21
21
namespace llvm {
22
22
class AsmPrinter ;
23
23
24
+ struct TargetIndexLocation {
25
+ int Index;
26
+ int Offset;
27
+
28
+ TargetIndexLocation () = default ;
29
+ TargetIndexLocation (unsigned Idx, int64_t Offset)
30
+ : Index(Idx), Offset(Offset) {}
31
+
32
+ bool operator ==(const TargetIndexLocation &Other) const {
33
+ return Index == Other.Index && Offset == Other.Offset ;
34
+ }
35
+ };
36
+
24
37
// / This struct describes location entries emitted in the .debug_loc
25
38
// / section.
26
39
class DebugLocEntry {
@@ -47,12 +60,20 @@ class DebugLocEntry {
47
60
: Expression(Expr), EntryKind(E_Location), Loc(Loc) {
48
61
assert (cast<DIExpression>(Expr)->isValid ());
49
62
}
63
+ Value (const DIExpression *Expr, TargetIndexLocation Loc)
64
+ : Expression(Expr), EntryKind(E_TargetIndexLocation), TIL(Loc) {}
50
65
51
66
// / Any complex address location expression for this Value.
52
67
const DIExpression *Expression;
53
68
54
69
// / Type of entry that this represents.
55
- enum EntryType { E_Location, E_Integer, E_ConstantFP, E_ConstantInt };
70
+ enum EntryType {
71
+ E_Location,
72
+ E_Integer,
73
+ E_ConstantFP,
74
+ E_ConstantInt,
75
+ E_TargetIndexLocation
76
+ };
56
77
enum EntryType EntryKind;
57
78
58
79
// / Either a constant,
@@ -62,17 +83,25 @@ class DebugLocEntry {
62
83
const ConstantInt *CIP;
63
84
} Constant;
64
85
65
- // Or a location in the machine frame.
66
- MachineLocation Loc;
86
+ union {
87
+ // Or a location in the machine frame.
88
+ MachineLocation Loc;
89
+ // Or a location from target specific location.
90
+ TargetIndexLocation TIL;
91
+ };
67
92
68
93
bool isLocation () const { return EntryKind == E_Location; }
94
+ bool isTargetIndexLocation () const {
95
+ return EntryKind == E_TargetIndexLocation;
96
+ }
69
97
bool isInt () const { return EntryKind == E_Integer; }
70
98
bool isConstantFP () const { return EntryKind == E_ConstantFP; }
71
99
bool isConstantInt () const { return EntryKind == E_ConstantInt; }
72
100
int64_t getInt () const { return Constant.Int ; }
73
101
const ConstantFP *getConstantFP () const { return Constant.CFP ; }
74
102
const ConstantInt *getConstantInt () const { return Constant.CIP ; }
75
103
MachineLocation getLoc () const { return Loc; }
104
+ TargetIndexLocation getTargetIndexLocation () const { return TIL; }
76
105
bool isFragment () const { return getExpression ()->isFragment (); }
77
106
const DIExpression *getExpression () const { return Expression; }
78
107
friend bool operator ==(const Value &, const Value &);
@@ -165,6 +194,8 @@ inline bool operator==(const DebugLocEntry::Value &A,
165
194
switch (A.EntryKind ) {
166
195
case DebugLocEntry::Value::E_Location:
167
196
return A.Loc == B.Loc ;
197
+ case DebugLocEntry::Value::E_TargetIndexLocation:
198
+ return A.TIL == B.TIL ;
168
199
case DebugLocEntry::Value::E_Integer:
169
200
return A.Constant .Int == B.Constant .Int ;
170
201
case DebugLocEntry::Value::E_ConstantFP:
0 commit comments