[llvm-commits] [SignlessTypes] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Reid Spencer reid at x10sys.com
Thu Oct 19 17:35:19 PDT 2006



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.289.2.1 -> 1.289.2.2
---
Log message:

Make some simplifications for ConstantInt:
1. Get rid of getRawValue, replace with getZExtValue
2. Single constructor (uint64_t) and get method (int64_t)
3. Canonicalize the constant to a zero extended unsigned 64-bit integer when
   it is created.
4. Adjust getZExtValue() to be a do-nothing (just returns the already
   canonicalized value).
5. Compensate for above changes everywhere else.


---
Diffs of the changes:  (+11 -11)

 SelectionDAGISel.cpp |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.289.2.1 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.289.2.2
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.289.2.1	Wed Oct 18 22:57:55 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp	Thu Oct 19 19:34:43 2006
@@ -641,7 +641,7 @@
       return N = DAG.getNode(ISD::VBUILD_VECTOR,MVT::Vector,&Ops[0],Ops.size());
     } else {
       // Canonicalize all constant ints to be unsigned.
-      return N = DAG.getConstant(cast<ConstantIntegral>(C)->getRawValue(),VT);
+      return N = DAG.getConstant(cast<ConstantIntegral>(C)->getZExtValue(),VT);
     }
   }
       
@@ -929,8 +929,8 @@
   // lowering the switch to a binary tree of conditional branches.
   if (TLI.isOperationLegal(ISD::BRIND, TLI.getPointerTy()) &&
       Cases.size() > 5) {
-    uint64_t First = cast<ConstantIntegral>(Cases.front().first)->getRawValue();
-    uint64_t Last  = cast<ConstantIntegral>(Cases.back().first)->getRawValue();
+    uint64_t First =cast<ConstantIntegral>(Cases.front().first)->getZExtValue();
+    uint64_t Last  = cast<ConstantIntegral>(Cases.back().first)->getZExtValue();
     double Density = (double)Cases.size() / (double)((Last - First) + 1ULL);
     
     if (Density >= 0.3125) {
@@ -978,7 +978,7 @@
       std::vector<MachineBasicBlock*> DestBBs;
       uint64_t TEI = First;
       for (CaseItr ii = Cases.begin(), ee = Cases.end(); ii != ee; ++TEI) {
-        if (cast<ConstantIntegral>(ii->first)->getRawValue() == TEI) {
+        if (cast<ConstantIntegral>(ii->first)->getZExtValue() == TEI) {
           DestBBs.push_back(ii->second);
           ++ii;
         } else {
@@ -1053,8 +1053,8 @@
       // rather than creating a leaf node for it.
       if ((LHSR.second - LHSR.first) == 1 &&
           LHSR.first->first == CR.GE &&
-          cast<ConstantIntegral>(C)->getRawValue() ==
-          (cast<ConstantIntegral>(CR.GE)->getRawValue() + 1ULL)) {
+          cast<ConstantIntegral>(C)->getZExtValue() ==
+          (cast<ConstantIntegral>(CR.GE)->getZExtValue() + 1ULL)) {
         LHSBB = LHSR.first->second;
       } else {
         LHSBB = new MachineBasicBlock(LLVMBB);
@@ -1065,8 +1065,8 @@
       // is CR.LT - 1, then we can branch directly to the target block for
       // the current Case Value, rather than emitting a RHS leaf node for it.
       if ((RHSR.second - RHSR.first) == 1 && CR.LT &&
-          cast<ConstantIntegral>(RHSR.first->first)->getRawValue() ==
-          (cast<ConstantIntegral>(CR.LT)->getRawValue() - 1ULL)) {
+          cast<ConstantIntegral>(RHSR.first->first)->getZExtValue() ==
+          (cast<ConstantIntegral>(CR.LT)->getZExtValue() - 1ULL)) {
         RHSBB = RHSR.first->second;
       } else {
         RHSBB = new MachineBasicBlock(LLVMBB);
@@ -1267,7 +1267,7 @@
 
       // If this is a constant subscript, handle it quickly.
       if (ConstantInt *CI = dyn_cast<ConstantInt>(Idx)) {
-        if (CI->getRawValue() == 0) continue;
+        if (CI->getZExtValue() == 0) continue;
         uint64_t Offs;
         if (CI->getType()->isSigned()) 
           Offs = (int64_t)
@@ -3122,7 +3122,7 @@
   for (GetElementPtrInst::op_iterator OI = GEPI->op_begin()+1,
        E = GEPI->op_end(); OI != E; ++OI) {
     if (ConstantInt *CI = dyn_cast<ConstantInt>(*OI)) {
-      if (CI->getRawValue()) {
+      if (CI->getZExtValue()) {
         hasConstantIndex = true;
         break;
       }
@@ -3164,7 +3164,7 @@
 
       // Handle constant subscripts.
       if (ConstantInt *CI = dyn_cast<ConstantInt>(Idx)) {
-        if (CI->getRawValue() == 0) continue;
+        if (CI->getZExtValue() == 0) continue;
         if (CI->getType()->isSigned())
           ConstantOffset += (int64_t)TD->getTypeSize(Ty)*CI->getSExtValue();
         else






More information about the llvm-commits mailing list