[llvm-commits] [llvm] r75086 - in /llvm/trunk/lib/Target/X86: AsmPrinter/X86ATTAsmPrinter.cpp AsmPrinter/X86IntelAsmPrinter.cpp X86ISelLowering.cpp X86InstrInfo.h
Chris Lattner
sabre at nondot.org
Wed Jul 8 17:58:54 PDT 2009
Author: lattner
Date: Wed Jul 8 19:58:53 2009
New Revision: 75086
URL: http://llvm.org/viewvc/llvm-project?rev=75086&view=rev
Log:
move handling of dllimport linkage in isel, not in asmprinter.
Modified:
llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/Target/X86/X86InstrInfo.h
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=75086&r1=75085&r2=75086&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Wed Jul 8 19:58:53 2009
@@ -351,10 +351,9 @@
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 @@
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 @@
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 << " + [.-";
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp?rev=75086&r1=75085&r2=75086&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp Wed Jul 8 19:58:53 2009
@@ -244,11 +244,13 @@
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 @@
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;
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=75086&r1=75085&r2=75086&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Jul 8 19:58:53 2009
@@ -4547,13 +4547,16 @@
// 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() &&
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.h?rev=75086&r1=75085&r2=75086&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.h Wed Jul 8 19:58:53 2009
@@ -149,6 +149,12 @@
/// 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.
More information about the llvm-commits
mailing list