[llvm-commits] [llvm] r43031 - /llvm/trunk/include/llvm/CodeGen/ValueTypes.h

Duncan Sands baldrick at free.fr
Tue Oct 16 06:34:12 PDT 2007


Author: baldrick
Date: Tue Oct 16 08:34:11 2007
New Revision: 43031

URL: http://llvm.org/viewvc/llvm-project?rev=43031&view=rev
Log:
Document the fact that the verifier currently requires the
top bit of a ValueType to be zero.  Enforce this by ensuring
an assertion failure if someone tries to create a ValueType
without this property.  I chose this minimal approach rather
than a more official integration of the notion of reserved
bits into ValueType because I'm hoping that the verifier will
be changed to no longer require this :)

Modified:
    llvm/trunk/include/llvm/CodeGen/ValueTypes.h

Modified: llvm/trunk/include/llvm/CodeGen/ValueTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ValueTypes.h?rev=43031&r1=43030&r2=43031&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/ValueTypes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/ValueTypes.h Tue Oct 16 08:34:11 2007
@@ -107,7 +107,9 @@
   ///
   /// 31--------------16-----------8-------------0
   ///  | Vector length | Precision | Simple type |
-  ///                  |      Vector element     |
+  ///  |               |      Vector element     |
+  ///
+  /// Note that the verifier currently requires the top bit to be zero.
 
   typedef uint32_t ValueType;
 
@@ -313,7 +315,8 @@
       if (NumElements == 2)  return MVT::v2f64;
       break;
     }
-    ValueType Result = VT | ((NumElements + 1) << (32 - VectorBits));
+    // Set the length with the top bit forced to zero (needed by the verifier).
+    ValueType Result = VT | (((NumElements + 1) << (33 - VectorBits)) >> 1);
     assert(getVectorElementType(Result) == VT &&
            "Bad vector element type!");
     assert(getVectorNumElements(Result) == NumElements &&





More information about the llvm-commits mailing list