From 258619bb2d420f54a510569cee8e642835f86023 Mon Sep 17 00:00:00 2001 From: Christian Bruel Date: Mon, 11 May 2015 10:23:53 +0200 Subject: [PATCH] arm-protos.h (arm_declare_function_name): Declare. 2015-05-11 Christian Bruel * config/arm/arm-protos.h (arm_declare_function_name): Declare. (is_called_in_ARM_mode): Remove. * config/arm/arm.c (is_called_in_ARM_mode): Declare static bool. (arm_declare_function_name): Moved from from ARM_DECLARE_FUNCTION_NAME. * config/arm/arm.h (ARM_DECLARE_FUNCTION_NAME): Call arm_declare_function_name. From-SVN: r222997 --- gcc/ChangeLog | 9 +++++++++ gcc/config/arm/arm-protos.h | 4 +--- gcc/config/arm/arm.c | 26 +++++++++++++++++++++++--- gcc/config/arm/arm.h | 18 +----------------- 4 files changed, 34 insertions(+), 23 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 27270d29b26..88d8934bc11 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2015-05-11 Christian Bruel + + * config/arm/arm-protos.h (arm_declare_function_name): Declare. + (is_called_in_ARM_mode): Remove. + * config/arm/arm.c (is_called_in_ARM_mode): Declare static bool. + (arm_declare_function_name): Moved from from ARM_DECLARE_FUNCTION_NAME. + * config/arm/arm.h (ARM_DECLARE_FUNCTION_NAME): Call + arm_declare_function_name. + 2015-05-11 Christian Bruel * config/arm/arm.c (arm_option_override): Reoganized and split into : diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index ecca944a2bd..bda20ca07ce 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -30,6 +30,7 @@ extern void arm_load_pic_register (unsigned long); extern int arm_volatile_func (void); extern void arm_expand_prologue (void); extern void arm_expand_epilogue (bool); +extern void arm_declare_function_name (FILE *, const char *, tree); extern void thumb2_expand_return (bool); extern const char *arm_strip_name_encoding (const char *); extern void arm_asm_output_labelref (FILE *, const char *); @@ -181,9 +182,6 @@ extern const char *thumb1_unexpanded_epilogue (void); extern void thumb1_expand_prologue (void); extern void thumb1_expand_epilogue (void); extern const char *thumb1_output_interwork (void); -#ifdef TREE_CODE -extern int is_called_in_ARM_mode (tree); -#endif extern int thumb_shiftable_const (unsigned HOST_WIDE_INT); #ifdef RTX_CODE extern enum arm_cond_code maybe_get_arm_condition_code (rtx); diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 57f91c51490..cf4f2485095 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -121,6 +121,7 @@ static int arm_gen_constant (enum rtx_code, machine_mode, rtx, static unsigned bit_count (unsigned long); static int arm_address_register_rtx_p (rtx, int); static int arm_legitimate_index_p (machine_mode, rtx, RTX_CODE, int); +static bool is_called_in_ARM_mode (tree); static int thumb2_legitimate_index_p (machine_mode, rtx, int); static int thumb1_base_register_rtx_p (rtx, machine_mode, int); static rtx arm_legitimize_address (rtx, rtx, machine_mode); @@ -23851,19 +23852,19 @@ thumb_far_jump_used_p (void) } /* Return nonzero if FUNC must be entered in ARM mode. */ -int +static bool is_called_in_ARM_mode (tree func) { gcc_assert (TREE_CODE (func) == FUNCTION_DECL); /* Ignore the problem about functions whose address is taken. */ if (TARGET_CALLEE_INTERWORKING && TREE_PUBLIC (func)) - return TRUE; + return true; #ifdef ARM_PE return lookup_attribute ("interfacearm", DECL_ATTRIBUTES (func)) != NULL_TREE; #else - return FALSE; + return false; #endif } @@ -29233,6 +29234,25 @@ arm_is_constant_pool_ref (rtx x) && CONSTANT_POOL_ADDRESS_P (XEXP (x, 0))); } +void +arm_declare_function_name (FILE *stream, const char *name, tree decl) +{ + if (TARGET_THUMB) + { + if (is_called_in_ARM_mode (decl) + || (TARGET_THUMB1 && !TARGET_THUMB1_ONLY + && cfun->is_thunk)) + fprintf (stream, "\t.code 32\n"); + else if (TARGET_THUMB1) + fprintf (stream, "\t.code\t16\n\t.thumb_func\n"); + else + fprintf (stream, "\t.thumb\n\t.thumb_func\n"); + } + + if (TARGET_POKE_FUNCTION_NAME) + arm_poke_function_name (stream, (const char *) name); +} + /* If MEM is in the form of [base+offset], extract the two parts of address and set to BASE and OFFSET, otherwise return false after clearing BASE and OFFSET. */ diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index aec5fb8e19a..ba37c42296d 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -2183,23 +2183,7 @@ extern int making_const_table; ? 1 : 0) #define ARM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \ - do \ - { \ - if (TARGET_THUMB) \ - { \ - if (is_called_in_ARM_mode (DECL) \ - || (TARGET_THUMB1 && !TARGET_THUMB1_ONLY \ - && cfun->is_thunk)) \ - fprintf (STREAM, "\t.code 32\n") ; \ - else if (TARGET_THUMB1) \ - fprintf (STREAM, "\t.code\t16\n\t.thumb_func\n") ; \ - else \ - fprintf (STREAM, "\t.thumb\n\t.thumb_func\n") ; \ - } \ - if (TARGET_POKE_FUNCTION_NAME) \ - arm_poke_function_name (STREAM, (const char *) NAME); \ - } \ - while (0) + arm_declare_function_name ((STREAM), (NAME), (DECL)); /* For aliases of functions we use .thumb_set instead. */ #define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL1, DECL2) \ -- 2.30.2