summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-09-08 23:20:50 +0000
committerChris Lattner <sabre@nondot.org>2009-09-08 23:20:50 +0000
commit22833a3cd6f24892ffb45105f13f6dbb82168921 (patch)
tree84b58c1c43da333efaa74410cc90267936cc6b57 /llvm
parentdae3e56cb75d668a77981d170215179083ca66af (diff)
downloadbcm5719-llvm-22833a3cd6f24892ffb45105f13f6dbb82168921.tar.gz
bcm5719-llvm-22833a3cd6f24892ffb45105f13f6dbb82168921.zip
parenthesize symbol names that start with $, fixing X86/dollar-name.ll with
the new asmprinter. llvm-svn: 81269
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/MC/MCExpr.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp
index 3eae6bdf3d3..c0ecad0361a 100644
--- a/llvm/lib/MC/MCExpr.cpp
+++ b/llvm/lib/MC/MCExpr.cpp
@@ -20,9 +20,20 @@ void MCExpr::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
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);
OpenPOWER on IntegriCloud