aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/LLVMTargetMachine.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2008-11-04 21:53:09 +0000
committerBill Wendling <isanbard@gmail.com>2008-11-04 21:53:09 +0000
commit80a320d974dae7666157e80b141d7ff97e5f6544 (patch)
treeddbcd7fd4bbcc1f67c0a585846a26527d187fbcb /lib/CodeGen/LLVMTargetMachine.cpp
parentba10fe04e7fdbf43a9cf7f7e39ef1341beea8bc5 (diff)
Update in response to feedback from Chris:
- Use enums instead of magic numbers. - Rework algorithm to use the bytes size from the target to determine when to emit stack protectors. - Get rid of "propolice" in any comments. - Renamed an option to its expanded form. - Other miscellanenous changes. More changes will come after this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58723 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LLVMTargetMachine.cpp')
-rw-r--r--lib/CodeGen/LLVMTargetMachine.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/CodeGen/LLVMTargetMachine.cpp b/lib/CodeGen/LLVMTargetMachine.cpp
index e1dd46342d..fee70b0015 100644
--- a/lib/CodeGen/LLVMTargetMachine.cpp
+++ b/lib/CodeGen/LLVMTargetMachine.cpp
@@ -61,9 +61,17 @@ EnableFastISelOption("fast-isel", cl::Hidden,
cl::desc("Enable the experimental \"fast\" instruction selector"));
// Enable stack protectors.
-static cl::opt<int>
-EnableStackProtector("enable-stack-protector", cl::init(0),
- cl::desc("Use ProPolice as a stack protection method."));
+static cl::opt<SSP::StackProtectorLevel>
+EnableStackProtector("enable-stack-protector",
+ cl::desc("Stack canary protection level: (default: off)"),
+ cl::init(SSP::OFF),
+ cl::values(clEnumValN(SSP::ALL, "all",
+ "All functions get stack protectors."),
+ clEnumValN(SSP::SOME, "some",
+ "Only functions requiring stack protectors get them."),
+ clEnumValN(SSP::OFF, "off",
+ "No functions get stack protectors."),
+ clEnumValEnd));
FileModel::Model
LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
@@ -170,7 +178,8 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM, bool Fast) {
if (!Fast)
PM.add(createCodeGenPreparePass(getTargetLowering()));
- PM.add(createStackProtectorPass(EnableStackProtector));
+ if (EnableStackProtector != SSP::OFF)
+ PM.add(createStackProtectorPass(EnableStackProtector, getTargetLowering()));
if (PrintISelInput)
PM.add(createPrintFunctionPass("\n\n"