[llvm-commits] [patch] Refactor getCalleeSavedRegClasses and getCalleeSavedRegs

Rafael Espindola espindola at google.com
Tue Jun 1 13:34:49 PDT 2010


Currently every target needs to implement both
getCalleeSavedRegClasses and getCalleeSavedRegs. They must both return
an array with corresponding elements. This is fairly brittle. The
attached patch simplifies things by replacing getCalleeSavedRegClasses
with a getCalleeSavedRegClass that returns the class for a single
register.

The patch already simplifies the code a bit. If we drop the new extra
asserts, it will simplify a lot more. The only case where there is no
trivial mapping from register to register class is R4 to R7 in thumb1
mode.

This patch does introduce more virtual function calls. Is there any
particular benchmark you would like me to try it in? Some
alternatives:

*) Implement getCalleeSavedRegClasses by returning a array that is
computed at runtime using getCalleeSavedRegClass. This would be
computed only once.
*) Merge both functions and have the merged function return an array
of  pairs (Reg, RegClass).
*) Produce both in tablegen. Not sure how to represent the special
case in thumb1.

Any preferences?

Cheers,
-- 
Rafael Ávila de Espíndola
-------------- next part --------------
A non-text attachment was scrubbed...
Name: regclass.patch
Type: text/x-diff
Size: 46858 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100601/0b4ed88b/attachment.patch>


More information about the llvm-commits mailing list