[llvm-commits] CVS: llvm/lib/Target/Sparc/SparcInstrSelection.cpp

Vikram Adve vadve at cs.uiuc.edu
Tue Jul 29 15:00:03 PDT 2003


Changes in directory llvm/lib/Target/Sparc:

SparcInstrSelection.cpp updated: 1.108 -> 1.109

---
Log message:

Unify all constant evaluations that depend on register size
in ConvertConstantToIntType.


---
Diffs of the changes:

Index: llvm/lib/Target/Sparc/SparcInstrSelection.cpp
diff -u llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.108 llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.109
--- llvm/lib/Target/Sparc/SparcInstrSelection.cpp:1.108	Fri Jul 25 16:08:58 2003
+++ llvm/lib/Target/Sparc/SparcInstrSelection.cpp	Tue Jul 29 14:59:23 2003
@@ -823,7 +823,8 @@
   
   if (resultType->isInteger() || isa<PointerType>(resultType)) {
     bool isValidConst;
-    int64_t C = GetConstantValueAsSignedInt(constOp, isValidConst);
+    int64_t C = (int64_t) target.getInstrInfo().ConvertConstantToIntType(target,
+                                     constOp, constOp->getType(), isValidConst);
     if (isValidConst) {
       unsigned pow;
       bool needNeg = false;
@@ -976,14 +977,15 @@
   if (resultType->isInteger()) {
     unsigned pow;
     bool isValidConst;
-    int64_t C = GetConstantValueAsSignedInt(constOp, isValidConst);
+    int64_t C = (int64_t) target.getInstrInfo().ConvertConstantToIntType(target,
+                                     constOp, constOp->getType(), isValidConst);
     if (isValidConst) {
       bool needNeg = false;
       if (C < 0) {
         needNeg = true;
         C = -C;
       }
-          
+      
       if (C == 1) {
         mvec.push_back(BuildMI(V9::ADDr, 3).addReg(LHS).addMReg(ZeroReg)
                        .addRegDef(destVal));
@@ -1085,7 +1087,9 @@
   // compile time if the total size is a known constant.
   if (isa<Constant>(numElementsVal)) {
     bool isValid;
-    int64_t numElem = GetConstantValueAsSignedInt(numElementsVal, isValid);
+    int64_t numElem = (int64_t) target.getInstrInfo().
+      ConvertConstantToIntType(target, numElementsVal,
+                               numElementsVal->getType(), isValid);
     assert(isValid && "Unexpectedly large array dimension in alloca!");
     int64_t total = numElem * tsize;
     if (int extra= total % target.getFrameInfo().getStackFrameSizeAlignment())
@@ -1634,7 +1638,8 @@
         
         if ((constVal->getType()->isInteger()
              || isa<PointerType>(constVal->getType()))
-            && GetConstantValueAsSignedInt(constVal, isValidConst) == 0
+            && target.getInstrInfo().ConvertConstantToIntType(target,
+                             constVal, constVal->getType(), isValidConst) == 0
             && isValidConst)
           {
             // That constant is a zero after all...
@@ -2240,7 +2245,8 @@
             
             if ((constVal->getType()->isInteger()
                  || isa<PointerType>(constVal->getType()))
-                && GetConstantValueAsSignedInt(constVal, isValidConst) == 0
+                && target.getInstrInfo().ConvertConstantToIntType(target,
+                             constVal, constVal->getType(), isValidConst) == 0
                 && isValidConst)
               {
                 // That constant is an integer zero after all...





More information about the llvm-commits mailing list