@@ -61,6 +61,7 @@ class BasicBlock;
61
61
class MDNode ;
62
62
class Module ;
63
63
class DbgVariableIntrinsic ;
64
+ class DIAssignID ;
64
65
class DPMarker ;
65
66
class DPValue ;
66
67
class raw_ostream ;
@@ -83,6 +84,7 @@ class DPValue : public ilist_node<DPValue>, private DebugValueUser {
83
84
DILocalVariable *Variable;
84
85
DIExpression *Expression;
85
86
DebugLoc DbgLoc;
87
+ DIExpression *AddressExpression;
86
88
87
89
public:
88
90
void deleteInstr ();
@@ -102,6 +104,7 @@ class DPValue : public ilist_node<DPValue>, private DebugValueUser {
102
104
enum class LocationType {
103
105
Declare,
104
106
Value,
107
+ Assign,
105
108
106
109
End, // /< Marks the end of the concrete types.
107
110
Any, // /< To indicate all LocationTypes in searches.
@@ -122,6 +125,22 @@ class DPValue : public ilist_node<DPValue>, private DebugValueUser {
122
125
// / assigning \p Location to the DV / Expr / DI variable.
123
126
DPValue (Metadata *Location, DILocalVariable *DV, DIExpression *Expr,
124
127
const DILocation *DI, LocationType Type = LocationType::Value);
128
+ DPValue (Metadata *Value, DILocalVariable *Variable, DIExpression *Expression,
129
+ DIAssignID *AssignID, Metadata *Address,
130
+ DIExpression *AddressExpression, const DILocation *DI);
131
+
132
+ static DPValue *createDPVAssign (Metadata *Value, DILocalVariable *Variable,
133
+ DIExpression *Expression,
134
+ DIAssignID *AssignID, Metadata *Address,
135
+ DIExpression *AddressExpression,
136
+ const DILocation *DI,
137
+ Instruction *InsertBefore = nullptr );
138
+ static DPValue *createLinkedDPVAssign (Instruction *LinkedInstr, Value *Val,
139
+ DILocalVariable *Variable,
140
+ DIExpression *Expression,
141
+ Value *Address,
142
+ DIExpression *AddressExpression,
143
+ const DILocation *DI);
125
144
126
145
static DPValue *createDPValue (Value *Location, DILocalVariable *DV,
127
146
DIExpression *Expr, const DILocation *DI);
@@ -213,7 +232,7 @@ class DPValue : public ilist_node<DPValue>, private DebugValueUser {
213
232
214
233
// / Does this describe the address of a local variable. True for dbg.addr
215
234
// / and dbg.declare, but not dbg.value, which describes its value.
216
- bool isAddressOfVariable () const { return Type != LocationType::Value ; }
235
+ bool isAddressOfVariable () const { return Type == LocationType::Declare ; }
217
236
LocationType getType () const { return Type; }
218
237
219
238
DebugLoc getDebugLoc () const { return DbgLoc; }
@@ -226,7 +245,11 @@ class DPValue : public ilist_node<DPValue>, private DebugValueUser {
226
245
227
246
DIExpression *getExpression () const { return Expression; }
228
247
229
- Metadata *getRawLocation () const { return DebugValue; }
248
+ // / Returns the metadata operand for the first location description. i.e.,
249
+ // / dbg intrinsic dbg.value,declare operand and dbg.assign 1st location
250
+ // / operand (the "value componenet"). Note the operand (singular) may be
251
+ // / a DIArgList which is a list of values.
252
+ Metadata *getRawLocation () const { return DebugValues[0 ]; }
230
253
231
254
Value *getValue (unsigned OpIdx = 0 ) const {
232
255
return getVariableLocationOp (OpIdx);
@@ -240,7 +263,7 @@ class DPValue : public ilist_node<DPValue>, private DebugValueUser {
240
263
(isa<ValueAsMetadata>(NewLocation) || isa<DIArgList>(NewLocation) ||
241
264
isa<MDNode>(NewLocation)) &&
242
265
" Location for a DPValue must be either ValueAsMetadata or DIArgList" );
243
- resetDebugValue (NewLocation);
266
+ resetDebugValue (0 , NewLocation);
244
267
}
245
268
246
269
// / Get the size (in bits) of the variable, or fragment of the variable that
@@ -260,16 +283,38 @@ class DPValue : public ilist_node<DPValue>, private DebugValueUser {
260
283
Other.Expression );
261
284
}
262
285
286
+ // / @name DbgAssign Methods
287
+ // / @{
288
+ bool isDbgAssign () const { return getType () == LocationType::Assign; }
289
+
290
+ Value *getAddress () const ;
291
+ Metadata *getRawAddress () const {
292
+ return isDbgAssign () ? DebugValues[1 ] : DebugValues[0 ];
293
+ }
294
+ Metadata *getRawAssignID () const { return DebugValues[2 ]; }
295
+ DIAssignID *getAssignID () const ;
296
+ DIExpression *getAddressExpression () const { return AddressExpression; }
297
+ void setAddressExpression (DIExpression *NewExpr) {
298
+ AddressExpression = NewExpr;
299
+ }
300
+ void setAssignId (DIAssignID *New);
301
+ void setAddress (Value *V) { resetDebugValue (1 , ValueAsMetadata::get (V)); }
302
+ // / Kill the address component.
303
+ void setKillAddress ();
304
+ // / Check whether this kills the address component. This doesn't take into
305
+ // / account the position of the intrinsic, therefore a returned value of false
306
+ // / does not guarentee the address is a valid location for the variable at the
307
+ // / intrinsic's position in IR.
308
+ bool isKillAddress () const ;
309
+
310
+ // / @}
311
+
263
312
DPValue *clone () const ;
264
313
// / Convert this DPValue back into a dbg.value intrinsic.
265
314
// / \p InsertBefore Optional position to insert this intrinsic.
266
315
// / \returns A new dbg.value intrinsic representiung this DPValue.
267
316
DbgVariableIntrinsic *createDebugIntrinsic (Module *M,
268
317
Instruction *InsertBefore) const ;
269
- // / Handle changes to the location of the Value(s) that we refer to happening
270
- // / "under our feet".
271
- void handleChangedLocation (Metadata *NewLocation);
272
-
273
318
void setMarker (DPMarker *M) { Marker = M; }
274
319
275
320
DPMarker *getMarker () { return Marker; }
0 commit comments