diff options
Diffstat (limited to 'llvm/lib/Target/WebAssembly')
9 files changed, 186 insertions, 151 deletions
| diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyCallIndirectFixup.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyCallIndirectFixup.cpp index f1196925f6c..313147c9431 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyCallIndirectFixup.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyCallIndirectFixup.cpp @@ -65,14 +65,14 @@ static unsigned getNonPseudoCallIndirectOpcode(const MachineInstr &MI) {      using namespace WebAssembly;    case PCALL_INDIRECT_VOID:      return CALL_INDIRECT_VOID; -  case PCALL_INDIRECT_I32: -    return CALL_INDIRECT_I32; -  case PCALL_INDIRECT_I64: -    return CALL_INDIRECT_I64; -  case PCALL_INDIRECT_F32: -    return CALL_INDIRECT_F32; -  case PCALL_INDIRECT_F64: -    return CALL_INDIRECT_F64; +  case PCALL_INDIRECT_i32: +    return CALL_INDIRECT_i32; +  case PCALL_INDIRECT_i64: +    return CALL_INDIRECT_i64; +  case PCALL_INDIRECT_f32: +    return CALL_INDIRECT_f32; +  case PCALL_INDIRECT_f64: +    return CALL_INDIRECT_f64;    case PCALL_INDIRECT_v16i8:      return CALL_INDIRECT_v16i8;    case PCALL_INDIRECT_v8i16: @@ -85,6 +85,10 @@ static unsigned getNonPseudoCallIndirectOpcode(const MachineInstr &MI) {      return CALL_INDIRECT_v4f32;    case PCALL_INDIRECT_v2f64:      return CALL_INDIRECT_v2f64; +  case PCALL_INDIRECT_ExceptRef: +    return CALL_INDIRECT_ExceptRef; +  case PRET_CALL_INDIRECT: +    return RET_CALL_INDIRECT;    default:      return INSTRUCTION_LIST_END;    } diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp index 39c682dc7ca..4fff49f54d7 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp @@ -741,6 +741,7 @@ bool WebAssemblyFastISel::fastLowerArguments() {  bool WebAssemblyFastISel::selectCall(const Instruction *I) {    const auto *Call = cast<CallInst>(I); +  // TODO: Support tail calls in FastISel    if (Call->isMustTailCall() || Call->isInlineAsm() ||        Call->getFunctionType()->isVarArg())      return false; @@ -769,19 +770,19 @@ bool WebAssemblyFastISel::selectCall(const Instruction *I) {      case MVT::i8:      case MVT::i16:      case MVT::i32: -      Opc = IsDirect ? WebAssembly::CALL_I32 : WebAssembly::PCALL_INDIRECT_I32; +      Opc = IsDirect ? WebAssembly::CALL_i32 : WebAssembly::PCALL_INDIRECT_i32;        ResultReg = createResultReg(&WebAssembly::I32RegClass);        break;      case MVT::i64: -      Opc = IsDirect ? WebAssembly::CALL_I64 : WebAssembly::PCALL_INDIRECT_I64; +      Opc = IsDirect ? WebAssembly::CALL_i64 : WebAssembly::PCALL_INDIRECT_i64;        ResultReg = createResultReg(&WebAssembly::I64RegClass);        break;      case MVT::f32: -      Opc = IsDirect ? WebAssembly::CALL_F32 : WebAssembly::PCALL_INDIRECT_F32; +      Opc = IsDirect ? WebAssembly::CALL_f32 : WebAssembly::PCALL_INDIRECT_f32;        ResultReg = createResultReg(&WebAssembly::F32RegClass);        break;      case MVT::f64: -      Opc = IsDirect ? WebAssembly::CALL_F64 : WebAssembly::PCALL_INDIRECT_F64; +      Opc = IsDirect ? WebAssembly::CALL_f64 : WebAssembly::PCALL_INDIRECT_f64;        ResultReg = createResultReg(&WebAssembly::F64RegClass);        break;      case MVT::v16i8: @@ -815,8 +816,8 @@ bool WebAssemblyFastISel::selectCall(const Instruction *I) {        ResultReg = createResultReg(&WebAssembly::V128RegClass);        break;      case MVT::ExceptRef: -      Opc = IsDirect ? WebAssembly::CALL_EXCEPT_REF -                     : WebAssembly::PCALL_INDIRECT_EXCEPT_REF; +      Opc = IsDirect ? WebAssembly::CALL_ExceptRef +                     : WebAssembly::PCALL_INDIRECT_ExceptRef;        ResultReg = createResultReg(&WebAssembly::EXCEPT_REFRegClass);        break;      default: diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISD.def b/llvm/lib/Target/WebAssembly/WebAssemblyISD.def index af5fcd8c09c..77217f16a72 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyISD.def +++ b/llvm/lib/Target/WebAssembly/WebAssemblyISD.def @@ -15,6 +15,7 @@  HANDLE_NODETYPE(CALL1)  HANDLE_NODETYPE(CALL0) +HANDLE_NODETYPE(RET_CALL)  HANDLE_NODETYPE(RETURN)  HANDLE_NODETYPE(ARGUMENT)  // A wrapper node for TargetExternalSymbol, TargetGlobalAddress, and MCSymbol diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp index fccb456586e..4064a983099 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp @@ -644,13 +644,14 @@ WebAssemblyTargetLowering::LowerCall(CallLoweringInfo &CLI,    if (CLI.IsPatchPoint)      fail(DL, DAG, "WebAssembly doesn't support patch point yet"); -  // WebAssembly doesn't currently support explicit tail calls. If they are -  // required, fail. Otherwise, just disable them. -  if ((CallConv == CallingConv::Fast && CLI.IsTailCall && -       MF.getTarget().Options.GuaranteedTailCallOpt) || -      (CLI.CS && CLI.CS.isMustTailCall())) -    fail(DL, DAG, "WebAssembly doesn't support tail call yet"); -  CLI.IsTailCall = false; +  // Fail if tail calls are required but not enabled +  if (!Subtarget->hasTailCall()) { +    if ((CallConv == CallingConv::Fast && CLI.IsTailCall && +         MF.getTarget().Options.GuaranteedTailCallOpt) || +        (CLI.CS && CLI.CS.isMustTailCall())) +      fail(DL, DAG, "WebAssembly 'tail-call' feature not enabled"); +    CLI.IsTailCall = false; +  }    SmallVectorImpl<ISD::InputArg> &Ins = CLI.Ins;    if (Ins.size() > 1) @@ -783,6 +784,13 @@ WebAssemblyTargetLowering::LowerCall(CallLoweringInfo &CLI,      // registers.      InTys.push_back(In.VT);    } + +  if (CLI.IsTailCall) { +    // ret_calls do not return values to the current frame +    SDVTList NodeTys = DAG.getVTList(MVT::Other, MVT::Glue); +    return DAG.getNode(WebAssemblyISD::RET_CALL, DL, NodeTys, Ops); +  } +    InTys.push_back(MVT::Other);    SDVTList InTyList = DAG.getVTList(InTys);    SDValue Res = diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrCall.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrCall.td index 190328c82e5..bcff9f23608 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrCall.td +++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrCall.td @@ -23,106 +23,110 @@ defm ADJCALLSTACKUP : NRI<(outs), (ins i32imm:$amt, i32imm:$amt2),                            [(WebAssemblycallseq_end timm:$amt, timm:$amt2)]>;  } // Uses = [SP32, SP64], Defs = [SP32, SP64], isCodeGenOnly = 1 -multiclass CALL<WebAssemblyRegClass vt, string prefix> { -  defm CALL_#vt : I<(outs vt:$dst), (ins function32_op:$callee, variable_ops), -                    (outs), (ins function32_op:$callee), -                    [(set vt:$dst, (WebAssemblycall1 (i32 imm:$callee)))], -                    !strconcat(prefix, "call\t$dst, $callee"), -                    !strconcat(prefix, "call\t$callee"), -                    0x10>; +multiclass CALL<ValueType vt, WebAssemblyRegClass rt, string prefix, +                list<Predicate> preds = []> { +  defm CALL_#vt : +    I<(outs rt:$dst), (ins function32_op:$callee, variable_ops), +      (outs), (ins function32_op:$callee), +      [(set (vt rt:$dst), (WebAssemblycall1 (i32 imm:$callee)))], +      !strconcat(prefix, "call\t$dst, $callee"), +      !strconcat(prefix, "call\t$callee"), +      0x10>, +    Requires<preds>;    let isCodeGenOnly = 1 in -  defm PCALL_INDIRECT_#vt : I<(outs vt:$dst), (ins I32:$callee, variable_ops), -                              (outs), (ins I32:$callee), -                              [(set vt:$dst, (WebAssemblycall1 I32:$callee))], -                              "PSEUDO CALL INDIRECT\t$callee", -                              "PSEUDO CALL INDIRECT\t$callee">; +  defm PCALL_INDIRECT_#vt : +    I<(outs rt:$dst), (ins I32:$callee, variable_ops), +      (outs), (ins I32:$callee), +      [(set (vt rt:$dst), (WebAssemblycall1 I32:$callee))], +      "PSEUDO CALL INDIRECT\t$callee", +      "PSEUDO CALL INDIRECT\t$callee">, +    Requires<preds>; -  defm CALL_INDIRECT_#vt : I<(outs vt:$dst), -                             (ins TypeIndex:$type, i32imm:$flags, variable_ops), -                             (outs), (ins TypeIndex:$type, i32imm:$flags), -                             [], -                             !strconcat(prefix, "call_indirect\t$dst"), -                             !strconcat(prefix, "call_indirect\t$type"), -                             0x11>; +  defm CALL_INDIRECT_#vt : +    I<(outs rt:$dst), +      (ins TypeIndex:$type, i32imm:$flags, variable_ops), +      (outs), (ins TypeIndex:$type, i32imm:$flags), +      [], +      !strconcat(prefix, "call_indirect\t$dst"), +      !strconcat(prefix, "call_indirect\t$type"), +      0x11>, +    Requires<preds>;  } -multiclass SIMD_CALL<ValueType vt, string prefix> { +let Uses = [SP32, SP64], isCall = 1 in { +defm "" : CALL<i32, I32, "i32.">; +defm "" : CALL<i64, I64, "i64.">; +defm "" : CALL<f32, F32, "f32.">; +defm "" : CALL<f64, F64, "f64.">; +defm "" : CALL<ExceptRef, EXCEPT_REF, "except_ref.", [HasExceptionHandling]>; +defm "" : CALL<v16i8, V128, "v128.", [HasSIMD128]>; +defm "" : CALL<v8i16, V128, "v128.", [HasSIMD128]>; +defm "" : CALL<v4i32, V128, "v128.", [HasSIMD128]>; +defm "" : CALL<v2i64, V128, "v128.", [HasSIMD128]>; +defm "" : CALL<v4f32, V128, "v128.", [HasSIMD128]>; +defm "" : CALL<v2f64, V128, "v128.", [HasSIMD128]>; -  defm CALL_#vt : I<(outs V128:$dst), (ins function32_op:$callee, variable_ops), -                    (outs), (ins function32_op:$callee), -                    [(set (vt V128:$dst), -                      (WebAssemblycall1 (i32 imm:$callee)))], -                    !strconcat(prefix, "call\t$dst, $callee"), -                    !strconcat(prefix, "call\t$callee"), -                    0x10>, -                  Requires<[HasSIMD128]>; +let IsCanonical = 1 in { +defm CALL_VOID : +  I<(outs), (ins function32_op:$callee, variable_ops), +    (outs), (ins function32_op:$callee), +    [(WebAssemblycall0 (i32 imm:$callee))], +    "call    \t$callee", "call\t$callee", 0x10>; -  let isCodeGenOnly = 1 in -  defm PCALL_INDIRECT_#vt : I<(outs V128:$dst), -                              (ins I32:$callee, variable_ops), -                              (outs), (ins I32:$callee), -                              [(set (vt V128:$dst), -                                    (WebAssemblycall1 I32:$callee))], -                              "PSEUDO CALL INDIRECT\t$callee", -                              "PSEUDO CALL INDIRECT\t$callee">, -                              Requires<[HasSIMD128]>; +let isReturn = 1 in +defm RET_CALL : +  I<(outs), (ins function32_op:$callee, variable_ops), +    (outs), (ins function32_op:$callee), +    [(WebAssemblyretcall (i32 imm:$callee))], +    "return_call    \t$callee", "return_call\t$callee", 0x12>, +  Requires<[HasTailCall]>; -  defm CALL_INDIRECT_#vt : I<(outs V128:$dst), -                             (ins TypeIndex:$type, i32imm:$flags, variable_ops), -                             (outs), (ins TypeIndex:$type, i32imm:$flags), -                             [], -                             !strconcat(prefix, "call_indirect\t$dst"), -                             !strconcat(prefix, "call_indirect\t$type"), -                             0x11>, -                             Requires<[HasSIMD128]>; -} +let isCodeGenOnly = 1 in +defm PCALL_INDIRECT_VOID : +  I<(outs), (ins I32:$callee, variable_ops), +    (outs), (ins I32:$callee), +    [(WebAssemblycall0 I32:$callee)], +    "PSEUDO CALL INDIRECT\t$callee", +    "PSEUDO CALL INDIRECT\t$callee">; -let Uses = [SP32, SP64], isCall = 1 in { -defm "" : CALL<I32, "i32.">; -defm "" : CALL<I64, "i64.">; -defm "" : CALL<F32, "f32.">; -defm "" : CALL<F64, "f64.">; -defm "" : CALL<EXCEPT_REF, "except_ref.">; -defm "" : SIMD_CALL<v16i8, "v128.">; -defm "" : SIMD_CALL<v8i16, "v128.">; -defm "" : SIMD_CALL<v4i32, "v128.">; -defm "" : SIMD_CALL<v2i64, "v128.">; -defm "" : SIMD_CALL<v4f32, "v128.">; -defm "" : SIMD_CALL<v2f64, "v128.">; +defm CALL_INDIRECT_VOID : +  I<(outs), (ins TypeIndex:$type, i32imm:$flags, variable_ops), +    (outs), (ins TypeIndex:$type, i32imm:$flags), +    [], +    "call_indirect\t", "call_indirect\t$type", +    0x11>; -let IsCanonical = 1 in { -defm CALL_VOID : I<(outs), (ins function32_op:$callee, variable_ops), -                   (outs), (ins function32_op:$callee), -                   [(WebAssemblycall0 (i32 imm:$callee))], -                   "call    \t$callee", "call\t$callee", 0x10>; +let isReturn = 1 in +defm RET_CALL_INDIRECT : +  I<(outs), (ins TypeIndex:$type, i32imm:$flags, variable_ops), +    (outs), (ins TypeIndex:$type, i32imm:$flags), +    [], +    "return_call_indirect\t", "return_call_indirect\t$type", +    0x13>, +  Requires<[HasTailCall]>; -let isCodeGenOnly = 1 in -defm PCALL_INDIRECT_VOID : I<(outs), (ins I32:$callee, variable_ops), -                             (outs), (ins I32:$callee), -                             [(WebAssemblycall0 I32:$callee)], -                             "PSEUDO CALL INDIRECT\t$callee", -                             "PSEUDO CALL INDIRECT\t$callee">; +let isCodeGenOnly = 1, isReturn = 1 in +defm PRET_CALL_INDIRECT: +    I<(outs), (ins I32:$callee, variable_ops), +      (outs), (ins I32:$callee), +      [(WebAssemblyretcall I32:$callee)], +      "PSEUDO RET_CALL INDIRECT\t$callee", +      "PSEUDO RET_CALL INDIRECT\t$callee">, +    Requires<[HasTailCall]>; -defm CALL_INDIRECT_VOID : I<(outs), -                            (ins TypeIndex:$type, i32imm:$flags, -                              variable_ops), -                            (outs), (ins TypeIndex:$type, i32imm:$flags), -                            [], -                            "call_indirect\t", "call_indirect\t$type", -                            0x11>;  } // IsCanonical = 1  } // Uses = [SP32,SP64], isCall = 1  // Patterns for matching a direct call to a global address.  def : Pat<(i32 (WebAssemblycall1 (WebAssemblywrapper tglobaladdr:$callee))), -          (CALL_I32 tglobaladdr:$callee)>; +          (CALL_i32 tglobaladdr:$callee)>;  def : Pat<(i64 (WebAssemblycall1 (WebAssemblywrapper tglobaladdr:$callee))), -          (CALL_I64 tglobaladdr:$callee)>; +          (CALL_i64 tglobaladdr:$callee)>;  def : Pat<(f32 (WebAssemblycall1 (WebAssemblywrapper tglobaladdr:$callee))), -          (CALL_F32 tglobaladdr:$callee)>; +          (CALL_f32 tglobaladdr:$callee)>;  def : Pat<(f64 (WebAssemblycall1 (WebAssemblywrapper tglobaladdr:$callee))), -          (CALL_F64 tglobaladdr:$callee)>; +          (CALL_f64 tglobaladdr:$callee)>;  def : Pat<(v16i8 (WebAssemblycall1 (WebAssemblywrapper tglobaladdr:$callee))),            (CALL_v16i8 tglobaladdr:$callee)>, Requires<[HasSIMD128]>;  def : Pat<(v8i16 (WebAssemblycall1 (WebAssemblywrapper tglobaladdr:$callee))), @@ -137,19 +141,22 @@ def : Pat<(v2f64 (WebAssemblycall1 (WebAssemblywrapper tglobaladdr:$callee))),            (CALL_v2f64 tglobaladdr:$callee)>, Requires<[HasSIMD128]>;  def : Pat<(ExceptRef             (WebAssemblycall1 (WebAssemblywrapper tglobaladdr:$callee))), -          (CALL_EXCEPT_REF tglobaladdr:$callee)>; +          (CALL_ExceptRef tglobaladdr:$callee)>, +      Requires<[HasExceptionHandling]>;  def : Pat<(WebAssemblycall0 (WebAssemblywrapper tglobaladdr:$callee)),            (CALL_VOID tglobaladdr:$callee)>; +def : Pat<(WebAssemblyretcall (WebAssemblywrapper tglobaladdr:$callee)), +          (RET_CALL tglobaladdr:$callee)>, Requires<[HasTailCall]>;  // Patterns for matching a direct call to an external symbol.  def : Pat<(i32 (WebAssemblycall1 (WebAssemblywrapper texternalsym:$callee))), -          (CALL_I32 texternalsym:$callee)>; +          (CALL_i32 texternalsym:$callee)>;  def : Pat<(i64 (WebAssemblycall1 (WebAssemblywrapper texternalsym:$callee))), -          (CALL_I64 texternalsym:$callee)>; +          (CALL_i64 texternalsym:$callee)>;  def : Pat<(f32 (WebAssemblycall1 (WebAssemblywrapper texternalsym:$callee))), -          (CALL_F32 texternalsym:$callee)>; +          (CALL_f32 texternalsym:$callee)>;  def : Pat<(f64 (WebAssemblycall1 (WebAssemblywrapper texternalsym:$callee))), -          (CALL_F64 texternalsym:$callee)>; +          (CALL_f64 texternalsym:$callee)>;  def : Pat<(v16i8 (WebAssemblycall1 (WebAssemblywrapper texternalsym:$callee))),            (CALL_v16i8 texternalsym:$callee)>, Requires<[HasSIMD128]>;  def : Pat<(v8i16 (WebAssemblycall1 (WebAssemblywrapper texternalsym:$callee))), @@ -164,6 +171,9 @@ def : Pat<(v2f64 (WebAssemblycall1 (WebAssemblywrapper texternalsym:$callee))),            (CALL_v2f64 texternalsym:$callee)>, Requires<[HasSIMD128]>;  def : Pat<(ExceptRef             (WebAssemblycall1 (WebAssemblywrapper texternalsym:$callee))), -          (CALL_EXCEPT_REF texternalsym:$callee)>; +          (CALL_ExceptRef texternalsym:$callee)>, +      Requires<[HasExceptionHandling]>;  def : Pat<(WebAssemblycall0 (WebAssemblywrapper texternalsym:$callee)),            (CALL_VOID texternalsym:$callee)>; +def : Pat<(WebAssemblyretcall (WebAssemblywrapper texternalsym:$callee)), +          (RET_CALL texternalsym:$callee)>, Requires<[HasTailCall]>; diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td index a15bb2cce0b..c42118e82c8 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td +++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrInfo.td @@ -97,6 +97,9 @@ def WebAssemblycall0 : SDNode<"WebAssemblyISD::CALL0",  def WebAssemblycall1 : SDNode<"WebAssemblyISD::CALL1",                                SDT_WebAssemblyCall1,                                [SDNPHasChain, SDNPVariadic]>; +def WebAssemblyretcall : SDNode<"WebAssemblyISD::RET_CALL", +                                SDT_WebAssemblyCall0, +                                [SDNPHasChain, SDNPVariadic]>;  def WebAssemblybr_table : SDNode<"WebAssemblyISD::BR_TABLE",                                   SDT_WebAssemblyBrTable,                                   [SDNPHasChain, SDNPVariadic]>; diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyMemIntrinsicResults.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyMemIntrinsicResults.cpp index a26873cd452..7ac0511c28b 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyMemIntrinsicResults.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyMemIntrinsicResults.cpp @@ -200,8 +200,8 @@ bool WebAssemblyMemIntrinsicResults::runOnMachineFunction(MachineFunction &MF) {        switch (MI.getOpcode()) {        default:          break; -      case WebAssembly::CALL_I32: -      case WebAssembly::CALL_I64: +      case WebAssembly::CALL_i32: +      case WebAssembly::CALL_i64:          Changed |= optimizeCall(MBB, MI, MRI, MDT, LIS, TLI, LibInfo);          break;        } diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyPeephole.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyPeephole.cpp index dc8f3c3efbe..e11cdeaa0e7 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyPeephole.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyPeephole.cpp @@ -128,8 +128,8 @@ bool WebAssemblyPeephole::runOnMachineFunction(MachineFunction &MF) {        switch (MI.getOpcode()) {        default:          break; -      case WebAssembly::CALL_I32: -      case WebAssembly::CALL_I64: { +      case WebAssembly::CALL_i32: +      case WebAssembly::CALL_i64: {          MachineOperand &Op1 = MI.getOperand(1);          if (Op1.isSymbol()) {            StringRef Name(Op1.getSymbolName()); diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyUtilities.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyUtilities.cpp index 002246a77e2..cca27d9c8d4 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyUtilities.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyUtilities.cpp @@ -107,14 +107,14 @@ bool WebAssembly::isCallDirect(const MachineInstr &MI) {    switch (MI.getOpcode()) {    case WebAssembly::CALL_VOID:    case WebAssembly::CALL_VOID_S: -  case WebAssembly::CALL_I32: -  case WebAssembly::CALL_I32_S: -  case WebAssembly::CALL_I64: -  case WebAssembly::CALL_I64_S: -  case WebAssembly::CALL_F32: -  case WebAssembly::CALL_F32_S: -  case WebAssembly::CALL_F64: -  case WebAssembly::CALL_F64_S: +  case WebAssembly::CALL_i32: +  case WebAssembly::CALL_i32_S: +  case WebAssembly::CALL_i64: +  case WebAssembly::CALL_i64_S: +  case WebAssembly::CALL_f32: +  case WebAssembly::CALL_f32_S: +  case WebAssembly::CALL_f64: +  case WebAssembly::CALL_f64_S:    case WebAssembly::CALL_v16i8:    case WebAssembly::CALL_v16i8_S:    case WebAssembly::CALL_v8i16: @@ -127,8 +127,10 @@ bool WebAssembly::isCallDirect(const MachineInstr &MI) {    case WebAssembly::CALL_v4f32_S:    case WebAssembly::CALL_v2f64:    case WebAssembly::CALL_v2f64_S: -  case WebAssembly::CALL_EXCEPT_REF: -  case WebAssembly::CALL_EXCEPT_REF_S: +  case WebAssembly::CALL_ExceptRef: +  case WebAssembly::CALL_ExceptRef_S: +  case WebAssembly::RET_CALL: +  case WebAssembly::RET_CALL_S:      return true;    default:      return false; @@ -139,14 +141,14 @@ bool WebAssembly::isCallIndirect(const MachineInstr &MI) {    switch (MI.getOpcode()) {    case WebAssembly::CALL_INDIRECT_VOID:    case WebAssembly::CALL_INDIRECT_VOID_S: -  case WebAssembly::CALL_INDIRECT_I32: -  case WebAssembly::CALL_INDIRECT_I32_S: -  case WebAssembly::CALL_INDIRECT_I64: -  case WebAssembly::CALL_INDIRECT_I64_S: -  case WebAssembly::CALL_INDIRECT_F32: -  case WebAssembly::CALL_INDIRECT_F32_S: -  case WebAssembly::CALL_INDIRECT_F64: -  case WebAssembly::CALL_INDIRECT_F64_S: +  case WebAssembly::CALL_INDIRECT_i32: +  case WebAssembly::CALL_INDIRECT_i32_S: +  case WebAssembly::CALL_INDIRECT_i64: +  case WebAssembly::CALL_INDIRECT_i64_S: +  case WebAssembly::CALL_INDIRECT_f32: +  case WebAssembly::CALL_INDIRECT_f32_S: +  case WebAssembly::CALL_INDIRECT_f64: +  case WebAssembly::CALL_INDIRECT_f64_S:    case WebAssembly::CALL_INDIRECT_v16i8:    case WebAssembly::CALL_INDIRECT_v16i8_S:    case WebAssembly::CALL_INDIRECT_v8i16: @@ -159,8 +161,10 @@ bool WebAssembly::isCallIndirect(const MachineInstr &MI) {    case WebAssembly::CALL_INDIRECT_v4f32_S:    case WebAssembly::CALL_INDIRECT_v2f64:    case WebAssembly::CALL_INDIRECT_v2f64_S: -  case WebAssembly::CALL_INDIRECT_EXCEPT_REF: -  case WebAssembly::CALL_INDIRECT_EXCEPT_REF_S: +  case WebAssembly::CALL_INDIRECT_ExceptRef: +  case WebAssembly::CALL_INDIRECT_ExceptRef_S: +  case WebAssembly::RET_CALL_INDIRECT: +  case WebAssembly::RET_CALL_INDIRECT_S:      return true;    default:      return false; @@ -173,15 +177,19 @@ unsigned WebAssembly::getCalleeOpNo(const MachineInstr &MI) {    case WebAssembly::CALL_VOID_S:    case WebAssembly::CALL_INDIRECT_VOID:    case WebAssembly::CALL_INDIRECT_VOID_S: +  case WebAssembly::RET_CALL: +  case WebAssembly::RET_CALL_S: +  case WebAssembly::RET_CALL_INDIRECT: +  case WebAssembly::RET_CALL_INDIRECT_S:      return 0; -  case WebAssembly::CALL_I32: -  case WebAssembly::CALL_I32_S: -  case WebAssembly::CALL_I64: -  case WebAssembly::CALL_I64_S: -  case WebAssembly::CALL_F32: -  case WebAssembly::CALL_F32_S: -  case WebAssembly::CALL_F64: -  case WebAssembly::CALL_F64_S: +  case WebAssembly::CALL_i32: +  case WebAssembly::CALL_i32_S: +  case WebAssembly::CALL_i64: +  case WebAssembly::CALL_i64_S: +  case WebAssembly::CALL_f32: +  case WebAssembly::CALL_f32_S: +  case WebAssembly::CALL_f64: +  case WebAssembly::CALL_f64_S:    case WebAssembly::CALL_v16i8:    case WebAssembly::CALL_v16i8_S:    case WebAssembly::CALL_v8i16: @@ -194,16 +202,16 @@ unsigned WebAssembly::getCalleeOpNo(const MachineInstr &MI) {    case WebAssembly::CALL_v4f32_S:    case WebAssembly::CALL_v2f64:    case WebAssembly::CALL_v2f64_S: -  case WebAssembly::CALL_EXCEPT_REF: -  case WebAssembly::CALL_EXCEPT_REF_S: -  case WebAssembly::CALL_INDIRECT_I32: -  case WebAssembly::CALL_INDIRECT_I32_S: -  case WebAssembly::CALL_INDIRECT_I64: -  case WebAssembly::CALL_INDIRECT_I64_S: -  case WebAssembly::CALL_INDIRECT_F32: -  case WebAssembly::CALL_INDIRECT_F32_S: -  case WebAssembly::CALL_INDIRECT_F64: -  case WebAssembly::CALL_INDIRECT_F64_S: +  case WebAssembly::CALL_ExceptRef: +  case WebAssembly::CALL_ExceptRef_S: +  case WebAssembly::CALL_INDIRECT_i32: +  case WebAssembly::CALL_INDIRECT_i32_S: +  case WebAssembly::CALL_INDIRECT_i64: +  case WebAssembly::CALL_INDIRECT_i64_S: +  case WebAssembly::CALL_INDIRECT_f32: +  case WebAssembly::CALL_INDIRECT_f32_S: +  case WebAssembly::CALL_INDIRECT_f64: +  case WebAssembly::CALL_INDIRECT_f64_S:    case WebAssembly::CALL_INDIRECT_v16i8:    case WebAssembly::CALL_INDIRECT_v16i8_S:    case WebAssembly::CALL_INDIRECT_v8i16: @@ -216,8 +224,8 @@ unsigned WebAssembly::getCalleeOpNo(const MachineInstr &MI) {    case WebAssembly::CALL_INDIRECT_v4f32_S:    case WebAssembly::CALL_INDIRECT_v2f64:    case WebAssembly::CALL_INDIRECT_v2f64_S: -  case WebAssembly::CALL_INDIRECT_EXCEPT_REF: -  case WebAssembly::CALL_INDIRECT_EXCEPT_REF_S: +  case WebAssembly::CALL_INDIRECT_ExceptRef: +  case WebAssembly::CALL_INDIRECT_ExceptRef_S:      return 1;    default:      llvm_unreachable("Not a call instruction"); | 

