This is an archive of the discontinued LLVM Phabricator instance.

[PatternMatch] Use generic One,Two,ThreeOps_match classes (NFC).
ClosedPublic

Authored by fhahn on Aug 21 2018, 9:37 AM.

Details

Summary

Currently we have a few duplicated matcher classes, which all do pretty
much the same thing. This patch introduces generic
One,Tow,ThreeOps_match classes which take the opcode the match as
template argument.

Diff Detail

Repository
rL LLVM

Event Timeline

fhahn created this revision.Aug 21 2018, 9:37 AM
lebedev.ri added inline comments.
include/llvm/IR/PatternMatch.h
997 ↗(On Diff #161743)

Comment needs updating.

1012 ↗(On Diff #161743)

Comment needs updating.

1031 ↗(On Diff #161743)

Here and elsewhere in this patch: so do arrays start from 0 or 1?

fhahn updated this revision to Diff 162836.Aug 28 2018, 5:32 AM

Fix comments, change Op1,2,3 to Op0,1,2

fhahn marked an inline comment as done.Aug 28 2018, 5:33 AM

Thanks for having a look @lebedev.ri. I somehow missed your comments until now :/

include/llvm/IR/PatternMatch.h
1031 ↗(On Diff #161743)

Personally I think it is more natural to refer to them as Op1,2,3 instead of Op0,1,2, but given that we have T0,1,2 using Op0,1,2 seems less confusing overall.

SjoerdMeijer accepted this revision.Sep 12 2018, 5:11 AM

Looks like a reasonable clean up to me.

This revision is now accepted and ready to land.Sep 12 2018, 5:11 AM
fhahn added a comment.Sep 12 2018, 5:59 AM

Thanks Sjoerd!

This revision was automatically updated to reflect the committed changes.