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

Reid Spencer reid at x10sys.com
Thu Jan 11 23:06:01 PST 2007



Changes in directory llvm/utils/TableGen:

IntrinsicEmitter.cpp updated: 1.21 -> 1.22
---
Log message:

For PR1064: http://llvm.org/PR1064 :
Implement the arbitrary bit-width integer feature. The feature allows
integers of any bitwidth (up to 64) to be defined instead of just 1, 8, 
16, 32, and 64 bit integers.  

This change does several things:
1. Introduces a new Derived Type, IntegerType, to represent the number of
   bits in an integer. The Type classes SubclassData field is used to
   store the number of bits. This allows 2^23 bits in an integer type. 
2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and
   64-bit integers. These are replaced with just IntegerType which is not
   a primitive any more. 
3. Adjust the rest of LLVM to account for this change.

Note that while this incremental change lays the foundation for arbitrary
bit-width integers, LLVM has not yet been converted to actually deal with 
them in any significant way. Most optimization passes, for example, will 
still only deal with the byte-width integer types.  Future increments
will rectify this situation.



---
Diffs of the changes:  (+6 -4)

 IntrinsicEmitter.cpp |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)


Index: llvm/utils/TableGen/IntrinsicEmitter.cpp
diff -u llvm/utils/TableGen/IntrinsicEmitter.cpp:1.21 llvm/utils/TableGen/IntrinsicEmitter.cpp:1.22
--- llvm/utils/TableGen/IntrinsicEmitter.cpp:1.21	Wed Oct  4 16:52:35 2006
+++ llvm/utils/TableGen/IntrinsicEmitter.cpp	Fri Jan 12 01:05:14 2007
@@ -110,12 +110,14 @@
 
 static void EmitTypeVerify(std::ostream &OS, Record *ArgType) {
   OS << "(int)" << ArgType->getValueAsString("TypeVal") << ", ";
+  // If this is an integer type, check the width is correct.
+  if (ArgType->isSubClassOf("LLVMIntegerType"))
+    OS << ArgType->getValueAsInt("Width") << ", ";
 
   // If this is a packed type, check that the subtype and size are correct.
-  if (ArgType->isSubClassOf("LLVMPackedType")) {
-    Record *SubType = ArgType->getValueAsDef("ElTy");
-    OS << "(int)" << SubType->getValueAsString("TypeVal") << ", "
-       << ArgType->getValueAsInt("NumElts") << ", ";
+  else if (ArgType->isSubClassOf("LLVMPackedType")) {
+    EmitTypeVerify(OS, ArgType->getValueAsDef("ElTy"));
+    OS << ArgType->getValueAsInt("NumElts") << ", ";
   }
 }
 






More information about the llvm-commits mailing list