[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] compiler improvments
From: |
HutchinsonAndy |
Subject: |
Re: [avr-gcc-list] compiler improvments |
Date: |
Mon, 19 Jan 2004 10:43:17 -0500 |
One big improvement in the handling of structures is to tell gcc how to move DI
operands. ie movdi in avr.md file
Then the "silly example" ends up as something more palatable.
I have rewitten the various move routines to handle all modes but its a bit
involved to post here.
.file "foo.c"
.arch avr2
__SREG__ = 0x3f
__SP_H__ = 0x3e
__SP_L__ = 0x3d
__tmp_reg__ = 0
__zero_reg__ = 1
.global __do_copy_data
.global __do_clear_bss
.text
.global foo
.type foo, @function
foo:
/* prologue: frame size=6 */
push r28
push r29
in r28,__SP_L__
in r29,__SP_H__
sbiw r28,6
in __tmp_reg__,__SREG__
cli
out __SP_H__,r29
out __SREG__,__tmp_reg__
out __SP_L__,r28
/* prologue end (size=10) */
ldi r18,lo8(0)
ldi r19,hi8(0)
ldi r20,hlo8(0)
ldi r21,hhi8(0)
ldi r19,lo8(1) ;AWHr_mr
std Y+1,r19 ;AWHs
std Y+2,__zero_reg__ ;AWHs
std Y+3,__zero_reg__ ;AWHs
std Y+4,__zero_reg__ ;AWHs
ldi r18,lo8(2) ;AWHr_mr
std Y+5,r18 ;AWHs
std Y+6,__zero_reg__ ;AWHs
ldd r18,Y+1
ldd r19,Y+2
ldd r20,Y+3
ldd r21,Y+4
ldd r22,Y+5
ldd r23,Y+6
/* epilogue: frame size=6 */
adiw r28,6
in __tmp_reg__,__SREG__
cli
out __SP_H__,r29
out __SREG__,__tmp_reg__
out __SP_L__,r28
pop r29
pop r28
ret
/* epilogue end (size=9) */
/* function foo size 37 (18) */
.size foo, .-foo
/* File "foo.c": code 37 = 0x0025 ( 18), prologues 10, epilogues 9 */
This involves expanding the existing move
HutchinsonAndy wrote:
>I am looking at the structure problems. Seems there are several issues.
>
>The compiler is trying to use a DI sized variable to hold structure - 8 bytes.
>I am not sure why but perhaps it attempst to hold all structures in registers
>and it has not been told that a DI register is not a good idea.
>
>Size DI moves are not defined for avr target, it is using QI moves (bytes
>moves) - which is reasonable
>
>I beleive it wants to use a temporary DI register in order to return the value
>in the right registers. This may be because of the overlap.
>
>The extra stack variable is simple padding out 6 bytes of structure to 8.
>Compiler did not spot that subregister was unused.
>
>The unwanted push/pop occurs somewhere in reload. R8 get assigned by global
>register allocation. However, it is latter replaced by R13 (on my build). The
>GCC part that marks the register as "live" does not get updated. Hence the
>problem.
>I am trying to find out what part of code does this.
>
>I am glad to see bug report is in on this one!
>
>I may well be able to do something about the other problems. It would seem
>that curing the "DI" allocation and movement will cause all the other issues
>to go away.
>
>
>
>
>
>
>__________________________________________________________________
>New! Unlimited Netscape Internet Service.
>Only $9.95 a month -- Sign up today at http://isp.netscape.com/register
>Act now to get a personalized email address!
>
>Netscape. Just the Net You Need.
>
__________________________________________________________________
New! Unlimited Netscape Internet Service.
Only $9.95 a month -- Sign up today at http://isp.netscape.com/register
Act now to get a personalized email address!
Netscape. Just the Net You Need.
- Re: [avr-gcc-list] compiler improvments, (continued)
- Re: [avr-gcc-list] compiler improvments, Neil Johnson, 2004/01/04
- Re: [avr-gcc-list] compiler improvments, Dmitry K., 2004/01/05
- RE: [avr-gcc-list] compiler improvments, Asko Kauppi, 2004/01/05
- Re: [avr-gcc-list] compiler improvments, HutchinsonAndy, 2004/01/09
- Re: [avr-gcc-list] compiler improvments, HutchinsonAndy, 2004/01/10
- Re: [avr-gcc-list] compiler improvments, Martin Thomas, 2004/01/12
- Re: [avr-gcc-list] compiler improvments,
HutchinsonAndy <=