summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit09fecf9a4796bc9d0abaeea1a200037a6ed80c22 (patch)
tree440f1778558b6687df77fdb65fa1d73aff8384a4 /llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
parent4d475f6e6e9300a21efa0b4eecd7667fc03aa06b (diff)
downloadbcm5719-llvm-09fecf9a4796bc9d0abaeea1a200037a6ed80c22.tar.gz
bcm5719-llvm-09fecf9a4796bc9d0abaeea1a200037a6ed80c22.zip
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. llvm-svn: 32348
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCTargetMachine.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/PPCTargetMachine.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
index dde998f5a7f..9dcbc048700 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
+++ b/llvm/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));
OpenPOWER on IntegriCloud