From 7922a3bb6ba14d5933fc414f6c345e96acd33833 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Tue, 5 Oct 2004 22:55:59 +0000 Subject: [PATCH] basic-block.h: Remove the prototype for flow_preorder_transversal_compute. * basic-block.h: Remove the prototype for flow_preorder_transversal_compute. * cfganal.c (dfst_node): Remove. (flow_preorder_transversal_compute): Likewise. * rtl.h: Remove the prototype for get_jump_table_offset. * rtlanal.c (get_jump_table_offset): Remove. From-SVN: r88580 --- gcc/ChangeLog | 9 ++++ gcc/basic-block.h | 1 - gcc/cfganal.c | 120 ----------------------------------------- gcc/rtl.h | 1 - gcc/rtlanal.c | 132 ---------------------------------------------- 5 files changed, 9 insertions(+), 254 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1d7d8dcec91..24da20f69a2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2004-10-05 Kazu Hirata + + * basic-block.h: Remove the prototype for + flow_preorder_transversal_compute. + * cfganal.c (dfst_node): Remove. + (flow_preorder_transversal_compute): Likewise. + * rtl.h: Remove the prototype for get_jump_table_offset. + * rtlanal.c (get_jump_table_offset): Remove. + 2004-10-05 Richard Henderson PR 17756 diff --git a/gcc/basic-block.h b/gcc/basic-block.h index 16d5ab3b1fd..7a75d688d00 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -473,7 +473,6 @@ extern basic_block create_basic_block_structure (rtx, rtx, rtx, basic_block); extern void clear_bb_flags (void); extern void flow_reverse_top_sort_order_compute (int *); extern int flow_depth_first_order_compute (int *, int *); -extern void flow_preorder_transversal_compute (int *); extern int dfs_enumerate_from (basic_block, int, bool (*)(basic_block, void *), basic_block *, int, void *); diff --git a/gcc/cfganal.c b/gcc/cfganal.c index 30aa5c40db3..c76da55296c 100644 --- a/gcc/cfganal.c +++ b/gcc/cfganal.c @@ -774,126 +774,6 @@ flow_depth_first_order_compute (int *dfs_order, int *rc_order) return dfsnum; } -struct dfst_node -{ - unsigned nnodes; - struct dfst_node **node; - struct dfst_node *up; -}; - -/* Compute a preorder transversal ordering such that a sub-tree which - is the source of a cross edge appears before the sub-tree which is - the destination of the cross edge. This allows for easy detection - of all the entry blocks for a loop. - - The ordering is compute by: - - 1) Generating a depth first spanning tree. - - 2) Walking the resulting tree from right to left. */ - -void -flow_preorder_transversal_compute (int *pot_order) -{ - edge_iterator *stack, ei; - int i; - int max_successors; - int sp; - sbitmap visited; - struct dfst_node *node; - struct dfst_node *dfst; - basic_block bb; - - /* Allocate stack for back-tracking up CFG. */ - stack = xmalloc ((n_basic_blocks + 1) * sizeof (edge)); - sp = 0; - - /* Allocate the tree. */ - dfst = xcalloc (last_basic_block, sizeof (struct dfst_node)); - - FOR_EACH_BB (bb) - { - max_successors = EDGE_COUNT (bb->succs); - dfst[bb->index].node - = (max_successors - ? xcalloc (max_successors, sizeof (struct dfst_node *)) : NULL); - } - - /* Allocate bitmap to track nodes that have been visited. */ - visited = sbitmap_alloc (last_basic_block); - - /* None of the nodes in the CFG have been visited yet. */ - sbitmap_zero (visited); - - /* Push the first edge on to the stack. */ - stack[sp++] = ei_start (ENTRY_BLOCK_PTR->succs); - - while (sp) - { - basic_block src; - basic_block dest; - - /* Look at the edge on the top of the stack. */ - ei = stack[sp - 1]; - src = ei_edge (ei)->src; - dest = ei_edge (ei)->dest; - - /* Check if the edge destination has been visited yet. */ - if (dest != EXIT_BLOCK_PTR && ! TEST_BIT (visited, dest->index)) - { - /* Mark that we have visited the destination. */ - SET_BIT (visited, dest->index); - - /* Add the destination to the preorder tree. */ - if (src != ENTRY_BLOCK_PTR) - { - dfst[src->index].node[dfst[src->index].nnodes++] - = &dfst[dest->index]; - dfst[dest->index].up = &dfst[src->index]; - } - - if (EDGE_COUNT (dest->succs) > 0) - /* Since the DEST node has been visited for the first - time, check its successors. */ - stack[sp++] = ei_start (dest->succs); - } - - else if (! ei_one_before_end_p (ei)) - ei_next (&stack[sp - 1]); - else - sp--; - } - - free (stack); - sbitmap_free (visited); - - /* Record the preorder transversal order by - walking the tree from right to left. */ - - i = 0; - node = &dfst[ENTRY_BLOCK_PTR->next_bb->index]; - pot_order[i++] = 0; - - while (node) - { - if (node->nnodes) - { - node = node->node[--node->nnodes]; - pot_order[i++] = node - dfst; - } - else - node = node->up; - } - - /* Free the tree. */ - - for (i = 0; i < last_basic_block; i++) - if (dfst[i].node) - free (dfst[i].node); - - free (dfst); -} - /* Compute the depth first search order on the _reverse_ graph and store in the array DFS_ORDER, marking the nodes visited in VISITED. Returns the number of nodes visited. diff --git a/gcc/rtl.h b/gcc/rtl.h index ffc7ef5cb11..ac2419b41e2 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -1598,7 +1598,6 @@ extern int rtx_varies_p (rtx, int); extern int rtx_addr_varies_p (rtx, int); extern HOST_WIDE_INT get_integer_term (rtx); extern rtx get_related_value (rtx); -extern rtx get_jump_table_offset (rtx, rtx *); extern int global_reg_mentioned_p (rtx); extern int reg_mentioned_p (rtx, rtx); extern int count_occurrences (rtx, rtx, int); diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index b529d76794c..7e79a8abeec 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -435,138 +435,6 @@ get_related_value (rtx x) return 0; } -/* Given a tablejump insn INSN, return the RTL expression for the offset - into the jump table. If the offset cannot be determined, then return - NULL_RTX. - - If EARLIEST is nonzero, it is a pointer to a place where the earliest - insn used in locating the offset was found. */ - -rtx -get_jump_table_offset (rtx insn, rtx *earliest) -{ - rtx label = NULL; - rtx table = NULL; - rtx set; - rtx old_insn; - rtx x; - rtx old_x; - rtx y; - rtx old_y; - int i; - - if (!tablejump_p (insn, &label, &table) || !(set = single_set (insn))) - return NULL_RTX; - - x = SET_SRC (set); - - /* Some targets (eg, ARM) emit a tablejump that also - contains the out-of-range target. */ - if (GET_CODE (x) == IF_THEN_ELSE - && GET_CODE (XEXP (x, 2)) == LABEL_REF) - x = XEXP (x, 1); - - /* Search backwards and locate the expression stored in X. */ - for (old_x = NULL_RTX; REG_P (x) && x != old_x; - old_x = x, x = find_last_value (x, &insn, NULL_RTX, 0)) - ; - - /* If X is an expression using a relative address then strip - off the addition / subtraction of PC, PIC_OFFSET_TABLE_REGNUM, - or the jump table label. */ - if (GET_CODE (PATTERN (table)) == ADDR_DIFF_VEC - && (GET_CODE (x) == PLUS || GET_CODE (x) == MINUS)) - { - for (i = 0; i < 2; i++) - { - old_insn = insn; - y = XEXP (x, i); - - if (y == pc_rtx || y == pic_offset_table_rtx) - break; - - for (old_y = NULL_RTX; REG_P (y) && y != old_y; - old_y = y, y = find_last_value (y, &old_insn, NULL_RTX, 0)) - ; - - if ((GET_CODE (y) == LABEL_REF && XEXP (y, 0) == label)) - break; - } - - if (i >= 2) - return NULL_RTX; - - x = XEXP (x, 1 - i); - - for (old_x = NULL_RTX; REG_P (x) && x != old_x; - old_x = x, x = find_last_value (x, &insn, NULL_RTX, 0)) - ; - } - - /* Strip off any sign or zero extension. */ - if (GET_CODE (x) == SIGN_EXTEND || GET_CODE (x) == ZERO_EXTEND) - { - x = XEXP (x, 0); - - for (old_x = NULL_RTX; REG_P (x) && x != old_x; - old_x = x, x = find_last_value (x, &insn, NULL_RTX, 0)) - ; - } - - /* If X isn't a MEM then this isn't a tablejump we understand. */ - if (!MEM_P (x)) - return NULL_RTX; - - /* Strip off the MEM. */ - x = XEXP (x, 0); - - for (old_x = NULL_RTX; REG_P (x) && x != old_x; - old_x = x, x = find_last_value (x, &insn, NULL_RTX, 0)) - ; - - /* If X isn't a PLUS than this isn't a tablejump we understand. */ - if (GET_CODE (x) != PLUS) - return NULL_RTX; - - /* At this point we should have an expression representing the jump table - plus an offset. Examine each operand in order to determine which one - represents the jump table. Knowing that tells us that the other operand - must represent the offset. */ - for (i = 0; i < 2; i++) - { - old_insn = insn; - y = XEXP (x, i); - - for (old_y = NULL_RTX; REG_P (y) && y != old_y; - old_y = y, y = find_last_value (y, &old_insn, NULL_RTX, 0)) - ; - - if ((GET_CODE (y) == CONST || GET_CODE (y) == LABEL_REF) - && reg_mentioned_p (label, y)) - break; - } - - if (i >= 2) - return NULL_RTX; - - x = XEXP (x, 1 - i); - - /* Strip off the addition / subtraction of PIC_OFFSET_TABLE_REGNUM. */ - if (GET_CODE (x) == PLUS || GET_CODE (x) == MINUS) - for (i = 0; i < 2; i++) - if (XEXP (x, i) == pic_offset_table_rtx) - { - x = XEXP (x, 1 - i); - break; - } - - if (earliest) - *earliest = insn; - - /* Return the RTL expression representing the offset. */ - return x; -} - /* A subroutine of global_reg_mentioned_p, returns 1 if *LOC mentions a global register. */ -- 2.30.2