summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/lib/IR/Module.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2014-12-25 18:22:22 +0000
committerdim <dim@FreeBSD.org>2014-12-25 18:22:22 +0000
commit6c90d54f67f0b2b7a4736e119f091e66afbabcce (patch)
treed99c35034a4055aa5391828a57312dcf1d90ee00 /contrib/llvm/lib/IR/Module.cpp
parenta962ff2599bf8202ad46e24a4ea1481964751597 (diff)
downloadFreeBSD-src-6c90d54f67f0b2b7a4736e119f091e66afbabcce.zip
FreeBSD-src-6c90d54f67f0b2b7a4736e119f091e66afbabcce.tar.gz
Pull in r214284 from upstream llvm trunk (by Hal Finkel):
[PowerPC] Add JMP_SLOT relocation definitions This will be required by upcoming patches for LLDB support. Patch by Justin Hibbits! Pull in r221510 from upstream llvm trunk (by Justin Hibbits): Add Position-independent Code model Module API. Summary: This makes PIC levels a Module flag attribute, which can be queried by the backend. The flag is named `PIC Level`, and can have a value of: 0 - Backend-default 1 - Small-model (-fpic) 2 - Large-model (-fPIC) These match the `-pic-level' command line argument for clang, and the value of the preprocessor macro `__PIC__'. Test Plan: New flags tests specific for the 'PIC Level' module flag. Tests to be added as part of a future commit for PowerPC, which will use this new API. Reviewers: rafael, echristo Reviewed By: rafael, echristo Subscribers: rafael, llvm-commits Differential Revision: http://reviews.llvm.org/D5882 Pull in r221791 from upstream llvm trunk (by Justin Hibbits): Add support for small-model PIC for PowerPC. Summary: Large-model was added first. With the addition of support for multiple PIC models in LLVM, now add small-model PIC for 32-bit PowerPC, SysV4 ABI. This generates more optimal code, for shared libraries with less than about 16380 data objects. Test Plan: Test cases added or updated Reviewers: joerg, hfinkel Reviewed By: hfinkel Subscribers: jholewinski, mcrosier, emaste, llvm-commits Differential Revision: http://reviews.llvm.org/D5399 Together, these changes implement small-model PIC support for PowerPC. Thanks to Justin Hibbits and Roman Divacky for their assistance in getting this working.
Diffstat (limited to 'contrib/llvm/lib/IR/Module.cpp')
-rw-r--r--contrib/llvm/lib/IR/Module.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/contrib/llvm/lib/IR/Module.cpp b/contrib/llvm/lib/IR/Module.cpp
index f1b1f9a..58584bd 100644
--- a/contrib/llvm/lib/IR/Module.cpp
+++ b/contrib/llvm/lib/IR/Module.cpp
@@ -461,3 +461,16 @@ Comdat *Module::getOrInsertComdat(StringRef Name) {
Entry.second.Name = &Entry;
return &Entry.second;
}
+
+PICLevel::Level Module::getPICLevel() const {
+ Value *Val = getModuleFlag("PIC Level");
+
+ if (Val == NULL)
+ return PICLevel::Default;
+
+ return static_cast<PICLevel::Level>(cast<ConstantInt>(Val)->getZExtValue());
+}
+
+void Module::setPICLevel(PICLevel::Level PL) {
+ addModuleFlag(ModFlagBehavior::Error, "PIC Level", PL);
+}
OpenPOWER on IntegriCloud