13
13
#ifndef SWIFT_SIL_BRANCHPROPAGATEDUSER_H
14
14
#define SWIFT_SIL_BRANCHPROPAGATEDUSER_H
15
15
16
+ #include " swift/Basic/LLVM.h"
16
17
#include " swift/SIL/SILBasicBlock.h"
17
18
#include " swift/SIL/SILInstruction.h"
18
19
#include " llvm/ADT/DenseMap.h"
@@ -27,68 +28,68 @@ namespace swift {
27
28
// / BranchPropagatedUser and friends break all such critical edges.
28
29
class BranchPropagatedUser {
29
30
using InnerTy = llvm::PointerIntPair<SILInstruction *, 1 >;
30
- InnerTy User ;
31
+ InnerTy user ;
31
32
32
33
public:
33
- BranchPropagatedUser (SILInstruction *I ) : User(I ) {
34
- assert (!isa<CondBranchInst>(I ));
34
+ BranchPropagatedUser (SILInstruction *inst ) : user(inst ) {
35
+ assert (!isa<CondBranchInst>(inst ));
35
36
}
36
37
37
- BranchPropagatedUser (CondBranchInst *I ) : User(I ) {}
38
+ BranchPropagatedUser (CondBranchInst *cbi ) : user(cbi ) {}
38
39
39
- BranchPropagatedUser (CondBranchInst *I , unsigned SuccessorIndex )
40
- : User(I, SuccessorIndex ) {
41
- assert (SuccessorIndex == CondBranchInst::TrueIdx ||
42
- SuccessorIndex == CondBranchInst::FalseIdx);
40
+ BranchPropagatedUser (CondBranchInst *cbi , unsigned successorIndex )
41
+ : user(cbi, successorIndex ) {
42
+ assert (successorIndex == CondBranchInst::TrueIdx ||
43
+ successorIndex == CondBranchInst::FalseIdx);
43
44
}
44
45
45
- BranchPropagatedUser (const BranchPropagatedUser &Other ) : User(Other.User ) {}
46
- BranchPropagatedUser &operator =(const BranchPropagatedUser &Other ) {
47
- User = Other. User ;
46
+ BranchPropagatedUser (const BranchPropagatedUser &other ) : user(other.user ) {}
47
+ BranchPropagatedUser &operator =(const BranchPropagatedUser &other ) {
48
+ user = other. user ;
48
49
return *this ;
49
50
}
50
51
51
- operator SILInstruction *() { return User .getPointer (); }
52
- operator const SILInstruction *() const { return User .getPointer (); }
52
+ operator SILInstruction *() { return user .getPointer (); }
53
+ operator const SILInstruction *() const { return user .getPointer (); }
53
54
54
- SILInstruction *getInst () const { return User .getPointer (); }
55
+ SILInstruction *getInst () const { return user .getPointer (); }
55
56
56
57
SILBasicBlock *getParent () const {
57
58
if (!isCondBranchUser ()) {
58
59
return getInst ()->getParent ();
59
60
}
60
61
61
- auto *CBI = cast<CondBranchInst>(getInst ());
62
- unsigned Number = getCondBranchSuccessorID ();
63
- if (Number == CondBranchInst::TrueIdx)
64
- return CBI ->getTrueBB ();
65
- return CBI ->getFalseBB ();
62
+ auto *cbi = cast<CondBranchInst>(getInst ());
63
+ unsigned number = getCondBranchSuccessorID ();
64
+ if (number == CondBranchInst::TrueIdx)
65
+ return cbi ->getTrueBB ();
66
+ return cbi ->getFalseBB ();
66
67
}
67
68
68
69
bool isCondBranchUser () const {
69
- return isa<CondBranchInst>(User .getPointer ());
70
+ return isa<CondBranchInst>(user .getPointer ());
70
71
}
71
72
72
73
unsigned getCondBranchSuccessorID () const {
73
74
assert (isCondBranchUser ());
74
- return User .getInt ();
75
+ return user .getInt ();
75
76
}
76
77
77
78
SILBasicBlock::iterator getIterator () const {
78
- return User .getPointer ()->getIterator ();
79
+ return user .getPointer ()->getIterator ();
79
80
}
80
81
81
82
void *getAsOpaqueValue () const {
82
- return llvm::PointerLikeTypeTraits<InnerTy>::getAsVoidPointer (User );
83
+ return llvm::PointerLikeTypeTraits<InnerTy>::getAsVoidPointer (user );
83
84
}
84
85
85
86
static BranchPropagatedUser getFromOpaqueValue (void *p) {
86
- InnerTy TmpUser =
87
+ InnerTy tmpUser =
87
88
llvm::PointerLikeTypeTraits<InnerTy>::getFromVoidPointer (p);
88
- if (auto *CBI = dyn_cast<CondBranchInst>(TmpUser .getPointer ())) {
89
- return BranchPropagatedUser (CBI, TmpUser .getInt ());
89
+ if (auto *cbi = dyn_cast<CondBranchInst>(tmpUser .getPointer ())) {
90
+ return BranchPropagatedUser (cbi, tmpUser .getInt ());
90
91
}
91
- return BranchPropagatedUser (TmpUser .getPointer ());
92
+ return BranchPropagatedUser (tmpUser .getPointer ());
92
93
}
93
94
94
95
enum {
0 commit comments