diff options
author | Daniel Sanders <daniel_l_sanders@apple.com> | 2020-01-07 10:27:53 -0800 |
---|---|---|
committer | Daniel Sanders <daniel_l_sanders@apple.com> | 2020-01-07 11:12:53 -0800 |
commit | 1d94fb211187519d0e9287db3b93928f9f7676c4 (patch) | |
tree | 1a6780097d592afccf27f3354a7a7e9e3af9529b /llvm/include | |
parent | 75eacbf1a9fbc29432a6e0c5627e6c8e95683956 (diff) | |
download | bcm5719-llvm-1d94fb211187519d0e9287db3b93928f9f7676c4.tar.gz bcm5719-llvm-1d94fb211187519d0e9287db3b93928f9f7676c4.zip |
[gicombiner] Add GIMatchTree and use it for the code generation
Summary:
GIMatchTree's job is to build a decision tree by zipping all the
GIMatchDag's together.
Each DAG is added to the tree builder as a leaf and partitioners are used
to subdivide each node until there are no more partitioners to apply. At
this point, the code generator is responsible for testing any untested
predicates and following any unvisited traversals (there shouldn't be any
of the latter as the getVRegDef partitioner handles them all).
Note that the leaves don't always fit into partitions cleanly and the
partitions may overlap as a result. This is resolved by cloning the leaf
into every partition it belongs to. One example of this is a rule that can
match one of N opcodes. The leaf for this rule would end up in N partitions
when processed by the opcode partitioner. A similar example is the
getVRegDef partitioner where having rules (add $a, $b), and (add ($a, $b), $c)
will result in the former being in the partition for successfully
following the vreg-def and failing to do so as it doesn't care which
happens.
Depends on D69151
Fixed the issues with the windows bots which were caused by stdout/stderr
interleaving.
Reviewers: bogner, volkan
Reviewed By: volkan
Subscribers: lkail, mgorny, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69152
Diffstat (limited to 'llvm/include')
-rw-r--r-- | llvm/include/llvm/Target/GlobalISel/Combine.td | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/llvm/include/llvm/Target/GlobalISel/Combine.td b/llvm/include/llvm/Target/GlobalISel/Combine.td index 51d8c603fb1..cb0e682c067 100644 --- a/llvm/include/llvm/Target/GlobalISel/Combine.td +++ b/llvm/include/llvm/Target/GlobalISel/Combine.td @@ -89,6 +89,10 @@ def match; class GIMatchKind; class GIMatchKindWithArgs; +/// In lieu of having proper macro support. Trivial one-off opcode checks can be +/// performed with this. +def wip_match_opcode : GIMatchKindWithArgs; + /// The operator at the root of a GICombineRule.Apply dag. def apply; /// All arguments of the apply operator must be subclasses of GIApplyKind, or @@ -99,26 +103,30 @@ class GIApplyKindWithArgs; def copy_prop : GICombineRule< (defs root:$d), - (match [{ return Helper.matchCombineCopy(${d}); }]), - (apply [{ Helper.applyCombineCopy(${d}); }])>; + (match (COPY $d, $s):$mi, + [{ return Helper.matchCombineCopy(*${mi}); }]), + (apply [{ Helper.applyCombineCopy(*${mi}); }])>; def trivial_combines : GICombineGroup<[copy_prop]>; def extending_loads : GICombineRule< (defs root:$root, extending_load_matchdata:$matchinfo), - (match [{ return Helper.matchCombineExtendingLoads(${root}, ${matchinfo}); }]), - (apply [{ Helper.applyCombineExtendingLoads(${root}, ${matchinfo}); }])>; + (match (wip_match_opcode G_LOAD, G_SEXTLOAD, G_ZEXTLOAD):$root, + [{ return Helper.matchCombineExtendingLoads(*${root}, ${matchinfo}); }]), + (apply [{ Helper.applyCombineExtendingLoads(*${root}, ${matchinfo}); }])>; def combines_for_extload: GICombineGroup<[extending_loads]>; def combine_indexed_load_store : GICombineRule< (defs root:$root, indexed_load_store_matchdata:$matchinfo), - (match [{ return Helper.matchCombineIndexedLoadStore(${root}, ${matchinfo}); }]), - (apply [{ Helper.applyCombineIndexedLoadStore(${root}, ${matchinfo}); }])>; + (match (wip_match_opcode G_LOAD, G_SEXTLOAD, G_ZEXTLOAD, G_STORE):$root, + [{ return Helper.matchCombineIndexedLoadStore(*${root}, ${matchinfo}); }]), + (apply [{ Helper.applyCombineIndexedLoadStore(*${root}, ${matchinfo}); }])>; // FIXME: Is there a reason this wasn't in tryCombine? I've left it out of // all_combines because it wasn't there. def elide_br_by_inverting_cond : GICombineRule< - (defs root:$d), - (match [{ return Helper.matchElideBrByInvertingCond(${d}); }]), - (apply [{ Helper.applyElideBrByInvertingCond(${d}); }])>; + (defs root:$root), + (match (wip_match_opcode G_BR):$root, + [{ return Helper.matchElideBrByInvertingCond(*${root}); }]), + (apply [{ Helper.applyElideBrByInvertingCond(*${root}); }])>; def all_combines : GICombineGroup<[trivial_combines, combines_for_extload, combine_indexed_load_store]>; |