aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Module.cpp
diff options
context:
space:
mode:
authorSriraman Tallam <tmsriram@google.com>2016-04-28 18:15:44 +0000
committerSriraman Tallam <tmsriram@google.com>2016-04-28 18:15:44 +0000
commit46d47b8ce2ff6860a1140318de46aa0ca0038b8e (patch)
tree9c311ecdf4d9794f20ef7808b7f6c62d56a8308c /llvm/lib/IR/Module.cpp
parent5354a8aa4d22b90f72092cefe35890ce66d6056e (diff)
downloadllvm-46d47b8ce2ff6860a1140318de46aa0ca0038b8e.zip
llvm-46d47b8ce2ff6860a1140318de46aa0ca0038b8e.tar.gz
llvm-46d47b8ce2ff6860a1140318de46aa0ca0038b8e.tar.bz2
Add "PIE Level" metadata to module flags.
http://reviews.llvm.org/D19671 llvm-svn: 267911
Diffstat (limited to 'llvm/lib/IR/Module.cpp')
-rw-r--r--llvm/lib/IR/Module.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp
index 1011036..b15cac4 100644
--- a/llvm/lib/IR/Module.cpp
+++ b/llvm/lib/IR/Module.cpp
@@ -497,6 +497,20 @@ void Module::setPICLevel(PICLevel::Level PL) {
addModuleFlag(ModFlagBehavior::Error, "PIC Level", PL);
}
+PIELevel::Level Module::getPIELevel() const {
+ auto *Val = cast_or_null<ConstantAsMetadata>(getModuleFlag("PIE Level"));
+
+ if (!Val)
+ return PIELevel::Default;
+
+ return static_cast<PIELevel::Level>(
+ cast<ConstantInt>(Val->getValue())->getZExtValue());
+}
+
+void Module::setPIELevel(PIELevel::Level PL) {
+ addModuleFlag(ModFlagBehavior::Error, "PIE Level", PL);
+}
+
void Module::setMaximumFunctionCount(uint64_t Count) {
addModuleFlag(ModFlagBehavior::Error, "MaxFunctionCount", Count);
}