From d3464c19a8b6acecd8a9618489ec7612505fd4bd Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 7 Aug 2003 23:15:21 +0000 Subject: Add new method to get a value type as a string git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7698 91177308-0d34-0410-b5e6-96231b3b80d8 --- support/tools/TableGen/CodeGenWrappers.cpp | 33 +++++++++++++++++------------- support/tools/TableGen/CodeGenWrappers.h | 2 +- 2 files changed, 20 insertions(+), 15 deletions(-) (limited to 'support') diff --git a/support/tools/TableGen/CodeGenWrappers.cpp b/support/tools/TableGen/CodeGenWrappers.cpp index 4987aeb76c..93e1856c32 100644 --- a/support/tools/TableGen/CodeGenWrappers.cpp +++ b/support/tools/TableGen/CodeGenWrappers.cpp @@ -16,22 +16,27 @@ MVT::ValueType getValueType(Record *Rec) { return (MVT::ValueType)Rec->getValueAsInt("Value"); } -std::ostream &operator<<(std::ostream &OS, MVT::ValueType T) { +std::string getName(MVT::ValueType T) { switch (T) { - case MVT::Other: return OS << "UNKNOWN"; - case MVT::i1: return OS << "i1"; - case MVT::i8: return OS << "i8"; - case MVT::i16: return OS << "i16"; - case MVT::i32: return OS << "i32"; - case MVT::i64: return OS << "i64"; - case MVT::i128: return OS << "i128"; - case MVT::f32: return OS << "f32"; - case MVT::f64: return OS << "f64"; - case MVT::f80: return OS << "f80"; - case MVT::f128: return OS << "f128"; - case MVT::isVoid:return OS << "void"; + case MVT::Other: return "UNKNOWN"; + case MVT::i1: return "i1"; + case MVT::i8: return "i8"; + case MVT::i16: return "i16"; + case MVT::i32: return "i32"; + case MVT::i64: return "i64"; + case MVT::i128: return "i128"; + case MVT::f32: return "f32"; + case MVT::f64: return "f64"; + case MVT::f80: return "f80"; + case MVT::f128: return "f128"; + case MVT::isVoid:return "void"; + default: assert(0 && "ILLEGAL VALUE TYPE!"); return ""; } - return OS; +} + + +std::ostream &operator<<(std::ostream &OS, MVT::ValueType T) { + return OS << getName(T); } diff --git a/support/tools/TableGen/CodeGenWrappers.h b/support/tools/TableGen/CodeGenWrappers.h index b371c0977c..ebae8dcf90 100644 --- a/support/tools/TableGen/CodeGenWrappers.h +++ b/support/tools/TableGen/CodeGenWrappers.h @@ -21,7 +21,7 @@ class RecordKeeper; MVT::ValueType getValueType(Record *Rec); std::ostream &operator<<(std::ostream &OS, MVT::ValueType T); - +std::string getName(MVT::ValueType T); /// CodeGenTarget - This class corresponds to the Target class in the .td files. -- cgit v1.2.3