From: Steven Bosscher Date: Wed, 26 Jan 2005 17:26:33 +0000 (+0000) Subject: re PR middle-end/16585 (current_function_has_computed_jump incorrectly changed in... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f7aa1423e222c3404666f54455d1968f7d769c83;p=gcc.git re PR middle-end/16585 (current_function_has_computed_jump incorrectly changed in make_edges) PR middle-end/16585 * cfgbuild.c (make_edges): Do not clear or set current_function_has_computed_jump. * function.h (struct function): Remove the has_computed_jump field. (current_function_has_computed_jump): Do not define. * sched-rgn.c (is_cfg_nonregular): Return true if a basic block ends in a computed jump. Ignore current_function_has_computed_jump. From-SVN: r94269 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a7b83b8d4fe..51b273e0d97 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2005-01-26 Steven Bosscher + + PR middle-end/16585 + * cfgbuild.c (make_edges): Do not clear or set + current_function_has_computed_jump. + * function.h (struct function): Remove the has_computed_jump field. + (current_function_has_computed_jump): Do not define. + * sched-rgn.c (is_cfg_nonregular): Return true if a basic block ends + in a computed jump. Ignore current_function_has_computed_jump. + 2005-01-26 Richard Henderson PR middle-end/19515 diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c index fdfbccae0c3..7f3e72b9ff5 100644 --- a/gcc/cfgbuild.c +++ b/gcc/cfgbuild.c @@ -227,18 +227,6 @@ make_edges (basic_block min, basic_block max, int update_p) basic_block bb; sbitmap *edge_cache = NULL; - /* Assume no computed jump; revise as we create edges. */ - current_function_has_computed_jump = 0; - - /* If we are partitioning hot and cold basic blocks into separate - sections, we cannot assume there is no computed jump (partitioning - sometimes requires the use of indirect jumps; see comments about - partitioning at the top of bb-reorder.c:partition_hot_cold_basic_blocks - for complete details). */ - - if (flag_reorder_blocks_and_partition) - current_function_has_computed_jump = 1; - /* Heavy use of computed goto in machine-generated code can lead to nearly fully-connected CFGs. In that case we spend a significant amount of time searching the edge lists for duplicates. */ @@ -325,8 +313,6 @@ make_edges (basic_block min, basic_block max, int update_p) everything on the forced_labels list. */ else if (computed_jump_p (insn)) { - current_function_has_computed_jump = 1; - for (x = forced_labels; x; x = XEXP (x, 1)) make_label_edge (edge_cache, bb, XEXP (x, 0), EDGE_ABNORMAL); } diff --git a/gcc/function.h b/gcc/function.h index 1c32c9fbc5b..1284becb47a 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -375,9 +375,6 @@ struct function GTY(()) /* Nonzero if function being compiled contains nested functions. */ unsigned int contains_functions : 1; - /* Nonzero if the function being compiled issues a computed jump. */ - unsigned int has_computed_jump : 1; - /* Nonzero if the current function is a thunk, i.e., a lightweight function implemented by the output_mi_thunk hook) that just adjusts one of its arguments and forwards to another @@ -447,7 +444,6 @@ extern int trampolines_created; #define current_function_calls_setjmp (cfun->calls_setjmp) #define current_function_calls_alloca (cfun->calls_alloca) #define current_function_calls_eh_return (cfun->calls_eh_return) -#define current_function_has_computed_jump (cfun->has_computed_jump) #define current_function_contains_functions (cfun->contains_functions) #define current_function_is_thunk (cfun->is_thunk) #define current_function_args_info (cfun->args_info) diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c index f4f73f86f2f..d5004e4e032 100644 --- a/gcc/sched-rgn.c +++ b/gcc/sched-rgn.c @@ -291,7 +291,6 @@ is_cfg_nonregular (void) { basic_block b; rtx insn; - RTX_CODE code; /* If we have a label that could be the target of a nonlocal goto, then the cfg is not well structured. */ @@ -302,11 +301,6 @@ is_cfg_nonregular (void) if (forced_labels) return 1; - /* If this function has a computed jump, then we consider the cfg - not well structured. */ - if (current_function_has_computed_jump) - return 1; - /* If we have exception handlers, then we consider the cfg not well structured. ?!? We should be able to handle this now that flow.c computes an accurate cfg for EH. */ @@ -315,24 +309,23 @@ is_cfg_nonregular (void) /* If we have non-jumping insns which refer to labels, then we consider the cfg not well structured. */ - /* Check for labels referred to other thn by jumps. */ FOR_EACH_BB (b) - for (insn = BB_HEAD (b); ; insn = NEXT_INSN (insn)) + FOR_BB_INSNS (b, insn) { - code = GET_CODE (insn); - if (INSN_P (insn) && code != JUMP_INSN) + /* Check for labels referred by non-jump insns. */ + if (NONJUMP_INSN_P (insn) || CALL_P (insn)) { rtx note = find_reg_note (insn, REG_LABEL, NULL_RTX); - if (note && ! (JUMP_P (NEXT_INSN (insn)) && find_reg_note (NEXT_INSN (insn), REG_LABEL, XEXP (note, 0)))) return 1; } - - if (insn == BB_END (b)) - break; + /* If this function has a computed jump, then we consider the cfg + not well structured. */ + else if (JUMP_P (insn) && computed_jump_p (insn)) + return 1; } /* Unreachable loops with more than one basic block are detected