This is an archive of the discontinued LLVM Phabricator instance.

[M68k] Introduce DReg bead
ClosedPublic

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

Details

Summary

This is required in order to determine during disassembly whether a
Reg bead without associated DA bead is referring to a data register.

Diff Detail

Event Timeline

ricky26 created this revision.Mar 12 2021, 10:46 AM
ricky26 published this revision for review.Mar 12 2021, 12:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 12 2021, 12:32 PM
myhsu added a comment.EditedMar 15 2021, 3:08 PM

Does the remaining Reg (Beads) always mean address register? If that's the case, can we just rename it into AReg? Also, is it possible to just get rid of the DA Beads since we have separate DReg and AReg?

It acts like a default when decoding (in one of the later patches). The DA bead is still needed since it's used for instructions where it can be either an address or data register.

As it stands, I could rename it but it might be a bit misleading. (Existing cases which don't need a specific register kind would all use AReg.)

Alternatively, perhaps I could add AReg and enforce that DReg/AReg cannot be combined with DA and keep Reg separate, solely for use with DA. I didn't think of that at the time.

It acts like a default when decoding (in one of the later patches). The DA bead is still needed since it's used for instructions where it can be either an address or data register.

As it stands, I could rename it but it might be a bit misleading. (Existing cases which don't need a specific register kind would all use AReg.)

Ahh I see

Alternatively, perhaps I could add AReg and enforce that DReg/AReg cannot be combined with DA and keep Reg separate, solely for use with DA. I didn't think of that at the time.

Let's keep your current plan (i.e. only add DReg) for now. Since if Reg and DA are really needed I don't see a good reason to add another AReg if that doesn't really make implementing MCCodeEmitter or AsmParser easier.

myhsu added inline comments.Mar 17 2021, 2:18 PM
llvm/lib/Target/M68k/M68kInstrArithmetic.td
548

Can you move this and related changes to a separate patch? This seems irrelevant to the topic

ricky26 updated this revision to Diff 331378.Mar 17 2021, 2:36 PM

Remove operand type changes. (These will appear in another differential shortly.)

ricky26 updated this revision to Diff 331380.Mar 17 2021, 2:50 PM

Fix one superfluous DReg: the rr arithmetic includes the DA bit for the operand already.

ricky26 marked an inline comment as done.Mar 17 2021, 2:50 PM
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.