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 */
44 cond_kind kind; /* flavor of Cond */
45 long default_proj; /* for optimization: biggest Proj number, i.e. the one
49 /* SymConst attributes */
50 /* This union contains the symbolic information represented by the node */
51 typedef union type_or_id {
63 entity *ent; /* entity to select */
64 linkage_type ltyp; /* linkage type of the entity */
68 type *cld_tp; /* type of called procedure */
69 #if PRECISE_EXC_CONTEXT
70 struct ir_node **frag_arr; /* For Phi node construction in case of exceptions */
72 entity ** callee_arr; /* result of callee analysis */
75 /* Alloc attributes */
77 type *type; /* Type of the allocated object. */
78 where_alloc where; /* stack, heap or other managed part of memory */
79 #if PRECISE_EXC_CONTEXT
80 struct ir_node **frag_arr; /* For Phi node construction in case of exceptions */
84 /* InstOf attributes */
91 /* Filter attributes */
93 long proj; /* contains the result position to project (Proj) */
94 ir_node ** in_cg; /* array with interprocedural predecessors (Phi) */
97 /* EndReg/EndExcept attributes */
99 ir_graph * irg; /* ir_graph this node belongs to (for
100 * navigating in interprocedural graphs) */
103 /* CallBegin attributes */
105 ir_graph * irg; /* ir_graph this node belongs to (for
106 * navigating in interprocedural graphs) */
107 ir_node * call; /* associated Call-operation */
110 /* Some irnodes just have one attribute, these are stored here,
111 some have more. Their name is 'irnodename_attr' */
113 block_attr block; /* For Block: Fields needed to construct it */
114 cond_attr c; /* For Cond. */
115 struct tarval *con; /* For Const: contains the value of the constant */
116 symconst_attr i; /* For SymConst. */
117 sel_attr s; /* For Sel. */
118 call_attr call; /* For Call: pointer to the type of the method to call */
119 alloc_attr a; /* For Alloc. */
120 io_attr io; /* For InstOf */
121 type *f; /* For Free. */
122 int phi0_pos; /* For Phi. Used to remember the value defined by
123 this Phi node. Needed when the Phi is completed
124 to call get_r_internal_value to find the
125 predecessors. If this attribute is set, the Phi
126 node takes the role of the obsolete Phi0 node,
127 therefore the name. */
128 long proj; /* For Proj: contains the result position to project */
129 filter_attr filter; /* For Filter */
130 end_attr end; /* For EndReg, EndExcept */
131 callbegin_attr callbegin; /* For CallBegin */
132 #if PRECISE_EXC_CONTEXT
133 struct ir_node **frag_arr; /* For Phi node construction in case of exceptions
134 for nodes Store, Load, Div, Mod, Quot, DivMod. */
139 /* common structure of an irnode */
140 /* if the node has some attributes, they are stored in attr */
143 /** Basics of the representation **/
144 firm_kind kind; /* distinguishes this node from others */
145 ir_op *op; /* Opcode of this node. */
146 ir_mode *mode; /* Mode of this node. */
147 unsigned long visited; /* visited counter for walks of the graph */
148 struct ir_node **in; /* array with predecessors / operands */
149 struct ir_node *link; /* for linking nodes somehow to a list, e.g.
150 used while construction to link Phi0 nodes and
151 during optimization to link to nodes that
152 shall replace a node. */
153 /** Fields for optimizations / analysis information **/
154 struct ir_node **out; /* array of out edges */
155 struct dbg_info* dbi; /* A pointer to information for debug support. */
156 /** For debugging **/
158 int node_nr; /* a unique node number for each node to make output
161 attr attr; /* attribute of this node. Depends on opcode. */
162 /* Must be last field of struct ir_node. */
165 /* Copies all attributes stored in the old node to the new node.
166 Assumes both have the same opcode and sufficient size. */
168 copy_attrs (ir_node *old, ir_node *new);
171 /* Print IR-Nodes with attributes */
172 /* @@@@ brauchen wir dienoch? dann fliegt ev. das xprint raus?*/
173 int ir_node_print (XP_PAR1, const xprintf_info *, XP_PARN);
176 /** access attributes directly **/
177 inline tarval *get_irn_const_attr (ir_node *node);
178 inline long get_irn_proj_attr (ir_node *node);
179 inline alloc_attr get_irn_alloc_attr (ir_node *node);
180 inline type *get_irn_free_attr (ir_node *node);
181 inline symconst_attr get_irn_symconst_attr (ir_node *node);
182 type *get_irn_call_attr (ir_node *node);
183 sel_attr get_irn_sel_attr (ir_node *node);
184 int get_irn_phi_attr (ir_node *node);
185 block_attr get_irn_block_attr (ir_node *node);
187 # endif /* _IRNODE_T_H_ */