[PATCH] D14994: Enable MatchRegisterName to match register altnames

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 11 01:34:11 PST 2015


asb added a comment.

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.


http://reviews.llvm.org/D14994





More information about the llvm-commits mailing list