Jlm
Loading...
Searching...
No Matches
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
12
13namespace jlm::llvm
14{
15
46{
47public:
48 ~IOBarrierOperation() noexcept override;
49
50 explicit IOBarrierOperation(const std::shared_ptr<const rvsdg::Type> & type)
51 : SimpleOperation({ type, IOStateType::Create() }, { 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::Node & node) noexcept
71 {
73 const auto input = node.input(0);
74 return *input;
75 }
76
77 [[nodiscard]] static rvsdg::Input &
78 getIOStateInput(const rvsdg::Node & node) noexcept
79 {
81 const auto input = node.input(1);
82 JLM_ASSERT(rvsdg::is<IOStateType>(input->Type()));
83 return *input;
84 }
85
86 static rvsdg::SimpleNode &
88 {
89 return rvsdg::CreateOpNode<IOBarrierOperation>({ &value, &ioState }, value.Type());
90 }
91};
92
93}
94
95#endif // JLM_LLVM_IR_OPERATORS_IOBARRIER_HPP
static rvsdg::Input & getIOStateInput(const rvsdg::Node &node) noexcept
Definition IOBarrier.hpp:78
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
static rvsdg::SimpleNode & createNode(rvsdg::Output &value, rvsdg::Output &ioState)
Definition IOBarrier.hpp:87
~IOBarrierOperation() noexcept override
static rvsdg::Input & BarredInput(const rvsdg::Node &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.
NodeType * TryGetOwnerNode(const rvsdg::Input &input) noexcept
Checks if this is an input to a node of specified type.
Definition node.hpp:872