diff options
| author | Sam Clegg <sbc@chromium.org> | 2018-01-31 19:50:14 +0000 |
|---|---|---|
| committer | Sam Clegg <sbc@chromium.org> | 2018-01-31 19:50:14 +0000 |
| commit | 6e7f1826c58932c0e987d8eca5b9055439161b13 (patch) | |
| tree | 026cc7c2042402c331710cb6d709d92011b1c15b /llvm/lib/Target/WebAssembly | |
| parent | f9edbe95db69e851c2bed712318f43b45de31ddd (diff) | |
| download | bcm5719-llvm-6e7f1826c58932c0e987d8eca5b9055439161b13.tar.gz bcm5719-llvm-6e7f1826c58932c0e987d8eca5b9055439161b13.zip | |
[WebAssembly] MC: Remove unused code for handling of wasm globals
For now, we are not using wasm globals, except for modeling of
the stack points.
Alos, factor out common struct WasmGlobalType, which matches the
name for that tuple in the Wasm spec and rename methods
to "isBindingGlobal", "isTypeGlobal" to avoid ambiguity.
Patch by Nicholas Wilson!
Differential Revision: https://reviews.llvm.org/D42750
llvm-svn: 323901
Diffstat (limited to 'llvm/lib/Target/WebAssembly')
| -rw-r--r-- | llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp | 51 | ||||
| -rw-r--r-- | llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h | 5 |
2 files changed, 0 insertions, 56 deletions
diff --git a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp index 0ca52ad651b..b1222283598 100644 --- a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp +++ b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp @@ -87,27 +87,6 @@ void WebAssemblyTargetAsmStreamer::emitLocal(ArrayRef<MVT> Types) { } } -void WebAssemblyTargetAsmStreamer::emitGlobal( - ArrayRef<wasm::Global> Globals) { - if (!Globals.empty()) { - OS << "\t.globalvar \t"; - - bool First = true; - for (const wasm::Global &G : Globals) { - if (First) - First = false; - else - OS << ", "; - OS << WebAssembly::TypeToString(G.Type); - if (!G.InitialModule.empty()) - OS << '=' << G.InitialModule << ':' << G.InitialName; - else - OS << '=' << G.InitialValue; - } - OS << '\n'; - } -} - void WebAssemblyTargetAsmStreamer::emitEndFunc() { OS << "\t.endfunc\n"; } void WebAssemblyTargetAsmStreamer::emitIndirectFunctionType( @@ -148,11 +127,6 @@ void WebAssemblyTargetELFStreamer::emitLocal(ArrayRef<MVT> Types) { emitValueType(WebAssembly::toValType(Type)); } -void WebAssemblyTargetELFStreamer::emitGlobal( - ArrayRef<wasm::Global> Globals) { - llvm_unreachable(".globalvar encoding not yet implemented"); -} - void WebAssemblyTargetELFStreamer::emitEndFunc() { Streamer.EmitIntValue(WebAssembly::End, 1); } @@ -204,31 +178,6 @@ void WebAssemblyTargetWasmStreamer::emitLocal(ArrayRef<MVT> Types) { } } -void WebAssemblyTargetWasmStreamer::emitGlobal( - ArrayRef<wasm::Global> Globals) { - // Encode the globals use by the funciton into the special .global_variables - // section. This will later be decoded and turned into contents for the - // Globals Section. - Streamer.PushSection(); - Streamer.SwitchSection(Streamer.getContext().getWasmSection( - ".global_variables", SectionKind::getMetadata())); - for (const wasm::Global &G : Globals) { - Streamer.EmitIntValue(int32_t(G.Type), 1); - Streamer.EmitIntValue(G.Mutable, 1); - if (G.InitialModule.empty()) { - Streamer.EmitIntValue(0, 1); // indicate that we have an int value - Streamer.EmitSLEB128IntValue(0); - } else { - Streamer.EmitIntValue(1, 1); // indicate that we have a module import - Streamer.EmitBytes(G.InitialModule); - Streamer.EmitIntValue(0, 1); // nul-terminate - Streamer.EmitBytes(G.InitialName); - Streamer.EmitIntValue(0, 1); // nul-terminate - } - } - Streamer.PopSection(); -} - void WebAssemblyTargetWasmStreamer::emitEndFunc() { llvm_unreachable(".end_func is not needed for direct wasm output"); } diff --git a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h index 2cb21a20580..539ca9ee8ce 100644 --- a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h +++ b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h @@ -37,8 +37,6 @@ public: virtual void emitResult(MCSymbol *Symbol, ArrayRef<MVT> Types) = 0; /// .local virtual void emitLocal(ArrayRef<MVT> Types) = 0; - /// .globalvar - virtual void emitGlobal(ArrayRef<wasm::Global> Globals) = 0; /// .endfunc virtual void emitEndFunc() = 0; /// .functype @@ -64,7 +62,6 @@ public: void emitParam(MCSymbol *Symbol, ArrayRef<MVT> Types) override; void emitResult(MCSymbol *Symbol, ArrayRef<MVT> Types) override; void emitLocal(ArrayRef<MVT> Types) override; - void emitGlobal(ArrayRef<wasm::Global> Globals) override; void emitEndFunc() override; void emitIndirectFunctionType(MCSymbol *Symbol, SmallVectorImpl<MVT> &Params, @@ -81,7 +78,6 @@ public: void emitParam(MCSymbol *Symbol, ArrayRef<MVT> Types) override; void emitResult(MCSymbol *Symbol, ArrayRef<MVT> Types) override; void emitLocal(ArrayRef<MVT> Types) override; - void emitGlobal(ArrayRef<wasm::Global> Globals) override; void emitEndFunc() override; void emitIndirectFunctionType(MCSymbol *Symbol, SmallVectorImpl<MVT> &Params, @@ -98,7 +94,6 @@ public: void emitParam(MCSymbol *Symbol, ArrayRef<MVT> Types) override; void emitResult(MCSymbol *Symbol, ArrayRef<MVT> Types) override; void emitLocal(ArrayRef<MVT> Types) override; - void emitGlobal(ArrayRef<wasm::Global> Globals) override; void emitEndFunc() override; void emitIndirectFunctionType(MCSymbol *Symbol, SmallVectorImpl<MVT> &Params, |

