This is an archive of the discontinued LLVM Phabricator instance.

[TableGen] Add 'register alternative name matching' support
ClosedPublic

Authored by dylanmckay on Jan 19 2016, 3:28 AM.

Details

Summary

This adds a new attribute which targets can set in TableGen which causes a function to be generated which matches register alternative names. This is very similar to ShouldEmitMatchRegisterName, except it works on alt names.

This patch is currently used by the out of tree part of the AVR backend. It reduces code duplication greatly, and has the effect that you do not need to hardcode altname to register mappings in C++.

It will not work on targets which have registers which share the same aliases.

Diff Detail

Event Timeline

dylanmckay updated this revision to Diff 45241.Jan 19 2016, 3:28 AM
dylanmckay retitled this revision from to [TableGen] Add 'register alternative name matching' support.
dylanmckay updated this object.
dylanmckay added reviewers: stoklund, arsenm, dsanders.
dylanmckay added a subscriber: llvm-commits.

Once this is merged, I will be able to merge the AVR register description which will use it.

hfinkel accepted this revision.Feb 2 2016, 10:03 PM
hfinkel added a reviewer: hfinkel.
hfinkel added a subscriber: hfinkel.

Minor formatting issues, otherwise LGTM.

utils/TableGen/AsmMatcherEmitter.cpp
2239

Insert white space after for.

2243

Insert white space after if

2790

Remove {}.

This revision is now accepted and ready to land.Feb 2 2016, 10:03 PM
dylanmckay updated this revision to Diff 46752.Feb 3 2016, 12:13 AM
dylanmckay marked 3 inline comments as done.
dylanmckay edited edge metadata.

Fix @hfinkel's code review points

dylanmckay closed this revision.Feb 3 2016, 12:24 AM