Index: include/llvm/MC/MCSymbolWasm.h =================================================================== --- include/llvm/MC/MCSymbolWasm.h +++ include/llvm/MC/MCSymbolWasm.h @@ -16,8 +16,8 @@ private: bool IsFunction = false; std::string ModuleName; - SmallVector Returns; - SmallVector Params; + SmallVector Returns; + SmallVector Params; /// An expression describing how to calculate the size of a symbol. If a /// symbol has no size this field will be NULL. @@ -39,13 +39,13 @@ const StringRef getModuleName() const { return ModuleName; } - const SmallVector &getReturns() const { return Returns; } - void setReturns(SmallVectorImpl &&Rets) { + const SmallVector &getReturns() const { return Returns; } + void setReturns(SmallVectorImpl &&Rets) { Returns = std::move(Rets); } - const SmallVector &getParams() const { return Params; } - void setParams(SmallVectorImpl &&Pars) { + const SmallVector &getParams() const { return Params; } + void setParams(SmallVectorImpl &&Pars) { Params = std::move(Pars); } }; Index: include/llvm/Support/Wasm.h =================================================================== --- include/llvm/Support/Wasm.h +++ include/llvm/Support/Wasm.h @@ -53,14 +53,14 @@ }; // Type immediate encodings used in various contexts. -enum : unsigned { - WASM_TYPE_I32 = 0x7f, - WASM_TYPE_I64 = 0x7e, - WASM_TYPE_F32 = 0x7d, - WASM_TYPE_F64 = 0x7c, - WASM_TYPE_ANYFUNC = 0x70, - WASM_TYPE_FUNC = 0x60, - WASM_TYPE_NORESULT = 0x40, // for blocks with no result values +enum { + WASM_TYPE_I32 = -0x01, + WASM_TYPE_I64 = -0x02, + WASM_TYPE_F32 = -0x03, + WASM_TYPE_F64 = -0x04, + WASM_TYPE_ANYFUNC = -0x10, + WASM_TYPE_FUNC = -0x20, + WASM_TYPE_NORESULT = -0x40, // for blocks with no result values }; // Kinds of externals (for imports and exports). Index: lib/MC/WasmObjectWriter.cpp =================================================================== --- lib/MC/WasmObjectWriter.cpp +++ lib/MC/WasmObjectWriter.cpp @@ -140,7 +140,7 @@ assert((Name != nullptr) == (SectionId == wasm::WASM_SEC_CUSTOM) && "Only custom sections can have names"); - write8(SectionId); + encodeULEB128(SectionId, getStream()); Section.SizeOffset = getStream().tell(); @@ -290,10 +290,10 @@ enum { Plain, Empty, Tombstone } State; // The return types of the function. - SmallVector Returns; + SmallVector Returns; // The parameter types of the function. - SmallVector Params; + SmallVector Params; WasmFunctionType() : State(Plain) {} @@ -317,10 +317,10 @@ } static unsigned getHashValue(const WasmFunctionType &FuncTy) { uintptr_t Value = FuncTy.State; - for (unsigned Ret : FuncTy.Returns) - Value += DenseMapInfo::getHashValue(Ret); - for (unsigned Param : FuncTy.Params) - Value += DenseMapInfo::getHashValue(Param); + for (int32_t Ret : FuncTy.Returns) + Value += DenseMapInfo::getHashValue(Ret); + for (int32_t Param : FuncTy.Params) + Value += DenseMapInfo::getHashValue(Param); return Value; } static bool isEqual(const WasmFunctionType &LHS, @@ -756,13 +756,13 @@ encodeULEB128(FunctionTypes.size(), getStream()); for (WasmFunctionType &FuncTy : FunctionTypes) { - write8(wasm::WASM_TYPE_FUNC); + encodeSLEB128(wasm::WASM_TYPE_FUNC, getStream()); encodeULEB128(FuncTy.Params.size(), getStream()); - for (unsigned Ty : FuncTy.Params) - write8(Ty); + for (int32_t Ty : FuncTy.Params) + encodeSLEB128(Ty, getStream()); encodeULEB128(FuncTy.Returns.size(), getStream()); - for (unsigned Ty : FuncTy.Returns) - write8(Ty); + for (int32_t Ty : FuncTy.Returns) + encodeSLEB128(Ty, getStream()); } endSection(Section); @@ -782,15 +782,15 @@ encodeULEB128(FieldName.size(), getStream()); writeBytes(FieldName); - write8(Import.Kind); + encodeULEB128(Import.Kind, getStream()); switch (Import.Kind) { case wasm::WASM_EXTERNAL_FUNCTION: encodeULEB128(Import.Type, getStream()); break; case wasm::WASM_EXTERNAL_GLOBAL: - write8(Import.Type); - write8(0); // mutability + encodeSLEB128(Import.Type, getStream()); + encodeULEB128(0, getStream()); // mutability break; default: llvm_unreachable("unsupported import kind"); @@ -820,7 +820,7 @@ // The number of tables, fixed to 1 for now. encodeULEB128(1, getStream()); - write8(wasm::WASM_TYPE_ANYFUNC); + encodeSLEB128(wasm::WASM_TYPE_ANYFUNC, getStream()); encodeULEB128(0, getStream()); // flags encodeULEB128(TableElems.size(), getStream()); // initial @@ -846,7 +846,7 @@ encodeULEB128(Globals.size(), getStream()); for (const WasmGlobal &Global : Globals) { - write8(Global.Type); + encodeSLEB128(Global.Type, getStream()); write8(Global.IsMutable); write8(wasm::WASM_OPCODE_I32_CONST); @@ -866,7 +866,7 @@ encodeULEB128(Export.FieldName.size(), getStream()); writeBytes(Export.FieldName); - write8(Export.Kind); + encodeSLEB128(Export.Kind, getStream()); encodeULEB128(Export.Index, getStream()); } @@ -1007,7 +1007,7 @@ if (!CodeRelocations.empty()) { startSection(Section, wasm::WASM_SEC_CUSTOM, "reloc.CODE"); - write8(wasm::WASM_SEC_CODE); + encodeULEB128(wasm::WASM_SEC_CODE, getStream()); encodeULEB128(CodeRelocations.size(), getStream()); @@ -1020,7 +1020,7 @@ if (!DataRelocations.empty()) { startSection(Section, wasm::WASM_SEC_CUSTOM, "reloc.DATA"); - write8(wasm::WASM_SEC_DATA); + encodeULEB128(wasm::WASM_SEC_DATA, getStream()); encodeULEB128(DataRelocations.size(), getStream()); Index: lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h =================================================================== --- lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h +++ lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h @@ -149,33 +149,33 @@ /// This is used to indicate block signatures. enum class ExprType { - Void = 0x40, - I32 = 0x7f, - I64 = 0x7e, - F32 = 0x7d, - F64 = 0x7c, - I8x16 = 0x7b, - I16x8 = 0x7a, - I32x4 = 0x79, - F32x4 = 0x78, - B8x16 = 0x77, - B16x8 = 0x76, - B32x4 = 0x75 + Void = -0x40, + I32 = -0x01, + I64 = -0x02, + F32 = -0x03, + F64 = -0x04, + I8x16 = -0x05, + I16x8 = -0x06, + I32x4 = -0x07, + F32x4 = -0x08, + B8x16 = -0x09, + B16x8 = -0x0a, + B32x4 = -0x0b }; /// This is used to indicate local types. enum class ValType { - I32 = 0x7f, - I64 = 0x7e, - F32 = 0x7d, - F64 = 0x7c, - I8x16 = 0x7b, - I16x8 = 0x7a, - I32x4 = 0x79, - F32x4 = 0x78, - B8x16 = 0x77, - B16x8 = 0x76, - B32x4 = 0x75 + I32 = -0x01, + I64 = -0x02, + F32 = -0x03, + F64 = -0x04, + I8x16 = -0x05, + I16x8 = -0x06, + I32x4 = -0x07, + F32x4 = -0x08, + B8x16 = -0x09, + B16x8 = -0x0a, + B32x4 = -0x0b }; /// Instruction opcodes emitted via means other than CodeGen. Index: lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp =================================================================== --- lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp +++ lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp @@ -164,7 +164,7 @@ void WebAssemblyTargetWasmStreamer::emitParam(MCSymbol *Symbol, ArrayRef Types) { - SmallVector Params; + SmallVector Params; for (MVT Ty : Types) Params.push_back(MVT2WasmType(Ty)); @@ -173,7 +173,7 @@ void WebAssemblyTargetWasmStreamer::emitResult(MCSymbol *Symbol, ArrayRef Types) { - SmallVector Returns; + SmallVector Returns; for (MVT Ty : Types) Returns.push_back(MVT2WasmType(Ty)); Index: lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp =================================================================== --- lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp +++ lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp @@ -45,8 +45,8 @@ const TargetMachine &TM = MF.getTarget(); const Function &CurrentFunc = *MF.getFunction(); - SmallVector Returns; - SmallVector Params; + SmallVector Returns; + SmallVector Params; WebAssembly::ValType iPTR = MF.getSubtarget().hasAddr64() ? @@ -58,19 +58,19 @@ // WebAssembly can't currently handle returning tuples. if (ResultMVTs.size() <= 1) for (MVT ResultMVT : ResultMVTs) - Returns.push_back(unsigned(WebAssembly::toValType(ResultMVT))); + Returns.push_back(int32_t(WebAssembly::toValType(ResultMVT))); else - Params.push_back(unsigned(iPTR)); + Params.push_back(int32_t(iPTR)); for (Type *Ty : FuncTy->params()) { SmallVector ParamMVTs; ComputeLegalValueVTs(CurrentFunc, TM, Ty, ParamMVTs); for (MVT ParamMVT : ParamMVTs) - Params.push_back(unsigned(WebAssembly::toValType(ParamMVT))); + Params.push_back(int32_t(WebAssembly::toValType(ParamMVT))); } if (FuncTy->isVarArg()) - Params.push_back(unsigned(iPTR)); + Params.push_back(int32_t(iPTR)); WasmSym->setReturns(std::move(Returns)); WasmSym->setParams(std::move(Params)); @@ -95,8 +95,8 @@ if (strcmp(Name, "__stack_pointer") == 0) return WasmSym; - SmallVector Returns; - SmallVector Params; + SmallVector Returns; + SmallVector Params; GetSignature(Subtarget, Name, Returns, Params); WasmSym->setReturns(std::move(Returns)); @@ -128,15 +128,15 @@ } // Return the WebAssembly type associated with the given register class. -static unsigned getType(const TargetRegisterClass *RC) { +static int32_t getType(const TargetRegisterClass *RC) { if (RC == &WebAssembly::I32RegClass) - return unsigned(WebAssembly::ExprType::I32); + return int32_t(WebAssembly::ExprType::I32); if (RC == &WebAssembly::I64RegClass) - return unsigned(WebAssembly::ExprType::I64); + return int32_t(WebAssembly::ExprType::I64); if (RC == &WebAssembly::F32RegClass) - return unsigned(WebAssembly::ExprType::F32); + return int32_t(WebAssembly::ExprType::F32); if (RC == &WebAssembly::F64RegClass) - return unsigned(WebAssembly::ExprType::F64); + return int32_t(WebAssembly::ExprType::F64); llvm_unreachable("Unexpected register class"); } @@ -172,8 +172,8 @@ if (Info.OperandType == WebAssembly::OPERAND_TYPEINDEX) { MCSymbol *Sym = Printer.createTempSymbol("typeindex"); if (!isa(Sym)) { - SmallVector Returns; - SmallVector Params; + SmallVector Returns; + SmallVector Params; const MachineRegisterInfo &MRI = MI->getParent()->getParent()->getRegInfo(); Index: lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.h =================================================================== --- lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.h +++ lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.h @@ -25,13 +25,13 @@ extern void GetSignature(const WebAssemblySubtarget &Subtarget, RTLIB::Libcall LC, - SmallVectorImpl &Rets, - SmallVectorImpl &Params); + SmallVectorImpl &Rets, + SmallVectorImpl &Params); extern void GetSignature(const WebAssemblySubtarget &Subtarget, const char *Name, - SmallVectorImpl &Rets, - SmallVectorImpl &Params); + SmallVectorImpl &Rets, + SmallVectorImpl &Params); } // end namespace llvm Index: lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp =================================================================== --- lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp +++ lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp @@ -972,8 +972,8 @@ void llvm::GetSignature(const WebAssemblySubtarget &Subtarget, RTLIB::Libcall LC, - SmallVectorImpl &Rets, - SmallVectorImpl &Params) + SmallVectorImpl &Rets, + SmallVectorImpl &Params) { assert(Rets.empty()); assert(Params.empty()); @@ -986,304 +986,304 @@ case func: break; case f32_func_f32: - Rets.push_back(unsigned(WebAssembly::ExprType::F32)); - Params.push_back(unsigned(WebAssembly::ExprType::F32)); + Rets.push_back(int32_t(WebAssembly::ExprType::F32)); + Params.push_back(int32_t(WebAssembly::ExprType::F32)); break; case f32_func_f64: - Rets.push_back(unsigned(WebAssembly::ExprType::F32)); - Params.push_back(unsigned(WebAssembly::ExprType::F64)); + Rets.push_back(int32_t(WebAssembly::ExprType::F32)); + Params.push_back(int32_t(WebAssembly::ExprType::F64)); break; case f32_func_i32: - Rets.push_back(unsigned(WebAssembly::ExprType::F32)); - Params.push_back(unsigned(WebAssembly::ExprType::I32)); + Rets.push_back(int32_t(WebAssembly::ExprType::F32)); + Params.push_back(int32_t(WebAssembly::ExprType::I32)); break; case f32_func_i64: - Rets.push_back(unsigned(WebAssembly::ExprType::F32)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::F32)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); break; case f32_func_i16: - Rets.push_back(unsigned(WebAssembly::ExprType::F32)); - Params.push_back(unsigned(WebAssembly::ExprType::I32)); + Rets.push_back(int32_t(WebAssembly::ExprType::F32)); + Params.push_back(int32_t(WebAssembly::ExprType::I32)); break; case f64_func_f32: - Rets.push_back(unsigned(WebAssembly::ExprType::F64)); - Params.push_back(unsigned(WebAssembly::ExprType::F32)); + Rets.push_back(int32_t(WebAssembly::ExprType::F64)); + Params.push_back(int32_t(WebAssembly::ExprType::F32)); break; case f64_func_f64: - Rets.push_back(unsigned(WebAssembly::ExprType::F64)); - Params.push_back(unsigned(WebAssembly::ExprType::F64)); + Rets.push_back(int32_t(WebAssembly::ExprType::F64)); + Params.push_back(int32_t(WebAssembly::ExprType::F64)); break; case f64_func_i32: - Rets.push_back(unsigned(WebAssembly::ExprType::F64)); - Params.push_back(unsigned(WebAssembly::ExprType::I32)); + Rets.push_back(int32_t(WebAssembly::ExprType::F64)); + Params.push_back(int32_t(WebAssembly::ExprType::I32)); break; case f64_func_i64: - Rets.push_back(unsigned(WebAssembly::ExprType::F64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::F64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); break; case i32_func_f32: - Rets.push_back(unsigned(WebAssembly::ExprType::I32)); - Params.push_back(unsigned(WebAssembly::ExprType::F32)); + Rets.push_back(int32_t(WebAssembly::ExprType::I32)); + Params.push_back(int32_t(WebAssembly::ExprType::F32)); break; case i32_func_f64: - Rets.push_back(unsigned(WebAssembly::ExprType::I32)); - Params.push_back(unsigned(WebAssembly::ExprType::F64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I32)); + Params.push_back(int32_t(WebAssembly::ExprType::F64)); break; case i32_func_i32: - Rets.push_back(unsigned(WebAssembly::ExprType::I32)); - Params.push_back(unsigned(WebAssembly::ExprType::I32)); + Rets.push_back(int32_t(WebAssembly::ExprType::I32)); + Params.push_back(int32_t(WebAssembly::ExprType::I32)); break; case i64_func_f32: - Rets.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::F32)); + Rets.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::F32)); break; case i64_func_f64: - Rets.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::F64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::F64)); break; case i64_func_i64: - Rets.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); break; case f32_func_f32_f32: - Rets.push_back(unsigned(WebAssembly::ExprType::F32)); - Params.push_back(unsigned(WebAssembly::ExprType::F32)); - Params.push_back(unsigned(WebAssembly::ExprType::F32)); + Rets.push_back(int32_t(WebAssembly::ExprType::F32)); + Params.push_back(int32_t(WebAssembly::ExprType::F32)); + Params.push_back(int32_t(WebAssembly::ExprType::F32)); break; case f32_func_f32_i32: - Rets.push_back(unsigned(WebAssembly::ExprType::F32)); - Params.push_back(unsigned(WebAssembly::ExprType::F32)); - Params.push_back(unsigned(WebAssembly::ExprType::I32)); + Rets.push_back(int32_t(WebAssembly::ExprType::F32)); + Params.push_back(int32_t(WebAssembly::ExprType::F32)); + Params.push_back(int32_t(WebAssembly::ExprType::I32)); break; case f32_func_i64_i64: - Rets.push_back(unsigned(WebAssembly::ExprType::F32)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::F32)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); break; case f64_func_f64_f64: - Rets.push_back(unsigned(WebAssembly::ExprType::F64)); - Params.push_back(unsigned(WebAssembly::ExprType::F64)); - Params.push_back(unsigned(WebAssembly::ExprType::F64)); + Rets.push_back(int32_t(WebAssembly::ExprType::F64)); + Params.push_back(int32_t(WebAssembly::ExprType::F64)); + Params.push_back(int32_t(WebAssembly::ExprType::F64)); break; case f64_func_f64_i32: - Rets.push_back(unsigned(WebAssembly::ExprType::F64)); - Params.push_back(unsigned(WebAssembly::ExprType::F64)); - Params.push_back(unsigned(WebAssembly::ExprType::I32)); + Rets.push_back(int32_t(WebAssembly::ExprType::F64)); + Params.push_back(int32_t(WebAssembly::ExprType::F64)); + Params.push_back(int32_t(WebAssembly::ExprType::I32)); break; case f64_func_i64_i64: - Rets.push_back(unsigned(WebAssembly::ExprType::F64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::F64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); break; case i16_func_f32: - Rets.push_back(unsigned(WebAssembly::ExprType::I32)); - Params.push_back(unsigned(WebAssembly::ExprType::F32)); + Rets.push_back(int32_t(WebAssembly::ExprType::I32)); + Params.push_back(int32_t(WebAssembly::ExprType::F32)); break; case i8_func_i8_i8: - Rets.push_back(unsigned(WebAssembly::ExprType::I32)); - Params.push_back(unsigned(WebAssembly::ExprType::I32)); - Params.push_back(unsigned(WebAssembly::ExprType::I32)); + Rets.push_back(int32_t(WebAssembly::ExprType::I32)); + Params.push_back(int32_t(WebAssembly::ExprType::I32)); + Params.push_back(int32_t(WebAssembly::ExprType::I32)); break; case func_f32_iPTR_iPTR: - Params.push_back(unsigned(WebAssembly::ExprType::F32)); - Params.push_back(unsigned(iPTR)); - Params.push_back(unsigned(iPTR)); + Params.push_back(int32_t(WebAssembly::ExprType::F32)); + Params.push_back(int32_t(iPTR)); + Params.push_back(int32_t(iPTR)); break; case func_f64_iPTR_iPTR: - Params.push_back(unsigned(WebAssembly::ExprType::F64)); - Params.push_back(unsigned(iPTR)); - Params.push_back(unsigned(iPTR)); + Params.push_back(int32_t(WebAssembly::ExprType::F64)); + Params.push_back(int32_t(iPTR)); + Params.push_back(int32_t(iPTR)); break; case i16_func_i16_i16: - Rets.push_back(unsigned(WebAssembly::ExprType::I32)); - Params.push_back(unsigned(WebAssembly::ExprType::I32)); - Params.push_back(unsigned(WebAssembly::ExprType::I32)); + Rets.push_back(int32_t(WebAssembly::ExprType::I32)); + Params.push_back(int32_t(WebAssembly::ExprType::I32)); + Params.push_back(int32_t(WebAssembly::ExprType::I32)); break; case i32_func_f32_f32: - Rets.push_back(unsigned(WebAssembly::ExprType::I32)); - Params.push_back(unsigned(WebAssembly::ExprType::F32)); - Params.push_back(unsigned(WebAssembly::ExprType::F32)); + Rets.push_back(int32_t(WebAssembly::ExprType::I32)); + Params.push_back(int32_t(WebAssembly::ExprType::F32)); + Params.push_back(int32_t(WebAssembly::ExprType::F32)); break; case i32_func_f64_f64: - Rets.push_back(unsigned(WebAssembly::ExprType::I32)); - Params.push_back(unsigned(WebAssembly::ExprType::F64)); - Params.push_back(unsigned(WebAssembly::ExprType::F64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I32)); + Params.push_back(int32_t(WebAssembly::ExprType::F64)); + Params.push_back(int32_t(WebAssembly::ExprType::F64)); break; case i32_func_i32_i32: - Rets.push_back(unsigned(WebAssembly::ExprType::I32)); - Params.push_back(unsigned(WebAssembly::ExprType::I32)); - Params.push_back(unsigned(WebAssembly::ExprType::I32)); + Rets.push_back(int32_t(WebAssembly::ExprType::I32)); + Params.push_back(int32_t(WebAssembly::ExprType::I32)); + Params.push_back(int32_t(WebAssembly::ExprType::I32)); break; case i64_func_i64_i64: - Rets.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); break; case i64_i64_func_f32: #if 0 // TODO: Enable this when wasm gets multiple-return-value support. - Rets.push_back(unsigned(WebAssembly::ExprType::I64)); - Rets.push_back(unsigned(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I64)); #else - Params.push_back(unsigned(iPTR)); + Params.push_back(int32_t(iPTR)); #endif - Params.push_back(unsigned(WebAssembly::ExprType::F32)); + Params.push_back(int32_t(WebAssembly::ExprType::F32)); break; case i64_i64_func_f64: #if 0 // TODO: Enable this when wasm gets multiple-return-value support. - Rets.push_back(unsigned(WebAssembly::ExprType::I64)); - Rets.push_back(unsigned(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I64)); #else - Params.push_back(unsigned(iPTR)); + Params.push_back(int32_t(iPTR)); #endif - Params.push_back(unsigned(WebAssembly::ExprType::F64)); + Params.push_back(int32_t(WebAssembly::ExprType::F64)); break; case i16_i16_func_i16_i16: #if 0 // TODO: Enable this when wasm gets multiple-return-value support. - Rets.push_back(unsigned(WebAssembly::ExprType::I32)); - Rets.push_back(unsigned(WebAssembly::ExprType::I32)); + Rets.push_back(int32_t(WebAssembly::ExprType::I32)); + Rets.push_back(int32_t(WebAssembly::ExprType::I32)); #else - Params.push_back(unsigned(iPTR)); + Params.push_back(int32_t(iPTR)); #endif - Params.push_back(unsigned(WebAssembly::ExprType::I32)); - Params.push_back(unsigned(WebAssembly::ExprType::I32)); + Params.push_back(int32_t(WebAssembly::ExprType::I32)); + Params.push_back(int32_t(WebAssembly::ExprType::I32)); break; case i32_i32_func_i32_i32: #if 0 // TODO: Enable this when wasm gets multiple-return-value support. - Rets.push_back(unsigned(WebAssembly::ExprType::I32)); - Rets.push_back(unsigned(WebAssembly::ExprType::I32)); + Rets.push_back(int32_t(WebAssembly::ExprType::I32)); + Rets.push_back(int32_t(WebAssembly::ExprType::I32)); #else - Params.push_back(unsigned(iPTR)); + Params.push_back(int32_t(iPTR)); #endif - Params.push_back(unsigned(WebAssembly::ExprType::I32)); - Params.push_back(unsigned(WebAssembly::ExprType::I32)); + Params.push_back(int32_t(WebAssembly::ExprType::I32)); + Params.push_back(int32_t(WebAssembly::ExprType::I32)); break; case i64_i64_func_i64_i64: #if 0 // TODO: Enable this when wasm gets multiple-return-value support. - Rets.push_back(unsigned(WebAssembly::ExprType::I64)); - Rets.push_back(unsigned(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I64)); #else - Params.push_back(unsigned(iPTR)); + Params.push_back(int32_t(iPTR)); #endif - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); break; case i64_i64_func_i64_i64_i64_i64: #if 0 // TODO: Enable this when wasm gets multiple-return-value support. - Rets.push_back(unsigned(WebAssembly::ExprType::I64)); - Rets.push_back(unsigned(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I64)); #else - Params.push_back(unsigned(iPTR)); + Params.push_back(int32_t(iPTR)); #endif - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); break; case i64_i64_i64_i64_func_i64_i64_i64_i64: #if 0 // TODO: Enable this when wasm gets multiple-return-value support. - Rets.push_back(unsigned(WebAssembly::ExprType::I64)); - Rets.push_back(unsigned(WebAssembly::ExprType::I64)); - Rets.push_back(unsigned(WebAssembly::ExprType::I64)); - Rets.push_back(unsigned(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I64)); #else - Params.push_back(unsigned(iPTR)); + Params.push_back(int32_t(iPTR)); #endif - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); break; case i64_i64_func_i64_i64_i32: #if 0 // TODO: Enable this when wasm gets multiple-return-value support. - Rets.push_back(unsigned(WebAssembly::ExprType::I64)); - Rets.push_back(unsigned(WebAssembly::ExprType::I64)); - Rets.push_back(unsigned(WebAssembly::ExprType::I64)); - Rets.push_back(unsigned(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I64)); #else - Params.push_back(unsigned(iPTR)); + Params.push_back(int32_t(iPTR)); #endif - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I32)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I32)); break; case iPTR_func_iPTR_i32_iPTR: - Rets.push_back(unsigned(iPTR)); - Params.push_back(unsigned(iPTR)); - Params.push_back(unsigned(WebAssembly::ExprType::I32)); - Params.push_back(unsigned(iPTR)); + Rets.push_back(int32_t(iPTR)); + Params.push_back(int32_t(iPTR)); + Params.push_back(int32_t(WebAssembly::ExprType::I32)); + Params.push_back(int32_t(iPTR)); break; case iPTR_func_iPTR_iPTR_iPTR: - Rets.push_back(unsigned(iPTR)); - Params.push_back(unsigned(iPTR)); - Params.push_back(unsigned(iPTR)); - Params.push_back(unsigned(iPTR)); + Rets.push_back(int32_t(iPTR)); + Params.push_back(int32_t(iPTR)); + Params.push_back(int32_t(iPTR)); + Params.push_back(int32_t(iPTR)); break; case f32_func_f32_f32_f32: - Rets.push_back(unsigned(WebAssembly::ExprType::F32)); - Params.push_back(unsigned(WebAssembly::ExprType::F32)); - Params.push_back(unsigned(WebAssembly::ExprType::F32)); - Params.push_back(unsigned(WebAssembly::ExprType::F32)); + Rets.push_back(int32_t(WebAssembly::ExprType::F32)); + Params.push_back(int32_t(WebAssembly::ExprType::F32)); + Params.push_back(int32_t(WebAssembly::ExprType::F32)); + Params.push_back(int32_t(WebAssembly::ExprType::F32)); break; case f64_func_f64_f64_f64: - Rets.push_back(unsigned(WebAssembly::ExprType::F64)); - Params.push_back(unsigned(WebAssembly::ExprType::F64)); - Params.push_back(unsigned(WebAssembly::ExprType::F64)); - Params.push_back(unsigned(WebAssembly::ExprType::F64)); + Rets.push_back(int32_t(WebAssembly::ExprType::F64)); + Params.push_back(int32_t(WebAssembly::ExprType::F64)); + Params.push_back(int32_t(WebAssembly::ExprType::F64)); + Params.push_back(int32_t(WebAssembly::ExprType::F64)); break; case func_i64_i64_iPTR_iPTR: - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(iPTR)); - Params.push_back(unsigned(iPTR)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(iPTR)); + Params.push_back(int32_t(iPTR)); break; case func_iPTR_f32: - Params.push_back(unsigned(iPTR)); - Params.push_back(unsigned(WebAssembly::ExprType::F32)); + Params.push_back(int32_t(iPTR)); + Params.push_back(int32_t(WebAssembly::ExprType::F32)); break; case func_iPTR_f64: - Params.push_back(unsigned(iPTR)); - Params.push_back(unsigned(WebAssembly::ExprType::F64)); + Params.push_back(int32_t(iPTR)); + Params.push_back(int32_t(WebAssembly::ExprType::F64)); break; case func_iPTR_i32: - Params.push_back(unsigned(iPTR)); - Params.push_back(unsigned(WebAssembly::ExprType::I32)); + Params.push_back(int32_t(iPTR)); + Params.push_back(int32_t(WebAssembly::ExprType::I32)); break; case func_iPTR_i64: - Params.push_back(unsigned(iPTR)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(iPTR)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); break; case func_iPTR_i64_i64: - Params.push_back(unsigned(iPTR)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(iPTR)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); break; case func_iPTR_i64_i64_i64_i64: - Params.push_back(unsigned(iPTR)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(iPTR)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); break; case func_iPTR_i64_i64_i64_i64_i64_i64: - Params.push_back(unsigned(iPTR)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(iPTR)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); break; case i32_func_i64_i64: - Rets.push_back(unsigned(WebAssembly::ExprType::I32)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I32)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); break; case i32_func_i64_i64_i64_i64: - Rets.push_back(unsigned(WebAssembly::ExprType::I32)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); - Params.push_back(unsigned(WebAssembly::ExprType::I64)); + Rets.push_back(int32_t(WebAssembly::ExprType::I32)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); + Params.push_back(int32_t(WebAssembly::ExprType::I64)); break; case unsupported: llvm_unreachable("unsupported runtime library signature"); @@ -1292,8 +1292,8 @@ void llvm::GetSignature(const WebAssemblySubtarget &Subtarget, const char *Name, - SmallVectorImpl &Rets, - SmallVectorImpl &Params) + SmallVectorImpl &Rets, + SmallVectorImpl &Params) { assert(strcmp(RuntimeLibcallNames[RTLIB::DEOPTIMIZE], "__llvm_deoptimize") == 0);