diff options
author | Chris Lattner <sabre@nondot.org> | 2011-04-18 06:22:33 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-04-18 06:22:33 +0000 |
commit | 07add49a4ba2b296ad1da2aa0eeb51e0edbd7ec4 (patch) | |
tree | d28eafd23be9484fdcdc3f9ed0f7fbffdb1b6880 /llvm/utils/TableGen/CodeGenDAGPatterns.h | |
parent | 353fda159dca7a8d3d93546dadec862af8d7167f (diff) | |
download | llvm-07add49a4ba2b296ad1da2aa0eeb51e0edbd7ec4.zip llvm-07add49a4ba2b296ad1da2aa0eeb51e0edbd7ec4.tar.gz llvm-07add49a4ba2b296ad1da2aa0eeb51e0edbd7ec4.tar.bz2 |
Implement major new fastisel functionality: the matcher can now handle immediates with
value constraints on them (when defined as ImmLeaf's). This is particularly important
for X86-64, where almost all reg/imm instructions take a i64immSExt32 immediate operand,
which has a value constraint. Before this patch we ended up iseling the examples into
such amazing code as:
movabsq $7, %rax
imulq %rax, %rdi
movq %rdi, %rax
ret
now we produce:
imulq $7, %rdi, %rax
ret
This dramatically shrinks the generated code at -O0 on x86-64.
llvm-svn: 129691
Diffstat (limited to 'llvm/utils/TableGen/CodeGenDAGPatterns.h')
-rw-r--r-- | llvm/utils/TableGen/CodeGenDAGPatterns.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.h b/llvm/utils/TableGen/CodeGenDAGPatterns.h index b113a59..e4e8574 100644 --- a/llvm/utils/TableGen/CodeGenDAGPatterns.h +++ b/llvm/utils/TableGen/CodeGenDAGPatterns.h @@ -257,6 +257,17 @@ public: /// isAlwaysTrue - Return true if this is a noop predicate. bool isAlwaysTrue() const; + bool isImmediatePattern() const { return !getImmCode().empty(); } + + /// getImmediatePredicateCode - Return the code that evaluates this pattern if + /// this is an immediate predicate. It is an error to call this on a + /// non-immediate pattern. + std::string getImmediatePredicateCode() const { + std::string Result = getImmCode(); + assert(!Result.empty() && "Isn't an immediate pattern!"); + return Result; + } + bool operator==(const TreePredicateFn &RHS) const { return PatFragRec == RHS.PatFragRec; |