From: Götz Lindenmaier Date: Tue, 18 Jan 2005 18:32:48 +0000 (+0000) Subject: added and fixed comments X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=64d38975c523c9cfe4a3890af23e9192f557e293;p=libfirm added and fixed comments [r4948] --- diff --git a/ir/adt/array.h b/ir/adt/array.h index 5ec4fa494..76eaf2bc3 100644 --- a/ir/adt/array.h +++ b/ir/adt/array.h @@ -134,7 +134,7 @@ /** * Create an automatic array which will be deleted at return from function. - * Beware, the data will be allocated un the functions stack! + * Beware, the data will be allocated on the function stack! * * @param type The element type of the new array. * @param var A lvalue of type (type *) which will hold the new array. diff --git a/ir/adt/eset.h b/ir/adt/eset.h index 60df1614f..430117ab2 100644 --- a/ir/adt/eset.h +++ b/ir/adt/eset.h @@ -16,7 +16,7 @@ /** * "eset" is a set of addresses. The addresses are used for element * compare and hash calculation. - * The value "NULL" could not be stored, as it is used as internal sentinel. + * The value "NULL" can not be stored, as it is used as internal sentinel. */ typedef struct eset eset; @@ -24,7 +24,7 @@ typedef struct eset eset; eset *eset_create(void); /** - * Creates a copy of the given set. Did NOT work if NULL is contained in source. */ + * Creates a copy of the given set. Does NOT work if NULL is contained in source. */ eset *eset_copy(eset *source); /** Deletes a set. */ diff --git a/ir/adt/hashptr.h b/ir/adt/hashptr.h index cc02b3497..ff325c729 100644 --- a/ir/adt/hashptr.h +++ b/ir/adt/hashptr.h @@ -14,8 +14,8 @@ #include "firm_config.h" -#define _FIRM_FNV_OFFSET_BASIS 2166136261 -#define _FIRM_FNV_FNV_PRIME 16777619 +#define _FIRM_FNV_OFFSET_BASIS 2166136261U +#define _FIRM_FNV_FNV_PRIME 16777619U static INLINE unsigned firm_fnv_hash(const unsigned char *data, unsigned bytes) { diff --git a/ir/ana/interval_analysis.c b/ir/ana/interval_analysis.c index 96b4e9443..a6c9ee7d0 100644 --- a/ir/ana/interval_analysis.c +++ b/ir/ana/interval_analysis.c @@ -306,7 +306,6 @@ void construct_intervals(ir_graph *irg) { construct_cf_backedges(current_ir_graph); - l = get_irg_loop(current_ir_graph); construct_interval_edges(l); diff --git a/ir/ana/interval_analysis.h b/ir/ana/interval_analysis.h index db4637c62..1562e5e44 100644 --- a/ir/ana/interval_analysis.h +++ b/ir/ana/interval_analysis.h @@ -11,20 +11,20 @@ */ /** -* @file interval_analysis.h -* -* Decompost control flow graph into acylic, hierarchic intervals. -* -* @author Goetz Lindenmaier -* -* The analysis is based on the control flow looptree. An intervall are basically -* all nodes in a single ir_loop entry, i.e., basic blocks and inner loop nodes. -* The analysis computes a new set of edges that link all nodes of a loop to an -* acyclic graph. -* -* -* -*/ + * @file interval_analysis.h + * + * Decompost control flow graph into acylic, hierarchic intervals. + * + * @author Goetz Lindenmaier + * + * The analysis is based on the control flow looptree. An intervall are basically + * all nodes in a single ir_loop entry, i.e., basic blocks and inner loop nodes. + * The analysis computes a new set of edges that link all nodes of a loop to an + * acyclic graph. + * + * + * + */ #ifndef _INTERVAL_ANALYSIS_H_ #define _INTERVAL_ANALYSIS_H_ @@ -46,7 +46,7 @@ void add_region_in (void *region, void *in); * * This number is useful for evaluation of execution frequencies. */ -int get_region_n_outs(void *region); +int get_region_n_outs(void *region); int get_region_n_exc_outs(void *region); /** The control flow operation corresponding to the loop-region in at @@ -55,16 +55,16 @@ int get_region_n_exc_outs(void *region); void *get_loop_cfop(void *region, int pos); - - /** The algorithm to construct the interval graph. + * + * Constructs the cf loop tree and leaves a valid version of it. * * @todo: @@@ add flag that states correctness of interval analysis information * to irg. **/ - void construct_intervals(ir_graph *irg); + /** frees interval information of all graphs. */ void free_intervals(void); diff --git a/ir/ana/irdom_t.h b/ir/ana/irdom_t.h index e5441fb85..9137bc43c 100644 --- a/ir/ana/irdom_t.h +++ b/ir/ana/irdom_t.h @@ -29,14 +29,14 @@ /** For dominator information */ typedef struct dom_info { struct ir_node *idom; /**< immediate CFG dominator */ - struct ir_node *next; /**< The next node in the dominated - list of @c idom. */ - struct ir_node *first; /**< The first node in the list of nodes - this nodes dominates immediately. */ - int tree_pre_num; /**< The pre-order number from a dfs walk - over the dominator tree. */ - int max_subtree_pre_num; /**< The largest tree pre num found in the - dominator subtree of this node. */ + struct ir_node *next; /**< The next node in the dominated + list of @c idom. */ + struct ir_node *first; /**< The first node in the list of nodes + this nodes dominates immediately. */ + int tree_pre_num; /**< The pre-order number from a dfs walk + over the dominator tree. */ + int max_subtree_pre_num; /**< The largest tree pre num found in the + dominator subtree of this node. */ int pre_num; /**< pre-order graph-walk number */ int dom_depth; /**< depth in dominator-tree */ } dom_info; diff --git a/ir/common/Makefile.in b/ir/common/Makefile.in index 4678fecca..e8830b7e5 100644 --- a/ir/common/Makefile.in +++ b/ir/common/Makefile.in @@ -15,13 +15,13 @@ srcdir = @srcdir@ topdir = ../.. subdir := ir/common -INSTALL_HEADERS := firm_common.h firm.h firmwalk.h statistics.h old_fctnames.h debug.h +INSTALL_HEADERS := firm_common.h firm.h firmwalk.h statistics.h debug.h SOURCES = $(INSTALL_HEADERS) SOURCES += Makefile.in \ panic.c firm_common.c firm.c firmwalk.c \ - panic.h firm_common_t.h statistics.c debug.c + panic.h firm_common_t.h statistics.c debug.c old_fctnames.h include $(topdir)/MakeRules diff --git a/ir/ir/irgmod.h b/ir/ir/irgmod.h index 9bcf5325d..55cdd53a9 100644 --- a/ir/ir/irgmod.h +++ b/ir/ir/irgmod.h @@ -47,6 +47,7 @@ void turn_into_tuple (ir_node *node, int arity); * Further it collects all Proj nodes in a list of the node producing * the tuple. In case of nested tuples the Projs are collected in the * node producing the outermost Tuple. + * All other link fields are cleared afterwards. */ void collect_phiprojs(ir_graph *irg); diff --git a/ir/ir/irgopt.c b/ir/ir/irgopt.c index fab7e1ee1..f19c7724f 100644 --- a/ir/ir/irgopt.c +++ b/ir/ir/irgopt.c @@ -207,9 +207,10 @@ static INLINE void new_backedge_info(ir_node *n) { * * @param n The node to be copied * @param env if non-NULL, the node number attribute will be copied to the new node + * + * Note: Also used for loop unrolling. */ -static void -copy_node (ir_node *n, void *env) { +void copy_node (ir_node *n, void *env) { ir_node *nn, *block; int new_arity; opcode op = get_irn_opcode(n); diff --git a/ir/ir/irnode.h b/ir/ir/irnode.h index aa96f26a5..dbdf668d2 100644 --- a/ir/ir/irnode.h +++ b/ir/ir/irnode.h @@ -120,8 +120,8 @@ int get_irn_inter_arity (const ir_node *node); Assumes that current_ir_graph is set to the graph containing "node". "in" must contain all predecessors except the block that are required for the nodes opcode. */ -void set_irn_in (ir_node *node, int arity, - ir_node *in[]); +void set_irn_in (ir_node *node, int arity, ir_node *in[]); + /* to iterate through the predecessors without touching the array. No order of predecessors guaranteed. To iterate over the operands iterate from 0 to i < get_irn_arity(), @@ -893,7 +893,7 @@ int is_cfop(const ir_node *node); int is_ip_cfop(const ir_node *node); /** Returns true if the operation can change the control flow because of an exception: Call, Quot, DivMod, Div, Mod, Load, Store, Alloc, - Bad. */ + Bad. Raise is not fragile, but a unconditional jump. */ int is_fragile_op(const ir_node *node); /** Returns the memory operand of fragile operations. */ ir_node *get_fragile_op_mem(ir_node *node); diff --git a/ir/ir/irnode_t.h b/ir/ir/irnode_t.h index 832dfee0e..084c9634a 100644 --- a/ir/ir/irnode_t.h +++ b/ir/ir/irnode_t.h @@ -136,16 +136,10 @@ typedef struct { /** EndReg/EndExcept attributes */ typedef struct { char dummy; - /* ir_graph * irg; */ /**< ir_graph this node belongs to (for */ - /* * navigating in interprocedural graphs) */ - /* @@@ now in block */ } end_attr; /** CallBegin attributes */ typedef struct { - /* ir_graph * irg; */ /**< ir_graph this node belongs to (for */ - /* * navigating in interprocedural graphs) */ - /* @@@ now in block */ ir_node * call; /**< associated Call-operation */ } callbegin_attr; @@ -193,8 +187,8 @@ typedef union { node takes the role of the obsolete Phi0 node, therefore the name. */ int *phi_backedge; /**< For Phi after construction. - Field n set to true if pred n is backedge. - @todo Ev. replace by bitfield! */ + Field n set to true if pred n is backedge. + @todo Ev. replace by bitfield! */ long proj; /**< For Proj: contains the result position to project */ confirm_attr confirm_cmp; /**< For Confirm: compare operation */ filter_attr filter; /**< For Filter */ @@ -472,7 +466,7 @@ __set_irn_link(ir_node *node, void *link) { */ static INLINE void * __get_irn_link(const ir_node *node) { - assert (node); + assert (node && is_ir_node(node)); return node->link; } @@ -482,6 +476,7 @@ __get_irn_link(const ir_node *node) { */ static INLINE op_pin_state __get_irn_pinned(const ir_node *node) { + assert(node && is_ir_node(node)); op_pin_state state = __get_op_pinned(__get_irn_op(node)); if (state >= op_pin_state_exc_pinned) return get_opt_fragile_ops() ? node->attr.except.pin_state : op_pin_state_pinned; @@ -490,11 +485,13 @@ __get_irn_pinned(const ir_node *node) { static INLINE int __is_unop(const ir_node *node) { + assert(node && is_ir_node(node)); return (node->op->opar == oparity_unary); } static INLINE int __is_binop(const ir_node *node) { + assert(node && is_ir_node(node)); return (node->op->opar == oparity_binary); } @@ -506,13 +503,13 @@ __is_Bad(const ir_node *node) { static INLINE int __is_no_Block(const ir_node *node) { - assert(node); + assert(node && is_ir_node(node)); return (__get_irn_op(node) != op_Block); } static INLINE int __is_Block(const ir_node *node) { - assert(node); + assert(node && is_ir_node(node)); return (__get_irn_op(node) == op_Block); } diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index 52a2f0da6..33def92b3 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -2115,6 +2115,7 @@ gigo (ir_node *node) and replacing the control flow by Bad. */ if (get_irn_mode(node) == mode_X) { ir_node *block = get_nodes_block(node); + if (!get_Block_matured(block)) return node; /* Don't optimize nodes in immature blocks. */ if (op == op_End) return node; /* Don't optimize End, may have Bads. */ if (get_irn_op(block) == op_Block && get_Block_matured(block)) {