forked from OSchip/llvm-project
move handling of dllimport linkage in isel, not in asmprinter.
llvm-svn: 75086
This commit is contained in:
parent
212f44d180
commit
47f64ea174
|
@ -351,10 +351,9 @@ void X86ATTAsmPrinter::print_pcrel_imm(const MachineInstr *MI, unsigned OpNo) {
|
|||
O << Name;
|
||||
}
|
||||
} else {
|
||||
if (GV->hasDLLImportLinkage()) {
|
||||
assert(MO.getTargetFlags() == 0);
|
||||
// Handle dllimport linkage.
|
||||
if (MO.getTargetFlags() == X86II::MO_DLLIMPORT)
|
||||
O << "__imp_";
|
||||
}
|
||||
O << Name;
|
||||
|
||||
if (shouldPrintPLT(TM, Subtarget)) {
|
||||
|
@ -503,10 +502,9 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
|
|||
PrintPICBaseSymbol();
|
||||
}
|
||||
} else {
|
||||
if (GV->hasDLLImportLinkage()) {
|
||||
// Handle dllimport linkage.
|
||||
if (MO.getTargetFlags() == X86II::MO_DLLIMPORT)
|
||||
O << "__imp_";
|
||||
assert(MO.getTargetFlags() == 0);
|
||||
}
|
||||
O << Name;
|
||||
}
|
||||
|
||||
|
@ -533,7 +531,8 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
|
|||
switch (MO.getTargetFlags()) {
|
||||
default:
|
||||
assert(0 && "Unknown target flag on GV operand");
|
||||
case X86II::MO_NO_FLAG:
|
||||
case X86II::MO_NO_FLAG: // No flag.
|
||||
case X86II::MO_DLLIMPORT: // Prefix, not a suffix.
|
||||
break;
|
||||
case X86II::MO_GOT_ABSOLUTE_ADDRESS:
|
||||
O << " + [.-";
|
||||
|
|
|
@ -244,11 +244,13 @@ void X86IntelAsmPrinter::printOp(const MachineOperand &MO,
|
|||
decorateName(Name, GV);
|
||||
|
||||
if (!isMemOp) O << "OFFSET ";
|
||||
if (GV->hasDLLImportLinkage()) {
|
||||
// FIXME: This should be fixed with full support of stdcall & fastcall
|
||||
// CC's
|
||||
|
||||
// Handle dllimport linkage.
|
||||
// FIXME: This should be fixed with full support of stdcall & fastcall
|
||||
// CC's
|
||||
if (MO.getTargetFlags() == X86II::MO_DLLIMPORT)
|
||||
O << "__imp_";
|
||||
}
|
||||
|
||||
O << Name;
|
||||
printOffset(MO.getOffset());
|
||||
return;
|
||||
|
@ -278,11 +280,11 @@ void X86IntelAsmPrinter::print_pcrel_imm(const MachineInstr *MI, unsigned OpNo){
|
|||
std::string Name = Mang->getValueName(GV);
|
||||
decorateName(Name, GV);
|
||||
|
||||
if (GV->hasDLLImportLinkage()) {
|
||||
// FIXME: This should be fixed with full support of stdcall & fastcall
|
||||
// CC's
|
||||
// Handle dllimport linkage.
|
||||
// FIXME: This should be fixed with full support of stdcall & fastcall
|
||||
// CC's
|
||||
if (MO.getTargetFlags() == X86II::MO_DLLIMPORT)
|
||||
O << "__imp_";
|
||||
}
|
||||
O << Name;
|
||||
printOffset(MO.getOffset());
|
||||
return;
|
||||
|
|
|
@ -4547,13 +4547,16 @@ X86TargetLowering::LowerGlobalAddress(const GlobalValue *GV, DebugLoc dl,
|
|||
// offset if it is legal.
|
||||
SDValue Result;
|
||||
if (!IsPic && !ExtraLoadRequired && isInt32(Offset)) {
|
||||
// A direct static reference to a global.
|
||||
Result = DAG.getTargetGlobalAddress(GV, getPointerTy(), Offset);
|
||||
Offset = 0;
|
||||
} else {
|
||||
unsigned char OpFlags = 0;
|
||||
|
||||
if (Subtarget->isPICStyleRIPRel() &&
|
||||
getTargetMachine().getRelocationModel() != Reloc::Static) {
|
||||
if (GV->hasDLLImportLinkage())
|
||||
OpFlags = X86II::MO_DLLIMPORT;
|
||||
else if (Subtarget->isPICStyleRIPRel() &&
|
||||
getTargetMachine().getRelocationModel() != Reloc::Static) {
|
||||
if (ExtraLoadRequired)
|
||||
OpFlags = X86II::MO_GOTPCREL;
|
||||
} else if (Subtarget->isPICStyleGOT() &&
|
||||
|
|
|
@ -149,6 +149,12 @@ namespace X86II {
|
|||
/// SYMBOL_LABEL @NTPOFF
|
||||
MO_NTPOFF = 11,
|
||||
|
||||
/// MO_DLLIMPORT - On a symbol operand "FOO", this indicates that the
|
||||
/// reference is actually to the "__imp_FOO" symbol. This is used for
|
||||
/// dllimport linkage on windows.
|
||||
MO_DLLIMPORT = 12,
|
||||
|
||||
|
||||
//===------------------------------------------------------------------===//
|
||||
// Instruction encodings. These are the standard/most common forms for X86
|
||||
// instructions.
|
||||
|
|
Loading…
Reference in New Issue