projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[WebAssembly] Print an extra local decl when the user stack pointer is used
[oota-llvm.git]
/
lib
/
Target
/
WebAssembly
/
WebAssemblyAsmPrinter.cpp
diff --git
a/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
b/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
index 68cfee42802c345df77e70efcd61bbb40956e742..e853b76d0dd43183a65e63e0fec732d3d62a9b79 100644
(file)
--- a/
lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
+++ b/
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/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"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/MC/MCContext.h"
@@
-181,6
+182,11
@@
void WebAssemblyAsmPrinter::EmitFunctionBodyStart() {
Local.addOperand(MCOperand::createImm(getRegType(VReg).SimpleTy));
AnyWARegs = true;
}
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);
if (AnyWARegs)
EmitToStreamer(*OutStreamer, Local);
@@
-260,7
+266,9
@@
bool WebAssemblyAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
report_fatal_error("There are no defined alternate asm variants");
if (!ExtraCode) {
report_fatal_error("There are no defined alternate asm variants");
if (!ExtraCode) {
- OS << regToString(MI->getOperand(OpNo));
+ // TODO: For now, we just hard-code 0 as the constant offset; teach
+ // SelectInlineAsmMemoryOperand how to do address mode matching.
+ OS << "0(" + regToString(MI->getOperand(OpNo)) + ')';
return false;
}
return false;
}