Ty = cast<PointerType>(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 :)
O << "@TLSGD";
break;
case TLSModel::InitialExec:
- if (Subtarget->is64Bit())
- O << "@TLSGD"; // 64 bit intial exec not implemented
- else
+ if (Subtarget->is64Bit()) {
+ assert (!NotRIPRel);
+ O << "@GOTTPOFF(%rip)";
+ } else {
O << "@INDNTPOFF";
+ }
break;
case TLSModel::LocalExec:
if (Subtarget->is64Bit())
- O << "@TLSGD"; // 64 bit local exec not implemented
+ O << "@TPOFF";
else
O << "@NTPOFF";
break;
}
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();
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
}
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();
}
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,
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;
}
}
// 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;
}
}
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());