This is an archive of the discontinued LLVM Phabricator instance.

[M68k] Convert register Aliases to AltNames
ClosedPublic

Authored by ricky26 on Mar 12 2021, 10:49 AM.

Details

Summary

This makes it simpler to determine when two registers are actually the same vs aliasing.

The only real caveat is that there is no longer any record of which 'logical' register it is.
(i.e. parsing assembly and then printing it can result in the register name changing.)

Diff Detail

Event Timeline

ricky26 created this revision.Mar 12 2021, 10:49 AM
ricky26 edited the summary of this revision. (Show Details)Mar 12 2021, 12:26 PM
ricky26 edited the summary of this revision. (Show Details)
ricky26 published this revision for review.Mar 12 2021, 12:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 12 2021, 12:29 PM
myhsu added a comment.Mar 15 2021, 3:32 PM

Are you trying to distinguish the sub-register use cases from alternative naming (e.g. a5 & bp)?

myhsu added inline comments.Mar 15 2021, 3:35 PM
llvm/lib/Target/M68k/M68kRegisterInfo.td
18–19

the second template argument for Register can be used to assign AltNames

Are you trying to distinguish the sub-register use cases from alternative naming (e.g. a5 & bp)?

Kind of. I was running into a number of cases where I had to handle A7/SP separately (for example). I was worried this was eventually going to lead to significant code duplication and/or errors. AltNames seemed to make the most sense. SP/etc are really only used to make assembly more readable. (For that reason, I actually made SP the default rendering of A7.)

ricky26 updated this revision to Diff 331096.Mar 16 2021, 1:33 PM

Use Register second parameter instead of an extra 'let'

Are you trying to distinguish the sub-register use cases from alternative naming (e.g. a5 & bp)?

Kind of. I was running into a number of cases where I had to handle A7/SP separately (for example). I was worried this was eventually going to lead to significant code duplication and/or errors. AltNames seemed to make the most sense. SP/etc are really only used to make assembly more readable. (For that reason, I actually made SP the default rendering of A7.)

That make sense. I only have few syntax comments inlined below.

llvm/lib/Target/M68k/M68kRegisterInfo.td
95

Is there any reason to expand these registers rather than using the original syntax (i.e. using sequence)?

127

ditto the same question above

ricky26 updated this revision to Diff 331371.Mar 17 2021, 2:11 PM

Change explicit register lists back into sequences where possible.

ricky26 marked 2 inline comments as done.Mar 17 2021, 2:13 PM

Yep, converted those back into sequences. Thanks.

myhsu accepted this revision.Mar 18 2021, 8:59 PM

LGTM

This revision is now accepted and ready to land.Mar 18 2021, 8:59 PM
This revision was landed with ongoing or failed builds.Mar 19 2021, 4:45 AM
This revision was automatically updated to reflect the committed changes.