LLVM: lib/Transforms/ObjCARC/PtrState.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef LLVM_LIB_TRANSFORMS_OBJCARC_PTRSTATE_H
17#define LLVM_LIB_TRANSFORMS_OBJCARC_PTRSTATE_H
18
22
23namespace llvm {
24
30
32
35class ProvenanceAnalysis;
36
37
38
39
40
49
51
52
53
54
56
57
58
59
60
61
62
63
64
65
66
67
69
70
72
73
74
76
77
78
80
81
82
84
85
86
88
90
92
93
94
96};
97
98
99
101protected:
102
104
105
106
108
109
111
112
114
116
117public:
119
121
123
125 RRI.IsTailCallRelease = NewValue;
126 }
127
129 return RRI.ReleaseMetadata != nullptr;
130 }
131
133
135
137
139 RRI.CFGHazardAfflicted = NewValue;
140 }
141
144
146
148
150
152
155
157
159
161
163
165};
166
169
170
171
173
174
175
176
177
178
179
181
186};
187
190
191
192
194
195
196
197
199
202
206};
207
208}
209
210}
211
212#endif
This file defines the SmallPtrSet class.
LLVM Basic Block Representation.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
LLVM Value Representation.
A cache of MDKinds used by various ARC optimizations.
This class summarizes several per-pointer runtime properties which are propagated through the flow gr...
Definition PtrState.h:100
bool KnownPositiveRefCount
True if the reference count is known to be incremented.
Definition PtrState.h:103
unsigned char Seq
The current position in the sequence.
Definition PtrState.h:110
void SetCFGHazardAfflicted(const bool NewValue)
Definition PtrState.h:138
Sequence GetSeq() const
Definition PtrState.h:149
RRInfo RRI
Unidirectional information about the current sequence.
Definition PtrState.h:113
void ClearReverseInsertPts()
Definition PtrState.h:160
void SetKnownPositiveRefCount()
bool IsTailCallRelease() const
Definition PtrState.h:122
bool HasKnownPositiveRefCount() const
Definition PtrState.h:145
void InsertReverseInsertPt(Instruction *I)
Definition PtrState.h:158
bool HasReverseInsertPts() const
Definition PtrState.h:162
const RRInfo & GetRRInfo() const
Definition PtrState.h:164
void SetTailCallRelease(const bool NewValue)
Definition PtrState.h:124
void ClearKnownPositiveRefCount()
bool IsCFGHazardAfflicted() const
Definition PtrState.h:136
const MDNode * GetReleaseMetadata() const
Definition PtrState.h:132
void SetReleaseMetadata(MDNode *NewValue)
Definition PtrState.h:134
void InsertCall(Instruction *I)
Definition PtrState.h:156
void ResetSequenceProgress(Sequence NewSeq)
PtrState()
Definition PtrState.h:115
void SetSeq(Sequence NewSeq)
void SetKnownSafe(const bool NewValue)
Definition PtrState.h:120
void ClearSequenceProgress()
Definition PtrState.h:151
bool IsKnownSafe() const
Definition PtrState.h:118
bool Partial
True if we've seen an opportunity for partial RR elimination, such as pushing calls into a CFG triang...
Definition PtrState.h:107
bool IsTrackingImpreciseReleases() const
Definition PtrState.h:128
This class implements an extremely fast bulk output stream that can only output to a stream.
raw_ostream & operator<<(raw_ostream &OS, const ARCInstKind Class)
ARCInstKind
Equivalence classes of instructions in the ARC Model.
Sequence
A sequence of states that a pointer may go through in which an objc_retain and objc_release are actua...
Definition PtrState.h:41
@ S_None
Definition PtrState.h:42
@ S_CanRelease
foo(x) – x could possibly see a ref count decrement.
Definition PtrState.h:44
@ S_Use
any use of x.
Definition PtrState.h:45
@ S_Retain
objc_retain(x).
Definition PtrState.h:43
@ S_Stop
code motion is stopped.
Definition PtrState.h:46
@ S_MovableRelease
objc_release(x), !clang.imprecise_release.
Definition PtrState.h:47
This is an optimization pass for GlobalISel generic memory operations.
bool HandlePotentialAlterRefCount(Instruction *Inst, const Value *Ptr, ProvenanceAnalysis &PA, ARCInstKind Class)
bool InitBottomUp(ARCMDKindCache &Cache, Instruction *I)
(Re-)Initialize this bottom up pointer returning true if we detected a pointer with nested releases.
BottomUpPtrState()=default
bool MatchWithRetain()
Return true if this set of releases can be paired with a release.
void HandlePotentialUse(BasicBlock *BB, Instruction *Inst, const Value *Ptr, ProvenanceAnalysis &PA, ARCInstKind Class)
Unidirectional information about either a retain-decrement-use-release sequence or release-use-decrem...
Definition PtrState.h:55
bool KnownSafe
After an objc_retain, the reference count of the referenced object is known to be positive.
Definition PtrState.h:68
SmallPtrSet< Instruction *, 2 > Calls
For a top-down sequence, the set of objc_retains or objc_retainBlocks.
Definition PtrState.h:79
MDNode * ReleaseMetadata
If the Calls are objc_release calls and they all have a clang.imprecise_release tag,...
Definition PtrState.h:75
bool CFGHazardAfflicted
If this is true, we cannot perform code motion but can still remove retain/release pairs.
Definition PtrState.h:87
bool IsTailCallRelease
True of the objc_release calls are all marked with the "tail" keyword.
Definition PtrState.h:71
SmallPtrSet< Instruction *, 2 > ReverseInsertPts
The set of optimal insert positions for moving calls in the opposite sequence.
Definition PtrState.h:83
TopDownPtrState()=default
bool MatchWithRelease(ARCMDKindCache &Cache, Instruction *Release)
Return true if this set of retains can be paired with the given release.
bool InitTopDown(ARCInstKind Kind, Instruction *I)
(Re-)Initialize this bottom up pointer returning true if we detected a pointer with nested releases.
bool HandlePotentialAlterRefCount(Instruction *Inst, const Value *Ptr, ProvenanceAnalysis &PA, ARCInstKind Class, const BundledRetainClaimRVs &BundledRVs)
void HandlePotentialUse(Instruction *Inst, const Value *Ptr, ProvenanceAnalysis &PA, ARCInstKind Class)