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 */
40 cond_kind kind; /* flavor of Cond */
41 long default_proj; /* for optimization: biggest Proj number, i.e. the one
45 /* SymConst attributes */
46 /* This union contains the symbolic information represented by the node */
47 typedef union type_or_id {
59 entity *ent; /* entity to select */
60 linkage_type ltyp; /* linkage type of the entity */
64 type *cld_tp; /* type of called procedure */
65 #if PRECISE_EXC_CONTEXT
66 struct ir_node **frag_arr; /* For Phi node construction in case of exceptions */
70 /* Alloc attributes */
72 type *type; /* Type of the allocated object. */
73 where_alloc where; /* stack, heap or other managed part of memory */
74 #if PRECISE_EXC_CONTEXT
75 struct ir_node **frag_arr; /* For Phi node construction in case of exceptions */
79 /* Some irnodes just have one attribute, these are stored here,
80 some have more. Their name is 'irnodename_attr' */
82 block_attr block; /* For Block: Fields needed to construct it */
83 cond_attr c; /* For Cond. */
84 struct tarval *con; /* For Const: contains the value of the constant */
85 symconst_attr i; /* For SymConst. */
86 sel_attr s; /* For Sel. */
87 call_attr call; /* For Call: pointer to the type of the method to call */
88 alloc_attr a; /* For Alloc. */
89 type *f; /* For Free. */
90 int phi0_pos; /* For Phi. Used to remember the value defined by
91 this Phi node. Needed when the Phi is completed
92 to call get_r_internal_value to find the
93 predecessors. If this attribute is set, the Phi
94 node takes the role of the obsolete Phi0 node,
95 therefore the name. */
96 long proj; /* For Proj: contains the result position to project */
97 #if PRECISE_EXC_CONTEXT
98 struct ir_node **frag_arr; /* For Phi node construction in case of exceptions
99 for nodes Store, Load, Div, Mod, Quot, DivMod. */
104 /* common structure of an irnode */
105 /* if the node has some attributes, they are stored in attr */
108 /** Basics of the representation **/
109 firm_kind kind; /* distinguishes this node from others */
110 ir_op *op; /* Opcode of this node. */
111 ir_mode *mode; /* Mode of this node. */
112 unsigned long visited; /* visited counter for walks of the graph */
113 struct ir_node **in; /* array with predecessors / operands */
114 struct ir_node *link; /* for linking nodes somehow to a list, e.g.
115 used while construction to link Phi0 nodes and
116 during optimization to link to nodes that
117 shall replace a node. */
118 /** Fields for optimizations / analysis information **/
119 struct ir_node **out; /* array of out edges */
120 struct dbg_info* dbi; /* A pointer to information for debug support. */
121 /** For debugging **/
123 int node_nr; /* a unique node number for each node to make output
126 attr attr; /* attribute of this node. Depends on opcode. */
127 /* Must be last field of struct ir_node. */
130 /* Copies all attributes stored in the old node to the new node.
131 Assumes both have the same opcode and sufficient size. */
133 copy_attrs (ir_node *old, ir_node *new);
136 /* Print IR-Nodes with attributes */
137 /* @@@@ brauchen wir dienoch? dann fliegt ev. das xprint raus?*/
138 int ir_node_print (XP_PAR1, const xprintf_info *, XP_PARN);
141 /** access attributes directly **/
142 inline tarval *get_irn_const_attr (ir_node *node);
143 inline long get_irn_proj_attr (ir_node *node);
144 inline alloc_attr get_irn_alloc_attr (ir_node *node);
145 inline type *get_irn_free_attr (ir_node *node);
146 inline symconst_attr get_irn_symconst_attr (ir_node *node);
147 type *get_irn_call_attr (ir_node *node);
148 sel_attr get_irn_sel_attr (ir_node *node);
149 int get_irn_phi_attr (ir_node *node);
150 block_attr get_irn_return_attr (ir_node *node);
152 # endif /* _IRNODE_T_H_ */