summaryrefslogtreecommitdiff
path: root/gcc/config/microblaze/microblaze.c
diff options
context:
space:
mode:
authorAjit Agarwal <ajitkum@xilinx.com>2014-05-17 15:12:38 +0000
committerMichael Eager <eager@gcc.gnu.org>2014-05-17 15:12:38 +0000
commit86498dbaae86f711a98ea020441562de84946879 (patch)
treeb594c0ab7cce86755578cc61bfda61439424797a /gcc/config/microblaze/microblaze.c
parenta0eaa08cebd801a6a1d340dfd71b0183c510f599 (diff)
downloadgcc-86498dbaae86f711a98ea020441562de84946879.tar.gz
ChangeLog:
2014-05-17 Ajit Agarwal <ajitkum@xilinx.com> * config/microblaze/microblaze.c (break_handler): New Declaration. (microblaze_break_function_p,microblaze_is_break_handler) : New functions. (compute_frame_size): use of microblaze_break_function_p. Add the test of break_handler. (microblaze_function_prologue) : Add the test of variable break_handler. Check the fnname by BREAK_HANDLER_NAME. (microblaze_function_epilogue) : Add the test of break_handler. (microblaze_globalize_label) : Add the test of break_handler. Check the name by BREAK_HANDLER_NAME. * config/microblaze/microblaze.h (BREAK_HANDLER_NAME) : New macro * config/microblaze/microblaze.md : (*<optab>,<optab>_internal): Add microblaze_is_break_handler () test. (call_internal1,call_value_intern) : Use of microblaze_break_function_p. Use of SYMBOL_REF_DECL. * config/microblaze/microblaze-protos.h (microblaze_break_function_p,microblaze_is_break_handler) : New Declaration. * testsuite/gcc.target/microblaze/others/break_handler.c : New. * doc/extend.texi( MicroBlaze break_handler Functions): Document new MicroBlaze break_handler functions. From-SVN: r210559
Diffstat (limited to 'gcc/config/microblaze/microblaze.c')
-rw-r--r--gcc/config/microblaze/microblaze.c40
1 files changed, 36 insertions, 4 deletions
diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
index ba8109bc123..b12b7bf047f 100644
--- a/gcc/config/microblaze/microblaze.c
+++ b/gcc/config/microblaze/microblaze.c
@@ -209,6 +209,7 @@ enum reg_class microblaze_regno_to_class[] =
and epilogue and use appropriate interrupt return.
save_volatiles - Similar to interrupt handler, but use normal return. */
int interrupt_handler;
+int break_handler;
int fast_interrupt;
int save_volatiles;
@@ -217,6 +218,8 @@ const struct attribute_spec microblaze_attribute_table[] = {
affects_type_identity */
{"interrupt_handler", 0, 0, true, false, false, NULL,
false },
+ {"break_handler", 0, 0, true, false, false, NULL,
+ false },
{"fast_interrupt", 0, 0, true, false, false, NULL,
false },
{"save_volatiles" , 0, 0, true, false, false, NULL,
@@ -1866,7 +1869,18 @@ microblaze_fast_interrupt_function_p (tree func)
a = lookup_attribute ("fast_interrupt", DECL_ATTRIBUTES (func));
return a != NULL_TREE;
}
+int
+microblaze_break_function_p (tree func)
+{
+ tree a;
+ if (!func)
+ return 0;
+ if (TREE_CODE (func) != FUNCTION_DECL)
+ return 0;
+ a = lookup_attribute ("break_handler", DECL_ATTRIBUTES (func));
+ return a != NULL_TREE;
+}
/* Return true if FUNC is an interrupt function which uses
normal return, indicated by the "save_volatiles" attribute. */
@@ -1891,6 +1905,11 @@ microblaze_is_interrupt_variant (void)
{
return (interrupt_handler || fast_interrupt);
}
+int
+microblaze_is_break_handler (void)
+{
+ return break_handler;
+}
/* Determine of register must be saved/restored in call. */
static int
@@ -1994,9 +2013,14 @@ compute_frame_size (HOST_WIDE_INT size)
interrupt_handler =
microblaze_interrupt_function_p (current_function_decl);
+ break_handler =
+ microblaze_break_function_p (current_function_decl);
+
fast_interrupt =
microblaze_fast_interrupt_function_p (current_function_decl);
save_volatiles = microblaze_save_volatiles (current_function_decl);
+ if (break_handler)
+ interrupt_handler = break_handler;
gp_reg_size = 0;
mask = 0;
@@ -2641,9 +2665,11 @@ microblaze_function_prologue (FILE * file, HOST_WIDE_INT size ATTRIBUTE_UNUSED)
{
fputs ("\t.ent\t", file);
if (interrupt_handler && strcmp (INTERRUPT_HANDLER_NAME, fnname))
- fputs ("_interrupt_handler", file);
+ fputs ("_interrupt_handler", file);
+ else if (break_handler && strcmp (BREAK_HANDLER_NAME, fnname))
+ fputs ("_break_handler", file);
else if (fast_interrupt && strcmp (FAST_INTERRUPT_NAME, fnname))
- fputs ("_fast_interrupt", file);
+ fputs ("_fast_interrupt", file);
else
assemble_name (file, fnname);
fputs ("\n", file);
@@ -2656,7 +2682,8 @@ microblaze_function_prologue (FILE * file, HOST_WIDE_INT size ATTRIBUTE_UNUSED)
if (interrupt_handler && strcmp (INTERRUPT_HANDLER_NAME, fnname))
fputs ("_interrupt_handler:\n", file);
-
+ if (break_handler && strcmp (BREAK_HANDLER_NAME, fnname))
+ fputs ("_break_handler:\n", file);
if (!flag_inhibit_size_directive)
{
/* .frame FRAMEREG, FRAMESIZE, RETREG. */
@@ -2791,6 +2818,7 @@ microblaze_expand_prologue (void)
if (flag_stack_usage_info)
current_function_static_stack_size = fsiz;
+
/* If this function is a varargs function, store any registers that
would normally hold arguments ($5 - $10) on the stack. */
if (((TYPE_ARG_TYPES (fntype) != 0
@@ -2892,8 +2920,10 @@ microblaze_function_epilogue (FILE * file ATTRIBUTE_UNUSED,
if (!flag_inhibit_size_directive)
{
fputs ("\t.end\t", file);
- if (interrupt_handler)
+ if (interrupt_handler && !break_handler)
fputs ("_interrupt_handler", file);
+ else if (break_handler)
+ fputs ("_break_handler", file);
else
assemble_name (file, fnname);
fputs ("\n", file);
@@ -3007,6 +3037,8 @@ microblaze_globalize_label (FILE * stream, const char *name)
{
if (interrupt_handler && strcmp (name, INTERRUPT_HANDLER_NAME))
fputs (INTERRUPT_HANDLER_NAME, stream);
+ else if (break_handler && strcmp (name, BREAK_HANDLER_NAME))
+ fputs (BREAK_HANDLER_NAME, stream);
else if (fast_interrupt && strcmp (name, FAST_INTERRUPT_NAME))
fputs (FAST_INTERRUPT_NAME, stream);
fputs ("\n\t.globl\t", stream);