From 3557a3949448e0c2fbc4acca6789b1e4d82f6879 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Wed, 1 Nov 2006 23:03:11 +0000 Subject: [PATCH] Tied-to constraint must be op_with_larger_idx = op_with_smaller_idx or else throw an exception. llvm-svn: 31361 --- llvm/utils/TableGen/CodeGenTarget.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/llvm/utils/TableGen/CodeGenTarget.cpp b/llvm/utils/TableGen/CodeGenTarget.cpp index 489aba981413..753651d950fd 100644 --- a/llvm/utils/TableGen/CodeGenTarget.cpp +++ b/llvm/utils/TableGen/CodeGenTarget.cpp @@ -280,6 +280,7 @@ static std::pair parseConstraint(const std::string &CStr, assert(pos != std::string::npos && "Unrecognized constraint"); std::string Name = CStr.substr(1, pos); // Skip '$' + // TIED_TO: $src1 = $dst const std::string delims(" \t"); std::string::size_type wpos = Name.find_first_of(delims); if (wpos != std::string::npos) @@ -291,6 +292,8 @@ static std::pair parseConstraint(const std::string &CStr, if (wpos != std::string::npos) Name = Name.substr(wpos+1); unsigned TIdx = I->getOperandNamed(Name); + if (TIdx >= FIdx) + throw "Illegal tied-to operand constraint '" + CStr + "'"; return std::make_pair(FIdx, (TIdx << 16) | 1); }