diff options
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp | 12 | ||||
| -rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyInstrConv.td | 50 |
2 files changed, 35 insertions, 27 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp index 6b5f653f3b9..7ee452efe1d 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp @@ -96,7 +96,8 @@ private: // Operand type (if any), followed by the lower-case version of the opcode's // name matching the names WebAssembly opcodes are expected to have. The // tablegen names are uppercase and suffixed with their type (after an -// underscore). +// underscore). Conversions are additionally prefixed with their input type +// (before a double underscore). static std::string OpcodeName(const WebAssemblyInstrInfo *TII, const MachineInstr *MI) { std::string N(StringRef(TII->getName(MI->getOpcode())).lower()); @@ -110,7 +111,14 @@ static std::string OpcodeName(const WebAssemblyInstrInfo *TII, for (const char *typelessOpcode : { "return", "call", "br_if" }) if (Name == typelessOpcode) return Name; - return std::string(&N[NameEnd + 1], &N[Len]) + '.' + Name; + std::string Type(&N[NameEnd + 1], &N[Len]); + std::string::size_type DoubleUnder = Name.find("__"); + bool IsConv = std::string::npos != DoubleUnder; + if (!IsConv) + return Type + '.' + Name; + std::string InType(&Name[0], &Name[DoubleUnder]); + return Type + '.' + std::string(&Name[DoubleUnder + 2], &Name[NameEnd]) + + '/' + InType; } static std::string toSymbol(StringRef S) { return ("$" + S).str(); } diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyInstrConv.td b/llvm/lib/Target/WebAssembly/WebAssemblyInstrConv.td index 760b4ce5f41..390e90fe317 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyInstrConv.td +++ b/llvm/lib/Target/WebAssembly/WebAssemblyInstrConv.td @@ -13,58 +13,58 @@ /// //===----------------------------------------------------------------------===// -def I32_WRAP_I64 : I<(outs I32:$dst), (ins I64:$src), +def I64__WRAP_I32 : I<(outs I32:$dst), (ins I64:$src), [(set I32:$dst, (trunc I64:$src))]>; -def I64_EXTEND_S_I32 : I<(outs I64:$dst), (ins I32:$src), +def I32__EXTEND_S_I64 : I<(outs I64:$dst), (ins I32:$src), [(set I64:$dst, (sext I32:$src))]>; -def I64_EXTEND_U_I32 : I<(outs I64:$dst), (ins I32:$src), +def I32__EXTEND_U_I64 : I<(outs I64:$dst), (ins I32:$src), [(set I64:$dst, (zext I32:$src))]>; -def I32_TRUNC_S_F32 : I<(outs I32:$dst), (ins F32:$src), +def F32__TRUNC_S_I32 : I<(outs I32:$dst), (ins F32:$src), [(set I32:$dst, (fp_to_sint F32:$src))]>; -def I32_TRUNC_U_F32 : I<(outs I32:$dst), (ins F32:$src), +def F32__TRUNC_U_I32 : I<(outs I32:$dst), (ins F32:$src), [(set I32:$dst, (fp_to_uint F32:$src))]>; -def I64_TRUNC_S_F32 : I<(outs I64:$dst), (ins F32:$src), +def F32__TRUNC_S_I64 : I<(outs I64:$dst), (ins F32:$src), [(set I64:$dst, (fp_to_sint F32:$src))]>; -def I64_TRUNC_U_F32 : I<(outs I64:$dst), (ins F32:$src), +def F32__TRUNC_U_I64 : I<(outs I64:$dst), (ins F32:$src), [(set I64:$dst, (fp_to_uint F32:$src))]>; -def I32_TRUNC_S_F64 : I<(outs I32:$dst), (ins F64:$src), +def F64__TRUNC_S_I32 : I<(outs I32:$dst), (ins F64:$src), [(set I32:$dst, (fp_to_sint F64:$src))]>; -def I32_TRUNC_U_F64 : I<(outs I32:$dst), (ins F64:$src), +def F64__TRUNC_U_I32 : I<(outs I32:$dst), (ins F64:$src), [(set I32:$dst, (fp_to_uint F64:$src))]>; -def I64_TRUNC_S_F64 : I<(outs I64:$dst), (ins F64:$src), +def F64__TRUNC_S_I64 : I<(outs I64:$dst), (ins F64:$src), [(set I64:$dst, (fp_to_sint F64:$src))]>; -def I64_TRUNC_U_F64 : I<(outs I64:$dst), (ins F64:$src), +def F64__TRUNC_U_I64 : I<(outs I64:$dst), (ins F64:$src), [(set I64:$dst, (fp_to_uint F64:$src))]>; -def F32_CONVERT_S_I32 : I<(outs F32:$dst), (ins I32:$src), +def I32__CONVERT_S_F32 : I<(outs F32:$dst), (ins I32:$src), [(set F32:$dst, (sint_to_fp I32:$src))]>; -def F32_CONVERT_U_I32 : I<(outs F32:$dst), (ins I32:$src), +def I32__CONVERT_U_F32 : I<(outs F32:$dst), (ins I32:$src), [(set F32:$dst, (uint_to_fp I32:$src))]>; -def F64_CONVERT_S_I32 : I<(outs F64:$dst), (ins I32:$src), +def I32__CONVERT_S_F64 : I<(outs F64:$dst), (ins I32:$src), [(set F64:$dst, (sint_to_fp I32:$src))]>; -def F64_CONVERT_U_I32 : I<(outs F64:$dst), (ins I32:$src), +def I32__CONVERT_U_F64 : I<(outs F64:$dst), (ins I32:$src), [(set F64:$dst, (uint_to_fp I32:$src))]>; -def F32_CONVERT_S_I64 : I<(outs F32:$dst), (ins I64:$src), +def I64__CONVERT_S_F32 : I<(outs F32:$dst), (ins I64:$src), [(set F32:$dst, (sint_to_fp I64:$src))]>; -def F32_CONVERT_U_I64 : I<(outs F32:$dst), (ins I64:$src), +def I64__CONVERT_U_F32 : I<(outs F32:$dst), (ins I64:$src), [(set F32:$dst, (uint_to_fp I64:$src))]>; -def F64_CONVERT_S_I64 : I<(outs F64:$dst), (ins I64:$src), +def I64__CONVERT_S_F64 : I<(outs F64:$dst), (ins I64:$src), [(set F64:$dst, (sint_to_fp I64:$src))]>; -def F64_CONVERT_U_I64 : I<(outs F64:$dst), (ins I64:$src), +def I64__CONVERT_U_F64 : I<(outs F64:$dst), (ins I64:$src), [(set F64:$dst, (uint_to_fp I64:$src))]>; -def F64_PROMOTE_F32 : I<(outs F64:$dst), (ins F32:$src), +def F32__PROMOTE_F64 : I<(outs F64:$dst), (ins F32:$src), [(set F64:$dst, (fextend F32:$src))]>; -def F32_DEMOTE_F64 : I<(outs F32:$dst), (ins F64:$src), +def F64__DEMOTE_F32 : I<(outs F32:$dst), (ins F64:$src), [(set F32:$dst, (fround F64:$src))]>; -def I32_REINTERPRET_F32 : I<(outs I32:$dst), (ins F32:$src), +def F32__REINTERPRET_I32 : I<(outs I32:$dst), (ins F32:$src), [(set I32:$dst, (bitconvert F32:$src))]>; -def F32_REINTERPRET_I32 : I<(outs F32:$dst), (ins I32:$src), +def I32__REINTERPRET_F32 : I<(outs F32:$dst), (ins I32:$src), [(set F32:$dst, (bitconvert I32:$src))]>; -def I64_REINTERPRET_F64 : I<(outs I64:$dst), (ins F64:$src), +def F64__REINTERPRET_I64 : I<(outs I64:$dst), (ins F64:$src), [(set I64:$dst, (bitconvert F64:$src))]>; -def F64_REINTERPRET_I64 : I<(outs F64:$dst), (ins I64:$src), +def I64__REINTERPRET_F64 : I<(outs F64:$dst), (ins I64:$src), [(set F64:$dst, (bitconvert I64:$src))]>; |

