From 67aff164c039765e3ec19e5a31659250c8427dfb Mon Sep 17 00:00:00 2001 From: John Thompson Date: Tue, 21 Sep 2010 22:04:54 +0000 Subject: [PATCH] Fixed pr20314-2.c failure, added E, F, p constraint letters. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114490 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/TargetLowering.cpp | 23 +++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 7fff8ada8c1..af48739c17a 100644 --- a/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -2496,7 +2496,10 @@ TargetLowering::getConstraintType(const std::string &Constraint) const { 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 @@ TargetLowering::getConstraintType(const std::string &Constraint) const { case 'N': case 'O': case 'P': + case '<': + case '>': return C_Other; } } @@ -2664,6 +2669,7 @@ std::vector TargetLowering::ParseConstraints( /// ConstraintOperands - Information about all of the constraints. std::vector ConstraintOperands; const InlineAsm *IA = cast(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 @@ std::vector TargetLowering::ParseConstraints( 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 @@ std::vector TargetLowering::ParseConstraints( // 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 @@ std::vector TargetLowering::ParseConstraints( 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 @@ static unsigned getConstraintGenerality(TargetLowering::ConstraintType CT) { /// and the current alternative constraint selected. int TargetLowering::getMultipleConstraintMatchWeight( AsmOperandInfo &info, int maIndex) const { - std::vector &rCodes = info.multipleAlternatives[maIndex].Codes; + std::vector *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; }