Mercurial > hg > CbC > CbC_gcc
comparison gcc/common/config/aarch64/aarch64-common.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* Common hooks for AArch64. | 1 /* Common hooks for AArch64. |
2 Copyright (C) 2012-2017 Free Software Foundation, Inc. | 2 Copyright (C) 2012-2018 Free Software Foundation, Inc. |
3 Contributed by ARM Ltd. | 3 Contributed by ARM Ltd. |
4 | 4 |
5 This file is part of GCC. | 5 This file is part of GCC. |
6 | 6 |
7 GCC is free software; you can redistribute it and/or modify it | 7 GCC is free software; you can redistribute it and/or modify it |
28 #include "common/common-target.h" | 28 #include "common/common-target.h" |
29 #include "common/common-target-def.h" | 29 #include "common/common-target-def.h" |
30 #include "opts.h" | 30 #include "opts.h" |
31 #include "flags.h" | 31 #include "flags.h" |
32 #include "diagnostic.h" | 32 #include "diagnostic.h" |
33 #include "params.h" | |
33 | 34 |
34 #ifdef TARGET_BIG_ENDIAN_DEFAULT | 35 #ifdef TARGET_BIG_ENDIAN_DEFAULT |
35 #undef TARGET_DEFAULT_TARGET_FLAGS | 36 #undef TARGET_DEFAULT_TARGET_FLAGS |
36 #define TARGET_DEFAULT_TARGET_FLAGS (MASK_BIG_END) | 37 #define TARGET_DEFAULT_TARGET_FLAGS (MASK_BIG_END) |
37 #endif | 38 #endif |
39 #undef TARGET_HANDLE_OPTION | 40 #undef TARGET_HANDLE_OPTION |
40 #define TARGET_HANDLE_OPTION aarch64_handle_option | 41 #define TARGET_HANDLE_OPTION aarch64_handle_option |
41 | 42 |
42 #undef TARGET_OPTION_OPTIMIZATION_TABLE | 43 #undef TARGET_OPTION_OPTIMIZATION_TABLE |
43 #define TARGET_OPTION_OPTIMIZATION_TABLE aarch_option_optimization_table | 44 #define TARGET_OPTION_OPTIMIZATION_TABLE aarch_option_optimization_table |
45 #undef TARGET_OPTION_DEFAULT_PARAMS | |
46 #define TARGET_OPTION_DEFAULT_PARAMS aarch64_option_default_params | |
47 #undef TARGET_OPTION_VALIDATE_PARAM | |
48 #define TARGET_OPTION_VALIDATE_PARAM aarch64_option_validate_param | |
44 | 49 |
45 /* Set default optimization options. */ | 50 /* Set default optimization options. */ |
46 static const struct default_options aarch_option_optimization_table[] = | 51 static const struct default_options aarch_option_optimization_table[] = |
47 { | 52 { |
48 /* Enable section anchors by default at -O1 or higher. */ | 53 /* Enable section anchors by default at -O1 or higher. */ |
49 { OPT_LEVELS_1_PLUS, OPT_fsection_anchors, NULL, 1 }, | 54 { OPT_LEVELS_1_PLUS, OPT_fsection_anchors, NULL, 1 }, |
55 /* Disable fomit-frame-pointer by default. */ | |
56 { OPT_LEVELS_ALL, OPT_fomit_frame_pointer, NULL, 0 }, | |
50 /* Enable -fsched-pressure by default when optimizing. */ | 57 /* Enable -fsched-pressure by default when optimizing. */ |
51 { OPT_LEVELS_1_PLUS, OPT_fsched_pressure, NULL, 1 }, | 58 { OPT_LEVELS_1_PLUS, OPT_fsched_pressure, NULL, 1 }, |
52 /* Enable redundant extension instructions removal at -O2 and higher. */ | 59 /* Enable redundant extension instructions removal at -O2 and higher. */ |
53 { OPT_LEVELS_2_PLUS, OPT_free, NULL, 1 }, | 60 { OPT_LEVELS_2_PLUS, OPT_free, NULL, 1 }, |
61 #if (TARGET_DEFAULT_ASYNC_UNWIND_TABLES == 1) | |
62 { OPT_LEVELS_ALL, OPT_fasynchronous_unwind_tables, NULL, 1 }, | |
63 { OPT_LEVELS_ALL, OPT_funwind_tables, NULL, 1}, | |
64 #endif | |
54 { OPT_LEVELS_NONE, 0, NULL, 0 } | 65 { OPT_LEVELS_NONE, 0, NULL, 0 } |
55 }; | 66 }; |
67 | |
68 /* Implement target validation TARGET_OPTION_DEFAULT_PARAM. */ | |
69 | |
70 static bool | |
71 aarch64_option_validate_param (const int value, const int param) | |
72 { | |
73 /* Check that both parameters are the same. */ | |
74 if (param == (int) PARAM_STACK_CLASH_PROTECTION_GUARD_SIZE) | |
75 { | |
76 if (value != 12 && value != 16) | |
77 { | |
78 error ("only values 12 (4 KB) and 16 (64 KB) are supported for guard " | |
79 "size. Given value %d (%llu KB) is out of range", | |
80 value, (1ULL << value) / 1024ULL); | |
81 return false; | |
82 } | |
83 } | |
84 | |
85 return true; | |
86 } | |
87 | |
88 /* Implement TARGET_OPTION_DEFAULT_PARAMS. */ | |
89 | |
90 static void | |
91 aarch64_option_default_params (void) | |
92 { | |
93 /* We assume the guard page is 64k. */ | |
94 int index = (int) PARAM_STACK_CLASH_PROTECTION_GUARD_SIZE; | |
95 set_default_param_value (PARAM_STACK_CLASH_PROTECTION_GUARD_SIZE, | |
96 DEFAULT_STK_CLASH_GUARD_SIZE == 0 | |
97 ? 16 : DEFAULT_STK_CLASH_GUARD_SIZE); | |
98 | |
99 int guard_size | |
100 = default_param_value (PARAM_STACK_CLASH_PROTECTION_GUARD_SIZE); | |
101 | |
102 /* Set the interval parameter to be the same as the guard size. This way the | |
103 mid-end code does the right thing for us. */ | |
104 set_default_param_value (PARAM_STACK_CLASH_PROTECTION_PROBE_INTERVAL, | |
105 guard_size); | |
106 | |
107 /* Validate the options. */ | |
108 aarch64_option_validate_param (guard_size, index); | |
109 } | |
56 | 110 |
57 /* Implement TARGET_HANDLE_OPTION. | 111 /* Implement TARGET_HANDLE_OPTION. |
58 This function handles the target specific options for CPU/target selection. | 112 This function handles the target specific options for CPU/target selection. |
59 | 113 |
60 -mcpu=CPU is shorthand for -march=ARCH_FOR_CPU, -mtune=CPU. | 114 -mcpu=CPU is shorthand for -march=ARCH_FOR_CPU, -mtune=CPU. |
93 case OPT_mfix_cortex_a53_835769: | 147 case OPT_mfix_cortex_a53_835769: |
94 opts->x_aarch64_fix_a53_err835769 = val; | 148 opts->x_aarch64_fix_a53_err835769 = val; |
95 return true; | 149 return true; |
96 | 150 |
97 case OPT_mstrict_align: | 151 case OPT_mstrict_align: |
98 opts->x_target_flags |= MASK_STRICT_ALIGN; | 152 if (val) |
153 opts->x_target_flags |= MASK_STRICT_ALIGN; | |
154 else | |
155 opts->x_target_flags &= ~MASK_STRICT_ALIGN; | |
99 return true; | 156 return true; |
100 | 157 |
101 case OPT_momit_leaf_frame_pointer: | 158 case OPT_momit_leaf_frame_pointer: |
102 opts->x_flag_omit_leaf_frame_pointer = val; | 159 opts->x_flag_omit_leaf_frame_pointer = val; |
103 return true; | 160 return true; |