Commit 502b8322 by Andreas Jaeger Committed by Andreas Jaeger

except.c: Convert prototypes to ISO C90.

	* except.c: Convert prototypes to ISO C90.
	* except.h: Likewise.
	* emit-rtl.c: Likewise.
	* et-forest.c: Likewise.
	* et-forest.h: Likewise.
	* except.c: Likewise.
	* explow.c: Likewise.
	* expmed.c: Likewise.
	* expr.c: Likewise.
	* expr.h: Likewise.

From-SVN: r68674
parent 7080f735
......@@ -14,6 +14,16 @@
* dwarf2out.c: Likewise.
* dwarf2out.h: Likewise.
* dwarfout.c: Likewise.
* except.c: Likewise.
* except.h: Likewise.
* emit-rtl.c: Likewise.
* et-forest.c: Likewise.
* et-forest.h: Likewise.
* except.c: Likewise.
* explow.c: Likewise.
* expmed.c: Likewise.
* expr.c: Likewise.
* expr.h: Likewise.
2003-06-29 Kazu Hirata <kazu@cs.umass.edu>
......
/* ET-trees datastructure implementation.
Contributed by Pavel Nejedly
Copyright (C) 2002 Free Software Foundation, Inc.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
......@@ -16,7 +16,7 @@ Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with libiberty; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Boston, MA 02111-1307, USA.
The ET-forest structure is described in:
D. D. Sleator and R. E. Tarjan. A data structure for dynamic trees.
......@@ -42,7 +42,7 @@ struct et_forest
alloc_pool occur_pool;
};
/* Single occurrence of node in ET-forest.
/* Single occurrence of node in ET-forest.
A single node may have multiple occurrences.
*/
struct et_forest_occurrence
......@@ -75,18 +75,17 @@ struct et_forest_node
};
static et_forest_occurrence_t splay PARAMS ((et_forest_occurrence_t));
static void remove_all_occurrences PARAMS ((et_forest_t, et_forest_node_t));
static inline et_forest_occurrence_t find_leftmost_node
PARAMS ((et_forest_occurrence_t));
static inline et_forest_occurrence_t find_rightmost_node
PARAMS ((et_forest_occurrence_t));
static int calculate_value PARAMS ((et_forest_occurrence_t));
static et_forest_occurrence_t splay (et_forest_occurrence_t);
static void remove_all_occurrences (et_forest_t, et_forest_node_t);
static inline et_forest_occurrence_t find_leftmost_node
(et_forest_occurrence_t);
static inline et_forest_occurrence_t find_rightmost_node
(et_forest_occurrence_t);
static int calculate_value (et_forest_occurrence_t);
/* Return leftmost node present in the tree roted by OCC. */
static inline et_forest_occurrence_t
find_leftmost_node (occ)
et_forest_occurrence_t occ;
find_leftmost_node (et_forest_occurrence_t occ)
{
while (occ->left)
occ = occ->left;
......@@ -96,8 +95,7 @@ find_leftmost_node (occ)
/* Return rightmost node present in the tree roted by OCC. */
static inline et_forest_occurrence_t
find_rightmost_node (occ)
et_forest_occurrence_t occ;
find_rightmost_node (et_forest_occurrence_t occ)
{
while (occ->right)
occ = occ->right;
......@@ -107,8 +105,7 @@ find_rightmost_node (occ)
/* Operation splay for splay tree structure representing occurrences. */
static et_forest_occurrence_t
splay (node)
et_forest_occurrence_t node;
splay (et_forest_occurrence_t node)
{
et_forest_occurrence_t parent;
et_forest_occurrence_t grandparent;
......@@ -276,7 +273,7 @@ splay (node)
}
}
}
}
/* parent == root. */
......@@ -286,7 +283,7 @@ splay (node)
{
et_forest_occurrence_t node1;
int count1;
node1 = node->right;
count1 = node->count_right;
......@@ -306,13 +303,13 @@ splay (node)
else
node->parent->right = node;
}
}
else
}
else
{
/* node == parent->right. */
et_forest_occurrence_t node1;
int count1;
node1 = node->left;
count1 = node->count_left;
......@@ -339,9 +336,7 @@ splay (node)
/* Remove all occurrences of the given node before destroying the node. */
static void
remove_all_occurrences (forest, forest_node)
et_forest_t forest;
et_forest_node_t forest_node;
remove_all_occurrences (et_forest_t forest, et_forest_node_t forest_node)
{
et_forest_occurrence_t first = forest_node->first;
et_forest_occurrence_t last = forest_node->last;
......@@ -352,7 +347,7 @@ remove_all_occurrences (forest, forest_node)
if (first->left)
first->left->parent = 0;
if (first->right)
first->right->parent = 0;
first->right->parent = 0;
if (last != first)
{
......@@ -416,8 +411,7 @@ remove_all_occurrences (forest, forest_node)
/* Calculate ET value of the given node. */
static inline int
calculate_value (node)
et_forest_occurrence_t node;
calculate_value (et_forest_occurrence_t node)
{
int value = node->count_left;
......@@ -437,7 +431,7 @@ calculate_value (node)
/* Create ET-forest structure. */
et_forest_t
et_forest_create ()
et_forest_create (void)
{
et_forest_t forest = xmalloc (sizeof (struct et_forest));
......@@ -450,9 +444,8 @@ et_forest_create ()
/* Deallocate the structure. */
void
et_forest_delete (forest)
et_forest_t forest;
void
et_forest_delete (et_forest_t forest)
{
if (forest->nnodes)
abort ();
......@@ -464,9 +457,7 @@ et_forest_delete (forest)
/* Create new node with VALUE and return the edge.
Return NULL when memory allocation failed. */
et_forest_node_t
et_forest_add_node (forest, value)
et_forest_t forest;
void *value;
et_forest_add_node (et_forest_t forest, void *value)
{
/* Create node with one occurrence. */
et_forest_node_t node;
......@@ -489,10 +480,8 @@ et_forest_add_node (forest, value)
/* Add new edge to the tree, return 1 if successful.
0 indicates that creation of the edge will close the cycle in graph. */
int
et_forest_add_edge (forest, parent_node, child_node)
et_forest_t forest ATTRIBUTE_UNUSED;
et_forest_node_t parent_node;
et_forest_node_t child_node;
et_forest_add_edge (et_forest_t forest ATTRIBUTE_UNUSED,
et_forest_node_t parent_node, et_forest_node_t child_node)
{
et_forest_occurrence_t new_occ, parent_occ, child_occ;
......@@ -510,7 +499,7 @@ et_forest_add_edge (forest, parent_node, child_node)
if (child_occ->left)
abort (); /* child must be root of its containing tree. */
new_occ = pool_alloc (forest->occur_pool);
new_occ->node = parent_node;
......@@ -534,9 +523,7 @@ et_forest_add_edge (forest, parent_node, child_node)
/* Remove NODE from the tree and all connected edges. */
void
et_forest_remove_node (forest, node)
et_forest_t forest;
et_forest_node_t node;
et_forest_remove_node (et_forest_t forest, et_forest_node_t node)
{
remove_all_occurrences (forest, node);
forest->nnodes--;
......@@ -547,10 +534,9 @@ et_forest_remove_node (forest, node)
/* Remove edge from the tree, return 1 if successful,
0 indicates nonexisting edge. */
int
et_forest_remove_edge (forest, parent_node, child_node)
et_forest_t forest ATTRIBUTE_UNUSED;
et_forest_node_t parent_node;
et_forest_node_t child_node;
et_forest_remove_edge (et_forest_t forest ATTRIBUTE_UNUSED,
et_forest_node_t parent_node,
et_forest_node_t child_node)
{
et_forest_occurrence_t parent_pre_occ, parent_post_occ;
......@@ -565,7 +551,7 @@ et_forest_remove_edge (forest, parent_node, child_node)
splay (parent_pre_occ);
parent_pre_occ->right->parent = 0;
parent_post_occ = parent_pre_occ->next;
splay (parent_post_occ);
......@@ -587,9 +573,7 @@ et_forest_remove_edge (forest, parent_node, child_node)
/* Return the parent of the NODE if any, NULL otherwise. */
et_forest_node_t
et_forest_parent (forest, node)
et_forest_t forest ATTRIBUTE_UNUSED;
et_forest_node_t node;
et_forest_parent (et_forest_t forest ATTRIBUTE_UNUSED, et_forest_node_t node)
{
splay (node->first);
......@@ -603,17 +587,15 @@ et_forest_parent (forest, node)
/* Return nearest common ancestor of NODE1 and NODE2.
Return NULL of they are in different trees. */
et_forest_node_t
et_forest_common_ancestor (forest, node1, node2)
et_forest_t forest ATTRIBUTE_UNUSED;
et_forest_node_t node1;
et_forest_node_t node2;
et_forest_common_ancestor (et_forest_t forest ATTRIBUTE_UNUSED,
et_forest_node_t node1, et_forest_node_t node2)
{
int value1, value2, max_value;
et_forest_node_t ancestor;
if (node1 == node2)
return node1;
if (! node1 || ! node2)
abort ();
......@@ -636,7 +618,7 @@ et_forest_common_ancestor (forest, node1, node2)
ancestor = node2;
max_value = value1;
}
while (calculate_value (ancestor->last) < max_value)
{
/* Find parent node. */
......@@ -649,9 +631,8 @@ et_forest_common_ancestor (forest, node1, node2)
/* Return the value pointer of node set during it's creation. */
void *
et_forest_node_value (forest, node)
et_forest_t forest ATTRIBUTE_UNUSED;
et_forest_node_t node;
et_forest_node_value (et_forest_t forest ATTRIBUTE_UNUSED,
et_forest_node_t node)
{
/* Alloc threading NULL as a special node of the forest. */
if (!node)
......@@ -662,10 +643,8 @@ et_forest_node_value (forest, node)
/* Find all sons of NODE and store them into ARRAY allocated by the caller.
Return number of nodes found. */
int
et_forest_enumerate_sons (forest, node, array)
et_forest_t forest ATTRIBUTE_UNUSED;
et_forest_node_t node;
et_forest_node_t *array;
et_forest_enumerate_sons (et_forest_t forest ATTRIBUTE_UNUSED,
et_forest_node_t node, et_forest_node_t *array)
{
int n = 0;
et_forest_occurrence_t occ = node->first, stop = node->last, occ1;
......
/* Et-forest data structure implementation.
Copyright (C) 2002 Free Software Foundation, Inc.
/* Et-forest data structure implementation.
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -15,32 +15,32 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This package implements ET forest data structure. Each tree in
/* This package implements ET forest data structure. Each tree in
the structure maintains a tree structure and offers logarithmic time
for tree operations (insertion and removal of nodes and edges) and
poly-logarithmic time for nearest common ancestor.
ET tree strores its structue as a sequence of symbols obtained
ET tree strores its structue as a sequence of symbols obtained
by dfs(root)
dfs (node)
dfs (node)
{
s = node;
for each child c of node do
s = concat (s, c, node);
return s;
}
For example for tree
1
/ | \
2 3 4
/ |
4 5
the sequence is 1 2 4 2 5 3 1 3 1 4 1.
The sequence is stored in a sligtly modified splay tree.
In order to support various types of node values, a hashtable
is used to convert node values to the internal representation. */
......@@ -58,23 +58,23 @@ extern "C" {
typedef struct et_forest *et_forest_t;
typedef struct et_forest_node *et_forest_node_t;
extern et_forest_t et_forest_create PARAMS ((void));
extern void et_forest_delete PARAMS ((et_forest_t));
extern et_forest_node_t et_forest_add_node PARAMS ((et_forest_t, void *));
extern int et_forest_add_edge PARAMS ((et_forest_t, et_forest_node_t,
et_forest_node_t));
extern void et_forest_remove_node PARAMS ((et_forest_t, et_forest_node_t));
extern int et_forest_remove_edge PARAMS ((et_forest_t, et_forest_node_t,
et_forest_node_t));
extern et_forest_node_t et_forest_parent PARAMS ((et_forest_t, et_forest_node_t));
extern et_forest_node_t et_forest_common_ancestor PARAMS ((et_forest_t,
et_forest_node_t,
et_forest_node_t));
extern void * et_forest_node_value PARAMS ((et_forest_t, et_forest_node_t));
extern int et_forest_enumerate_sons PARAMS ((et_forest_t, et_forest_node_t,
et_forest_node_t *));
extern et_forest_t et_forest_create (void);
extern void et_forest_delete (et_forest_t);
extern et_forest_node_t et_forest_add_node (et_forest_t, void *);
extern int et_forest_add_edge (et_forest_t, et_forest_node_t,
et_forest_node_t);
extern void et_forest_remove_node (et_forest_t, et_forest_node_t);
extern int et_forest_remove_edge (et_forest_t, et_forest_node_t,
et_forest_node_t);
extern et_forest_node_t et_forest_parent (et_forest_t, et_forest_node_t);
extern et_forest_node_t et_forest_common_ancestor (et_forest_t,
et_forest_node_t,
et_forest_node_t);
extern void * et_forest_node_value (et_forest_t, et_forest_node_t);
extern int et_forest_enumerate_sons (et_forest_t, et_forest_node_t,
et_forest_node_t *);
#ifdef __cplusplus
}
......
/* Exception Handling interface routines.
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Contributed by Mike Stump <mrs@cygnus.com>.
......@@ -33,95 +33,94 @@ struct eh_status;
struct eh_region;
/* Test: is exception handling turned on? */
extern int doing_eh PARAMS ((int));
extern int doing_eh (int);
/* Start an exception handling region. All instructions emitted after
this point are considered to be part of the region until an
expand_eh_region_end variant is invoked. */
extern void expand_eh_region_start PARAMS ((void));
extern void expand_eh_region_start (void);
/* End an exception handling region for a cleanup. HANDLER is an
expression to expand for the cleanup. */
extern void expand_eh_region_end_cleanup PARAMS ((tree));
extern void expand_eh_region_end_cleanup (tree);
/* End an exception handling region for a try block, and prepares
for subsequent calls to expand_start_catch. */
extern void expand_start_all_catch PARAMS ((void));
extern void expand_start_all_catch (void);
/* Begin a catch clause. TYPE is an object to be matched by the
runtime, or a list of such objects, or null if this is a catch-all
clause. */
extern void expand_start_catch PARAMS ((tree));
extern void expand_start_catch (tree);
/* End a catch clause. Control will resume after the try/catch block. */
extern void expand_end_catch PARAMS ((void));
extern void expand_end_catch (void);
/* End a sequence of catch handlers for a try block. */
extern void expand_end_all_catch PARAMS ((void));
extern void expand_end_all_catch (void);
/* End an exception region for an exception type filter. ALLOWED is a
TREE_LIST of TREE_VALUE objects to be matched by the runtime.
FAILURE is a function to invoke if a mismatch occurs. */
extern void expand_eh_region_end_allowed PARAMS ((tree, tree));
extern void expand_eh_region_end_allowed (tree, tree);
/* End an exception region for a must-not-throw filter. FAILURE is a
function to invoke if an uncaught exception propagates this far. */
extern void expand_eh_region_end_must_not_throw PARAMS ((tree));
extern void expand_eh_region_end_must_not_throw (tree);
/* End an exception region for a throw. No handling goes on here,
but it's the easiest way for the front-end to indicate what type
is being thrown. */
extern void expand_eh_region_end_throw PARAMS ((tree));
extern void expand_eh_region_end_throw (tree);
/* End a fixup region. Within this region the cleanups for the immediately
enclosing region are _not_ run. This is used for goto cleanup to avoid
destroying an object twice. */
extern void expand_eh_region_end_fixup PARAMS ((tree));
extern void expand_eh_region_end_fixup (tree);
/* Note that the current EH region (if any) may contain a throw, or a
call to a function which itself may contain a throw. */
extern void note_eh_region_may_contain_throw PARAMS ((void));
extern void note_eh_region_may_contain_throw (void);
/* Invokes CALLBACK for every exception handler label. Only used by old
loop hackery; should not be used by new code. */
extern void for_each_eh_label PARAMS ((void (*) (rtx)));
extern void for_each_eh_label (void (*) (rtx));
/* Determine if the given INSN can throw an exception. */
extern bool can_throw_internal PARAMS ((rtx));
extern bool can_throw_external PARAMS ((rtx));
extern bool can_throw_internal (rtx);
extern bool can_throw_external (rtx);
/* Set current_function_nothrow and cfun->all_throwers_are_sibcalls. */
extern void set_nothrow_function_flags PARAMS ((void));
extern void set_nothrow_function_flags (void);
/* After initial rtl generation, call back to finish generating
exception support code. */
extern void finish_eh_generation PARAMS ((void));
extern void finish_eh_generation (void);
extern void init_eh PARAMS ((void));
extern void init_eh_for_function PARAMS ((void));
extern void init_eh (void);
extern void init_eh_for_function (void);
extern rtx reachable_handlers PARAMS ((rtx));
extern void maybe_remove_eh_handler PARAMS ((rtx));
extern rtx reachable_handlers (rtx);
extern void maybe_remove_eh_handler (rtx);
extern void convert_from_eh_region_ranges PARAMS ((void));
extern void convert_to_eh_region_ranges PARAMS ((void));
extern void find_exception_handler_labels PARAMS ((void));
extern bool current_function_has_exception_handlers PARAMS ((void));
extern void output_function_exception_table PARAMS ((void));
extern void convert_from_eh_region_ranges (void);
extern void convert_to_eh_region_ranges (void);
extern void find_exception_handler_labels (void);
extern bool current_function_has_exception_handlers (void);
extern void output_function_exception_table (void);
extern void expand_builtin_unwind_init PARAMS ((void));
extern rtx expand_builtin_eh_return_data_regno PARAMS ((tree));
extern rtx expand_builtin_extract_return_addr PARAMS ((tree));
extern void expand_builtin_init_dwarf_reg_sizes PARAMS ((tree));
extern rtx expand_builtin_frob_return_addr PARAMS ((tree));
extern rtx expand_builtin_dwarf_sp_column PARAMS ((void));
extern void expand_builtin_eh_return PARAMS ((tree, tree));
extern void expand_eh_return PARAMS ((void));
extern rtx get_exception_pointer PARAMS ((struct function *));
extern int duplicate_eh_regions PARAMS ((struct function *,
struct inline_remap *));
extern void expand_builtin_unwind_init (void);
extern rtx expand_builtin_eh_return_data_regno (tree);
extern rtx expand_builtin_extract_return_addr (tree);
extern void expand_builtin_init_dwarf_reg_sizes (tree);
extern rtx expand_builtin_frob_return_addr (tree);
extern rtx expand_builtin_dwarf_sp_column (void);
extern void expand_builtin_eh_return (tree, tree);
extern void expand_eh_return (void);
extern rtx get_exception_pointer (struct function *);
extern int duplicate_eh_regions (struct function *, struct inline_remap *);
extern void sjlj_emit_function_exit_after PARAMS ((rtx));
extern void sjlj_emit_function_exit_after (rtx);
/* If non-NULL, this is a function that returns an expression to be
......@@ -130,13 +129,13 @@ extern void sjlj_emit_function_exit_after PARAMS ((rtx));
during stack unwinding is required to result in a call to
`std::terminate', so the C++ version of this function returns a
CALL_EXPR for `std::terminate'. */
extern tree (*lang_protect_cleanup_actions) PARAMS ((void));
extern tree (*lang_protect_cleanup_actions) (void);
/* Return true if type A catches type B. */
extern int (*lang_eh_type_covers) PARAMS ((tree a, tree b));
extern int (*lang_eh_type_covers) (tree a, tree b);
/* Map a type to a runtime object to match type. */
extern tree (*lang_eh_runtime_type) PARAMS ((tree));
extern tree (*lang_eh_runtime_type) (tree);
/* Just because the user configured --with-sjlj-exceptions=no doesn't
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment