aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/sh
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2001-06-21 19:37:35 +0000
committerAldy Hernandez <aldyh@gcc.gnu.org>2001-06-21 19:37:35 +0000
commit552ecbd90053e7a1dc005d49d6b6ec472eec9304 (patch)
tree008cdc020db133e80e4f9888a71d25d1b9a8ef12 /gcc/config/sh
parent5005dee96e83706307df9b24086e6ebb01832479 (diff)
downloadgcc-552ecbd90053e7a1dc005d49d6b6ec472eec9304.zip
gcc-552ecbd90053e7a1dc005d49d6b6ec472eec9304.tar.gz
gcc-552ecbd90053e7a1dc005d49d6b6ec472eec9304.tar.bz2
handle interrupt_handler correctly
From-SVN: r43490
Diffstat (limited to 'gcc/config/sh')
-rw-r--r--gcc/config/sh/sh.c8
-rw-r--r--gcc/config/sh/sh.h4
-rw-r--r--gcc/config/sh/sh.md6
3 files changed, 16 insertions, 2 deletions
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 30d890e..103a524 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -43,6 +43,9 @@ int code_for_indirect_jump_scratch = CODE_FOR_indirect_jump_scratch;
#define MSW (TARGET_LITTLE_ENDIAN ? 1 : 0)
#define LSW (TARGET_LITTLE_ENDIAN ? 0 : 1)
+/* Set to 1 by expand_prologue() when the function is an interrupt handler. */
+int current_function_interrupt;
+
/* ??? The pragma interrupt support will not work for SH3. */
/* This is set by #pragma interrupt and #pragma trapa, and causes gcc to
output code for the next function appropriate for an interrupt handler. */
@@ -4009,6 +4012,11 @@ sh_expand_prologue ()
int live_regs_mask2;
int save_flags = target_flags;
+ current_function_interrupt
+ = lookup_attribute ("interrupt_handler",
+ DECL_MACHINE_ATTRIBUTES (current_function_decl))
+ != NULL_TREE;
+
/* We have pretend args if we had an object sent partially in registers
and partially on the stack, e.g. a large structure. */
output_stack_adjust (-current_function_pretend_args_size,
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index 4006427..2e9f76e 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -2299,6 +2299,10 @@ extern enum mdep_reorg_phase_e mdep_reorg_phase;
extern int pragma_interrupt;
+/* Set when processing a function with interrupt attribute. */
+
+extern int current_function_interrupt;
+
/* Set to an RTX containing the address of the stack to switch to
for interrupt functions. */
extern struct rtx_def *sp_switch;
diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
index d1cde71..eb3c88b 100644
--- a/gcc/config/sh/sh.md
+++ b/gcc/config/sh/sh.md
@@ -547,7 +547,7 @@
(const_string "yes")))
(define_attr "interrupt_function" "no,yes"
- (const (symbol_ref "pragma_interrupt")))
+ (const (symbol_ref "current_function_interrupt")))
(define_attr "in_delay_slot" "yes,no"
(cond [(eq_attr "type" "cbranch") (const_string "no")
@@ -577,7 +577,9 @@
(ior (and (eq_attr "interrupt_function" "no")
(eq_attr "type" "!pload,prset"))
(and (eq_attr "interrupt_function" "yes")
- (eq_attr "hit_stack" "no")))) (nil) (nil)])
+ (ior
+ (ne (symbol_ref "TARGET_SH3") (const_int 0))
+ (eq_attr "hit_stack" "no"))))) (nil) (nil)])
;; Since a call implicitly uses the PR register, we can't allow
;; a PR register store in a jsr delay slot.