13
13
#ifndef LLVM_IR_BASICBLOCK_H
14
14
#define LLVM_IR_BASICBLOCK_H
15
15
16
- #include " llvm/Support/Compiler.h"
17
16
#include " llvm-c/Types.h"
18
17
#include " llvm/ADT/DenseMap.h"
19
18
#include " llvm/ADT/Twine.h"
25
24
#include " llvm/IR/Instruction.h"
26
25
#include " llvm/IR/SymbolTableListTraits.h"
27
26
#include " llvm/IR/Value.h"
27
+ #include " llvm/Support/Compiler.h"
28
28
#include < cassert>
29
29
#include < cstddef>
30
30
#include < iterator>
@@ -138,7 +138,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
138
138
LLVM_ABI void insertDbgRecordAfter (DbgRecord *DR, Instruction *I);
139
139
140
140
// / Insert a DbgRecord into a block at the position given by \p Here.
141
- LLVM_ABI void insertDbgRecordBefore (DbgRecord *DR, InstListType::iterator Here);
141
+ LLVM_ABI void insertDbgRecordBefore (DbgRecord *DR,
142
+ InstListType::iterator Here);
142
143
143
144
// / Eject any debug-info trailing at the end of a block. DbgRecords can
144
145
// / transiently be located "off the end" of a block if the blocks terminator
@@ -151,8 +152,9 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
151
152
// / happens in RemoveDIs debug-info mode, some special patching-up needs to
152
153
// / occur: inserting into the middle of a sequence of dbg.value intrinsics
153
154
// / does not have an equivalent with DbgRecords.
154
- LLVM_ABI void reinsertInstInDbgRecords (Instruction *I,
155
- std::optional<DbgRecord::self_iterator> Pos);
155
+ LLVM_ABI void
156
+ reinsertInstInDbgRecords (Instruction *I,
157
+ std::optional<DbgRecord::self_iterator> Pos);
156
158
157
159
private:
158
160
void setParent (Function *parent);
@@ -163,8 +165,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
163
165
// / inserted at either the end of the function (if InsertBefore is null), or
164
166
// / before the specified basic block.
165
167
LLVM_ABI explicit BasicBlock (LLVMContext &C, const Twine &Name = " " ,
166
- Function *Parent = nullptr ,
167
- BasicBlock *InsertBefore = nullptr );
168
+ Function *Parent = nullptr ,
169
+ BasicBlock *InsertBefore = nullptr );
168
170
169
171
public:
170
172
BasicBlock (const BasicBlock &) = delete ;
@@ -228,16 +230,16 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
228
230
LLVM_ABI const Module *getModule () const ;
229
231
Module *getModule () {
230
232
return const_cast <Module *>(
231
- static_cast <const BasicBlock *>(this )->getModule ());
233
+ static_cast <const BasicBlock *>(this )->getModule ());
232
234
}
233
235
234
236
// / Get the data layout of the module this basic block belongs to.
235
237
// /
236
238
// / Requires the basic block to have a parent module.
237
239
LLVM_ABI const DataLayout &getDataLayout () const ;
238
240
239
- // / Returns the terminator instruction if the block is well formed or null
240
- // / if the block is not well formed.
241
+ // / Returns the terminator instruction if the block is well formed or
242
+ // / null if the block is not well formed.
241
243
const Instruction *getTerminator () const LLVM_READONLY {
242
244
if (InstList.empty () || !InstList.back ().isTerminator ())
243
245
return nullptr ;
@@ -284,11 +286,11 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
284
286
// /
285
287
// / Deprecated in favour of getFirstNonPHIIt, which returns an iterator that
286
288
// / preserves some debugging information.
287
- LLVM_ABI LLVM_DEPRECATED (" Use iterators as instruction positions" , " getFirstNonPHIIt" )
288
- const Instruction *getFirstNonPHI() const ;
289
+ LLVM_ABI LLVM_DEPRECATED (" Use iterators as instruction positions" ,
290
+ " getFirstNonPHIIt" ) const
291
+ Instruction *getFirstNonPHI() const ;
289
292
LLVM_ABI LLVM_DEPRECATED (" Use iterators as instruction positions instead" ,
290
- " getFirstNonPHIIt" )
291
- Instruction *getFirstNonPHI();
293
+ " getFirstNonPHIIt" ) Instruction *getFirstNonPHI();
292
294
293
295
// / Returns an iterator to the first instruction in this block that is not a
294
296
// / PHINode instruction.
@@ -352,7 +354,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
352
354
// / Returns the first potential AsynchEH faulty instruction
353
355
// / currently it checks for loads/stores (which may dereference a null
354
356
// / pointer) and calls/invokes (which may propagate exceptions)
355
- LLVM_ABI const Instruction* getFirstMayFaultInst () const ;
357
+ LLVM_ABI const Instruction * getFirstMayFaultInst () const ;
356
358
Instruction* getFirstMayFaultInst () {
357
359
return const_cast <Instruction*>(
358
360
static_cast <const BasicBlock*>(this )->getFirstMayFaultInst ());
@@ -361,7 +363,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
361
363
// / Return a const iterator range over the instructions in the block, skipping
362
364
// / any debug instructions. Skip any pseudo operations as well if \c
363
365
// / SkipPseudoOp is true.
364
- LLVM_ABI iterator_range<filter_iterator<BasicBlock::const_iterator,
366
+ LLVM_ABI
367
+ iterator_range<filter_iterator<BasicBlock::const_iterator,
365
368
std::function<bool (const Instruction &)>>>
366
369
instructionsWithoutDebug (bool SkipPseudoOp = true ) const ;
367
370
@@ -373,7 +376,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
373
376
instructionsWithoutDebug (bool SkipPseudoOp = true );
374
377
375
378
// / Return the size of the basic block ignoring debug instructions
376
- LLVM_ABI filter_iterator<BasicBlock::const_iterator,
379
+ LLVM_ABI
380
+ filter_iterator<BasicBlock::const_iterator,
377
381
std::function<bool (const Instruction &)>>::difference_type
378
382
sizeWithoutDebug () const ;
379
383
@@ -402,7 +406,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
402
406
// / provided, inserts before that basic block, otherwise inserts at the end.
403
407
// /
404
408
// / \pre \a getParent() is \c nullptr.
405
- LLVM_ABI void insertInto (Function *Parent, BasicBlock *InsertBefore = nullptr );
409
+ LLVM_ABI void insertInto (Function *Parent,
410
+ BasicBlock *InsertBefore = nullptr );
406
411
407
412
// / Return the predecessor of this block if it has a single predecessor
408
413
// / block. Otherwise return a null pointer.
@@ -453,8 +458,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
453
458
// / Print the basic block to an output stream with an optional
454
459
// / AssemblyAnnotationWriter.
455
460
LLVM_ABI void print (raw_ostream &OS, AssemblyAnnotationWriter *AAW = nullptr ,
456
- bool ShouldPreserveUseListOrder = false ,
457
- bool IsForDebug = false ) const ;
461
+ bool ShouldPreserveUseListOrder = false ,
462
+ bool IsForDebug = false ) const ;
458
463
459
464
// ===--------------------------------------------------------------------===//
460
465
// / Instruction iterator methods
@@ -608,7 +613,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
608
613
// / If \p KeepOneInputPHIs is true then don't remove PHIs that are left with
609
614
// / zero or one incoming values, and don't simplify PHIs with all incoming
610
615
// / values the same.
611
- LLVM_ABI void removePredecessor (BasicBlock *Pred, bool KeepOneInputPHIs = false );
616
+ LLVM_ABI void removePredecessor (BasicBlock *Pred,
617
+ bool KeepOneInputPHIs = false );
612
618
613
619
LLVM_ABI bool canSplitPredecessors () const ;
614
620
@@ -631,7 +637,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
631
637
// / Also note that this doesn't preserve any passes. To split blocks while
632
638
// / keeping loop information consistent, use the SplitBlock utility function.
633
639
LLVM_ABI BasicBlock *splitBasicBlock (iterator I, const Twine &BBName = " " ,
634
- bool Before = false );
640
+ bool Before = false );
635
641
BasicBlock *splitBasicBlock (Instruction *I, const Twine &BBName = " " ,
636
642
bool Before = false ) {
637
643
return splitBasicBlock (I->getIterator (), BBName, Before);
@@ -654,7 +660,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
654
660
// / Also note that this doesn't preserve any passes. To split blocks while
655
661
// / keeping loop information consistent, use the SplitBlockBefore utility
656
662
// / function.
657
- LLVM_ABI BasicBlock *splitBasicBlockBefore (iterator I, const Twine &BBName = " " );
663
+ LLVM_ABI BasicBlock *splitBasicBlockBefore (iterator I,
664
+ const Twine &BBName = " " );
658
665
BasicBlock *splitBasicBlockBefore (Instruction *I, const Twine &BBName = " " ) {
659
666
return splitBasicBlockBefore (I->getIterator (), BBName);
660
667
}
@@ -678,12 +685,13 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
678
685
// / Transfer a range of instructions that belong to \p FromBB from \p
679
686
// / FromBeginIt to \p FromEndIt, to this basic block at \p ToIt.
680
687
LLVM_ABI void splice (BasicBlock::iterator ToIt, BasicBlock *FromBB,
681
- BasicBlock::iterator FromBeginIt,
682
- BasicBlock::iterator FromEndIt);
688
+ BasicBlock::iterator FromBeginIt,
689
+ BasicBlock::iterator FromEndIt);
683
690
684
691
// / Erases a range of instructions from \p FromIt to (not including) \p ToIt.
685
692
// / \Returns \p ToIt.
686
- LLVM_ABI BasicBlock::iterator erase (BasicBlock::iterator FromIt, BasicBlock::iterator ToIt);
693
+ LLVM_ABI BasicBlock::iterator erase (BasicBlock::iterator FromIt,
694
+ BasicBlock::iterator ToIt);
687
695
688
696
// / Returns true if there are any uses of this basic block other than
689
697
// / direct branches, switches, etc. to it.
0 commit comments