Avoid unnecessary +0 in experimental-asm-printer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80603 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2009-08-31 19:13:47 +00:00
parent 6ceea33c5e
commit 64926be847

View File

@ -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);
}