summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2014-07-18 23:29:49 +0000
committerHal Finkel <hfinkel@anl.gov>2014-07-18 23:29:49 +0000
commit3ee2af7d1c0decb43729d239b5c6c0052b5308b7 (patch)
treeed2c775d579da6195162e9146eea3a83c8e0d678 /llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp
parent8924d27c02b546d1f4da3be97b353792df4e6211 (diff)
downloadbcm5719-llvm-3ee2af7d1c0decb43729d239b5c6c0052b5308b7.tar.gz
bcm5719-llvm-3ee2af7d1c0decb43729d239b5c6c0052b5308b7.zip
[PowerPC] 32-bit ELF PIC support
This adds initial support for PPC32 ELF PIC (Position Independent Code; the -fPIC variety), thus rectifying a long-standing deficiency in the PowerPC backend. Patch by Justin Hibbits! llvm-svn: 213427
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp b/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp
index 6a0aec842be..9da1b1b5c75 100644
--- a/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp
+++ b/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp
@@ -8,8 +8,16 @@
//===----------------------------------------------------------------------===//
#include "PPCMachineFunctionInfo.h"
+#include "llvm/IR/DataLayout.h"
+#include "llvm/MC/MCContext.h"
+#include "llvm/Target/TargetMachine.h"
using namespace llvm;
void PPCFunctionInfo::anchor() { }
+MCSymbol *PPCFunctionInfo::getPICOffsetSymbol() const {
+ const DataLayout *DL = MF.getTarget().getDataLayout();
+ return MF.getContext().GetOrCreateSymbol(Twine(DL->getPrivateGlobalPrefix())+
+ Twine(MF.getFunctionNumber())+"$poff");
+}
OpenPOWER on IntegriCloud