For 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31063 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/ARM/ARMISelDAGToDAG.cpp b/lib/Target/ARM/ARMISelDAGToDAG.cpp
index 4b197db..cd49271 100644
--- a/lib/Target/ARM/ARMISelDAGToDAG.cpp
+++ b/lib/Target/ARM/ARMISelDAGToDAG.cpp
@@ -810,8 +810,7 @@
   case ISD::Constant: {
     uint32_t val = cast<ConstantSDNode>(N)->getValue();
     if(!isRotInt8Immediate(val)) {
-      const Type  *t =  MVT::getTypeForValueType(MVT::i32);
-      Constant    *C = ConstantUInt::get(t, val);
+      Constant    *C = ConstantInt::get(Type::UIntTy, val);
       int  alignment = 2;
       SDOperand Addr = CurDAG->getTargetConstantPool(C, MVT::i32, alignment);
       SDOperand    Z = CurDAG->getTargetConstant(0,     MVT::i32);
diff --git a/lib/Target/Alpha/AlphaISelDAGToDAG.cpp b/lib/Target/Alpha/AlphaISelDAGToDAG.cpp
index b3b2461..15ee143 100644
--- a/lib/Target/Alpha/AlphaISelDAGToDAG.cpp
+++ b/lib/Target/Alpha/AlphaISelDAGToDAG.cpp
@@ -317,8 +317,7 @@
       break; //(zext (LDAH (LDA)))
     //Else use the constant pool
     MachineConstantPool *CP = BB->getParent()->getConstantPool();
-    ConstantUInt *C =
-      ConstantUInt::get(Type::getPrimitiveType(Type::ULongTyID) , uval);
+    ConstantInt *C = ConstantInt::get(Type::ULongTy, uval);
     SDOperand CPI = CurDAG->getTargetConstantPool(C, MVT::i64);
     SDNode *Tmp = CurDAG->getTargetNode(Alpha::LDAHr, MVT::i64, CPI,
                                         getGlobalBaseReg());
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index 88113a0..f31f920 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -460,7 +460,7 @@
 
     // Do not include the last character, which we know is null
     for (unsigned i = 0, e = CPA->getNumOperands()-1; i != e; ++i) {
-      unsigned char C = cast<ConstantInt>(CPA->getOperand(i))->getRawValue();
+      unsigned char C = cast<ConstantInt>(CPA->getOperand(i))->getZExtValue();
 
       // Print it out literally if it is a printable character.  The only thing
       // to be careful about is when the last letter output was a hex escape
@@ -642,31 +642,31 @@
     break;
   case Type::SByteTyID:
   case Type::ShortTyID:
-    Out << cast<ConstantSInt>(CPV)->getValue();
+    Out << cast<ConstantInt>(CPV)->getSExtValue();
     break;
   case Type::IntTyID:
-    if ((int)cast<ConstantSInt>(CPV)->getValue() == (int)0x80000000)
+    if ((int)cast<ConstantInt>(CPV)->getSExtValue() == (int)0x80000000)
       Out << "((int)0x80000000U)";   // Handle MININT specially to avoid warning
     else
-      Out << cast<ConstantSInt>(CPV)->getValue();
+      Out << cast<ConstantInt>(CPV)->getSExtValue();
     break;
 
   case Type::LongTyID:
-    if (cast<ConstantSInt>(CPV)->isMinValue())
+    if (cast<ConstantInt>(CPV)->isMinValue())
       Out << "(/*INT64_MIN*/(-9223372036854775807LL)-1)";
     else
-      Out << cast<ConstantSInt>(CPV)->getValue() << "ll";
+      Out << cast<ConstantInt>(CPV)->getSExtValue() << "ll";
     break;
 
   case Type::UByteTyID:
   case Type::UShortTyID:
-    Out << cast<ConstantUInt>(CPV)->getValue();
+    Out << cast<ConstantInt>(CPV)->getZExtValue();
     break;
   case Type::UIntTyID:
-    Out << cast<ConstantUInt>(CPV)->getValue() << 'u';
+    Out << cast<ConstantInt>(CPV)->getZExtValue() << 'u';
     break;
   case Type::ULongTyID:
-    Out << cast<ConstantUInt>(CPV)->getValue() << "ull";
+    Out << cast<ConstantInt>(CPV)->getZExtValue() << "ull";
     break;
 
   case Type::FloatTyID:
@@ -2002,14 +2002,14 @@
     // Print out the -> operator if possible...
     if (TmpI != E && isa<StructType>(*TmpI)) {
       Out << (HasImplicitAddress ? "." : "->");
-      Out << "field" << cast<ConstantUInt>(TmpI.getOperand())->getValue();
+      Out << "field" << cast<ConstantInt>(TmpI.getOperand())->getZExtValue();
       I = ++TmpI;
     }
   }
 
   for (; I != E; ++I)
     if (isa<StructType>(*I)) {
-      Out << ".field" << cast<ConstantUInt>(I.getOperand())->getValue();
+      Out << ".field" << cast<ConstantInt>(I.getOperand())->getZExtValue();
     } else {
       Out << '[';
       writeOperand(I.getOperand());
diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp
index 88113a0..f31f920 100644
--- a/lib/Target/CBackend/Writer.cpp
+++ b/lib/Target/CBackend/Writer.cpp
@@ -460,7 +460,7 @@
 
     // Do not include the last character, which we know is null
     for (unsigned i = 0, e = CPA->getNumOperands()-1; i != e; ++i) {
-      unsigned char C = cast<ConstantInt>(CPA->getOperand(i))->getRawValue();
+      unsigned char C = cast<ConstantInt>(CPA->getOperand(i))->getZExtValue();
 
       // Print it out literally if it is a printable character.  The only thing
       // to be careful about is when the last letter output was a hex escape
@@ -642,31 +642,31 @@
     break;
   case Type::SByteTyID:
   case Type::ShortTyID:
-    Out << cast<ConstantSInt>(CPV)->getValue();
+    Out << cast<ConstantInt>(CPV)->getSExtValue();
     break;
   case Type::IntTyID:
-    if ((int)cast<ConstantSInt>(CPV)->getValue() == (int)0x80000000)
+    if ((int)cast<ConstantInt>(CPV)->getSExtValue() == (int)0x80000000)
       Out << "((int)0x80000000U)";   // Handle MININT specially to avoid warning
     else
-      Out << cast<ConstantSInt>(CPV)->getValue();
+      Out << cast<ConstantInt>(CPV)->getSExtValue();
     break;
 
   case Type::LongTyID:
-    if (cast<ConstantSInt>(CPV)->isMinValue())
+    if (cast<ConstantInt>(CPV)->isMinValue())
       Out << "(/*INT64_MIN*/(-9223372036854775807LL)-1)";
     else
-      Out << cast<ConstantSInt>(CPV)->getValue() << "ll";
+      Out << cast<ConstantInt>(CPV)->getSExtValue() << "ll";
     break;
 
   case Type::UByteTyID:
   case Type::UShortTyID:
-    Out << cast<ConstantUInt>(CPV)->getValue();
+    Out << cast<ConstantInt>(CPV)->getZExtValue();
     break;
   case Type::UIntTyID:
-    Out << cast<ConstantUInt>(CPV)->getValue() << 'u';
+    Out << cast<ConstantInt>(CPV)->getZExtValue() << 'u';
     break;
   case Type::ULongTyID:
-    Out << cast<ConstantUInt>(CPV)->getValue() << "ull";
+    Out << cast<ConstantInt>(CPV)->getZExtValue() << "ull";
     break;
 
   case Type::FloatTyID:
@@ -2002,14 +2002,14 @@
     // Print out the -> operator if possible...
     if (TmpI != E && isa<StructType>(*TmpI)) {
       Out << (HasImplicitAddress ? "." : "->");
-      Out << "field" << cast<ConstantUInt>(TmpI.getOperand())->getValue();
+      Out << "field" << cast<ConstantInt>(TmpI.getOperand())->getZExtValue();
       I = ++TmpI;
     }
   }
 
   for (; I != E; ++I)
     if (isa<StructType>(*I)) {
-      Out << ".field" << cast<ConstantUInt>(I.getOperand())->getValue();
+      Out << ".field" << cast<ConstantInt>(I.getOperand())->getZExtValue();
     } else {
       Out << '[';
       writeOperand(I.getOperand());
diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp
index cb602a6..8341774 100644
--- a/lib/Target/TargetData.cpp
+++ b/lib/Target/TargetData.cpp
@@ -330,7 +330,7 @@
   for (unsigned CurIDX = 0; CurIDX != Idx.size(); ++CurIDX, ++TI) {
     if (const StructType *STy = dyn_cast<StructType>(*TI)) {
       assert(Idx[CurIDX]->getType() == Type::UIntTy && "Illegal struct idx");
-      unsigned FieldNo = cast<ConstantUInt>(Idx[CurIDX])->getValue();
+      unsigned FieldNo = cast<ConstantInt>(Idx[CurIDX])->getZExtValue();
 
       // Get structure layout information...
       const StructLayout *Layout = getStructLayout(STy);
@@ -346,7 +346,7 @@
       Ty = cast<SequentialType>(Ty)->getElementType();
 
       // Get the array index and the size of each array element.
-      int64_t arrayIdx = cast<ConstantInt>(Idx[CurIDX])->getRawValue();
+      int64_t arrayIdx = cast<ConstantInt>(Idx[CurIDX])->getSExtValue();
       Result += arrayIdx * (int64_t)getTypeSize(Ty);
     }
   }
diff --git a/lib/Target/X86/X86IntelAsmPrinter.cpp b/lib/Target/X86/X86IntelAsmPrinter.cpp
index a7d1351..7a420d8 100755
--- a/lib/Target/X86/X86IntelAsmPrinter.cpp
+++ b/lib/Target/X86/X86IntelAsmPrinter.cpp
@@ -474,7 +474,7 @@
     unsigned len = 0;
     bool inString = false;
     for (unsigned i = 0; i < NumElts; i++) {
-      int n = cast<ConstantInt>(CVA->getOperand(i))->getRawValue() & 255;
+      int n = cast<ConstantInt>(CVA->getOperand(i))->getZExtValue() & 255;
       if (len == 0)
         O << "\tdb ";