diff options
author | John Thompson <John.Thompson.JTSoftware@gmail.com> | 2010-09-21 22:04:54 +0000 |
---|---|---|
committer | John Thompson <John.Thompson.JTSoftware@gmail.com> | 2010-09-21 22:04:54 +0000 |
commit | 67aff164c039765e3ec19e5a31659250c8427dfb (patch) | |
tree | b2bffc76ddc6afdad27371a9ada2c574c863fc29 /lib/CodeGen/SelectionDAG/TargetLowering.cpp | |
parent | d847bc20b89679279e75412ddc51dc1d299da942 (diff) |
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
Diffstat (limited to 'lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/TargetLowering.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 7fff8ada8c..af48739c17 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::AsmOperandInfo> TargetLowering::ParseConstraints( /// 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 @@ std::vector<TargetLowering::AsmOperandInfo> 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::AsmOperandInfo> 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::AsmOperandInfo> 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<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; } |