diff options
author | Chris Lattner <sabre@nondot.org> | 2003-08-07 23:15:21 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-08-07 23:15:21 +0000 |
commit | d3464c19a8b6acecd8a9618489ec7612505fd4bd (patch) | |
tree | 293a0c47fe70f2bcca60b8f1232f2b14c53b0b66 /support | |
parent | 2e5cbc218c9b03ca27ff54d1d63201de6484666e (diff) | |
download | external_llvm-d3464c19a8b6acecd8a9618489ec7612505fd4bd.zip external_llvm-d3464c19a8b6acecd8a9618489ec7612505fd4bd.tar.gz external_llvm-d3464c19a8b6acecd8a9618489ec7612505fd4bd.tar.bz2 |
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
Diffstat (limited to 'support')
-rw-r--r-- | support/tools/TableGen/CodeGenWrappers.cpp | 33 | ||||
-rw-r--r-- | support/tools/TableGen/CodeGenWrappers.h | 2 |
2 files changed, 20 insertions, 15 deletions
diff --git a/support/tools/TableGen/CodeGenWrappers.cpp b/support/tools/TableGen/CodeGenWrappers.cpp index 4987aeb..93e1856 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 b371c09..ebae8dc 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. |