[llvm-commits] [PATCH] TargetRegisterInfo method to get native register indices

Jakob Stoklund Olesen stoklund at 2pi.dk
Mon May 23 21:22:43 PDT 2011


On May 23, 2011, at 9:12 PM, Charles Davis wrote:

> On 5/23/11 9:37 PM, Jakob Stoklund Olesen wrote:
>> 
>> On May 23, 2011, at 7:58 PM, Charles Davis wrote:
>> 
>>> Hi,
>>> 
>>> This patch adds a method to TargetRegisterInfo to get the native
>>> register index corresponding to a LLVM register index. I've implemented
>>> it for x86. Note that it returns 8-15 for r8-r15 (and xmm8-xmm15).
>> 
>>> I need this for my SEH directive-parsing methods, since the Win64 EH
>>> streamer methods expect a native register number.
>> 
>> What is a 'native' register number in a target-independent context? Should this be an X86-specific function only?
> It already is (see getX86RegNum() in lib/Target/X86RegisterInfo.cpp). I
> didn't want to add an x86-specific dependency to COFFAsmParser (which
> implements the SEH directives).
> 
> Come to think of it, maybe some of the SEH directives should be
> x86-specific. They are x86-specific in GAS. It's just that I don't know
> how to parse a directive that is both x86- and COFF-specific.

I don't know either.

If you need to put the function in the generic TargetRegisterInfo, please use a function name that makes it clear that it is for SEH, like TRI->getDwarfRegNum().

Otherwise the patch looks good to me.

/jakob





More information about the llvm-commits mailing list