cp-gimplify.c (169690) | cp-gimplify.c (260014) |
---|---|
1/* C++-specific tree lowering bits; see also c-gimplify.c and tree-gimple.c. 2 3 Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 4 Contributed by Jason Merrill <jason@redhat.com> 5 6This file is part of GCC. 7 8GCC is free software; you can redistribute it and/or modify it under --- 174 unchanged lines hidden (view full) --- 183/* Build a generic representation of one of the C loop forms. COND is the 184 loop condition or NULL_TREE. BODY is the (possibly compound) statement 185 controlled by the loop. INCR is the increment expression of a for-loop, 186 or NULL_TREE. COND_IS_FIRST indicates whether the condition is 187 evaluated before the loop body as in while and for loops, or after the 188 loop body as in do-while loops. */ 189 190static tree | 1/* C++-specific tree lowering bits; see also c-gimplify.c and tree-gimple.c. 2 3 Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 4 Contributed by Jason Merrill <jason@redhat.com> 5 6This file is part of GCC. 7 8GCC is free software; you can redistribute it and/or modify it under --- 174 unchanged lines hidden (view full) --- 183/* Build a generic representation of one of the C loop forms. COND is the 184 loop condition or NULL_TREE. BODY is the (possibly compound) statement 185 controlled by the loop. INCR is the increment expression of a for-loop, 186 or NULL_TREE. COND_IS_FIRST indicates whether the condition is 187 evaluated before the loop body as in while and for loops, or after the 188 loop body as in do-while loops. */ 189 190static tree |
191gimplify_cp_loop (tree cond, tree body, tree incr, bool cond_is_first) | 191/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ 192gimplify_cp_loop (tree cond, tree body, tree incr, tree attrs, 193 bool cond_is_first, tree inner_foreach) 194/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ |
192{ 193 tree top, entry, exit, cont_block, break_block, stmt_list, t; 194 location_t stmt_locus; 195 196 stmt_locus = input_location; 197 stmt_list = NULL_TREE; 198 entry = NULL_TREE; 199 --- 18 unchanged lines hidden (view full) --- 218 have to gimplify the loop body NOW so that we can resolve 219 break/continue stmts, seems easier to just expand to gotos. */ 220 top = build1 (LABEL_EXPR, void_type_node, NULL_TREE); 221 222 /* If we have an exit condition, then we build an IF with gotos either 223 out of the loop, or to the top of it. If there's no exit condition, 224 then we just build a jump back to the top. */ 225 exit = build_and_jump (&LABEL_EXPR_LABEL (top)); | 195{ 196 tree top, entry, exit, cont_block, break_block, stmt_list, t; 197 location_t stmt_locus; 198 199 stmt_locus = input_location; 200 stmt_list = NULL_TREE; 201 entry = NULL_TREE; 202 --- 18 unchanged lines hidden (view full) --- 221 have to gimplify the loop body NOW so that we can resolve 222 break/continue stmts, seems easier to just expand to gotos. */ 223 top = build1 (LABEL_EXPR, void_type_node, NULL_TREE); 224 225 /* If we have an exit condition, then we build an IF with gotos either 226 out of the loop, or to the top of it. If there's no exit condition, 227 then we just build a jump back to the top. */ 228 exit = build_and_jump (&LABEL_EXPR_LABEL (top)); |
229/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ 230 231 /* Add the attributes to the 'top' label. */ 232 decl_attributes (&LABEL_EXPR_LABEL (top), attrs, 0); 233 234/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ |
|
226 if (cond && !integer_nonzerop (cond)) 227 { 228 t = build_bc_goto (bc_break); 229 exit = fold_build3 (COND_EXPR, void_type_node, cond, exit, t); 230 gimplify_stmt (&exit); 231 232 if (cond_is_first) 233 { --- 31 unchanged lines hidden (view full) --- 265static void 266gimplify_for_stmt (tree *stmt_p, tree *pre_p) 267{ 268 tree stmt = *stmt_p; 269 270 if (FOR_INIT_STMT (stmt)) 271 gimplify_and_add (FOR_INIT_STMT (stmt), pre_p); 272 | 235 if (cond && !integer_nonzerop (cond)) 236 { 237 t = build_bc_goto (bc_break); 238 exit = fold_build3 (COND_EXPR, void_type_node, cond, exit, t); 239 gimplify_stmt (&exit); 240 241 if (cond_is_first) 242 { --- 31 unchanged lines hidden (view full) --- 274static void 275gimplify_for_stmt (tree *stmt_p, tree *pre_p) 276{ 277 tree stmt = *stmt_p; 278 279 if (FOR_INIT_STMT (stmt)) 280 gimplify_and_add (FOR_INIT_STMT (stmt), pre_p); 281 |
282/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ |
|
273 *stmt_p = gimplify_cp_loop (FOR_COND (stmt), FOR_BODY (stmt), | 283 *stmt_p = gimplify_cp_loop (FOR_COND (stmt), FOR_BODY (stmt), |
274 FOR_EXPR (stmt), 1); | 284 FOR_EXPR (stmt), FOR_ATTRIBUTES (stmt), 1, 285 NULL_TREE); 286/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ |
275} 276 277/* Gimplify a WHILE_STMT node. */ 278 279static void 280gimplify_while_stmt (tree *stmt_p) 281{ 282 tree stmt = *stmt_p; | 287} 288 289/* Gimplify a WHILE_STMT node. */ 290 291static void 292gimplify_while_stmt (tree *stmt_p) 293{ 294 tree stmt = *stmt_p; |
295/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ |
|
283 *stmt_p = gimplify_cp_loop (WHILE_COND (stmt), WHILE_BODY (stmt), | 296 *stmt_p = gimplify_cp_loop (WHILE_COND (stmt), WHILE_BODY (stmt), |
284 NULL_TREE, 1); | 297 NULL_TREE, WHILE_ATTRIBUTES (stmt), 1, 298 NULL_TREE); 299/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ |
285} 286 287/* Gimplify a DO_STMT node. */ 288 289static void 290gimplify_do_stmt (tree *stmt_p) 291{ 292 tree stmt = *stmt_p; | 300} 301 302/* Gimplify a DO_STMT node. */ 303 304static void 305gimplify_do_stmt (tree *stmt_p) 306{ 307 tree stmt = *stmt_p; |
308/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ |
|
293 *stmt_p = gimplify_cp_loop (DO_COND (stmt), DO_BODY (stmt), | 309 *stmt_p = gimplify_cp_loop (DO_COND (stmt), DO_BODY (stmt), |
294 NULL_TREE, 0); | 310 NULL_TREE, DO_ATTRIBUTES (stmt), 0, 311 DO_FOREACH (stmt)); 312/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ |
295} 296 297/* Genericize a SWITCH_STMT by turning it into a SWITCH_EXPR. */ 298 299static void 300gimplify_switch_stmt (tree *stmt_p) 301{ 302 tree stmt = *stmt_p; --- 632 unchanged lines hidden --- | 313} 314 315/* Genericize a SWITCH_STMT by turning it into a SWITCH_EXPR. */ 316 317static void 318gimplify_switch_stmt (tree *stmt_p) 319{ 320 tree stmt = *stmt_p; --- 632 unchanged lines hidden --- |