aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/PowerPC/PPCTargetMachine.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-12-08 04:54:03 +0000
committerChris Lattner <sabre@nondot.org>2006-12-08 04:54:03 +0000
commite150b8eb873fc1bdde17d8ecfd3c38168a5cdcee (patch)
treed7ff2e34a8f39dfa4ddb3537c0c7b0f190cb17a3 /lib/Target/PowerPC/PPCTargetMachine.cpp
parentf9bae438aa5dce85685de670702250bb930dfc49 (diff)
this is an initial patch to switch the ppc64 jit over to working in PIC mode,
which allows the code to be above the 2G marker. We still need to JIT emit dyld stubs to support external, weak, common, etc globals, but that will happen tomorrow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32348 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPCTargetMachine.cpp')
-rw-r--r--lib/Target/PowerPC/PPCTargetMachine.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp
index dde998f5a7..9dcbc04870 100644
--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
+++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
@@ -135,9 +135,17 @@ bool PPCTargetMachine::addObjectWriter(FunctionPassManager &PM, bool Fast,
bool PPCTargetMachine::addCodeEmitter(FunctionPassManager &PM, bool Fast,
MachineCodeEmitter &MCE) {
- // The JIT should use the static relocation model.
+ // The JIT should use the static relocation model in ppc32 mode, PIC in ppc64.
// FIXME: This should be moved to TargetJITInfo!!
- setRelocationModel(Reloc::Static);
+ if (Subtarget.isPPC64()) {
+ // We use PIC codegen in ppc64 mode, because otherwise we'd have to use many
+ // instructions to materialize arbitrary global variable + function +
+ // constant pool addresses.
+ setRelocationModel(Reloc::PIC_);
+ } else {
+ setRelocationModel(Reloc::Static);
+ }
+
// Machine code emitter pass for PowerPC.
PM.add(createPPCCodeEmitterPass(*this, MCE));