[llvm-commits] CVS: llvm/utils/TableGen/CodeGenWrappers.cpp CodeGenWrappers.h

Chris Lattner lattner at cs.uiuc.edu
Thu Aug 7 18:16:01 PDT 2003


Changes in directory llvm/utils/TableGen:

CodeGenWrappers.cpp updated: 1.1 -> 1.2
CodeGenWrappers.h updated: 1.2 -> 1.3

---
Log message:

Add new method to get a value type as a string


---
Diffs of the changes:

Index: llvm/utils/TableGen/CodeGenWrappers.cpp
diff -u llvm/utils/TableGen/CodeGenWrappers.cpp:1.1 llvm/utils/TableGen/CodeGenWrappers.cpp:1.2
--- llvm/utils/TableGen/CodeGenWrappers.cpp:1.1	Thu Aug  7 00:38:11 2003
+++ llvm/utils/TableGen/CodeGenWrappers.cpp	Thu Aug  7 18:15:21 2003
@@ -16,22 +16,27 @@
   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);
 }
 
 


Index: llvm/utils/TableGen/CodeGenWrappers.h
diff -u llvm/utils/TableGen/CodeGenWrappers.h:1.2 llvm/utils/TableGen/CodeGenWrappers.h:1.3
--- llvm/utils/TableGen/CodeGenWrappers.h:1.2	Thu Aug  7 01:01:44 2003
+++ llvm/utils/TableGen/CodeGenWrappers.h	Thu Aug  7 18:15:21 2003
@@ -21,7 +21,7 @@
 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.





More information about the llvm-commits mailing list