| 
19 | 19 | namespace llvm {  | 
20 | 20 | class raw_ostream;  | 
21 | 21 | 
 
  | 
22 |  | -/// This represents an "assembler immediate".  | 
23 |  | -///  | 
24 |  | -///  In its most general form, this can hold ":Kind:(SymbolA - SymbolB +  | 
25 |  | -///  imm64)".  Not all targets supports relocations of this general form, but we  | 
26 |  | -///  need to represent this anyway.  | 
27 |  | -///  | 
28 |  | -/// In general both SymbolA and SymbolB will also have a modifier  | 
29 |  | -/// analogous to the top-level Kind. Current targets are not expected  | 
30 |  | -/// to make use of both though. The choice comes down to whether  | 
31 |  | -/// relocation modifiers apply to the closest symbol or the whole  | 
32 |  | -/// expression.  | 
33 |  | -///  | 
34 |  | -/// Note that this class must remain a simple POD value class, because we need  | 
35 |  | -/// it to live in unions etc.  | 
 | 22 | +// Represents a relocatable expression in its most general form:  | 
 | 23 | +// relocation_specifier(SymA - SymB + imm64).  | 
 | 24 | +//  | 
 | 25 | +// Not all targets support SymB. For PC-relative relocations, a specifier is  | 
 | 26 | +// typically used instead of setting SymB to DOT.  | 
 | 27 | +//  | 
 | 28 | +// Some targets encode the relocation specifier within SymA using  | 
 | 29 | +// MCSymbolRefExpr::SubclassData and access it via getAccessVariant(), though  | 
 | 30 | +// this method is now deprecated.  | 
 | 31 | +//  | 
 | 32 | +// This class must remain a simple POD value class, as it needs to reside in  | 
 | 33 | +// unions and similar structures.  | 
36 | 34 | class MCValue {  | 
37 | 35 |   const MCSymbolRefExpr *SymA = nullptr, *SymB = nullptr;  | 
38 | 36 |   int64_t Cst = 0;  | 
39 | 37 |   uint32_t Specifier = 0;  | 
40 | 38 | 
 
  | 
 | 39 | +  // SymB cannot have a specifier. Use getSubSym instead.  | 
 | 40 | +  const MCSymbolRefExpr *getSymB() const { return SymB; }  | 
 | 41 | + | 
41 | 42 | public:  | 
 | 43 | +  friend class MCAssembler;  | 
42 | 44 |   friend class MCExpr;  | 
43 | 45 |   MCValue() = default;  | 
44 | 46 |   int64_t getConstant() const { return Cst; }  | 
45 | 47 |   const MCSymbolRefExpr *getSymA() const { return SymA; }  | 
46 |  | -  const MCSymbolRefExpr *getSymB() const { return SymB; }  | 
47 | 48 |   uint32_t getRefKind() const { return Specifier; }  | 
48 | 49 |   uint32_t getSpecifier() const { return Specifier; }  | 
49 | 50 |   void setSpecifier(uint32_t S) { Specifier = S; }  | 
 | 
0 commit comments