diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-08-31 19:13:47 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-08-31 19:13:47 +0000 |
commit | 64926be8475ae5f3016a9f5371a72d0943da267b (patch) | |
tree | 91029ab4337830880350ee5afb7e7fbd33b681e5 | |
parent | 6ceea33c5e5c00069453e48740aaef5fe1c0953b (diff) | |
download | external_llvm-64926be8475ae5f3016a9f5371a72d0943da267b.zip external_llvm-64926be8475ae5f3016a9f5371a72d0943da267b.tar.gz external_llvm-64926be8475ae5f3016a9f5371a72d0943da267b.tar.bz2 |
Avoid unnecessary +0 in experimental-asm-printer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80603 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp index 2058d7d..a9b89e8 100644 --- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp @@ -802,9 +802,10 @@ MCOperand X86ATTAsmPrinter::LowerGlobalAddressOperand(const MachineOperand &MO){ 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 @@ LowerExternalSymbolOperand(const MachineOperand &MO){ 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); } |