[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp
Evan Cheng
evan.cheng at apple.com
Wed Nov 29 15:48:28 PST 2006
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
More information about the llvm-commits
mailing list