diff options
author | Derek Schuff <dschuff@google.com> | 2015-12-11 23:49:46 +0000 |
---|---|---|
committer | Derek Schuff <dschuff@google.com> | 2015-12-11 23:49:46 +0000 |
commit | 9769debf88170904006b4b16538085e5dbd2ed44 (patch) | |
tree | b316f68ef161411bf790cf6c5ba27b717873bae5 /llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp | |
parent | e8f9387e0cae74b54a8e77310477626a59a91aed (diff) | |
download | bcm5719-llvm-9769debf88170904006b4b16538085e5dbd2ed44.tar.gz bcm5719-llvm-9769debf88170904006b4b16538085e5dbd2ed44.zip |
[WebAssembly] Implement prolog/epilog insertion and FrameIndex elimination
Summary:
Use the SP32 physical register as the base for FrameIndex
lowering. Update it and the __stack_pointer global var in the prolog and
epilog. Extend the mapping of virtual registers to wasm locals to
include the physical registers.
Rather than modify the target-independent PrologEpilogInserter (which
asserts that there are no virtual registers left) include a
slightly-modified copy for Wasm that does not have this assertion and
only clears the virtual registers if scavenging was needed (which of
course it isn't for wasm).
Differential Revision: http://reviews.llvm.org/D15344
llvm-svn: 255392
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp index a333fb3055e..dcc393db6ea 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp @@ -176,7 +176,8 @@ void WebAssemblyPassConfig::addPostRegAlloc() { // virtual registers. Consider removing their restrictions and re-enabling // them. // - // Fails with: Regalloc must assign all vregs. + // We use our own PrologEpilogInserter which is very slightly modified to + // tolerate virtual registers. disablePass(&PrologEpilogCodeInserterID); // Fails with: should be run after register allocation. disablePass(&MachineCopyPropagationID); @@ -185,6 +186,11 @@ void WebAssemblyPassConfig::addPostRegAlloc() { addPass(createWebAssemblyRegColoring()); TargetPassConfig::addPostRegAlloc(); + + // Run WebAssembly's version of the PrologEpilogInserter. Target-independent + // PEI runs after PostRegAlloc and after ShrinkWrap. Putting it here will run + // PEI before ShrinkWrap but otherwise in the same position in the order. + addPass(createWebAssemblyPEI()); } void WebAssemblyPassConfig::addPreEmitPass() { |