Mercurial > hg > CbC > CbC_llvm
comparison include/llvm/IR/BasicBlock.h @ 77:54457678186b LLVM3.6
LLVM 3.6
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 08 Sep 2014 22:06:00 +0900 |
parents | 95c75e76d11b |
children | 60c9769439b8 |
comparison
equal
deleted
inserted
replaced
34:e874dbf0ad9d | 77:54457678186b |
---|---|
21 #include "llvm/Support/CBindingWrapping.h" | 21 #include "llvm/Support/CBindingWrapping.h" |
22 #include "llvm/Support/DataTypes.h" | 22 #include "llvm/Support/DataTypes.h" |
23 | 23 |
24 namespace llvm { | 24 namespace llvm { |
25 | 25 |
26 class CallInst; | |
26 class LandingPadInst; | 27 class LandingPadInst; |
27 class TerminatorInst; | 28 class TerminatorInst; |
28 class LLVMContext; | 29 class LLVMContext; |
29 class BlockAddress; | 30 class BlockAddress; |
30 | 31 |
88 /// | 89 /// |
89 /// If the function parameter is specified, the basic block is automatically | 90 /// If the function parameter is specified, the basic block is automatically |
90 /// inserted at either the end of the function (if InsertBefore is null), or | 91 /// inserted at either the end of the function (if InsertBefore is null), or |
91 /// before the specified basic block. | 92 /// before the specified basic block. |
92 explicit BasicBlock(LLVMContext &C, const Twine &Name = "", | 93 explicit BasicBlock(LLVMContext &C, const Twine &Name = "", |
93 Function *Parent = 0, BasicBlock *InsertBefore = 0); | 94 Function *Parent = nullptr, |
95 BasicBlock *InsertBefore = nullptr); | |
94 public: | 96 public: |
95 /// \brief Get the context in which this basic block lives. | 97 /// \brief Get the context in which this basic block lives. |
96 LLVMContext &getContext() const; | 98 LLVMContext &getContext() const; |
97 | 99 |
98 /// Instruction iterators... | 100 /// Instruction iterators... |
105 /// | 107 /// |
106 /// If the Parent parameter is specified, the basic block is automatically | 108 /// If the Parent parameter is specified, the basic block is automatically |
107 /// inserted at either the end of the function (if InsertBefore is 0), or | 109 /// inserted at either the end of the function (if InsertBefore is 0), or |
108 /// before the specified basic block. | 110 /// before the specified basic block. |
109 static BasicBlock *Create(LLVMContext &Context, const Twine &Name = "", | 111 static BasicBlock *Create(LLVMContext &Context, const Twine &Name = "", |
110 Function *Parent = 0,BasicBlock *InsertBefore = 0) { | 112 Function *Parent = nullptr, |
113 BasicBlock *InsertBefore = nullptr) { | |
111 return new BasicBlock(Context, Name, Parent, InsertBefore); | 114 return new BasicBlock(Context, Name, Parent, InsertBefore); |
112 } | 115 } |
113 ~BasicBlock(); | 116 ~BasicBlock(); |
114 | 117 |
115 /// \brief Return the enclosing method, or null if none. | 118 /// \brief Return the enclosing method, or null if none. |
116 const Function *getParent() const { return Parent; } | 119 const Function *getParent() const { return Parent; } |
117 Function *getParent() { return Parent; } | 120 Function *getParent() { return Parent; } |
121 | |
122 const DataLayout *getDataLayout() const; | |
118 | 123 |
119 /// \brief Returns the terminator instruction if the block is well formed or | 124 /// \brief Returns the terminator instruction if the block is well formed or |
120 /// null if the block is not well formed. | 125 /// null if the block is not well formed. |
121 TerminatorInst *getTerminator(); | 126 TerminatorInst *getTerminator(); |
122 const TerminatorInst *getTerminator() const; | 127 const TerminatorInst *getTerminator() const; |
128 | |
129 /// \brief Returns the call instruction marked 'musttail' prior to the | |
130 /// terminating return instruction of this basic block, if such a call is | |
131 /// present. Otherwise, returns null. | |
132 CallInst *getTerminatingMustTailCall(); | |
133 const CallInst *getTerminatingMustTailCall() const { | |
134 return const_cast<BasicBlock *>(this)->getTerminatingMustTailCall(); | |
135 } | |
123 | 136 |
124 /// \brief Returns a pointer to the first instruction in this block that is | 137 /// \brief Returns a pointer to the first instruction in this block that is |
125 /// not a PHINode instruction. | 138 /// not a PHINode instruction. |
126 /// | 139 /// |
127 /// When adding instructions to the beginning of the basic block, they should | 140 /// When adding instructions to the beginning of the basic block, they should |
167 | 180 |
168 /// \brief Unlink this basic block from its current function and insert it | 181 /// \brief Unlink this basic block from its current function and insert it |
169 /// right after \p MovePos in the function \p MovePos lives in. | 182 /// right after \p MovePos in the function \p MovePos lives in. |
170 void moveAfter(BasicBlock *MovePos); | 183 void moveAfter(BasicBlock *MovePos); |
171 | 184 |
172 | 185 /// \brief Insert unlinked basic block into a function. |
173 /// \brief Return this block if it has a single predecessor block. Otherwise | 186 /// |
174 /// return a null pointer. | 187 /// Inserts an unlinked basic block into \c Parent. If \c InsertBefore is |
188 /// provided, inserts before that basic block, otherwise inserts at the end. | |
189 /// | |
190 /// \pre \a getParent() is \c nullptr. | |
191 void insertInto(Function *Parent, BasicBlock *InsertBefore = nullptr); | |
192 | |
193 /// \brief Return the predecessor of this block if it has a single predecessor | |
194 /// block. Otherwise return a null pointer. | |
175 BasicBlock *getSinglePredecessor(); | 195 BasicBlock *getSinglePredecessor(); |
176 const BasicBlock *getSinglePredecessor() const { | 196 const BasicBlock *getSinglePredecessor() const { |
177 return const_cast<BasicBlock*>(this)->getSinglePredecessor(); | 197 return const_cast<BasicBlock*>(this)->getSinglePredecessor(); |
178 } | 198 } |
179 | 199 |
180 /// \brief Return this block if it has a unique predecessor block. Otherwise return a null pointer. | 200 /// \brief Return the predecessor of this block if it has a unique predecessor |
201 /// block. Otherwise return a null pointer. | |
181 /// | 202 /// |
182 /// Note that unique predecessor doesn't mean single edge, there can be | 203 /// Note that unique predecessor doesn't mean single edge, there can be |
183 /// multiple edges from the unique predecessor to this block (for example a | 204 /// multiple edges from the unique predecessor to this block (for example a |
184 /// switch statement with multiple cases having the same destination). | 205 /// switch statement with multiple cases having the same destination). |
185 BasicBlock *getUniquePredecessor(); | 206 BasicBlock *getUniquePredecessor(); |