From 126b11c6921e3e0b8eb29b60e5bf5b4dd83797d4 Mon Sep 17 00:00:00 2001 From: Chung-Ju Wu Date: Wed, 3 Sep 2014 08:50:14 +0000 Subject: [PATCH] [NDS32] Add a function to indentify if FUNC is an interrupt service routine. * config/nds32/nds32-isr.c (nds32_isr_function_p): Define new function to check if FUNC is an interrupt service routine. * config/nds32/nds32-protos.h (nds32_isr_function_p): Declaration. From-SVN: r214855 --- gcc/ChangeLog | 6 ++++++ gcc/config/nds32/nds32-isr.c | 24 ++++++++++++++++++++++++ gcc/config/nds32/nds32-protos.h | 1 + 3 files changed, 31 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f9c795dbdc2..aa65d6a890a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2014-09-03 Chung-Ju Wu + * config/nds32/nds32-isr.c (nds32_isr_function_p): Define new function + to check if FUNC is an interrupt service routine. + * config/nds32/nds32-protos.h (nds32_isr_function_p): Declaration. + +2014-09-03 Chung-Ju Wu + * config/nds32/nds32.h (machine_function): Add some fields for variadic arguments implementation. diff --git a/gcc/config/nds32/nds32-isr.c b/gcc/config/nds32/nds32-isr.c index ef0187c39cf..bb8fcdd7561 100644 --- a/gcc/config/nds32/nds32-isr.c +++ b/gcc/config/nds32/nds32-isr.c @@ -574,4 +574,28 @@ nds32_asm_file_end_for_isr (void) } } +/* Return true if FUNC is a isr function. */ +bool +nds32_isr_function_p (tree func) +{ + tree t_intr; + tree t_excp; + tree t_reset; + + tree attrs; + + if (TREE_CODE (func) != FUNCTION_DECL) + abort (); + + attrs = DECL_ATTRIBUTES (func); + + t_intr = lookup_attribute ("interrupt", attrs); + t_excp = lookup_attribute ("exception", attrs); + t_reset = lookup_attribute ("reset", attrs); + + return ((t_intr != NULL_TREE) + || (t_excp != NULL_TREE) + || (t_reset != NULL_TREE)); +} + /* ------------------------------------------------------------------------ */ diff --git a/gcc/config/nds32/nds32-protos.h b/gcc/config/nds32/nds32-protos.h index e2810163ec9..e57674a8311 100644 --- a/gcc/config/nds32/nds32-protos.h +++ b/gcc/config/nds32/nds32-protos.h @@ -136,6 +136,7 @@ extern void nds32_check_isr_attrs_conflict (tree, tree); extern void nds32_construct_isr_vectors_information (tree, const char *); extern void nds32_asm_file_start_for_isr (void); extern void nds32_asm_file_end_for_isr (void); +extern bool nds32_isr_function_p (tree); /* Auxiliary functions for cost calculation. */ -- 2.11.4.GIT