diff options
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]>; |