diff options
author | Austin Benson <arbenson@google.com> | 2012-07-31 16:36:13 -0700 |
---|---|---|
committer | Derek Schuff <dschuff@chromium.org> | 2012-07-31 16:36:13 -0700 |
commit | 13d5be78ccbe988ac859279b469fb0ad8d24fc85 (patch) | |
tree | f97f33bf5f19ad7e8a508e6cbaf9ef5e6c86ea77 /lib/Target/X86/X86NaClRewritePass.cpp | |
parent | 6c86af4ab3c12e8b945587c2bcb6457f54f47e3b (diff) |
Restrict R15 with a flag
http://codereview.chromium.org/10820013/
Diffstat (limited to 'lib/Target/X86/X86NaClRewritePass.cpp')
-rw-r--r-- | lib/Target/X86/X86NaClRewritePass.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Target/X86/X86NaClRewritePass.cpp b/lib/Target/X86/X86NaClRewritePass.cpp index 86bb45584e..36a3d4bf7c 100644 --- a/lib/Target/X86/X86NaClRewritePass.cpp +++ b/lib/Target/X86/X86NaClRewritePass.cpp @@ -33,6 +33,11 @@ using namespace llvm; extern cl::opt<bool> FlagUseZeroBasedSandbox; +cl::opt<bool> FlagRestrictR15("sfi-restrict-r15", + cl::desc("Restrict use of %r15. This flag can" + " be turned off for the zero-based" + " sandbox model."), + cl::init(true)); namespace { class X86NaClRewritePass : public MachineFunctionPass { @@ -134,8 +139,10 @@ static bool IsDirectBranch(const MachineInstr &MI) { static bool IsRegAbsolute(unsigned Reg) { const bool UseZeroBasedSandbox = FlagUseZeroBasedSandbox; + const bool RestrictR15 = FlagRestrictR15; + assert(UseZeroBasedSandbox || RestrictR15); return (Reg == X86::RSP || Reg == X86::RBP || - (Reg == X86::R15 && !UseZeroBasedSandbox) || + (Reg == X86::R15 && RestrictR15) || Reg == X86::RIP); } |