Changes in directory llvm/lib/Target/X86:

X86ISelLowering.cpp updated: 1.297 -> 1.298
---
Log message:

In PIC mode, GV not requiring an extra load can be used as address immediate.

---
Diffs of the changes:  (+7 -14)

 X86ISelLowering.cpp |   21 +++++++--------------
 1 files changed, 7 insertions(+), 14 deletions(-)


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.297 
llvm/lib/Target/X86/X86ISelLowering.cpp:1.298
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.297       Wed Nov 29 17:19:46 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp     Wed Nov 29 17:48:14 2006
@@ -4994,21 +4994,14 @@
 }
 
 bool X86TargetLowering::isLegalAddressImmediate(GlobalValue *GV) const {
-  // GV is 64-bit but displacement field is 32-bit unless we are in small code
-  // model. Mac OS X happens to support only small PIC code model.
-  // FIXME: better support for other OS's.
-  if (Subtarget->is64Bit() && !Subtarget->isTargetDarwin())
+  // In 64-bit mode, GV is 64-bit so it won't fit in the 32-bit displacement 
+  // field unless we are in small code model.
+  if (Subtarget->is64Bit() &&
+      getTargetMachine().getCodeModel() != CodeModel::Small)
     return false;
-  if (Subtarget->isTargetDarwin()) {
-    Reloc::Model RModel = getTargetMachine().getRelocationModel();
-    if (RModel == Reloc::Static)
-      return true;
-    else if (RModel == Reloc::DynamicNoPIC)
-      return !(Subtarget->GVRequiresExtraLoad(GV, false));
-    else
-      return false;
-  } else
-    return true;
+  Reloc::Model RModel = getTargetMachine().getRelocationModel();
+  return (RModel == Reloc::Static) ||
+    !Subtarget->GVRequiresExtraLoad(GV, false);
 }
 
 /// isShuffleMaskLegal - Targets can use this to indicate that they only



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to