LLVM  9.0.0svn
MCExpr.cpp
Go to the documentation of this file.
1 //===- MCExpr.cpp - Assembly Level Expression Implementation --------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "llvm/MC/MCExpr.h"
10 #include "llvm/ADT/Statistic.h"
11 #include "llvm/ADT/StringSwitch.h"
12 #include "llvm/Config/llvm-config.h"
13 #include "llvm/MC/MCAsmBackend.h"
14 #include "llvm/MC/MCAsmInfo.h"
15 #include "llvm/MC/MCAsmLayout.h"
16 #include "llvm/MC/MCAssembler.h"
17 #include "llvm/MC/MCContext.h"
18 #include "llvm/MC/MCObjectWriter.h"
19 #include "llvm/MC/MCSymbol.h"
20 #include "llvm/MC/MCValue.h"
21 #include "llvm/Support/Casting.h"
22 #include "llvm/Support/Compiler.h"
23 #include "llvm/Support/Debug.h"
26 #include <cassert>
27 #include <cstdint>
28 
29 using namespace llvm;
30 
31 #define DEBUG_TYPE "mcexpr"
32 
33 namespace {
34 namespace stats {
35 
36 STATISTIC(MCExprEvaluate, "Number of MCExpr evaluations");
37 
38 } // end namespace stats
39 } // end anonymous namespace
40 
41 void MCExpr::print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens) const {
42  switch (getKind()) {
43  case MCExpr::Target:
44  return cast<MCTargetExpr>(this)->printImpl(OS, MAI);
45  case MCExpr::Constant:
46  OS << cast<MCConstantExpr>(*this).getValue();
47  return;
48 
49  case MCExpr::SymbolRef: {
50  const MCSymbolRefExpr &SRE = cast<MCSymbolRefExpr>(*this);
51  const MCSymbol &Sym = SRE.getSymbol();
52  // Parenthesize names that start with $ so that they don't look like
53  // absolute names.
54  bool UseParens =
55  !InParens && !Sym.getName().empty() && Sym.getName()[0] == '$';
56  if (UseParens) {
57  OS << '(';
58  Sym.print(OS, MAI);
59  OS << ')';
60  } else
61  Sym.print(OS, MAI);
62 
63  if (SRE.getKind() != MCSymbolRefExpr::VK_None)
64  SRE.printVariantKind(OS);
65 
66  return;
67  }
68 
69  case MCExpr::Unary: {
70  const MCUnaryExpr &UE = cast<MCUnaryExpr>(*this);
71  switch (UE.getOpcode()) {
72  case MCUnaryExpr::LNot: OS << '!'; break;
73  case MCUnaryExpr::Minus: OS << '-'; break;
74  case MCUnaryExpr::Not: OS << '~'; break;
75  case MCUnaryExpr::Plus: OS << '+'; break;
76  }
77  bool Binary = UE.getSubExpr()->getKind() == MCExpr::Binary;
78  if (Binary) OS << "(";
79  UE.getSubExpr()->print(OS, MAI);
80  if (Binary) OS << ")";
81  return;
82  }
83 
84  case MCExpr::Binary: {
85  const MCBinaryExpr &BE = cast<MCBinaryExpr>(*this);
86 
87  // Only print parens around the LHS if it is non-trivial.
88  if (isa<MCConstantExpr>(BE.getLHS()) || isa<MCSymbolRefExpr>(BE.getLHS())) {
89  BE.getLHS()->print(OS, MAI);
90  } else {
91  OS << '(';
92  BE.getLHS()->print(OS, MAI);
93  OS << ')';
94  }
95 
96  switch (BE.getOpcode()) {
97  case MCBinaryExpr::Add:
98  // Print "X-42" instead of "X+-42".
99  if (const MCConstantExpr *RHSC = dyn_cast<MCConstantExpr>(BE.getRHS())) {
100  if (RHSC->getValue() < 0) {
101  OS << RHSC->getValue();
102  return;
103  }
104  }
105 
106  OS << '+';
107  break;
108  case MCBinaryExpr::AShr: OS << ">>"; break;
109  case MCBinaryExpr::And: OS << '&'; break;
110  case MCBinaryExpr::Div: OS << '/'; break;
111  case MCBinaryExpr::EQ: OS << "=="; break;
112  case MCBinaryExpr::GT: OS << '>'; break;
113  case MCBinaryExpr::GTE: OS << ">="; break;
114  case MCBinaryExpr::LAnd: OS << "&&"; break;
115  case MCBinaryExpr::LOr: OS << "||"; break;
116  case MCBinaryExpr::LShr: OS << ">>"; break;
117  case MCBinaryExpr::LT: OS << '<'; break;
118  case MCBinaryExpr::LTE: OS << "<="; break;
119  case MCBinaryExpr::Mod: OS << '%'; break;
120  case MCBinaryExpr::Mul: OS << '*'; break;
121  case MCBinaryExpr::NE: OS << "!="; break;
122  case MCBinaryExpr::Or: OS << '|'; break;
123  case MCBinaryExpr::Shl: OS << "<<"; break;
124  case MCBinaryExpr::Sub: OS << '-'; break;
125  case MCBinaryExpr::Xor: OS << '^'; break;
126  }
127 
128  // Only print parens around the LHS if it is non-trivial.
129  if (isa<MCConstantExpr>(BE.getRHS()) || isa<MCSymbolRefExpr>(BE.getRHS())) {
130  BE.getRHS()->print(OS, MAI);
131  } else {
132  OS << '(';
133  BE.getRHS()->print(OS, MAI);
134  OS << ')';
135  }
136  return;
137  }
138  }
139 
140  llvm_unreachable("Invalid expression kind!");
141 }
142 
143 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
144 LLVM_DUMP_METHOD void MCExpr::dump() const {
145  dbgs() << *this;
146  dbgs() << '\n';
147 }
148 #endif
149 
150 /* *** */
151 
152 const MCBinaryExpr *MCBinaryExpr::create(Opcode Opc, const MCExpr *LHS,
153  const MCExpr *RHS, MCContext &Ctx,
154  SMLoc Loc) {
155  return new (Ctx) MCBinaryExpr(Opc, LHS, RHS, Loc);
156 }
157 
158 const MCUnaryExpr *MCUnaryExpr::create(Opcode Opc, const MCExpr *Expr,
159  MCContext &Ctx, SMLoc Loc) {
160  return new (Ctx) MCUnaryExpr(Opc, Expr, Loc);
161 }
162 
163 const MCConstantExpr *MCConstantExpr::create(int64_t Value, MCContext &Ctx) {
164  return new (Ctx) MCConstantExpr(Value);
165 }
166 
167 /* *** */
168 
169 MCSymbolRefExpr::MCSymbolRefExpr(const MCSymbol *Symbol, VariantKind Kind,
170  const MCAsmInfo *MAI, SMLoc Loc)
171  : MCExpr(MCExpr::SymbolRef, Loc), Kind(Kind),
172  UseParensForSymbolVariant(MAI->useParensForSymbolVariant()),
173  HasSubsectionsViaSymbols(MAI->hasSubsectionsViaSymbols()),
174  Symbol(Symbol) {
175  assert(Symbol);
176 }
177 
178 const MCSymbolRefExpr *MCSymbolRefExpr::create(const MCSymbol *Sym,
179  VariantKind Kind,
180  MCContext &Ctx, SMLoc Loc) {
181  return new (Ctx) MCSymbolRefExpr(Sym, Kind, Ctx.getAsmInfo(), Loc);
182 }
183 
184 const MCSymbolRefExpr *MCSymbolRefExpr::create(StringRef Name, VariantKind Kind,
185  MCContext &Ctx) {
186  return create(Ctx.getOrCreateSymbol(Name), Kind, Ctx);
187 }
188 
189 StringRef MCSymbolRefExpr::getVariantKindName(VariantKind Kind) {
190  switch (Kind) {
191  case VK_Invalid: return "<<invalid>>";
192  case VK_None: return "<<none>>";
193 
194  case VK_DTPOFF: return "DTPOFF";
195  case VK_DTPREL: return "DTPREL";
196  case VK_GOT: return "GOT";
197  case VK_GOTOFF: return "GOTOFF";
198  case VK_GOTREL: return "GOTREL";
199  case VK_GOTPCREL: return "GOTPCREL";
200  case VK_GOTTPOFF: return "GOTTPOFF";
201  case VK_INDNTPOFF: return "INDNTPOFF";
202  case VK_NTPOFF: return "NTPOFF";
203  case VK_GOTNTPOFF: return "GOTNTPOFF";
204  case VK_PLT: return "PLT";
205  case VK_TLSGD: return "TLSGD";
206  case VK_TLSLD: return "TLSLD";
207  case VK_TLSLDM: return "TLSLDM";
208  case VK_TPOFF: return "TPOFF";
209  case VK_TPREL: return "TPREL";
210  case VK_TLSCALL: return "tlscall";
211  case VK_TLSDESC: return "tlsdesc";
212  case VK_TLVP: return "TLVP";
213  case VK_TLVPPAGE: return "TLVPPAGE";
214  case VK_TLVPPAGEOFF: return "TLVPPAGEOFF";
215  case VK_PAGE: return "PAGE";
216  case VK_PAGEOFF: return "PAGEOFF";
217  case VK_GOTPAGE: return "GOTPAGE";
218  case VK_GOTPAGEOFF: return "GOTPAGEOFF";
219  case VK_SECREL: return "SECREL32";
220  case VK_SIZE: return "SIZE";
221  case VK_WEAKREF: return "WEAKREF";
222  case VK_X86_ABS8: return "ABS8";
223  case VK_ARM_NONE: return "none";
224  case VK_ARM_GOT_PREL: return "GOT_PREL";
225  case VK_ARM_TARGET1: return "target1";
226  case VK_ARM_TARGET2: return "target2";
227  case VK_ARM_PREL31: return "prel31";
228  case VK_ARM_SBREL: return "sbrel";
229  case VK_ARM_TLSLDO: return "tlsldo";
230  case VK_ARM_TLSDESCSEQ: return "tlsdescseq";
231  case VK_AVR_NONE: return "none";
232  case VK_AVR_LO8: return "lo8";
233  case VK_AVR_HI8: return "hi8";
234  case VK_AVR_HLO8: return "hlo8";
235  case VK_AVR_DIFF8: return "diff8";
236  case VK_AVR_DIFF16: return "diff16";
237  case VK_AVR_DIFF32: return "diff32";
238  case VK_PPC_LO: return "l";
239  case VK_PPC_HI: return "h";
240  case VK_PPC_HA: return "ha";
241  case VK_PPC_HIGH: return "high";
242  case VK_PPC_HIGHA: return "higha";
243  case VK_PPC_HIGHER: return "higher";
244  case VK_PPC_HIGHERA: return "highera";
245  case VK_PPC_HIGHEST: return "highest";
246  case VK_PPC_HIGHESTA: return "highesta";
247  case VK_PPC_GOT_LO: return "got@l";
248  case VK_PPC_GOT_HI: return "got@h";
249  case VK_PPC_GOT_HA: return "got@ha";
250  case VK_PPC_TOCBASE: return "tocbase";
251  case VK_PPC_TOC: return "toc";
252  case VK_PPC_TOC_LO: return "toc@l";
253  case VK_PPC_TOC_HI: return "toc@h";
254  case VK_PPC_TOC_HA: return "toc@ha";
255  case VK_PPC_DTPMOD: return "dtpmod";
256  case VK_PPC_TPREL_LO: return "tprel@l";
257  case VK_PPC_TPREL_HI: return "tprel@h";
258  case VK_PPC_TPREL_HA: return "tprel@ha";
259  case VK_PPC_TPREL_HIGH: return "tprel@high";
260  case VK_PPC_TPREL_HIGHA: return "tprel@higha";
261  case VK_PPC_TPREL_HIGHER: return "tprel@higher";
262  case VK_PPC_TPREL_HIGHERA: return "tprel@highera";
263  case VK_PPC_TPREL_HIGHEST: return "tprel@highest";
264  case VK_PPC_TPREL_HIGHESTA: return "tprel@highesta";
265  case VK_PPC_DTPREL_LO: return "dtprel@l";
266  case VK_PPC_DTPREL_HI: return "dtprel@h";
267  case VK_PPC_DTPREL_HA: return "dtprel@ha";
268  case VK_PPC_DTPREL_HIGH: return "dtprel@high";
269  case VK_PPC_DTPREL_HIGHA: return "dtprel@higha";
270  case VK_PPC_DTPREL_HIGHER: return "dtprel@higher";
271  case VK_PPC_DTPREL_HIGHERA: return "dtprel@highera";
272  case VK_PPC_DTPREL_HIGHEST: return "dtprel@highest";
273  case VK_PPC_DTPREL_HIGHESTA: return "dtprel@highesta";
274  case VK_PPC_GOT_TPREL: return "got@tprel";
275  case VK_PPC_GOT_TPREL_LO: return "got@tprel@l";
276  case VK_PPC_GOT_TPREL_HI: return "got@tprel@h";
277  case VK_PPC_GOT_TPREL_HA: return "got@tprel@ha";
278  case VK_PPC_GOT_DTPREL: return "got@dtprel";
279  case VK_PPC_GOT_DTPREL_LO: return "got@dtprel@l";
280  case VK_PPC_GOT_DTPREL_HI: return "got@dtprel@h";
281  case VK_PPC_GOT_DTPREL_HA: return "got@dtprel@ha";
282  case VK_PPC_TLS: return "tls";
283  case VK_PPC_GOT_TLSGD: return "got@tlsgd";
284  case VK_PPC_GOT_TLSGD_LO: return "got@tlsgd@l";
285  case VK_PPC_GOT_TLSGD_HI: return "got@tlsgd@h";
286  case VK_PPC_GOT_TLSGD_HA: return "got@tlsgd@ha";
287  case VK_PPC_TLSGD: return "tlsgd";
288  case VK_PPC_GOT_TLSLD: return "got@tlsld";
289  case VK_PPC_GOT_TLSLD_LO: return "got@tlsld@l";
290  case VK_PPC_GOT_TLSLD_HI: return "got@tlsld@h";
291  case VK_PPC_GOT_TLSLD_HA: return "got@tlsld@ha";
292  case VK_PPC_TLSLD: return "tlsld";
293  case VK_PPC_LOCAL: return "local";
294  case VK_COFF_IMGREL32: return "IMGREL";
295  case VK_Hexagon_PCREL: return "PCREL";
296  case VK_Hexagon_LO16: return "LO16";
297  case VK_Hexagon_HI16: return "HI16";
298  case VK_Hexagon_GPREL: return "GPREL";
299  case VK_Hexagon_GD_GOT: return "GDGOT";
300  case VK_Hexagon_LD_GOT: return "LDGOT";
301  case VK_Hexagon_GD_PLT: return "GDPLT";
302  case VK_Hexagon_LD_PLT: return "LDPLT";
303  case VK_Hexagon_IE: return "IE";
304  case VK_Hexagon_IE_GOT: return "IEGOT";
305  case VK_WebAssembly_FUNCTION: return "FUNCTION";
306  case VK_WebAssembly_GLOBAL: return "GLOBAL";
307  case VK_WebAssembly_TYPEINDEX: return "TYPEINDEX";
308  case VK_WebAssembly_EVENT: return "EVENT";
309  case VK_AMDGPU_GOTPCREL32_LO: return "gotpcrel32@lo";
310  case VK_AMDGPU_GOTPCREL32_HI: return "gotpcrel32@hi";
311  case VK_AMDGPU_REL32_LO: return "rel32@lo";
312  case VK_AMDGPU_REL32_HI: return "rel32@hi";
313  case VK_AMDGPU_REL64: return "rel64";
314  }
315  llvm_unreachable("Invalid variant kind");
316 }
317 
318 MCSymbolRefExpr::VariantKind
319 MCSymbolRefExpr::getVariantKindForName(StringRef Name) {
320  return StringSwitch<VariantKind>(Name.lower())
321  .Case("dtprel", VK_DTPREL)
322  .Case("dtpoff", VK_DTPOFF)
323  .Case("got", VK_GOT)
324  .Case("gotoff", VK_GOTOFF)
325  .Case("gotrel", VK_GOTREL)
326  .Case("gotpcrel", VK_GOTPCREL)
327  .Case("gottpoff", VK_GOTTPOFF)
328  .Case("indntpoff", VK_INDNTPOFF)
329  .Case("ntpoff", VK_NTPOFF)
330  .Case("gotntpoff", VK_GOTNTPOFF)
331  .Case("plt", VK_PLT)
332  .Case("tlscall", VK_TLSCALL)
333  .Case("tlsdesc", VK_TLSDESC)
334  .Case("tlsgd", VK_TLSGD)
335  .Case("tlsld", VK_TLSLD)
336  .Case("tlsldm", VK_TLSLDM)
337  .Case("tpoff", VK_TPOFF)
338  .Case("tprel", VK_TPREL)
339  .Case("tlvp", VK_TLVP)
340  .Case("tlvppage", VK_TLVPPAGE)
341  .Case("tlvppageoff", VK_TLVPPAGEOFF)
342  .Case("page", VK_PAGE)
343  .Case("pageoff", VK_PAGEOFF)
344  .Case("gotpage", VK_GOTPAGE)
345  .Case("gotpageoff", VK_GOTPAGEOFF)
346  .Case("imgrel", VK_COFF_IMGREL32)
347  .Case("secrel32", VK_SECREL)
348  .Case("size", VK_SIZE)
349  .Case("abs8", VK_X86_ABS8)
350  .Case("l", VK_PPC_LO)
351  .Case("h", VK_PPC_HI)
352  .Case("ha", VK_PPC_HA)
353  .Case("high", VK_PPC_HIGH)
354  .Case("higha", VK_PPC_HIGHA)
355  .Case("higher", VK_PPC_HIGHER)
356  .Case("highera", VK_PPC_HIGHERA)
357  .Case("highest", VK_PPC_HIGHEST)
358  .Case("highesta", VK_PPC_HIGHESTA)
359  .Case("got@l", VK_PPC_GOT_LO)
360  .Case("got@h", VK_PPC_GOT_HI)
361  .Case("got@ha", VK_PPC_GOT_HA)
362  .Case("local", VK_PPC_LOCAL)
363  .Case("tocbase", VK_PPC_TOCBASE)
364  .Case("toc", VK_PPC_TOC)
365  .Case("toc@l", VK_PPC_TOC_LO)
366  .Case("toc@h", VK_PPC_TOC_HI)
367  .Case("toc@ha", VK_PPC_TOC_HA)
368  .Case("tls", VK_PPC_TLS)
369  .Case("dtpmod", VK_PPC_DTPMOD)
370  .Case("tprel@l", VK_PPC_TPREL_LO)
371  .Case("tprel@h", VK_PPC_TPREL_HI)
372  .Case("tprel@ha", VK_PPC_TPREL_HA)
373  .Case("tprel@high", VK_PPC_TPREL_HIGH)
374  .Case("tprel@higha", VK_PPC_TPREL_HIGHA)
375  .Case("tprel@higher", VK_PPC_TPREL_HIGHER)
376  .Case("tprel@highera", VK_PPC_TPREL_HIGHERA)
377  .Case("tprel@highest", VK_PPC_TPREL_HIGHEST)
378  .Case("tprel@highesta", VK_PPC_TPREL_HIGHESTA)
379  .Case("dtprel@l", VK_PPC_DTPREL_LO)
380  .Case("dtprel@h", VK_PPC_DTPREL_HI)
381  .Case("dtprel@ha", VK_PPC_DTPREL_HA)
382  .Case("dtprel@high", VK_PPC_DTPREL_HIGH)
383  .Case("dtprel@higha", VK_PPC_DTPREL_HIGHA)
384  .Case("dtprel@higher", VK_PPC_DTPREL_HIGHER)
385  .Case("dtprel@highera", VK_PPC_DTPREL_HIGHERA)
386  .Case("dtprel@highest", VK_PPC_DTPREL_HIGHEST)
387  .Case("dtprel@highesta", VK_PPC_DTPREL_HIGHESTA)
388  .Case("got@tprel", VK_PPC_GOT_TPREL)
389  .Case("got@tprel@l", VK_PPC_GOT_TPREL_LO)
390  .Case("got@tprel@h", VK_PPC_GOT_TPREL_HI)
391  .Case("got@tprel@ha", VK_PPC_GOT_TPREL_HA)
392  .Case("got@dtprel", VK_PPC_GOT_DTPREL)
393  .Case("got@dtprel@l", VK_PPC_GOT_DTPREL_LO)
394  .Case("got@dtprel@h", VK_PPC_GOT_DTPREL_HI)
395  .Case("got@dtprel@ha", VK_PPC_GOT_DTPREL_HA)
396  .Case("got@tlsgd", VK_PPC_GOT_TLSGD)
397  .Case("got@tlsgd@l", VK_PPC_GOT_TLSGD_LO)
398  .Case("got@tlsgd@h", VK_PPC_GOT_TLSGD_HI)
399  .Case("got@tlsgd@ha", VK_PPC_GOT_TLSGD_HA)
400  .Case("got@tlsld", VK_PPC_GOT_TLSLD)
401  .Case("got@tlsld@l", VK_PPC_GOT_TLSLD_LO)
402  .Case("got@tlsld@h", VK_PPC_GOT_TLSLD_HI)
403  .Case("got@tlsld@ha", VK_PPC_GOT_TLSLD_HA)
404  .Case("gdgot", VK_Hexagon_GD_GOT)
405  .Case("gdplt", VK_Hexagon_GD_PLT)
406  .Case("iegot", VK_Hexagon_IE_GOT)
407  .Case("ie", VK_Hexagon_IE)
408  .Case("ldgot", VK_Hexagon_LD_GOT)
409  .Case("ldplt", VK_Hexagon_LD_PLT)
410  .Case("pcrel", VK_Hexagon_PCREL)
411  .Case("none", VK_ARM_NONE)
412  .Case("got_prel", VK_ARM_GOT_PREL)
413  .Case("target1", VK_ARM_TARGET1)
414  .Case("target2", VK_ARM_TARGET2)
415  .Case("prel31", VK_ARM_PREL31)
416  .Case("sbrel", VK_ARM_SBREL)
417  .Case("tlsldo", VK_ARM_TLSLDO)
418  .Case("lo8", VK_AVR_LO8)
419  .Case("hi8", VK_AVR_HI8)
420  .Case("hlo8", VK_AVR_HLO8)
421  .Case("function", VK_WebAssembly_FUNCTION)
422  .Case("global", VK_WebAssembly_GLOBAL)
423  .Case("typeindex", VK_WebAssembly_TYPEINDEX)
424  .Case("event", VK_WebAssembly_EVENT)
425  .Case("gotpcrel32@lo", VK_AMDGPU_GOTPCREL32_LO)
426  .Case("gotpcrel32@hi", VK_AMDGPU_GOTPCREL32_HI)
427  .Case("rel32@lo", VK_AMDGPU_REL32_LO)
428  .Case("rel32@hi", VK_AMDGPU_REL32_HI)
429  .Case("rel64", VK_AMDGPU_REL64)
430  .Default(VK_Invalid);
431 }
432 
433 void MCSymbolRefExpr::printVariantKind(raw_ostream &OS) const {
434  if (UseParensForSymbolVariant)
435  OS << '(' << MCSymbolRefExpr::getVariantKindName(getKind()) << ')';
436  else
437  OS << '@' << MCSymbolRefExpr::getVariantKindName(getKind());
438 }
439 
440 /* *** */
441 
442 void MCTargetExpr::anchor() {}
443 
444 /* *** */
445 
446 bool MCExpr::evaluateAsAbsolute(int64_t &Res) const {
447  return evaluateAsAbsolute(Res, nullptr, nullptr, nullptr);
448 }
449 
450 bool MCExpr::evaluateAsAbsolute(int64_t &Res,
451  const MCAsmLayout &Layout) const {
452  return evaluateAsAbsolute(Res, &Layout.getAssembler(), &Layout, nullptr);
453 }
454 
455 bool MCExpr::evaluateAsAbsolute(int64_t &Res,
456  const MCAsmLayout &Layout,
457  const SectionAddrMap &Addrs) const {
458  return evaluateAsAbsolute(Res, &Layout.getAssembler(), &Layout, &Addrs);
459 }
460 
461 bool MCExpr::evaluateAsAbsolute(int64_t &Res, const MCAssembler &Asm) const {
462  return evaluateAsAbsolute(Res, &Asm, nullptr, nullptr);
463 }
464 
465 bool MCExpr::evaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm) const {
466  return evaluateAsAbsolute(Res, Asm, nullptr, nullptr);
467 }
468 
469 bool MCExpr::evaluateKnownAbsolute(int64_t &Res,
470  const MCAsmLayout &Layout) const {
471  return evaluateAsAbsolute(Res, &Layout.getAssembler(), &Layout, nullptr,
472  true);
473 }
474 
475 bool MCExpr::evaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
476  const MCAsmLayout *Layout,
477  const SectionAddrMap *Addrs) const {
478  // FIXME: The use if InSet = Addrs is a hack. Setting InSet causes us
479  // absolutize differences across sections and that is what the MachO writer
480  // uses Addrs for.
481  return evaluateAsAbsolute(Res, Asm, Layout, Addrs, Addrs);
482 }
483 
484 bool MCExpr::evaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
485  const MCAsmLayout *Layout,
486  const SectionAddrMap *Addrs, bool InSet) const {
487  MCValue Value;
488 
489  // Fast path constants.
490  if (const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(this)) {
491  Res = CE->getValue();
492  return true;
493  }
494 
495  bool IsRelocatable =
496  evaluateAsRelocatableImpl(Value, Asm, Layout, nullptr, Addrs, InSet);
497 
498  // Record the current value.
499  Res = Value.getConstant();
500 
501  return IsRelocatable && Value.isAbsolute();
502 }
503 
504 /// Helper method for \see EvaluateSymbolAdd().
505 static void AttemptToFoldSymbolOffsetDifference(
506  const MCAssembler *Asm, const MCAsmLayout *Layout,
507  const SectionAddrMap *Addrs, bool InSet, const MCSymbolRefExpr *&A,
508  const MCSymbolRefExpr *&B, int64_t &Addend) {
509  if (!A || !B)
510  return;
511 
512  const MCSymbol &SA = A->getSymbol();
513  const MCSymbol &SB = B->getSymbol();
514 
515  if (SA.isUndefined() || SB.isUndefined())
516  return;
517 
518  if (!Asm->getWriter().isSymbolRefDifferenceFullyResolved(*Asm, A, B, InSet))
519  return;
520 
521  if (SA.getFragment() == SB.getFragment() && !SA.isVariable() &&
522  !SA.isUnset() && !SB.isVariable() && !SB.isUnset()) {
523  Addend += (SA.getOffset() - SB.getOffset());
524 
525  // Pointers to Thumb symbols need to have their low-bit set to allow
526  // for interworking.
527  if (Asm->isThumbFunc(&SA))
528  Addend |= 1;
529 
530  // If symbol is labeled as micromips, we set low-bit to ensure
531  // correct offset in .gcc_except_table
532  if (Asm->getBackend().isMicroMips(&SA))
533  Addend |= 1;
534 
535  // Clear the symbol expr pointers to indicate we have folded these
536  // operands.
537  A = B = nullptr;
538  return;
539  }
540 
541  if (!Layout)
542  return;
543 
544  const MCSection &SecA = *SA.getFragment()->getParent();
545  const MCSection &SecB = *SB.getFragment()->getParent();
546 
547  if ((&SecA != &SecB) && !Addrs)
548  return;
549 
550  // Eagerly evaluate.
551  Addend += Layout->getSymbolOffset(A->getSymbol()) -
552  Layout->getSymbolOffset(B->getSymbol());
553  if (Addrs && (&SecA != &SecB))
554  Addend += (Addrs->lookup(&SecA) - Addrs->lookup(&SecB));
555 
556  // Pointers to Thumb symbols need to have their low-bit set to allow
557  // for interworking.
558  if (Asm->isThumbFunc(&SA))
559  Addend |= 1;
560 
561  // Clear the symbol expr pointers to indicate we have folded these
562  // operands.
563  A = B = nullptr;
564 }
565 
566 /// Evaluate the result of an add between (conceptually) two MCValues.
567 ///
568 /// This routine conceptually attempts to construct an MCValue:
569 /// Result = (Result_A - Result_B + Result_Cst)
570 /// from two MCValue's LHS and RHS where
571 /// Result = LHS + RHS
572 /// and
573 /// Result = (LHS_A - LHS_B + LHS_Cst) + (RHS_A - RHS_B + RHS_Cst).
574 ///
575 /// This routine attempts to aggresively fold the operands such that the result
576 /// is representable in an MCValue, but may not always succeed.
577 ///
578 /// \returns True on success, false if the result is not representable in an
579 /// MCValue.
580 
581 /// NOTE: It is really important to have both the Asm and Layout arguments.
582 /// They might look redundant, but this function can be used before layout
583 /// is done (see the object streamer for example) and having the Asm argument
584 /// lets us avoid relaxations early.
585 static bool
586 EvaluateSymbolicAdd(const MCAssembler *Asm, const MCAsmLayout *Layout,
587  const SectionAddrMap *Addrs, bool InSet, const MCValue &LHS,
588  const MCSymbolRefExpr *RHS_A, const MCSymbolRefExpr *RHS_B,
589  int64_t RHS_Cst, MCValue &Res) {
590  // FIXME: This routine (and other evaluation parts) are *incredibly* sloppy
591  // about dealing with modifiers. This will ultimately bite us, one day.
592  const MCSymbolRefExpr *LHS_A = LHS.getSymA();
593  const MCSymbolRefExpr *LHS_B = LHS.getSymB();
594  int64_t LHS_Cst = LHS.getConstant();
595 
596  // Fold the result constant immediately.
597  int64_t Result_Cst = LHS_Cst + RHS_Cst;
598 
599  assert((!Layout || Asm) &&
600  "Must have an assembler object if layout is given!");
601 
602  // If we have a layout, we can fold resolved differences. Do not do this if
603  // the backend requires this to be emitted as individual relocations, unless
604  // the InSet flag is set to get the current difference anyway (used for
605  // example to calculate symbol sizes).
606  if (Asm &&
607  (InSet || !Asm->getBackend().requiresDiffExpressionRelocations())) {
608  // First, fold out any differences which are fully resolved. By
609  // reassociating terms in
610  // Result = (LHS_A - LHS_B + LHS_Cst) + (RHS_A - RHS_B + RHS_Cst).
611  // we have the four possible differences:
612  // (LHS_A - LHS_B),
613  // (LHS_A - RHS_B),
614  // (RHS_A - LHS_B),
615  // (RHS_A - RHS_B).
616  // Since we are attempting to be as aggressive as possible about folding, we
617  // attempt to evaluate each possible alternative.
618  AttemptToFoldSymbolOffsetDifference(Asm, Layout, Addrs, InSet, LHS_A, LHS_B,
619  Result_Cst);
620  AttemptToFoldSymbolOffsetDifference(Asm, Layout, Addrs, InSet, LHS_A, RHS_B,
621  Result_Cst);
622  AttemptToFoldSymbolOffsetDifference(Asm, Layout, Addrs, InSet, RHS_A, LHS_B,
623  Result_Cst);
624  AttemptToFoldSymbolOffsetDifference(Asm, Layout, Addrs, InSet, RHS_A, RHS_B,
625  Result_Cst);
626  }
627 
628  // We can't represent the addition or subtraction of two symbols.
629  if ((LHS_A && RHS_A) || (LHS_B && RHS_B))
630  return false;
631 
632  // At this point, we have at most one additive symbol and one subtractive
633  // symbol -- find them.
634  const MCSymbolRefExpr *A = LHS_A ? LHS_A : RHS_A;
635  const MCSymbolRefExpr *B = LHS_B ? LHS_B : RHS_B;
636 
637  Res = MCValue::get(A, B, Result_Cst);
638  return true;
639 }
640 
642  const MCAsmLayout *Layout,
643  const MCFixup *Fixup) const {
644  MCAssembler *Assembler = Layout ? &Layout->getAssembler() : nullptr;
645  return evaluateAsRelocatableImpl(Res, Assembler, Layout, Fixup, nullptr,
646  false);
647 }
648 
649 bool MCExpr::evaluateAsValue(MCValue &Res, const MCAsmLayout &Layout) const {
650  MCAssembler *Assembler = &Layout.getAssembler();
651  return evaluateAsRelocatableImpl(Res, Assembler, &Layout, nullptr, nullptr,
652  true);
653 }
654 
655 static bool canExpand(const MCSymbol &Sym, bool InSet) {
656  const MCExpr *Expr = Sym.getVariableValue();
657  const auto *Inner = dyn_cast<MCSymbolRefExpr>(Expr);
658  if (Inner) {
659  if (Inner->getKind() == MCSymbolRefExpr::VK_WEAKREF)
660  return false;
661  }
662 
663  if (InSet)
664  return true;
665  return !Sym.isInSection();
666 }
667 
669  const MCAsmLayout *Layout,
670  const MCFixup *Fixup,
671  const SectionAddrMap *Addrs,
672  bool InSet) const {
673  ++stats::MCExprEvaluate;
674 
675  switch (getKind()) {
676  case Target:
677  return cast<MCTargetExpr>(this)->evaluateAsRelocatableImpl(Res, Layout,
678  Fixup);
679 
680  case Constant:
681  Res = MCValue::get(cast<MCConstantExpr>(this)->getValue());
682  return true;
683 
684  case SymbolRef: {
685  const MCSymbolRefExpr *SRE = cast<MCSymbolRefExpr>(this);
686  const MCSymbol &Sym = SRE->getSymbol();
687 
688  // Evaluate recursively if this is a variable.
689  if (Sym.isVariable() && SRE->getKind() == MCSymbolRefExpr::VK_None &&
690  canExpand(Sym, InSet)) {
691  bool IsMachO = SRE->hasSubsectionsViaSymbols();
692  if (Sym.getVariableValue()->evaluateAsRelocatableImpl(
693  Res, Asm, Layout, Fixup, Addrs, InSet || IsMachO)) {
694  if (!IsMachO)
695  return true;
696 
697  const MCSymbolRefExpr *A = Res.getSymA();
698  const MCSymbolRefExpr *B = Res.getSymB();
699  // FIXME: This is small hack. Given
700  // a = b + 4
701  // .long a
702  // the OS X assembler will completely drop the 4. We should probably
703  // include it in the relocation or produce an error if that is not
704  // possible.
705  // Allow constant expressions.
706  if (!A && !B)
707  return true;
708  // Allows aliases with zero offset.
709  if (Res.getConstant() == 0 && (!A || !B))
710  return true;
711  }
712  }
713 
714  Res = MCValue::get(SRE, nullptr, 0);
715  return true;
716  }
717 
718  case Unary: {
719  const MCUnaryExpr *AUE = cast<MCUnaryExpr>(this);
720  MCValue Value;
721 
722  if (!AUE->getSubExpr()->evaluateAsRelocatableImpl(Value, Asm, Layout, Fixup,
723  Addrs, InSet))
724  return false;
725 
726  switch (AUE->getOpcode()) {
727  case MCUnaryExpr::LNot:
728  if (!Value.isAbsolute())
729  return false;
730  Res = MCValue::get(!Value.getConstant());
731  break;
732  case MCUnaryExpr::Minus:
733  /// -(a - b + const) ==> (b - a - const)
734  if (Value.getSymA() && !Value.getSymB())
735  return false;
736 
737  // The cast avoids undefined behavior if the constant is INT64_MIN.
738  Res = MCValue::get(Value.getSymB(), Value.getSymA(),
739  -(uint64_t)Value.getConstant());
740  break;
741  case MCUnaryExpr::Not:
742  if (!Value.isAbsolute())
743  return false;
744  Res = MCValue::get(~Value.getConstant());
745  break;
746  case MCUnaryExpr::Plus:
747  Res = Value;
748  break;
749  }
750 
751  return true;
752  }
753 
754  case Binary: {
755  const MCBinaryExpr *ABE = cast<MCBinaryExpr>(this);
756  MCValue LHSValue, RHSValue;
757 
758  if (!ABE->getLHS()->evaluateAsRelocatableImpl(LHSValue, Asm, Layout, Fixup,
759  Addrs, InSet) ||
760  !ABE->getRHS()->evaluateAsRelocatableImpl(RHSValue, Asm, Layout, Fixup,
761  Addrs, InSet)) {
762  // Check if both are Target Expressions, see if we can compare them.
763  if (const MCTargetExpr *L = dyn_cast<MCTargetExpr>(ABE->getLHS()))
764  if (const MCTargetExpr *R = cast<MCTargetExpr>(ABE->getRHS())) {
765  switch (ABE->getOpcode()) {
766  case MCBinaryExpr::EQ:
767  Res = MCValue::get((L->isEqualTo(R)) ? -1 : 0);
768  return true;
769  case MCBinaryExpr::NE:
770  Res = MCValue::get((R->isEqualTo(R)) ? 0 : -1);
771  return true;
772  default: break;
773  }
774  }
775  return false;
776  }
777 
778  // We only support a few operations on non-constant expressions, handle
779  // those first.
780  if (!LHSValue.isAbsolute() || !RHSValue.isAbsolute()) {
781  switch (ABE->getOpcode()) {
782  default:
783  return false;
784  case MCBinaryExpr::Sub:
785  // Negate RHS and add.
786  // The cast avoids undefined behavior if the constant is INT64_MIN.
787  return EvaluateSymbolicAdd(Asm, Layout, Addrs, InSet, LHSValue,
788  RHSValue.getSymB(), RHSValue.getSymA(),
789  -(uint64_t)RHSValue.getConstant(), Res);
790 
791  case MCBinaryExpr::Add:
792  return EvaluateSymbolicAdd(Asm, Layout, Addrs, InSet, LHSValue,
793  RHSValue.getSymA(), RHSValue.getSymB(),
794  RHSValue.getConstant(), Res);
795  }
796  }
797 
798  // FIXME: We need target hooks for the evaluation. It may be limited in
799  // width, and gas defines the result of comparisons differently from
800  // Apple as.
801  int64_t LHS = LHSValue.getConstant(), RHS = RHSValue.getConstant();
802  int64_t Result = 0;
803  auto Op = ABE->getOpcode();
804  switch (Op) {
805  case MCBinaryExpr::AShr: Result = LHS >> RHS; break;
806  case MCBinaryExpr::Add: Result = LHS + RHS; break;
807  case MCBinaryExpr::And: Result = LHS & RHS; break;
808  case MCBinaryExpr::Div:
809  case MCBinaryExpr::Mod:
810  // Handle division by zero. gas just emits a warning and keeps going,
811  // we try to be stricter.
812  // FIXME: Currently the caller of this function has no way to understand
813  // we're bailing out because of 'division by zero'. Therefore, it will
814  // emit a 'expected relocatable expression' error. It would be nice to
815  // change this code to emit a better diagnostic.
816  if (RHS == 0)
817  return false;
818  if (ABE->getOpcode() == MCBinaryExpr::Div)
819  Result = LHS / RHS;
820  else
821  Result = LHS % RHS;
822  break;
823  case MCBinaryExpr::EQ: Result = LHS == RHS; break;
824  case MCBinaryExpr::GT: Result = LHS > RHS; break;
825  case MCBinaryExpr::GTE: Result = LHS >= RHS; break;
826  case MCBinaryExpr::LAnd: Result = LHS && RHS; break;
827  case MCBinaryExpr::LOr: Result = LHS || RHS; break;
828  case MCBinaryExpr::LShr: Result = uint64_t(LHS) >> uint64_t(RHS); break;
829  case MCBinaryExpr::LT: Result = LHS < RHS; break;
830  case MCBinaryExpr::LTE: Result = LHS <= RHS; break;
831  case MCBinaryExpr::Mul: Result = LHS * RHS; break;
832  case MCBinaryExpr::NE: Result = LHS != RHS; break;
833  case MCBinaryExpr::Or: Result = LHS | RHS; break;
834  case MCBinaryExpr::Shl: Result = uint64_t(LHS) << uint64_t(RHS); break;
835  case MCBinaryExpr::Sub: Result = LHS - RHS; break;
836  case MCBinaryExpr::Xor: Result = LHS ^ RHS; break;
837  }
838 
839  switch (Op) {
840  default:
841  Res = MCValue::get(Result);
842  break;
843  case MCBinaryExpr::EQ:
844  case MCBinaryExpr::GT:
845  case MCBinaryExpr::GTE:
846  case MCBinaryExpr::LT:
847  case MCBinaryExpr::LTE:
848  case MCBinaryExpr::NE:
849  // A comparison operator returns a -1 if true and 0 if false.
850  Res = MCValue::get(Result ? -1 : 0);
851  break;
852  }
853 
854  return true;
855  }
856  }
857 
858  llvm_unreachable("Invalid assembly expression kind!");
859 }
860 
862  switch (getKind()) {
863  case Target:
864  // We never look through target specific expressions.
865  return cast<MCTargetExpr>(this)->findAssociatedFragment();
866 
867  case Constant:
869 
870  case SymbolRef: {
871  const MCSymbolRefExpr *SRE = cast<MCSymbolRefExpr>(this);
872  const MCSymbol &Sym = SRE->getSymbol();
873  return Sym.getFragment();
874  }
875 
876  case Unary:
877  return cast<MCUnaryExpr>(this)->getSubExpr()->findAssociatedFragment();
878 
879  case Binary: {
880  const MCBinaryExpr *BE = cast<MCBinaryExpr>(this);
881  MCFragment *LHS_F = BE->getLHS()->findAssociatedFragment();
882  MCFragment *RHS_F = BE->getRHS()->findAssociatedFragment();
883 
884  // If either is absolute, return the other.
886  return RHS_F;
888  return LHS_F;
889 
890  // Not always correct, but probably the best we can do without more context.
891  if (BE->getOpcode() == MCBinaryExpr::Sub)
893 
894  // Otherwise, return the first non-null fragment.
895  return LHS_F ? LHS_F : RHS_F;
896  }
897  }
898 
899  llvm_unreachable("Invalid assembly expression kind!");
900 }
Signed less than comparison (result is either 0 or some target-specific non-zero value).
Definition: MCExpr.h:429
Bitwise negation.
Definition: MCExpr.h:364
This class represents lattice values for constants.
Definition: AllocatorList.h:23
Signed less than or equal comparison (result is either 0 or some target-specific non-zero value)...
Definition: MCExpr.h:431
This represents an "assembler immediate".
Definition: MCValue.h:39
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
VariantKind getKind() const
Definition: MCExpr.h:337
Bitwise and.
Definition: MCExpr.h:420
Multiplication.
Definition: MCExpr.h:434
Opcode getOpcode() const
Get the kind of this unary expression.
Definition: MCExpr.h:403
const MCExpr * getLHS() const
Get the left-hand side expression of the binary operator.
Definition: MCExpr.h:563
Unary plus.
Definition: MCExpr.h:365
STATISTIC(NumFunctions, "Total number of functions")
Equality comparison.
Definition: MCExpr.h:422
Bitwise or.
Definition: MCExpr.h:436
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:73
int64_t getConstant() const
Definition: MCValue.h:46
const MCSymbolRefExpr * getSymB() const
Definition: MCValue.h:48
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:28
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
This is an extension point for target-specific MCExpr subclasses to implement.
Definition: MCExpr.h:580
bool isInSection() const
isInSection - Check if this symbol is defined in some section (i.e., it is defined but not absolute)...
Definition: MCSymbol.h:251
Represent a reference to a symbol from inside an expression.
Definition: MCExpr.h:165
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:126
Arithmetic shift right.
Definition: MCExpr.h:438
bool evaluateAsRelocatable(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const
Try to evaluate the expression to a relocatable value, i.e.
Definition: MCExpr.cpp:641
const MCExpr * getRHS() const
Get the right-hand side expression of the binary operator.
Definition: MCExpr.h:566
Logical or.
Definition: MCExpr.h:428
Signed remainder.
Definition: MCExpr.h:433
Unary assembler expressions.
Definition: MCExpr.h:359
static bool canExpand(const MCSymbol &Sym, bool InSet)
Definition: MCExpr.cpp:655
Signed division.
Definition: MCExpr.h:421
MCAssembler & getAssembler() const
Get the assembler object this is a layout for.
Definition: MCAsmLayout.h:50
Unary expressions.
Definition: MCExpr.h:41
Shift left.
Definition: MCExpr.h:437
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:55
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
void print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens=false) const
Definition: MCExpr.cpp:41
This is an important base class in LLVM.
Definition: Constant.h:41
static bool EvaluateSymbolicAdd(const MCAssembler *Asm, const MCAsmLayout *Layout, const SectionAddrMap *Addrs, bool InSet, const MCValue &LHS, const MCSymbolRefExpr *RHS_A, const MCSymbolRefExpr *RHS_B, int64_t RHS_Cst, MCValue &Res)
Evaluate the result of an add between (conceptually) two MCValues.
Definition: MCExpr.cpp:586
const MCSymbolRefExpr * getSymA() const
Definition: MCValue.h:47
Logical negation.
Definition: MCExpr.h:362
Logical and.
Definition: MCExpr.h:427
Binary assembler expressions.
Definition: MCExpr.h:416
bool hasSubsectionsViaSymbols() const
Definition: MCExpr.h:341
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static MCFragment * AbsolutePseudoFragment
Definition: MCSymbol.h:63
void printVariantKind(raw_ostream &OS) const
Definition: MCExpr.cpp:433
const MCSymbol & getSymbol() const
Definition: MCExpr.h:335
ExprKind getKind() const
Definition: MCExpr.h:72
MCFragment * getFragment(bool SetUsed=true) const
Definition: MCSymbol.h:383
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm, const MCAsmLayout *Layout, const MCFixup *Fixup, const SectionAddrMap *Addrs, bool InSet) const
Definition: MCExpr.cpp:668
Inequality comparison.
Definition: MCExpr.h:435
Signed greater than comparison (result is either 0 or some target-specific non-zero value) ...
Definition: MCExpr.h:423
MCFragment * findAssociatedFragment() const
Find the "associated section" for this expression, which is currently defined as the absolute section...
Definition: MCExpr.cpp:861
Signed greater than or equal comparison (result is either 0 or some target-specific non-zero value)...
Definition: MCExpr.h:425
Target - Wrapper for Target specific information.
Bitwise exclusive or.
Definition: MCExpr.h:441
Logical shift right.
Definition: MCExpr.h:439
static MCValue get(const MCSymbolRefExpr *SymA, const MCSymbolRefExpr *SymB=nullptr, int64_t Val=0, uint32_t RefKind=0)
Definition: MCValue.h:62
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Definition: Casting.h:322
References to labels and assigned expressions.
Definition: MCExpr.h:40
Unary minus.
Definition: MCExpr.h:363
bool evaluateAsValue(MCValue &Res, const MCAsmLayout &Layout) const
Try to evaluate the expression to the form (a - b + constant) where neither a nor b are variables...
Definition: MCExpr.cpp:649
Opcode getOpcode() const
Get the kind of this binary expression.
Definition: MCExpr.h:560
StringRef getName() const
getName - Get the symbol name.
Definition: MCSymbol.h:202
const MCExpr * getVariableValue(bool SetUsed=true) const
getVariableValue - Get the value for variable symbols.
Definition: MCSymbol.h:298
const MCExpr * getSubExpr() const
Get the child of this unary expression.
Definition: MCExpr.h:406
LLVM Value Representation.
Definition: Value.h:72
Constant expressions.
Definition: MCExpr.h:39
Binary expressions.
Definition: MCExpr.h:38
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
Subtraction.
Definition: MCExpr.h:440
Target specific expression.
Definition: MCExpr.h:42
void print(raw_ostream &OS, const MCAsmInfo *MAI) const
print - Print the value to the stream OS.
Definition: MCSymbol.cpp:59