summaryrefslogtreecommitdiff
path: root/gcc/cfg.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2001-10-16 22:24:16 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2001-10-16 22:24:16 +0000
commit2fb0fd1526055cce275ed9dd1683a8a4c90d546d (patch)
tree1295a7d5d520c93f35da9092195ef7eb5cc38d7d /gcc/cfg.c
parent78ac78d98eaa97ce0fc8c9d9f8c2b4df0c48caaa (diff)
downloadgcc-2fb0fd1526055cce275ed9dd1683a8a4c90d546d.tar.gz
* cfg.c (free_edge): Break out from ....
(remove_edge): ... here. (clear_edges): Use free_edge. * att.h (ASM_QUAD): Add comment. * bsd.h, sco5.h, sun386.h (ASM_QUAD): Define. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46297 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfg.c')
-rw-r--r--gcc/cfg.c44
1 files changed, 36 insertions, 8 deletions
diff --git a/gcc/cfg.c b/gcc/cfg.c
index d8d8c992b7d..a72067342f2 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -117,6 +117,7 @@ struct basic_block_def entry_exit_blocks[2]
};
void debug_flow_info PARAMS ((void));
+static void free_edge PARAMS ((edge));
/* Called once at intialization time. */
@@ -142,23 +143,53 @@ init_flow ()
}
}
+/* Helper function for remove_edge and clear_edges. Frees edge structure
+ without actually unlinking it from the pred/succ lists. */
+
+static void
+free_edge (e)
+ edge e;
+{
+ n_edges--;
+ memset (e, 0, sizeof (*e));
+ e->succ_next = first_deleted_edge;
+ first_deleted_edge = e;
+}
+
/* Free the memory associated with the edge structures. */
void
clear_edges ()
{
int i;
+ edge e;
for (i = 0; i < n_basic_blocks; ++i)
{
basic_block bb = BASIC_BLOCK (i);
+ edge e = bb->succ;
- while (bb->succ)
- remove_edge (bb->succ);
+ while (e)
+ {
+ edge next = e->succ_next;
+
+ free_edge (e);
+ e = next;
+ }
+ bb->succ = NULL;
+ bb->pred = NULL;
}
- while (ENTRY_BLOCK_PTR->succ)
- remove_edge (ENTRY_BLOCK_PTR->succ);
+ e = ENTRY_BLOCK_PTR->succ;
+ while (e)
+ {
+ edge next = e->succ_next;
+
+ free_edge (e);
+ e = next;
+ }
+ EXIT_BLOCK_PTR->pred = NULL;
+ ENTRY_BLOCK_PTR->succ = NULL;
if (n_edges)
abort ();
@@ -335,10 +366,7 @@ remove_edge (e)
else
dest->pred = e->pred_next;
- n_edges--;
- memset (e, 0, sizeof (*e));
- e->succ_next = first_deleted_edge;
- first_deleted_edge = e;
+ free_edge (e);
}
/* Redirect an edge's successor from one block to another. */