diff options
author | Fangrui Song <i@maskray.me> | 2024-07-01 18:04:27 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2024-07-01 18:04:27 -0700 |
commit | bbb50369a149d9a7d1f91efaaabf75c260a220c7 (patch) | |
tree | a54fff7d19db79f1ebdccf3cbaed05750ff6fe0a /llvm/lib/MC/MCExpr.cpp | |
parent | e3e0df391c7116b519499aab2eba8990c647cdf5 (diff) | |
download | llvm-bbb50369a149d9a7d1f91efaaabf75c260a220c7.zip llvm-bbb50369a149d9a7d1f91efaaabf75c260a220c7.tar.gz llvm-bbb50369a149d9a7d1f91efaaabf75c260a220c7.tar.bz2 |
[MC] Use a stub ctor for MCAsmLayout
and replace MCAssembler::Layout with a bool.
This mostly completes "[MC] Start merging MCAsmLayout into MCAssembler".
Diffstat (limited to 'llvm/lib/MC/MCExpr.cpp')
-rw-r--r-- | llvm/lib/MC/MCExpr.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp index 8279539..0a175ade 100644 --- a/llvm/lib/MC/MCExpr.cpp +++ b/llvm/lib/MC/MCExpr.cpp @@ -626,7 +626,7 @@ static void AttemptToFoldSymbolOffsetDifference( // separated by a linker-relaxable instruction. If the section contains // instructions and InSet is false (not expressions in directive like // .size/.fill), disable the fast path. - const MCAsmLayout *Layout = Asm->getLayout(); + bool Layout = Asm->hasLayout(); if (Layout && (InSet || !SecA.hasInstructions() || !(Asm->getContext().getTargetTriple().isRISCV() || Asm->getContext().getTargetTriple().isLoongArch()))) { @@ -817,7 +817,6 @@ bool MCExpr::evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm, const SectionAddrMap *Addrs, bool InSet) const { ++stats::MCExprEvaluate; - MCAsmLayout *Layout = Asm ? Asm->getLayout() : nullptr; switch (getKind()) { case Target: return cast<MCTargetExpr>(this)->evaluateAsRelocatableImpl(Res, Asm, Fixup); @@ -830,6 +829,7 @@ bool MCExpr::evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm, const MCSymbolRefExpr *SRE = cast<MCSymbolRefExpr>(this); const MCSymbol &Sym = SRE->getSymbol(); const auto Kind = SRE->getKind(); + bool Layout = Asm && Asm->hasLayout(); // Evaluate recursively if this is a variable. if (Sym.isVariable() && (Kind == MCSymbolRefExpr::VK_None || Layout) && |