// Initialize
Type = isInput;
isEarlyClobber = false;
- hasMatchingInput = false;
+ MatchingInput = -1;
isCommutative = false;
isIndirect = false;
Type != isInput)
return true; // Invalid constraint number.
+ // If Operand N already has a matching input, reject this. An output
+ // can't be constrained to the same value as multiple inputs.
+ if (ConstraintsSoFar[N].hasMatchingInput())
+ return true;
+
// Note that operand #n has a matching input.
- ConstraintsSoFar[N].hasMatchingInput = true;
+ ConstraintsSoFar[N].MatchingInput = ConstraintsSoFar.size();
} else {
// Single letter constraint.
Codes.push_back(std::string(I, I+1));
if (Constraints.empty() && !ConstStr.empty()) return false;
unsigned NumOutputs = 0, NumInputs = 0, NumClobbers = 0;
+ unsigned NumIndirect = 0;
for (unsigned i = 0, e = Constraints.size(); i != e; ++i) {
switch (Constraints[i].Type) {
case InlineAsm::isOutput:
+ if ((NumInputs-NumIndirect) != 0 || NumClobbers != 0)
+ return false; // outputs before inputs and clobbers.
if (!Constraints[i].isIndirect) {
- if (NumInputs || NumClobbers) return false; // outputs come first.
++NumOutputs;
break;
}
+ ++NumIndirect;
// FALLTHROUGH for Indirect Outputs.
case InlineAsm::isInput:
if (NumClobbers) return false; // inputs before clobbers.