H8/300 strange #pragma interrupt behaviour
Jussi Ylänen
jethro@assari.cc.tut.fi
Fri Apr 23 09:34:00 GMT 1999
With egcs-2.91.66 19990314 (egcs-1.1.2 release) on a linux box, the #pragma
interrupt causes the function entry / exit stuff to be misplaced. For example
the code (compiled with "h8300-hms-gcc -Wall -mh -O3 -fomit-frame-pointer -S
test2.c") has the pushs and pops around function f1(), instead of around i1()
and i2():
volatile int n;
void f1(void) {n=0;}
void f2(void) {n=1;}
#pragma interrupt
void i1(void) {n++;}
#pragma interrupt
void i2(void) {n--;}
The following code is generated:
; GCC For the Hitachi H8/300
; By Hitachi America Ltd and Cygnus Support
; release F-1
; -O3
.h8300h
.file "test2.c"
.comm _n,2
.section .text
.align 1
.global _f1
_f1:
push.l er0
push.l er1
push.l er2
push.l er3
push.l er4
push.l er5
push.l er6
sub.w r2,r2
mov.w r2,@_n
pop.l er6
pop.l er5
pop.l er4
pop.l er3
pop.l er2
pop.l er1
pop.l er0
rte
.align 1
.global _f2
_f2:
mov.w #1,r2
mov.w r2,@_n
rts
.align 1
.global _i1
_i1:
mov.w @_n,r2
adds #1,er2
mov.w r2,@_n
rts
.align 1
.global _i2
_i2:
mov.w @_n,r2
subs #1,er2
mov.w r2,@_n
rts
.end
Also, there seems to be no mention of the #pragma interrupt in the egcs info
files. Is it supported anymore? For embedded environments this pragma is
really useful.
--
Jussi Ylänen (jethro@iki.fi)
More information about the Gcc-bugs
mailing list