[llvm-commits] [llvm] r166382 - /llvm/trunk/utils/TableGen/CodeGenInstruction.cpp
Lang Hames
lhames at gmail.com
Sat Oct 20 15:44:14 PDT 2012
Author: lhames
Date: Sat Oct 20 17:44:13 2012
New Revision: 166382
URL: http://llvm.org/viewvc/llvm-project?rev=166382&view=rev
Log:
Allow the commuted form of tied-operand constraints in tablegen ("$dst = $src",
rather than "$src = $dst").
Modified:
llvm/trunk/utils/TableGen/CodeGenInstruction.cpp
Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenInstruction.cpp?rev=166382&r1=166381&r2=166382&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenInstruction.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenInstruction.cpp Sat Oct 20 17:44:13 2012
@@ -233,11 +233,12 @@
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);
More information about the llvm-commits
mailing list