LLVM: lib/Target/Mips/MCTargetDesc/MipsMCExpr.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
21#include
22
23using namespace llvm;
24
25#define DEBUG_TYPE "mipsmcexpr"
26
29 return new (Ctx) MipsMCExpr(Kind, Expr);
30}
31
35}
36
38 int64_t AbsVal;
39
40 switch (Kind) {
44 break;
46
47
49 return;
51 OS << "%call_hi";
52 break;
54 OS << "%call_lo";
55 break;
57 OS << "%dtprel_hi";
58 break;
60 OS << "%dtprel_lo";
61 break;
63 OS << "%got";
64 break;
66 OS << "%gottprel";
67 break;
69 OS << "%call16";
70 break;
72 OS << "%got_disp";
73 break;
75 OS << "%got_hi";
76 break;
78 OS << "%got_lo";
79 break;
81 OS << "%got_page";
82 break;
84 OS << "%got_ofst";
85 break;
87 OS << "%gp_rel";
88 break;
90 OS << "%hi";
91 break;
93 OS << "%higher";
94 break;
96 OS << "%highest";
97 break;
99 OS << "%lo";
100 break;
102 OS << "%neg";
103 break;
105 OS << "%pcrel_hi";
106 break;
108 OS << "%pcrel_lo";
109 break;
111 OS << "%tlsgd";
112 break;
114 OS << "%tlsldm";
115 break;
117 OS << "%tprel_hi";
118 break;
120 OS << "%tprel_lo";
121 break;
122 }
123
124 OS << '(';
125 if (Expr->evaluateAsAbsolute(AbsVal))
126 OS << AbsVal;
127 else
128 Expr->print(OS, MAI, true);
129 OS << ')';
130}
131
134
136 const MCExpr *SubExpr =
138 ->getSubExpr();
140 return false;
141
144 return true;
145 }
146
148 return false;
149
151 return false;
152
153
154
155
158 switch (Kind) {
163
164
183 return false;
186 AbsVal = SignExtend64<16>(AbsVal);
187 break;
190 AbsVal = SignExtend64<16>((AbsVal + 0x8000) >> 16);
191 break;
193 AbsVal = SignExtend64<16>((AbsVal + 0x80008000LL) >> 32);
194 break;
196 AbsVal = SignExtend64<16>((AbsVal + 0x800080008000LL) >> 48);
197 break;
199 AbsVal = -AbsVal;
200 break;
201 }
203 return true;
204 }
205
206
207
208
209
210
211
212 Res =
214
215 return true;
216}
217
220}
221
223 switch (Expr->getKind()) {
226 break;
228 break;
230 const MCBinaryExpr *BE = cast(Expr);
233 break;
234 }
236
237
238 const MCSymbolRefExpr &SymRef = *cast(Expr);
240 break;
241 }
244 break;
245 }
246}
247
253 break;
271
272
274 E->fixELFSymbolsInTLSFixups(Asm);
275 break;
285 break;
286 }
287}
288
292 if (const MipsMCExpr *S2 = dyn_cast(S1->getSubExpr())) {
295 return true;
296 }
297 }
298 }
299 }
300 return false;
301}
static void fixELFSymbolsInTLSFixupsImpl(const MCExpr *Expr, MCAssembler &Asm)
PowerPC TLS Dynamic Call Fixup
This class is intended to be used as a base class for asm properties and features specific to the tar...
Binary assembler expressions.
const MCExpr * getLHS() const
Get the left-hand side expression of the binary operator.
const MCExpr * getRHS() const
Get the right-hand side expression of the binary operator.
Context object for machine code objects.
Base class for the full range of assembler expressions which are needed for parsing.
@ Unary
Unary expressions.
@ Constant
Constant expressions.
@ SymbolRef
References to labels and assigned expressions.
@ Target
Target specific expression.
@ Binary
Binary expressions.
bool evaluateAsRelocatable(MCValue &Res, const MCAssembler *Asm, const MCFixup *Fixup) const
Try to evaluate the expression to a relocatable value, i.e.
void print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens=false) const
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Streaming machine code generation interface.
void visitUsedExpr(const MCExpr &Expr)
Represent a reference to a symbol from inside an expression.
const MCSymbol & getSymbol() const
This represents an "assembler immediate".
int64_t getConstant() const
uint32_t getRefKind() const
static MCValue get(const MCSymbolRefExpr *SymA, const MCSymbolRefExpr *SymB=nullptr, int64_t Val=0, uint32_t RefKind=0)
const MCSymbolRefExpr * getSymB() const
const MCSymbolRefExpr * getSymA() const
bool isAbsolute() const
Is this an absolute (as opposed to relocatable) value.
static const MipsMCExpr * create(MipsExprKind Kind, const MCExpr *Expr, MCContext &Ctx)
const MCExpr * getSubExpr() const
Get the child of this expression.
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override
MipsExprKind getKind() const
Get the kind of this expression.
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
void visitUsedExpr(MCStreamer &Streamer) const override
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm, const MCFixup *Fixup) const override
static const MipsMCExpr * createGpOff(MipsExprKind Kind, const MCExpr *Expr, MCContext &Ctx)
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.