diff options
author | Derek Schuff <dschuff@google.com> | 2016-06-02 21:34:18 +0000 |
---|---|---|
committer | Derek Schuff <dschuff@google.com> | 2016-06-02 21:34:18 +0000 |
commit | 23b7d65fe5b93bf7161b3d7ebd54eb9b1f41e291 (patch) | |
tree | cf42c2e90fb308a21127e29bd39d19d8430be137 /llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h | |
parent | b820edd58ab40a10a3c2f86fd99af97dda2ee63f (diff) | |
download | bcm5719-llvm-23b7d65fe5b93bf7161b3d7ebd54eb9b1f41e291.tar.gz bcm5719-llvm-23b7d65fe5b93bf7161b3d7ebd54eb9b1f41e291.zip |
[WebAssembly] Emit type signatures for declared functions
Under emscripten, C code can take the address of a function implemented
in Javascript (which is exposed via an import in wasm). Because imports
do not have linear memory address in wasm, we need to generate a thunk
to be the target of the indirect call; it call the import directly.
To make this possible, LLVM needs to emit the type signatures for these
functions, because they may not be called directly or referred to other
than where the address is taken.
This uses s new .s directive (.functype) which specifies the signature.
Differential Revision: http://reviews.llvm.org/D20891
llvm-svn: 271599
Diffstat (limited to 'llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h')
-rw-r--r-- | llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h index c66a51574ef..51354ef22d7 100644 --- a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h +++ b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h @@ -37,6 +37,12 @@ public: virtual void emitLocal(ArrayRef<MVT> Types) = 0; /// .endfunc virtual void emitEndFunc() = 0; + /// .functype + virtual void emitIndirectFunctionType(StringRef name, + SmallVectorImpl<MVT> &SignatureVTs, + size_t NumResults) { + llvm_unreachable("emitIndirectFunctionType not implemented"); + } }; /// This part is for ascii assembly output @@ -50,6 +56,9 @@ public: void emitResult(ArrayRef<MVT> Types) override; void emitLocal(ArrayRef<MVT> Types) override; void emitEndFunc() override; + void emitIndirectFunctionType(StringRef name, + SmallVectorImpl<MVT> &SignatureVTs, + size_t NumResults) override; }; /// This part is for ELF object output |