1 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
8 * Declarations of an ir node.
10 * @author Martin Trapp, Christian Schaefer
24 # include "firm_common_t.h"
25 # include "irdom_t.h" /* For size of struct dom_info. */
30 /** ir node attributes **/
32 /** Block attributes */
34 unsigned long block_visited; /**< for the walker that walks over all blocks. */
35 /* Attributes private to construction: */
36 bool matured; /**< if set, all in-nodes of the block are fixed */
37 struct ir_node **graph_arr; /**< array to store all parameters */
38 struct dom_info dom; /**< Datastructure that holds information about dominators.
40 Eventually overlay with graph_arr as only valid
41 in different phases. Eventually inline the whole
43 exc_t exc; /**< role of this block for exception handling */
44 ir_node *handler_entry; /**< handler entry block iff this block is part of a region */
45 ir_node ** in_cg; /**< array with predecessors in
46 * interprocedural_view, if they differ
47 * from intraprocedural predecessors */
48 int *backedge; /**< Field n set to true if pred n is backedge.
49 @todo Ev. replace by bitfield! */
50 int *cg_backedge; /**< Field n set to true if pred n is interprocedural backedge.
51 @todo Ev. replace by bitfield! */
54 /** Cond attributes */
56 cond_kind kind; /**< flavor of Cond */
57 long default_proj; /**< for optimization: biggest Proj number, i.e. the one
61 /** SymConst attributes
62 This union contains the symbolic information represented by the node */
63 typedef union type_or_id {
75 entity *ent; /**< entity to select */
79 type *cld_tp; /**< type of called procedure */
80 #if PRECISE_EXC_CONTEXT
81 struct ir_node **frag_arr; /**< For Phi node construction in case of exceptions */
83 entity ** callee_arr; /**< result of callee analysis */
86 /** Alloc attributes */
88 type *type; /**< Type of the allocated object. */
89 where_alloc where; /**< stack, heap or other managed part of memory */
90 #if PRECISE_EXC_CONTEXT
91 struct ir_node **frag_arr; /**< For Phi node construction in case of exceptions */
95 /** InstOf attributes */
102 /** Filter attributes */
104 long proj; /**< contains the result position to project (Proj) */
105 ir_node ** in_cg; /**< array with interprocedural predecessors (Phi) */
106 int *backedge; /**< Field n set to true if pred n is backedge.
107 @todo Ev. replace by bitfield! */
110 /** EndReg/EndExcept attributes */
112 ir_graph * irg; /**< ir_graph this node belongs to (for
113 * navigating in interprocedural graphs) */
116 /** CallBegin attributes */
118 ir_graph * irg; /**< ir_graph this node belongs to (for
119 * navigating in interprocedural graphs) */
120 ir_node * call; /**< associated Call-operation */
123 /** Some irnodes just have one attribute, these are stored here,
124 some have more. Their name is 'irnodename_attr' */
126 block_attr block; /**< For Block: Fields needed to construct it */
127 cond_attr c; /**< For Cond. */
128 struct tarval *con; /**< For Const: contains the value of the constant */
129 symconst_attr i; /**< For SymConst. */
130 sel_attr s; /**< For Sel. */
131 call_attr call; /**< For Call: pointer to the type of the method to call */
132 callbegin_attr callbegin; /**< For CallBegin */
133 alloc_attr a; /**< For Alloc. */
134 io_attr io; /**< For InstOf */
135 type *f; /**< For Free. */
136 int phi0_pos; /**< For Phi. Used to remember the value defined by
137 this Phi node. Needed when the Phi is completed
138 to call get_r_internal_value to find the
139 predecessors. If this attribute is set, the Phi
140 node takes the role of the obsolete Phi0 node,
141 therefore the name. */
142 int *phi_backedge; /**< For Phi after construction.
143 Field n set to true if pred n is backedge.
144 @todo Ev. replace by bitfield! */
145 long proj; /**< For Proj: contains the result position to project */
146 filter_attr filter; /**< For Filter */
147 end_attr end; /**< For EndReg, EndExcept */
148 #if PRECISE_EXC_CONTEXT
149 struct ir_node **frag_arr; /**< For Phi node construction in case of exceptions
150 for nodes Store, Load, Div, Mod, Quot, DivMod. */
155 /** common structure of an irnode
156 if the node has some attributes, they are stored in attr */
158 /* ------- Basics of the representation ------- */
159 firm_kind kind; /**< distinguishes this node from others */
160 ir_op *op; /**< Opcode of this node. */
161 ir_mode *mode; /**< Mode of this node. */
162 unsigned long visited; /**< visited counter for walks of the graph */
163 struct ir_node **in; /**< array with predecessors / operands */
164 void *link; /**< to attach additional information to the node, e.g.
165 used while construction to link Phi0 nodes and
166 during optimization to link to nodes that
167 shall replace a node. */
168 /* ------- Fields for optimizations / analysis information ------- */
169 struct ir_node **out; /**< array of out edges */
170 struct dbg_info* dbi; /**< A pointer to information for debug support. */
171 /* ------- For debugging ------- */
173 int node_nr; /**< a unique node number for each node to make output
176 attr attr; /**< attribute of this node. Depends on opcode.
177 Must be last field of struct ir_node. */
180 /** Copies all attributes stored in the old node to the new node.
181 Assumes both have the same opcode and sufficient size. */
183 copy_attrs (ir_node *old, ir_node *new);
186 /** Returns the array with the ins. The content of the array may not be
188 ir_node **get_irn_in (const ir_node *node);
191 /** access attributes directly */
192 INLINE tarval *get_irn_const_attr (ir_node *node);
193 INLINE long get_irn_proj_attr (ir_node *node);
194 INLINE alloc_attr get_irn_alloc_attr (ir_node *node);
195 INLINE type *get_irn_free_attr (ir_node *node);
196 INLINE symconst_attr get_irn_symconst_attr (ir_node *node);
197 type *get_irn_call_attr (ir_node *node);
198 sel_attr get_irn_sel_attr (ir_node *node);
199 int get_irn_phi_attr (ir_node *node);
200 block_attr get_irn_block_attr (ir_node *node);
203 # endif /* _IRNODE_T_H_ */