[PATCH] D15546: [WebAssembly] Print an extra local decl when the user stack pointer is used

Derek Schuff via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 16 12:46:26 PST 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL255815: [WebAssembly] Print an extra local decl when the user stack pointer is used (authored by dschuff).

Changed prior to commit:
  http://reviews.llvm.org/D15546?vs=42947&id=43052#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15546

Files:
  llvm/trunk/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
  llvm/trunk/test/CodeGen/WebAssembly/userstack.ll

Index: llvm/trunk/test/CodeGen/WebAssembly/userstack.ll
===================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/userstack.ll
+++ llvm/trunk/test/CodeGen/WebAssembly/userstack.ll
@@ -6,6 +6,8 @@
 target triple = "wasm32-unknown-unknown"
 
 ; CHECK-LABEL: alloca32:
+; Check that there is an extra local for the stack pointer.
+; CHECK: .local i32, i32, i32, i32{{$}}
 define void @alloca32() {
  ; CHECK: i32.const [[L1:.+]]=, __stack_pointer
  ; CHECK-NEXT: i32.load [[L1]]=, 0([[L1]])
@@ -23,6 +25,7 @@
 }
 
 ; CHECK-LABEL: alloca3264:
+; CHECK: .local i32, i32, i32, i32{{$}}
 define void @alloca3264() {
  ; CHECK: i32.const [[L1:.+]]=, __stack_pointer
  ; CHECK-NEXT: i32.load [[L1]]=, 0([[L1]])
@@ -43,6 +46,8 @@
  ret void
 }
 
+; CHECK-LABEL: allocarray:
+; CHECK: .local i32, i32, i32, i32, i32, i32{{$}}
 define void @allocarray() {
  ; CHECK: i32.const [[L1:.+]]=, __stack_pointer
  ; CHECK-NEXT: i32.load [[L1]]=, 0([[L1]])
Index: llvm/trunk/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
===================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
@@ -26,6 +26,7 @@
 #include "llvm/CodeGen/Analysis.h"
 #include "llvm/CodeGen/AsmPrinter.h"
 #include "llvm/CodeGen/MachineConstantPool.h"
+#include "llvm/CodeGen/MachineFrameInfo.h"
 #include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/IR/DataLayout.h"
 #include "llvm/MC/MCContext.h"
@@ -181,6 +182,11 @@
     Local.addOperand(MCOperand::createImm(getRegType(VReg).SimpleTy));
     AnyWARegs = true;
   }
+  if (MF->getFrameInfo()->getStackSize() > 0) {
+    // TODO: wasm64
+    Local.addOperand(MCOperand::createImm(MVT::i32));
+    AnyWARegs = true;
+  }
   if (AnyWARegs)
     EmitToStreamer(*OutStreamer, Local);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15546.43052.patch
Type: text/x-patch
Size: 1874 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151216/2c61017b/attachment.bin>


More information about the llvm-commits mailing list