[PATCH] D14994: Enable MatchRegisterName to match register altnames

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 11 13:08:43 PST 2015


hfinkel added a comment.

In http://reviews.llvm.org/D14994#308104, @asb wrote:

> In http://reviews.llvm.org/D14994#307568, @hfinkel wrote:
>
> > In PowerPC, we have registers with names like rNN, where NN is some number, but when parsing, we accept %rNN and NN by default, and rNN when targeting Darwin systems. Could this system handle that, or would we need some target-dependence in the selection of which altname indices were available?
>
>
> As is currently implemented, the AltName indices mechanism doesn't provide that flexibility. The existing code in AsmWriterEmitter just assumes that the altname indicated by the first AltNameIndex is preferred, and this patch will match any listed AltNameIndex. Having some flexibility to prefer or match different register names depending on ABI and target platform would be a logical extension, but remains to be implemented.
>
> Off the top of my head, it seems there are two sensible ways of doing this: 1) by allowing a predicate function to be specified that will filter the AltNameIndex list, or 2) just requiring the user to specify a function that returns the AltNameIndex list in the first place, perhaps have this be a field in RegisterClass.


I think that, to be useful across a range of targets, we should really generate values for the AltName indices that can form a bitmask. Then, when printing we pick one (as we do now), and when matching, we can provide a bitmask of accepted AltName classes.


http://reviews.llvm.org/D14994





More information about the llvm-commits mailing list