summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2017-02-24 23:46:05 +0000
committerDan Gohman <dan433584@gmail.com>2017-02-24 23:46:05 +0000
commit82607f56bd25d8c260e6d9cf8267371ea5e410c7 (patch)
tree06d5be4a6612484abe16501586fbb8cf981f48fd /llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
parent8d543e2741c1fac6b002fb87e47dfc0b8ee0c212 (diff)
downloadbcm5719-llvm-82607f56bd25d8c260e6d9cf8267371ea5e410c7.tar.gz
bcm5719-llvm-82607f56bd25d8c260e6d9cf8267371ea5e410c7.zip
[WebAssembly] Add support for using a wasm global for the stack pointer.
This replaces the __stack_pointer variable which was allocated in linear memory. llvm-svn: 296201
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
index 56bb550c72f..c272eb4cbf5 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
@@ -27,6 +27,7 @@
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/CodeGen/MachineModuleInfoImpls.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/MC/MCContext.h"
@@ -92,6 +93,11 @@ void WebAssemblyAsmPrinter::EmitEndOfAsmFile(Module &M) {
MCConstantExpr::create(Size, OutContext));
}
}
+
+ if (!TM.getTargetTriple().isOSBinFormatELF()) {
+ MachineModuleInfoWasm &MMIW = MMI->getObjFileInfo<MachineModuleInfoWasm>();
+ getTargetStreamer()->emitGlobal(MMIW.getGlobals());
+ }
}
void WebAssemblyAsmPrinter::EmitConstantPool() {
OpenPOWER on IntegriCloud