[llvm-commits] [llvm] r81269 - /llvm/trunk/lib/MC/MCExpr.cpp
Chris Lattner
sabre at nondot.org
Tue Sep 8 16:20:51 PDT 2009
Author: lattner
Date: Tue Sep 8 18:20:50 2009
New Revision: 81269
URL: http://llvm.org/viewvc/llvm-project?rev=81269&view=rev
Log:
parenthesize symbol names that start with $, fixing X86/dollar-name.ll with
the new asmprinter.
Modified:
llvm/trunk/lib/MC/MCExpr.cpp
Modified: llvm/trunk/lib/MC/MCExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=81269&r1=81268&r2=81269&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCExpr.cpp (original)
+++ llvm/trunk/lib/MC/MCExpr.cpp Tue Sep 8 18:20:50 2009
@@ -20,9 +20,20 @@
OS << cast<MCConstantExpr>(*this).getValue();
return;
- case MCExpr::SymbolRef:
- cast<MCSymbolRefExpr>(*this).getSymbol().print(OS, MAI);
+ case MCExpr::SymbolRef: {
+ const MCSymbol &Sym = cast<MCSymbolRefExpr>(*this).getSymbol();
+
+ // Parenthesize names that start with $ so that they don't look like
+ // absolute names.
+ if (Sym.getName()[0] == '$') {
+ OS << '(';
+ Sym.print(OS, MAI);
+ OS << ')';
+ } else {
+ Sym.print(OS, MAI);
+ }
return;
+ }
case MCExpr::Unary: {
const MCUnaryExpr &UE = cast<MCUnaryExpr>(*this);
More information about the llvm-commits
mailing list