Set module flag PIELevel. Simplify code that sets PICLevel flag.

llvm-svn: 267948
This commit is contained in:
Sriraman Tallam 2016-04-28 22:34:00 +00:00
parent 1f4231f8cf
commit 70e70e6eb9
1 changed files with 6 additions and 8 deletions

View File

@ -477,15 +477,13 @@ void CodeGenModule::Release() {
}
if (uint32_t PLevel = Context.getLangOpts().PICLevel) {
llvm::PICLevel::Level PL = llvm::PICLevel::Default;
switch (PLevel) {
case 0: break;
case 1: PL = llvm::PICLevel::Small; break;
case 2: PL = llvm::PICLevel::Large; break;
default: llvm_unreachable("Invalid PIC Level");
}
assert(PLevel < 3 && "Invalid PIC Level");
getModule().setPICLevel(static_cast<llvm::PICLevel::Level>(PLevel));
}
getModule().setPICLevel(PL);
if (uint32_t PLevel = Context.getLangOpts().PIELevel) {
assert(PLevel < 3 && "Invalid PIE Level");
getModule().setPIELevel(static_cast<llvm::PIELevel::Level>(PLevel));
}
SimplifyPersonality();