This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add subclasses of Sched to simplify code
ClosedPublic

Authored by wangpc on Jul 21 2023, 2:51 AM.

Details

Summary

We add some subclasses of Sched to reduce code which cast string
to SchedWrite/SchedRead.

Besides, we add ReadVMask iff pseudo is masked. And this is the
reason why this patch isn't a NFC since we add it for all pseudos
before.

ReadMergeOp will be added in D155654.

Diff Detail

Event Timeline

wangpc created this revision.Jul 21 2023, 2:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2023, 2:51 AM
wangpc requested review of this revision.Jul 21 2023, 2:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2023, 2:51 AM
wangpc updated this revision to Diff 542839.Jul 21 2023, 2:54 AM

Remove defvars.

I'm a fan of this change! I support updating the rest of the Scheds like this.

wangpc retitled this revision from [WIP][RISCV] Add subclasses of Sched to simplify code to [RISCV] Add subclasses of Sched to simplify code.Jul 23 2023, 11:59 PM
wangpc edited the summary of this revision. (Show Details)
wangpc updated this revision to Diff 543395.Jul 23 2023, 11:59 PM
wangpc retitled this revision from [RISCV] Add subclasses of Sched to simplify code to [WIP][RISCV] Add subclasses of Sched to simplify code.
wangpc edited the summary of this revision. (Show Details)
  • Rebase.
  • Rewrite all.
wangpc edited the summary of this revision. (Show Details)Jul 24 2023, 1:32 AM
wangpc retitled this revision from [WIP][RISCV] Add subclasses of Sched to simplify code to [RISCV] Add subclasses of Sched to simplify code.
wangpc updated this revision to Diff 543483.Jul 24 2023, 5:22 AM
  • Move subclasses of Sched to RISCVInstrInfoV.td.
  • Double check.

Thanks for these changes, they clean up this file a bunch!

llvm/lib/Target/RISCV/RISCVInstrInfoV.td
101

Can we add docstrings for these functions since they will be used by many different classes?

101

These classes are only used in RISCVInstrVPseudos.td. Do they belong in that file?

111

I don't know the case convention for TableGen, but it looks like we're mixing camel and pascal case here (and we also use underscores in other places too). Is there a reason for mixing case conventions here?

wangpc updated this revision to Diff 543907.Jul 25 2023, 3:03 AM
  • Add doc.
  • Rewrite MC Scheds.
wangpc marked 3 inline comments as done.Jul 25 2023, 3:04 AM
wangpc added inline comments.Jul 25 2023, 3:59 AM
llvm/lib/Target/RISCV/RISCVInstrInfoV.td
101

Now they are used. :-)

111

Fixed.
Just my convention:

  • pascal case for classes, multiclasses, fields.
  • camel case for iterators, arguments, defvars, subroutines, the return value of subroutines.

Usually, I don't use underscores or mix the cases. But sometimes I will in order to match existed code (some of them are inherited from target independent TableGen infrastructures).
We can do some cleanups in the future to keep the style consistent once we reach an agreement.

wangpc updated this revision to Diff 543939.Jul 25 2023, 5:44 AM

Add MC Sched classed for load/store.

This revision is now accepted and ready to land.Jul 25 2023, 6:31 AM
wangpc updated this revision to Diff 544238.Jul 26 2023, 12:36 AM

Fix copy/paste error.

wangpc updated this revision to Diff 544239.Jul 26 2023, 12:41 AM

Fix copy/paste error.

This revision was landed with ongoing or failed builds.Jul 26 2023, 1:13 AM
This revision was automatically updated to reflect the committed changes.