[WebAssembly] Factor out a TypeToString function, since we need it in multiple places.
[oota-llvm.git] / lib / Target / WebAssembly / WebAssemblyAsmPrinter.cpp
index cfabc21ea4d933bf5727ee3a008b860037820284..1b175a7f8d5b2e3fa6907d781126580ece4898bf 100644 (file)
@@ -115,21 +115,7 @@ std::string WebAssemblyAsmPrinter::regToString(const MachineOperand &MO) {
 }
 
 const char *WebAssemblyAsmPrinter::toString(MVT VT) const {
 }
 
 const char *WebAssemblyAsmPrinter::toString(MVT VT) const {
-  switch (VT.SimpleTy) {
-  default:
-    break;
-  case MVT::f32:
-    return "f32";
-  case MVT::f64:
-    return "f64";
-  case MVT::i32:
-    return "i32";
-  case MVT::i64:
-    return "i64";
-  }
-  DEBUG(dbgs() << "Invalid type " << EVT(VT).getEVTString() << '\n');
-  llvm_unreachable("invalid type");
-  return "<invalid>";
+  return WebAssembly::TypeToString(VT);
 }
 
 //===----------------------------------------------------------------------===//
 }
 
 //===----------------------------------------------------------------------===//