[llvm-commits] [SignlessTypes] CVS: llvm/lib/VMCore/Constants.cpp

Reid Spencer reid at x10sys.com
Fri Oct 20 00:34:12 PDT 2006



Changes in directory llvm/lib/VMCore:

Constants.cpp updated: 1.163.2.4 -> 1.163.2.5
---
Log message:

The forgotten patches. These should have been committed and tagged with the
ST_iter_1 tag, but they weren't, so we're commiting them now.


---
Diffs of the changes:  (+5 -32)

 Constants.cpp |   37 +++++--------------------------------
 1 files changed, 5 insertions(+), 32 deletions(-)


Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.163.2.4 llvm/lib/VMCore/Constants.cpp:1.163.2.5
--- llvm/lib/VMCore/Constants.cpp:1.163.2.4	Thu Oct 19 23:27:18 2006
+++ llvm/lib/VMCore/Constants.cpp	Fri Oct 20 02:33:53 2006
@@ -200,8 +200,7 @@
 //                             Normal Constructors
 
 ConstantIntegral::ConstantIntegral(const Type *Ty, ValueTy VT, uint64_t V)
-  : Constant(Ty, VT, 0, 0) {
-  Val.Unsigned = V;
+  : Constant(Ty, VT, 0, 0), Val(V) {
 }
 
 ConstantBool::ConstantBool(bool V) 
@@ -573,44 +572,18 @@
   case Type::SByteTyID:
     return (Val <= INT8_MAX && Val >= INT8_MIN);
   case Type::UByteTyID:
-    return (Val > 0) && (Val <= UINT8_MAX);
+    return (Val >= 0) && (Val <= UINT8_MAX);
   case Type::ShortTyID:
     return (Val <= INT16_MAX && Val >= INT16_MIN);
   case Type::UShortTyID:
-    return (Val > 0) && (Val <= UINT16_MAX);
+    return (Val >= 0) && (Val <= UINT16_MAX);
   case Type::IntTyID:
     return (Val <= int(INT32_MAX) && Val >= int(INT32_MIN));
   case Type::UIntTyID:
-    return (Val > 0) && (Val <= UINT32_MAX);
+    return (Val >= 0) && (Val <= UINT32_MAX);
   case Type::LongTyID:
-    return true; // always true, has to fit in largest type
-  case Type::ULongTyID:
-    return (Val >= 0);
-  }
-}
-
-bool ConstantInt::isValueValidForType(const Type *Ty, uint64_t Val) {
-  switch (Ty->getTypeID()) {
-  default:
-    return false;         // These can't be represented as integers!!!
-
-    // Unsigned types...
-  case Type::UByteTyID:
-    return (Val <= UINT8_MAX);
-  case Type::SByteTyID:
-    return (Val <= INT8_MAX);
-  case Type::UShortTyID:
-    return (Val <= UINT16_MAX);
-  case Type::ShortTyID:
-    return (Val <= INT16_MAX);
-  case Type::UIntTyID:
-    return (Val <= UINT32_MAX);
-  case Type::IntTyID:
-    return (Val <= INT32_MAX);
   case Type::ULongTyID:
-    return true;          // This is the largest type...
-  case Type::LongTyID:
-    return (Val <= INT64_MAX);
+    return true; // always true, has to fit in largest type
   }
 }
 






More information about the llvm-commits mailing list