3 * File name: ir/ana/irloop_t.h
4 * Purpose: Loop datastructure and access functions -- private stuff.
5 * Author: Goetz Lindenmaier
9 * Copyright: (c) 2002-2003 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
15 * Loop datastructure and access functions -- private stuff.
17 * @author Goetz Lindenmaier
20 #include "firm_common.h"
21 #include "irgraph_t.h"
28 * Possible loop flags, can be or'ed.
30 typedef enum loop_flags {
31 loop_is_count_loop = 0x00000001, /**< if set it's a counting loop */
32 loop_downto_loop = 0x00000002, /**< if set, it's a downto loop, else an upto loop */
33 loop_is_endless = 0x00000004, /**< if set, this is an endless loop */
34 loop_is_dead = 0x00000008, /**< if set, it's a dead loop ie will never be entered */
35 loop_wrap_around = 0x00000010, /**< this loop is NOT endless, because of wrap around */
36 loop_end_false = 0x00000020, /**< this loop end can't be computed "from compute_loop_info.c" */
37 do_loop = 0x00000040, /**< this is a do loop */
38 once = 0x00000080, /**< this is a do loop, with a false condition.It itarate once */
41 /** The loops datastructure. */
43 firm_kind kind; /**< A type tag, set to k_ir_loop. */
45 struct ir_loop *outer_loop; /**< The outer loop */
46 loop_element *children; /**< Mixed array: Contains sons and loop_nodes */
47 int depth; /**< Nesting depth */
48 int n_sons; /**< Number of ir_nodes in array "children" */
49 int n_nodes; /**< Number of loop_nodes in array "children" */
50 unsigned flags; /**< a set of loop_flags_t */
51 tarval *loop_iter_start; /**< counting loop: the start value */
52 tarval *loop_iter_end; /**< counting loop: the last value reached */
53 tarval *loop_iter_increment; /**< counting loop: the increment */
54 ir_node *loop_iter_variable; /**< The iteration variable of counting loop.*/
57 struct state_entry *mem_phis;
58 struct state_entry *states;
61 struct loop_node *link;
64 long loop_nr; /**< a unique node number for each loop node to make output
66 void *link; /**< GL @@@ For debugging the analyses. */
71 /** Add a son loop to a father loop. */
72 void add_loop_son(ir_loop *loop, ir_loop *son);
74 /** Add a node to a loop. */
75 void add_loop_node(ir_loop *loop, ir_node *n);
77 /** Sets the loop a node belonging to. */
78 void set_irn_loop(ir_node *n, ir_loop *loop);
80 /* -------- INLINE functions -------- */
83 _is_ir_loop(const void *thing) {
84 return (get_kind(thing) == k_ir_loop);
88 _set_irg_loop(ir_graph *irg, ir_loop *loop) {
93 static INLINE ir_loop *
94 _get_irg_loop(ir_graph *irg) {
99 #define is_ir_loop(thing) _is_ir_loop(thing)
100 #define set_irg_loop(irg, loop) _set_irg_loop(irg, loop)
101 #define get_irg_loop(irg) _get_irg_loop(irg)
103 #endif /* _IRLOOP_T_H_ */