Jlm
Loading...
Searching...
No Matches
basic-block.hpp
Go to the documentation of this file.
1/*
2 * Copyright 2013 2014 2015 Nico Reißmann <nico.reissmann@gmail.com>
3 * See COPYING for terms of redistribution.
4 */
5
6#ifndef JLM_LLVM_IR_BASIC_BLOCK_HPP
7#define JLM_LLVM_IR_BASIC_BLOCK_HPP
8
10#include <jlm/llvm/ir/cfg.hpp>
11#include <jlm/llvm/ir/tac.hpp>
12
13namespace jlm::llvm
14{
15
16class BasicBlock final : public ControlFlowGraphNode
17{
18public:
19 ~BasicBlock() noexcept override;
20
21private:
25
26 BasicBlock(const BasicBlock &) = delete;
27
28 BasicBlock(BasicBlock &&) = delete;
29
31 operator=(const BasicBlock &) = delete;
32
34 operator=(BasicBlock &&) = delete;
35
36public:
38 tacs() const noexcept
39 {
40 return tacs_;
41 }
42
44 tacs() noexcept
45 {
46 return tacs_;
47 }
48
50 begin() const noexcept
51 {
52 return tacs_.begin();
53 }
54
56 rbegin() const noexcept
57 {
58 return tacs_.rbegin();
59 }
60
62 end() const noexcept
63 {
64 return tacs_.end();
65 }
66
68 rend() const noexcept
69 {
70 return tacs_.rend();
71 }
72
73 inline size_t
74 ntacs() const noexcept
75 {
76 return tacs_.ntacs();
77 }
78
79 [[nodiscard]] ThreeAddressCode *
80 first() const noexcept
81 {
82 return tacs_.first();
83 }
84
85 [[nodiscard]] ThreeAddressCode *
86 last() const noexcept
87 {
88 return tacs_.last();
89 }
90
91 inline void
93 {
95 }
96
97 inline void
99 {
101 }
102
104 append_first(std::unique_ptr<llvm::ThreeAddressCode> tac)
105 {
106 tacs_.append_first(std::move(tac));
107 return tacs_.first();
108 }
109
110 void
112 {
113 for (auto it = tacs.rbegin(); it != tacs.rend(); it++)
114 append_first(std::move(*it));
115 tacs.clear();
116 }
117
118 void
123
125 append_last(std::unique_ptr<llvm::ThreeAddressCode> tac)
126 {
127 tacs_.append_last(std::move(tac));
128 return tacs_.last();
129 }
130
131 void
133 {
134 for (auto & tac : tacs)
135 append_last(std::move(tac));
136 tacs.clear();
137 }
138
142 std::unique_ptr<llvm::ThreeAddressCode> tac)
143 {
144 return tacs_.insert_before(it, std::move(tac));
145 }
146
147 void
149 {
150 for (auto & tac : tv)
151 tacs_.insert_before(it, std::move(tac));
152 tv.clear();
153 }
154
161 bool
162 HasSsaPhiOperation() const;
163
165 insert_before_branch(std::unique_ptr<llvm::ThreeAddressCode> tac);
166
167 void
169
170 static BasicBlock *
172
173private:
175};
176
177}
178
179#endif
BasicBlock(const BasicBlock &)=delete
llvm::ThreeAddressCode * append_last(std::unique_ptr< llvm::ThreeAddressCode > tac)
void append_first(tacsvector_t &tacs)
ThreeAddressCodeList::const_reverse_iterator rend() const noexcept
ThreeAddressCodeList::const_iterator end() const noexcept
llvm::ThreeAddressCode * insert_before(const ThreeAddressCodeList::const_iterator &it, std::unique_ptr< llvm::ThreeAddressCode > tac)
ThreeAddressCodeList tacs_
~BasicBlock() noexcept override
BasicBlock & operator=(BasicBlock &&)=delete
size_t ntacs() const noexcept
void append_last(tacsvector_t &tacs)
void insert_before(const ThreeAddressCodeList::const_iterator &it, tacsvector_t &tv)
ThreeAddressCode * last() const noexcept
const ThreeAddressCodeList & tacs() const noexcept
llvm::ThreeAddressCode * insert_before_branch(std::unique_ptr< llvm::ThreeAddressCode > tac)
bool HasSsaPhiOperation() const
ThreeAddressCodeList & tacs() noexcept
void append_first(ThreeAddressCodeList &tl)
BasicBlock(BasicBlock &&)=delete
static BasicBlock * create(ControlFlowGraph &cfg)
BasicBlock & operator=(const BasicBlock &)=delete
ThreeAddressCode * first() const noexcept
ThreeAddressCodeList::const_iterator begin() const noexcept
ThreeAddressCodeList::const_reverse_iterator rbegin() const noexcept
llvm::ThreeAddressCode * append_first(std::unique_ptr< llvm::ThreeAddressCode > tac)
ControlFlowGraph & cfg() const noexcept
Definition cfg-node.hpp:106
const_iterator end() const noexcept
Definition tac.hpp:251
const_iterator begin() const noexcept
Definition tac.hpp:239
std::list< ThreeAddressCode * >::const_iterator const_iterator
Definition tac.hpp:207
void append_first(std::unique_ptr< llvm::ThreeAddressCode > tac)
Definition tac.hpp:281
const_reverse_iterator rbegin() const noexcept
Definition tac.hpp:245
std::list< ThreeAddressCode * >::const_reverse_iterator const_reverse_iterator
Definition tac.hpp:208
ThreeAddressCode * insert_before(const const_iterator &it, std::unique_ptr< llvm::ThreeAddressCode > tac)
Definition tac.hpp:263
size_t ntacs() const noexcept
Definition tac.hpp:294
ThreeAddressCode * last() const noexcept
Definition tac.hpp:306
void append_last(std::unique_ptr< llvm::ThreeAddressCode > tac)
Definition tac.hpp:275
const_reverse_iterator rend() const noexcept
Definition tac.hpp:257
ThreeAddressCode * first() const noexcept
Definition tac.hpp:300
Global memory state passed between functions.
std::vector< std::unique_ptr< llvm::ThreeAddressCode > > tacsvector_t
Definition tac.hpp:202