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 /** Cast attributes */
128 /** Some irnodes just have one attribute, these are stored here,
129 some have more. Their name is 'irnodename_attr' */
131 block_attr block; /**< For Block: Fields needed to construct it */
132 cond_attr c; /**< For Cond. */
133 struct tarval *con; /**< For Const: contains the value of the constant */
134 symconst_attr i; /**< For SymConst. */
135 sel_attr s; /**< For Sel. */
136 call_attr call; /**< For Call: pointer to the type of the method to call */
137 callbegin_attr callbegin; /**< For CallBegin */
138 alloc_attr a; /**< For Alloc. */
139 io_attr io; /**< For InstOf */
140 type *f; /**< For Free. */
141 cast_attr cast; /**< For Cast. */
142 int phi0_pos; /**< For Phi. Used to remember the value defined by
143 this Phi node. Needed when the Phi is completed
144 to call get_r_internal_value to find the
145 predecessors. If this attribute is set, the Phi
146 node takes the role of the obsolete Phi0 node,
147 therefore the name. */
148 int *phi_backedge; /**< For Phi after construction.
149 Field n set to true if pred n is backedge.
150 @todo Ev. replace by bitfield! */
151 long proj; /**< For Proj: contains the result position to project */
152 filter_attr filter; /**< For Filter */
153 end_attr end; /**< For EndReg, EndExcept */
154 #if PRECISE_EXC_CONTEXT
155 struct ir_node **frag_arr; /**< For Phi node construction in case of exceptions
156 for nodes Store, Load, Div, Mod, Quot, DivMod. */
161 /** common structure of an irnode
162 if the node has some attributes, they are stored in attr */
164 /* ------- Basics of the representation ------- */
165 firm_kind kind; /**< distinguishes this node from others */
166 ir_op *op; /**< Opcode of this node. */
167 ir_mode *mode; /**< Mode of this node. */
168 unsigned long visited; /**< visited counter for walks of the graph */
169 struct ir_node **in; /**< array with predecessors / operands */
170 void *link; /**< to attach additional information to the node, e.g.
171 used while construction to link Phi0 nodes and
172 during optimization to link to nodes that
173 shall replace a node. */
174 /* ------- Fields for optimizations / analysis information ------- */
175 struct ir_node **out; /**< array of out edges */
176 struct dbg_info* dbi; /**< A pointer to information for debug support. */
177 /* ------- For debugging ------- */
179 int node_nr; /**< a unique node number for each node to make output
182 attr attr; /**< attribute of this node. Depends on opcode.
183 Must be last field of struct ir_node. */
186 /** Copies all attributes stored in the old node to the new node.
187 Assumes both have the same opcode and sufficient size. */
189 copy_attrs (ir_node *old, ir_node *new);
192 /** Returns the array with the ins. The content of the array may not be
194 ir_node **get_irn_in (const ir_node *node);
197 /** access attributes directly */
198 INLINE tarval *get_irn_const_attr (ir_node *node);
199 INLINE long get_irn_proj_attr (ir_node *node);
200 INLINE alloc_attr get_irn_alloc_attr (ir_node *node);
201 INLINE type *get_irn_free_attr (ir_node *node);
202 INLINE symconst_attr get_irn_symconst_attr (ir_node *node);
203 type *get_irn_call_attr (ir_node *node);
204 sel_attr get_irn_sel_attr (ir_node *node);
205 int get_irn_phi_attr (ir_node *node);
206 block_attr get_irn_block_attr (ir_node *node);
209 # endif /* _IRNODE_T_H_ */