[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] code selection: ijmp and icall
From: |
Joerg Wunsch |
Subject: |
Re: [avr-gcc-list] code selection: ijmp and icall |
Date: |
Tue, 2 Dec 2008 20:19:48 +0100 (MET) |
Markus Oertel <address@hidden> wrote:
> So my question is: does the compiler create jumptargets for IJMP and
> ICALL that are not labeled.
A simple test (large case statement with many labels) compiles
into something like this:
..global foo
.type foo, @function
foo:
/* prologue: frame size=0 */
/* prologue end (size=0) */
mov r31,r25
mov r30,r24
cpi r24,255
cpc r25,__zero_reg__
breq .+4
brlo .+2
rjmp .L2
subi r30,lo8(-(gs(.L259)))
sbci r31,hi8(-(gs(.L259)))
ijmp
.data
.section .progmem.gcc_sw_table, "ax", @progbits
.p2align 1
..L259:
.data
.section .progmem.gcc_sw_table, "ax", @progbits
.p2align 1
rjmp .L3
rjmp .L4
rjmp .L5
rjmp .L6
rjmp .L7
rjmp .L8
rjmp .L9
rjmp .L10
rjmp .L11
....
.text
..L3:
ldi r24,lo8(1024)
ldi r25,hi8(1024)
ret
..L4:
ldi r24,lo8(1023)
ldi r25,hi8(1023)
ret
..L5:
ldi r24,lo8(1022)
ldi r25,hi8(1022)
ret
..L6:
ldi r24,lo8(1021)
ldi r25,hi8(1021)
ret
..L7:
ldi r24,lo8(1020)
ldi r25,hi8(1020)
ret
....
But of course, as Eric wrote, if you want to be really sure, you'd
have to lookup all instances of "ijmp" in the AVR-specific part of the
GCC source code, and see whether all of them are used that way.
--
cheers, J"org .-.-. --... ...-- -.. . DL8DTL
http://www.sax.de/~joerg/ NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)