[prev in list] [next in list] [prev in thread] [next in thread]
List: pcc-list
Subject: Re: Problem with liveliness of hard registers
From: Anders Magnusson <ragge () ludd ! ltu ! se>
Date: 2007-11-12 11:04:49
Message-ID: 47383351.2020502 () ludd ! ltu ! se
[Download RAW message or body]
Hi,
Gregory McGarry wrote:
> Revision 1.160 of pcc/mip/regs.c didn't exhibit this problem. 1.161
> does.
>
> Here's what I noticed on powerpc for the following program:
>
> In main(), the call to val1() correctly handles the return values in
> R3:R4. While for the call to val2(), the compiler thinks the return
> values are R5:R6.
>
> Is the problem that registers R3 and R4 are used as function arguments
> to val2() and also used as outputs of val2()? [Actually, I just added
> an extra argument to val2() and the compiler thought the outputs were
> in R7:R8, so I think this a valid conclusion.] Is the liveliness
> analysis getting confused that the registers changed inside val2()?
>
> I'll look more closely at the changes in 1.161.
What's causing the problem here is that rmove() isn't implemented. The
compiler moves
R3:R4 to R5:R6 by calling rmove after the call. (there is a liveness
problem also but
the compiler fixes that :-)
Also note that the concatenated registers do not need PERMREG/TEMPREG
attributes
set, the attributes are already set on the individual regs and we do not
need to save
the registers more than once, eh? :-)
-- Ragge
>
> long long
> val1()
> {
> return (0x1234567890abcdefLL);
> }
>
> long long
> val2(long long v)
> {
> return (v-1);
> }
>
> void
> main()
> {
> printf("this: %llx\n", val1());
> printf("this: %llx\n", val2(0x1234567890abcdefLL));
> }
>
>
>
>
> bl _val1 ; call (no args, result in r3:r4) to
> scon/sname (_val1)
> - [ return values in r3:r4]
> mr r5,r4 ; assign r3:r4 to r4:r5
> mr r4,r3
> lis r3,ha16(L20)
> addi r3,r3,lo16(L20)
> bl _printf ; call (args, no result) to scon/sname (_printf)
> - [ printf(R3,R4,R5) ]
>
> lis r4,ha16(-1867788817)
> addi r4,r4,lo16(-1867788817)
> lis r3,ha16(305419896)
> addi r3,r3,lo16(305419896)
> bl _val2 ; call (args, result in r3:r4) to scon/sname
> (_val2)
> - [ return values in r3:r4]
> stw r6,56(r1) ; store 64-bit value
> stw r5,60(r1)
> - [ what??? ]
> lwz r5,56(r1) ; assign llong to reg
> lwz r4,60(r1)
> lis r3,ha16(L20)
> addi r3,r3,lo16(L20)
> bl _printf ; call (args, no result) to scon/sname (_printf)
> - [ printf(R3,R4,R5) ]
>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic