diff options
author | Fangrui Song <i@maskray.me> | 2025-03-30 16:38:16 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2025-03-30 16:38:16 -0700 |
commit | 3acccf042ab8a7b7e663bb2b2fac328d9bf65b38 (patch) | |
tree | 36148bbeb025d4700d27fed4d370e0d3d9d95ea4 /llvm/lib/MC/MCExpr.cpp | |
parent | e5fcbfa2aa8291a57e5eb03cd458935b458c73c0 (diff) | |
download | llvm-3acccf042ab8a7b7e663bb2b2fac328d9bf65b38.zip llvm-3acccf042ab8a7b7e663bb2b2fac328d9bf65b38.tar.gz llvm-3acccf042ab8a7b7e663bb2b2fac328d9bf65b38.tar.bz2 |
[MC] Don't print () around $ names
This MIPS behavior from edb9d84dcc4824865e86f963e52d67eb50dde7f5 (2010)
is obsoleted and misleading. This caused confusion in
https://reviews.llvm.org/D123702 ([NVPTX] Disable parens for identifiers
starting with '$')
Note: $tmp was rejected by AsmParser before
https://reviews.llvm.org/D75111 (2020)
Diffstat (limited to 'llvm/lib/MC/MCExpr.cpp')
-rw-r--r-- | llvm/lib/MC/MCExpr.cpp | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp index dd45a94..2532475 100644 --- a/llvm/lib/MC/MCExpr.cpp +++ b/llvm/lib/MC/MCExpr.cpp @@ -40,7 +40,7 @@ STATISTIC(MCExprEvaluate, "Number of MCExpr evaluations"); // VariantKind printing and formatting utilize MAI. operator<< (dump and some // target code) specifies MAI as nullptr and should be avoided when MAI is // needed. -void MCExpr::print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens) const { +void MCExpr::print(raw_ostream &OS, const MCAsmInfo *MAI) const { switch (getKind()) { case MCExpr::Target: return cast<MCTargetExpr>(this)->printImpl(OS, MAI); @@ -75,17 +75,7 @@ void MCExpr::print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens) const { case MCExpr::SymbolRef: { const MCSymbolRefExpr &SRE = cast<MCSymbolRefExpr>(*this); const MCSymbol &Sym = SRE.getSymbol(); - // Parenthesize names that start with $ so that they don't look like - // absolute names. - bool UseParens = MAI && MAI->useParensForDollarSignNames() && !InParens && - Sym.getName().starts_with('$'); - - if (UseParens) { - OS << '('; - Sym.print(OS, MAI); - OS << ')'; - } else - Sym.print(OS, MAI); + Sym.print(OS, MAI); const MCSymbolRefExpr::VariantKind Kind = SRE.getKind(); if (Kind != MCSymbolRefExpr::VK_None) { |