LLVM: include/llvm/Transforms/Utils/DebugSSAUpdater.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21#ifndef LLVM_TRANSFORMS_UTILS_DEBUGSSAUPDATER_H
22#define LLVM_TRANSFORMS_UTILS_DEBUGSSAUPDATER_H
23
32#include
33
34namespace llvm {
35
36
37
38
41
42
43
44
45
52
72
75 return true;
78 Other.Expression);
79 }
80
84
86};
87
88class DbgSSABlock;
89class DebugSSAUpdater;
90
91
92
113
119 PHI.print(OS);
120 return OS;
121}
122
123
125public:
128
131
135
140
142};
143
144
146public:
149
152
156
161
163};
164
166public:
170
171
173
176
180
184
188
192
196
200
201
204 "Only one PHI should exist per-block per-variable");
205 PHIList.emplace_back(this);
207 }
208
209
211};
212
213
214
218
219private:
220
221
222 AvailableValsTy AV;
223
224
225
227
229
230public:
231
232
237
239 for (auto &Block : BlockMap)
240 delete Block.second;
241 }
242
244 for (auto &Block : BlockMap)
245 delete Block.second;
246
247 if (InsertedPHIs)
248 InsertedPHIs->clear();
249 BlockMap.clear();
250 }
251
253
254
255
257 auto it = BlockMap.find(BB);
258 if (it == BlockMap.end()) {
259 BlockMap[BB] = new DbgSSABlock(*BB, *this);
260 it = BlockMap.find(BB);
261 }
262 return it->second;
263 }
264
265
266
268
269
270
272
273
274
276
277
278
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
302
303private:
305};
306
313
314
315
316
317
318
322 };
323
324public:
328
329private:
333};
334
335
336
337
338
341 OrigVariableValueRangeTable;
343
344public:
347 return OrigVariableValueRangeTable.contains(DVA) ||
348 OrigSingleLocVariableValueTable.contains(DVA);
349 }
351 return OrigSingleLocVariableValueTable.contains(DVA);
352 }
354 return OrigVariableValueRangeTable[DVA];
355 }
357 return OrigSingleLocVariableValueTable[DVA];
358 }
359
361};
362
363}
364
365#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file provides various utilities for inspecting and working with the control flow graph in LLVM I...
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM Basic Block Representation.
InstListType::iterator iterator
Instruction iterators...
Thin wrapper around a block successor iterator.
Definition DebugSSAUpdater.h:145
DbgSSABlockPredIterator(pred_iterator PredIt, DebugSSAUpdater &Updater)
Definition DebugSSAUpdater.h:150
DebugSSAUpdater & Updater
Definition DebugSSAUpdater.h:148
bool operator!=(const DbgSSABlockPredIterator &OtherIt) const
Definition DebugSSAUpdater.h:153
DbgSSABlockPredIterator & operator++()
Definition DebugSSAUpdater.h:157
pred_iterator PredIt
Definition DebugSSAUpdater.h:147
DbgSSABlock * operator*()
Thin wrapper around a block successor iterator.
Definition DebugSSAUpdater.h:124
DebugSSAUpdater & Updater
Definition DebugSSAUpdater.h:127
DbgSSABlock * operator*()
DbgSSABlockSuccIterator(succ_iterator SuccIt, DebugSSAUpdater &Updater)
Definition DebugSSAUpdater.h:129
succ_iterator SuccIt
Definition DebugSSAUpdater.h:126
bool operator!=(const DbgSSABlockSuccIterator &OtherIt) const
Definition DebugSSAUpdater.h:132
DbgSSABlockSuccIterator & operator++()
Definition DebugSSAUpdater.h:136
Definition DebugSSAUpdater.h:165
DebugSSAUpdater & Updater
Definition DebugSSAUpdater.h:168
iterator_range< DbgSSABlockPredIterator > predecessors()
Definition DebugSSAUpdater.h:185
DbgSSABlockSuccIterator succ_end()
Definition DebugSSAUpdater.h:193
SmallVector< DbgSSAPhi, 1 > PHIListT
Definition DebugSSAUpdater.h:169
DbgSSABlockPredIterator pred_end()
Definition DebugSSAUpdater.h:181
DbgSSABlockPredIterator pred_begin()
Definition DebugSSAUpdater.h:177
DbgSSABlockSuccIterator succ_begin()
Definition DebugSSAUpdater.h:189
PHIListT & phis()
SSAUpdater wishes to know what PHIs already exist in this block.
Definition DebugSSAUpdater.h:210
PHIListT PHIList
List of PHIs in this block.
Definition DebugSSAUpdater.h:172
BasicBlock & BB
Definition DebugSSAUpdater.h:167
DbgSSAPhi * newPHI()
SSAUpdater has requested a PHI: create that within this block record.
Definition DebugSSAUpdater.h:202
iterator_range< DbgSSABlockSuccIterator > successors()
Definition DebugSSAUpdater.h:197
DbgSSABlock(BasicBlock &BB, DebugSSAUpdater &Updater)
Definition DebugSSAUpdater.h:174
Represents the live-in definitions of a variable to a block with multiple predecessors.
Definition DebugSSAUpdater.h:93
SmallVector< std::pair< DbgSSABlock *, DbgValueDef >, 4 > IncomingValues
Definition DebugSSAUpdater.h:95
void addIncoming(DbgSSABlock *BB, DbgValueDef DV)
Definition DebugSSAUpdater.h:107
DbgSSABlock * getParent()
Definition DebugSSAUpdater.h:99
DbgSSAPhi(DbgSSABlock *ParentBlock)
Definition DebugSSAUpdater.h:97
void print(raw_ostream &OS) const
DbgSSABlock * ParentBlock
Definition DebugSSAUpdater.h:96
DbgValueDef getIncomingValue(size_t Idx)
Definition DebugSSAUpdater.h:104
unsigned getNumIncomingValues() const
Definition DebugSSAUpdater.h:100
DbgSSABlock * getIncomingBlock(size_t Idx)
Definition DebugSSAUpdater.h:101
Utility class used to find and store the live debug ranges for variables in a module.
Definition DebugSSAUpdater.h:339
DbgValueDef getSingleLoc(DebugVariableAggregate DVA)
Definition DebugSSAUpdater.h:356
ArrayRef< DbgRangeEntry > getVariableRanges(DebugVariableAggregate DVA)
Definition DebugSSAUpdater.h:353
void printValues(DebugVariableAggregate DVA, raw_ostream &OS)
void addVariable(Function *F, DebugVariableAggregate DVA)
bool hasSingleLocEntry(DebugVariableAggregate DVA) const
Definition DebugSSAUpdater.h:350
bool hasVariableEntry(DebugVariableAggregate DVA) const
Definition DebugSSAUpdater.h:346
Record of a variable value-assignment, aka a non instruction representation of the dbg....
LLVM_ABI bool isKillLocation() const
bool isAddressOfVariable() const
Does this describe the address of a local variable.
DIExpression * getExpression() const
Metadata * getRawLocation() const
Returns the metadata operand for the first location description.
Class used to determine the live ranges of debug variables in IR using SSA construction (via the SSAU...
Definition DebugSSAUpdater.h:215
DebugSSAUpdater(SmallVectorImpl< DbgSSAPhi * > *InsertedPHIs=nullptr)
If InsertedPHIs is specified, it will be filled in with all PHI Nodes created by rewriting.
DebugSSAUpdater & operator=(const DebugSSAUpdater &)=delete
DbgValueDef findValueForBlock(DbgSSABlock *BB) const
Return the value for the specified block if the DebugSSAUpdater has one, otherwise return nullptr.
DebugSSAUpdater(const DebugSSAUpdater &)=delete
void addAvailableValue(DbgSSABlock *BB, DbgValueDef DV)
Indicate that a rewritten value is available in the specified block with the specified value.
DbgValueDef getValueAtEndOfBlock(DbgSSABlock *BB)
Construct SSA form, materializing a value that is live at the end of the specified block.
DbgSSABlock * getDbgSSABlock(BasicBlock *BB)
For a given BB, create a wrapper block for it.
Definition DebugSSAUpdater.h:256
~DebugSSAUpdater()
Definition DebugSSAUpdater.h:238
DbgValueDef getValueInMiddleOfBlock(DbgSSABlock *BB)
Construct SSA form, materializing a value that is live in the middle of the specified block.
void reset()
Definition DebugSSAUpdater.h:243
bool hasValueForBlock(DbgSSABlock *BB) const
Return true if the DebugSSAUpdater already has a value for the specified block.
Identifies a unique instance of a whole variable (discards/ignores fragment information).
Utility class used to store the names of SSA values after their owning modules have been destroyed.
Definition DebugSSAUpdater.h:319
uint64_t ValueID
Definition DebugSSAUpdater.h:325
std::string getName(ValueID ID)
Definition DebugSSAUpdater.h:327
ValueID addValue(Value *V)
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
LLVM Value Representation.
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
auto pred_end(const MachineBasicBlock *BB)
RNSuccIterator< NodeRef, BlockT, RegionT > succ_begin(NodeRef Node)
iterator_range(Container &&) -> iterator_range< llvm::detail::IterOfRange< Container > >
RNSuccIterator< NodeRef, BlockT, RegionT > succ_end(NodeRef Node)
PredIterator< BasicBlock, Value::user_iterator > pred_iterator
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
auto pred_begin(const MachineBasicBlock *BB)
SuccIterator< Instruction, BasicBlock > succ_iterator
Definition DebugSSAUpdater.h:307
BasicBlock::iterator End
Definition DebugSSAUpdater.h:309
BasicBlock::iterator Start
Definition DebugSSAUpdater.h:308
DbgValueDef Value
Definition DebugSSAUpdater.h:311
A definition of a variable; can represent either a debug value, no definition (the variable has not y...
Definition DebugSSAUpdater.h:46
bool IsUndef
Definition DebugSSAUpdater.h:48
DbgValueDef(DbgVariableRecord *DVR)
Definition DebugSSAUpdater.h:62
DbgValueDef(DbgSSAPhi *Phi)
Definition DebugSSAUpdater.h:69
bool operator!=(DbgValueDef Other) const
Definition DebugSSAUpdater.h:83
bool IsMemory
Definition DebugSSAUpdater.h:49
void print(raw_ostream &OS) const
DbgValueDef()
Definition DebugSSAUpdater.h:53
DIExpression * Expression
Definition DebugSSAUpdater.h:51
DbgSSAPhi * Phi
Definition DebugSSAUpdater.h:47
bool operator==(DbgValueDef Other) const
Definition DebugSSAUpdater.h:82
Metadata * Locations
Definition DebugSSAUpdater.h:50
DbgValueDef(bool IsMemory, Metadata *Locations, DIExpression *Expression)
Definition DebugSSAUpdater.h:59
DbgValueDef(int)
Definition DebugSSAUpdater.h:56
bool agreesWith(DbgValueDef Other) const
Definition DebugSSAUpdater.h:73
This class defines the default behavior for configurable aspects of ValueMap<>.