diff options
author | Bob Wilson <bob.wilson@apple.com> | 2011-01-26 19:44:55 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2011-01-26 19:44:55 +0000 |
commit | a49c7dfb360154070c08b8eb94ad31711d1babae (patch) | |
tree | a6d5a0f9b3ed95e98b7a809d93f766116e3aa51f /utils/TableGen/CodeGenInstruction.h | |
parent | eabde0cf0798e36934ffd03b071f2bd490ac1f11 (diff) | |
download | external_llvm-a49c7dfb360154070c08b8eb94ad31711d1babae.zip external_llvm-a49c7dfb360154070c08b8eb94ad31711d1babae.tar.gz external_llvm-a49c7dfb360154070c08b8eb94ad31711d1babae.tar.bz2 |
Improve the AsmMatcher's ability to handle suboperands.
When an operand class is defined with MIOperandInfo set to a list of
suboperands, the AsmMatcher has so far required that operand to also define
a custom ParserMatchClass, and InstAlias patterns have not been able to
set the individual suboperands separately. This patch removes both of those
restrictions. If a "compound" operand does not override the default
ParserMatchClass, then the AsmMatcher will now parse its suboperands
separately. If an InstAlias operand has the same class as the corresponding
compound operand, then it will be handled as before; but if that check fails,
TableGen will now try to match up a sequence of InstAlias operands with the
corresponding suboperands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124314 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/CodeGenInstruction.h')
-rw-r--r-- | utils/TableGen/CodeGenInstruction.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/utils/TableGen/CodeGenInstruction.h b/utils/TableGen/CodeGenInstruction.h index fb0e50c..58913b9 100644 --- a/utils/TableGen/CodeGenInstruction.h +++ b/utils/TableGen/CodeGenInstruction.h @@ -16,6 +16,7 @@ #include "llvm/CodeGen/ValueTypes.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/SourceMgr.h" #include <string> #include <vector> #include <utility> @@ -297,11 +298,18 @@ namespace llvm { /// ResultOperands - The decoded operands for the result instruction. std::vector<ResultOperand> ResultOperands; - /// ResultInstOperandIndex - For each operand, this vector holds the - /// corresponding index of an operand in the result instruction. - std::vector<unsigned> ResultInstOperandIndex; + /// ResultInstOperandIndex - For each operand, this vector holds a pair of + /// indices to identify the corresponding operand in the result + /// instruction. The first index specifies the operand and the second + /// index specifies the suboperand. If there are no suboperands or if all + /// of them are matched by the operand, the second value should be -1. + std::vector<std::pair<unsigned, int> > ResultInstOperandIndex; CodeGenInstAlias(Record *R, CodeGenTarget &T); + + bool tryAliasOpMatch(DagInit *Result, unsigned AliasOpNo, + Record *InstOpRec, bool hasSubOps, SMLoc Loc, + CodeGenTarget &T, ResultOperand &ResOp); }; } |