X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTarget%2FX86%2FAsmPrinter%2FX86ATTAsmPrinter.cpp;h=c88af21784c34eb3705469607a141995d7ea4452;hb=777d2306b36816a53bc1ae1244c0dc7d998ae691;hp=65ce5acb9dfe78c2e9a9200abf819ca470bccf3a;hpb=7ff5bff45eaa1fabf8bb910daf2907cf981cbf3d;p=oota-llvm.git diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp index 65ce5acb9df..c88af21784c 100644 --- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp @@ -76,7 +76,7 @@ static X86MachineFunctionInfo calculateFunctionInfo(const Function *F, Ty = cast(Ty)->getElementType(); // Size should be aligned to DWORD boundary - Size += ((TD->getTypePaddedSize(Ty) + 3)/4)*4; + Size += ((TD->getTypeAllocSize(Ty) + 3)/4)*4; } // We're not supporting tooooo huge arguments :) @@ -501,6 +501,7 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo, } case MachineOperand::MO_ExternalSymbol: { bool isCallOp = Modifier && !strcmp(Modifier, "call"); + bool isMemOp = Modifier && !strcmp(Modifier, "mem"); bool needCloseParen = false; std::string Name(TAI->getGlobalPrefix()); Name += MO.getSymbolName(); @@ -511,7 +512,7 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo, printSuffixedName(Name, "$stub"); return; } - if (!isCallOp) + if (!isMemOp && !isCallOp) O << '$'; else if (Name[0] == '$') { // The name begins with a dollar-sign. In order to avoid having it look @@ -569,15 +570,17 @@ void X86ATTAsmPrinter::printSSECC(const MachineInstr *MI, unsigned Op) { } void X86ATTAsmPrinter::printLeaMemReference(const MachineInstr *MI, unsigned Op, - const char *Modifier){ + const char *Modifier, + bool NotRIPRel) { MachineOperand BaseReg = MI->getOperand(Op); MachineOperand IndexReg = MI->getOperand(Op+2); const MachineOperand &DispSpec = MI->getOperand(Op+3); - bool NotRIPRel = IndexReg.getReg() || BaseReg.getReg(); + NotRIPRel |= IndexReg.getReg() || BaseReg.getReg(); if (DispSpec.isGlobal() || DispSpec.isCPI() || - DispSpec.isJTI()) { + DispSpec.isJTI() || + DispSpec.isSymbol()) { printOperand(MI, Op+3, "mem", NotRIPRel); } else { int DispVal = DispSpec.getImm(); @@ -613,14 +616,14 @@ void X86ATTAsmPrinter::printLeaMemReference(const MachineInstr *MI, unsigned Op, } void X86ATTAsmPrinter::printMemReference(const MachineInstr *MI, unsigned Op, - const char *Modifier){ + const char *Modifier, bool NotRIPRel){ assert(isMem(MI, Op) && "Invalid memory reference!"); MachineOperand Segment = MI->getOperand(Op+4); if (Segment.getReg()) { printOperand(MI, Op+4, Modifier); O << ':'; } - printLeaMemReference(MI, Op, Modifier); + printLeaMemReference(MI, Op, Modifier, NotRIPRel); } void X86ATTAsmPrinter::printPICJumpTableSetLabel(unsigned uid, @@ -721,7 +724,7 @@ bool X86ATTAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, return false; case 'P': // Don't print @PLT, but do print as memory. - printOperand(MI, OpNo, "mem"); + printOperand(MI, OpNo, "mem", /*NotRIPRel=*/true); return false; } } @@ -747,7 +750,7 @@ bool X86ATTAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, // These only apply to registers, ignore on mem. break; case 'P': // Don't print @PLT, but do print as memory. - printOperand(MI, OpNo, "mem"); + printMemReference(MI, OpNo, "mem", /*NotRIPRel=*/true); return false; } } @@ -808,7 +811,7 @@ void X86ATTAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) { std::string name = Mang->getValueName(GVar); Constant *C = GVar->getInitializer(); const Type *Type = C->getType(); - unsigned Size = TD->getTypePaddedSize(Type); + unsigned Size = TD->getTypeAllocSize(Type); unsigned Align = TD->getPreferredAlignmentLog(GVar); printVisibility(name, GVar->getVisibility());