]> granicus.if.org Git - llvm/commitdiff
[WebAssembly] Encode block signatures as SLEB instead of ULEB
authorDerek Schuff <dschuff@google.com>
Mon, 17 Apr 2017 20:28:28 +0000 (20:28 +0000)
committerDerek Schuff <dschuff@google.com>
Mon, 17 Apr 2017 20:28:28 +0000 (20:28 +0000)
Use SLEB (varint) for block_type immediates in accordance with the spec.

Patch by Yury Delendik

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300490 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp

index a0b008947491a1cbfb276d124ecd5ef24ebd6d2c..544cd653fd7219433b888aea68f5a284d4f1fdc6 100644 (file)
@@ -94,6 +94,8 @@ void WebAssemblyMCCodeEmitter::encodeInstruction(
               MCFixupKind(WebAssembly::fixup_code_global_index), MI.getLoc()));
           ++MCNumFixups;
           encodeULEB128(uint64_t(MO.getImm()), OS);
+        } else if (Info.OperandType == WebAssembly::OPERAND_SIGNATURE) {
+          encodeSLEB128(int64_t(MO.getImm()), OS);
         } else {
           encodeULEB128(uint64_t(MO.getImm()), OS);
         }