[llvm-commits] CVS: llvm/lib/Transforms/TransformInternals.cpp TransformInternals.h

Reid Spencer reid at x10sys.com
Fri Oct 20 00:08:35 PDT 2006



Changes in directory llvm/lib/Transforms:

TransformInternals.cpp updated: 1.50 -> 1.51
TransformInternals.h updated: 1.27 -> 1.28
---
Log message:

For PR950: http://llvm.org/PR950 :
This patch implements the first increment for the Signless Types feature.
All changes pertain to removing the ConstantSInt and ConstantUInt classes
in favor of just using ConstantInt.


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

 TransformInternals.cpp |    9 +++++----
 TransformInternals.h   |    2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)


Index: llvm/lib/Transforms/TransformInternals.cpp
diff -u llvm/lib/Transforms/TransformInternals.cpp:1.50 llvm/lib/Transforms/TransformInternals.cpp:1.51
--- llvm/lib/Transforms/TransformInternals.cpp:1.50	Fri Oct 28 23:41:30 2005
+++ llvm/lib/Transforms/TransformInternals.cpp	Fri Oct 20 02:07:24 2006
@@ -34,7 +34,7 @@
          (i == SL->MemberOffsets.size()-1 || Offset < SL->MemberOffsets[i+1]));
 
   // Make sure to save the current index...
-  Indices.push_back(ConstantUInt::get(Type::UIntTy, i));
+  Indices.push_back(ConstantInt::get(Type::UIntTy, i));
   Offset = SL->MemberOffsets[i];
   return STy->getContainedType(i);
 }
@@ -73,10 +73,11 @@
 
     NextType = ATy->getElementType();
     unsigned ChildSize = (unsigned)TD.getTypeSize(NextType);
-    if (ConstantSInt::isValueValidForType(Type::IntTy, Offset/ChildSize))
-      Indices.push_back(ConstantSInt::get(Type::IntTy, Offset/ChildSize));
+    if (ConstantInt::isValueValidForType(Type::IntTy, 
+                                         uint64_t(Offset/ChildSize)))
+      Indices.push_back(ConstantInt::get(Type::IntTy, Offset/ChildSize));
     else
-      Indices.push_back(ConstantSInt::get(Type::LongTy, Offset/ChildSize));
+      Indices.push_back(ConstantInt::get(Type::LongTy, Offset/ChildSize));
     ThisOffset = (Offset/ChildSize)*ChildSize;
   } else {
     Offset = 0;   // Return the offset that we were able to achieve


Index: llvm/lib/Transforms/TransformInternals.h
diff -u llvm/lib/Transforms/TransformInternals.h:1.27 llvm/lib/Transforms/TransformInternals.h:1.28
--- llvm/lib/Transforms/TransformInternals.h:1.27	Tue Jul 26 11:38:28 2005
+++ llvm/lib/Transforms/TransformInternals.h	Fri Oct 20 02:07:24 2006
@@ -25,7 +25,7 @@
 namespace llvm {
 
 static inline int64_t getConstantValue(const ConstantInt *CPI) {
-  return (int64_t)cast<ConstantInt>(CPI)->getRawValue();
+  return (int64_t)cast<ConstantInt>(CPI)->getZExtValue();
 }
 
 






More information about the llvm-commits mailing list