diff options
author | Lang Hames <lhames@gmail.com> | 2012-10-20 22:44:13 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2012-10-20 22:44:13 +0000 |
commit | 64486737d59c835725c61c96511beeff7e31f403 (patch) | |
tree | cf2413a05bc9d7c72a80f3ceb599646bf06eaf00 /utils | |
parent | ccaccfa8bf070b169847109513610cf41abfd1f3 (diff) | |
download | llvm-64486737d59c835725c61c96511beeff7e31f403.tar.gz llvm-64486737d59c835725c61c96511beeff7e31f403.tar.bz2 llvm-64486737d59c835725c61c96511beeff7e31f403.tar.xz |
Allow the commuted form of tied-operand constraints in tablegen ("$dst = $src",
rather than "$src = $dst").
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166382 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/TableGen/CodeGenInstruction.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/utils/TableGen/CodeGenInstruction.cpp b/utils/TableGen/CodeGenInstruction.cpp index 99d2f173a8..fd38672bfc 100644 --- a/utils/TableGen/CodeGenInstruction.cpp +++ b/utils/TableGen/CodeGenInstruction.cpp @@ -233,11 +233,12 @@ static void ParseConstraint(const std::string &CStr, CGIOperandList &Ops) { if (wpos == std::string::npos) throw "Illegal format for tied-to constraint: '" + CStr + "'"; - std::pair<unsigned,unsigned> SrcOp = - Ops.ParseOperandName(Name.substr(wpos), false); - if (SrcOp > DestOp) - throw "Illegal tied-to operand constraint '" + CStr + "'"; - + std::string SrcOpName = Name.substr(wpos); + std::pair<unsigned,unsigned> SrcOp = Ops.ParseOperandName(SrcOpName, false); + if (SrcOp > DestOp) { + std::swap(SrcOp, DestOp); + std::swap(SrcOpName, DestOpName); + } unsigned FlatOpNo = Ops.getFlattenedOperandNumber(SrcOp); |