Jlm
IOBarrier.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2025 Nico Reißmann <nico.reissmann@gmail.com>
3  * See COPYING for terms of redistribution.
4  */
5 
6 #ifndef JLM_LLVM_IR_OPERATORS_IOBARRIER_HPP
7 #define JLM_LLVM_IR_OPERATORS_IOBARRIER_HPP
8 
9 #include <jlm/llvm/ir/types.hpp>
10 #include <jlm/rvsdg/operation.hpp>
12 
13 namespace jlm::llvm
14 {
15 
46 {
47 public:
48  ~IOBarrierOperation() noexcept override;
49 
50  explicit IOBarrierOperation(const std::shared_ptr<const rvsdg::Type> & type)
52  {}
53 
54  [[nodiscard]] const std::shared_ptr<const rvsdg::Type> &
55  Type() const noexcept
56  {
57  return result(0);
58  }
59 
60  bool
61  operator==(const Operation & other) const noexcept override;
62 
63  std::string
64  debug_string() const override;
65 
66  std::unique_ptr<Operation>
67  copy() const override;
68 
69  [[nodiscard]] static rvsdg::Input &
70  BarredInput(const rvsdg::SimpleNode & node) noexcept
71  {
72  JLM_ASSERT(rvsdg::is<IOBarrierOperation>(&node));
73  const auto input = node.input(0);
74  return *input;
75  }
76 
77  static rvsdg::SimpleNode &
79  {
80  return rvsdg::CreateOpNode<IOBarrierOperation>({ &value, &ioState }, value.Type());
81  }
82 };
83 
84 }
85 
86 #endif // JLM_LLVM_IR_OPERATORS_IOBARRIER_HPP
const std::shared_ptr< const rvsdg::Type > & Type() const noexcept
Definition: IOBarrier.hpp:55
std::string debug_string() const override
Definition: IOBarrier.cpp:21
bool operator==(const Operation &other) const noexcept override
Definition: IOBarrier.cpp:14
~IOBarrierOperation() noexcept override
static rvsdg::SimpleNode & createNode(rvsdg::Output &value, rvsdg::Output &ioState)
Definition: IOBarrier.hpp:78
static rvsdg::Input & BarredInput(const rvsdg::SimpleNode &node) noexcept
Definition: IOBarrier.hpp:70
std::unique_ptr< Operation > copy() const override
Definition: IOBarrier.cpp:27
static std::shared_ptr< const IOStateType > Create()
Definition: types.cpp:343
const std::shared_ptr< const rvsdg::Type > & Type() const noexcept
Definition: node.hpp:366
const std::shared_ptr< const rvsdg::Type > & result(size_t index) const noexcept
Definition: operation.cpp:36
SimpleOperation(std::vector< std::shared_ptr< const jlm::rvsdg::Type >> operands, std::vector< std::shared_ptr< const jlm::rvsdg::Type >> results)
Definition: operation.hpp:61
#define JLM_ASSERT(x)
Definition: common.hpp:16
Global memory state passed between functions.
static std::string type(const Node *n)
Definition: view.cpp:255