OSDN Git Service
(root)
/
pf3gnuchains
/
gcc-fork.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* typeck.c (comptypes): First determine if the types are compatible
[pf3gnuchains/gcc-fork.git]
/
gcc
/
et-forest.c
diff --git
a/gcc/et-forest.c
b/gcc/et-forest.c
index
dfc05a3
..
7fbbb77
100644
(file)
--- a/
gcc/et-forest.c
+++ b/
gcc/et-forest.c
@@
-1,6
+1,6
@@
/* ET-trees data structure implementation.
Contributed by Pavel Nejedly
/* ET-trees data structure implementation.
Contributed by Pavel Nejedly
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003
, 2004
Free Software Foundation, Inc.
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
@@
-37,7
+37,7
@@
Boston, MA 02111-1307, USA.
#include "basic-block.h"
#endif
#include "basic-block.h"
#endif
-/* The occurence of a node in the et tree. */
+/* The occur
r
ence of a node in the et tree. */
struct et_occ
{
struct et_node *of; /* The node. */
struct et_occ
{
struct et_node *of; /* The node. */
@@
-51,12
+51,12
@@
struct et_occ
int min; /* The minimum value of the depth in the subtree
is obtained by adding sum of depth fields
on the path to the root. */
int min; /* The minimum value of the depth in the subtree
is obtained by adding sum of depth fields
on the path to the root. */
- struct et_occ *min_occ; /* The occurence in the subtree with the minimal
+ struct et_occ *min_occ; /* The occur
r
ence in the subtree with the minimal
depth. */
};
static alloc_pool et_nodes;
depth. */
};
static alloc_pool et_nodes;
-static alloc_pool et_occurences;
+static alloc_pool et_occur
r
ences;
/* Changes depth of OCC to D. */
/* Changes depth of OCC to D. */
@@
-88,8
+88,7
@@
static inline void
set_prev (struct et_occ *occ, struct et_occ *t)
{
#ifdef DEBUG_ET
set_prev (struct et_occ *occ, struct et_occ *t)
{
#ifdef DEBUG_ET
- if (occ == t)
- abort ();
+ gcc_assert (occ != t);
#endif
occ->prev = t;
#endif
occ->prev = t;
@@
-103,8
+102,7
@@
static inline void
set_next (struct et_occ *occ, struct et_occ *t)
{
#ifdef DEBUG_ET
set_next (struct et_occ *occ, struct et_occ *t)
{
#ifdef DEBUG_ET
- if (occ == t)
- abort ();
+ gcc_assert (occ != t);
#endif
occ->next = t;
#endif
occ->next = t;
@@
-112,7
+110,7
@@
set_next (struct et_occ *occ, struct et_occ *t)
t->parent = occ;
}
t->parent = occ;
}
-/* Recompute minimum for occurence OCC. */
+/* Recompute minimum for occur
r
ence OCC. */
static inline void
et_recomp_min (struct et_occ *occ)
static inline void
et_recomp_min (struct et_occ *occ)
@@
-137,7
+135,7
@@
et_recomp_min (struct et_occ *occ)
}
#ifdef DEBUG_ET
}
#ifdef DEBUG_ET
-/* Checks whether neighbo
u
rhood of OCC seems sane. */
+/* Checks whether neighborhood of OCC seems sane. */
static void
et_check_occ_sanity (struct et_occ *occ)
static void
et_check_occ_sanity (struct et_occ *occ)
@@
-145,40
+143,26
@@
et_check_occ_sanity (struct et_occ *occ)
if (!occ)
return;
if (!occ)
return;
- if (occ->parent == occ)
- abort ();
-
- if (occ->prev == occ)
- abort ();
-
- if (occ->next == occ)
- abort ();
-
- if (occ->next && occ->next == occ->prev)
- abort ();
+ gcc_assert (occ->parent != occ);
+ gcc_assert (occ->prev != occ);
+ gcc_assert (occ->next != occ);
+ gcc_assert (!occ->next || occ->next != occ->prev);
if (occ->next)
{
if (occ->next)
{
- if (occ->next == occ->parent)
- abort ();
-
- if (occ->next->parent != occ)
- abort ();
+ gcc_assert (occ->next != occ->parent);
+ gcc_assert (occ->next->parent == occ);
}
if (occ->prev)
{
}
if (occ->prev)
{
- if (occ->prev == occ->parent)
- abort ();
-
- if (occ->prev->parent != occ)
- abort ();
+ gcc_assert (occ->prev != occ->parent);
+ gcc_assert (occ->prev->parent == occ);
}
}
- if (occ->parent
- && occ->parent->prev != occ
- && occ->parent->next != occ)
- abort ();
+ gcc_assert (!occ->parent
+ || occ->parent->prev == occ
+ || occ->parent->next == occ);
}
/* Checks whether tree rooted at OCC is sane. */
}
/* Checks whether tree rooted at OCC is sane. */
@@
-206,9
+190,13
@@
et_check_tree_sanity (struct et_occ *occ)
/* For recording the paths. */
/* For recording the paths. */
+/* An ad-hoc constant; if the function has more blocks, this won't work,
+ but since it is used for debugging only, it does not matter. */
+#define MAX_NODES 100000
+
static int len;
static int len;
-static void *datas[
100000
];
-static int depths[
100000
];
+static void *datas[
MAX_NODES
];
+static int depths[
MAX_NODES
];
/* Records the path represented by OCC, with depth incremented by DEPTH. */
/* Records the path represented by OCC, with depth incremented by DEPTH. */
@@
-228,6
+216,9
@@
record_path_before_1 (struct et_occ *occ, int depth)
}
fprintf (stderr, "%d (%d); ", ((basic_block) occ->of->data)->index, depth);
}
fprintf (stderr, "%d (%d); ", ((basic_block) occ->of->data)->index, depth);
+
+ gcc_assert (len < MAX_NODES);
+
depths[len] = depth;
datas[len] = occ->of;
len++;
depths[len] = depth;
datas[len] = occ->of;
len++;
@@
-239,8
+230,7
@@
record_path_before_1 (struct et_occ *occ, int depth)
mn = m;
}
mn = m;
}
- if (mn != occ->min + depth - occ->depth)
- abort ();
+ gcc_assert (mn == occ->min + depth - occ->depth);
return mn;
}
return mn;
}
@@
-277,9
+267,7
@@
check_path_after_1 (struct et_occ *occ, int depth)
}
len--;
}
len--;
- if (depths[len] != depth
- || datas[len] != occ->of)
- abort ();
+ gcc_assert (depths[len] == depth && datas[len] == occ->of);
if (occ->prev)
{
if (occ->prev)
{
@@
-288,8
+276,7
@@
check_path_after_1 (struct et_occ *occ, int depth)
mn = m;
}
mn = m;
}
- if (mn != occ->min + depth - occ->depth)
- abort ();
+ gcc_assert (mn == occ->min + depth - occ->depth);
return mn;
}
return mn;
}
@@
-304,13
+291,12
@@
check_path_after (struct et_occ *occ)
occ = occ->parent;
check_path_after_1 (occ, 0);
occ = occ->parent;
check_path_after_1 (occ, 0);
- if (len != 0)
- abort ();
+ gcc_assert (!len);
}
#endif
}
#endif
-/* Splay the occurence OCC to the root of the tree. */
+/* Splay the occur
r
ence OCC to the root of the tree. */
static void
et_splay (struct et_occ *occ)
static void
et_splay (struct et_occ *occ)
@@
-452,16
+438,16
@@
et_splay (struct et_occ *occ)
#endif
}
#endif
}
-/* Create a new et tree occurence of NODE. */
+/* Create a new et tree occur
r
ence of NODE. */
static struct et_occ *
et_new_occ (struct et_node *node)
{
struct et_occ *nw;
static struct et_occ *
et_new_occ (struct et_node *node)
{
struct et_occ *nw;
- if (!et_occurences)
- et_occurences = create_alloc_pool ("et_occ pool", sizeof (struct et_occ), 300);
- nw = pool_alloc (et_occurences);
+ if (!et_occur
r
ences)
+ et_occur
r
ences = create_alloc_pool ("et_occ pool", sizeof (struct et_occ), 300);
+ nw = pool_alloc (et_occur
r
ences);
nw->of = node;
nw->parent = NULL;
nw->of = node;
nw->parent = NULL;
@@
-509,7
+495,7
@@
et_free_tree (struct et_node *t)
if (t->father)
et_split (t);
if (t->father)
et_split (t);
- pool_free (et_occurences, t->rightmost_occ);
+ pool_free (et_occur
r
ences, t->rightmost_occ);
pool_free (et_nodes, t);
}
pool_free (et_nodes, t);
}
@@
-602,7
+588,7
@@
et_split (struct et_node *t)
rmost->depth = 0;
rmost->min = 0;
rmost->depth = 0;
rmost->min = 0;
- pool_free (et_occurences, p_occ);
+ pool_free (et_occur
r
ences, p_occ);
/* Update the tree. */
if (father->son == t)
/* Update the tree. */
if (father->son == t)