This is an archive of the discontinued LLVM Phabricator instance.

[TableGen] Allow target specific flags for RegisterClass
ClosedPublic

Authored by cdevadas on Aug 26 2021, 8:15 AM.

Details

Summary

Analogous to the TSFlags for machine instructions, this
patch introduces a variable for target specific flags in
TargetRegisterClass that acts as configurable bitfields
for register classes.

Diff Detail

Event Timeline

cdevadas requested review of this revision.Aug 26 2021, 8:15 AM
cdevadas created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptAug 26 2021, 8:15 AM

Can you provide an example of why this is a useful thing to have?

Can you provide an example of why this is a useful thing to have?

For AMDGPU we have different vector registers (VGPRs and AGPRs). There are multiple register classes for them individually and now a superset that combines both A & V registers (AV_32RegClass, for instance).
Currently, the isVGPR() and isAGPR() helper functions that query a specific register class isn't efficient. They are quite slow.
Having the TSFlags and a single bit for each vector register type will make the query just a quick bitwise operation.

Can you provide an example of why this is a useful thing to have?

For AMDGPU we have different vector registers (VGPRs and AGPRs). There are multiple register classes for them individually and now a superset that combines both A & V registers (AV_32RegClass, for instance).
Currently, the isVGPR() and isAGPR() helper functions that query a specific register class isn't efficient. They are quite slow.
Having the TSFlags and a single bit for each vector register type will make the query just a quick bitwise operation.

That would be a nice speedup. The change looks good at least to me.

Here is a use case for RC TSFlags D108815

This revision is now accepted and ready to land.Aug 31 2021, 9:39 AM
This revision was landed with ongoing or failed builds.Aug 31 2021, 7:40 PM
This revision was automatically updated to reflect the committed changes.