Commit 02f098c9 authored by Matthias Braun's avatar Matthias Braun
Browse files

remove unnecessary comments before functions

public functions are already documented in their headers, no need to
repeat the comment at the definition site.
parent 91941f56
......@@ -253,12 +253,6 @@ static void analyze_ent_args(ir_entity *ent)
#endif
}
/**
* Analyze how pointer arguments of a given
* ir graph are accessed.
*
* @param irg The ir graph to analyze.
*/
void analyze_irg_args(ir_graph *irg)
{
ir_entity *ent;
......@@ -274,10 +268,6 @@ void analyze_irg_args(ir_graph *irg)
analyze_ent_args(ent);
}
/*
* Compute for a method with pointer parameter(s)
* if they will be read or written.
*/
ptr_access_kind get_method_param_access(ir_entity *ent, size_t pos)
{
#ifndef NDEBUG
......@@ -459,19 +449,6 @@ static void analyze_method_params_weight(ir_entity *ent)
}
}
/*
* Returns for a method the 'weight' that every parameter
* has on optimization possibility. Higher values allows
* higher optimization with procedure cloning.
*
* The values are calculation on demand only.
*
* @param ent the entity to analyze
* @param pos the argument number
*
* @return the parameter weight or null_weight if pos is greater
* than the number of arguments.
*/
unsigned get_method_param_weight(ir_entity *ent, size_t pos)
{
if (ent->attr.mtd_attr.param_weight) {
......@@ -489,12 +466,6 @@ unsigned get_method_param_weight(ir_entity *ent, size_t pos)
return null_weight;
}
/**
* Analyze argument's weight of a given
* ir graph.
*
* @param irg The ir graph to analyze.
*/
void analyze_irg_args_weight(ir_graph *irg)
{
ir_entity *entity = get_irg_entity(irg);
......
......@@ -48,33 +48,28 @@ static ir_visited_t master_cg_visited = 0;
static inline int cg_irg_visited (ir_graph *n);
static inline void mark_cg_irg_visited(ir_graph *n);
/** Returns the callgraph state of the program representation. */
irp_callgraph_state get_irp_callgraph_state(void)
{
return irp->callgraph_state;
}
/* Sets the callgraph state of the program representation. */
void set_irp_callgraph_state(irp_callgraph_state s)
{
irp->callgraph_state = s;
}
/* Returns the number of procedures that call the given irg. */
size_t get_irg_n_callers(const ir_graph *irg)
{
assert(irg->callers);
return irg->callers ? ARR_LEN(irg->callers) : 0;
}
/* Returns the caller at position pos. */
ir_graph *get_irg_caller(const ir_graph *irg, size_t pos)
{
assert(pos < get_irg_n_callers(irg));
return irg->callers ? irg->callers[pos] : NULL;
}
/* Returns non-zero if the caller at position pos is "a backedge", i.e. a recursion. */
int is_irg_caller_backedge(const ir_graph *irg, size_t pos)
{
assert(pos < get_irg_n_callers(irg));
......@@ -97,7 +92,6 @@ static void set_irg_caller_backedge(ir_graph *irg, const ir_graph *caller)
}
}
/* Returns non-zero if the irg has a backedge caller. */
int has_irg_caller_backedge(const ir_graph *irg)
{
size_t i, n_callers = get_irg_n_callers(irg);
......@@ -131,7 +125,6 @@ static size_t reverse_pos(const ir_graph *callee, size_t pos_caller)
return 0;
}
/* Returns the maximal loop depth of call nodes that call along this edge. */
size_t get_irg_caller_loop_depth(const ir_graph *irg, size_t pos)
{
ir_graph *caller = get_irg_caller(irg, pos);
......@@ -140,29 +133,24 @@ size_t get_irg_caller_loop_depth(const ir_graph *irg, size_t pos)
return get_irg_callee_loop_depth(caller, pos_callee);
}
/* Returns the number of procedures that are called by the given irg. */
size_t get_irg_n_callees(const ir_graph *irg)
{
assert(irg->callees);
return irg->callees ? ARR_LEN(irg->callees) : 0;
}
/* Returns the callee at position pos. */
ir_graph *get_irg_callee(const ir_graph *irg, size_t pos)
{
assert(pos < get_irg_n_callees(irg));
return irg->callees ? irg->callees[pos]->irg : NULL;
}
/* Returns non-zero if the callee at position pos is "a backedge", i.e. a recursion. */
int is_irg_callee_backedge(const ir_graph *irg, size_t pos)
{
assert(pos < get_irg_n_callees(irg));
return irg->callee_isbe != NULL ? rbitset_is_set(irg->callee_isbe, pos) : 0;
}
/* Returns non-zero if the irg has a backedge callee. */
int has_irg_callee_backedge(const ir_graph *irg)
{
size_t i, n_callees = get_irg_n_callees(irg);
......@@ -189,7 +177,6 @@ static void set_irg_callee_backedge(ir_graph *irg, size_t pos)
rbitset_set(irg->callee_isbe, pos);
}
/* Returns the maximal loop depth of call nodes that call along this edge. */
size_t get_irg_callee_loop_depth(const ir_graph *irg, size_t pos)
{
assert(pos < get_irg_n_callees(irg));
......@@ -197,8 +184,6 @@ size_t get_irg_callee_loop_depth(const ir_graph *irg, size_t pos)
}
/* --------------------- Compute the callgraph ------------------------ */
/**
* Pre-Walker called by compute_callgraph(), analyses all Call nodes.
*/
......@@ -259,8 +244,6 @@ static int graph_cmp(const void *elt, const void *key)
return e1 != e2;
}
/* Construct and destruct the callgraph. */
void compute_callgraph(void)
{
size_t i, n_irgs;
......@@ -318,7 +301,6 @@ void compute_callgraph(void)
set_irp_callgraph_state(irp_callgraph_consistent);
}
/* Destruct the callgraph. */
void free_callgraph(void)
{
size_t i, n_irgs = get_irp_n_irgs();
......@@ -336,10 +318,6 @@ void free_callgraph(void)
set_irp_callgraph_state(irp_callgraph_none);
}
/* ----------------------------------------------------------------------------------- */
/* A walker for the callgraph */
/* ----------------------------------------------------------------------------------- */
static void do_walk(ir_graph *irg, callgraph_walk_func *pre, callgraph_walk_func *post, void *env)
{
......@@ -382,10 +360,6 @@ void callgraph_walk(callgraph_walk_func *pre, callgraph_walk_func *post, void *e
}
}
/* ----------------------------------------------------------------------------------- */
/* loop construction algorithm */
/* ----------------------------------------------------------------------------------- */
static ir_graph *outermost_ir_graph; /**< The outermost graph the scc is computed
for */
static ir_loop *current_loop; /**< Current cfloop construction is working
......@@ -396,10 +370,6 @@ static size_t loop_node_cnt = 0; /**< Counts the number of allocated cfloop no
static size_t current_dfn = 1; /**< Counter to generate depth first numbering
of visited nodes. */
/*-----------------*/
/* Node attributes */
/*-----------------*/
typedef struct scc_info {
size_t dfn; /**< Depth first search number. */
size_t uplink; /**< dfn number of ancestor. */
......@@ -496,10 +466,6 @@ static inline size_t get_irg_dfn(const ir_graph *irg)
return info->dfn;
}
/**********************************************************************/
/* A stack. **/
/**********************************************************************/
static ir_graph **stack = NULL;
static size_t tos = 0; /**< top of stack */
......@@ -601,10 +567,6 @@ static inline void pop_scc_unmark_visit(ir_graph *n)
}
}
/**********************************************************************/
/* The loop data structure. **/
/**********************************************************************/
/**
* Allocates a new loop as son of current_loop. Sets current_loop
* to the new loop and returns the father.
......@@ -619,12 +581,6 @@ static ir_loop *new_loop(void)
}
/**********************************************************************/
/* Constructing and destructing the loop/backedge information. **/
/**********************************************************************/
/* Initialization steps. **********************************************/
static void init_scc(struct obstack *obst)
{
size_t i, n_irgs;
......@@ -807,11 +763,6 @@ static ir_graph *find_tail(const ir_graph *n)
return get_irg_callee(m, res_index);
}
/*-----------------------------------------------------------*
* The core algorithm. *
*-----------------------------------------------------------*/
static void cgscc(ir_graph *n)
{
size_t i, n_callees;
......@@ -904,11 +855,6 @@ static void reset_isbe(void)
}
}
/* ----------------------------------------------------------------------------------- */
/* The recursion stuff driver. */
/* ----------------------------------------------------------------------------------- */
/* Compute the backedges that represent recursions. */
void find_callgraph_recursions(void)
{
size_t i, n_irgs;
......@@ -961,8 +907,6 @@ void find_callgraph_recursions(void)
irp->callgraph_state = irp_callgraph_and_calltree_consistent;
}
/* Returns the maximal loop depth of all paths from an external visible method to
this irg. */
size_t get_irg_loop_depth(const ir_graph *irg)
{
assert(irp->callgraph_state == irp_callgraph_consistent ||
......@@ -970,15 +914,12 @@ size_t get_irg_loop_depth(const ir_graph *irg)
return irg->callgraph_loop_depth;
}
/* Returns the maximal recursion depth of all paths from an external visible method to
this irg. */
size_t get_irg_recursion_depth(const ir_graph *irg)
{
assert(irp->callgraph_state == irp_callgraph_and_calltree_consistent);
return irg->callgraph_recursion_depth;
}
/* Computes the interprocedural loop nesting information. */
void analyse_loop_nesting_depth(void)
{
/* establish preconditions. */
......
......@@ -52,7 +52,6 @@ ir_cdep *(get_cdep_next)(const ir_cdep *cdep)
return _get_cdep_next(cdep);
}
/* Return a list of all control dependences of a block. */
ir_cdep *find_cdep(const ir_node *block)
{
assert(is_Block(block));
......
......@@ -797,10 +797,6 @@ static void sel_methods_dispose(void)
entities = NULL;
}
/*--------------------------------------------------------------------------*/
/* Freeing the callee arrays. */
/*--------------------------------------------------------------------------*/
static void destruct_walker(ir_node * node, void * env)
{
(void) env;
......@@ -809,10 +805,6 @@ static void destruct_walker(ir_node * node, void * env)
}
}
/*--------------------------------------------------------------------------*/
/* Main drivers. */
/*--------------------------------------------------------------------------*/
size_t cgana(ir_entity ***free_methods)
{
size_t length;
......@@ -838,22 +830,22 @@ void free_irp_callee_info(void)
}
}
/* Optimize the address expressions passed to call nodes.
*
* This optimization performs the following transformations for
* all ir graphs:
* - All SymConst operations that refer to intern methods are replaced
* by Const operations referring to the corresponding entity.
* - Sel nodes, that select entities that are not overwritten are
* replaced by Const nodes referring to the selected entity.
* - Sel nodes, for which no method exists at all are replaced by Bad
* nodes.
* - Sel nodes with a pointer input that is an Alloc node are replaced
* by Const nodes referring to the entity that implements the method in
* the type given by the Alloc node.
*/
void opt_call_addrs(void)
{
/* Optimize the address expressions passed to call nodes.
*
* This optimization performs the following transformations for
* all ir graphs:
* - All SymConst operations that refer to intern methods are replaced
* by Const operations referring to the corresponding entity.
* - Sel nodes, that select entities that are not overwritten are
* replaced by Const nodes referring to the selected entity.
* - Sel nodes, for which no method exists at all are replaced by Bad
* nodes.
* - Sel nodes with a pointer input that is an Alloc node are replaced
* by Const nodes referring to the entity that implements the method in
* the type given by the Alloc node.
*/
sel_methods_init();
sel_methods_dispose();
}
......@@ -121,10 +121,6 @@ static bool search(ir_heights_t *h, const ir_node *curr, const ir_node *tgt)
return false;
}
/**
* Check, if one node can be reached from another one, according to data
* dependence.
*/
int heights_reachable_in_block(ir_heights_t *h, const ir_node *n,
const ir_node *m)
{
......
......@@ -117,7 +117,6 @@ void fix_backedges(struct obstack *obst, ir_node *n)
assert(legal_backarray(n));
}
/* Returns non-zero if the predecessor pos is a backedge. */
int is_backedge(const ir_node *n, int pos)
{
bitset_t *ba = get_backarray(n);
......@@ -126,7 +125,6 @@ int is_backedge(const ir_node *n, int pos)
return 0;
}
/* Remarks that edge pos is a backedge. */
void set_backedge(ir_node *n, int pos)
{
bitset_t *ba = get_backarray(n);
......@@ -134,7 +132,6 @@ void set_backedge(ir_node *n, int pos)
bitset_set(ba, pos);
}
/* Remarks that edge pos is a backedge. */
void set_not_backedge(ir_node *n, int pos)
{
bitset_t *ba = get_backarray(n);
......@@ -142,7 +139,6 @@ void set_not_backedge(ir_node *n, int pos)
bitset_clear(ba, pos);
}
/* Returns non-zero if n has backedges. */
int has_backedges(const ir_node *n)
{
bitset_t *ba = get_backarray(n);
......@@ -152,7 +148,6 @@ int has_backedges(const ir_node *n)
return 0;
}
/** Sets all backedge information to zero. */
void clear_backedges(ir_node *n)
{
bitset_t *ba = get_backarray(n);
......@@ -161,7 +156,6 @@ void clear_backedges(ir_node *n)
}
}
/* Allocate a new backedge array on the obstack for given size. */
bitset_t *new_backedge_arr(struct obstack *obst, size_t size)
{
return bitset_obstack_alloc(obst, size);
......
......@@ -615,7 +615,6 @@ static void cfscc(ir_node *n)
}
}
/* Constructs control flow backedge information for irg. */
int construct_cf_backedges(ir_graph *irg)
{
ir_graph *rem = current_ir_graph;
......
......@@ -607,7 +607,6 @@ void construct_confirms(ir_graph *irg)
perform_irg_optimization(irg, &opt_confirms);
}
/* Construct a pass. */
ir_graph_pass_t *construct_confirms_pass(const char *name)
{
return def_graph_pass(name ? name : "confirm", construct_confirms);
......@@ -625,15 +624,11 @@ static void remove_confirm(ir_node *n, void *env)
exchange(n, value);
}
/*
* Remove all Confirm nodes from a graph.
*/
void remove_confirms(ir_graph *irg)
{
irg_walk_graph(irg, NULL, remove_confirm, NULL);
}
/* Construct a pass. */
ir_graph_pass_t *remove_confirms_pass(const char *name)
{
return def_graph_pass(name ? name : "rem_confirm", remove_confirms);
......
......@@ -42,10 +42,6 @@
#define get_dom_info(bl) (&(bl)->attr.block.dom)
#define get_pdom_info(bl) (&(bl)->attr.block.pdom)
/*--------------------------------------------------------------------*/
/** Accessing the dominator and post dominator data structures **/
/*--------------------------------------------------------------------*/
ir_node *get_Block_idom(const ir_node *bl)
{
assert(is_Block(bl));
......@@ -183,7 +179,6 @@ unsigned get_Block_pdom_max_subtree_pre_num(const ir_node *bl)
return get_pdom_info(bl)->max_subtree_pre_num;
}
/* Check, if a block dominates another block. */
int block_dominates(const ir_node *a, const ir_node *b)
{
const ir_dom_info *ai, *bi;
......@@ -198,13 +193,11 @@ int block_dominates(const ir_node *a, const ir_node *b)
return 0;
}
/* Check, if a block strictly dominates another block. */
int block_strictly_dominates(const ir_node *a, const ir_node *b)
{
return (a != b) && block_dominates(a, b);
}
/* Returns the smallest common dominator block of two nodes. */
ir_node *node_smallest_common_dominator(ir_node *a, ir_node *b)
{
ir_node *bl_a = is_Block(a) ? a : get_nodes_block(a);
......@@ -232,7 +225,6 @@ ir_node *node_smallest_common_dominator(ir_node *a, ir_node *b)
return dom_bl;
}
/* Returns the smallest common dominator block of all users of a node. */
ir_node *node_users_smallest_common_dominator(ir_node *irn, int handle_phi)
{
int n, j, i = 0, success;
......@@ -289,7 +281,6 @@ ir_node *node_users_smallest_common_dominator(ir_node *irn, int handle_phi)
return dom_bl;
}
/* Get the first node in the list of nodes dominated by a given block. */
ir_node *get_Block_dominated_first(const ir_node *bl)
{
......@@ -297,15 +288,12 @@ ir_node *get_Block_dominated_first(const ir_node *bl)
return get_dom_info(bl)->first;
}
/* Get the next node in a list of nodes which are dominated by some
* other node. */
ir_node *get_Block_dominated_next(const ir_node *bl)
{
assert(is_Block(bl));
return get_dom_info(bl)->next;
}
/* Check, if a block post dominates another block. */
int block_postdominates(const ir_node *a, const ir_node *b)
{
const ir_dom_info *ai, *bi;
......@@ -320,29 +308,23 @@ int block_postdominates(const ir_node *a, const ir_node *b)
return 0;
}
/* Check, if a block strictly dominates another block. */
int block_strictly_postdominates(const ir_node *a, const ir_node *b)
{
return (a != b) && block_postdominates(a, b);
}
/* Get the first node in the list of nodes post dominated by a given block. */
ir_node *get_Block_postdominated_first(const ir_node *bl)
{
assert(is_Block(bl));
return get_pdom_info(bl)->first;
}
/* Get the next node in a list of nodes which are post dominated by some
* other node. */
ir_node *get_Block_postdominated_next(const ir_node *bl)
{
assert(is_Block(bl));
return get_pdom_info(bl)->next;
}
/* Visit all nodes in the dominator subtree of a given node. */
void dom_tree_walk(ir_node *bl, irg_walk_func *pre,
irg_walk_func *post, void *env)
{
......@@ -359,7 +341,6 @@ void dom_tree_walk(ir_node *bl, irg_walk_func *pre,
post(bl, env);
}
/* Visit all nodes in the post dominator subtree of a given node. */
void postdom_tree_walk(ir_node *bl, irg_walk_func *pre,
irg_walk_func *post, void *env)
{
......@@ -376,7 +357,6 @@ void postdom_tree_walk(ir_node *bl, irg_walk_func *pre,
post(bl, env);
}
/* Walk over the dominator tree of an irg starting at the root. */
void dom_tree_walk_irg(ir_graph *irg, irg_walk_func *pre,
irg_walk_func *post, void *env)
{
......@@ -391,7 +371,6 @@ void dom_tree_walk_irg(ir_graph *irg, irg_walk_func *pre,
dom_tree_walk(root, pre, post, env);
}
/* Walk over the post dominator tree of an irg starting at the root. */
void postdom_tree_walk_irg(ir_graph *irg, irg_walk_func *pre,
irg_walk_func *post, void *env)
{
......@@ -459,10 +438,6 @@ static void assign_tree_postdom_pre_order_max(ir_node *bl, void *data)
assert(bi->max_subtree_pre_num >= bi->tree_pre_num);
}
/*--------------------------------------------------------------------*/
/* Building and Removing the dominator data structure */
/*--------------------------------------------------------------------*/
/**
* count the number of blocks and clears the post dominance info
*/
......@@ -639,7 +614,6 @@ static void count_and_init_blocks_dom(ir_node *bl, void *env)
set_Block_dom_depth(bl, -1);
}
/* Computes the dominator trees. */
void compute_doms(ir_graph *irg)
{
ir_graph *rem = current_ir_graph;
......@@ -785,7 +759,6 @@ void free_dom(ir_graph *irg)
but better call it anyways... */
}
/* Computes the post dominator trees. */
void compute_postdoms(ir_graph *irg)
{
ir_graph *rem = current_ir_graph;
......
......@@ -197,9 +197,6 @@ static void post_walk_calc_extbb(ir_node *block, void *ctx)
}
}
/*
* Compute the extended basic blocks for a graph
*/
void compute_extbb(ir_graph *irg)
{
env_t env;
......@@ -268,7 +265,6 @@ void compute_extbb(ir_graph *irg)
set_irg_state(irg, IR_GRAPH_STATE_VALID_EXTENDED_BLOCKS);
}
/* free all extended block info. */
void free_extbb(ir_graph *irg)
{
if (irg->extbb_obst) {
......@@ -279,74 +275,62 @@ void free_extbb(ir_graph *irg)
clear_irg_state(irg, IR_GRAPH_STATE_VALID_EXTENDED_BLOCKS);
}
/* Return the extended block of a node. */
ir_extblk *get_nodes_extbb(const ir_node *node)
{
const ir_node *block = is_Block(node) ? node : get_nodes_block(node);
return get_Block_extbb(block);
}
/* Gets the visited counter of an extended block. */
ir_visited_t (get_extbb_visited)(const ir_extblk *blk)
{
return _get_extbb_visited(blk);
}
/* Sets the visited counter of an extended block. */
void (set_extbb_visited)(ir_extblk *blk, ir_visited_t visited)
{
_set_extbb_visited(blk, visited);
}
/* Mark an extended block as visited in a graph. */
void (mark_extbb_visited)(ir_extblk *blk)
{
_mark_extbb_visited(blk);
}
/* Returns non-zero if an extended was visited. */
int (extbb_visited)(const ir_extblk *blk)
{
return _extbb_visited(blk);
}
/* Returns non-zero if an extended block was NOT visited. */
int (extbb_not_visited)(const ir_extblk *blk)
{
return _extbb_not_visited(blk);
}
/* Returns the link field of an extended block. */
void *(get_extbb_link)(const ir_extblk *blk)
{
return _get_extbb_link(blk);
}
/* Sets the link field of an extended block. */
void (set_extbb_link)(ir_extblk *blk, void *link)
{
_set_extbb_link(blk, link);
}
/* Return the number of basic blocks of an extended block */
int (get_extbb_n_blocks)(const ir_extblk *blk)
{
return _get_extbb_n_blocks(blk);