Re: [PATCH, ARM] attribute target (thumb,arm) [1/6] respin (4th)
On Mon, May 11, 2015 at 10:13 AM, Christian Bruel christian.br...@st.com wrote: OK with those changes. Ramana thanks, done following up the thumb_code cleanup, here is a missing chunk for the vxworks config. arm-vxworks build checked. ok for trunk ? thanks, Christian OK thanks - please post the version of p1 that you committed for archival purposes. Ramana
Re: [PATCH, ARM] attribute target (thumb,arm) [1/6] respin (4th)
OK with those changes. Ramana thanks, done following up the thumb_code cleanup, here is a missing chunk for the vxworks config. arm-vxworks build checked. ok for trunk ? thanks, Christian 2015-05-11 Christian Bruel christian.br...@st.com * config/arm/arm-protos.h (thumb_code, thumb1_code): Remove. * config/arm/vxworks.h (thumb_code): Replace with TARGET_THUMB. Index: gcc/config/arm/arm-protos.h === --- gcc/config/arm/arm-protos.h (revision 222997) +++ gcc/config/arm/arm-protos.h (working copy) @@ -462,12 +462,6 @@ /* Nonzero if tuning for Cortex-A9. */ extern int arm_tune_cortex_a9; -/* Nonzero if generating Thumb instructions. */ -extern int thumb_code; - -/* Nonzero if generating Thumb-1 instructions. */ -extern int thumb1_code; - /* Nonzero if we should define __THUMB_INTERWORK__ in the preprocessor. XXX This is a bit of a hack, it's intended to help work around Index: gcc/config/arm/vxworks.h === --- gcc/config/arm/vxworks.h (revision 222997) +++ gcc/config/arm/vxworks.h (working copy) @@ -40,7 +40,7 @@ builtin_define (CPU=ARMARCH5); \ else if (arm_arch4)\ { \ - if (thumb_code)\ + if (TARGET_THUMB) \ builtin_define (CPU=ARMARCH4_T); \ else \ builtin_define (CPU=ARMARCH4); \
Re: [PATCH, ARM] attribute target (thumb,arm) [1/6] respin (4th)
2014-09-23 Christian Bruel christian.br...@st.com * config/arm/arm.h (arm_option_override): Reoganized and split. Reorganized and split into (arm_option_params_internal); New function. s/;/: New function. (arm_option_check_internal): New function. (arm_option_override_internal): New function. (restrict_default): New boolean. Non existent ? (thumb_code, thumb1_code): Remove. * config/arm/arm.h (TREE_TARGET_THUMB, TREE_TARGET_THUMB1): New macros. (TREE_TARGET_THUM2, TREE_TARGET_ARM): Likewise. (thumb_code, thumb1_code): Remove. * config/arm/arm.md (is_thumb, is_thumb1): Check TARGET flag. diff '--exclude=.svn' -ruN gnu_trunk.ref/gcc/gcc/config/arm/arm.c gnu_trunk.p1/gcc/gcc/config/arm/arm.c --- gnu_trunk.ref/gcc/gcc/config/arm/arm.c 2015-05-05 14:35:30.214153999 +0200 +++ gnu_trunk.p1/gcc/gcc/config/arm/arm.c 2015-05-06 14:24:41.125994898 +0200 @@ -846,12 +846,6 @@ /* Nonzero if tuning for Cortex-A9. */ int arm_tune_cortex_a9 = 0; -/* Nonzero if generating Thumb instructions. */ -int thumb_code = 0; - -/* Nonzero if generating Thumb-1 instructions. */ -int thumb1_code = 0; - /* Nonzero if we should define __THUMB_INTERWORK__ in the preprocessor. XXX This is a bit of a hack, it's intended to help work around @@ -2669,6 +2663,148 @@ return std_gimplify_va_arg_expr (valist, type, pre_p, post_p); } +/* Check any incompatible options that the user has specified. */ +static void +arm_option_check_internal (struct gcc_options *opts) +{ + /* Make sure that the processor choice does not conflict with any of the + other command line choices. */ + if (TREE_TARGET_ARM (opts) !(insn_flags FL_NOTM)) +error (target CPU does not support ARM mode); + + /* TARGET_BACKTRACE calls leaf_function_p, which causes a crash if done + from here where no function is being compiled currently. */ + if ((TARGET_TPCS_FRAME || TARGET_TPCS_LEAF_FRAME) TREE_TARGET_ARM (opts)) +warning (0, enabling backtrace support is only meaningful when compiling for the Thumb); + + if (TREE_TARGET_ARM (opts) TARGET_CALLEE_INTERWORKING) +warning (0, enabling callee interworking support is only meaningful when compiling for the Thumb); + + /* If this target is normally configured to use APCS frames, warn if they + are turned off and debugging is turned on. */ + if (TREE_TARGET_ARM (opts) + write_symbols != NO_DEBUG + !TARGET_APCS_FRAME + (TARGET_DEFAULT MASK_APCS_FRAME)) +warning (0, -g with -mno-apcs-frame may not give sensible debugging); + + /* iWMMXt unsupported under Thumb mode. */ + if (TREE_TARGET_THUMB (opts) TARGET_IWMMXT) +error (iWMMXt unsupported under Thumb mode); + + if (TARGET_HARD_TP TREE_TARGET_THUMB1 (opts)) +error (can not use -mtp=cp15 with 16-bit Thumb); + + if (TREE_TARGET_THUMB (opts) TARGET_VXWORKS_RTP flag_pic) +{ + error (RTP PIC is incompatible with Thumb); + flag_pic = 0; +} + + /* We only support -mslow-flash-data on armv7-m targets. */ + if (target_slow_flash_data + ((!(arm_arch7 !arm_arch_notm) !arm_arch7em) + || (TREE_TARGET_THUMB1 (opts) || flag_pic || TARGET_NEON))) +error (-mslow-flash-data only supports non-pic code on armv7-m targets); +} + +/* Check any params depending on attributes that the user has specified. */ Set params depending on target and optimization options. +static void +arm_option_params_internal (struct gcc_options *opts) +{ + /* If we are not using the default (ARM mode) section anchor offset + ranges, then set the correct ranges now. */ + if (TREE_TARGET_THUMB1 (opts)) +{ + /* Thumb-1 LDR instructions cannot have negative offsets. + Permissible positive offset ranges are 5-bit (for byte loads), + 6-bit (for halfword loads), or 7-bit (for word loads). + Empirical results suggest a 7-bit anchor range gives the best + overall code size. */ + targetm.min_anchor_offset = 0; + targetm.max_anchor_offset = 127; +} + else if (TREE_TARGET_THUMB2 (opts)) +{ + /* The minimum is set such that the total size of the block + for a particular anchor is 248 + 1 + 4095 bytes, which is + divisible by eight, ensuring natural spacing of anchors. */ + targetm.min_anchor_offset = -248; + targetm.max_anchor_offset = 4095; +} + else +{ + targetm.min_anchor_offset = TARGET_MIN_ANCHOR_OFFSET; + targetm.max_anchor_offset = TARGET_MAX_ANCHOR_OFFSET; +} + + if (optimize_size) +{ + /* If optimizing for size, bump the number of instructions that we + are prepared to conditionally execute (even on a StrongARM). */ + max_insns_skipped = 6; + + /* For THUMB2, we limit the conditional sequence to one IT block. */ + if (TREE_TARGET_THUMB2 (opts)) + max_insns_skipped = opts-x_arm_restrict_it ? 1 : 4; Not sure about
[PATCH, ARM] attribute target (thumb,arm) [1/6] respin (4th)
In preparation of the target attribute, reorganize Âarm_option_override into 3 entities: arm_option_override_internal_p arm_option_check_internal arm_option_param_internal Also define and use TREE_TARGET macros instead of file-scope variables in the machine description. Thanks, Christian 2014-09-23 Christian Bruel christian.br...@st.com * config/arm/arm.h (arm_option_override): Reoganized and split. (arm_option_params_internal); New function. (arm_option_check_internal): New function. (arm_option_override_internal): New function. (restrict_default): New boolean. (thumb_code, thumb1_code): Remove. * config/arm/arm.h (TREE_TARGET_THUMB, TREE_TARGET_THUMB1): New macros. (TREE_TARGET_THUM2, TREE_TARGET_ARM): Likewise. (thumb_code, thumb1_code): Remove. * config/arm/arm.md (is_thumb, is_thumb1): Check TARGET flag. diff '--exclude=.svn' -ruN gnu_trunk.ref/gcc/gcc/config/arm/arm.c gnu_trunk.p1/gcc/gcc/config/arm/arm.c --- gnu_trunk.ref/gcc/gcc/config/arm/arm.c 2015-05-05 14:35:30.214153999 +0200 +++ gnu_trunk.p1/gcc/gcc/config/arm/arm.c 2015-05-06 14:24:41.125994898 +0200 @@ -846,12 +846,6 @@ /* Nonzero if tuning for Cortex-A9. */ int arm_tune_cortex_a9 = 0; -/* Nonzero if generating Thumb instructions. */ -int thumb_code = 0; - -/* Nonzero if generating Thumb-1 instructions. */ -int thumb1_code = 0; - /* Nonzero if we should define __THUMB_INTERWORK__ in the preprocessor. XXX This is a bit of a hack, it's intended to help work around @@ -2669,6 +2663,148 @@ return std_gimplify_va_arg_expr (valist, type, pre_p, post_p); } +/* Check any incompatible options that the user has specified. */ +static void +arm_option_check_internal (struct gcc_options *opts) +{ + /* Make sure that the processor choice does not conflict with any of the + other command line choices. */ + if (TREE_TARGET_ARM (opts) !(insn_flags FL_NOTM)) +error (target CPU does not support ARM mode); + + /* TARGET_BACKTRACE calls leaf_function_p, which causes a crash if done + from here where no function is being compiled currently. */ + if ((TARGET_TPCS_FRAME || TARGET_TPCS_LEAF_FRAME) TREE_TARGET_ARM (opts)) +warning (0, enabling backtrace support is only meaningful when compiling for the Thumb); + + if (TREE_TARGET_ARM (opts) TARGET_CALLEE_INTERWORKING) +warning (0, enabling callee interworking support is only meaningful when compiling for the Thumb); + + /* If this target is normally configured to use APCS frames, warn if they + are turned off and debugging is turned on. */ + if (TREE_TARGET_ARM (opts) + write_symbols != NO_DEBUG + !TARGET_APCS_FRAME + (TARGET_DEFAULT MASK_APCS_FRAME)) +warning (0, -g with -mno-apcs-frame may not give sensible debugging); + + /* iWMMXt unsupported under Thumb mode. */ + if (TREE_TARGET_THUMB (opts) TARGET_IWMMXT) +error (iWMMXt unsupported under Thumb mode); + + if (TARGET_HARD_TP TREE_TARGET_THUMB1 (opts)) +error (can not use -mtp=cp15 with 16-bit Thumb); + + if (TREE_TARGET_THUMB (opts) TARGET_VXWORKS_RTP flag_pic) +{ + error (RTP PIC is incompatible with Thumb); + flag_pic = 0; +} + + /* We only support -mslow-flash-data on armv7-m targets. */ + if (target_slow_flash_data + ((!(arm_arch7 !arm_arch_notm) !arm_arch7em) + || (TREE_TARGET_THUMB1 (opts) || flag_pic || TARGET_NEON))) +error (-mslow-flash-data only supports non-pic code on armv7-m targets); +} + +/* Check any params depending on attributes that the user has specified. */ +static void +arm_option_params_internal (struct gcc_options *opts) +{ + /* If we are not using the default (ARM mode) section anchor offset + ranges, then set the correct ranges now. */ + if (TREE_TARGET_THUMB1 (opts)) +{ + /* Thumb-1 LDR instructions cannot have negative offsets. + Permissible positive offset ranges are 5-bit (for byte loads), + 6-bit (for halfword loads), or 7-bit (for word loads). + Empirical results suggest a 7-bit anchor range gives the best + overall code size. */ + targetm.min_anchor_offset = 0; + targetm.max_anchor_offset = 127; +} + else if (TREE_TARGET_THUMB2 (opts)) +{ + /* The minimum is set such that the total size of the block + for a particular anchor is 248 + 1 + 4095 bytes, which is + divisible by eight, ensuring natural spacing of anchors. */ + targetm.min_anchor_offset = -248; + targetm.max_anchor_offset = 4095; +} + else +{ + targetm.min_anchor_offset = TARGET_MIN_ANCHOR_OFFSET; + targetm.max_anchor_offset = TARGET_MAX_ANCHOR_OFFSET; +} + + if (optimize_size) +{ + /* If optimizing for size, bump the number of instructions that we + are prepared to conditionally execute (even on a StrongARM). */ + max_insns_skipped = 6; + + /* For THUMB2, we limit the conditional sequence to one IT block. */ + if (TREE_TARGET_THUMB2 (opts)) + max_insns_skipped
[PATCH, ARM] attribute target (thumb,arm) [1/6]
In preparation of the target attribute, reorganize ´arm_option_override´ into 3 entities: arm_option_override_internal_p arm_option_check_internal arm_option_param_internal Also define and use TREE_TARGET macros instead of file-scope variables in the machine description. Thanks, Christian 2014-09-23 Christian Bruel christian.br...@st.com * config/arm/arm.h (arm_option_override): Reoganized and split. (arm_option_params_internal); New function. (arm_option_check_internal): New function. (arm_option_override_internal): New function. (restrict_default): New boolean. (thumb_code, thumb1_code): Remove. * config/arm/arm.h (TREE_TARGET_THUMB, TREE_TARGET_THUMB1): New macros. (TREE_TARGET_THUM2, TREE_TARGET_ARM): Likewise. (thumb_code, thumb1_code): Remove. * config/arm/arm.md (is_thumb, is_thumb1): Check TARGET flag. diff '--exclude=ChangeLog*' '--exclude=.svn' '--exclude=*~' '--exclude=#*#' -rupN a/gcc/gcc/config/arm/arm.c b/gcc/gcc/config/arm/arm.c --- a/gcc/gcc/config/arm/arm.c 2014-11-18 08:35:38.0 +0100 +++ b/gcc/gcc/config/arm/arm.c 2014-11-18 09:11:19.0 +0100 @@ -744,6 +744,9 @@ const struct arm_fpu_desc *arm_fpu_desc; rtx thumb_call_via_label[14]; static int thumb_call_reg_needed; +/* Remember default option is used. */ +static bool restrict_default; + /* Bit values used to identify processor capabilities. */ #define FL_CO_PROC(1 0)/* Has external co-processor bus */ #define FL_ARCH3M (1 1)/* Extended multiply */ @@ -886,12 +889,6 @@ int arm_tune_wbuf = 0; /* Nonzero if tuning for Cortex-A9. */ int arm_tune_cortex_a9 = 0; -/* Nonzero if generating Thumb instructions. */ -int thumb_code = 0; - -/* Nonzero if generating Thumb-1 instructions. */ -int thumb1_code = 0; - /* Nonzero if we should define __THUMB_INTERWORK__ in the preprocessor. XXX This is a bit of a hack, it's intended to help work around @@ -2601,6 +2598,136 @@ arm_gimplify_va_arg_expr (tree valist, t return std_gimplify_va_arg_expr (valist, type, pre_p, post_p); } +/* Check any incompatible options that the user has specified. */ +static void +arm_option_check_internal (struct gcc_options *opts) +{ + /* Make sure that the processor choice does not conflict with any of the + other command line choices. */ + if (TREE_TARGET_ARM (opts) !(insn_flags FL_NOTM)) +error (target CPU does not support ARM mode); + + /* TARGET_BACKTRACE calls leaf_function_p, which causes a crash if done + from here where no function is being compiled currently. */ + if ((TARGET_TPCS_FRAME || TARGET_TPCS_LEAF_FRAME) TREE_TARGET_ARM (opts)) +warning (0, enabling backtrace support is only meaningful when compiling for the Thumb); + + if (TREE_TARGET_ARM (opts) TARGET_CALLEE_INTERWORKING) +warning (0, enabling callee interworking support is only meaningful when compiling for the Thumb); + + /* If this target is normally configured to use APCS frames, warn if they + are turned off and debugging is turned on. */ + if (TREE_TARGET_ARM (opts) + write_symbols != NO_DEBUG + !TARGET_APCS_FRAME + (TARGET_DEFAULT MASK_APCS_FRAME)) +warning (0, -g with -mno-apcs-frame may not give sensible debugging); + + /* iWMMXt unsupported under Thumb mode. */ + if (TREE_TARGET_THUMB (opts) TARGET_IWMMXT) +error (iWMMXt unsupported under Thumb mode); + + if (TARGET_HARD_TP TREE_TARGET_THUMB1 (opts)) +error (can not use -mtp=cp15 with 16-bit Thumb); + + if (TREE_TARGET_THUMB (opts) TARGET_VXWORKS_RTP flag_pic) +{ + error (RTP PIC is incompatible with Thumb); + flag_pic = 0; +} + + /* We only support -mslow-flash-data on armv7-m targets. */ + if (target_slow_flash_data + ((!(arm_arch7 !arm_arch_notm) !arm_arch7em) + || (TREE_TARGET_THUMB1 (opts) || flag_pic || TARGET_NEON))) +error (-mslow-flash-data only supports non-pic code on armv7-m targets); +} + +/* Check any params depending on attributes that the user has specified. */ +static void +arm_option_params_internal (struct gcc_options *opts) +{ + /* If we are not using the default (ARM mode) section anchor offset + ranges, then set the correct ranges now. */ + if (TREE_TARGET_THUMB1 (opts)) +{ + /* Thumb-1 LDR instructions cannot have negative offsets. + Permissible positive offset ranges are 5-bit (for byte loads), + 6-bit (for halfword loads), or 7-bit (for word loads). + Empirical results suggest a 7-bit anchor range gives the best + overall code size. */ + targetm.min_anchor_offset = 0; + targetm.max_anchor_offset = 127; +} + else if (TREE_TARGET_THUMB2 (opts)) +{ + /* The minimum is set such that the total size of the block + for a particular anchor is 248 + 1 + 4095 bytes, which is + divisible by eight, ensuring natural spacing of anchors. */ + targetm.min_anchor_offset = -248; + targetm.max_anchor_offset = 4095; +} + else +{ +