[llvm-commits] [dragonegg] r126569 - /dragonegg/trunk/llvm-convert.cpp

Duncan Sands baldrick at free.fr
Sun Feb 27 05:24:02 PST 2011


Author: baldrick
Date: Sun Feb 27 07:24:02 2011
New Revision: 126569

URL: http://llvm.org/viewvc/llvm-project?rev=126569&view=rev
Log:
Calculate the CallArgTypes vector from the call operands, eliminating the
possibility of forgetting to update it.

Modified:
    dragonegg/trunk/llvm-convert.cpp

Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=126569&r1=126568&r2=126569&view=diff
==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Sun Feb 27 07:24:02 2011
@@ -6863,7 +6863,6 @@
   bool HasSideEffects = gimple_asm_volatile_p(stmt) || (NumOutputs == 0);
 
   std::vector<Value*> CallOps;
-  std::vector<const Type*> CallArgTypes;
 
   // CallResultTypes - The inline asm call may return one or more results.  The
   // types of the results are recorded here along with a flag indicating whether
@@ -6957,8 +6956,7 @@
       ConstraintStr += ",=*";
       ConstraintStr += SimplifiedConstraint;
       CallOps.push_back(Dest.Ptr);
-      CallArgTypes.push_back(Dest.Ptr->getType());
-      OutputLocations.push_back(std::make_pair(false, CallArgTypes.size()-1));
+      OutputLocations.push_back(std::make_pair(false, CallOps.size()-1));
     }
   }
 
@@ -7041,7 +7039,7 @@
           if (OutputLocations[Match].first)
             OTy = CallResultTypes[OutputIndex].first;
           else {
-            OTy = CallArgTypes[OutputIndex];
+            OTy = CallOps[OutputIndex]->getType();
             assert(OTy->isPointerTy() && "Expected pointer type!");
             OTy = cast<PointerType>(OTy)->getElementType();
           }
@@ -7098,14 +7096,12 @@
       }
 
       CallOps.push_back(Op);
-      CallArgTypes.push_back(Op->getType());
     } else {                          // Memory operand.
       mark_addressable(TREE_VALUE(Input));
       isIndirect = true;
       LValue Src = EmitLV(Val);
       assert(!Src.isBitfield() && "Cannot read from a bitfield!");
       CallOps.push_back(Src.Ptr);
-      CallArgTypes.push_back(Src.Ptr->getType());
     }
 
     ConstraintStr += ',';
@@ -7209,6 +7205,12 @@
     break;
   }
 
+  // Compute the types of the arguments to the asm call.
+  std::vector<const Type*> CallArgTypes(CallOps.size());
+  for (unsigned i = 0, e = CallOps.size(); i != e; ++i)
+    CallArgTypes[i] = CallOps[i]->getType();
+
+  // Get the type of the called asm "function".
   const FunctionType *FTy =
     FunctionType::get(CallResultType, CallArgTypes, false);
 





More information about the llvm-commits mailing list