[PATCH] D43991: [WebAssembly] More uses of uint8_t for single byte values

Nicholas Wilson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 2 06:01:46 PST 2018


ncw added a comment.

For now, I'll revert the bad commit; if you want to re-apply it, you'll have to apply this change with it, so that SLEB encoding isn't applied to the uint8_t bytes:

  diff --git a/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp b/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp
  index 77744e53d62..0d35806229a 100644
  --- a/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp
  +++ b/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp
  @@ -93,7 +93,9 @@ void WebAssemblyMCCodeEmitter::encodeInstruction(
           } else if (Info.OperandType == WebAssembly::OPERAND_GLOBAL) {
             llvm_unreachable("wasm globals should only be accessed symbolicly");
           } else if (Info.OperandType == WebAssembly::OPERAND_SIGNATURE) {
  -          encodeSLEB128(int64_t(MO.getImm()), OS);
  +          assert(MO.getImm() > 0 && (MO.getImm() & ~0x3f) == 0x40 &&
  +                 "Signature must be pre-encoded negative single-byte SLEB");
  +          OS << uint8_t(MO.getImm());
           } else {
             encodeULEB128(uint64_t(MO.getImm()), OS);
           }


Repository:
  rL LLVM

https://reviews.llvm.org/D43991





More information about the llvm-commits mailing list