@@ -24,9 +24,16 @@ class MCSymbol;
24
24
class MCSymbolRefExpr ;
25
25
class raw_ostream ;
26
26
27
- // / MCValue - This represents an "assembler immediate". In its most general
28
- // / form, this can hold "SymbolA - SymbolB + imm64". Not all targets supports
29
- // / relocations of this general form, but we need to represent this anyway.
27
+ // / MCValue - This represents an "assembler immediate". In its most
28
+ // / general form, this can hold ":Kind:(SymbolA - SymbolB + imm64)".
29
+ // / Not all targets supports relocations of this general form, but we
30
+ // / need to represent this anyway.
31
+ // /
32
+ // / In general both SymbolA and SymbolB will also have a modifier
33
+ // / analogous to the top-level Kind. Current targets are not expected
34
+ // / to make use of both though. The choice comes down to whether
35
+ // / relocation modifiers apply to the closest symbol or the whole
36
+ // / expression.
30
37
// /
31
38
// / In the general form, SymbolB can only be defined if SymbolA is, and both
32
39
// / must be in the same (non-external) section. The latter constraint is not
@@ -37,11 +44,13 @@ class raw_ostream;
37
44
class MCValue {
38
45
const MCSymbolRefExpr *SymA, *SymB;
39
46
int64_t Cst;
47
+ uint32_t RefKind;
40
48
public:
41
49
42
50
int64_t getConstant () const { return Cst; }
43
51
const MCSymbolRefExpr *getSymA () const { return SymA; }
44
52
const MCSymbolRefExpr *getSymB () const { return SymB; }
53
+ uint32_t getRefKind () const { return RefKind; }
45
54
46
55
// / isAbsolute - Is this an absolute (as opposed to relocatable) value.
47
56
bool isAbsolute () const { return !SymA && !SymB; }
@@ -53,12 +62,13 @@ class MCValue {
53
62
void dump () const ;
54
63
55
64
static MCValue get (const MCSymbolRefExpr *SymA, const MCSymbolRefExpr *SymB=0 ,
56
- int64_t Val = 0 ) {
65
+ int64_t Val = 0 , uint32_t RefKind = 0 ) {
57
66
MCValue R;
58
67
assert ((!SymB || SymA) && " Invalid relocatable MCValue!" );
59
68
R.Cst = Val;
60
69
R.SymA = SymA;
61
70
R.SymB = SymB;
71
+ R.RefKind = RefKind;
62
72
return R;
63
73
}
64
74
@@ -67,6 +77,7 @@ class MCValue {
67
77
R.Cst = Val;
68
78
R.SymA = 0 ;
69
79
R.SymB = 0 ;
80
+ R.RefKind = 0 ;
70
81
return R;
71
82
}
72
83
0 commit comments