3 * File name: ir/ir/ircons.h
4 * Purpose: Various irnode constructors. Automatic construction
5 * of SSA representation.
6 * Author: Martin Trapp, Christian Schaefer
7 * Modified by: Goetz Lindenmaier, Boris Boesler
10 * Copyright: (c) 1998-2003 Universität Karlsruhe
11 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
17 -# Handle construction of exceptions more comfortable:
18 Add new constructors that pass the exception region (or better the
19 Phi for the memories, the ex. region can be found from there) as parameter,
20 constructor then adds all Proj nodes and returns the pointer
21 to the Proj node that selects the result of the arithmetic operation.
22 -# Maybe hide the exception region in a global variable, especially if
23 it is always unambiguous.
29 * documentation no more supported since 2001
31 * ir node construction.
33 * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier
35 * This file documents all datatypes and constructors needed to
36 * build a FIRM representation of a procedure. The constructors are
37 * also implemented in this file.
39 * The documentation also gives a short manual how to use the library.
41 * For extensive documentation of FIRM see UKA Techreport 1999-14.
48 * This struct contains all information about a procedure.
49 * It's allocated directly to memory.
51 * The fields of ir_graph:
53 * *ent The entity describing this procedure.
55 * The beginning and end of a graph:
57 * *start_block This ir_node is the block that contains the unique
58 * start node of the procedure. With it it contains
59 * the Proj's on starts results.
60 * Further all Const nodes are placed in the start block.
61 * *start This ir_node is the unique start node of the procedure.
63 * *end_block This ir_node is the block that contains the unique
64 * end node of the procedure. This block contains no
66 * *end This ir_node is the unique end node of the procedure.
68 * The following nodes are Projs from the start node, held in ir_graph for
71 * *frame The ir_node producing the pointer to the stack frame of
72 * the procedure as output. This is the Proj node on the
73 * third output of the start node. This output of the start
74 * node is tagged as pns_frame_base. In FIRM most lokal
75 * variables are modeled as data flow edges. Static
76 * allocated arrays can not be represented as dataflow
77 * edges. Therefore FIRM has to represent them in the stack
80 * *globals This models a pointer to a space in the memory where
81 * _all_ global things are held. Select from this pointer
82 * with a Sel node the pointer to a global variable /
83 * procedure / compiler known function... .
85 * *args The ir_node that produces the arguments of the method as
86 * it's result. This is a Proj node on the fourth output of
87 * the start node. This output is tagged as pns_args.
89 * *bad The bad node is an auxiliary node. It is needed only once,
90 * so there is this globally reachable node.
92 * Datastructures that are private to a graph:
94 * *obst An obstack that contains all nodes.
96 * *current_block A pointer to the current block. Any node created with
97 * one of the node constructors (new_<opcode>) are assigned
98 * to this block. It can be set with switch_block(block).
99 * Only needed for ir construction.
101 * params/n_loc An int giving the number of local variables in this
102 * procedure. This is neede for ir construction. Name will
105 * *value_table This hash table (pset) is used for global value numbering
106 * for optimizing use in iropt.c.
108 * *Phi_in_stack; a stack needed for automatic Phi construction, needed only
109 * during ir construction.
111 * visited A int used as flag to traverse the ir_graph.
113 * block_visited A int used as a flag to traverse block nodes in the graph.
115 * Three kinds of nodes
116 * --------------------
118 * There are three kinds of nodes known to the ir: entities,
119 * types, and ir_nodes
121 * + ir_nodes are the actual nodes of the FIRM intermediate representation.
122 * They represent operations on the data of the program and control flow
125 * + entity ==> implemented in entity.h
126 * Refers to a single entity of the compiled program, e.g. a field of a
127 * class or a method. If a method or variable can not be assigned to
128 * a method or class or the like, it is a global object.
130 * + types ==> implemented in type.h
131 * With types type information is represented. There are several type
134 * Implementation of the FIRM operations: ir_node
135 * ----------------------------------------------
137 * Ir_nodes represent operations on the data of the program and control flow
138 * operations. Examples of ir_nodes: Add, Jmp, Cmp
140 * FIRM is a dataflow graph. A dataflow graph is a directed graph,
141 * so that every node has incoming and outgoing edges. A node is
142 * executable if every input at it's incoming edges is available.
143 * Execution of the dataflow graph is started at the Start node which
144 * has no incoming edges and ends when the End node executes, even if
145 * there are still executable or not executed nodes. (Is this true,
146 * or must all executable nodes be executed?) (There are exceptions
147 * to the dataflow paradigma that all inputs have to be available
148 * before a node can execute: Phi, Block. See UKA Techreport
151 * The implementation of FIRM differs from the view as a dataflow
152 * graph. To allow fast traversion of the graph edges are
153 * implemented as C-pointers. Inputs to nodes are not ambiguous, the
154 * results can be used by several other nodes. Each input can be
155 * implemented as a single pointer to a predecessor node, outputs
156 * need to be lists of pointers to successors. Therefore a node
157 * contains pointers to it's predecessor so that the implementation is a
158 * dataflow graph with reversed edges. It has to be traversed bottom
161 * All nodes of the ir have the same basic structure. They are
162 * distinguished by a field containing the opcode.
164 * The fields of an ir_node:
166 * kind A firm_kind tag containing k_ir_node. This is useful for
167 * dynamically checking the type of a node.
169 * *op This ir_op gives the opcode as a tag and a string
170 * and the number of attributes of an ir_node. There is
171 * one statically allocated struct ir_op for each opcode.
173 * *mode The ir_mode of the operation represented by this firm
174 * node. The mode of the operation is the mode of it's
175 * result. A Firm mode is a datatype as known to the target,
176 * not a type of the source language.
178 * visit A flag for traversing the ir.
180 * **in An array with pointers to the node's predecessors.
182 * *link A pointer to an ir_node. With this pointer all Phi nodes
183 * are attached to a Block, i.e., a Block points to it's
184 * first Phi node, this node points to the second Phi node
185 * in the Block and so fourth. Used in mature_block
186 * to find all Phi nodes to be matured. It's also used to
187 * annotate a node with a better, optimized version of it.
189 * attr An attr struct containing the attributes of the nodes. The
190 * attributes depend on the opcode of the node. The number
191 * of these attributes is given in op.
195 * Not yet documented. See irop.h.
199 * Not yet documented. See irmode.h.
201 * GLOBAL VARIABLES -- now also fields of ir_graph.
204 * current_ir_graph Points to the current ir_graph. All constructors for
205 * nodes add nodes to this graph.
207 * ir_visited An int used as flag to traverse the ir_graph.
209 * block_visited An int used as a flag to traverse block nodes in the
212 * Others not yet documented.
216 * CONSTRUCTOR FOR IR_GRAPH --> see irgraph.h
217 * ========================
220 * PROCEDURE TO CONSTRUCT AN IR GRAPH --> see also Firm tutorial
221 * ==================================
223 * This library supplies several interfaces to construct a FIRM graph for
225 * * A "comfortable" interface generating SSA automatically. Automatically
226 * computed predecessors of nodes need not be specified in the constructors.
227 * (new_<Node> constructurs and a set of additional routines.)
228 * * A less comfortable interface where all predecessors except the block
229 * an operation belongs to need to be specified. SSA must be constructed
230 * by hand. (new_<Node> constructors and switch_block()). This interface
231 * is called "block oriented". It automatically calles the local optimizations
233 * * An even less comfortable interface where the block needs to be specified
234 * explicitly. This is called the "raw" interface. (new_r_<Node>
235 * constructors). These nodes are not optimized.
237 * To use the functionality of the comfortable interface correctly the Front
238 * End needs to follow certain protocols. This is explained in the following.
239 * To build a correct IR with the other interfaces study the semantics of
240 * the firm node (See tech-reprot UKA 1999-14). For the construction of
241 * types and entities see the documentation in those modules.
243 * First the Frontend needs to decide which variables and values used in
244 * a procedure can be represented by dataflow edges. These are variables
245 * that need not be saved to memory as they cause no side effects visible
246 * out of the procedure. Often these are all compiler generated
247 * variables and simple local variables of the procedure as integers,
248 * reals and pointers. The frontend has to count and number these variables.
250 * First an ir_graph needs to be constructed with new_ir_graph. The
251 * constructor gets the number of local variables. The graph is hold in the
252 * global variable irg.
254 * Now the construction of the procedure can start. Several basic blocks can
255 * be constructed in parallel, but the code within each block needs to
256 * be constructed (almost) in program order.
258 * A global variable holds the current basic block. All (non block) nodes
259 * generated are added to this block. The current block can be set with
260 * switch_block(block). If several blocks are constructed in parallel block
261 * switches need to be performed constantly.
263 * To generate a Block node (with the comfortable interface) it's predecessor
264 * control flow nodes need not be known. In case of cyclic control flow these
265 * can not be known when the block is constructed. With add_in_edge(block,
266 * cfnode) predecessors can be added to the block. If all predecessors are
267 * added to the block mature_block(b) needs to be called. Calling mature_block
268 * early improves the efficiency of the Phi node construction algorithm.
269 * But if several blocks are constructed at once, mature_block must only
270 * be called after performing all set_values and set_stores in the block!
271 * (See documentation of new_immBlock constructor.)
273 * The constructors of arithmetic nodes require that their predecessors
274 * are mentioned. Sometimes these are available in the Frontend as the
275 * predecessors have just been generated by the frontend. If they are local
276 * values the predecessors can be obtained from the library with a call to
277 * get_value(local_val_nr). (local_val_nr needs to be administered by
278 * the Frontend.) A call to get_value triggers the generation of Phi nodes.
279 * If an arithmetic operation produces a local value this value needs to be
280 * passed to the library by set_value(node, local_val_nr).
281 * In straight line code these two operations just remember and return the
282 * pointer to nodes producing the value. If the value passes block boundaries
283 * Phi nodes can be inserted.
284 * Similar routines exist to manage the Memory operands: set_store and
287 * Several nodes produce more than one result. An example is the Div node.
288 * Such nodes return tuples of values. From these individual values can be
289 * extracted by proj nodes.
291 * The following example illustrates the construction of a simple basic block
292 * with two predecessors stored in variables cf_pred1 and cf_pred2, containing
295 * and finally jumping to an other block. The variable a got the local_val_nr
296 * 42 by the frontend.
298 * ir_node *this_block, *cf_pred1, *cf_pred2, *a_val, *mem, *div, *res, *cf_op;
300 * this_block = new_immBlock();
301 * add_in_edge(this_block, cf_pred1);
302 * add_in_edge(this_block, cf_pred2);
303 * mature_block(this_block);
304 * a_val = get_value(42, mode_Iu);
306 * div = new_Div(mem, a_val, a_val);
307 * mem = new_Proj(div, mode_M, 0); * for the numbers for Proj see docu *
308 * res = new_Proj(div, mode_Iu, 2);
310 * set_value(res, 42);
313 * For further information look at the documentation of the nodes and
314 * constructors and at the paragraph COPING WITH DATA OBJECTS at the
315 * end of this documentation.
317 * The comfortable interface contains the following routines further explained
320 * ir_node *new_immBlock (void);
321 * ir_node *new_Start (void);
322 * ir_node *new_End (void);
323 * ir_node *new_Jmp (void);
324 * ir_node *new_Cond (ir_node *c);
325 * ir_node *new_Return (ir_node *store, int arity, ir_node **in);
326 * ir_node *new_Raise (ir_node *store, ir_node *obj);
327 * ir_node *new_Const (ir_mode *mode, tarval *con);
328 * ir_node *new_SymConst (type_or_id_p value, symconst_kind kind);
329 * ir_node *new_simpleSel (ir_node *store, ir_node *objptr, entity *ent);
330 * ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity,
331 * ir_node **in, entity *ent);
332 * ir_node *new_InstOf (ir_node *store, ir_node obj, type *ent);
333 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity,
334 * ir_node **in, type_method *type);
335 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
336 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
337 * ir_node *new_Minus (ir_node *op, ir_mode *mode);
338 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
339 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2);
340 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
341 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2);
342 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2);
343 * ir_node *new_Abs (ir_node *op, ir_mode *mode);
344 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
345 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
346 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
347 * ir_node *new_Not (ir_node *op, ir_mode *mode);
348 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
349 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
350 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
351 * ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode);
352 * ir_node *new_Cmp (ir_node *op1, ir_node *op2);
353 * ir_node *new_Conv (ir_node *op, ir_mode *mode);
354 * ir_node *new_Cast (ir_node *op, type *to_tp);
355 * ir_node *new_Load (ir_node *store, ir_node *addr);
356 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
357 * ir_node *new_Alloc (ir_node *store, ir_node *size, type *alloc_type,
358 * where_alloc where);
359 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
361 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
363 * ir_node *new_simpleSel(ir_node *store, ir_node *objptr, entity *ent);
364 * ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity,
365 * ir_node **in, entity *ent);
366 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity,
367 * ir_node **in, type_method *type);
368 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
369 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
370 * ir_node *new_Minus (ir_node *op, ir_mode *mode);
371 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
372 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2);
373 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
374 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2);
375 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2);
376 * ir_node *new_Abs (ir_node *op, ir_mode *mode);
377 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
378 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
379 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
380 * ir_node *new_Not (ir_node *op, ir_mode *mode);
381 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
382 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
383 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
384 * ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode);
385 * ir_node *new_Cmp (ir_node *op1, ir_node *op2);
386 * ir_node *new_Conv (ir_node *op, ir_mode *mode);
387 * ir_node *new_Cast (ir_node *op, type *to_tp);
388 * ir_node *new_Load (ir_node *store, ir_node *addr);
389 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
390 * ir_node *new_Alloc (ir_node *store, ir_node *size, type *alloc_type,
391 * where_alloc where);
392 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
394 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
395 * ir_node *new_FuncCall (ir_node *store, ir_node *callee, int arity,
396 * ir_node **in, type_method *type);
398 * void add_in_edge (ir_node *block, ir_node *jmp);
399 * void mature_block (ir_node *block);
400 * void switch_block (ir_node *target);
401 * ir_node *get_value (int pos, ir_mode *mode);
402 * void set_value (int pos, ir_node *value);
403 * ir_node *get_store (void);
404 * void set_store (ir_node *store);
405 * keep_alive (ir_node ka)
407 * IR_NODES AND CONSTRUCTORS FOR IR_NODES
408 * =======================================
410 * All ir_nodes are defined by a common data structure. They are distinguished
411 * by their opcode and differ in the number of their attributes.
413 * The constructor for the block node sets current_block to itself.
414 * Const nodes are always added to the start block.
415 * All other constructors add the created node to the current_block.
416 * swich_block(block) allows to set the current block to block.
418 * Watch for my inconsistent use of input and predecessor (dataflow view)
419 * and `the node points to' (implementation view).
421 * The following description of the nodes lists four properties them if these
423 * - the parameters to the constructor
424 * - the inputs of the Firm node
425 * - the outputs of the Firm node
426 * - attributes to the node
430 * ir_node *new_immBlock (void)
431 * ----------------------------
433 * Creates a new block. Sets current_block to itself. When a new block is
434 * created it cannot be known how many predecessors this block will have in the
435 * control flow graph. Therefore the list of inputs can not be fixed at
436 * creation. Predecessors can be added with add_in_edge (block, control flow
437 * operation). With every added predecessor the number of inputs to Phi nodes
440 * The block can be completed by mature_block(block) if all predecessors are
441 * known. If several blocks are built at once, mature_block can only be called
442 * after set_value has been called for all values that are life at the end
443 * of the block. This is necessary so that Phi nodes created by mature_block
444 * get the right predecessors in case of cyclic dependencies. If all set_values
445 * of this block are called after maturing it and before calling get_value
446 * in some block that is control flow dependent on this block, the construction
449 * Example for faulty ir construction: (draw the graph on a paper and you'll
452 * block_before_loop = new_block();
454 * mature_block(block_before_loop);
455 * before2header = new_Jmp;
457 * loop_header = new_block ();
458 * header2body - new_Jmp();
460 * loop_body = new_block ();
461 * body2header = new_Jmp();
463 * add_in_edge(loop_header, before2header);
464 * add_in_edge(loop_header, body2header);
465 * add_in_edge(loop_body, header2body);
467 * mature_block(loop_header);
468 * mature_block(loop_body);
470 * get_value(loop_body, x); // gets the Phi in loop_header
471 * set_value(loop_header, x); // sets the value the above get_value should
472 * // have returned!!!
474 * Mature_block also fixes the number of inputs to the Phi nodes. Mature_block
475 * should be called as early as possible, as afterwards the generation of Phi
476 * nodes is more efficient.
479 * There is an input for each control flow predecessor of the block.
480 * The input points to an instruction producing an output of type X.
481 * Possible predecessors: Start, Jmp, Cond, Raise or Return or any node
482 * possibly causing an exception. (Often the real predecessors are Projs.)
484 * Mode BB (R), all nodes belonging to this block should consume this output.
485 * As they are strict (except Block and Phi node) it is a necessary condition
486 * that the block node executed before any other node in this block executes.
488 * block.matured Indicates whether the block is mature.
490 * This attribute contains all local values valid in this
491 * block. This is needed to build the Phi nodes and removed
492 * if the graph is complete. This field is used by the
493 * internal construction algorithm and should not be accessed
497 * ir_node *new_Block (int arity, ir_node **in)
498 * --------------------------------------------
500 * Creates a new Block with the given list of predecessors. This block
501 * is mature. As other constructors calls optimization and vrfy for the
502 * block. If one of the predecessors is Unknown (as it has to be filled in
503 * later) optimizations are skipped. This is necessary to
504 * construct Blocks in loops. Leaving Unknown in the Block after finishing
505 * the construction may have strange effects, especially for interprocedural
506 * representation and analyses.
509 * CONTROL FLOW OPERATIONS
510 * -----------------------
512 * In each block there must be exactly one of the control flow
513 * operations Start, End, Jmp, Cond, Return or Raise. The output of a
514 * control flow operation points to the block to be executed next.
516 * ir_node *new_Start (void)
517 * -------------------------
519 * Creates a start node. Not actually needed public. There is only one such
520 * node in each procedure which is automatically created by new_ir_graph.
523 * No inputs except the block it belogns to.
525 * A tuple of 4 (5, 6) distinct values. These are labeled by the following
526 * projection numbers (pns_number):
528 * mode X, points to the first block to be executed.
530 * mode M, the global store
531 * * pns_frame_base mode P, a pointer to the base of the procedures
533 * * pns_globals mode P, a pointer to the part of the memory containing
534 * _all_ global things.
535 * * pns_args mode T, a tuple containing all arguments of the procedure.
538 * ir_node *new_End (void)
539 * -----------------------
541 * Creates an end node. Not actually needed public. There is only one such
542 * node in each procedure which is automatically created by new_ir_graph.
545 * No inputs except the block it belongs to.
549 * ir_node *new_Jmp (void)
550 * -----------------------
552 * Creates a Jmp node.
555 * The block the node belongs to
557 * Control flow to the next block.
559 * ir_node *new_Cond (ir_node *c)
560 * ------------------------------
562 * Creates a Cond node. There are two versions of this node.
568 * A tuple of two control flows. The first is taken if the input is
569 * false, the second if it is true.
573 * A value of mode I_u. (i)
575 * A tuple of n control flows. If the Cond's input is i, control
576 * flow will procede along output i. If the input is >= n control
577 * flow proceeds along output n.
579 * ir_node *new_Return (ir_node *store, int arity, ir_node **in)
580 * -------------------------------------------------------------
582 * The return node has as inputs the results of the procedure. It
583 * passes the control flow to the end_block.
589 * Control flow to the end block.
591 * ir_node *new_Raise (ir_node *store, ir_node *obj)
592 * -------------------------------------------------
594 * Raises an exception. Unconditional change of control flow. Writes
595 * an explicit Except variable to memory to pass it to the exception
596 * handler. See TechReport 1999-14, chapter Exceptions.
600 * A pointer to the Except variable.
602 * A tuple of control flow and the changed memory state. The control flow
603 * points to the exception handler if it is definied in this procedure,
604 * else it points to the end_block.
609 * ir_node *new_Const (ir_mode *mode, tarval *con)
610 * -----------------------------------------------
612 * Creates a constant in the constant table and adds a Const node
613 * returning this value to the start block.
616 * *mode The mode of the constant.
617 * *con Points to an entry in the constant table.
618 * This pointer is added to the attributes of
619 * the node (self->attr.con)
621 * No inputs except the block it belogns to.
623 * The constant value.
625 * attr.con A tarval* pointer to the proper entry in the constant
628 * ir_node *new_SymConst (type *tp, symconst_kind kind)
629 * ------------------------------------------------------------
631 * There are three kinds of symbolic constants:
632 * type_tag The symbolic constant represents a type tag.
633 * size The symbolic constant represents the size of a class.
634 * link_info Information for the linker, e.g. the name of a global
636 * To represent a pointer to an entity that is represented by an entity
637 * datastructure don't use
638 * new_SymConst((type_or_id*)get_entity_ld_ident(ent), linkage_ptr_info);.
639 * Use a real const instead:
640 * new_Const(mode_P_mach, tarval_p_from_entity(ent));
641 * This makes the Constant independent of name changes of the entity due to
645 * kind The kind of the symbolic constant: type_tag, size or link_info.
646 * *type_or_id Points to the type the tag stands for or to the type
647 * whose size is represented by the constant or to an ident
648 * representing the linkage info.
651 * No inputs except the block it belogns to.
653 * An unsigned integer (I_u) or a pointer (P).
656 * attr.i.num The symconst_kind, i.e. one of
660 * If the attr.i.num is type_tag or size, the node contains an attribute
661 * attr.i.*type, a pointer to a type_class. The mode of the node is mode_Is.
662 * if it is linkage_ptr_info it contains
663 * attr.i.*ptrinfo, an ident holding information for the linker. The mode
664 * of the node is mode_P_mach.
668 * ir_node *new_simpleSel (ir_node *store, ir_node *frame, entity *sel)
669 * --------------------------------------------------------------------
672 * Selects an entity from a compound type. This entity can be a field or
676 * *store The memory in which the object the entity should be selected
678 * *frame The pointer to the object.
679 * *sel The entity to select.
682 * The memory containing the object.
683 * A pointer to the object.
684 * An unsigned integer.
686 * A pointer to the selected entity.
688 * attr.sel Pointer to the entity
691 * ir_node *new_Sel (ir_node *store, ir_node *frame, int arity, ir_node **in,
692 * --------------------------------------------------------------------------
696 * Selects a field from an array type. The entity has as owner the array, as
697 * type the arrays element type. The indexes to access an array element are
701 * *store The memory in which the object the entity should be selected from
703 * *frame The pointer to the object.
704 * *arity number of array indexes.
705 * *in array with index inputs to the node.
706 * *sel The entity to select.
709 * The memory containing the object.
710 * A pointer to the object.
711 * As much unsigned integer as there are array expressions.
713 * A pointer to the selected entity.
715 * attr.sel Pointer to the entity
717 * The constructors new_Sel and new_simpleSel generate the same ir nodes.
718 * simpleSel just sets the arity of the index inputs to zero.
721 * ARITHMETIC OPERATIONS
722 * ---------------------
724 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node **in,
725 * ----------------------------------------------------------------------------
729 * Creates a procedure call.
732 * *store The actual store.
733 * *callee A pointer to the called procedure.
734 * arity The number of procedure parameters.
735 * **in An array with the pointers to the parameters.
736 * The constructor copies this array.
737 * *type Type information of the procedure called.
740 * The store, the callee and the parameters.
742 * A tuple containing the eventually changed store and the procedure
745 * attr.call Contains the type information for the procedure.
747 * ir_node *new_FuncCall (ir_node *callee, int arity, ir_node **in, type_method *type)
748 * -----------------------------------------------------------------------------------
750 * Creates a procedure call to a function WITHOUT memory side effects.
751 * Nodes of this kind are floating in contrast to Call nodes.
752 * Further, a procedure call with FuncCall cannot raise an exception!
755 * *callee A pointer to the called procedure.
756 * arity The number of procedure parameters.
757 * **in An array with the pointers to the parameters.
758 * The constructor copies this array.
759 * *type Type information of the procedure called.
762 * The callee and the parameters.
764 * A tuple containing the procedure results.
766 * attr.call Contains the type information for the procedure.
768 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode)
769 * ------------------------------------------------------------
773 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode)
774 * ------------------------------------------------------------
778 * ir_node *new_Minus (ir_node *op, ir_mode *mode)
779 * -----------------------------------------------
781 * Unary Minus operations on floating point values.
783 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode)
784 * ------------------------------------------------------------
788 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2)
789 * --------------------------------------------------------------
791 * Quot performs exact division of floating point numbers. It's mode
792 * is Tuple, the mode of the result must be annotated to the Proj
793 * that extracts the result of the arithmetic operations.
796 * The store needed to model exceptions and the two operands.
798 * A tuple contaning a memory and a execution for modeling exceptions
799 * and the result of the arithmetic operation.
801 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2)
802 * ----------------------------------------------------------------
804 * Performs Div and Mod on interger values.
807 * A tuple contaning a memory and a execution for modeling exceptions
808 * and the two result of the arithmetic operations.
810 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2)
811 * -------------------------------------------------------------
815 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2)
816 * -------------------------------------------------------------
820 * ir_node *new_Abs (ir_node *op, ir_mode *mode)
821 * ---------------------------------------------
825 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode)
826 * ------------------------------------------------------------
830 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode)
831 * -----------------------------------------------------------
835 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode)
836 * ------------------------------------------------------------
840 * ir_node *new_Not (ir_node *op, ir_mode *mode)
841 * ---------------------------------------------
843 * This node constructs a constant where all bits are set to one
844 * and a Eor of this constant and the operator. This simulates a
847 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode)
848 * ---------------------------------------------------------
852 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode)
853 * ---------------------------------------------------------
855 * Logic shift right, i.e., zero extended.
858 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode)
859 * ----------------------------------------------------------
861 * Arithmetic shift right, i.e., sign extended.
863 * ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode)
864 * ---------------------------------------------------------
866 * Rotates the operand to the (right??) by k bits.
868 * ir_node *new_Conv (ir_node *op, ir_mode *mode)
869 * ---------------------------------------------
871 * Mode conversion. For allowed conversions see UKA Tech Report
874 * ir_node *new_Cmp (ir_node *op1, ir_node *op2)
875 * ---------------------------------------------
878 * The two values to be compared.
880 * A 16-tuple containing the results of the 16 different comparisons.
881 * The following is a list giving the comparisons and a projection
882 * number (pnc_number) to use in Proj nodes to extract the proper result.
888 * Ge greater of equal
890 * Leg less, equal or greater = ordered
892 * Ue unordered or equal
893 * Ul unordered or less
894 * Ule unordered, less or equal
895 * Ug unordered or greater
896 * Uge unordered, greater or equal
897 * Ne unordered, less or greater = not equal
904 * In general, Phi nodes are automaitcally inserted. In some cases, if
905 * all predecessors of a block are known, an explicit Phi node constructor
906 * is needed. E.g., to construct a FIRM graph for a statement as
907 * a = (b==c) ? 2 : 5;
909 * ir_node *new_Phi (int arity, ir_node **in, ir_mode *mode)
910 * ---------------------------------------------------------
912 * Creates a Phi node. The in's order has to correspond to the order
913 * of in's of current_block. This is not checked by the library!
914 * If one of the predecessors is Unknown (as it has to be filled in
915 * later) optimizations are skipped. This is necessary to
916 * construct Phi nodes in loops. Leaving Unknown in the Phi after finishing
917 * the construction may have strange effects, especially for interprocedural
918 * representation and analyses.
921 * arity number of predecessors
922 * **in array with predecessors
923 * *mode The mode of it's inputs and output.
925 * A Phi node has as many inputs as the block it belongs to.
926 * Each input points to a definition of the same value on a
927 * different path in the control flow.
929 * The definition valid in this block.
932 * OPERATIONS TO MANAGE MEMORY EXPLICITLY
933 * --------------------------------------
935 * ir_node *new_Load (ir_node *store, ir_node *addr)
936 * ----------------------------------------------------------------
938 * The Load operation reads a value from memory.
941 * *store The current memory.
942 * *addr A pointer to the variable to be read in this memory.
945 * The memory and a pointer to a variable in this memory.
947 * A tuple of the memory, a control flow to be taken in case of
948 * an exception and the loaded value.
950 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val)
951 * ----------------------------------------------------------------
953 * The Store operation writes a value to a variable in memory.
956 * The memory, a pointer to a variable in this memory and the value
957 * to write to this variable.
959 * A tuple of the changed memory and a control flow to be taken in
960 * case of an exception.
962 * ir_node *new_Alloc (ir_node *store, ir_node *size, type *alloc_type,
963 * --------------------------------------------------------------------
967 * The Alloc node allocates a new variable. It can be specified whether the
968 * variable should be allocated to the stack or to the heap.
971 * *store The memory which shall contain the new variable.
972 * ** *size The number of bytes to allocate. Old. **
973 * *size We decided that the size easily can be derived from the type.
974 * This field is for allocating arrays, i.e., it gives the multiple
975 * of the size of alloc_type to allocate memory for.
976 * *alloc_type The type of the allocated variable.
977 * where Where to allocate the variable, either heap_alloc or stack_alloc.
980 * A memory and an unsigned integer.
982 * A tuple of the changed memory, a control flow to be taken in
983 * case of an exception and the pointer to the new variable.
985 * a.where Indicates where the variable is allocated.
986 * a.*type A pointer to the class the allocated data object
989 * ir_node *new_Free (ir_node *store, ir_node *ptr, type *free_type)
990 * ------------------------------------------------------------------
992 * The Free node frees memory of the given variable.
995 * *store The memory which shall contain the new variable.
996 * *ptr The pointer to the object to free.
997 * *size The number of objects of type free_type to free in a sequence.
998 * *free_type The type of the freed variable.
1001 * A memory, a pointer and an unsigned integer.
1003 * The changed memory.
1005 * f.*type A pointer to the type information of the freed data object.
1009 * ir_node *new_Sync (int arity, ir_node **in)
1010 * -------------------------------------------
1012 * The Sync operation unifies several partial memory blocks. These blocks
1013 * have to be pairwise disjunct or the values in common locations have to
1014 * be identical. This operation allows to specify all operations that eventually
1015 * need several partial memory blocks as input with a single entrance by
1016 * unifying the memories with a preceding Sync operation.
1019 * arity The number of memories to syncronize.
1020 * **in An array of pointers to nodes that produce an output of
1025 * The unified memory.
1028 * SPECIAL OPERATIONS
1029 * ------------------
1031 * ir_node *new_Bad (void)
1032 * -----------------------
1034 * Returns the unique Bad node current_ir_graph->bad.
1035 * This node is used to express results of dead code elimination.
1037 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj)
1038 * ----------------------------------------------------------
1040 * Selects one entry of a tuple. This is a hidden `fat edge'.
1043 * *arg A node producing a tuple.
1044 * *mode The mode of the value to project.
1045 * proj The position of the value in the tuple.
1051 * ir_node *new_Tuple (int arity, ir_node **in)
1052 * --------------------------------------------
1054 * Builds a Tuple from single values. This is needed to implement
1055 * optimizations that remove a node that produced a tuple. The node can be
1056 * replaced by the Tuple operation so that the following Proj nodes have not to
1057 * be changed. (They are hard to find due to the implementation with pointers
1058 * in only one direction.) The Tuple node is smaller than any other
1059 * node, so that a node can be changed into a Tuple by just changing it's
1060 * opcode and giving it a new in array.
1063 * arity The number of tuple elements.
1064 * **in An array containing pointers to the nodes producing the
1067 * ir_node *new_Id (ir_node *val, ir_mode *mode)
1068 * ---------------------------------------------
1070 * The single output of the Id operation is it's input. Also needed
1071 * for optimizations.
1074 * COPING WITH DATA OBJECTS
1075 * ========================
1077 * Two kinds of data objects have to be distinguished for generating
1078 * FIRM. First there are local variables other than arrays that are
1079 * known to be alias free. Second there are all other data objects.
1080 * For the first a common SSA representation is built, the second
1081 * are modeled by saving them to memory. The memory is treated as
1082 * a single local variable, the alias problem is hidden in the
1083 * content of this variable.
1085 * All values known in a Block are listed in the block's attribute,
1086 * block.**graph_arr which is used to automatically insert Phi nodes.
1087 * The following two funcions can be used to add a newly computed value
1088 * to the array, or to get the producer of a value, i.e., the current
1091 * inline void set_value (int pos, ir_node *value)
1092 * -----------------------------------------------
1094 * Has to be called for every assignment to a local variable. It
1095 * adds the value to the array of used values at position pos. Pos
1096 * has to be a unique identifier for an entry in the procedure's
1097 * definition table. It can be used to access the value again.
1098 * Requires current_block to be set correctly.
1100 * ir_node *get_value (int pos, ir_mode *mode)
1101 * -------------------------------------------
1103 * Returns the node defining the value referred to by pos. If the
1104 * value is not defined in this block a Phi node is generated and
1105 * all definitions reaching this Phi node are collected. It can
1106 * happen that the algorithm allocates an unnecessary Phi node,
1107 * e.g. if there is only one definition of this value, but this
1108 * definition reaches the currend block on several different
1109 * paths. This Phi node will be eliminated if optimizations are
1110 * turned on right after it's creation.
1111 * Requires current_block to be set correctly.
1113 * There are two special routines for the global store:
1115 * inline void set_store (ir_node *store)
1116 * --------------------------------------
1118 * Adds the store to the array of known values at a reserved
1120 * Requires current_block to be set correctly.
1122 * inline ir_node *get_store (void)
1123 * --------------------------------
1125 * Returns the node defining the actual store.
1126 * Requires current_block to be set correctly.
1129 * inline void keep_alive (ir_node *ka)
1130 * ------------------------------------
1132 * Keep this node alive because it is (might be) not in the control
1133 * flow from Start to End. Adds the node to the list in the end
1142 # include "firm_common.h"
1143 # include "irgraph.h"
1144 # include "irnode.h"
1145 # include "irmode.h"
1146 # include "entity.h"
1149 # include "dbginfo.h"
1151 /*-------------------------------------------------------------------------*/
1152 /* The raw interface */
1153 /*-------------------------------------------------------------------------*/
1155 /* Constructs a Block with a fixed number of predecessors.
1156 Does not set current_block. Can not be used with automatic
1157 Phi node construction. */
1159 /** Constructor for a Block node.
1161 * Constructor for a Block node. Constructs a mature block with the given
1162 * predecessors. Use Unknown nodes as predecessors to constuct a block
1163 * if the number of predecessors is known, but not the predecessors themselves.
1164 * This constructor does not set current_block. It not be used with automatic
1165 * Phi node construction.
1167 * @param *db A Pointer for debug information.
1168 * @param irg The ir graph the block belongs to.
1169 * @param arity The number of control predecessors.
1170 * @param in[] An array of control predecessors. The length of
1171 * the array must be 'arity'. The constructor copies this array.
1173 ir_node *new_rd_Block (dbg_info *db, ir_graph *irg, int arity, ir_node *in[]);
1175 /** Constructor for a Start node.
1177 * Constructor for a Start node.
1179 * @param *db A pointer for debug information.
1180 * @param *irg The ir graph the node belongs to.
1181 * @param *block The ir block the node belongs to.
1184 ir_node *new_rd_Start (dbg_info *db, ir_graph *irg, ir_node *block);
1186 /** Constructor for a End node.
1188 * Constructor for a End node.
1190 * @param *db A pointer for debug information.
1191 * @param *irg The ir graph the node belongs to.
1192 * @param *block The ir block the node belongs to.
1195 ir_node *new_rd_End (dbg_info *db, ir_graph *irg, ir_node *block);
1197 /** Constructor for a Jmp node.
1199 * Constructor for a Jmp node. Jmp represents control flow to a single \
1200 * control successor.
1202 * @param *db A pointer for debug information.
1203 * @param *irg The ir graph the node belongs to.
1204 * @param *block The ir block the node belongs to.
1207 ir_node *new_rd_Jmp (dbg_info *db, ir_graph *irg, ir_node *block);
1209 /** Constructor for a Cond node.
1211 * Constructor for a Cond node. If c is mode_b represents a conditional
1212 * branch (if/else). If c is mode_Is represents a switch. (Allocates dense
1213 * Cond node, default Proj is 0.)
1215 * @param *db A pointer for debug information.
1216 * @param *irg The ir graph the node belongs to.
1217 * @param *block The ir block the node belongs to.
1218 * @param *c The conditions parameter. Can be of mode b or I_u.
1221 ir_node *new_rd_Cond (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *c);
1223 /** Constructor for a Return node.
1225 * Constructor for a Return node. Returns the memory an zero or
1226 * more return values. Only node that can end regular control flow.
1228 * @param *db A pointer for debug information.
1229 * @param *irg The ir graph the node belongs to.
1230 * @param *block The ir block the node belongs to.
1231 * @param *store The state of memory.
1232 * @param arity Number of return values.
1233 * @param *in Array of length arity with return values. The constructor copies this array.
1235 ir_node *new_rd_Return (dbg_info *db, ir_graph *irg, ir_node *block,
1236 ir_node *store, int arity, ir_node *in[]);
1238 /** Constructor for a Raise node.
1240 * Constructor for a Raise node.
1242 * @param *db A pointer for debug information.
1243 * @param *irg The ir graph the node belongs to.
1244 * @param *block The ir block the node belongs to.
1245 * @param *store The current memory.
1246 * @param *obj A pointer to the Except variable.
1248 ir_node *new_rd_Raise (dbg_info *db, ir_graph *irg, ir_node *block,
1249 ir_node *store, ir_node *obj);
1251 /** Constructor for a Const node.
1253 * Constructor for a Const node. The constant represents a target value.
1254 * This constructor sets high level type information for the
1257 * @param *db A pointer for debug information.
1258 * @param *irg The ir graph the node belongs to.
1259 * @param *block The ir block the node belongs to.
1260 * @param *mode The mode of the operands and redults.
1261 * @param *con Points to an entry in the constant table.
1262 * @param *tp The type of the constant.
1264 ir_node *new_rd_Const_type (dbg_info* db, ir_graph *irg, ir_node *block,
1265 ir_mode *mode, tarval *con, type *tp);
1267 /** Constructor for a Const node.
1269 * Constructor for a Const node. The constant represents a target value.
1270 * Sets the type information to type_unknown. (No more supported: If
1271 * tv is entity derives a somehow useful type.)
1273 * @param *db A pointer for debug information.
1274 * @param *irg The ir graph the node belongs to.
1275 * @param *block The ir block the node belongs to.
1276 * @param *mode The mode of the operands and redults.
1277 * @param *con Points to an entry in the constant table.
1280 ir_node *new_rd_Const (dbg_info *db, ir_graph *irg, ir_node *block,
1281 ir_mode *mode, tarval *con);
1283 /** Constructor for a SymConst node.
1285 * This is the constructor for a symbolic constant.
1286 * There are four kinds of symbolic constants:
1287 * type_tag The symbolic constant represents a type tag. The type the
1288 * tag stands for is given explicitly.
1289 * size The symbolic constant represents the size of a type. The
1290 * type of which the constant represents the size is given
1292 * addr_name The symbolic constant represents the address of an entity
1293 * (variable or method). The variable is indicated by a name
1294 * that is valid for linking.
1295 * addr_ent The symbolic constant represents the address of an entity
1296 * (variable or method). The variable is given explicitly by
1299 * Inputs to the node:
1300 * No inputs except the block it belongs to.
1301 * Outputs of the node.
1302 * An unsigned integer (I_u) or a pointer (P).
1304 * @param *db A pointer for debug information.
1305 * @param *irg The ir graph the node belongs to.
1306 * @param *block The ir block the node belongs to.
1307 * @param symkind The kind of the symbolic constant: type_tag, size, addr_name or addr_ent.
1308 * @param value A type, entity or a ident depending on the SymConst kind.
1310 ir_node *new_rd_SymConst (dbg_info *db, ir_graph *irg, ir_node *block,
1311 type_or_id_p value, symconst_kind symkind);
1313 /** Constructor for a Sel node.
1315 * Constructor for a Sel node. The select node selects an entity (field or method)
1316 * from an entity with a compound type. It explicitly specifies the entity selected.
1317 * Dynamically the node may select entities that overwrite the given entity. If the
1318 * selected entity is an array element entity the Sel node takes the required array
1319 * indicees as inputs.
1321 * @param *db A pointer for debug information.
1322 * @param *irg The ir graph the node belongs to.
1323 * @param *block The ir block the node belongs to.
1324 * @param *store The memory in which the object the entity should be selected
1325 * from is allocated.
1326 * @param *objptr A pointer to a compound entity the Sel operation selects a
1327 * single attribute from.
1328 * @param *n_index The number of array indicees needed to select an array element entity.
1329 * @param *index[] If the compound entity is an array the indicees of the selected
1330 * element entity. The constructor copies this array.
1331 * @param *ent The entity to select.
1334 ir_node *new_rd_Sel (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1335 ir_node *objptr, int n_index, ir_node *index[], entity *ent);
1338 * Constructor for a InstOf node. For translating Java. Not supported as standard
1341 * @param *db A pointer for debug information.
1342 * @param *irg The ir graph the node belongs to.
1343 * @param *block The ir block the node belongs to.
1348 ir_node *new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store, ir_node *objptr, type *ent);
1351 * Constructor for a Call node.
1353 * @param *db A pointer for debug information.
1354 * @param *irg The ir graph the node belongs to.
1355 * @param *block The ir block the node belongs to.
1356 * @param *store The current memory state.
1357 * @param *callee A pointer to the called procedure.
1358 * @param arity The number of procedure parameters.
1359 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1360 * @param *tp Type information of the procedure called.
1362 ir_node *new_rd_Call (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1363 ir_node *callee, int arity, ir_node *in[], type *tp);
1366 * Constructor for a Add node.
1368 * @param *db A pointer for debug information.
1369 * @param *irg The ir graph the node belongs to.
1370 * @param *block The ir block the node belongs to.
1371 * @param *op1 The operand 1.
1372 * @param *op2 The operand 2.
1373 * @param *mode The mode of the operands and the result.
1375 ir_node *new_rd_Add (dbg_info *db, ir_graph *irg, ir_node *block,
1376 ir_node *op1, ir_node *op2, ir_mode *mode);
1379 * Constructor for a Sub node.
1381 * @param *db A pointer for debug information.
1382 * @param *irg The ir graph the node belongs to.
1383 * @param *block The ir block the node belongs to.
1384 * @param *op1 The operand 1.
1385 * @param *op2 The operand 2.
1386 * @param *mode The mode of the operands and the result.
1388 ir_node *new_rd_Sub (dbg_info *db, ir_graph *irg, ir_node *block,
1389 ir_node *op1, ir_node *op2, ir_mode *mode);
1392 * Constructor for a Minus node.
1394 * @param *db A pointer for debug information.
1395 * @param *irg The ir graph the node belongs to.
1396 * @param *block The ir block the node belongs to.
1397 * @param *op The operand .
1398 * @param *mode The mode of the operand and the result.
1400 ir_node *new_rd_Minus (dbg_info *db, ir_graph *irg, ir_node *block,
1401 ir_node *op, ir_mode *mode);
1404 * Constructor for a Mul node.
1406 * @param *db A pointer for debug information.
1407 * @param *irg The ir graph the node belongs to.
1408 * @param *block The ir block the node belongs to.
1409 * @param *op1 The operand 1.
1410 * @param *op2 The operand 2.
1411 * @param *mode The mode of the operands and the result.
1413 ir_node *new_rd_Mul (dbg_info *db, ir_graph *irg, ir_node *block,
1414 ir_node *op1, ir_node *op2, ir_mode *mode);
1417 * Constructor for a Quot node.
1419 * @param *db A pointer for debug information.
1420 * @param *irg The ir graph the node belongs to.
1421 * @param *block The ir block the node belongs to.
1422 * @param *memop The store needed to model exceptions
1423 * @param *op1 The operand 1.
1424 * @param *op2 The operand 2.
1426 ir_node *new_rd_Quot (dbg_info *db, ir_graph *irg, ir_node *block,
1427 ir_node *memop, ir_node *op1, ir_node *op2);
1430 * Constructor for a DivMod node.
1432 * @param *db A pointer for debug information.
1433 * @param *irg The ir graph the node belongs to.
1434 * @param *block The ir block the node belongs to.
1435 * @param *memop The store needed to model exceptions
1436 * @param *op1 The operand 1.
1437 * @param *op2 The operand 2.
1439 ir_node *new_rd_DivMod (dbg_info *db, ir_graph *irg, ir_node *block,
1440 ir_node *memop, ir_node *op1, ir_node *op2);
1443 * Constructor for a Div node.
1445 * @param *db A pointer for debug information.
1446 * @param *irg The ir graph the node belongs to.
1447 * @param *block The ir block the node belongs to.
1448 * @param *memop The store needed to model exceptions
1449 * @param *op1 The operand 1.
1450 * @param *op2 The operand 2.
1452 ir_node *new_rd_Div (dbg_info *db, ir_graph *irg, ir_node *block,
1453 ir_node *memop, ir_node *op1, ir_node *op2);
1456 * Constructor for a Mod node.
1458 * @param *db A pointer for debug information.
1459 * @param *irg The ir graph the node belongs to.
1460 * @param *block The ir block the node belongs to.
1461 * @param *memop The store needed to model exceptions
1462 * @param *op1 The operand 1.
1463 * @param *op2 The operand 2.
1465 ir_node *new_rd_Mod (dbg_info *db, ir_graph *irg, ir_node *block,
1466 ir_node *memop, ir_node *op1, ir_node *op2);
1469 * Constructor for a Abs node.
1471 * @param *db A pointer for debug information.
1472 * @param *irg The ir graph the node belongs to.
1473 * @param *block The ir block the node belongs to.
1474 * @param *op The operand
1475 * @param *mode The mode of the operands and the result.
1477 ir_node *new_rd_Abs (dbg_info *db, ir_graph *irg, ir_node *block,
1478 ir_node *op, ir_mode *mode);
1481 * Constructor for a And node.
1483 * @param *db A pointer for debug information.
1484 * @param *irg The ir graph the node belongs to.
1485 * @param *block The ir block the node belongs to.
1486 * @param *op1 The operand 1.
1487 * @param *op2 The operand 2.
1488 * @param *mode The mode of the operands and the result.
1490 ir_node *new_rd_And (dbg_info *db, ir_graph *irg, ir_node *block,
1491 ir_node *op1, ir_node *op2, ir_mode *mode);
1494 * Constructor for a Or node.
1496 * @param *db A pointer for debug information.
1497 * @param *irg The ir graph the node belongs to.
1498 * @param *block The ir block the node belongs to.
1499 * @param *op1 The operand 1.
1500 * @param *op2 The operand 2.
1501 * @param *mode The mode of the operands and the result.
1503 ir_node *new_rd_Or (dbg_info *db, ir_graph *irg, ir_node *block,
1504 ir_node *op1, ir_node *op2, ir_mode *mode);
1507 * Constructor for a Eor node.
1509 * @param *db A pointer for debug information.
1510 * @param *irg The ir graph the node belongs to.
1511 * @param *block The ir block the node belongs to.
1512 * @param *op1 The operand 1.
1513 * @param *op2 The operand 2.
1514 * @param *mode The mode of the operands and the results.
1516 ir_node *new_rd_Eor (dbg_info *db, ir_graph *irg, ir_node *block,
1517 ir_node *op1, ir_node *op2, ir_mode *mode);
1520 * Constructor for a Not node.
1522 * @param *db A pointer for debug information.
1523 * @param *irg The ir graph the node belongs to.
1524 * @param *block The ir block the node belongs to.
1525 * @param *op The operand.
1526 * @param *mode The mode of the operand and the result.
1529 ir_node *new_rd_Not (dbg_info *db, ir_graph *irg, ir_node *block,
1530 ir_node *op, ir_mode *mode);
1533 * Constructor for a Cmp node.
1535 * @param *db A pointer for debug information.
1536 * @param *irg The ir graph the node belongs to.
1537 * @param *block The ir block the node belongs to.
1538 * @param *op1 The operand 1.
1539 * @param *op2 The operand 2.
1542 ir_node *new_rd_Cmp (dbg_info *db, ir_graph *irg, ir_node *block,
1543 ir_node *op1, ir_node *op2);
1546 * Constructor for a Shl node.
1548 * @param *db A pointer for debug information.
1549 * @param *irg The ir graph the node belongs to.
1550 * @param *block The ir block the node belongs to.
1551 * @param *op The operand.
1552 * @param *k The number of bits to shift the operand .
1553 * @param *mode The mode of the operand and the result.
1556 ir_node *new_rd_Shl (dbg_info *db, ir_graph *irg, ir_node *block,
1557 ir_node *op, ir_node *k, ir_mode *mode);
1561 * Constructor for a Shr node.
1563 * @param *db A pointer for debug information.
1564 * @param *irg The ir graph the node belongs to.
1565 * @param *block The ir block the node belongs to.
1566 * @param *op The operand.
1567 * @param *k The number of bits to shift the operand .
1568 * @param *mode The mode of the operand and the result.
1572 ir_node *new_rd_Shr (dbg_info *db, ir_graph *irg, ir_node *block,
1573 ir_node *op, ir_node *k, ir_mode *mode);
1576 * Constructor for a Shrs node.
1578 * @param *db A pointer for debug information.
1579 * @param *irg The ir graph the node belongs to.
1580 * @param *block The ir block the node belongs to.
1581 * @param *op The operand.
1582 * @param *k The number of bits to shift the operand.
1583 * @param *mode The mode of the operand and the result.
1587 ir_node *new_rd_Shrs (dbg_info *db, ir_graph *irg, ir_node *block,
1588 ir_node *op, ir_node *k, ir_mode *mode);
1591 * Constructor for a Rot node.
1593 * @param *db A pointer for debug information.
1594 * @param *irg The ir graph the node belongs to.
1595 * @param *block The ir block the node belongs to.
1596 * @param *op The operand.
1597 * @param *k The number of bits to rotate the operand.
1598 * @param *mode The mode of the operand.
1602 ir_node *new_rd_Rot (dbg_info *db, ir_graph *irg, ir_node *block,
1603 ir_node *op, ir_node *k, ir_mode *mode);
1607 * Constructor for a Conv node.
1609 * @param *db A pointer for debug information.
1610 * @param *irg The ir graph the node belongs to.
1611 * @param *block The ir block the node belongs to.
1612 * @param *op The operand.
1613 * @param *mode The mode of this the operand muss be converted .
1617 ir_node *new_rd_Conv (dbg_info *db, ir_graph *irg, ir_node *block,
1618 ir_node *op, ir_mode *mode);
1621 * Constructor for a Cast node. High level type cast.
1623 * @param *db A pointer for debug information.
1624 * @param *irg The ir graph the node belongs to.
1625 * @param *block The ir block the node belongs to.
1626 * @param *op The operand.
1627 * @param *to_tp The type of this the operand muss be casted .
1629 ir_node *new_rd_Cast (dbg_info* db, ir_graph *irg, ir_node *block,
1630 ir_node *op, type *to_tp);
1633 * Constructor for a Phi node.
1635 * @param *db A pointer for debugginaromation.
1636 * @param *irg The ir graph the node belongs to.
1637 * @param *block The ir block the node belongs to.
1638 * @param arity The number of predecessors
1639 * @param *in[] Array with predecessors. The constructor copies this array.
1640 * @param *mode The mode of it's inputs and output.
1642 ir_node *new_rd_Phi (dbg_info *db, ir_graph *irg, ir_node *block, int arity,
1643 ir_node *in[], ir_mode *mode);
1646 * Constructor for a Load node.
1648 * @param *db A pointer for debug information.
1649 * @param *irg The ir graph the node belongs to.
1650 * @param *block The ir block the node belongs to.
1651 * @param *store The current memory
1652 * @param *adr A pointer to the variable to be read in this memory.
1654 ir_node *new_rd_Load (dbg_info *db, ir_graph *irg, ir_node *block,
1655 ir_node *store, ir_node *adr);
1658 * Constructor for a Store node.
1660 * @param *db A pointer for debug information.
1661 * @param *irg The ir graph the node belongs to.
1662 * @param *block The ir block the node belongs to.
1663 * @param *store The current memory
1664 * @param *adr A pointer to the variable to be read in this memory.
1665 * @param *val The value to write to this variable.
1667 ir_node *new_rd_Store (dbg_info *db, ir_graph *irg, ir_node *block,
1668 ir_node *store, ir_node *adr, ir_node *val);
1671 * Constructor for a Alloc node.
1673 * @param *db A pointer for debug information.
1674 * @param *irg The ir graph the node belongs to.
1675 * @param *block The ir block the node belongs to.
1676 * @param *store The memory which shall contain the new variable.
1677 * @param *size The number of bytes to allocate.
1678 * @param *alloc_type The type of the allocated variable.
1679 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
1682 ir_node *new_rd_Alloc (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1683 ir_node *size, type *alloc_type, where_alloc where);
1686 * Constructor for a Free node.
1688 * @param *db A pointer for debug information.
1689 * @param *irg The ir graph the node belongs to.
1690 * @param *block The ir block the node belongs to.
1691 * @param *store The memory which shall contain the new variable.
1692 * @param *ptr The pointer to the object to free.
1693 * @param *size The number of objects of type free_type to free in a sequence.
1694 * @param *free_type The type of the freed variable.
1697 ir_node *new_rd_Free (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1698 ir_node *ptr, ir_node *size, type *free_type);
1700 /** Constructor for a Sync node.
1702 * Constructor for a Sync node. Merges several memory values. The node assumes
1703 * that a variable either occurs only in one of the memories, or it contains the
1704 * same value in all memories where it occurs.
1706 * @param *db A pointer for debug information.
1707 * @param *irg The ir graph the node belongs to.
1708 * @param *block The ir block the node belongs to.
1709 * @param arity The number of memories to syncronize.
1710 * @param *in[] An array of pointers to nodes that produce an output of type memory. The constructor copies this array.
1714 ir_node *new_rd_Sync (dbg_info *db, ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
1717 * Constructor for a Proj node.
1719 * @param *db A pointer for deubugginformation.
1720 * @param *irg The ir graph the node belongs to.
1721 * @param *block The ir block the node belongs to.
1722 * @param arg A node producing a tuple.
1723 * @param *mode The mode of the value to project.
1724 * @param proj The position of the value in the tuple.
1726 ir_node *new_rd_Proj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1727 ir_mode *mode, long proj);
1730 * Constructor for a defaultProj node.
1732 * @param *db A pointer for debug information.
1733 * @param *irg The ir graph the node belongs to.
1734 * @param *block The ir block the node belongs to.
1735 * @param arg A node producing a tuple.
1736 * @param max_ proj The end position of the value in the tuple.
1738 ir_node *new_rd_defaultProj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1742 * Constructor for a Tuple node.
1744 * @param *db A pointer for debug information.
1745 * @param *irg The ir graph the node belongs to.
1746 * @param *block The ir block the node belongs to.
1747 * @param arity The number of tuple elements.
1748 * @param *in[] An array containing pointers to the nodes producing the tuple elements. The constructor copies this array.
1750 ir_node *new_rd_Tuple (dbg_info *db, ir_graph *irg, ir_node *block,
1751 int arity, ir_node *in[]);
1754 * Constructor for a Id node.
1756 * @param *db A pointer for debug information.
1757 * @param *irg The ir graph the node belongs to.
1758 * @param *block The ir block the node belongs to.
1760 * @param *mode The mode of *val.
1762 ir_node *new_rd_Id (dbg_info *db, ir_graph *irg, ir_node *block,
1763 ir_node *val, ir_mode *mode);
1766 * Constructor for a Bad node.
1768 * @param *irg The ir graph the node belongs to.
1770 ir_node *new_rd_Bad (ir_graph *irg);
1773 * Constructor for a Confirm node.
1775 * @param *db A pointer for debug information.
1776 * @param *irg The ir graph the node belong to.
1777 * @param *block The ir block the node belong to.
1782 ir_node *new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block,
1783 ir_node *val, ir_node *bound, pn_Cmp cmp);
1786 * Constructor for a Unknown node.
1788 * @param *irg The ir graph the node belongs to.
1791 ir_node *new_rd_Unknown(ir_graph *irg, ir_mode *m);
1794 * Constructor for a CallBegin node.
1796 * @param *db A pointer for debug information.
1797 * @param *irg The ir graph the node belong to.
1798 * @param *block The block the node belong to.
1799 * @param *callee The call node bisible in the intra procedural view.
1801 ir_node *new_rd_CallBegin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *callee);
1804 * Constructor for a EndReg node.
1806 * @param *db A pointer for debug information.
1807 * @param *irg The ir graph the node belong to.
1808 * @param *block The block the node belong to.
1810 ir_node *new_rd_EndReg (dbg_info *db, ir_graph *irg, ir_node *block);
1813 * Constructor for a EndExcept node.
1815 * @param *db A pointer for debug information.
1816 * @param *irg The ir graph the node belong to.
1817 * @param *block The block the node belong to.
1819 ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
1822 * Constructor for a Break node.
1824 * @param *db A pointer for debug information.
1825 * @param *irg The ir graph the node belong to.
1826 * @param *block The block the node belong to.
1828 ir_node *new_rd_Break (dbg_info *db, ir_graph *irg, ir_node *block);
1832 * Constructor for a Filter node.
1834 * @param *db A pointer for debug information.
1835 * @param *irg The ir graph the node belong to.
1836 * @param *block The block the node belong to.
1841 ir_node *new_rd_Filter (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1842 ir_mode *mode, long proj);
1845 * Constructor for a FuncCall node.
1847 * @param *db A pointer for debug information.
1848 * @param *irg The ir graph the node belong to.
1849 * @param *block The block the node belong to.
1850 * @param *callee A pointer to the called procedure.
1851 * @param arity The number of procedure parameters.
1852 * @param *in[] An array with the pointers to the parameters. The constructor
1853 * copies this array. The constructor copies this array.
1854 * @param *tp Type information of the procedure called.
1856 ir_node *new_rd_FuncCall (dbg_info *db, ir_graph *irg, ir_node *block,
1857 ir_node *callee, int arity, ir_node *in[],
1860 /*-------------------------------------------------------------------------*/
1861 /* The raw interface without debug support */
1862 /*-------------------------------------------------------------------------*/
1864 /* Constructs a Block with a fixed number of predecessors.
1865 Does not set current_block. Can not be used with automatic
1866 Phi node costruction. */
1869 * Constructor for a Block node.
1871 * @param irg The ir graph the block belongs to.
1872 * @param arity The number of control predecessors.
1873 * @param in[] An array of control predecessors. The length of
1874 * the array must be 'arity'. The constructor copies this array.
1876 ir_node *new_r_Block (ir_graph *irg, int arity, ir_node *in[]);
1879 * Constructor for a Start node.
1881 * @param *irg The ir graph the node belongs to.
1882 * @param *block The ir block the node belongs to.
1884 ir_node *new_r_Start (ir_graph *irg, ir_node *block);
1887 * Constructor for a End node.
1889 * @param *irg The ir graph the node belongs to.
1890 * @param *block The ir block the node belongs to.
1892 ir_node *new_r_End (ir_graph *irg, ir_node *block);
1895 * Constructor for a Jmp node.
1897 * @param *irg The ir graph the node belongs to.
1898 * @param *block The ir block the node belongs to.
1900 ir_node *new_r_Jmp (ir_graph *irg, ir_node *block);
1903 * Constructor for a Cond node.
1905 * @param *irg The ir graph the node belongs to.
1906 * @param *block The ir block the node belongs to.
1907 * @param *c The conditions parameter.Can be of mode b or I_u.
1909 ir_node *new_r_Cond (ir_graph *irg, ir_node *block, ir_node *c);
1912 * Constructor for a Return node.
1914 * @param *irg The ir graph the node belongs to.
1915 * @param *block The ir block the node belongs to.
1916 * @param *store The state of memory.
1917 * @param arity Number of array indexes.
1918 * @param *in[] Array with index inputs to the node. The constructor copies this array.
1920 ir_node *new_r_Return (ir_graph *irg, ir_node *block,
1921 ir_node *store, int arity, ir_node *in[]);
1924 * Constructor for a Raise node.
1926 * @param *irg The ir graph the node belongs to.
1927 * @param *block The ir block the node belongs to.
1928 * @param *store The current memory.
1929 * @param *obj A pointer to the Except variable.
1933 ir_node *new_r_Raise (ir_graph *irg, ir_node *block,
1934 ir_node *store, ir_node *obj);
1937 * Constructor for a Const node.
1939 * @param *irg The ir graph the node belongs to.
1940 * @param *block The ir block the node belongs to.
1941 * @param *mode The mode of the operands and the results.
1942 * @param *con Points to an entry in the constant table. This pointer is
1943 * added to the attributes of the node (self->attr.con).
1946 ir_node *new_r_Const (ir_graph *irg, ir_node *block,
1947 ir_mode *mode, tarval *con);
1949 * Constructor for a SymConst node.
1951 * @param *irg The ir graph the node belongs to.
1952 * @param *block The ir block the node belongs to.
1954 * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
1956 ir_node *new_r_SymConst (ir_graph *irg, ir_node *block,
1957 type_or_id_p value, symconst_kind symkind);
1960 * Constructor for a Sel node.
1962 * @param *irg The ir graph the node belongs to.
1963 * @param *block The ir block the node belongs to.
1964 * @param *store The memory in which the object the entity should be selected from is allocated.
1965 * @param *objptr The object from that the Sel operation selects a single attribute out.
1966 * @param *n_index The index of the selected object from the array.
1967 * @param *index[] Array with index inputs to the node. The constructor copies this array.
1968 * @param *ent The entity to select.
1970 ir_node *new_r_Sel (ir_graph *irg, ir_node *block, ir_node *store,
1971 ir_node *objptr, int n_index, ir_node *index[],
1975 * Constructor for a InstOf node.
1977 * @param *irg The ir graph the node belongs to.
1978 * @param *block The ir block the node belongs to.
1985 ir_node *new_r_InstOf (ir_graph *irg, ir_node *block, ir_node *x, ir_node *y, type *z);
1988 * Constructor for a Call node.
1990 * @param *irg The ir graph the node belongs to.
1991 * @param *block The ir block the node belongs to.
1992 * @param * store The actual store.
1993 * @param *callee A pointer to the called procedure.
1994 * @param arity The number of procedure parameters.
1995 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
1996 * @param *tp Type information of the procedure called.
2000 ir_node *new_r_Call (ir_graph *irg, ir_node *block, ir_node *store,
2001 ir_node *callee, int arity, ir_node *in[],
2005 * Constructor for a Add node.
2007 * @param *irg The ir graph the node belongs to.
2008 * @param *block The ir block the node belongs to.
2009 * @param *op1 The operand 1.
2010 * @param *op2 The operand 2.
2011 * @param *mode The mode of the operands and the result.
2016 ir_node *new_r_Add (ir_graph *irg, ir_node *block,
2017 ir_node *op1, ir_node *op2, ir_mode *mode);
2020 * Constructor for a Sub node.
2022 * @param *irg The ir graph the node belongs to.
2023 * @param *block The ir block the node belongs to.
2024 * @param *op1 The operand 1.
2025 * @param *op2 The operand 2.
2026 * @param *mode The mode of the operands and the results.
2030 ir_node *new_r_Sub (ir_graph *irg, ir_node *block,
2031 ir_node *op1, ir_node *op2, ir_mode *mode);
2034 * Constructor for a Minus node.
2036 * @param *irg The ir graph the node belongs to.
2037 * @param *block The ir block the node belongs to.
2038 * @param *op The operand.
2039 * @param *mode The mode of the operand and the result.
2043 ir_node *new_r_Minus (ir_graph *irg, ir_node *block,
2044 ir_node *op, ir_mode *mode);
2046 * Constructor for a Mul node.
2048 * @param *irg The ir graph the node belongs to.
2049 * @param *block The ir block the node belongs to.
2050 * @param *op1 The operand 1.
2051 * @param *op2 The operand 2.
2052 * @param *mode The mode of the operands and the result.
2056 ir_node *new_r_Mul (ir_graph *irg, ir_node *block,
2057 ir_node *op1, ir_node *op2, ir_mode *mode);
2060 * Constructor for a Quot node.
2062 * @param *irg The ir graph the node belongs to.
2063 * @param *block The ir block the node belongs to.
2064 * @param *memop The store needed to model exceptions
2065 * @param *op1 The operand 1.
2066 * @param *op2 The operand 2.
2070 ir_node *new_r_Quot (ir_graph *irg, ir_node *block,
2071 ir_node *memop, ir_node *op1, ir_node *op2);
2074 * Constructor for a DivMod node.
2076 * @param *irg The ir graph the node belongs to.
2077 * @param *block The ir block the node belongs to.
2078 * @param *memop The store needed to model exceptions
2079 * @param *op1 The operand 1.
2080 * @param *op2 The operand 2.
2084 ir_node *new_r_DivMod (ir_graph *irg, ir_node *block,
2085 ir_node *memop, ir_node *op1, ir_node *op2);
2088 * Constructor for a Div node.
2090 * @param *irg The ir graph the node belongs to.
2091 * @param *block The ir block the node belongs to.
2092 * @param *memop The store needed to model exceptions
2093 * @param *op1 The operand 1.
2094 * @param *op2 The operand 2.
2098 ir_node *new_r_Div (ir_graph *irg, ir_node *block,
2099 ir_node *memop, ir_node *op1, ir_node *op2);
2102 * Constructor for a Mod node.
2104 * @param *irg The ir graph the node belongs to.
2105 * @param *block The ir block the node belongs to.
2106 * @param *memop The store needed to model exceptions
2107 * @param *op1 The operand 1.
2108 * @param *op2 The operand 2.
2112 ir_node *new_r_Mod (ir_graph *irg, ir_node *block,
2113 ir_node *memop, ir_node *op1, ir_node *op2);
2116 * Constructor for a Abs node.
2118 * @param *irg The ir graph the node belongs to.
2119 * @param *block The ir block the node belongs to.
2120 * @param *op The operand
2121 * @param *mode The mode of the operands and the result.
2125 ir_node *new_r_Abs (ir_graph *irg, ir_node *block,
2126 ir_node *op, ir_mode *mode);
2129 * Constructor for a And node.
2131 * @param *irg The ir graph the node belongs to.
2132 * @param *block The ir block the node belongs to.
2133 * @param *op1 The operand 1.
2134 * @param *op2 The operand 2.
2135 * @param *mode The mode of the operands and the result.
2139 ir_node *new_r_And (ir_graph *irg, ir_node *block,
2140 ir_node *op1, ir_node *op2, ir_mode *mode);
2143 * Constructor for a Or node.
2145 * @param *irg The ir graph the node belongs to.
2146 * @param *block The ir block the node belongs to.
2147 * @param *op1 The operand 1.
2148 * @param *op2 The operand 2.
2149 * @param *mode The mode of the operands and the result.
2153 ir_node *new_r_Or (ir_graph *irg, ir_node *block,
2154 ir_node *op1, ir_node *op2, ir_mode *mode);
2157 * Constructor for a Eor node.
2159 * @param *irg The ir graph the node belongs to.
2160 * @param *block The ir block the node belongs to.
2161 * @param *op1 The operand 1.
2162 * @param *op2 The operand 2.
2163 * @param *mode The mode of the operands and the results.
2167 ir_node *new_r_Eor (ir_graph *irg, ir_node *block,
2168 ir_node *op1, ir_node *op2, ir_mode *mode);
2171 * Constructor for a Not node.
2173 * @param *irg The ir graph the node belongs to.
2174 * @param *block The ir block the node belongs to.
2175 * @param *op The operand.
2176 * @param *mode The mode of the operand and the result.
2180 ir_node *new_r_Not (ir_graph *irg, ir_node *block,
2181 ir_node *op, ir_mode *mode);
2184 * Constructor for a Cmp node.
2186 * @param *irg The ir graph the node belongs to.
2187 * @param *block The ir block the node belongs to.
2188 * @param *op1 The operand 1.
2189 * @param *op2 The operand 2.
2193 ir_node *new_r_Cmp (ir_graph *irg, ir_node *block,
2194 ir_node *op1, ir_node *op2);
2197 * Constructor for a Shl node.
2199 * @param *irg The ir graph the node belongs to.
2200 * @param *block The ir block the node belongs to.
2201 * @param *op The operand.
2202 * @param *k The number of bits to shift the operand .
2203 * @param *mode The mode of the operand and the result.
2207 ir_node *new_r_Shl (ir_graph *irg, ir_node *block,
2208 ir_node *op, ir_node *k, ir_mode *mode);
2211 * Constructor for a Shr node.
2213 * @param *irg The ir graph the node belongs to.
2214 * @param *block The ir block the node belongs to.
2215 * @param *op The operand.
2216 * @param *k The number of bits to shift the operand .
2217 * @param *mode The mode of the operand and the result.
2221 ir_node *new_r_Shr (ir_graph *irg, ir_node *block,
2222 ir_node *op, ir_node *k, ir_mode *mode);
2225 * Constructor for a Shrs node.
2227 * @param *irg The ir graph the node belongs to.
2228 * @param *block The ir block the node belongs to.
2229 * @param *op The operand.
2230 * @param *k The number of bits to shift the operand.
2231 * @param *mode The mode of the operand and the result.
2235 ir_node *new_r_Shrs (ir_graph *irg, ir_node *block,
2236 ir_node *op, ir_node *k, ir_mode *mode);
2239 * Constructor for a Rot node.
2241 * @param *irg The ir graph the node belongs to.
2242 * @param *block The ir block the node belongs to.
2243 * @param *op The operand.
2244 * @param *k The number of bits to rotate the operand.
2245 * @param *mode The mode of the operand.
2249 ir_node *new_r_Rot (ir_graph *irg, ir_node *block,
2250 ir_node *op, ir_node *k, ir_mode *mode);
2253 * Constructor for a Conv node.
2255 * @param *irg The ir graph the node belongs to.
2256 * @param *block The ir block the node belongs to.
2257 * @param *op The operand.
2258 * @param *mode The mode of this the operand muss be converted .
2262 ir_node *new_r_Conv (ir_graph *irg, ir_node *block,
2263 ir_node *op, ir_mode *mode);
2266 * Constructor for a Cast node.
2268 * @param *irg The ir graph the node belongs to.
2269 * @param *block The ir block the node belongs to.
2270 * @param *op The operand.
2271 * @param *to_tp The type of this the operand muss be casted .
2275 ir_node *new_r_Cast (ir_graph *irg, ir_node *block,
2276 ir_node *op, type *to_tp);
2278 * Constructor for a Phi node.
2280 * @param *irg The ir graph the node belongs to.
2281 * @param *block The ir block the node belongs to.
2282 * @param arity The number of predecessors
2283 * @param *in[] Array with predecessors. The constructor copies this array.
2284 * @param *mode The mode of it's inputs and output.
2288 ir_node *new_r_Phi (ir_graph *irg, ir_node *block, int arity,
2289 ir_node *in[], ir_mode *mode);
2291 * Constructor for a Load node.
2293 * @param *irg The ir graph the node belongs to.
2294 * @param *block The ir block the node belongs to.
2295 * @param *store The current memory
2296 * @param *adr A pointer to the variable to be read in this memory.
2300 ir_node *new_r_Load (ir_graph *irg, ir_node *block,
2301 ir_node *store, ir_node *adr);
2303 * Constructor for a Store node.
2305 * @param *irg The ir graph the node belongs to.
2306 * @param *block The ir block the node belongs to.
2307 * @param *store The current memory
2308 * @param *adr A pointer to the variable to be read in this memory.
2309 * @param *val The value to write to this variable.
2312 ir_node *new_r_Store (ir_graph *irg, ir_node *block,
2313 ir_node *store, ir_node *adr, ir_node *val);
2315 * Constructor for a Alloc node.
2317 * @param *irg The ir graph the node belongs to.
2318 * @param *block The ir block the node belongs to.
2319 * @param *store The memory which shall contain the new variable.
2320 * @param *size The number of bytes to allocate.
2321 * @param *alloc_type The type of the allocated variable.
2322 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
2326 ir_node *new_r_Alloc (ir_graph *irg, ir_node *block, ir_node *store,
2327 ir_node *size, type *alloc_type, where_alloc where);
2329 * Constructor for a Free node.
2331 * @param *irg The ir graph the node belongs to.
2332 * @param *block The ir block the node belongs to.
2333 * @param *store The memory which shall contain the new variable.
2334 * @param *ptr The pointer to the object to free.
2335 * @param *size The number of objects of type free_type to free in a sequence.
2336 * @param *free_type The type of the freed variable.
2340 ir_node *new_r_Free (ir_graph *irg, ir_node *block, ir_node *store,
2341 ir_node *ptr, ir_node *size, type *free_type);
2343 * Constructor for a Sync node.
2345 * @param *irg The ir graph the node belongs to.
2346 * @param *block The ir block the node belongs to.
2347 * @param arity The number of memories to syncronize.
2348 * @param *in[] An array of pointers to nodes that produce an output of type memory. The constructor copies this array.
2352 ir_node *new_r_Sync (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2355 * Constructor for a Proj node.
2357 * @param *irg The ir graph the node belongs to.
2358 * @param *block The ir block the node belongs to.
2359 * @param arg A node producing a tuple.
2360 * @param *mode The mode of the value to project.
2361 * @param proj The position of the value in the tuple.
2365 ir_node *new_r_Proj (ir_graph *irg, ir_node *block, ir_node *arg,
2366 ir_mode *mode, long proj);
2369 * Constructor for a defaultProj node.
2371 * @param *irg The ir graph the node belongs to.
2372 * @param *block The ir block the node belongs to.
2373 * @param arg A node producing a tuple.
2374 * @param max_ proj The end position of the value in the tuple.
2378 ir_node *new_r_defaultProj (ir_graph *irg, ir_node *block, ir_node *arg, long max_proj);
2382 * Constructor for a Tuple node.
2384 * @param *irg The ir graph the node belongs to.
2385 * @param *block The ir block the node belongs to.
2386 * @param arity The number of tuple elements.
2387 * @param *in[] An array containing pointers to the nodes producing the tuple elements. The constructor copies this array.
2391 ir_node *new_r_Tuple (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2393 * Constructor for a Id node.
2395 * @param *irg The ir graph the node belongs to.
2396 * @param *block The ir block the node belongs to.
2398 * @param *mode The mode of *val.
2402 ir_node *new_r_Id (ir_graph *irg, ir_node *block,
2403 ir_node *val, ir_mode *mode);
2406 * Constructor for a Bad node.
2408 * @param *irg The ir graph the node belongs to.
2412 ir_node *new_r_Bad (ir_graph *irg);
2415 * Constructor for a Confirm node.
2417 * @param *irg The ir graph the node belong to.
2418 * @param *block The ir block the node belong to.
2425 ir_node *new_r_Confirm (ir_graph *irg, ir_node *block,
2426 ir_node *val, ir_node *bound, pn_Cmp cmp);
2429 * Constructor for a Unknown node.
2431 * @param *irg The ir graph the node belongs to.
2436 ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2439 * Constructor for a CallBegin node.
2441 * @param *irg The ir graph the node belong to.
2442 * @param *block The block the node belong to.
2443 * @param *callee The call node bisible in the intra procedural view.
2447 ir_node *new_r_CallBegin(ir_graph *irg, ir_node *block, ir_node *callee);
2450 * Constructor for a EndReg node.
2452 * @param *irg The ir graph the node belong to.
2453 * @param *block The block the node belong to.
2457 ir_node *new_r_EndReg (ir_graph *irg, ir_node *block);
2460 * Constructor for a EndExcept node.
2462 * @param *irg The ir graph the node belong to.
2463 * @param *block The block the node belong to.
2467 ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
2470 * Constructor for a Break node.
2472 * @param *irg The ir graph the node belong to.
2473 * @param *block The block the node belong to.
2477 ir_node *new_r_Break (ir_graph *irg, ir_node *block);
2481 * Costructor for a Filter node.
2483 * @param *irg The ir graph the node belong to.
2484 * @param *block The block the node belong to.
2490 ir_node *new_r_Filter (ir_graph *irg, ir_node *block, ir_node *arg,
2491 ir_mode *mode, long proj);
2493 * Constructor for a FuncCall node.
2495 * @param *irg The ir graph the node belong to.
2496 * @param *block The block the node belong to.
2497 * @param *callee A pointer to the called procedure.
2498 * @param arity The number of procedure parameters.
2499 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2500 * @param *type Type information of the procedure called.
2504 ir_node *new_r_FuncCall (ir_graph *irg, ir_node *block,
2505 ir_node *callee, int arity, ir_node *in[],
2508 /*-----------------------------------------------------------------------*/
2509 /* The block oriented interface */
2510 /*-----------------------------------------------------------------------*/
2512 /** Sets the current block in which the following constructors place the
2513 nodes they construct. */
2514 void switch_block (ir_node *target);
2516 /* Constructs a Block with a fixed number of predecessors.
2517 Does set current_block. Can be used with automatic Phi
2518 node construction. */
2521 * Constructor for a Block node. Adds the block to the graph in current_ir_graph .
2523 * @param *db A Pointer for debug information.
2524 * @param arity The number of control predecessors.
2525 * @param in An array of control predecessors. The length of
2526 * the array must be 'arity'.
2529 ir_node *new_d_Block(dbg_info* db, int arity, ir_node *in[]);
2532 * Constructor for a Start node. Adds the node to the block in current_ir_block.
2534 * @param *db A pointer for debug information.
2538 ir_node *new_d_Start (dbg_info* db);
2541 * Constructor for a End node. Adds the node to the block in current_ir_block.
2543 * @param *db A pointer for debug information.
2547 ir_node *new_d_End (dbg_info* db);
2550 * Constructor for a Jmp node. Adds the node to the block in current_ir_block.
2552 * @param *db A pointer for debug information.
2556 ir_node *new_d_Jmp (dbg_info* db);
2559 * Constructor for a Cond node. Adds the node to the block in current_ir_block.
2561 * @param *db A pointer for debug information.
2562 * @param *c The conditions parameter.Can be of mode b or I_u.
2566 ir_node *new_d_Cond (dbg_info* db, ir_node *c);
2569 * Constructor for a Return node. Adds the node to the block in current_ir_block.
2571 * @param *db A pointer for debug information.
2572 * @param *store The state of memory.
2573 * @param arity Number of array indexes.
2574 * @param *in Array with index inputs to the node.
2578 ir_node *new_d_Return (dbg_info* db, ir_node *store, int arity, ir_node *in[]);
2581 * Constructor for a Raise node. Adds the node to the block in current_ir_block.
2583 * @param *db A pointer for debug information.
2584 * @param *store The current memory.
2585 * @param *obj A pointer to the Except variable.
2589 ir_node *new_d_Raise (dbg_info* db, ir_node *store, ir_node *obj);
2592 * Constructor for a Const_type node. Adds the node to the block in current_ir_block.
2594 * @param *db A pointer for debug information.
2595 * @param *mode The mode of the operands and redults.
2596 * @param *con Points to an entry in the constant table. This pointer is added to the attributes of the node (self->attr.con).
2597 * @param *tp The type of the constante.
2601 ir_node *new_d_Const_type (dbg_info* db, ir_mode *mode, tarval *con, type *tp);
2604 * Constructor for a Const node. Adds the node to the block in current_ir_block.
2606 * @param *db A pointer for debug information.
2607 * @param *mode The mode of the operands and redults.
2608 * @param *con Points to an entry in the constant table. This pointer is added to the attributes of the node (self->attr.con).
2612 ir_node *new_d_Const (dbg_info* db, ir_mode *mode, tarval *con);
2615 * Constructor for a SymConst node. Adds the node to the block in current_ir_block.
2617 * @param *db A pointer for debug information.
2619 * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
2623 ir_node *new_d_SymConst (dbg_info* db, type_or_id_p value, symconst_kind kind);
2626 * Constructor for a simpleSel node. Adds the node to the block in current_ir_block.
2628 * @param *db A pointer for debug information.
2629 * @param *store The memory in which the object the entity should be selected from is allocated.
2630 * @param *objptr The object from that the Sel operation selects a single attribute out.
2631 * @param *ent The entity to select.
2635 ir_node *new_d_simpleSel(dbg_info* db, ir_node *store, ir_node *objptr, entity *ent);
2638 * Constructor for a Sel node. Adds the node to the block in current_ir_block.
2640 * @param *db A pointer for debug information.
2641 * @param *store The memory in which the object the entity should be selected from is allocated.
2642 * @param *objptr The object from that the Sel operation selects a single attribute out.
2643 * @param arity The index of the selected object from the array.
2644 * @param *in Array with index inputs to the node.
2645 * @param *ent The entity to select.
2649 ir_node *new_d_Sel (dbg_info* db, ir_node *store, ir_node *objptr, int arity, ir_node *in[],
2653 * Constructor for a InstOf node. Adds the node to the block in current_ir_block.
2655 * @param *db A pointer for debug information.
2662 ir_node *new_d_InstOf (dbg_info* db, ir_node *store, ir_node *objptr, type *ent);
2665 * Constructor for a Call node. Adds the node to the block in current_ir_block.
2667 * @param *db A pointer for debug information.
2668 * @param *store The actual store.
2669 * @param *callee A pointer to the called procedure.
2670 * @param arity The number of procedure parameters.
2671 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2672 * @param *tp Type information of the procedure called.
2676 ir_node *new_d_Call (dbg_info* db, ir_node *store, ir_node *callee, int arity, ir_node *in[],
2680 * Constructor for a Add node. Adds the node to the block in current_ir_block.
2682 * @param *db A pointer for debug information.
2683 * @param *op1 The operand 1.
2684 * @param *op2 The operand 2.
2685 * @param *mode The mode of the operands and the result.
2689 ir_node *new_d_Add (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2692 * Constructor for a Sub node. Adds the node to the block in current_ir_block.
2694 * @param *db A pointer for debug information.
2695 * @param *op1 The operand 1.
2696 * @param *op2 The operand 2.
2697 * @param *mode The mode of the operands and the result.
2701 ir_node *new_d_Sub (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2704 * Constructor for a Minus node. Adds the node to the block in current_ir_block.
2706 * @param *db A pointer for debug information.
2707 * @param *op The operand .
2708 * @param *mode The mode of the operand and the result.
2712 ir_node *new_d_Minus (dbg_info* db, ir_node *op, ir_mode *mode);
2715 * Constructor for a Mul node. Adds the node to the block in current_ir_block.
2717 * @param *db A pointer for debug information.
2718 * @param *op1 The operand 1.
2719 * @param *op2 The operand 2.
2720 * @param *mode The mode of the operands and the result.
2724 ir_node *new_d_Mul (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2727 * Constructor for a Quot node. Adds the node to the block in current_ir_block.
2729 * @param *db A pointer for debug information.
2730 * @param *memop The store needed to model exceptions
2731 * @param *op1 The operand 1.
2732 * @param *op2 The operand 2.
2736 ir_node *new_d_Quot (dbg_info* db, ir_node *memop, ir_node *op1, ir_node *op2);
2739 * Constructor for a DivMod node. Adds the node to the block in current_ir_block.
2741 * @param *db A pointer for debug information.
2742 * @param *memop The store needed to model exceptions
2743 * @param *op1 The operand 1.
2744 * @param *op2 The operand 2.
2748 ir_node *new_d_DivMod (dbg_info* db, ir_node *memop, ir_node *op1, ir_node *op2);
2751 * Constructor for a Div node. Adds the node to the block in current_ir_block.
2753 * @param *db A pointer for debug information.
2754 * @param *memop The store needed to model exceptions
2755 * @param *op1 The operand 1.
2756 * @param *op2 The operand 2.
2760 ir_node *new_d_Div (dbg_info* db, ir_node *memop, ir_node *op1, ir_node *op2);
2763 * Constructor for a Mod node. Adds the node to the block in current_ir_block.
2765 * @param *db A pointer for debug information.
2766 * @param *memop The store needed to model exceptions
2767 * @param *op1 The operand 1.
2768 * @param *op2 The operand 2.
2772 ir_node *new_d_Mod (dbg_info* db, ir_node *memop, ir_node *op1, ir_node *op2);
2775 * Constructor for a Abs node. Adds the node to the block in current_ir_block.
2777 * @param *db A pointer for debug information.
2778 * @param *op The operand
2779 * @param *mode The mode of the operands and the result.
2783 ir_node *new_d_Abs (dbg_info* db, ir_node *op, ir_mode *mode);
2786 * Constructor for a And node. Adds the node to the block in current_ir_block.
2788 * @param *db A pointer for debug information.
2789 * @param *irg The ir graph the node belongs to.
2790 * @param *block The ir block the node belongs to.
2791 * @param *op1 The operand 1.
2792 * @param *op2 The operand 2.
2793 * @param *mode The mode of the operands and the result.
2797 ir_node *new_d_And (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2800 * Constructor for a Or node. Adds the node to the block in current_ir_block.
2802 * @param *db A pointer for debug information.
2803 * @param *op1 The operand 1.
2804 * @param *op2 The operand 2.
2805 * @param *mode The mode of the operands and the result.
2809 ir_node *new_d_Or (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2812 * Constructor for a Eor node. Adds the node to the block in current_ir_block.
2814 * @param *db A pointer for debug information.
2815 * @param *op1 The operand 1.
2816 * @param *op2 The operand 2.
2817 * @param *mode The mode of the operands and the results.
2821 ir_node *new_d_Eor (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2824 * Constructor for a Not node. Adds the node to the block in current_ir_block.
2826 * @param *db A pointer for debug information.
2827 * @param *op The operand.
2828 * @param *mode The mode of the operand and the result.
2832 ir_node *new_d_Not (dbg_info* db, ir_node *op, ir_mode *mode);
2835 * Constructor for a Shl node. Adds the node to the block in current_ir_block.
2837 * @param *db A pointer for debug information.
2838 * @param *op The operand.
2839 * @param *k The number of bits to shift the operand .
2840 * @param *mode The mode of the operand and the result.
2844 ir_node *new_d_Shl (dbg_info* db, ir_node *op, ir_node *k, ir_mode *mode);
2847 * Constructor for a Shr node. Adds the node to the block in current_ir_block.
2849 * @param *db A pointer for debug information.
2850 * @param *op The operand.
2851 * @param *k The number of bits to shift the operand .
2852 * @param *mode The mode of the operand and the result.
2856 ir_node *new_d_Shr (dbg_info* db, ir_node *op, ir_node *k, ir_mode *mode);
2859 * Constructor for a Shrs node. Adds the node to the block in current_ir_block.
2861 * @param *db A pointer for debug information.
2862 * @param *op The operand.
2863 * @param *k The number of bits to shift the operand .
2864 * @param *mode The mode of the operand and the result.
2868 ir_node *new_d_Shrs (dbg_info* db, ir_node *op, ir_node *k, ir_mode *mode);
2871 * Constructor for a Rot node. Adds the node to the block in current_ir_block.
2873 * @param *db A pointer for debug information.
2874 * @param *op The operand.
2875 * @param *k The number of bits to rotate the operand.
2876 * @param *mode The mode of the operand.
2880 ir_node *new_d_Rot (dbg_info* db, ir_node *op, ir_node *k, ir_mode *mode);
2883 * Constructor for a Cmp node. Adds the node to the block in current_ir_block.
2885 * @param *db A pointer for debug information.
2886 * @param *op1 The operand 1.
2887 * @param *op2 The operand 2.
2891 ir_node *new_d_Cmp (dbg_info* db, ir_node *op1, ir_node *op2);
2894 * Constructor for a Conv node. Adds the node to the block in current_ir_block.
2896 * @param *db A pointer for debug information.
2897 * @param *op The operand.
2898 * @param *mode The mode of this the operand muss be converted .
2902 ir_node *new_d_Conv (dbg_info* db, ir_node *op, ir_mode *mode);
2905 * Constructor for a Cast node. Adds the node to the block in current_ir_block.
2907 * @param *db A pointer for debug information.
2908 * @param *op The operand.
2909 * @param *to_tp The type of this the operand muss be casted .
2913 ir_node *new_d_Cast (dbg_info* db, ir_node *op, type *to_tp);
2916 * Constructor for a Phi node. Adds the node to the block in current_ir_block.
2918 * @param *db A pointer for debugginaromation.
2919 * @param arity The number of predecessors
2920 * @param *in Array with predecessors
2921 * @param *mode The mode of it's inputs and output.
2925 ir_node *new_d_Phi (dbg_info* db, int arity, ir_node *in[], ir_mode *mode);
2928 * Constructor for a Load node. Adds the node to the block in current_ir_block.
2930 * @param *db A pointer for debug information.
2931 * @param *store The current memory
2932 * @param *adr A pointer to the variable to be read in this memory.
2936 ir_node *new_d_Load (dbg_info* db, ir_node *store, ir_node *addr);
2939 * Constructor for a Store node. Adds the node to the block in current_ir_block.
2941 * @param *db A pointer for debug information.
2942 * @param *store The current memory
2943 * @param *adr A pointer to the variable to be read in this memory.
2944 * @param *val The value to write to this variable.
2947 ir_node *new_d_Store (dbg_info* db, ir_node *store, ir_node *addr, ir_node *val);
2950 * Constructor for a Alloc node. Adds the node to the block in current_ir_block.
2952 * @param *db A pointer for debug information.
2953 * @param *store The memory which shall contain the new variable.
2954 * @param *size The number of bytes to allocate.
2955 * @param *alloc_type The type of the allocated variable.
2956 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
2960 ir_node *new_d_Alloc (dbg_info* db, ir_node *store, ir_node *size, type *alloc_type,
2964 * Constructor for a Free node. Adds the node to the block in current_ir_block.
2966 * @param *db A pointer for debug information.
2967 * @param *store The memory which shall contain the new variable.
2968 * @param *ptr The pointer to the object to free.
2969 * @param *size The number of objects of type free_type to free in a sequence.
2970 * @param *free_type The type of the freed variable.
2974 ir_node *new_d_Free (dbg_info* db, ir_node *store, ir_node *ptr, ir_node *size,
2978 * Constructor for a Sync node. Adds the node to the block in current_ir_block.
2980 * @param *db A pointer for debug information.
2981 * @param arity The number of memories to syncronize.
2982 * @param **in An array of pointers to nodes that produce an output of type memory.
2986 ir_node *new_d_Sync (dbg_info* db, int arity, ir_node *in[]);
2990 * Constructor for a Proj node. Adds the node to the block in current_ir_block.
2992 * @param *db A pointer for deubugginformation.
2993 * @param arg A node producing a tuple.
2994 * @param *mode The mode of the value to project.
2995 * @param proj The position of the value in the tuple.
2999 ir_node *new_d_Proj (dbg_info* db, ir_node *arg, ir_mode *mode, long proj);
3003 * Constructor for a defaultProj node. Adds the node to the block in current_ir_block.
3005 * @param *db A pointer for debug information.
3006 * @param arg A node producing a tuple.
3007 * @param max_ proj The end position of the value in the tuple.
3011 ir_node *new_d_defaultProj (dbg_info* db, ir_node *arg, long max_proj);
3014 * Constructor for a Tuple node. Adds the node to the block in current_ir_block.
3016 * @param *db A pointer for debug information.
3017 * @param arity The number of tuple elements.
3018 * @param **in An array containing pointers to the nodes producing the tuple elements.
3022 ir_node *new_d_Tuple (dbg_info* db, int arity, ir_node *in[]);
3026 * Constructor for a Id node. Adds the node to the block in current_ir_block.
3027 * Performs the Id operation, i.e., does nothing.
3029 * @param *db A pointer for debug information.
3030 * @param *val The operand to Id.
3031 * @param *mode The mode of *val.
3035 ir_node *new_d_Id (dbg_info* db, ir_node *val, ir_mode *mode);
3038 * Returns the unique Bad node. Same as get_irn_bad(..);
3041 ir_node *new_d_Bad (void);
3044 * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3045 * Specifies constraints for a value. To support dataflow analyses.
3047 * Example: If the value never exceeds '100' this is expressed by placing a
3048 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
3050 * @param *db A pointer for debug information.
3051 * @param *val The value we express a constraint for
3052 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3053 * @param cmp The compare operation.
3057 ir_node *new_d_Confirm (dbg_info* db, ir_node *val, ir_node *bound, pn_Cmp cmp);
3061 * Constructor for a Unknown node. Represents an arbtrary valus. Places the node in
3064 * @param *m The mode of the unknown value.
3068 ir_node *new_d_Unknown(ir_mode *m);
3071 * Constructor for a CallBegin node. Adds the node to the block in current_ir_block.
3073 * @param *db A pointer for debug information.
3074 * @param *callee The call node bisible in the intra procedural view.
3078 ir_node *new_d_CallBegin(dbg_info *db, ir_node *callee);
3081 * Constructor for a EndReg node. Adds the node to the block in current_ir_block.
3083 * @param *db A pointer for debug information.
3087 ir_node *new_d_EndReg (dbg_info *db);
3090 * Constructor for a Endexcept node. Adds the node to the block in current_ir_block.
3092 * @param *db A pointer for debug information.
3096 ir_node *new_d_EndExcept(dbg_info *db);
3099 * Constructor for a Breake node. Adds the node to the block in current_ir_block.
3101 * @param *db A pointer for debug information.
3106 ir_node *new_d_Break (dbg_info *db);
3108 /** Constructor for a Filter node.
3110 * Constructor for a Filter node. Adds the node to the block in
3111 * current_ir_block. Filter is a node with two views used to
3112 * construct the interprocedural view. In intraprocedural view its
3113 * semantics are identical to the Proj node. In interprocedural view
3114 * the Filter performs the Phi operation on method parameters or
3115 * results. Other than a Phi a Filter node may not be removed if it
3116 * has only a single input.
3118 * The constructor builds the Filter in intraprocedural view.
3120 * @param *db A pointer for debug information.
3121 * @param *arg The tuple value to project from.
3122 * @param *mode The mode of the projected value.
3123 * @param proj The position in the tuple to project from.
3127 ir_node *new_d_Filter (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3131 * Constructor for a FuncCall node. Adds the node to the block in current_ir_block.
3133 * @param *db A pointer for debug information.
3134 * @param *callee A pointer to the called procedure.
3135 * @param arity The number of procedure parameters.
3136 * @param **in An array with the pointers to the parameters. The constructor copies this array.
3137 * @param *tp Type information of the procedure called.
3142 ir_node *new_d_FuncCall (dbg_info* db, ir_node *callee, int arity, ir_node *in[],
3145 /*-----------------------------------------------------------------------*/
3146 /* The block oriented interface without debug support */
3147 /*-----------------------------------------------------------------------*/
3149 /* Needed from the interfase with debug support:
3150 void switch_block (ir_node *target); */
3152 /* Constructs a Block with a fixed number of predecessors.
3153 Does set current_block. Can be used with automatic Phi
3154 node construction. */
3156 /** Constructor for a Block node.
3158 * Constructor for a Block node. Adds the block to the graph in
3159 * current_ir_graph .
3161 * @param arity The number of control predecessors.
3162 * @param in An array of control predecessors. The length of
3163 * the array must be 'arity'.
3165 ir_node *new_Block(int arity, ir_node *in[]);
3169 * Constructor for a Start node. Adds the node to the block in current_ir_block.
3173 ir_node *new_Start (void);
3177 * Constructor for a End node. Adds the node to the block in current_ir_block.
3181 ir_node *new_End (void);
3185 * Constructor for a EndReg node. Adds the node to the block in current_ir_block.
3189 ir_node *new_EndReg (void);
3191 /** Constructor for an EndExpcept node.
3193 * Constructor for an EndExpcept node. Adds the node to the block in current_ir_block.
3198 ir_node *new_EndExcept(void);
3202 * Constructor for a Jump node. Adds the node to the block in current_ir_block.
3206 ir_node *new_Jmp (void);
3210 * Constructor for a Break node. Adds the node to the block in current_ir_block.
3214 ir_node *new_Break (void);
3217 * Constructor for a Cond node. Adds the node to the block in current_ir_block.
3219 * @param *c The conditions parameter.Can be of mode b or I_u.
3223 ir_node *new_Cond (ir_node *c);
3226 * Constructor for a Return node. Adds the node to the block in current_ir_block.
3228 * @param *store The state of memory.
3229 * @param arity Number of array indexes.
3230 * @param *in Array with index inputs to the node.
3234 ir_node *new_Return (ir_node *store, int arity, ir_node *in[]);
3237 * Constructor for a Raise node. Adds the node to the block in current_ir_block.
3239 * @param *store The current memory.
3240 * @param *obj A pointer to the Except variable.
3244 ir_node *new_Raise (ir_node *store, ir_node *obj);
3247 * Constructor for a Const node. Adds the node to the block in current_ir_block.
3249 * @param *mode The mode of the operands and redults.
3250 * @param *con Points to an entry in the constant table. This pointer is added to the attributes of the node (self->attr.con).
3254 ir_node *new_Const (ir_mode *mode, tarval *con);
3257 * Constructor for a SymConst node. Adds the node to the block in current_ir_block.
3260 * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
3264 ir_node *new_SymConst (type_or_id_p value, symconst_kind kind);
3267 * Constructor for a simpelSel node.
3269 * @param *store The memory in which the object the entity should be selected from is allocated.
3270 * @param *objptr The object from that the Sel operation selects a single attribute out.
3271 * @param *ent The entity to select.
3275 ir_node *new_simpleSel(ir_node *store, ir_node *objptr, entity *ent);
3278 * Constructor for a Sel node.
3280 * @param *store The memory in which the object the entity should be selected from is allocated.
3281 * @param *objptr The object from that the Sel operation selects a single attribute out.
3282 * @param *n_index The index of the selected object from the array.
3283 * @param *index Array with index inputs to the node.
3284 * @param *ent The entity to select.
3288 ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3292 * Constructor for a InstOf node. Adds the node to the block in current_ir_block.
3300 ir_node *new_InstOf (ir_node *store, ir_node *obj, type *ent);
3303 * Constructor for a Call node. Adds the node to the block in current_ir_block.
3305 * @param *store The actual store.
3306 * @param *callee A pointer to the called procedure.
3307 * @param arity The number of procedure parameters.
3308 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3309 * @param *tp Type information of the procedure called.
3313 ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node *in[],
3317 * Constructor for a CallBegin node. Adds the node to the block in current_ir_block.
3319 * @param *callee A pointer to the called procedure.
3323 ir_node *new_CallBegin(ir_node *callee);
3326 * Constructor for a Add node. Adds the node to the block in current_ir_block.
3328 * @param *op1 The operand 1.
3329 * @param *op2 The operand 2.
3330 * @param *mode The mode of the operands and the result.
3334 ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
3337 * Constructor for a Sub node. Adds the node to the block in current_ir_block.
3339 * @param *op1 The operand 1.
3340 * @param *op2 The operand 2.
3341 * @param *mode The mode of the operands and the result.
3345 ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
3348 * Constructor for a Minus node. Adds the node to the block in current_ir_block.
3350 * @param *op The operand .
3351 * @param *mode The mode of the operand and the result.
3355 ir_node *new_Minus (ir_node *op, ir_mode *mode);
3358 * Constructor for a Mul node. Adds the node to the block in current_ir_block.
3360 * @param *op1 The operand 1.
3361 * @param *op2 The operand 2.
3362 * @param *mode The mode of the operands and the result.
3366 ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
3369 * Constructor for a Quot node. Adds the node to the block in current_ir_block.
3371 * @param *memop The store needed to model exceptions
3372 * @param *op1 The operand 1.
3373 * @param *op2 The operand 2.
3377 ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2);
3380 * Constructor for a DivMod node. Adds the node to the block in current_ir_block.
3382 * @param *memop The store needed to model exceptions
3383 * @param *op1 The operand 1.
3384 * @param *op2 The operand 2.
3388 ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
3391 * Constructor for a Div node. Adds the node to the block in current_ir_block.
3393 * @param *memop The store needed to model exceptions
3394 * @param *op1 The operand 1.
3395 * @param *op2 The operand 2.
3399 ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2);
3402 * Constructor for a Mod node. Adds the node to the block in current_ir_block.
3404 * @param *memop The store needed to model exceptions
3405 * @param *op1 The operand 1.
3406 * @param *op2 The operand 2.
3410 ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2);
3413 * Constructor for a Abs node. Adds the node to the block in current_ir_block.
3415 * @param *op The operand
3416 * @param *mode The mode of the operands and the result.
3420 ir_node *new_Abs (ir_node *op, ir_mode *mode);
3423 * Constructor for a And node. Adds the node to the block in current_ir_block.
3425 * @param *op1 The operand 1.
3426 * @param *op2 The operand 2.
3427 * @param *mode The mode of the operands and the result.
3430 ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
3433 * Constructor for a Or node. Adds the node to the block in current_ir_block.
3435 * @param *op1 The operand 1.
3436 * @param *op2 The operand 2.
3437 * @param *mode The mode of the operands and the result.
3441 ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
3444 * Constructor for a Eor node. Adds the node to the block in current_ir_block.
3446 * @param *op1 The operand 1.
3447 * @param *op2 The operand 2.
3448 * @param *mode The mode of the operands and the results.
3452 ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
3455 * Constructor for a Not node. Adds the node to the block in current_ir_block.
3457 * @param *op The operand.
3458 * @param *mode The mode of the operand and the result.
3462 ir_node *new_Not (ir_node *op, ir_mode *mode);
3465 * Constructor for a Shl node. Adds the node to the block in current_ir_block.
3467 * @param *op The operand.
3468 * @param *k The number of bits to shift the operand .
3469 * @param *mode The mode of the operand and the result.
3473 ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
3476 * Constructor for a Shr node. Adds the node to the block in current_ir_block.
3478 * @param *op The operand.
3479 * @param *k The number of bits to shift the operand .
3480 * @param *mode The mode of the operand and the result.
3484 ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
3487 * Constructor for a Shrs node. Adds the node to the block in current_ir_block.
3489 * @param *op The operand.
3490 * @param *k The number of bits to shift the operand .
3491 * @param *mode The mode of the operand and the result.
3495 ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
3498 * Constructor for a Rot node. Adds the node to the block in current_ir_block.
3500 * @param *op The operand.
3501 * @param *k The number of bits to rotate the operand.
3502 * @param *mode The mode of the operand.
3506 ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode);
3509 * Constructor for a Cmp node. Adds the node to the block in current_ir_block.
3511 * @param *op1 The operand 1.
3512 * @param *op2 The operand 2.
3516 ir_node *new_Cmp (ir_node *op1, ir_node *op2);
3519 * Constructor for a Conv node. Adds the node to the block in current_ir_block.
3521 * @param *op The operand.
3522 * @param *mode The mode of this the operand muss be converted .
3526 ir_node *new_Conv (ir_node *op, ir_mode *mode);
3529 * Constructor for a Cast node. Adds the node to the block in current_ir_block.
3531 * @param *op The operand.
3532 * @param *to_tp The type of this the operand muss be casted .
3536 ir_node *new_Cast (ir_node *op, type *to_tp);
3539 * Constructor for a Phi node. Adds the node to the block in current_ir_block.
3541 * @param arity The number of predecessors
3542 * @param *in Array with predecessors
3543 * @param *mode The mode of it's inputs and output.
3547 ir_node *new_Phi (int arity, ir_node *in[], ir_mode *mode);
3550 * Constructor for a Load node.
3552 * @param *store The current memory
3553 * @param *addr A pointer to the variable to be read in this memory.
3557 ir_node *new_Load (ir_node *store, ir_node *addr);
3560 * Constructor for a Store node.
3562 * @param *store The current memory
3563 * @param *addr A pointer to the variable to be read in this memory.
3564 * @param *val The value to write to this variable.
3567 ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
3570 * Constructor for a Alloc node. Adds the node to the block in current_ir_block.
3572 * @param *store The memory which shall contain the new variable.
3573 * @param *size The number of bytes to allocate.
3574 * @param *alloc_type The type of the allocated variable.
3575 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3579 ir_node *new_Alloc (ir_node *store, ir_node *size, type *alloc_type,
3584 * Constructor for a Free node. Adds the node to the block in current_ir_block.
3586 * @param *store The memory which shall contain the new variable.
3587 * @param *ptr The pointer to the object to free.
3588 * @param *size The number of objects of type free_type to free in a sequence.
3589 * @param *free_type The type of the freed variable.
3593 ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
3597 * Constructor for a Sync node. Adds the node to the block in current_ir_block.
3599 * @param arity The number of memories to syncronize.
3600 * @param **in An array of pointers to nodes that produce an output of type memory.
3604 ir_node *new_Sync (int arity, ir_node *in[]);
3607 * Constructor for a Proj node. Adds the node to the block in current_ir_block.
3609 * @param arg A node producing a tuple.
3610 * @param *mode The mode of the value to project.
3611 * @param proj The position of the value in the tuple.
3615 ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
3619 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
3627 ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj);
3630 * Constructor for a defaultProj node.Adds the node to the block in current_ir_block.
3632 * @param arg A node producing a tuple.
3633 * @param max_ proj The end position of the value in the tuple.
3637 ir_node *new_defaultProj (ir_node *arg, long max_proj);
3640 * Constructor for a Tuple node. Adds the node to the block in current_ir_block.
3642 * @param arity The number of tuple elements.
3643 * @param **in An array containing pointers to the nodes producing the tuple elements.
3647 ir_node *new_Tuple (int arity, ir_node *in[]);
3650 * Constructor for a Id node. Adds the node to the block in current_ir_block.
3653 * @param *mode The mode of *val.
3657 ir_node *new_Id (ir_node *val, ir_mode *mode);
3661 * Constructor for a Bad node.
3662 * Adds the node to the block in current_ir_block.
3666 ir_node *new_Bad (void);
3669 * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3677 ir_node *new_Confirm (ir_node *val, ir_node *bound, pn_Cmp cmp);
3680 * Constructor for a Unknown node. Adds the node to the block in current_ir_block.
3686 ir_node *new_Unknown(ir_mode *m);
3689 * Constructor for a FuncCall node. Adds the node to the block in current_ir_block.
3691 * @param *callee A pointer to the called procedure.
3692 * @param arity The number of procedure parameters.
3693 * @param **in An array with the pointers to the parameters. The constructor copies this array.
3694 * @param *tp Type information of the procedure called.
3698 ir_node *new_FuncCall (ir_node *callee, int arity, ir_node *in[],
3701 /*---------------------------------------------------------------------*/
3702 /* The comfortable interface. */
3703 /* Supports automatic Phi node construction. */
3704 /* All routines of the block oriented interface except new_Block are */
3706 /*---------------------------------------------------------------------*/
3708 /* --- Block construction --- */
3709 /* immature Block without predecessors */
3710 ir_node *new_d_immBlock (dbg_info* db);
3711 ir_node *new_immBlock (void);
3713 /** Add a control flow edge to an immature block. */
3714 void add_in_edge (ir_node *immblock, ir_node *jmp);
3716 /** fixes the number of predecessors of a block. */
3717 void mature_block (ir_node *block);
3719 /* --- Parameter administration --- */
3720 /* Read a value from the array with the local variables. Use this
3721 function to obtain the last definition of the value associated with
3722 pos. Pos may not exceed the value passed as n_loc to new_ir_graph. */
3723 ir_node *get_d_value (dbg_info* db, int pos, ir_mode *mode);
3724 ir_node *get_value (int pos, ir_mode *mode);
3726 /** Write a value in the array with the local variables. Use this function
3727 to remember a new definition of the value associated with pos. Pos may
3728 not exceed the value passed as n_loc to new_ir_graph. */
3729 void set_value (int pos, ir_node *value);
3732 Use this function to get the most recent version of the store (type M).
3733 Internally it does the same as get_value. */
3734 ir_node *get_store (void);
3736 /** Write a store. */
3737 void set_store (ir_node *store);
3739 /** keep this node alive even if End is not control-reachable from it */
3740 void keep_alive (ir_node *ka);
3742 /* --- Useful access routines --- */
3743 /** Returns the current block of the current graph. To set the current
3744 block use switch_block(). */
3745 ir_node *get_cur_block(void);
3747 /** Returns the frame type of the current graph */
3748 type *get_cur_frame_type(void);
3751 /* --- initialize and finalize ir construction --- */
3753 /** Puts the graph into state "phase_high" */
3754 void finalize_cons (ir_graph *irg);
3756 /* --- Initialization --- */
3759 * This function is called, whenever a local variable is used before definition
3761 * @parameter mode the mode of the local var
3762 * @pos position choosen be the frontend for this var
3764 * @return a firm node of mode @p mode that initialises the var at position pos
3767 * Do not return NULL
3768 * If this function is not set, FIRM will create a const node with tarval BAD
3770 typedef ir_node *default_initialize_local_variable_func_t(ir_mode *mode, int pos);
3773 * Initializes the graph construction.
3775 * @param func @see default_initialize_local_variable_func_t
3777 void init_cons (default_initialize_local_variable_func_t *func);
3779 # endif /* _IRCONS_H_ */