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 | cdd40bdc051a7b22d42d1b38091a643502756ce7 (patch) | |
tree | d01d013ce0501fe4e62454123757505eff2b787f /llvm/utils/TableGen/CodeGenInstruction.cpp | |
parent | 60c9dae2bfc8f02635b8449c15ec20c9e371f3c7 (diff) | |
download | bcm5719-llvm-cdd40bdc051a7b22d42d1b38091a643502756ce7.tar.gz bcm5719-llvm-cdd40bdc051a7b22d42d1b38091a643502756ce7.zip |
Allow the commuted form of tied-operand constraints in tablegen ("$dst = $src",
rather than "$src = $dst").
llvm-svn: 166382
Diffstat (limited to 'llvm/utils/TableGen/CodeGenInstruction.cpp')
-rw-r--r-- | llvm/utils/TableGen/CodeGenInstruction.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/utils/TableGen/CodeGenInstruction.cpp b/llvm/utils/TableGen/CodeGenInstruction.cpp index 99d2f173a87..fd38672bfcf 100644 --- a/llvm/utils/TableGen/CodeGenInstruction.cpp +++ b/llvm/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); |