[llvm-commits] [llvm] r114490 - /llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp

John Thompson John.Thompson.JTSoftware at gmail.com
Tue Sep 21 15:04:54 PDT 2010


Author: jtsoftware
Date: Tue Sep 21 17:04:54 2010
New Revision: 114490

URL: http://llvm.org/viewvc/llvm-project?rev=114490&view=rev
Log:
Fixed pr20314-2.c failure, added E, F, p constraint letters.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=114490&r1=114489&r2=114490&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Tue Sep 21 17:04:54 2010
@@ -2496,7 +2496,10 @@
       return C_Memory;
     case 'i':    // Simple Integer or Relocatable Constant
     case 'n':    // Simple Integer
+    case 'E':    // Floating Point Constant
+    case 'F':    // Floating Point Constant
     case 's':    // Relocatable Constant
+    case 'p':    // Address.
     case 'X':    // Allow ANY value.
     case 'I':    // Target registers.
     case 'J':
@@ -2506,6 +2509,8 @@
     case 'N':
     case 'O':
     case 'P':
+    case '<':
+    case '>':
       return C_Other;
     }
   }
@@ -2664,6 +2669,7 @@
   /// ConstraintOperands - Information about all of the constraints.
   std::vector<AsmOperandInfo> ConstraintOperands;
   const InlineAsm *IA = cast<InlineAsm>(CS.getCalledValue());
+  unsigned maCount = 0; // Largest number of multiple alternative constraints.
 
   // Do a prepass over the constraints, canonicalizing them, and building up the
   // ConstraintOperands list.
@@ -2677,6 +2683,10 @@
     ConstraintOperands.push_back(AsmOperandInfo(ConstraintInfos[i]));
     AsmOperandInfo &OpInfo = ConstraintOperands.back();
 
+    // Update multiple alternative constraint count.
+    if (OpInfo.multipleAlternatives.size() > maCount)
+      maCount = OpInfo.multipleAlternatives.size();
+
     EVT OpVT = MVT::Other;
 
     // Compute the value type for each operand.
@@ -2711,7 +2721,6 @@
 
   // If we have multiple alternative constraints, select the best alternative.
   if (ConstraintInfos.size()) {
-    unsigned maCount = ConstraintInfos[0].multipleAlternatives.size();
     if (maCount) {
       unsigned bestMAIndex = 0;
       int bestWeight = -1;
@@ -2727,8 +2736,6 @@
           AsmOperandInfo& OpInfo = ConstraintOperands[cIndex];
           if (OpInfo.Type == InlineAsm::isClobber)
             continue;
-          assert((OpInfo.multipleAlternatives.size() == maCount)
-            && "Constraint has inconsistent multiple alternative count.");
 
           // If this is an output operand with a matching input operand, look up the
           // matching input. If their types mismatch, e.g. one is an integer, the
@@ -2827,12 +2834,16 @@
 /// and the current alternative constraint selected.
 int TargetLowering::getMultipleConstraintMatchWeight(
     AsmOperandInfo &info, int maIndex) const {
-  std::vector<std::string> &rCodes = info.multipleAlternatives[maIndex].Codes;
+  std::vector<std::string> *rCodes;
+  if (maIndex >= (int)info.multipleAlternatives.size())
+    rCodes = &info.Codes;
+  else
+    rCodes = &info.multipleAlternatives[maIndex].Codes;
   int BestWeight = -1;
 
   // Loop over the options, keeping track of the most general one.
-  for (unsigned i = 0, e = rCodes.size(); i != e; ++i) {
-    int weight = getSingleConstraintMatchWeight(info, rCodes[i].c_str());
+  for (unsigned i = 0, e = rCodes->size(); i != e; ++i) {
+    int weight = getSingleConstraintMatchWeight(info, (*rCodes)[i].c_str());
     if (weight > BestWeight)
       BestWeight = weight;
   }





More information about the llvm-commits mailing list