[llvm-commits] [llvm] r80603 - /llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
Daniel Dunbar
daniel at zuster.org
Mon Aug 31 12:13:48 PDT 2009
Author: ddunbar
Date: Mon Aug 31 14:13:47 2009
New Revision: 80603
URL: http://llvm.org/viewvc/llvm-project?rev=80603&view=rev
Log:
Avoid unnecessary +0 in experimental-asm-printer.
Modified:
llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=80603&r1=80602&r2=80603&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Mon Aug 31 14:13:47 2009
@@ -802,9 +802,10 @@
Expr = MCBinaryExpr::CreateSub(Expr, MCSymbolRefExpr::Create(NegatedSymbol,
OutContext),
OutContext);
- Expr = MCBinaryExpr::CreateAdd(Expr, MCConstantExpr::Create(MO.getOffset(),
- OutContext),
- OutContext);
+ if (MO.getOffset())
+ Expr = MCBinaryExpr::CreateAdd(Expr, MCConstantExpr::Create(MO.getOffset(),
+ OutContext),
+ OutContext);
return MCOperand::CreateExpr(Expr);
}
@@ -819,10 +820,12 @@
MCSymbol *Sym = OutContext.GetOrCreateSymbol(Name);
// FIXME: We would like an efficient form for this, so we don't have to do a
// lot of extra uniquing.
- const MCExpr *Expr =
- MCBinaryExpr::CreateAdd(MCSymbolRefExpr::Create(Sym, OutContext),
- MCConstantExpr::Create(MO.getOffset(),OutContext),
- OutContext);
+ const MCExpr *Expr = MCSymbolRefExpr::Create(Sym, OutContext);
+ if (MO.getOffset())
+ Expr = MCBinaryExpr::CreateAdd(Expr,
+ MCConstantExpr::Create(MO.getOffset(),
+ OutContext),
+ OutContext);
return MCOperand::CreateExpr(Expr);
}
More information about the llvm-commits
mailing list