summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-03-01 18:06:21 +0000
committerSam Clegg <sbc@chromium.org>2018-03-01 18:06:21 +0000
commit03e101f1b00d463d3a070a43a7ac8f13db291c37 (patch)
tree000e836f3e42c60f9803b35cc41f798471314bf3 /llvm/lib/Target/WebAssembly
parentc6a75a69f15e42dd4c6b1a79f6d1a4e3df9f75ea (diff)
downloadbcm5719-llvm-03e101f1b00d463d3a070a43a7ac8f13db291c37.tar.gz
bcm5719-llvm-03e101f1b00d463d3a070a43a7ac8f13db291c37.zip
[WebAssembly] Use uint8_t for single byte values to match the spec
The original BinaryEncoding.md document used to specify that these values were `varint7`, but the official spec lists them explicitly as single byte values and not LEB. A similar change for wabt is in flight: https://github.com/WebAssembly/wabt/pull/782 Differential Revision: https://reviews.llvm.org/D43921 llvm-svn: 326454
Diffstat (limited to 'llvm/lib/Target/WebAssembly')
-rw-r--r--llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp2
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp6
2 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp
index 9d4f308ca3c..cab14e9b47b 100644
--- a/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp
+++ b/llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp
@@ -31,7 +31,7 @@ WebAssemblyTargetStreamer::WebAssemblyTargetStreamer(MCStreamer &S)
: MCTargetStreamer(S) {}
void WebAssemblyTargetStreamer::emitValueType(wasm::ValType Type) {
- Streamer.EmitSLEB128IntValue(int32_t(Type));
+ Streamer.EmitIntValue(uint8_t(Type), 1);
}
WebAssemblyTargetAsmStreamer::WebAssemblyTargetAsmStreamer(
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
index c8afa39e6e9..ac2258abc24 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
@@ -95,10 +95,10 @@ MCSymbol *WebAssemblyMCInstLower::GetExternalSymbolSymbol(
// here; this method is precisely there for fetching the signatures of known
// Clang-provided symbols.
if (strcmp(Name, "__stack_pointer") == 0) {
- wasm::ValType iPTR =
- Subtarget.hasAddr64() ? wasm::ValType::I64 : wasm::ValType::I32;
WasmSym->setType(wasm::WASM_SYMBOL_TYPE_GLOBAL);
- WasmSym->setGlobalType(wasm::WasmGlobalType{int32_t(iPTR), true});
+ WasmSym->setGlobalType(wasm::WasmGlobalType{
+ Subtarget.hasAddr64() ? wasm::WASM_TYPE_I64 : wasm::WASM_TYPE_I32,
+ true});
return WasmSym;
}
OpenPOWER on IntegriCloud