diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 06094f333bc..70d1aa109c8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2006-11-03 Paul Brook + + gcc/ + * config/arm/arm.c (arm_file_start): New function. + (TARGET_ASM_FILE_START): Define. + (arm_default_cpu): New variable. + (arm_override_options): Set arm_default_cpu. + 2006-11-03 David Ung * config/mips/mips.h (processor_type): Removed PROCESSOR_24K, add diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index bbf4863a7ad..70e3d787a0c 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -154,6 +154,7 @@ static void arm_encode_section_info (tree, rtx, int); #endif static void arm_file_end (void); +static void arm_file_start (void); #ifdef AOF_ASSEMBLER static void aof_globalize_label (FILE *, const char *); @@ -202,6 +203,9 @@ static bool arm_tls_symbol_p (rtx x); #undef TARGET_ATTRIBUTE_TABLE #define TARGET_ATTRIBUTE_TABLE arm_attribute_table +#undef TARGET_ASM_FILE_START +#define TARGET_ASM_FILE_START arm_file_start + #undef TARGET_ASM_FILE_END #define TARGET_ASM_FILE_END arm_file_end @@ -390,6 +394,9 @@ rtx arm_compare_op0, arm_compare_op1; /* The processor for which instructions should be scheduled. */ enum processor_type arm_tune = arm_none; +/* The default processor used if not overriden by commandline. */ +static enum processor_type arm_default_cpu = arm_none; + /* Which floating point model to use. */ enum arm_fp_model arm_fp_model; @@ -1020,8 +1027,9 @@ arm_override_options (void) insn_flags = sel->flags; } sprintf (arm_arch_name, "__ARM_ARCH_%s__", sel->arch); + arm_default_cpu = (enum processor_type) (sel - all_cores); if (arm_tune == arm_none) - arm_tune = (enum processor_type) (sel - all_cores); + arm_tune = arm_default_cpu; } /* The processor for which we should tune should now have been @@ -14412,6 +14420,105 @@ arm_asm_output_labelref (FILE *stream, const char *name) asm_fprintf (stream, "%U%s", name); } +static void +arm_file_start (void) +{ + int val; + + if (TARGET_BPABI) + { + const char *fpu_name; + if (arm_select[0].string) + asm_fprintf (asm_out_file, "\t.cpu %s\n", arm_select[0].string); + else if (arm_select[1].string) + asm_fprintf (asm_out_file, "\t.arch %s\n", arm_select[1].string); + else + asm_fprintf (asm_out_file, "\t.cpu %s\n", + all_cores[arm_default_cpu].name); + + if (TARGET_SOFT_FLOAT) + { + if (TARGET_VFP) + fpu_name = "softvfp"; + else + fpu_name = "softfpa"; + } + else + { + switch (arm_fpu_arch) + { + case FPUTYPE_FPA: + fpu_name = "fpa"; + break; + case FPUTYPE_FPA_EMU2: + fpu_name = "fpe2"; + break; + case FPUTYPE_FPA_EMU3: + fpu_name = "fpe3"; + break; + case FPUTYPE_MAVERICK: + fpu_name = "maverick"; + break; + case FPUTYPE_VFP: + if (TARGET_HARD_FLOAT) + asm_fprintf (asm_out_file, "\t.eabi_attribute 27, 3\n"); + if (TARGET_HARD_FLOAT_ABI) + asm_fprintf (asm_out_file, "\t.eabi_attribute 28, 1\n"); + fpu_name = "vfp"; + break; + default: + abort(); + } + } + asm_fprintf (asm_out_file, "\t.fpu %s\n", fpu_name); + + /* Some of these attributes only apply when the corresponding features + are used. However we don't have any easy way of figuring this out. + Conservatively record the setting that would have been used. */ + + /* Tag_ABI_PCS_wchar_t. */ + asm_fprintf (asm_out_file, "\t.eabi_attribute 18, %d\n", + (int)WCHAR_TYPE_SIZE / BITS_PER_UNIT); + + /* Tag_ABI_FP_rounding. */ + if (flag_rounding_math) + asm_fprintf (asm_out_file, "\t.eabi_attribute 19, 1\n"); + if (!flag_unsafe_math_optimizations) + { + /* Tag_ABI_FP_denomal. */ + asm_fprintf (asm_out_file, "\t.eabi_attribute 20, 1\n"); + /* Tag_ABI_FP_exceptions. */ + asm_fprintf (asm_out_file, "\t.eabi_attribute 21, 1\n"); + } + /* Tag_ABI_FP_user_exceptions. */ + if (flag_signaling_nans) + asm_fprintf (asm_out_file, "\t.eabi_attribute 22, 1\n"); + /* Tag_ABI_FP_number_model. */ + asm_fprintf (asm_out_file, "\t.eabi_attribute 23, %d\n", + flag_finite_math_only ? 1 : 3); + + /* Tag_ABI_align8_needed. */ + asm_fprintf (asm_out_file, "\t.eabi_attribute 24, 1\n"); + /* Tag_ABI_align8_preserved. */ + asm_fprintf (asm_out_file, "\t.eabi_attribute 25, 1\n"); + /* Tag_ABI_enum_size. */ + asm_fprintf (asm_out_file, "\t.eabi_attribute 26, %d\n", + flag_short_enums ? 1 : 2); + + /* Tag_ABI_optimization_goals. */ + if (optimize_size) + val = 4; + else if (optimize >= 2) + val = 2; + else if (optimize) + val = 1; + else + val = 6; + asm_fprintf (asm_out_file, "\t.eabi_attribute 30, %d\n", val); + } + default_file_start(); +} + static void arm_file_end (void) {