1 //===- MCExpr.cpp - Assembly Level Expression Implementation --------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #define DEBUG_TYPE "mcexpr"
11 #include "llvm/MC/MCExpr.h"
12 #include "llvm/ADT/Statistic.h"
13 #include "llvm/ADT/StringSwitch.h"
14 #include "llvm/MC/MCAsmLayout.h"
15 #include "llvm/MC/MCAssembler.h"
16 #include "llvm/MC/MCContext.h"
17 #include "llvm/MC/MCObjectWriter.h"
18 #include "llvm/MC/MCSymbol.h"
19 #include "llvm/MC/MCValue.h"
20 #include "llvm/Support/Debug.h"
21 #include "llvm/Support/ErrorHandling.h"
22 #include "llvm/Support/raw_ostream.h"
27 STATISTIC(MCExprEvaluate, "Number of MCExpr evaluations");
31 void MCExpr::print(raw_ostream &OS) const {
34 return cast<MCTargetExpr>(this)->PrintImpl(OS);
35 case MCExpr::Constant:
36 OS << cast<MCConstantExpr>(*this).getValue();
39 case MCExpr::SymbolRef: {
40 const MCSymbolRefExpr &SRE = cast<MCSymbolRefExpr>(*this);
41 const MCSymbol &Sym = SRE.getSymbol();
42 // Parenthesize names that start with $ so that they don't look like
44 bool UseParens = Sym.getName()[0] == '$';
46 if (SRE.getKind() == MCSymbolRefExpr::VK_PPC_DARWIN_HA16 ||
47 SRE.getKind() == MCSymbolRefExpr::VK_PPC_DARWIN_LO16) {
48 OS << MCSymbolRefExpr::getVariantKindName(SRE.getKind());
53 OS << '(' << Sym << ')';
57 if (SRE.getKind() == MCSymbolRefExpr::VK_ARM_NONE ||
58 SRE.getKind() == MCSymbolRefExpr::VK_ARM_PLT ||
59 SRE.getKind() == MCSymbolRefExpr::VK_ARM_TLSGD ||
60 SRE.getKind() == MCSymbolRefExpr::VK_ARM_GOT ||
61 SRE.getKind() == MCSymbolRefExpr::VK_ARM_GOTOFF ||
62 SRE.getKind() == MCSymbolRefExpr::VK_ARM_TPOFF ||
63 SRE.getKind() == MCSymbolRefExpr::VK_ARM_GOTTPOFF ||
64 SRE.getKind() == MCSymbolRefExpr::VK_ARM_TARGET1 ||
65 SRE.getKind() == MCSymbolRefExpr::VK_ARM_TARGET2 ||
66 SRE.getKind() == MCSymbolRefExpr::VK_ARM_PREL31)
67 OS << MCSymbolRefExpr::getVariantKindName(SRE.getKind());
68 else if (SRE.getKind() != MCSymbolRefExpr::VK_None &&
69 SRE.getKind() != MCSymbolRefExpr::VK_PPC_DARWIN_HA16 &&
70 SRE.getKind() != MCSymbolRefExpr::VK_PPC_DARWIN_LO16)
71 OS << '@' << MCSymbolRefExpr::getVariantKindName(SRE.getKind());
77 const MCUnaryExpr &UE = cast<MCUnaryExpr>(*this);
78 switch (UE.getOpcode()) {
79 case MCUnaryExpr::LNot: OS << '!'; break;
80 case MCUnaryExpr::Minus: OS << '-'; break;
81 case MCUnaryExpr::Not: OS << '~'; break;
82 case MCUnaryExpr::Plus: OS << '+'; break;
84 OS << *UE.getSubExpr();
88 case MCExpr::Binary: {
89 const MCBinaryExpr &BE = cast<MCBinaryExpr>(*this);
91 // Only print parens around the LHS if it is non-trivial.
92 if (isa<MCConstantExpr>(BE.getLHS()) || isa<MCSymbolRefExpr>(BE.getLHS())) {
95 OS << '(' << *BE.getLHS() << ')';
98 switch (BE.getOpcode()) {
99 case MCBinaryExpr::Add:
100 // Print "X-42" instead of "X+-42".
101 if (const MCConstantExpr *RHSC = dyn_cast<MCConstantExpr>(BE.getRHS())) {
102 if (RHSC->getValue() < 0) {
103 OS << RHSC->getValue();
110 case MCBinaryExpr::And: OS << '&'; break;
111 case MCBinaryExpr::Div: OS << '/'; break;
112 case MCBinaryExpr::EQ: OS << "=="; break;
113 case MCBinaryExpr::GT: OS << '>'; break;
114 case MCBinaryExpr::GTE: OS << ">="; break;
115 case MCBinaryExpr::LAnd: OS << "&&"; break;
116 case MCBinaryExpr::LOr: 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::Shr: OS << ">>"; break;
125 case MCBinaryExpr::Sub: OS << '-'; break;
126 case MCBinaryExpr::Xor: OS << '^'; break;
129 // Only print parens around the LHS if it is non-trivial.
130 if (isa<MCConstantExpr>(BE.getRHS()) || isa<MCSymbolRefExpr>(BE.getRHS())) {
133 OS << '(' << *BE.getRHS() << ')';
139 llvm_unreachable("Invalid expression kind!");
142 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
143 void MCExpr::dump() const {
151 const MCBinaryExpr *MCBinaryExpr::Create(Opcode Opc, const MCExpr *LHS,
152 const MCExpr *RHS, MCContext &Ctx) {
153 return new (Ctx) MCBinaryExpr(Opc, LHS, RHS);
156 const MCUnaryExpr *MCUnaryExpr::Create(Opcode Opc, const MCExpr *Expr,
158 return new (Ctx) MCUnaryExpr(Opc, Expr);
161 const MCConstantExpr *MCConstantExpr::Create(int64_t Value, MCContext &Ctx) {
162 return new (Ctx) MCConstantExpr(Value);
167 const MCSymbolRefExpr *MCSymbolRefExpr::Create(const MCSymbol *Sym,
170 return new (Ctx) MCSymbolRefExpr(Sym, Kind);
173 const MCSymbolRefExpr *MCSymbolRefExpr::Create(StringRef Name, VariantKind Kind,
175 return Create(Ctx.GetOrCreateSymbol(Name), Kind, Ctx);
178 StringRef MCSymbolRefExpr::getVariantKindName(VariantKind Kind) {
180 case VK_Invalid: return "<<invalid>>";
181 case VK_None: return "<<none>>";
183 case VK_GOT: return "GOT";
184 case VK_GOTOFF: return "GOTOFF";
185 case VK_GOTPCREL: return "GOTPCREL";
186 case VK_GOTTPOFF: return "GOTTPOFF";
187 case VK_INDNTPOFF: return "INDNTPOFF";
188 case VK_NTPOFF: return "NTPOFF";
189 case VK_GOTNTPOFF: return "GOTNTPOFF";
190 case VK_PLT: return "PLT";
191 case VK_TLSGD: return "TLSGD";
192 case VK_TLSLD: return "TLSLD";
193 case VK_TLSLDM: return "TLSLDM";
194 case VK_TPOFF: return "TPOFF";
195 case VK_DTPOFF: return "DTPOFF";
196 case VK_TLVP: return "TLVP";
197 case VK_SECREL: return "SECREL";
198 case VK_ARM_NONE: return "(NONE)";
199 case VK_ARM_PLT: return "(PLT)";
200 case VK_ARM_GOT: return "(GOT)";
201 case VK_ARM_GOTOFF: return "(GOTOFF)";
202 case VK_ARM_TPOFF: return "(tpoff)";
203 case VK_ARM_GOTTPOFF: return "(gottpoff)";
204 case VK_ARM_TLSGD: return "(tlsgd)";
205 case VK_ARM_TARGET1: return "(target1)";
206 case VK_ARM_TARGET2: return "(target2)";
207 case VK_ARM_PREL31: return "(prel31)";
208 case VK_PPC_TOC: return "tocbase";
209 case VK_PPC_TOC_ENTRY: return "toc";
210 case VK_PPC_DARWIN_HA16: return "ha16";
211 case VK_PPC_DARWIN_LO16: return "lo16";
212 case VK_PPC_GAS_HA16: return "ha";
213 case VK_PPC_GAS_LO16: return "l";
214 case VK_PPC_TPREL16_HA: return "tprel@ha";
215 case VK_PPC_TPREL16_LO: return "tprel@l";
216 case VK_PPC_TOC16_HA: return "toc@ha";
217 case VK_PPC_TOC16_LO: return "toc@l";
218 case VK_PPC_GOT_TPREL16_DS: return "got@tprel";
219 case VK_PPC_TLS: return "tls";
220 case VK_PPC_GOT_TLSGD16_HA: return "got@tlsgd@ha";
221 case VK_PPC_GOT_TLSGD16_LO: return "got@tlsgd@l";
222 case VK_PPC_TLSGD: return "tlsgd";
223 case VK_Mips_GPREL: return "GPREL";
224 case VK_Mips_GOT_CALL: return "GOT_CALL";
225 case VK_Mips_GOT16: return "GOT16";
226 case VK_Mips_GOT: return "GOT";
227 case VK_Mips_ABS_HI: return "ABS_HI";
228 case VK_Mips_ABS_LO: return "ABS_LO";
229 case VK_Mips_TLSGD: return "TLSGD";
230 case VK_Mips_TLSLDM: return "TLSLDM";
231 case VK_Mips_DTPREL_HI: return "DTPREL_HI";
232 case VK_Mips_DTPREL_LO: return "DTPREL_LO";
233 case VK_Mips_GOTTPREL: return "GOTTPREL";
234 case VK_Mips_TPREL_HI: return "TPREL_HI";
235 case VK_Mips_TPREL_LO: return "TPREL_LO";
236 case VK_Mips_GPOFF_HI: return "GPOFF_HI";
237 case VK_Mips_GPOFF_LO: return "GPOFF_LO";
238 case VK_Mips_GOT_DISP: return "GOT_DISP";
239 case VK_Mips_GOT_PAGE: return "GOT_PAGE";
240 case VK_Mips_GOT_OFST: return "GOT_OFST";
241 case VK_Mips_HIGHER: return "HIGHER";
242 case VK_Mips_HIGHEST: return "HIGHEST";
243 case VK_Mips_GOT_HI16: return "GOT_HI16";
244 case VK_Mips_GOT_LO16: return "GOT_LO16";
245 case VK_Mips_CALL_HI16: return "CALL_HI16";
246 case VK_Mips_CALL_LO16: return "CALL_LO16";
248 llvm_unreachable("Invalid variant kind");
251 MCSymbolRefExpr::VariantKind
252 MCSymbolRefExpr::getVariantKindForName(StringRef Name) {
253 return StringSwitch<VariantKind>(Name)
256 .Case("GOTOFF", VK_GOTOFF)
257 .Case("gotoff", VK_GOTOFF)
258 .Case("GOTPCREL", VK_GOTPCREL)
259 .Case("gotpcrel", VK_GOTPCREL)
260 .Case("GOTTPOFF", VK_GOTTPOFF)
261 .Case("gottpoff", VK_GOTTPOFF)
262 .Case("INDNTPOFF", VK_INDNTPOFF)
263 .Case("indntpoff", VK_INDNTPOFF)
264 .Case("NTPOFF", VK_NTPOFF)
265 .Case("ntpoff", VK_NTPOFF)
266 .Case("GOTNTPOFF", VK_GOTNTPOFF)
267 .Case("gotntpoff", VK_GOTNTPOFF)
270 .Case("TLSGD", VK_TLSGD)
271 .Case("tlsgd", VK_TLSGD)
272 .Case("TLSLD", VK_TLSLD)
273 .Case("tlsld", VK_TLSLD)
274 .Case("TLSLDM", VK_TLSLDM)
275 .Case("tlsldm", VK_TLSLDM)
276 .Case("TPOFF", VK_TPOFF)
277 .Case("tpoff", VK_TPOFF)
278 .Case("DTPOFF", VK_DTPOFF)
279 .Case("dtpoff", VK_DTPOFF)
280 .Case("TLVP", VK_TLVP)
281 .Case("tlvp", VK_TLVP)
282 .Default(VK_Invalid);
287 void MCTargetExpr::anchor() {}
291 bool MCExpr::EvaluateAsAbsolute(int64_t &Res) const {
292 return EvaluateAsAbsolute(Res, 0, 0, 0);
295 bool MCExpr::EvaluateAsAbsolute(int64_t &Res,
296 const MCAsmLayout &Layout) const {
297 return EvaluateAsAbsolute(Res, &Layout.getAssembler(), &Layout, 0);
300 bool MCExpr::EvaluateAsAbsolute(int64_t &Res,
301 const MCAsmLayout &Layout,
302 const SectionAddrMap &Addrs) const {
303 return EvaluateAsAbsolute(Res, &Layout.getAssembler(), &Layout, &Addrs);
306 bool MCExpr::EvaluateAsAbsolute(int64_t &Res, const MCAssembler &Asm) const {
307 return EvaluateAsAbsolute(Res, &Asm, 0, 0);
310 bool MCExpr::EvaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
311 const MCAsmLayout *Layout,
312 const SectionAddrMap *Addrs) const {
315 // Fast path constants.
316 if (const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(this)) {
317 Res = CE->getValue();
321 // FIXME: The use if InSet = Addrs is a hack. Setting InSet causes us
322 // absolutize differences across sections and that is what the MachO writer
325 EvaluateAsRelocatableImpl(Value, Asm, Layout, Addrs, /*InSet*/ Addrs);
327 // Record the current value.
328 Res = Value.getConstant();
330 return IsRelocatable && Value.isAbsolute();
333 /// \brief Helper method for \see EvaluateSymbolAdd().
334 static void AttemptToFoldSymbolOffsetDifference(const MCAssembler *Asm,
335 const MCAsmLayout *Layout,
336 const SectionAddrMap *Addrs,
338 const MCSymbolRefExpr *&A,
339 const MCSymbolRefExpr *&B,
344 const MCSymbol &SA = A->getSymbol();
345 const MCSymbol &SB = B->getSymbol();
347 if (SA.isUndefined() || SB.isUndefined())
350 if (!Asm->getWriter().IsSymbolRefDifferenceFullyResolved(*Asm, A, B, InSet))
353 MCSymbolData &AD = Asm->getSymbolData(SA);
354 MCSymbolData &BD = Asm->getSymbolData(SB);
356 if (AD.getFragment() == BD.getFragment()) {
357 Addend += (AD.getOffset() - BD.getOffset());
359 // Pointers to Thumb symbols need to have their low-bit set to allow
361 if (Asm->isThumbFunc(&SA))
364 // Clear the symbol expr pointers to indicate we have folded these
373 const MCSectionData &SecA = *AD.getFragment()->getParent();
374 const MCSectionData &SecB = *BD.getFragment()->getParent();
376 if ((&SecA != &SecB) && !Addrs)
380 Addend += (Layout->getSymbolOffset(&Asm->getSymbolData(A->getSymbol())) -
381 Layout->getSymbolOffset(&Asm->getSymbolData(B->getSymbol())));
382 if (Addrs && (&SecA != &SecB))
383 Addend += (Addrs->lookup(&SecA) - Addrs->lookup(&SecB));
385 // Pointers to Thumb symbols need to have their low-bit set to allow
387 if (Asm->isThumbFunc(&SA))
390 // Clear the symbol expr pointers to indicate we have folded these
395 /// \brief Evaluate the result of an add between (conceptually) two MCValues.
397 /// This routine conceptually attempts to construct an MCValue:
398 /// Result = (Result_A - Result_B + Result_Cst)
399 /// from two MCValue's LHS and RHS where
400 /// Result = LHS + RHS
402 /// Result = (LHS_A - LHS_B + LHS_Cst) + (RHS_A - RHS_B + RHS_Cst).
404 /// This routine attempts to aggresively fold the operands such that the result
405 /// is representable in an MCValue, but may not always succeed.
407 /// \returns True on success, false if the result is not representable in an
410 /// NOTE: It is really important to have both the Asm and Layout arguments.
411 /// They might look redundant, but this function can be used before layout
412 /// is done (see the object streamer for example) and having the Asm argument
413 /// lets us avoid relaxations early.
414 static bool EvaluateSymbolicAdd(const MCAssembler *Asm,
415 const MCAsmLayout *Layout,
416 const SectionAddrMap *Addrs,
418 const MCValue &LHS,const MCSymbolRefExpr *RHS_A,
419 const MCSymbolRefExpr *RHS_B, int64_t RHS_Cst,
421 // FIXME: This routine (and other evaluation parts) are *incredibly* sloppy
422 // about dealing with modifiers. This will ultimately bite us, one day.
423 const MCSymbolRefExpr *LHS_A = LHS.getSymA();
424 const MCSymbolRefExpr *LHS_B = LHS.getSymB();
425 int64_t LHS_Cst = LHS.getConstant();
427 // Fold the result constant immediately.
428 int64_t Result_Cst = LHS_Cst + RHS_Cst;
430 assert((!Layout || Asm) &&
431 "Must have an assembler object if layout is given!");
433 // If we have a layout, we can fold resolved differences.
435 // First, fold out any differences which are fully resolved. By
436 // reassociating terms in
437 // Result = (LHS_A - LHS_B + LHS_Cst) + (RHS_A - RHS_B + RHS_Cst).
438 // we have the four possible differences:
443 // Since we are attempting to be as aggressive as possible about folding, we
444 // attempt to evaluate each possible alternative.
445 AttemptToFoldSymbolOffsetDifference(Asm, Layout, Addrs, InSet, LHS_A, LHS_B,
447 AttemptToFoldSymbolOffsetDifference(Asm, Layout, Addrs, InSet, LHS_A, RHS_B,
449 AttemptToFoldSymbolOffsetDifference(Asm, Layout, Addrs, InSet, RHS_A, LHS_B,
451 AttemptToFoldSymbolOffsetDifference(Asm, Layout, Addrs, InSet, RHS_A, RHS_B,
455 // We can't represent the addition or subtraction of two symbols.
456 if ((LHS_A && RHS_A) || (LHS_B && RHS_B))
459 // At this point, we have at most one additive symbol and one subtractive
460 // symbol -- find them.
461 const MCSymbolRefExpr *A = LHS_A ? LHS_A : RHS_A;
462 const MCSymbolRefExpr *B = LHS_B ? LHS_B : RHS_B;
464 // If we have a negated symbol, then we must have also have a non-negated
465 // symbol in order to encode the expression.
469 Res = MCValue::get(A, B, Result_Cst);
473 bool MCExpr::EvaluateAsRelocatable(MCValue &Res,
474 const MCAsmLayout &Layout) const {
475 return EvaluateAsRelocatableImpl(Res, &Layout.getAssembler(), &Layout,
479 bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res,
480 const MCAssembler *Asm,
481 const MCAsmLayout *Layout,
482 const SectionAddrMap *Addrs,
484 ++stats::MCExprEvaluate;
488 return cast<MCTargetExpr>(this)->EvaluateAsRelocatableImpl(Res, Layout);
491 Res = MCValue::get(cast<MCConstantExpr>(this)->getValue());
495 const MCSymbolRefExpr *SRE = cast<MCSymbolRefExpr>(this);
496 const MCSymbol &Sym = SRE->getSymbol();
498 // Evaluate recursively if this is a variable.
499 if (Sym.isVariable() && SRE->getKind() == MCSymbolRefExpr::VK_None) {
500 bool Ret = Sym.getVariableValue()->EvaluateAsRelocatableImpl(Res, Asm,
504 // If we failed to simplify this to a constant, let the target
506 if (Ret && !Res.getSymA() && !Res.getSymB())
510 Res = MCValue::get(SRE, 0, 0);
515 const MCUnaryExpr *AUE = cast<MCUnaryExpr>(this);
518 if (!AUE->getSubExpr()->EvaluateAsRelocatableImpl(Value, Asm, Layout,
522 switch (AUE->getOpcode()) {
523 case MCUnaryExpr::LNot:
524 if (!Value.isAbsolute())
526 Res = MCValue::get(!Value.getConstant());
528 case MCUnaryExpr::Minus:
529 /// -(a - b + const) ==> (b - a - const)
530 if (Value.getSymA() && !Value.getSymB())
532 Res = MCValue::get(Value.getSymB(), Value.getSymA(),
533 -Value.getConstant());
535 case MCUnaryExpr::Not:
536 if (!Value.isAbsolute())
538 Res = MCValue::get(~Value.getConstant());
540 case MCUnaryExpr::Plus:
549 const MCBinaryExpr *ABE = cast<MCBinaryExpr>(this);
550 MCValue LHSValue, RHSValue;
552 if (!ABE->getLHS()->EvaluateAsRelocatableImpl(LHSValue, Asm, Layout,
554 !ABE->getRHS()->EvaluateAsRelocatableImpl(RHSValue, Asm, Layout,
558 // We only support a few operations on non-constant expressions, handle
560 if (!LHSValue.isAbsolute() || !RHSValue.isAbsolute()) {
561 switch (ABE->getOpcode()) {
564 case MCBinaryExpr::Sub:
565 // Negate RHS and add.
566 return EvaluateSymbolicAdd(Asm, Layout, Addrs, InSet, LHSValue,
567 RHSValue.getSymB(), RHSValue.getSymA(),
568 -RHSValue.getConstant(),
571 case MCBinaryExpr::Add:
572 return EvaluateSymbolicAdd(Asm, Layout, Addrs, InSet, LHSValue,
573 RHSValue.getSymA(), RHSValue.getSymB(),
574 RHSValue.getConstant(),
579 // FIXME: We need target hooks for the evaluation. It may be limited in
580 // width, and gas defines the result of comparisons and right shifts
581 // differently from Apple as.
582 int64_t LHS = LHSValue.getConstant(), RHS = RHSValue.getConstant();
584 switch (ABE->getOpcode()) {
585 case MCBinaryExpr::Add: Result = LHS + RHS; break;
586 case MCBinaryExpr::And: Result = LHS & RHS; break;
587 case MCBinaryExpr::Div: Result = LHS / RHS; break;
588 case MCBinaryExpr::EQ: Result = LHS == RHS; break;
589 case MCBinaryExpr::GT: Result = LHS > RHS; break;
590 case MCBinaryExpr::GTE: Result = LHS >= RHS; break;
591 case MCBinaryExpr::LAnd: Result = LHS && RHS; break;
592 case MCBinaryExpr::LOr: Result = LHS || RHS; break;
593 case MCBinaryExpr::LT: Result = LHS < RHS; break;
594 case MCBinaryExpr::LTE: Result = LHS <= RHS; break;
595 case MCBinaryExpr::Mod: Result = LHS % RHS; break;
596 case MCBinaryExpr::Mul: Result = LHS * RHS; break;
597 case MCBinaryExpr::NE: Result = LHS != RHS; break;
598 case MCBinaryExpr::Or: Result = LHS | RHS; break;
599 case MCBinaryExpr::Shl: Result = LHS << RHS; break;
600 case MCBinaryExpr::Shr: Result = LHS >> RHS; break;
601 case MCBinaryExpr::Sub: Result = LHS - RHS; break;
602 case MCBinaryExpr::Xor: Result = LHS ^ RHS; break;
605 Res = MCValue::get(Result);
610 llvm_unreachable("Invalid assembly expression kind!");
613 const MCSection *MCExpr::FindAssociatedSection() const {
616 // We never look through target specific expressions.
617 return cast<MCTargetExpr>(this)->FindAssociatedSection();
620 return MCSymbol::AbsolutePseudoSection;
623 const MCSymbolRefExpr *SRE = cast<MCSymbolRefExpr>(this);
624 const MCSymbol &Sym = SRE->getSymbol();
627 return &Sym.getSection();
633 return cast<MCUnaryExpr>(this)->getSubExpr()->FindAssociatedSection();
636 const MCBinaryExpr *BE = cast<MCBinaryExpr>(this);
637 const MCSection *LHS_S = BE->getLHS()->FindAssociatedSection();
638 const MCSection *RHS_S = BE->getRHS()->FindAssociatedSection();
640 // If either section is absolute, return the other.
641 if (LHS_S == MCSymbol::AbsolutePseudoSection)
643 if (RHS_S == MCSymbol::AbsolutePseudoSection)
646 // Otherwise, return the first non-null section.
647 return LHS_S ? LHS_S : RHS_S;
651 llvm_unreachable("Invalid assembly expression kind!");