summaryrefslogtreecommitdiff
path: root/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@google.com>2016-02-17 23:20:43 +0000
committerDerek Schuff <dschuff@google.com>2016-02-17 23:20:43 +0000
commit71434ff6429e1ff330bf3bfa8340b2421a0a2b31 (patch)
treeb4a2b0fa305089efa4df5cb1fc14cd11bbf10b76 /llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
parent7687bcee4a5a83fc01141f47cc17a64fbdb96207 (diff)
[WebAssembly] Disable register stackification and coloring when not optimizing
These passes are optimizations, and should be disabled when not optimizing. Also create an MCCodeGenInfo so the opt level is correctly plumbed to the backend pass manager. Also remove the command line flag for disabling register coloring; running llc with -O0 should now be useful for debugging, so it's not necessary. Differential Revision: http://reviews.llvm.org/D17327 llvm-svn: 261176
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
index 25f009d2fb3b..2e2a1194502e 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
@@ -185,11 +185,13 @@ void WebAssemblyPassConfig::addPostRegAlloc() {
// Fails with: should be run after register allocation.
disablePass(&MachineCopyPropagationID);
- // Mark registers as representing wasm's expression stack.
- addPass(createWebAssemblyRegStackify());
+ if (getOptLevel() != CodeGenOpt::None) {
+ // Mark registers as representing wasm's expression stack.
+ addPass(createWebAssemblyRegStackify());
- // Run the register coloring pass to reduce the total number of registers.
- addPass(createWebAssemblyRegColoring());
+ // Run the register coloring pass to reduce the total number of registers.
+ addPass(createWebAssemblyRegColoring());
+ }
TargetPassConfig::addPostRegAlloc();