[LLVMdev] Eliminating General Purpose Register
David Greene
dag at cray.com
Tue Dec 22 14:11:39 PST 2009
On Tuesday 22 December 2009 15:47, Juan Carlos Martinez Santos wrote:
> Hello,
>
> Sound odd, but how I can reduce the amount of GPR available. Is there a
> place (file) where I let know the compiler how many register it can use?
>
> I have planned to used some registers for special purpose, so I want to
> estimate the cost before to do it. In my project, I cannot add register to
> the current architecture (I will imply redesign my core - x86based).
X86RegisterInfo.td "allocation_order_[begin/end]" is probably what you
want. There is a pair of these APIs for every register class.
There may be various special cases scattered throughout the backend
that may have to be modified but changing these functions should get
the vast majority of them. Just change them so they do not include the
registers you want to reserve.
You may need to restructure some of the underlying register lists
to put your reserved registers at the end. A more general alternative
is to put something like a boost::filter_iterator on top of the iterator
returned by allocation_order_[begin/end] and have it filter out the reserved
registers. I don't know how standard-compliant the register iterators are,
however. They may some work in that department to operate with
boost::filter_iterator.
-Dave
More information about the llvm-dev
mailing list