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 ;
@@ -236,8 +238,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
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 ;
@@ -285,11 +287,11 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
285
287
// /
286
288
// / Deprecated in favour of getFirstNonPHIIt, which returns an iterator that
287
289
// / preserves some debugging information.
288
- LLVM_ABI LLVM_DEPRECATED (" Use iterators as instruction positions" , " getFirstNonPHIIt" )
289
- const Instruction *getFirstNonPHI() const ;
290
+ LLVM_ABI LLVM_DEPRECATED (" Use iterators as instruction positions" ,
291
+ " getFirstNonPHIIt" ) const
292
+ Instruction *getFirstNonPHI() const ;
290
293
LLVM_ABI LLVM_DEPRECATED (" Use iterators as instruction positions instead" ,
291
- " getFirstNonPHIIt" )
292
- Instruction *getFirstNonPHI();
294
+ " getFirstNonPHIIt" ) Instruction *getFirstNonPHI();
293
295
294
296
// / Returns an iterator to the first instruction in this block that is not a
295
297
// / PHINode instruction.
@@ -363,7 +365,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
363
365
// / Return a const iterator range over the instructions in the block, skipping
364
366
// / any debug instructions. Skip any pseudo operations as well if \c
365
367
// / SkipPseudoOp is true.
366
- LLVM_ABI iterator_range<filter_iterator<BasicBlock::const_iterator,
368
+ LLVM_ABI
369
+ iterator_range<filter_iterator<BasicBlock::const_iterator,
367
370
std::function<bool (const Instruction &)>>>
368
371
instructionsWithoutDebug (bool SkipPseudoOp = true ) const ;
369
372
@@ -375,7 +378,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
375
378
instructionsWithoutDebug (bool SkipPseudoOp = true );
376
379
377
380
// / Return the size of the basic block ignoring debug instructions
378
- LLVM_ABI filter_iterator<BasicBlock::const_iterator,
381
+ LLVM_ABI
382
+ filter_iterator<BasicBlock::const_iterator,
379
383
std::function<bool (const Instruction &)>>::difference_type
380
384
sizeWithoutDebug () const ;
381
385
@@ -404,7 +408,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
404
408
// / provided, inserts before that basic block, otherwise inserts at the end.
405
409
// /
406
410
// / \pre \a getParent() is \c nullptr.
407
- LLVM_ABI void insertInto (Function *Parent, BasicBlock *InsertBefore = nullptr );
411
+ LLVM_ABI void insertInto (Function *Parent,
412
+ BasicBlock *InsertBefore = nullptr );
408
413
409
414
// / Return the predecessor of this block if it has a single predecessor
410
415
// / block. Otherwise return a null pointer.
@@ -455,8 +460,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
455
460
// / Print the basic block to an output stream with an optional
456
461
// / AssemblyAnnotationWriter.
457
462
LLVM_ABI void print (raw_ostream &OS, AssemblyAnnotationWriter *AAW = nullptr ,
458
- bool ShouldPreserveUseListOrder = false ,
459
- bool IsForDebug = false ) const ;
463
+ bool ShouldPreserveUseListOrder = false ,
464
+ bool IsForDebug = false ) const ;
460
465
461
466
// ===--------------------------------------------------------------------===//
462
467
// / Instruction iterator methods
@@ -610,7 +615,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
610
615
// / If \p KeepOneInputPHIs is true then don't remove PHIs that are left with
611
616
// / zero or one incoming values, and don't simplify PHIs with all incoming
612
617
// / values the same.
613
- LLVM_ABI void removePredecessor (BasicBlock *Pred, bool KeepOneInputPHIs = false );
618
+ LLVM_ABI void removePredecessor (BasicBlock *Pred,
619
+ bool KeepOneInputPHIs = false );
614
620
615
621
LLVM_ABI bool canSplitPredecessors () const ;
616
622
@@ -633,7 +639,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
633
639
// / Also note that this doesn't preserve any passes. To split blocks while
634
640
// / keeping loop information consistent, use the SplitBlock utility function.
635
641
LLVM_ABI BasicBlock *splitBasicBlock (iterator I, const Twine &BBName = " " ,
636
- bool Before = false );
642
+ bool Before = false );
637
643
BasicBlock *splitBasicBlock (Instruction *I, const Twine &BBName = " " ,
638
644
bool Before = false ) {
639
645
return splitBasicBlock (I->getIterator (), BBName, Before);
@@ -656,7 +662,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
656
662
// / Also note that this doesn't preserve any passes. To split blocks while
657
663
// / keeping loop information consistent, use the SplitBlockBefore utility
658
664
// / function.
659
- LLVM_ABI BasicBlock *splitBasicBlockBefore (iterator I, const Twine &BBName = " " );
665
+ LLVM_ABI BasicBlock *splitBasicBlockBefore (iterator I,
666
+ const Twine &BBName = " " );
660
667
BasicBlock *splitBasicBlockBefore (Instruction *I, const Twine &BBName = " " ) {
661
668
return splitBasicBlockBefore (I->getIterator (), BBName);
662
669
}
@@ -680,12 +687,13 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
680
687
// / Transfer a range of instructions that belong to \p FromBB from \p
681
688
// / FromBeginIt to \p FromEndIt, to this basic block at \p ToIt.
682
689
LLVM_ABI void splice (BasicBlock::iterator ToIt, BasicBlock *FromBB,
683
- BasicBlock::iterator FromBeginIt, BasicBlock::iterator FromEndIt);
690
+ BasicBlock::iterator FromBeginIt,
691
+ BasicBlock::iterator FromEndIt);
684
692
685
693
// / Erases a range of instructions from \p FromIt to (not including) \p ToIt.
686
694
// / \Returns \p ToIt.
687
695
LLVM_ABI BasicBlock::iterator erase (BasicBlock::iterator FromIt,
688
- BasicBlock::iterator ToIt);
696
+ BasicBlock::iterator ToIt);
689
697
690
698
// / Returns true if there are any uses of this basic block other than
691
699
// / direct branches, switches, etc. to it.
0 commit comments