1 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
2 ** All rights reserved.
4 ** Authors: Martin Trapp, Christian Schaefer
6 ** declarations of an ir node
17 # include "common_t.h"
18 # include "irdom_t.h" /* For size of struct dom_info. */
23 /** ir node attributes **/
25 /* Block attributes */
27 unsigned long block_visited; /* for the walker that walks over all blocks. */
28 /* Attributes private to construction: */
29 bool matured; /* if set, all in-nodes of the block are fixed */
30 struct ir_node **graph_arr; /* array to store all parameters */
31 struct dom_info dom; /* Datastructure that holds information about dominators.
32 @@@ Eventually overlay with graph_arr as only valid
33 in different phases. Eventually inline the whole
35 exc_t exc; /* role of this block for exception handling */
36 ir_node *handler_entry; /* handler entry block iff this block is part of a region */
37 ir_node ** in_cg; /* array with predecessors in
38 * interprocedural_view, if they differ
39 * from intraprocedural predecessors */
40 int *backedge; /* Field n set to true if pred n is backedge.
41 @@@ Ev. replace by bitfield! */
42 int *cg_backedge; /* Field n set to true if pred n is interprocedural backedge.
43 @@@ Ev. replace by bitfield! */
48 cond_kind kind; /* flavor of Cond */
49 long default_proj; /* for optimization: biggest Proj number, i.e. the one
53 /* SymConst attributes */
54 /* This union contains the symbolic information represented by the node */
55 typedef union type_or_id {
67 entity *ent; /* entity to select */
71 type *cld_tp; /* type of called procedure */
72 #if PRECISE_EXC_CONTEXT
73 struct ir_node **frag_arr; /* For Phi node construction in case of exceptions */
75 entity ** callee_arr; /* result of callee analysis */
78 /* Alloc attributes */
80 type *type; /* Type of the allocated object. */
81 where_alloc where; /* stack, heap or other managed part of memory */
82 #if PRECISE_EXC_CONTEXT
83 struct ir_node **frag_arr; /* For Phi node construction in case of exceptions */
87 /* InstOf attributes */
94 /* Filter attributes */
96 long proj; /* contains the result position to project (Proj) */
97 ir_node ** in_cg; /* array with interprocedural predecessors (Phi) */
98 int *backedge; /* Field n set to true if pred n is backedge.
99 @@@ Ev. replace by bitfield! */
102 /* EndReg/EndExcept attributes */
104 ir_graph * irg; /* ir_graph this node belongs to (for
105 * navigating in interprocedural graphs) */
108 /* CallBegin attributes */
110 ir_graph * irg; /* ir_graph this node belongs to (for
111 * navigating in interprocedural graphs) */
112 ir_node * call; /* associated Call-operation */
115 /* Some irnodes just have one attribute, these are stored here,
116 some have more. Their name is 'irnodename_attr' */
118 block_attr block; /* For Block: Fields needed to construct it */
119 cond_attr c; /* For Cond. */
120 struct tarval *con; /* For Const: contains the value of the constant */
121 symconst_attr i; /* For SymConst. */
122 sel_attr s; /* For Sel. */
123 call_attr call; /* For Call: pointer to the type of the method to call */
124 callbegin_attr callbegin; /* For CallBegin */
125 alloc_attr a; /* For Alloc. */
126 io_attr io; /* For InstOf */
127 type *f; /* For Free. */
128 int phi0_pos; /* For Phi. Used to remember the value defined by
129 this Phi node. Needed when the Phi is completed
130 to call get_r_internal_value to find the
131 predecessors. If this attribute is set, the Phi
132 node takes the role of the obsolete Phi0 node,
133 therefore the name. */
134 int *phi_backedge; /* For Phi after construction.
135 Field n set to true if pred n is backedge.
136 @@@ Ev. replace by bitfield! */
137 long proj; /* For Proj: contains the result position to project */
138 filter_attr filter; /* For Filter */
139 end_attr end; /* For EndReg, EndExcept */
140 #if PRECISE_EXC_CONTEXT
141 struct ir_node **frag_arr; /* For Phi node construction in case of exceptions
142 for nodes Store, Load, Div, Mod, Quot, DivMod. */
147 /* common structure of an irnode */
148 /* if the node has some attributes, they are stored in attr */
151 /** Basics of the representation **/
152 firm_kind kind; /* distinguishes this node from others */
153 ir_op *op; /* Opcode of this node. */
154 ir_mode *mode; /* Mode of this node. */
155 unsigned long visited; /* visited counter for walks of the graph */
156 struct ir_node **in; /* array with predecessors / operands */
157 void *link; /* to attach additional information to the node, e.g.
158 used while construction to link Phi0 nodes and
159 during optimization to link to nodes that
160 shall replace a node. */
161 /** Fields for optimizations / analysis information **/
162 struct ir_node **out; /* array of out edges */
163 struct dbg_info* dbi; /* A pointer to information for debug support. */
164 /** For debugging **/
166 int node_nr; /* a unique node number for each node to make output
169 attr attr; /* attribute of this node. Depends on opcode. */
170 /* Must be last field of struct ir_node. */
173 /* Copies all attributes stored in the old node to the new node.
174 Assumes both have the same opcode and sufficient size. */
176 copy_attrs (ir_node *old, ir_node *new);
179 /* Print IR-Nodes with attributes */
180 /* @@@@ brauchen wir dienoch? dann fliegt ev. das xprint raus?*/
181 int ir_node_print (XP_PAR1, const xprintf_info *, XP_PARN);
183 /* Returns the array with the ins. The content of the array may not be
185 ir_node **get_irn_in (ir_node *node);
187 /** access attributes directly **/
188 INLINE tarval *get_irn_const_attr (ir_node *node);
189 INLINE long get_irn_proj_attr (ir_node *node);
190 INLINE alloc_attr get_irn_alloc_attr (ir_node *node);
191 INLINE type *get_irn_free_attr (ir_node *node);
192 INLINE symconst_attr get_irn_symconst_attr (ir_node *node);
193 type *get_irn_call_attr (ir_node *node);
194 sel_attr get_irn_sel_attr (ir_node *node);
195 int get_irn_phi_attr (ir_node *node);
196 block_attr get_irn_block_attr (ir_node *node);
198 # endif /* _IRNODE_T_H_ */