X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fana%2Firloop.h;h=6672a129162612ebc67bf55f0894c58870660a2f;hb=d0d85962ef52c14950db90e5981a7bea36023ab3;hp=424146d76322c029592fbd16593bba05fc05a39e;hpb=32745b2ad1a6286b79f5af48768507e1866134fd;p=libfirm diff --git a/ir/ana/irloop.h b/ir/ana/irloop.h index 424146d76..6672a1291 100644 --- a/ir/ana/irloop.h +++ b/ir/ana/irloop.h @@ -11,15 +11,15 @@ */ /** -* @file irloop.h -* -* Computes backedges in the control and data flow. -* -* @author Goetz Lindenmaier -* -* Only Block and Phi/Filter nodes can have incoming backedges. -* Constructs loops data structure: indicates loop nesting. -*/ + * @file irloop.h + * + * Computes backedges in the control and data flow. + * + * @author Goetz Lindenmaier + * + * Only Block and Phi/Filter nodes can have incoming backedges. + * Constructs loops data structure: indicates loop nesting. + */ # ifndef _IRLOOP_H_ # define _IRLOOP_H_ @@ -39,30 +39,31 @@ */ /* ------------------------------------------------------------------- */ -/** Returns true if the predesessor pos is a backedge. */ +/** Returns true if the predecessor pos is a backedge in the interprozeduralem view. */ int is_inter_backedge(ir_node *n, int pos); +/** Returns true if the predecessor pos is a backedge in the intraprocedural view. */ int is_intra_backedge(ir_node *n, int pos); /** Returns non-zero if the predecessor pos is a backedge. */ int is_backedge (ir_node *n, int pos); -/** Remarks that edge pos is a backedge. */ +/** Marks edge pos as a backedge. */ void set_backedge (ir_node *n, int pos); -/** Remarks that edge pos is not a backedge. */ +/** Marks edge pos as a non-backedge. */ void set_not_backedge (ir_node *n, int pos); /** Returns non-zero if n has backedges. */ int has_backedges (ir_node *n); -/** Sets backedge information to zero. */ +/** Clears all backedge information. */ void clear_backedges (ir_node *n); /* ------------------------------------------------------------------- */ /** - * The loops datastructure. + * The loops data structure. * - * The loops datastructure represents circles in the intermediate + * The loops data structure represents circles in the intermediate * representation. It does not represent loops in the terms of a * source program. - * Each ir_graph can contain one outermost loop datastructure. + * Each ir_graph can contain one outermost loop data structure. * loop is the entry point to the nested loops. - * The loop datastructure contains a field indicating the depth of + * The loop data structure contains a field indicating the depth of * the loop within the nesting. Further it contains a list of the * loops with nesting depth -1. Finally it contains a list of all * nodes in the loop. @@ -71,7 +72,10 @@ void clear_backedges (ir_node *n); * this would cost a lot of memory, though. */ /* ------------------------------------------------------------------- */ +#ifndef _IR_LOOP_TYPEDEF_ +#define _IR_LOOP_TYPEDEF_ typedef struct ir_loop ir_loop; +#endif /** Loop elements: loop nodes and ir nodes */ typedef union { @@ -89,16 +93,16 @@ void set_irg_loop(ir_graph *irg, ir_loop *l); ir_loop *get_irg_loop(ir_graph *irg); /** Returns the loop n is contained in. NULL if node is in no loop. */ -ir_loop *get_irn_loop(ir_node *n); +ir_loop *get_irn_loop(const ir_node *n); /** Returns outer loop, itself if outermost. */ -ir_loop *get_loop_outer_loop (ir_loop *loop); +ir_loop *get_loop_outer_loop (const ir_loop *loop); /** Returns nesting depth of this loop */ -int get_loop_depth (ir_loop *loop); +int get_loop_depth (const ir_loop *loop); /* Sons are the inner loops contained in this loop. */ /** Returns the number of inner loops */ -int get_loop_n_sons (ir_loop *loop); +int get_loop_n_sons (const ir_loop *loop); /** Returns the pos`th son loop (inner loop) of a loop. Returns NULL if there is not a pos`th loop_node. */ @@ -112,19 +116,20 @@ int get_loop_n_nodes (ir_loop *loop); ir_node *get_loop_node (ir_loop *loop, int pos); /** Returns the number of elements contained in loop. */ -int get_loop_n_elements (ir_loop *loop); +int get_loop_n_elements (const ir_loop *loop); + /** Returns a loop element. A loop element can be interpreted as a kind pointer, an ir_node* or an ir_loop*. */ -loop_element get_loop_element (ir_loop *loop, int pos); +loop_element get_loop_element (const ir_loop *loop, int pos); /** Returns the element number of the loop son in loop. * Returns -1 if not found. O(|elements|). */ -int get_loop_element_pos(ir_loop *loop, void *le); +int get_loop_element_pos(const ir_loop *loop, void *le); /** Returns a unique node number for the loop node to make output readable. If libfirm_debug is not set it returns the loop cast to int. */ -int get_loop_loop_nr(ir_loop *loop); +int get_loop_loop_nr(const ir_loop *loop); /** A field to connect additional information to a loop. Only valid if libfirm_debug is set, else returns NULL. */ @@ -142,6 +147,8 @@ void *get_loop_link (const ir_loop *loop); * The resulting loop tree is a possible visiting order for dataflow * analysis. * + * This algorithm destoyes the link field of block nodes. + * * @returns Maximal depth of loop tree. * * @remark @@ -179,7 +186,10 @@ int construct_ip_backedges(void); * This algorithm computes only back edge information for Block nodes, not * for Phi nodes. * - * @returns Maximal depth of loop tree. */ + * This algorithm destoyes the link field of block nodes. + * + * @returns Maximal depth of loop tree. + */ int construct_cf_backedges(ir_graph *irg); /** Construct interprocedural loop tree for control flow.