+ // Remember this constraint.
+ Result.push_back(std::make_pair(ConstraintType, std::string(IdStart, I)));
+
+ // If we reached the end of the ID, we must have the end of the string or a
+ // comma, which we skip now.
+ if (I != E) {
+ if (*I != ',') { Result.clear(); break; }
+ ++I;
+ if (I == E) { Result.clear(); break; } // don't allow "xyz,"
+ }
+ }
+
+ return Result;
+}
+
+
+/// Verify - Verify that the specified constraint string is reasonable for the
+/// specified function type, and otherwise validate the constraint string.
+bool InlineAsm::Verify(const FunctionType *Ty, const std::string &ConstStr) {
+ if (Ty->isVarArg()) return false;
+
+ std::vector<std::pair<ConstraintPrefix, std::string> >
+ Constraints = ParseConstraints(ConstStr);
+
+ // Error parsing constraints.
+ if (Constraints.empty() && !ConstStr.empty()) return false;
+
+ unsigned NumOutputs = 0, NumInputs = 0, NumClobbers = 0;
+
+ for (unsigned i = 0, e = Constraints.size(); i != e; ++i) {
+ switch (Constraints[i].first) {