diff options
Diffstat (limited to 'gcc/passes.c')
-rw-r--r-- | gcc/passes.c | 88 |
1 files changed, 84 insertions, 4 deletions
diff --git a/gcc/passes.c b/gcc/passes.c index 695e4908cd1..c886410efac 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -251,6 +251,10 @@ rest_of_decl_compilation (tree decl, debug_hooks->type_decl (decl, !top_level); timevar_pop (TV_SYMOUT); } + + /* Let cgraph know about the existance of variables. */ + if (TREE_CODE (decl) == VAR_DECL && !DECL_EXTERNAL (decl)) + cgraph_varpool_node (decl); } /* Called after finishing a record, union or enumeral type. */ @@ -571,6 +575,8 @@ rest_of_handle_partition_blocks (void) static void rest_of_handle_sms (void) { + sbitmap blocks; + timevar_push (TV_SMS); open_dump_file (DFI_sms, current_function_decl); @@ -583,10 +589,14 @@ rest_of_handle_sms (void) /* Update the life information, because we add pseudos. */ max_regno = max_reg_num (); allocate_reg_info (max_regno, FALSE, FALSE); - update_life_info_in_dirty_blocks (UPDATE_LIFE_GLOBAL_RM_NOTES, - (PROP_DEATH_NOTES - | PROP_KILL_DEAD_CODE - | PROP_SCAN_DEAD_CODE)); + blocks = sbitmap_alloc (last_basic_block); + sbitmap_ones (blocks); + update_life_info (blocks, UPDATE_LIFE_GLOBAL_RM_NOTES, + (PROP_DEATH_NOTES + | PROP_REG_INFO + | PROP_KILL_DEAD_CODE + | PROP_SCAN_DEAD_CODE)); + no_new_pseudos = 1; ggc_collect (); @@ -895,6 +905,7 @@ rest_of_handle_combine (void) rebuild_jump_labels (get_insns ()); timevar_pop (TV_JUMP); + delete_dead_jumptables (); cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE); } @@ -971,6 +982,9 @@ rest_of_handle_cse (void) expecting CSE to be run. But always rerun it in a cheap mode. */ cse_not_expected = !flag_rerun_cse_after_loop && !flag_gcse; + if (tem) + delete_dead_jumptables (); + if (tem || optimize > 1) cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP); @@ -1006,6 +1020,7 @@ rest_of_handle_cse2 (void) { timevar_push (TV_JUMP); rebuild_jump_labels (get_insns ()); + delete_dead_jumptables (); cleanup_cfg (CLEANUP_EXPENSIVE); timevar_pop (TV_JUMP); } @@ -1053,6 +1068,7 @@ rest_of_handle_gcse (void) { timevar_push (TV_JUMP); rebuild_jump_labels (get_insns ()); + delete_dead_jumptables (); cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP); timevar_pop (TV_JUMP); } @@ -1473,6 +1489,38 @@ rest_of_clean_state (void) } +/* APPLE LOCAL begin radar 4120689 */ +#ifdef TARGET_386 +static int MaxAlignForThisBlock (tree block) +{ + tree decl; + unsigned int max_align = 0; + + for (decl = BLOCK_VARS (block); decl; decl = TREE_CHAIN (decl)) + { + if (TREE_CODE (decl) == VAR_DECL + && DECL_ALIGN (decl) > max_align) + max_align = DECL_ALIGN (decl); + } + return max_align; + +} + +static int +LargestAlignmentOfVariables (void) +{ + unsigned int align; + tree t; + tree outer_block = DECL_INITIAL (current_function_decl); + unsigned int max_align = MaxAlignForThisBlock (outer_block); + + for (t = BLOCK_SUBBLOCKS (outer_block); t ; t = BLOCK_CHAIN (t)) + if ((align = MaxAlignForThisBlock (t)) > max_align) + max_align = align; + return max_align; +} +#endif +/* APPLE LOCAL end radar 4120689 */ /* This function is called from the pass manager in tree-optimize.c after all tree passes have finished for a single function, and we have expanded the function body from trees to RTL. @@ -1485,6 +1533,11 @@ rest_of_clean_state (void) static void rest_of_compilation (void) { + /* APPLE LOCAL begin radar 4095567 */ +#ifdef TARGET_386 + unsigned int save_PREFERRED_STACK_BOUNDARY = 0; +#endif + /* APPLE LOCAL end radar 4095567 */ /* If we're emitting a nested function, make sure its parent gets emitted as well. Doing otherwise confuses debug info. */ { @@ -1653,6 +1706,23 @@ rest_of_compilation (void) since this can impact optimizations done by the prologue and epilogue thus changing register elimination offsets. */ current_function_is_leaf = leaf_function_p (); + /* APPLE LOCAL begin radar 4095567 */ +#ifdef TARGET_386 + if ((optimize > 0 || optimize_size) + && current_function_is_leaf + && PREFERRED_STACK_BOUNDARY >= 128 +/* APPLE LOCAL begin radar 4120689 */ + && !DECL_STRUCT_FUNCTION (current_function_decl)->uses_vector + && LargestAlignmentOfVariables() < 128) +/* APPLE LOCAL end radar 4120689 */ + { + save_PREFERRED_STACK_BOUNDARY = PREFERRED_STACK_BOUNDARY; + PREFERRED_STACK_BOUNDARY = 32; + cfun->stack_alignment_needed = STACK_BOUNDARY; + cfun->preferred_stack_boundary = STACK_BOUNDARY; + } +#endif + /* APPLE LOCAL end radar 4095567 */ if (rest_of_handle_old_regalloc ()) goto exit_rest_of_compilation; @@ -1738,6 +1808,16 @@ rest_of_compilation (void) exit_rest_of_compilation: + /* APPLE LOCAL begin radar 4095567 */ +#ifdef TARGET_386 + if (save_PREFERRED_STACK_BOUNDARY > 0) + { + PREFERRED_STACK_BOUNDARY = save_PREFERRED_STACK_BOUNDARY; + cfun->stack_alignment_needed = STACK_BOUNDARY; + cfun->preferred_stack_boundary = STACK_BOUNDARY; + } +#endif + /* APPLE LOCAL end radar 4095567 */ rest_of_clean_state (); } |