3 * File name: ir/ir/irnode_t.h
4 * Purpose: Representation of an intermediate operation -- private header.
5 * Author: Martin Trapp, Christian Schaefer
6 * Modified by: Goetz Lindenmaier
9 * Copyright: (c) 1998-2003 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
17 * Declarations of an ir node.
19 * @author Martin Trapp, Christian Schaefer
32 # include "firm_common_t.h"
33 # include "irdom_t.h" /* For size of struct dom_info. */
38 /** ir node attributes **/
40 /** Block attributes */
42 unsigned long block_visited; /**< for the walker that walks over all blocks. */
43 /* Attributes private to construction: */
44 bool matured; /**< if set, all in-nodes of the block are fixed */
45 struct ir_node **graph_arr; /**< array to store all parameters */
46 struct dom_info dom; /**< Datastructure that holds information about dominators.
48 Eventually overlay with graph_arr as only valid
49 in different phases. Eventually inline the whole
51 exc_t exc; /**< role of this block for exception handling */
52 ir_node *handler_entry; /**< handler entry block iff this block is part of a region */
53 ir_node ** in_cg; /**< array with predecessors in
54 * interprocedural_view, if they differ
55 * from intraprocedural predecessors */
56 int *backedge; /**< Field n set to true if pred n is backedge.
57 @todo Ev. replace by bitfield! */
58 int *cg_backedge; /**< Field n set to true if pred n is interprocedural backedge.
59 @todo Ev. replace by bitfield! */
62 /** Start attributes */
67 /** Cond attributes */
69 cond_kind kind; /**< flavor of Cond */
70 long default_proj; /**< for optimization: biggest Proj number, i.e. the one
74 /** Const attributes */
76 tarval *tv; /**< the target value */
77 type *tp; /**< the source type, for analyses. default: type_unknown. */
80 /** SymConst attributes
81 This union contains the symbolic information represented by the node */
82 typedef union type_or_id {
94 entity *ent; /**< entity to select */
98 type *cld_tp; /**< type of called procedure */
99 #if PRECISE_EXC_CONTEXT
100 struct ir_node **frag_arr; /**< For Phi node construction in case of exceptions */
102 entity ** callee_arr; /**< result of callee analysis */
105 /** Alloc attributes */
107 type *type; /**< Type of the allocated object. */
108 where_alloc where; /**< stack, heap or other managed part of memory */
109 #if PRECISE_EXC_CONTEXT
110 struct ir_node **frag_arr; /**< For Phi node construction in case of exceptions */
114 /** InstOf attributes */
121 /** Filter attributes */
123 long proj; /**< contains the result position to project (Proj) */
124 ir_node ** in_cg; /**< array with interprocedural predecessors (Phi) */
125 int *backedge; /**< Field n set to true if pred n is backedge.
126 @todo Ev. replace by bitfield! */
129 /** EndReg/EndExcept attributes */
131 ir_graph * irg; /**< ir_graph this node belongs to (for
132 * navigating in interprocedural graphs) */
135 /** CallBegin attributes */
137 ir_graph * irg; /**< ir_graph this node belongs to (for
138 * navigating in interprocedural graphs) */
139 ir_node * call; /**< associated Call-operation */
142 /** Cast attributes */
147 /** Some irnodes just have one attribute, these are stored here,
148 some have more. Their name is 'irnodename_attr' */
150 start_attr start; /**< For Start */
151 block_attr block; /**< For Block: Fields needed to construct it */
152 cond_attr c; /**< For Cond. */
153 const_attr con; /**< For Const: contains the value of the constant and a type */
154 symconst_attr i; /**< For SymConst. */
155 sel_attr s; /**< For Sel. */
156 call_attr call; /**< For Call: pointer to the type of the method to call */
157 callbegin_attr callbegin; /**< For CallBegin */
158 alloc_attr a; /**< For Alloc. */
159 io_attr io; /**< For InstOf */
160 type *f; /**< For Free. */
161 cast_attr cast; /**< For Cast. */
162 int phi0_pos; /**< For Phi. Used to remember the value defined by
163 this Phi node. Needed when the Phi is completed
164 to call get_r_internal_value to find the
165 predecessors. If this attribute is set, the Phi
166 node takes the role of the obsolete Phi0 node,
167 therefore the name. */
168 int *phi_backedge; /**< For Phi after construction.
169 Field n set to true if pred n is backedge.
170 @todo Ev. replace by bitfield! */
171 long proj; /**< For Proj: contains the result position to project */
172 filter_attr filter; /**< For Filter */
173 end_attr end; /**< For EndReg, EndExcept */
174 #if PRECISE_EXC_CONTEXT
175 struct ir_node **frag_arr; /**< For Phi node construction in case of exceptions
176 for nodes Store, Load, Div, Mod, Quot, DivMod. */
181 /** common structure of an irnode
182 if the node has some attributes, they are stored in attr */
184 /* ------- Basics of the representation ------- */
185 firm_kind kind; /**< distinguishes this node from others */
186 ir_op *op; /**< Opcode of this node. */
187 ir_mode *mode; /**< Mode of this node. */
188 unsigned long visited; /**< visited counter for walks of the graph */
189 struct ir_node **in; /**< array with predecessors / operands */
190 void *link; /**< to attach additional information to the node, e.g.
191 used while construction to link Phi0 nodes and
192 during optimization to link to nodes that
193 shall replace a node. */
194 /* ------- Fields for optimizations / analysis information ------- */
195 struct ir_node **out; /**< array of out edges */
196 struct dbg_info* dbi; /**< A pointer to information for debug support. */
197 /* ------- For debugging ------- */
199 int node_nr; /**< a unique node number for each node to make output
202 attr attr; /**< attribute of this node. Depends on opcode.
203 Must be last field of struct ir_node. */
206 /** Copies all attributes stored in the old node to the new node.
207 Assumes both have the same opcode and sufficient size. */
209 copy_attrs (ir_node *old, ir_node *new);
212 /** Returns the array with the ins. The content of the array may not be
214 ir_node **get_irn_in (const ir_node *node);
217 /** access attributes directly */
218 INLINE const_attr get_irn_const_attr (ir_node *node);
219 INLINE long get_irn_proj_attr (ir_node *node);
220 INLINE alloc_attr get_irn_alloc_attr (ir_node *node);
221 INLINE type *get_irn_free_attr (ir_node *node);
222 INLINE symconst_attr get_irn_symconst_attr (ir_node *node);
223 type *get_irn_call_attr (ir_node *node);
224 sel_attr get_irn_sel_attr (ir_node *node);
225 int get_irn_phi_attr (ir_node *node);
226 block_attr get_irn_block_attr (ir_node *node);
229 # endif /* _IRNODE_T_H_ */