[llvm-branch-commits] [llvm-gcc-branch] r106231 - /llvm-gcc-4.2/branches/Apple/Morbo/gcc/llvm-convert.cpp

Dale Johannesen dalej at apple.com
Thu Jun 17 11:03:03 PDT 2010


Author: johannes
Date: Thu Jun 17 13:03:03 2010
New Revision: 106231

URL: http://llvm.org/viewvc/llvm-project?rev=106231&view=rev
Log:
--- Merging r106225 into '.':
U    gcc/llvm-convert.cpp


Modified:
    llvm-gcc-4.2/branches/Apple/Morbo/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.2/branches/Apple/Morbo/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Morbo/gcc/llvm-convert.cpp?rev=106231&r1=106230&r2=106231&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Morbo/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Morbo/gcc/llvm-convert.cpp Thu Jun 17 13:03:03 2010
@@ -4616,6 +4616,7 @@
   SmallVector<Value *, 4> StoreCallResultAddrs;
   SmallVector<const Type *, 4> CallResultTypes;
   SmallVector<bool, 4> CallResultIsSigned;
+  SmallVector<std::pair<bool, unsigned>, 4> OutputLocations;
 
   // Process outputs.
   ValNum = 0;
@@ -4684,11 +4685,13 @@
       ConstraintStr += SimplifiedConstraint;
       CallResultTypes.push_back(DestValTy);
       CallResultIsSigned.push_back(!TYPE_UNSIGNED(TREE_TYPE(Operand)));
+      OutputLocations.push_back(std::make_pair(true, CallResultTypes.size()-1));
     } else {
       ConstraintStr += ",=*";
       ConstraintStr += SimplifiedConstraint;
       CallOps.push_back(Dest.Ptr);
       CallArgTypes.push_back(Dest.Ptr->getType());
+      OutputLocations.push_back(std::make_pair(false, CallArgTypes.size()-1));
     }
   }
 
@@ -4753,8 +4756,19 @@
       // is big endian.
       if (ISDIGIT(Constraint[0])) {
         unsigned Match = atoi(Constraint);
-        const Type *OTy = (Match < CallResultTypes.size())
-          ? CallResultTypes[Match] : 0;
+        // This output might have gotten put in either CallResult or CallArg
+        // depending whether it's a register or not.  Find its type.
+        const Type *OTy = 0;
+        if (Match < OutputLocations.size()) {
+          // Indices here known to be within range.
+          if (OutputLocations[Match].first)
+            OTy = CallResultTypes[OutputLocations[Match].second];
+          else {
+            OTy = CallArgTypes[OutputLocations[Match].second];
+            assert(OTy->isPointerTy() && "Expected pointer type!");
+            OTy = cast<PointerType>(OTy)->getElementType();
+          }
+        }
         if (OTy && OTy != OpTy) {
           if (!(OTy->isIntegerTy() || OTy->isPointerTy()) ||
               !(OpTy->isIntegerTy() || OpTy->isPointerTy())) {





More information about the llvm-branch-commits mailing list