diff options
Diffstat (limited to 'toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106817.patch')
| -rw-r--r-- | toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106817.patch | 290 |
1 files changed, 0 insertions, 290 deletions
diff --git a/toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106817.patch b/toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106817.patch deleted file mode 100644 index d44f8cf1a5..0000000000 --- a/toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106817.patch +++ /dev/null | |||
| @@ -1,290 +0,0 @@ | |||
| 1 | 2011-10-01 Revital Eres <revital.eres@linaro.org> | ||
| 2 | |||
| 3 | gcc/ | ||
| 4 | Backport from mainline -r179380 and -r179381 | ||
| 5 | |||
| 6 | * ddg.c (autoinc_var_is_used_p): New function. | ||
| 7 | (create_ddg_dep_from_intra_loop_link, | ||
| 8 | add_cross_iteration_register_deps): Call it. | ||
| 9 | * ddg.h (autoinc_var_is_used_p): Declare. | ||
| 10 | * modulo-sched.c (sms_schedule): Handle instructions with REG_INC. | ||
| 11 | (generate_reg_moves): Call autoinc_var_is_used_p. Skip | ||
| 12 | instructions that do not set a register and verify no regmoves | ||
| 13 | are created for !single_set instructions. | ||
| 14 | |||
| 15 | gcc/testsuite/ | ||
| 16 | |||
| 17 | * gcc.dg/sms-10.c: New file | ||
| 18 | |||
| 19 | === modified file 'gcc/ddg.c' | ||
| 20 | --- old/gcc/ddg.c 2011-07-31 11:29:10 +0000 | ||
| 21 | +++ new/gcc/ddg.c 2011-10-02 06:56:53 +0000 | ||
| 22 | @@ -145,6 +145,27 @@ | ||
| 23 | return rtx_mem_access_p (PATTERN (insn)); | ||
| 24 | } | ||
| 25 | |||
| 26 | +/* Return true if DEF_INSN contains address being auto-inc or auto-dec | ||
| 27 | + which is used in USE_INSN. Otherwise return false. The result is | ||
| 28 | + being used to decide whether to remove the edge between def_insn and | ||
| 29 | + use_insn when -fmodulo-sched-allow-regmoves is set. This function | ||
| 30 | + doesn't need to consider the specific address register; no reg_moves | ||
| 31 | + will be allowed for any life range defined by def_insn and used | ||
| 32 | + by use_insn, if use_insn uses an address register auto-inc'ed by | ||
| 33 | + def_insn. */ | ||
| 34 | +bool | ||
| 35 | +autoinc_var_is_used_p (rtx def_insn, rtx use_insn) | ||
| 36 | +{ | ||
| 37 | + rtx note; | ||
| 38 | + | ||
| 39 | + for (note = REG_NOTES (def_insn); note; note = XEXP (note, 1)) | ||
| 40 | + if (REG_NOTE_KIND (note) == REG_INC | ||
| 41 | + && reg_referenced_p (XEXP (note, 0), PATTERN (use_insn))) | ||
| 42 | + return true; | ||
| 43 | + | ||
| 44 | + return false; | ||
| 45 | +} | ||
| 46 | + | ||
| 47 | /* Computes the dependence parameters (latency, distance etc.), creates | ||
| 48 | a ddg_edge and adds it to the given DDG. */ | ||
| 49 | static void | ||
| 50 | @@ -173,10 +194,15 @@ | ||
| 51 | compensate for that by generating reg-moves based on the life-range | ||
| 52 | analysis. The anti-deps that will be deleted are the ones which | ||
| 53 | have true-deps edges in the opposite direction (in other words | ||
| 54 | - the kernel has only one def of the relevant register). TODO: | ||
| 55 | - support the removal of all anti-deps edges, i.e. including those | ||
| 56 | + the kernel has only one def of the relevant register). | ||
| 57 | + If the address that is being auto-inc or auto-dec in DEST_NODE | ||
| 58 | + is used in SRC_NODE then do not remove the edge to make sure | ||
| 59 | + reg-moves will not be created for this address. | ||
| 60 | + TODO: support the removal of all anti-deps edges, i.e. including those | ||
| 61 | whose register has multiple defs in the loop. */ | ||
| 62 | - if (flag_modulo_sched_allow_regmoves && (t == ANTI_DEP && dt == REG_DEP)) | ||
| 63 | + if (flag_modulo_sched_allow_regmoves | ||
| 64 | + && (t == ANTI_DEP && dt == REG_DEP) | ||
| 65 | + && !autoinc_var_is_used_p (dest_node->insn, src_node->insn)) | ||
| 66 | { | ||
| 67 | rtx set; | ||
| 68 | |||
| 69 | @@ -302,10 +328,14 @@ | ||
| 70 | gcc_assert (first_def_node); | ||
| 71 | |||
| 72 | /* Always create the edge if the use node is a branch in | ||
| 73 | - order to prevent the creation of reg-moves. */ | ||
| 74 | + order to prevent the creation of reg-moves. | ||
| 75 | + If the address that is being auto-inc or auto-dec in LAST_DEF | ||
| 76 | + is used in USE_INSN then do not remove the edge to make sure | ||
| 77 | + reg-moves will not be created for that address. */ | ||
| 78 | if (DF_REF_ID (last_def) != DF_REF_ID (first_def) | ||
| 79 | || !flag_modulo_sched_allow_regmoves | ||
| 80 | - || JUMP_P (use_node->insn)) | ||
| 81 | + || JUMP_P (use_node->insn) | ||
| 82 | + || autoinc_var_is_used_p (DF_REF_INSN (last_def), use_insn)) | ||
| 83 | create_ddg_dep_no_link (g, use_node, first_def_node, ANTI_DEP, | ||
| 84 | REG_DEP, 1); | ||
| 85 | |||
| 86 | |||
| 87 | === modified file 'gcc/ddg.h' | ||
| 88 | --- old/gcc/ddg.h 2009-11-25 10:55:54 +0000 | ||
| 89 | +++ new/gcc/ddg.h 2011-10-02 06:56:53 +0000 | ||
| 90 | @@ -186,4 +186,6 @@ | ||
| 91 | int find_nodes_on_paths (sbitmap result, ddg_ptr, sbitmap from, sbitmap to); | ||
| 92 | int longest_simple_path (ddg_ptr, int from, int to, sbitmap via); | ||
| 93 | |||
| 94 | +bool autoinc_var_is_used_p (rtx, rtx); | ||
| 95 | + | ||
| 96 | #endif /* GCC_DDG_H */ | ||
| 97 | |||
| 98 | === modified file 'gcc/modulo-sched.c' | ||
| 99 | --- old/gcc/modulo-sched.c 2011-09-14 11:06:06 +0000 | ||
| 100 | +++ new/gcc/modulo-sched.c 2011-10-02 06:56:53 +0000 | ||
| 101 | @@ -477,7 +477,12 @@ | ||
| 102 | sbitmap *uses_of_defs; | ||
| 103 | rtx last_reg_move; | ||
| 104 | rtx prev_reg, old_reg; | ||
| 105 | - | ||
| 106 | + rtx set = single_set (u->insn); | ||
| 107 | + | ||
| 108 | + /* Skip instructions that do not set a register. */ | ||
| 109 | + if ((set && !REG_P (SET_DEST (set)))) | ||
| 110 | + continue; | ||
| 111 | + | ||
| 112 | /* Compute the number of reg_moves needed for u, by looking at life | ||
| 113 | ranges started at u (excluding self-loops). */ | ||
| 114 | for (e = u->out; e; e = e->next_out) | ||
| 115 | @@ -494,6 +499,20 @@ | ||
| 116 | && SCHED_COLUMN (e->dest) < SCHED_COLUMN (e->src)) | ||
| 117 | nreg_moves4e--; | ||
| 118 | |||
| 119 | + if (nreg_moves4e >= 1) | ||
| 120 | + { | ||
| 121 | + /* !single_set instructions are not supported yet and | ||
| 122 | + thus we do not except to encounter them in the loop | ||
| 123 | + except from the doloop part. For the latter case | ||
| 124 | + we assume no regmoves are generated as the doloop | ||
| 125 | + instructions are tied to the branch with an edge. */ | ||
| 126 | + gcc_assert (set); | ||
| 127 | + /* If the instruction contains auto-inc register then | ||
| 128 | + validate that the regmov is being generated for the | ||
| 129 | + target regsiter rather then the inc'ed register. */ | ||
| 130 | + gcc_assert (!autoinc_var_is_used_p (u->insn, e->dest->insn)); | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | nreg_moves = MAX (nreg_moves, nreg_moves4e); | ||
| 134 | } | ||
| 135 | |||
| 136 | @@ -1266,12 +1285,10 @@ | ||
| 137 | continue; | ||
| 138 | } | ||
| 139 | |||
| 140 | - /* Don't handle BBs with calls or barriers or auto-increment insns | ||
| 141 | - (to avoid creating invalid reg-moves for the auto-increment insns), | ||
| 142 | + /* Don't handle BBs with calls or barriers | ||
| 143 | or !single_set with the exception of instructions that include | ||
| 144 | count_reg---these instructions are part of the control part | ||
| 145 | that do-loop recognizes. | ||
| 146 | - ??? Should handle auto-increment insns. | ||
| 147 | ??? Should handle insns defining subregs. */ | ||
| 148 | for (insn = head; insn != NEXT_INSN (tail); insn = NEXT_INSN (insn)) | ||
| 149 | { | ||
| 150 | @@ -1282,7 +1299,6 @@ | ||
| 151 | || (NONDEBUG_INSN_P (insn) && !JUMP_P (insn) | ||
| 152 | && !single_set (insn) && GET_CODE (PATTERN (insn)) != USE | ||
| 153 | && !reg_mentioned_p (count_reg, insn)) | ||
| 154 | - || (FIND_REG_INC_NOTE (insn, NULL_RTX) != 0) | ||
| 155 | || (INSN_P (insn) && (set = single_set (insn)) | ||
| 156 | && GET_CODE (SET_DEST (set)) == SUBREG)) | ||
| 157 | break; | ||
| 158 | @@ -1296,8 +1312,6 @@ | ||
| 159 | fprintf (dump_file, "SMS loop-with-call\n"); | ||
| 160 | else if (BARRIER_P (insn)) | ||
| 161 | fprintf (dump_file, "SMS loop-with-barrier\n"); | ||
| 162 | - else if (FIND_REG_INC_NOTE (insn, NULL_RTX) != 0) | ||
| 163 | - fprintf (dump_file, "SMS reg inc\n"); | ||
| 164 | else if ((NONDEBUG_INSN_P (insn) && !JUMP_P (insn) | ||
| 165 | && !single_set (insn) && GET_CODE (PATTERN (insn)) != USE)) | ||
| 166 | fprintf (dump_file, "SMS loop-with-not-single-set\n"); | ||
| 167 | |||
| 168 | === added file 'gcc/testsuite/gcc.dg/sms-10.c' | ||
| 169 | --- old/gcc/testsuite/gcc.dg/sms-10.c 1970-01-01 00:00:00 +0000 | ||
| 170 | +++ new/gcc/testsuite/gcc.dg/sms-10.c 2011-10-02 06:56:53 +0000 | ||
| 171 | @@ -0,0 +1,118 @@ | ||
| 172 | + /* { dg-do run } */ | ||
| 173 | + /* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -fdump-rtl-sms" } */ | ||
| 174 | + | ||
| 175 | + | ||
| 176 | +typedef __SIZE_TYPE__ size_t; | ||
| 177 | +extern void *malloc (size_t); | ||
| 178 | +extern void free (void *); | ||
| 179 | +extern void abort (void); | ||
| 180 | + | ||
| 181 | +struct regstat_n_sets_and_refs_t | ||
| 182 | +{ | ||
| 183 | + int sets; | ||
| 184 | + int refs; | ||
| 185 | +}; | ||
| 186 | + | ||
| 187 | +struct regstat_n_sets_and_refs_t *regstat_n_sets_and_refs; | ||
| 188 | + | ||
| 189 | +struct df_reg_info | ||
| 190 | +{ | ||
| 191 | + unsigned int n_refs; | ||
| 192 | +}; | ||
| 193 | + | ||
| 194 | +struct df_d | ||
| 195 | +{ | ||
| 196 | + struct df_reg_info **def_regs; | ||
| 197 | + struct df_reg_info **use_regs; | ||
| 198 | +}; | ||
| 199 | +struct df_d *df; | ||
| 200 | + | ||
| 201 | +static inline int | ||
| 202 | +REG_N_SETS (int regno) | ||
| 203 | +{ | ||
| 204 | + return regstat_n_sets_and_refs[regno].sets; | ||
| 205 | +} | ||
| 206 | + | ||
| 207 | +__attribute__ ((noinline)) | ||
| 208 | + int max_reg_num (void) | ||
| 209 | +{ | ||
| 210 | + return 100; | ||
| 211 | +} | ||
| 212 | + | ||
| 213 | +__attribute__ ((noinline)) | ||
| 214 | + void regstat_init_n_sets_and_refs (void) | ||
| 215 | +{ | ||
| 216 | + unsigned int i; | ||
| 217 | + unsigned int max_regno = max_reg_num (); | ||
| 218 | + | ||
| 219 | + for (i = 0; i < max_regno; i++) | ||
| 220 | + { | ||
| 221 | + (regstat_n_sets_and_refs[i].sets = (df->def_regs[(i)]->n_refs)); | ||
| 222 | + (regstat_n_sets_and_refs[i].refs = | ||
| 223 | + (df->use_regs[(i)]->n_refs) + REG_N_SETS (i)); | ||
| 224 | + } | ||
| 225 | +} | ||
| 226 | + | ||
| 227 | +int a_sets[100] = | ||
| 228 | + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, | ||
| 229 | + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, | ||
| 230 | + 40, 41, 42, | ||
| 231 | + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, | ||
| 232 | + 62, 63, 64, | ||
| 233 | + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, | ||
| 234 | + 84, 85, 86, | ||
| 235 | + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 | ||
| 236 | +}; | ||
| 237 | + | ||
| 238 | +int a_refs[100] = | ||
| 239 | + { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, | ||
| 240 | + 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, | ||
| 241 | + 78, 80, 82, | ||
| 242 | + 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, | ||
| 243 | + 118, 120, | ||
| 244 | + 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, | ||
| 245 | + 152, 154, 156, | ||
| 246 | + 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, | ||
| 247 | + 188, 190, 192, | ||
| 248 | + 194, 196, 198 | ||
| 249 | +}; | ||
| 250 | + | ||
| 251 | +int | ||
| 252 | +main () | ||
| 253 | +{ | ||
| 254 | + struct df_reg_info *b[100], *c[100]; | ||
| 255 | + struct df_d df1; | ||
| 256 | + size_t s = sizeof (struct df_reg_info); | ||
| 257 | + struct regstat_n_sets_and_refs_t a[100]; | ||
| 258 | + | ||
| 259 | + df = &df1; | ||
| 260 | + regstat_n_sets_and_refs = a; | ||
| 261 | + int i; | ||
| 262 | + | ||
| 263 | + for (i = 0; i < 100; i++) | ||
| 264 | + { | ||
| 265 | + b[i] = (struct df_reg_info *) malloc (s); | ||
| 266 | + b[i]->n_refs = i; | ||
| 267 | + c[i] = (struct df_reg_info *) malloc (s); | ||
| 268 | + c[i]->n_refs = i; | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | + df1.def_regs = b; | ||
| 272 | + df1.use_regs = c; | ||
| 273 | + regstat_init_n_sets_and_refs (); | ||
| 274 | + | ||
| 275 | + for (i = 0; i < 100; i++) | ||
| 276 | + if ((a[i].sets != a_sets[i]) || (a[i].refs != a_refs[i])) | ||
| 277 | + abort (); | ||
| 278 | + | ||
| 279 | + for (i = 0; i < 100; i++) | ||
| 280 | + { | ||
| 281 | + free (b[i]); | ||
| 282 | + free (c[i]); | ||
| 283 | + } | ||
| 284 | + | ||
| 285 | + return 0; | ||
| 286 | +} | ||
| 287 | + | ||
| 288 | +/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target powerpc*-*-* } } } */ | ||
| 289 | +/* { dg-final { cleanup-rtl-dump "sms" } } */ | ||
| 290 | |||
