summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2015-12-05 03:03:35 +0000
committerDan Gohman <dan433584@gmail.com>2015-12-05 03:03:35 +0000
commitf0b165a7f8492973d71f33b824acaea1eb26bba3 (patch)
tree5fa6aa641f32143ebf33fd8942b9bfe73e34d596 /llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
parent064a672f659627e00a656e160e79006fe71cf7b0 (diff)
downloadbcm5719-llvm-f0b165a7f8492973d71f33b824acaea1eb26bba3.tar.gz
bcm5719-llvm-f0b165a7f8492973d71f33b824acaea1eb26bba3.zip
[WebAssembly] Implement ReverseBranchCondition, and re-enable MachineBlockPlacement
This patch introduces a codegen-only instruction currently named br_unless, which makes it convenient to implement ReverseBranchCondition and re-enable the MachineBlockPlacement pass. Then in a late pass, it lowers br_unless back into br_if. Differential Revision: http://reviews.llvm.org/D14995 llvm-svn: 254826
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
index 29fb89c6e18..b54699243bd 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
@@ -171,10 +171,6 @@ void WebAssemblyPassConfig::addPostRegAlloc() {
// Fails with: should be run after register allocation.
disablePass(&MachineCopyPropagationID);
- // TODO: Until we get ReverseBranchCondition support, MachineBlockPlacement
- // can create ugly-looking control flow.
- disablePass(&MachineBlockPlacementID);
-
// Run the register coloring pass to reduce the total number of registers.
addPass(createWebAssemblyRegColoring());
}
@@ -183,6 +179,9 @@ void WebAssemblyPassConfig::addPreEmitPass() {
// Put the CFG in structured form; insert BLOCK and LOOP markers.
addPass(createWebAssemblyCFGStackify());
+ // Lower br_unless into br_if.
+ addPass(createWebAssemblyLowerBrUnless());
+
// Create a mapping from LLVM CodeGen virtual registers to wasm registers.
addPass(createWebAssemblyRegNumbering());
OpenPOWER on IntegriCloud