diff options
author | Tim Northover <tnorthover@apple.com> | 2014-05-20 11:52:46 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2014-05-20 11:52:46 +0000 |
commit | c807a17a9b9250196f16e6a9ce843a8b0f09b9ff (patch) | |
tree | e615e6dc18d4876c7322acdeec39749a025b3628 /llvm/utils/TableGen/CodeGenDAGPatterns.h | |
parent | 069e5f485818eb127ae1944b6759b29dbce3437a (diff) | |
download | llvm-c807a17a9b9250196f16e6a9ce843a8b0f09b9ff.zip llvm-c807a17a9b9250196f16e6a9ce843a8b0f09b9ff.tar.gz llvm-c807a17a9b9250196f16e6a9ce843a8b0f09b9ff.tar.bz2 |
TableGen: permit non-leaf ComplexPattern uses
This allows the results of a ComplexPattern check to be distributed to separate
named Operands, instead of the current system where all results must apply (and
match perfectly) with a single Operand.
For example, if "some_addrmode" is a ComplexPattern producing two results, you
can write:
def : Pat<(load (some_addrmode GPR64:$base, imm:$offset)),
(INST GPR64:$base, imm:$offset)>;
This should allow neater instruction definitions in TableGen that don't put all
possible aspects of addressing into a single operand, but are still usable with
relatively simple C++ CodeGen idioms.
llvm-svn: 209206
Diffstat (limited to 'llvm/utils/TableGen/CodeGenDAGPatterns.h')
-rw-r--r-- | llvm/utils/TableGen/CodeGenDAGPatterns.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.h b/llvm/utils/TableGen/CodeGenDAGPatterns.h index 59b3dbe..fb30cdd 100644 --- a/llvm/utils/TableGen/CodeGenDAGPatterns.h +++ b/llvm/utils/TableGen/CodeGenDAGPatterns.h @@ -409,6 +409,12 @@ public: const ComplexPattern * getComplexPatternInfo(const CodeGenDAGPatterns &CGP) const; + /// Returns the number of MachineInstr operands that would be produced by this + /// node if it mapped directly to an output Instruction's + /// operand. ComplexPattern specifies this explicitly; MIOperandInfo gives it + /// for Operands; otherwise 1. + unsigned getNumMIResults(const CodeGenDAGPatterns &CGP) const; + /// NodeHasProperty - Return true if this node has the specified property. bool NodeHasProperty(SDNP Property, const CodeGenDAGPatterns &CGP) const; @@ -527,6 +533,13 @@ class TreePattern { /// hasError - True if the currently processed nodes have unresolvable types /// or other non-fatal errors bool HasError; + + /// It's important that the usage of operands in ComplexPatterns is + /// consistent: each named operand can be defined by at most one + /// ComplexPattern. This records the ComplexPattern instance and the operand + /// number for each operand encountered in a ComplexPattern to aid in that + /// check. + StringMap<std::pair<Record *, unsigned>> ComplexPatternOperands; public: /// TreePattern constructor - Parse the specified DagInits into the |