aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen/MachineModuleInfoImpls.h
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-04-16 16:01:22 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-04-16 16:01:22 +0000
commit71d5a2540a98c81f5bcaeb48805e0e2881f530ef (patch)
tree5343938942df402b49ec7300a1c25a2d4ccd5821 /include/llvm/CodeGen/MachineModuleInfoImpls.h
parent31bbf64f3a4974a2d6c8b3b27ad2f519caf74057 (diff)
Diffstat (limited to 'include/llvm/CodeGen/MachineModuleInfoImpls.h')
-rw-r--r--include/llvm/CodeGen/MachineModuleInfoImpls.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/llvm/CodeGen/MachineModuleInfoImpls.h b/include/llvm/CodeGen/MachineModuleInfoImpls.h
index f9fa6999073f..f28a79c5b5cc 100644
--- a/include/llvm/CodeGen/MachineModuleInfoImpls.h
+++ b/include/llvm/CodeGen/MachineModuleInfoImpls.h
@@ -15,7 +15,9 @@
#ifndef LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
#define LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
+#include "llvm/CodeGen/ValueTypes.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
+#include "llvm/Support/Wasm.h"
namespace llvm {
class MCSymbol;
@@ -75,6 +77,33 @@ public:
SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); }
};
+/// MachineModuleInfoWasm - This is a MachineModuleInfoImpl implementation
+/// for Wasm targets.
+class MachineModuleInfoWasm : public MachineModuleInfoImpl {
+ /// WebAssembly global variables defined by CodeGen.
+ std::vector<wasm::Global> Globals;
+
+ /// The WebAssembly global variable which is the stack pointer.
+ unsigned StackPointerGlobal;
+
+ virtual void anchor(); // Out of line virtual method.
+public:
+ MachineModuleInfoWasm(const MachineModuleInfo &)
+ : StackPointerGlobal(-1U) {}
+
+ void addGlobal(const wasm::Global &G) { Globals.push_back(G); }
+ const std::vector<wasm::Global> &getGlobals() const { return Globals; }
+
+ bool hasStackPointerGlobal() const {
+ return StackPointerGlobal != -1U;
+ }
+ unsigned getStackPointerGlobal() const {
+ assert(hasStackPointerGlobal() && "Stack ptr global hasn't been set");
+ return StackPointerGlobal;
+ }
+ void setStackPointerGlobal(unsigned Global) { StackPointerGlobal = Global; }
+};
+
} // end namespace llvm
#endif