|
From: Florian K. <br...@ac...> - 2013-02-01 20:27:00
|
On 01/31/2013 11:50 AM, Florian Krohm wrote:
>
> Hmm, maybe we should bite the bullet and make HReg a struct after all.
> Let me see how generated code looks like....
>
I looked at two implementation choices:
1) make HReg a proper struct
typedef struct {
UInt regno : 24;
HRegClass class : 4;
Bool virtual : 1;
} HReg;
2) Wrap the current register encoding into a struct:
typedef struct {
UInt reg;
} HReg;
For both choices a function sameHReg will have to be introduced to
compare two HRegs for equality. In the case of a proper struct (#1
above) that function will do this:
return toBool(r1.regno == r2.regno && r1.class == r2.class &&
r1.virtual == r2.virtual)
That generates:
movl %esi, %edx
xorl %eax, %eax
xorl %edi, %edx
andl $16777215, %edx
jne .L2
xorq %rsi, %rdi
testl $520093696, %edi
sete %al
.L2:
rep
ret
as opposed to
cmpl %edi, %esi
sete %al
ret
for #2 where we simply return toBool(r1.reg == r2.reg)
Because comparison gets used a lot in the register allocator I chose #2.
Patch attached and regtested on x86-x64, s390, and ppc with no new
regressions.
Florian
|