diff options
Diffstat (limited to 'llvm/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp')
-rw-r--r-- | llvm/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/llvm/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp b/llvm/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp index 9b94806c953..3a151dec16f 100644 --- a/llvm/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp +++ b/llvm/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp @@ -98,22 +98,7 @@ void WebAssemblyInstPrinter::printOperand(const MCInst *MI, unsigned OpNo, case WebAssembly::PARAM: case WebAssembly::RESULT: case WebAssembly::LOCAL: - switch (Op.getImm()) { - case MVT::i32: - O << "i32"; - break; - case MVT::i64: - O << "i64"; - break; - case MVT::f32: - O << "f32"; - break; - case MVT::f64: - O << "f64"; - break; - default: - llvm_unreachable("unexpected type"); - } + O << WebAssembly::TypeToString(MVT::SimpleValueType(Op.getImm())); break; default: O << Op.getImm(); @@ -126,3 +111,18 @@ void WebAssemblyInstPrinter::printOperand(const MCInst *MI, unsigned OpNo, Op.getExpr()->print(O, &MAI); } } + +const char *llvm::WebAssembly::TypeToString(MVT Ty) { + switch (Ty.SimpleTy) { + case MVT::i32: + return "i32"; + case MVT::i64: + return "i64"; + case MVT::f32: + return "f32"; + case MVT::f64: + return "f64"; + default: + llvm_unreachable("unsupported type"); + } +} |