2 * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * File name: ir/ir/ircons.h
23 * Purpose: Various irnode constructors. Automatic construction
24 * of SSA representation.
25 * Author: Martin Trapp, Christian Schaefer
26 * Modified by: Goetz Lindenmaier, Boris Boesler, Michael Beck
29 * Copyright: (c) 1998-2006 Universität Karlsruhe
34 Ideas for improvement:
35 -# Handle construction of exceptions more comfortable:
36 Add new constructors that pass the exception region (or better the
37 Phi for the memories, the ex. region can be found from there) as parameter,
38 constructor then adds all Proj nodes and returns the pointer
39 to the Proj node that selects the result of the arithmetic operation.
40 -# Maybe hide the exception region in a global variable, especially if
41 it is always unambiguous.
47 * documentation no more supported since 2001
49 * ir node construction.
51 * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier
53 * This file documents all datatypes and constructors needed to
54 * build a FIRM representation of a procedure. The constructors are
55 * also implemented in this file.
57 * The documentation also gives a short manual how to use the library.
59 * For extensive documentation of FIRM see UKA Techreport 1999-14.
62 * Three kinds of nodes
63 * --------------------
65 * There are three kinds of nodes known to the ir: entities,
68 * + ir_nodes are the actual nodes of the FIRM intermediate representation.
69 * They represent operations on the data of the program and control flow
72 * + entity ==> implemented in entity.h
73 * Refers to a single entity of the compiled program, e.g. a field of a
74 * class or a method. If a method or variable can not be assigned to
75 * a method or class or the like, it is a global object.
77 * + types ==> implemented in type.h
78 * With types type information is represented. There are several type
81 * Implementation of the FIRM operations: ir_node
82 * ----------------------------------------------
84 * Ir_nodes represent operations on the data of the program and control flow
85 * operations. Examples of ir_nodes: Add, Jmp, Cmp
87 * FIRM is a dataflow graph. A dataflow graph is a directed graph,
88 * so that every node has incoming and outgoing edges. A node is
89 * executable if every input at it's incoming edges is available.
90 * Execution of the dataflow graph is started at the Start node which
91 * has no incoming edges and ends when the End node executes, even if
92 * there are still executable or not executed nodes. (Is this true,
93 * or must all executable nodes be executed?) (There are exceptions
94 * to the dataflow paradigma that all inputs have to be available
95 * before a node can execute: Phi, Block. See UKA Techreport
98 * The implementation of FIRM differs from the view as a dataflow
99 * graph. To allow fast traversion of the graph edges are
100 * implemented as C-pointers. Inputs to nodes are not ambiguous, the
101 * results can be used by several other nodes. Each input can be
102 * implemented as a single pointer to a predecessor node, outputs
103 * need to be lists of pointers to successors. Therefore a node
104 * contains pointers to it's predecessor so that the implementation is a
105 * dataflow graph with reversed edges. It has to be traversed bottom
108 * All nodes of the ir have the same basic structure. They are
109 * distinguished by a field containing the opcode.
111 * The fields of an ir_node:
113 * kind A firm_kind tag containing k_ir_node. This is useful for
114 * dynamically checking the type of a node.
116 * *op This ir_op gives the opcode as a tag and a string
117 * and the number of attributes of an ir_node. There is
118 * one statically allocated struct ir_op for each opcode.
120 * *mode The ir_mode of the operation represented by this firm
121 * node. The mode of the operation is the mode of it's
122 * result. A Firm mode is a datatype as known to the target,
123 * not a type of the source language.
125 * visit A flag for traversing the ir.
127 * **in An array with pointers to the node's predecessors.
129 * *link A pointer to an ir_node. With this pointer all Phi nodes
130 * are attached to a Block, i.e., a Block points to it's
131 * first Phi node, this node points to the second Phi node
132 * in the Block and so fourth. Used in mature_immBlock
133 * to find all Phi nodes to be matured. It's also used to
134 * annotate a node with a better, optimized version of it.
136 * attr An attr struct containing the attributes of the nodes. The
137 * attributes depend on the opcode of the node. The number
138 * of these attributes is given in op.
142 * Not yet documented. See irop.h.
146 * Not yet documented. See irmode.h.
148 * GLOBAL VARIABLES -- now also fields of ir_graph.
151 * current_ir_graph Points to the current ir_graph. All constructors for
152 * nodes add nodes to this graph.
154 * ir_visited An int used as flag to traverse the ir_graph.
156 * block_visited An int used as a flag to traverse block nodes in the
159 * Others not yet documented.
163 * CONSTRUCTOR FOR IR_GRAPH --> see irgraph.h
164 * ========================
167 * PROCEDURE TO CONSTRUCT AN IR GRAPH --> see also Firm tutorial
168 * ==================================
170 * This library supplies several interfaces to construct a FIRM graph for
172 * - A "comfortable" interface generating SSA automatically. Automatically
173 * computed predecessors of nodes need not be specified in the constructors.
174 * (new_<Node> constructurs and a set of additional routines.)
175 * - A less comfortable interface where all predecessors except the block
176 * an operation belongs to need to be specified. SSA must be constructed
177 * by hand. (new_<Node> constructors and set_cur_block()). This interface
178 * is called "block oriented". It automatically calles the local optimizations
180 * - An even less comfortable interface where the block needs to be specified
181 * explicitly. This is called the "raw" interface. (new_r_<Node>
182 * constructors). These nodes are not optimized.
184 * To use the functionality of the comfortable interface correctly the Front
185 * End needs to follow certain protocols. This is explained in the following.
186 * To build a correct IR with the other interfaces study the semantics of
187 * the firm node (See tech-reprot UKA 1999-14). For the construction of
188 * types and entities see the documentation in those modules.
190 * First the Frontend needs to decide which variables and values used in
191 * a procedure can be represented by dataflow edges. These are variables
192 * that need not be saved to memory as they cause no side effects visible
193 * out of the procedure. Often these are all compiler generated
194 * variables and simple local variables of the procedure as integers,
195 * reals and pointers. The frontend has to count and number these variables.
197 * First an ir_graph needs to be constructed with new_ir_graph. The
198 * constructor gets the number of local variables. The graph is hold in the
199 * global variable irg.
201 * Now the construction of the procedure can start. Several basic blocks can
202 * be constructed in parallel, but the code within each block needs to
203 * be constructed (almost) in program order.
205 * A global variable holds the current basic block. All (non block) nodes
206 * generated are added to this block. The current block can be set with
207 * set_cur_block(block). If several blocks are constructed in parallel block
208 * switches need to be performed constantly.
210 * To generate a Block node (with the comfortable interface) it's predecessor
211 * control flow nodes need not be known. In case of cyclic control flow these
212 * can not be known when the block is constructed. With add_immBlock_pred(block,
213 * cfnode) predecessors can be added to the block. If all predecessors are
214 * added to the block mature_immBlock(b) needs to be called. Calling mature_immBlock
215 * early improves the efficiency of the Phi node construction algorithm.
216 * But if several blocks are constructed at once, mature_immBlock must only
217 * be called after performing all set_values and set_stores in the block!
218 * (See documentation of new_immBlock constructor.)
220 * The constructors of arithmetic nodes require that their predecessors
221 * are mentioned. Sometimes these are available in the Frontend as the
222 * predecessors have just been generated by the frontend. If they are local
223 * values the predecessors can be obtained from the library with a call to
224 * get_value(local_val_nr). (local_val_nr needs to be administered by
225 * the Frontend.) A call to get_value triggers the generation of Phi nodes.
226 * If an arithmetic operation produces a local value this value needs to be
227 * passed to the library by set_value(node, local_val_nr).
228 * In straight line code these two operations just remember and return the
229 * pointer to nodes producing the value. If the value passes block boundaries
230 * Phi nodes can be inserted.
231 * Similar routines exist to manage the Memory operands: set_store and
234 * Several nodes produce more than one result. An example is the Div node.
235 * Such nodes return tuples of values. From these individual values can be
236 * extracted by proj nodes.
238 * The following example illustrates the construction of a simple basic block
239 * with two predecessors stored in variables cf_pred1 and cf_pred2, containing
242 * and finally jumping to an other block. The variable a got the local_val_nr
243 * 42 by the frontend.
245 * ir_node *this_block, *cf_pred1, *cf_pred2, *a_val, *mem, *div, *res, *cf_op;
247 * this_block = new_immBlock();
248 * add_immBlock_pred(this_block, cf_pred1);
249 * add_immBlock_pred(this_block, cf_pred2);
250 * mature_immBlock(this_block);
251 * a_val = get_value(42, mode_Iu);
253 * div = new_Div(mem, a_val, a_val);
254 * mem = new_Proj(div, mode_M, 0); * for the numbers for Proj see docu *
255 * res = new_Proj(div, mode_Iu, 2);
257 * set_value(res, 42);
260 * For further information look at the documentation of the nodes and
261 * constructors and at the paragraph COPING WITH DATA OBJECTS at the
262 * end of this documentation.
264 * The comfortable interface contains the following routines further explained
267 * ir_node *new_immBlock (void);
268 * ir_node *new_Start (void);
269 * ir_node *new_End (void);
270 * ir_node *new_Jmp (void);
271 * ir_node *new_IJmp (ir_node *tgt);
272 * ir_node *new_Cond (ir_node *c);
273 * ir_node *new_Return (ir_node *store, int arity, ir_node **in);
274 * ir_node *new_Const (ir_mode *mode, tarval *con);
275 * ir_node *new_SymConst (symconst_symbol value, symconst_kind kind);
276 * ir_node *new_simpleSel (ir_node *store, ir_node *objptr, ir_entity *ent);
277 * ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity,
278 * ir_node **in, ir_entity *ent);
279 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity,
280 * ir_node **in, type_method *type);
281 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
282 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
283 * ir_node *new_Minus (ir_node *op, ir_mode *mode);
284 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
285 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2);
286 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
287 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2);
288 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2);
289 * ir_node *new_Abs (ir_node *op, ir_mode *mode);
290 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
291 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
292 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
293 * ir_node *new_Not (ir_node *op, ir_mode *mode);
294 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
295 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
296 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
297 * ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode);
298 * ir_node *new_Cmp (ir_node *op1, ir_node *op2);
299 * ir_node *new_Conv (ir_node *op, ir_mode *mode);
300 * ir_node *new_Cast (ir_node *op, ir_type *to_tp);
301 * ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode);
302 * ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode);
303 * ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode);
304 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
305 * ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
306 * where_alloc where);
307 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
308 * ir_type *free_type, where_alloc where);
309 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
310 * ir_node *new_NoMem (void);
311 * ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
312 * ir_node *new_Psi (int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
313 * ir_node *new_CopyB (ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
314 * ir_node *new_InstOf (ir_node *store, ir_node obj, ir_type *ent);
315 * ir_node *new_Raise (ir_node *store, ir_node *obj);
316 * ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
317 * ir_node *new_Pin (ir_node *node);
319 * void add_immBlock_pred (ir_node *block, ir_node *jmp);
320 * void mature_immBlock (ir_node *block);
321 * void set_cur_block (ir_node *target);
322 * ir_node *get_value (int pos, ir_mode *mode);
323 * void set_value (int pos, ir_node *value);
324 * ir_node *get_store (void);
325 * void set_store (ir_node *store);
326 * keep_alive (ir_node ka)
328 * IR_NODES AND CONSTRUCTORS FOR IR_NODES
329 * =======================================
331 * All ir_nodes are defined by a common data structure. They are distinguished
332 * by their opcode and differ in the number of their attributes.
334 * The constructor for the block node sets current_block to itself.
335 * Const nodes are always added to the start block.
336 * All other constructors add the created node to the current_block.
337 * swich_block(block) allows to set the current block to block.
339 * Watch for my inconsistent use of input and predecessor (dataflow view)
340 * and `the node points to' (implementation view).
342 * The following description of the nodes lists four properties them if these
344 * - the parameters to the constructor
345 * - the inputs of the Firm node
346 * - the outputs of the Firm node
347 * - attributes to the node
351 * ir_node *new_immBlock (void)
352 * ----------------------------
354 * Creates a new block. Sets current_block to itself. When a new block is
355 * created it cannot be known how many predecessors this block will have in the
356 * control flow graph. Therefore the list of inputs can not be fixed at
357 * creation. Predecessors can be added with add_immBlock_pred (block, control flow
358 * operation). With every added predecessor the number of inputs to Phi nodes
361 * The block can be completed by mature_immBlock(block) if all predecessors are
362 * known. If several blocks are built at once, mature_immBlock can only be called
363 * after set_value has been called for all values that are life at the end
364 * of the block. This is necessary so that Phi nodes created mature_immBlock
365 * get the right predecessors in case of cyclic dependencies. If all set_values
366 * of this block are called after maturing it and before calling get_value
367 * in some block that is control flow dependent on this block, the construction
370 * Example for faulty ir construction: (draw the graph on a paper and you'll
373 * block_before_loop = new_block();
375 * mature_immBlock(block_before_loop);
376 * before2header = new_Jmp;
378 * loop_header = new_block ();
379 * header2body - new_Jmp();
381 * loop_body = new_block ();
382 * body2header = new_Jmp();
384 * add_immBlock_pred(loop_header, before2header);
385 * add_immBlock_pred(loop_header, body2header);
386 * add_immBlock_pred(loop_body, header2body);
388 * mature_immBlock(loop_header);
389 * mature_immBlock(loop_body);
391 * get_value(loop_body, x); // gets the Phi in loop_header
392 * set_value(loop_header, x); // sets the value the above get_value should
393 * // have returned!!!
395 * Mature_immBlock also fixes the number of inputs to the Phi nodes. Mature_immBlock
396 * should be called as early as possible, as afterwards the generation of Phi
397 * nodes is more efficient.
400 * There is an input for each control flow predecessor of the block.
401 * The input points to an instruction producing an output of type X.
402 * Possible predecessors: Start, Jmp, Cond, Raise or Return or any node
403 * possibly causing an exception. (Often the real predecessors are Projs.)
405 * Mode BB (R), all nodes belonging to this block should consume this output.
406 * As they are strict (except Block and Phi node) it is a necessary condition
407 * that the block node executed before any other node in this block executes.
409 * block.matured Indicates whether the block is mature.
411 * This attribute contains all local values valid in this
412 * block. This is needed to build the Phi nodes and removed
413 * if the graph is complete. This field is used by the
414 * internal construction algorithm and should not be accessed
418 * ir_node *new_Block (int arity, ir_node **in)
419 * --------------------------------------------
421 * Creates a new Block with the given list of predecessors. This block
422 * is mature. As other constructors calls optimization and vrfy for the
423 * block. If one of the predecessors is Unknown (as it has to be filled in
424 * later) optimizations are skipped. This is necessary to
425 * construct Blocks in loops. Leaving Unknown in the Block after finishing
426 * the construction may have strange effects, especially for interprocedural
427 * representation and analysis.
430 * CONTROL FLOW OPERATIONS
431 * -----------------------
433 * In each block there must be exactly one of the control flow
434 * operations Start, End, Jmp, Cond, Return or Raise. The output of a
435 * control flow operation points to the block to be executed next.
437 * ir_node *new_Start (void)
438 * -------------------------
440 * Creates a start node. Not actually needed public. There is only one such
441 * node in each procedure which is automatically created by new_ir_graph.
444 * No inputs except the block it belogns to.
446 * A tuple of 4 (5, 6) distinct values. These are labeled by the following
447 * projection numbers (pn_Start):
448 * * pn_Start_X_initial_exec mode X, points to the first block to be exe * cuted.
449 * * pn_Start_M mode M, the global store
450 * * pn_Start_P_frame_base mode P, a pointer to the base of the proce * dures stack frame.
451 * * pn_Start_P_globals mode P, a pointer to the part of the memory * containing_all_ global things.
452 * * pn_Start_T_args mode T, a tuple containing all arguments of * the procedure.
455 * ir_node *new_End (void)
456 * -----------------------
458 * Creates an end node. Not actually needed public. There is only one such
459 * node in each procedure which is automatically created by new_ir_graph.
462 * No inputs except the block it belongs to.
466 * ir_node *new_Jmp (void)
467 * -----------------------
469 * Creates a Jmp node.
472 * The block the node belongs to
474 * Control flow to the next block.
476 * ir_node *new_IJmp (ir_node *tgt)
477 * -----------------------
479 * Creates an IJmp node.
482 * The node that represents the target jump address
484 * Control flow to an unknown target, must be pinned by
487 * ir_node *new_Cond (ir_node *c)
488 * ------------------------------
490 * Creates a Cond node. There are two versions of this node.
496 * A tuple of two control flows. The first is taken if the input is
497 * false, the second if it is true.
501 * A value of mode I_u. (i)
503 * A tuple of n control flows. If the Cond's input is i, control
504 * flow will procede along output i. If the input is >= n control
505 * flow proceeds along output n.
507 * ir_node *new_Return (ir_node *store, int arity, ir_node **in)
508 * -------------------------------------------------------------
510 * The return node has as inputs the results of the procedure. It
511 * passes the control flow to the end_block.
517 * Control flow to the end block.
521 * ir_node *new_Const (ir_mode *mode, tarval *con)
522 * -----------------------------------------------
524 * Creates a constant in the constant table and adds a Const node
525 * returning this value to the start block.
528 * *mode The mode of the constant.
529 * *con Points to an entry in the constant table.
530 * This pointer is added to the attributes of
531 * the node (self->attr.con)
533 * No inputs except the block it belogns to.
535 * The constant value.
537 * attr.con A tarval* pointer to the proper entry in the constant
540 * ir_node *new_SymConst (union symconst_symbol value, symconst_addr_ent kind)
541 * ---------------------------------------------------------------------------
543 * There are three kinds of symbolic constants:
544 * symconst_type_tag The symbolic constant represents a type tag.
545 * symconst_type_size The symbolic constant represents the size of a type.
546 * symconst_type_align The symbolic constant represents the alignment of a type.
547 * symconst_addr_name Information for the linker, e.g. the name of a global
549 * symconst_addr_name The symbolic constant represents the address of an entity.
551 * To represent a pointer to an entity that is represented by an entity
552 * datastructure don't use
553 * new_SymConst((type_or_id*)get_entity_ld_ident(ent), symconst_addr_name);.
554 * Use a real const instead:
555 * new_SymConst(ent, symconst_addr_ent);
556 * This makes the Constant independent of name changes of the entity due to
560 * kind The kind of the symbolic constant: type_tag, size or link_info.
561 * *type_or_id Points to the type the tag stands for or to the type
562 * whose size is represented by the constant or to an ident
563 * representing the linkage info.
566 * No inputs except the block it belogns to.
568 * An unsigned integer (I_u) or a pointer (P).
571 * attr.i.num The symconst_addr_ent, i.e. one of
573 * -symconst_type_size
574 * -symconst_type_align
575 * -symconst_addr_name
577 * If the attr.i.num is symconst_type_tag, symconst_type_size or symconst_type_align,
578 * the node contains an attribute:
580 * attr.i.*type, a pointer to a type_class. The mode of the node is mode_Is.
581 * if it is linkage_ptr_info it contains
582 * attr.i.*ptrinfo, an ident holding information for the linker. The mode
583 * of the node is mode_P_mach.
587 * ir_node *new_simpleSel (ir_node *store, ir_node *frame, ir_entity *sel)
588 * -----------------------------------------------------------------------
591 * Selects an entity from a compound type. This entity can be a field or
595 * *store The memory in which the object the entity should be selected
597 * *frame The pointer to the object.
598 * *sel The entity to select.
601 * The memory containing the object.
602 * A pointer to the object.
603 * An unsigned integer.
605 * A pointer to the selected entity.
607 * attr.sel Pointer to the entity
610 * ir_node *new_Sel (ir_node *store, ir_node *frame, int arity, ir_node **in,
611 * --------------------------------------------------------------------------
615 * Selects a field from an array type. The entity has as owner the array, as
616 * type the arrays element type. The indices to access an array element are
620 * *store The memory in which the object the entity should be selected from
622 * *frame The pointer to the object.
623 * *arity number of array indices.
624 * *in array with index inputs to the node.
625 * *sel The entity to select.
628 * The memory containing the object.
629 * A pointer to the object.
630 * As much unsigned integer as there are array expressions.
632 * A pointer to the selected entity.
634 * attr.sel Pointer to the entity
636 * The constructors new_Sel and new_simpleSel generate the same ir nodes.
637 * simpleSel just sets the arity of the index inputs to zero.
640 * ARITHMETIC OPERATIONS
641 * ---------------------
643 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node **in,
644 * ----------------------------------------------------------------------------
648 * Creates a procedure call.
651 * *store The actual store.
652 * *callee A pointer to the called procedure.
653 * arity The number of procedure parameters.
654 * **in An array with the pointers to the parameters.
655 * The constructor copies this array.
656 * *type Type information of the procedure called.
659 * The store, the callee and the parameters.
661 * A tuple containing the eventually changed store and the procedure
664 * attr.call Contains the type information for the procedure.
667 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode)
668 * ------------------------------------------------------------
672 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode)
673 * ------------------------------------------------------------
677 * ir_node *new_Minus (ir_node *op, ir_mode *mode)
678 * -----------------------------------------------
680 * Unary Minus operations on integer and floating point values.
682 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode)
683 * ------------------------------------------------------------
687 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2)
688 * --------------------------------------------------------------
690 * Quot performs exact division of floating point numbers. It's mode
691 * is Tuple, the mode of the result must be annotated to the Proj
692 * that extracts the result of the arithmetic operations.
695 * The store needed to model exceptions and the two operands.
697 * A tuple contaning a memory and a execution for modeling exceptions
698 * and the result of the arithmetic operation.
700 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2)
701 * ----------------------------------------------------------------
703 * Performs Div and Mod on interger values.
706 * A tuple contaning a memory and a execution for modeling exceptions
707 * and the two result of the arithmetic operations.
709 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2)
710 * -------------------------------------------------------------
714 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2)
715 * -------------------------------------------------------------
719 * ir_node *new_Abs (ir_node *op, ir_mode *mode)
720 * ---------------------------------------------
724 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode)
725 * ------------------------------------------------------------
729 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode)
730 * -----------------------------------------------------------
734 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode)
735 * ------------------------------------------------------------
739 * ir_node *new_Not (ir_node *op, ir_mode *mode)
740 * ---------------------------------------------
742 * This node constructs a constant where all bits are set to one
743 * and a Eor of this constant and the operator. This simulates a
746 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode)
747 * ---------------------------------------------------------
751 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode)
752 * ---------------------------------------------------------
754 * Logic shift right, i.e., zero extended.
757 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode)
758 * ----------------------------------------------------------
760 * Arithmetic shift right, i.e., sign extended.
762 * ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode)
763 * ---------------------------------------------------------
765 * Rotates the operand to the (right??) by k bits.
767 * ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode)
768 * ------------------------------------------------------------
770 * Calculates the Carry value for integer addition. Used only
773 * ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode)
774 * ------------------------------------------------------------
776 * Calculates the Borrow value for integer substraction. Used only
779 * ir_node *new_Conv (ir_node *op, ir_mode *mode)
780 * ---------------------------------------------
782 * Mode conversion. For allowed conversions see UKA Tech Report
785 * ir_node *new_Cmp (ir_node *op1, ir_node *op2)
786 * ---------------------------------------------
789 * The two values to be compared.
791 * A 16-tuple containing the results of the 16 different comparisons.
792 * The following is a list giving the comparisons and a projection
793 * number (pn_Cmp) to use in Proj nodes to extract the proper result.
797 * pn_Cmp_Le less or equal
799 * pn_Cmp_Ge greater of equal
800 * pn_Cmp_Lg less or greater
801 * pn_Cmp_Leg less, equal or greater = ordered
802 * pn_Cmp_Uo unordered
803 * pn_Cmp_Ue unordered or equal
804 * pn_Cmp_Ul unordered or less
805 * pn_Cmp_Ule unordered, less or equal
806 * pn_Cmp_Ug unordered or greater
807 * pn_Cmp_Uge unordered, greater or equal
808 * pn_Cmp_Ne unordered, less or greater = not equal
815 * In general, Phi nodes are automaitcally inserted. In some cases, if
816 * all predecessors of a block are known, an explicit Phi node constructor
817 * is needed. E.g., to construct a FIRM graph for a statement as
818 * a = (b==c) ? 2 : 5;
820 * ir_node *new_Phi (int arity, ir_node **in, ir_mode *mode)
821 * ---------------------------------------------------------
823 * Creates a Phi node. The in's order has to correspond to the order
824 * of in's of current_block. This is not checked by the library!
825 * If one of the predecessors is Unknown (as it has to be filled in
826 * later) optimizations are skipped. This is necessary to
827 * construct Phi nodes in loops. Leaving Unknown in the Phi after finishing
828 * the construction may have strange effects, especially for interprocedural
829 * representation and analysis.
832 * arity number of predecessors
833 * **in array with predecessors
834 * *mode The mode of it's inputs and output.
836 * A Phi node has as many inputs as the block it belongs to.
837 * Each input points to a definition of the same value on a
838 * different path in the control flow.
840 * The definition valid in this block.
842 * ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode)
843 * -----------------------------------------------------------------------------
845 * Creates a Mux node. This node implements the following semantic:
846 * If the sel node (which must be of mode_b) evaluates to true, its value is
847 * ir_true, else ir_false;
850 * ir_node *new_Psi (int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode)
851 * -----------------------------------------------------------------------------
853 * Creates a Psi node. This node implements the following semantic:
857 * OPERATIONS TO MANAGE MEMORY EXPLICITLY
858 * --------------------------------------
860 * ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode)
861 * ----------------------------------------------------------------
863 * The Load operation reads a value from memory.
866 * *store The current memory.
867 * *addr A pointer to the variable to be read in this memory.
868 * *mode The mode of the value to be loaded.
871 * The memory and a pointer to a variable in this memory.
873 * A tuple of the memory, a control flow to be taken in case of
874 * an exception and the loaded value.
876 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val)
877 * ----------------------------------------------------------------
879 * The Store operation writes a value to a variable in memory.
882 * The memory, a pointer to a variable in this memory and the value
883 * to write to this variable.
885 * A tuple of the changed memory and a control flow to be taken in
886 * case of an exception.
888 * ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
889 * -----------------------------------------------------------------------
893 * The Alloc node allocates a new variable. It can be specified whether the
894 * variable should be allocated to the stack or to the heap.
897 * *store The memory which shall contain the new variable.
898 * ** *size The number of bytes to allocate. Old. **
899 * *size We decided that the size easily can be derived from the type.
900 * This field is for allocating arrays, i.e., it gives the multiple
901 * of the size of alloc_type to allocate memory for.
902 * *alloc_type The type of the allocated variable.
903 * where Where to allocate the variable, either heap_alloc or stack_alloc.
906 * A memory and an unsigned integer.
908 * A tuple of the changed memory, a control flow to be taken in
909 * case of an exception and the pointer to the new variable.
911 * a.where Indicates where the variable is allocated.
912 * a.*type A pointer to the class the allocated data object
915 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size, ir_type *free_type,
916 * -----------------------------------------------------------------------------------
920 * The Free node frees memory of the given variable.
923 * *store The memory which shall contain the new variable.
924 * *ptr The pointer to the object to free.
925 * *size The number of objects of type free_type to free in a sequence.
926 * *free_type The type of the freed variable.
927 * where Where the variable was allocated, either heap_alloc or stack_alloc.
930 * A memory, a pointer and an unsigned integer.
932 * The changed memory.
934 * f.*type A pointer to the type information of the freed data object.
938 * ir_node *new_Sync (int arity, ir_node **in)
939 * -------------------------------------------
941 * The Sync operation unifies several partial memory blocks. These blocks
942 * have to be pairwise disjunct or the values in common locations have to
943 * be identical. This operation allows to specify all operations that eventually
944 * need several partial memory blocks as input with a single entrance by
945 * unifying the memories with a preceding Sync operation.
948 * arity The number of memories to synchronize.
949 * **in An array of pointers to nodes that produce an output of
954 * The unified memory.
960 * ir_node *new_Bad (void)
961 * -----------------------
963 * Returns the unique Bad node current_ir_graph->bad.
964 * This node is used to express results of dead code elimination.
966 * ir_node *new_NoMem (void)
967 * -----------------------------------------------------------------------------------
969 * Returns the unique NoMem node current_ir_graph->no_mem.
970 * This node is used as input for operations that need a Memory, but do not
971 * change it like Div by const != 0, analyzed calls etc.
973 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj)
974 * ----------------------------------------------------------
976 * Selects one entry of a tuple. This is a hidden edge with attributes.
979 * *arg A node producing a tuple.
980 * *mode The mode of the value to project.
981 * proj The position of the value in the tuple.
987 * ir_node *new_Tuple (int arity, ir_node **in)
988 * --------------------------------------------
990 * Builds a Tuple from single values. This is needed to implement
991 * optimizations that remove a node that produced a tuple. The node can be
992 * replaced by the Tuple operation so that the following Proj nodes have not to
993 * be changed. (They are hard to find due to the implementation with pointers
994 * in only one direction.) The Tuple node is smaller than any other
995 * node, so that a node can be changed into a Tuple by just changing it's
996 * opcode and giving it a new in array.
999 * arity The number of tuple elements.
1000 * **in An array containing pointers to the nodes producing the
1003 * ir_node *new_Id (ir_node *val, ir_mode *mode)
1004 * ---------------------------------------------
1006 * The single output of the Id operation is it's input. Also needed
1007 * for optimizations.
1010 * HIGH LEVEL OPERATIONS
1011 * ---------------------
1013 * ir_node *new_CopyB (ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type)
1014 * -----------------------------------------------------------------------------------
1016 * Describes a high level block copy of a compound type from address src to
1017 * address dst. Must be lowered to a Call to a runtime memory copy function.
1020 * HIGH LEVEL OPERATIONS: Exception Support
1021 * ----------------------------------------
1022 * See TechReport 1999-14, chapter Exceptions.
1024 * ir_node *new_InstOf(ir_node *store, ir_node *ptr, ir_type *type);
1025 * -----------------------------------------------------------------------------------
1027 * Describes a high level type check. Must be lowered to a Call to a runtime check
1030 * ir_node *new_Raise (ir_node *store, ir_node *obj)
1031 * -------------------------------------------------
1033 * Raises an exception. Unconditional change of control flow. Writes
1034 * an explicit Except variable to memory to pass it to the exception
1035 * handler. Must be lowered to a Call to a runtime check
1040 * A pointer to the Except variable.
1042 * A tuple of control flow and the changed memory state. The control flow
1043 * points to the exception handler if it is definied in this procedure,
1044 * else it points to the end_block.
1046 * ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
1047 * -----------------------------------------------------------------------------------
1049 * Describes a high level bounds check. Must be lowered to a Call to a runtime check
1052 * ir_node *new_Pin (ir_node *node);
1053 * -----------------------------------------------------------------------------------
1055 * Pin the value of the node node in the current block No users of the Pin node can
1056 * float above the Block of the Pin. The node cannot float behind this block. Often
1057 * used to Pin the NoMem node.
1060 * COPING WITH DATA OBJECTS
1061 * ========================
1063 * Two kinds of data objects have to be distinguished for generating
1064 * FIRM. First there are local variables other than arrays that are
1065 * known to be alias free. Second there are all other data objects.
1066 * For the first a common SSA representation is built, the second
1067 * are modeled by saving them to memory. The memory is treated as
1068 * a single local variable, the alias problem is hidden in the
1069 * content of this variable.
1071 * All values known in a Block are listed in the block's attribute,
1072 * block.**graph_arr which is used to automatically insert Phi nodes.
1073 * The following two functions can be used to add a newly computed value
1074 * to the array, or to get the producer of a value, i.e., the current
1077 * inline void set_value (int pos, ir_node *value)
1078 * -----------------------------------------------
1080 * Has to be called for every assignment to a local variable. It
1081 * adds the value to the array of used values at position pos. Pos
1082 * has to be a unique identifier for an entry in the procedure's
1083 * definition table. It can be used to access the value again.
1084 * Requires current_block to be set correctly.
1086 * ir_node *get_value (int pos, ir_mode *mode)
1087 * -------------------------------------------
1089 * Returns the node defining the value referred to by pos. If the
1090 * value is not defined in this block a Phi node is generated and
1091 * all definitions reaching this Phi node are collected. It can
1092 * happen that the algorithm allocates an unnecessary Phi node,
1093 * e.g. if there is only one definition of this value, but this
1094 * definition reaches the currend block on several different
1095 * paths. This Phi node will be eliminated if optimizations are
1096 * turned on right after it's creation.
1097 * Requires current_block to be set correctly.
1099 * There are two special routines for the global store:
1101 * void set_store (ir_node *store)
1102 * -------------------------------
1104 * Adds the store to the array of known values at a reserved
1106 * Requires current_block to be set correctly.
1108 * ir_node *get_store (void)
1109 * -------------------------
1111 * Returns the node defining the actual store.
1112 * Requires current_block to be set correctly.
1115 * inline void keep_alive (ir_node *ka)
1116 * ------------------------------------
1118 * Keep this node alive because it is (might be) not in the control
1119 * flow from Start to End. Adds the node to the list in the end
1123 #ifndef _FIRM_IR_IRCONS_H_
1124 #define _FIRM_IR_IRCONS_H_
1126 #include "firm_common.h"
1128 #include "irgraph.h"
1129 #include "dbginfo.h"
1131 /*-------------------------------------------------------------------------*/
1132 /* The raw interface */
1133 /*-------------------------------------------------------------------------*/
1135 /** Constructor for a Block node.
1137 * Constructs a mature block with the given predecessors. Use Unknown
1138 * nodes as predecessors to construct a block if the number of
1139 * predecessors is known, but not the predecessors themselves. This
1140 * constructor does not set current_block. It not be used with
1141 * automatic Phi node construction.
1143 * @param *db A Pointer for debug information.
1144 * @param irg The ir graph the block belongs to.
1145 * @param arity The number of control predecessors.
1146 * @param in[] An array of control predecessors. The length of
1147 * the array must be 'arity'. The constructor copies this array.
1149 ir_node *new_rd_Block (dbg_info *db, ir_graph *irg, int arity, ir_node *in[]);
1151 /** Constructor for a Start node.
1153 * @param *db A pointer for debug information.
1154 * @param *irg The ir graph the node belongs to.
1155 * @param *block The ir block the node belongs to.
1157 ir_node *new_rd_Start (dbg_info *db, ir_graph *irg, ir_node *block);
1159 /** Constructor for a End node.
1161 * @param *db A pointer for debug information.
1162 * @param *irg The ir graph the node belongs to.
1163 * @param *block The ir block the node belongs to.
1165 ir_node *new_rd_End (dbg_info *db, ir_graph *irg, ir_node *block);
1167 /** Constructor for a Jmp node.
1169 * Jmp represents control flow to a single control successor.
1171 * @param *db A pointer for debug information.
1172 * @param *irg The ir graph the node belongs to.
1173 * @param *block The ir block the node belongs to.
1175 ir_node *new_rd_Jmp (dbg_info *db, ir_graph *irg, ir_node *block);
1177 /** Constructor for an IJmp node.
1179 * IJmp represents control flow to a single control successor not
1180 * statically known i.e. an indirect Jmp.
1182 * @param *db A pointer for debug information.
1183 * @param *irg The ir graph the node belongs to.
1184 * @param *block The ir block the node belongs to.
1185 * @param *tgt The ir node representing the target address.
1187 ir_node *new_rd_IJmp (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *tgt);
1189 /** Constructor for a Break node.
1191 * Break represents control flow to a single control successor just as Jmp.
1192 * The blocks separated by a break may not be concatenated by an optimization.
1193 * It is used for the interprocedural representation where blocks are parted
1194 * behind Call nodes to represent the control flow to called procedures.
1196 * @param *db A pointer for debug information.
1197 * @param *irg The ir graph the node belong to.
1198 * @param *block The block the node belong to.
1200 ir_node *new_rd_Break (dbg_info *db, ir_graph *irg, ir_node *block);
1202 /** Constructor for a Cond node.
1204 * If c is mode_b represents a conditional branch (if/else). If c is
1205 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
1206 * node, default Proj is 0.)
1208 * This is not consistent: Input to Cond is Is, Proj has as proj number
1211 * @param *db A pointer for debug information.
1212 * @param *irg The ir graph the node belongs to.
1213 * @param *block The ir block the node belongs to.
1214 * @param *c The conditions parameter. Can be of mode b or I_u.
1216 ir_node *new_rd_Cond (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *c);
1218 /** Constructor for a Return node.
1220 * Returns the memory an zero or more return values. Only node that
1221 * can end regular control flow.
1223 * @param *db A pointer for debug information.
1224 * @param *irg The ir graph the node belongs to.
1225 * @param *block The ir block the node belongs to.
1226 * @param *store The state of memory.
1227 * @param arity Number of return values.
1228 * @param *in Array of length arity with return values. The constructor copies this array.
1230 ir_node *new_rd_Return (dbg_info *db, ir_graph *irg, ir_node *block,
1231 ir_node *store, int arity, ir_node *in[]);
1233 /** Constructor for a Const_type node.
1235 * The constant represents a target value. This constructor sets high
1236 * level type information for the constant value.
1238 * @param *db A pointer for debug information.
1239 * @param *irg The ir graph the node belongs to.
1240 * @param *block The ir block the node belongs to.
1241 * @param *mode The mode of the operands and results.
1242 * @param *con Points to an entry in the constant table.
1243 * @param *tp The type of the constant.
1245 ir_node *new_rd_Const_type (dbg_info *db, ir_graph *irg, ir_node *block,
1246 ir_mode *mode, tarval *con, ir_type *tp);
1248 /** Constructor for a Const node.
1250 * Constructor for a Const node. The constant represents a target
1251 * value. Sets the type information to type_unknown. (No more
1252 * supported: If tv is entity derives a somehow useful type.)
1254 * @param *db A pointer for debug information.
1255 * @param *irg The ir graph the node belongs to.
1256 * @param *block The ir block the node belongs to.
1257 * @param *mode The mode of the operands and results.
1258 * @param *con Points to an entry in the constant table.
1260 ir_node *new_rd_Const (dbg_info *db, ir_graph *irg, ir_node *block,
1261 ir_mode *mode, tarval *con);
1263 /** Constructor for a SymConst_type node.
1265 * This is the constructor for a symbolic constant.
1266 * There are four kinds of symbolic constants:
1267 * - type_tag The symbolic constant represents a type tag. The type the
1268 * tag stands for is given explicitly.
1269 * - type_size The symbolic constant represents the size of a type. The
1270 * type of which the constant represents the size is given
1272 * - type_align The symbolic constant represents the alignment of a type. The
1273 * type of which the constant represents the size is given
1275 * - addr_name The symbolic constant represents the address of an entity
1276 * (variable or method). The variable is indicated by a name
1277 * that is valid for linking.
1278 * - addr_ent The symbolic constant represents the address of an entity
1279 * (variable or method). The variable is given explicitly by
1282 * Inputs to the node:
1283 * No inputs except the block it belongs to.
1284 * Outputs of the node.
1285 * An unsigned integer (I_u) or a pointer (P).
1287 * Mention union in declaration so that the firmjni generator recognizes that
1288 * it can not cast the argument to an int.
1290 * @param *db A pointer for debug information.
1291 * @param *irg The ir graph the node belongs to.
1292 * @param *block The ir block the node belongs to.
1293 * @param symkind The kind of the symbolic constant: type_tag, size, addr_name or addr_ent.
1294 * @param value A type, entity or a ident depending on the SymConst kind.
1295 * @param tp The source type of the constant.
1297 ir_node *new_rd_SymConst_type (dbg_info *db, ir_graph *irg, ir_node *block, union symconst_symbol value,
1298 symconst_kind symkind, ir_type *tp);
1300 /** Constructor for a SymConst node.
1302 * Same as new_rd_SymConst_type, except that it sets the type to type_unknown. */
1303 ir_node *new_rd_SymConst (dbg_info *db, ir_graph *irg, ir_node *block,
1304 union symconst_symbol value, symconst_kind symkind);
1306 /** Constructor for a SymConst addr_ent node.
1308 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1309 * symconst_addr_ent.
1310 * Adds the SymConst to the start block of irg. */
1311 ir_node *new_rd_SymConst_addr_ent (dbg_info *db, ir_graph *irg, ir_entity *symbol, ir_type *tp);
1313 /** Constructor for a SymConst ofs_ent node.
1315 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1317 * Adds the SymConst to the start block of irg. */
1318 ir_node *new_rd_SymConst_ofs_ent (dbg_info *db, ir_graph *irg, ir_entity *symbol, ir_type *tp);
1320 /** Constructor for a SymConst addr_name node.
1322 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1323 * symconst_addr_ent.
1324 * Adds the SymConst to the start block of irg. */
1325 ir_node *new_rd_SymConst_addr_name (dbg_info *db, ir_graph *irg, ident *symbol, ir_type *tp);
1327 /** Constructor for a SymConst type_tag node.
1329 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1330 * symconst_addr_ent.
1331 * Adds the SymConst to the start block of irg. */
1332 ir_node *new_rd_SymConst_type_tag (dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp);
1334 /** Constructor for a SymConst size node.
1336 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1337 * symconst_type_size.
1338 * Adds the SymConst to the start block of irg. */
1339 ir_node *new_rd_SymConst_size (dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp);
1341 /** Constructor for a SymConst size node.
1343 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1344 * symconst_type_align.
1345 * Adds the SymConst to the start block of irg. */
1346 ir_node *new_rd_SymConst_align (dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp);
1348 /** Constructor for a simpleSel node.
1350 * This is a shortcut for the new_rd_Sel() constructor. To be used for
1351 * Sel nodes that do not select from an array, i.e., have no index
1352 * inputs. It adds the two parameters 0, NULL.
1354 * @param *db A pointer for debug information.
1355 * @param *irg The ir graph the node belongs to.
1356 * @param *block The ir block the node belongs to.
1357 * @param *store The memory in which the object the entity should be
1358 * selected from is allocated.
1359 * @param *objptr The object from that the Sel operation selects a
1360 * single attribute out.
1361 * @param *ent The entity to select.
1363 ir_node *new_rd_simpleSel (dbg_info *db, ir_graph *irg, ir_node *block,
1364 ir_node *store, ir_node *objptr, ir_entity *ent);
1366 /** Constructor for a Sel node.
1368 * The select node selects an entity (field or method) from an entity
1369 * with a compound type. It explicitly specifies the entity selected.
1370 * Dynamically the node may select entities that overwrite the given
1371 * entity. If the selected entity is an array element entity the Sel
1372 * node takes the required array indices as inputs.
1374 * @param *db A pointer for debug information.
1375 * @param *irg The ir graph the node belongs to.
1376 * @param *block The ir block the node belongs to.
1377 * @param *store The memory in which the object the entity should be selected
1378 * from is allocated.
1379 * @param *objptr A pointer to a compound entity the Sel operation selects a
1380 * single attribute from.
1381 * @param *n_index The number of array indices needed to select an array element entity.
1382 * @param *index[] If the compound entity is an array the indices of the selected
1383 * element entity. The constructor copies this array.
1384 * @param *ent The entity to select.
1386 ir_node *new_rd_Sel (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1387 ir_node *objptr, int n_index, ir_node *index[], ir_entity *ent);
1389 /** Constructor for a Call node.
1391 * Represents all kinds of method and function calls.
1393 * @param *db A pointer for debug information.
1394 * @param *irg The ir graph the node belongs to.
1395 * @param *block The ir block the node belongs to.
1396 * @param *store The current memory state.
1397 * @param *callee A pointer to the called procedure.
1398 * @param arity The number of procedure parameters.
1399 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1400 * @param *tp Type information of the procedure called.
1402 ir_node *new_rd_Call (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1403 ir_node *callee, int arity, ir_node *in[], ir_type *tp);
1405 /** Constructor for a Add node.
1407 * @param *db A pointer for debug information.
1408 * @param *irg The ir graph the node belongs to.
1409 * @param *block The ir block the node belongs to.
1410 * @param *op1 The first operand.
1411 * @param *op2 The second operand.
1412 * @param *mode The mode of the operands and the result.
1414 ir_node *new_rd_Add (dbg_info *db, ir_graph *irg, ir_node *block,
1415 ir_node *op1, ir_node *op2, ir_mode *mode);
1417 /** Constructor for a Sub 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 *op1 The first operand.
1423 * @param *op2 The second operand.
1424 * @param *mode The mode of the operands and the result.
1426 ir_node *new_rd_Sub (dbg_info *db, ir_graph *irg, ir_node *block,
1427 ir_node *op1, ir_node *op2, ir_mode *mode);
1429 /** Constructor for a Minus node.
1431 * @param *db A pointer for debug information.
1432 * @param *irg The ir graph the node belongs to.
1433 * @param *block The ir block the node belongs to.
1434 * @param *op The operand .
1435 * @param *mode The mode of the operand and the result.
1437 ir_node *new_rd_Minus (dbg_info *db, ir_graph *irg, ir_node *block,
1438 ir_node *op, ir_mode *mode);
1440 /** Constructor for a Mul node.
1442 * @param *db A pointer for debug information.
1443 * @param *irg The ir graph the node belongs to.
1444 * @param *block The ir block the node belongs to.
1445 * @param *op1 The first operand.
1446 * @param *op2 The second operand.
1447 * @param *mode The mode of the operands and the result.
1449 ir_node *new_rd_Mul (dbg_info *db, ir_graph *irg, ir_node *block,
1450 ir_node *op1, ir_node *op2, ir_mode *mode);
1452 /** Constructor for a Quot node.
1454 * @param *db A pointer for debug information.
1455 * @param *irg The ir graph the node belongs to.
1456 * @param *block The ir block the node belongs to.
1457 * @param *memop The store needed to model exceptions
1458 * @param *op1 The first operand.
1459 * @param *op2 The second operand.
1461 ir_node *new_rd_Quot (dbg_info *db, ir_graph *irg, ir_node *block,
1462 ir_node *memop, ir_node *op1, ir_node *op2);
1464 /** Constructor for a DivMod node.
1466 * @param *db A pointer for debug information.
1467 * @param *irg The ir graph the node belongs to.
1468 * @param *block The ir block the node belongs to.
1469 * @param *memop The store needed to model exceptions
1470 * @param *op1 The first operand.
1471 * @param *op2 The second operand.
1473 ir_node *new_rd_DivMod (dbg_info *db, ir_graph *irg, ir_node *block,
1474 ir_node *memop, ir_node *op1, ir_node *op2);
1476 /** Constructor for a Div node.
1478 * @param *db A pointer for debug information.
1479 * @param *irg The ir graph the node belongs to.
1480 * @param *block The ir block the node belongs to.
1481 * @param *memop The store needed to model exceptions
1482 * @param *op1 The first operand.
1483 * @param *op2 The second operand.
1485 ir_node *new_rd_Div (dbg_info *db, ir_graph *irg, ir_node *block,
1486 ir_node *memop, ir_node *op1, ir_node *op2);
1488 /** Constructor for a Mod node.
1490 * @param *db A pointer for debug information.
1491 * @param *irg The ir graph the node belongs to.
1492 * @param *block The ir block the node belongs to.
1493 * @param *memop The store needed to model exceptions
1494 * @param *op1 The first operand.
1495 * @param *op2 The second operand.
1497 ir_node *new_rd_Mod (dbg_info *db, ir_graph *irg, ir_node *block,
1498 ir_node *memop, ir_node *op1, ir_node *op2);
1500 /** Constructor for a Abs node.
1502 * @param *db A pointer for debug information.
1503 * @param *irg The ir graph the node belongs to.
1504 * @param *block The ir block the node belongs to.
1505 * @param *op The operand
1506 * @param *mode The mode of the operands and the result.
1508 ir_node *new_rd_Abs (dbg_info *db, ir_graph *irg, ir_node *block,
1509 ir_node *op, ir_mode *mode);
1511 /** Constructor for a And node.
1513 * @param *db A pointer for debug information.
1514 * @param *irg The ir graph the node belongs to.
1515 * @param *block The ir block the node belongs to.
1516 * @param *op1 The first operand.
1517 * @param *op2 The second operand.
1518 * @param *mode The mode of the operands and the result.
1520 ir_node *new_rd_And (dbg_info *db, ir_graph *irg, ir_node *block,
1521 ir_node *op1, ir_node *op2, ir_mode *mode);
1523 /** Constructor for a Or node.
1525 * @param *db A pointer for debug information.
1526 * @param *irg The ir graph the node belongs to.
1527 * @param *block The ir block the node belongs to.
1528 * @param *op1 The first operand.
1529 * @param *op2 The second operand.
1530 * @param *mode The mode of the operands and the result.
1532 ir_node *new_rd_Or (dbg_info *db, ir_graph *irg, ir_node *block,
1533 ir_node *op1, ir_node *op2, ir_mode *mode);
1535 /** Constructor for a Eor node.
1537 * @param *db A pointer for debug information.
1538 * @param *irg The ir graph the node belongs to.
1539 * @param *block The ir block the node belongs to.
1540 * @param *op1 The first operand.
1541 * @param *op2 The second operand.
1542 * @param *mode The mode of the operands and the results.
1544 ir_node *new_rd_Eor (dbg_info *db, ir_graph *irg, ir_node *block,
1545 ir_node *op1, ir_node *op2, ir_mode *mode);
1547 /** Constructor for a Not node.
1549 * @param *db A pointer for debug information.
1550 * @param *irg The ir graph the node belongs to.
1551 * @param *block The ir block the node belongs to.
1552 * @param *op The operand.
1553 * @param *mode The mode of the operand and the result.
1555 ir_node *new_rd_Not (dbg_info *db, ir_graph *irg, ir_node *block,
1556 ir_node *op, ir_mode *mode);
1558 /** Constructor for a Cmp node.
1560 * @param *db A pointer for debug information.
1561 * @param *irg The ir graph the node belongs to.
1562 * @param *block The ir block the node belongs to.
1563 * @param *op1 The first operand.
1564 * @param *op2 The second operand.
1566 ir_node *new_rd_Cmp (dbg_info *db, ir_graph *irg, ir_node *block,
1567 ir_node *op1, ir_node *op2);
1569 /** Constructor for a Shl node.
1571 * @param *db A pointer for debug information.
1572 * @param *irg The ir graph the node belongs to.
1573 * @param *block The ir block the node belongs to.
1574 * @param *op The operand.
1575 * @param *k The number of bits to shift the operand .
1576 * @param *mode The mode of the operand and the result.
1578 ir_node *new_rd_Shl (dbg_info *db, ir_graph *irg, ir_node *block,
1579 ir_node *op, ir_node *k, ir_mode *mode);
1581 /** Constructor for a Shr node.
1583 * @param *db A pointer for debug information.
1584 * @param *irg The ir graph the node belongs to.
1585 * @param *block The ir block the node belongs to.
1586 * @param *op The operand.
1587 * @param *k The number of bits to shift the operand .
1588 * @param *mode The mode of the operand and the result.
1590 ir_node *new_rd_Shr (dbg_info *db, ir_graph *irg, ir_node *block,
1591 ir_node *op, ir_node *k, ir_mode *mode);
1593 /** Constructor for a Shrs node.
1595 * @param *db A pointer for debug information.
1596 * @param *irg The ir graph the node belongs to.
1597 * @param *block The ir block the node belongs to.
1598 * @param *op The operand.
1599 * @param *k The number of bits to shift the operand.
1600 * @param *mode The mode of the operand and the result.
1602 ir_node *new_rd_Shrs (dbg_info *db, ir_graph *irg, ir_node *block,
1603 ir_node *op, ir_node *k, ir_mode *mode);
1605 /** Constructor for a Rot node.
1607 * @param *db A pointer for debug information.
1608 * @param *irg The ir graph the node belongs to.
1609 * @param *block The ir block the node belongs to.
1610 * @param *op The operand.
1611 * @param *k The number of bits to rotate the operand.
1612 * @param *mode The mode of the operand.
1614 ir_node *new_rd_Rot (dbg_info *db, ir_graph *irg, ir_node *block,
1615 ir_node *op, ir_node *k, ir_mode *mode);
1618 /** Constructor for a Conv node.
1620 * @param *db A pointer for debug information.
1621 * @param *irg The ir graph the node belongs to.
1622 * @param *block The ir block the node belongs to.
1623 * @param *op The operand.
1624 * @param *mode The mode of this the operand muss be converted .
1626 ir_node *new_rd_Conv (dbg_info *db, ir_graph *irg, ir_node *block,
1627 ir_node *op, ir_mode *mode);
1629 /** Constructor for a Cast node.
1631 * High level type cast.
1633 * @param *db A pointer for debug information.
1634 * @param *irg The ir graph the node belongs to.
1635 * @param *block The ir block the node belongs to.
1636 * @param *op The operand.
1637 * @param *to_tp The type of this the operand muss be casted .
1639 ir_node *new_rd_Cast (dbg_info *db, ir_graph *irg, ir_node *block,
1640 ir_node *op, ir_type *to_tp);
1642 /** Constructor for a Carry node.
1644 * @param *db A pointer for debug information.
1645 * @param *irg The ir graph the node belongs to.
1646 * @param *block The ir block the node belongs to.
1647 * @param *op1 The first operand.
1648 * @param *op2 The second operand.
1649 * @param *mode The mode of the operands and the result.
1651 ir_node *new_rd_Carry (dbg_info *db, ir_graph *irg, ir_node *block,
1652 ir_node *op1, ir_node *op2, ir_mode *mode);
1654 /** Constructor for a Borrow node.
1656 * @param *db A pointer for debug information.
1657 * @param *irg The ir graph the node belongs to.
1658 * @param *block The ir block the node belongs to.
1659 * @param *op1 The first operand.
1660 * @param *op2 The second operand.
1661 * @param *mode The mode of the operands and the result.
1663 ir_node *new_rd_Borrow (dbg_info *db, ir_graph *irg, ir_node *block,
1664 ir_node *op1, ir_node *op2, ir_mode *mode);
1666 /** Constructor for a Phi node.
1668 * @param *db A pointer for debug information.
1669 * @param *irg The ir graph the node belongs to.
1670 * @param *block The ir block the node belongs to.
1671 * @param arity The number of predecessors
1672 * @param *in[] Array with predecessors. The constructor copies this array.
1673 * @param *mode The mode of it's inputs and output.
1675 ir_node *new_rd_Phi (dbg_info *db, ir_graph *irg, ir_node *block, int arity,
1676 ir_node *in[], ir_mode *mode);
1678 /** Constructor for a Load node.
1680 * @param *db A pointer for debug information.
1681 * @param *irg The ir graph the node belongs to.
1682 * @param *block The ir block the node belongs to.
1683 * @param *store The current memory
1684 * @param *adr A pointer to the variable to be read in this memory.
1685 * @param *mode The mode of the value to be loaded.
1687 ir_node *new_rd_Load (dbg_info *db, ir_graph *irg, ir_node *block,
1688 ir_node *store, ir_node *adr, ir_mode *mode);
1690 /** Constructor for a Store node.
1692 * @param *db A pointer for debug information.
1693 * @param *irg The ir graph the node belongs to.
1694 * @param *block The ir block the node belongs to.
1695 * @param *store The current memory
1696 * @param *adr A pointer to the variable to be read in this memory.
1697 * @param *val The value to write to this variable.
1699 ir_node *new_rd_Store (dbg_info *db, ir_graph *irg, ir_node *block,
1700 ir_node *store, ir_node *adr, ir_node *val);
1702 /** Constructor for a Alloc node.
1704 * The Alloc node extends the memory by space for an entity of type alloc_type.
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 *store The memory which shall contain the new variable.
1710 * @param *size The number of bytes to allocate.
1711 * @param *alloc_type The type of the allocated variable.
1712 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
1714 ir_node *new_rd_Alloc (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1715 ir_node *size, ir_type *alloc_type, where_alloc where);
1717 /** Constructor for a Free node.
1719 * Frees the memory occupied by the entity pointed to by the pointer
1720 * arg. Type indicates the type of the entity the argument points to.
1722 * @param *db A pointer for debug information.
1723 * @param *irg The ir graph the node belongs to.
1724 * @param *block The ir block the node belongs to.
1725 * @param *store The memory which shall contain the new variable.
1726 * @param *ptr The pointer to the object to free.
1727 * @param *size The number of objects of type free_type to free in a sequence.
1728 * @param *free_type The type of the freed variable.
1729 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
1731 ir_node *new_rd_Free (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1732 ir_node *ptr, ir_node *size, ir_type *free_type, where_alloc where);
1734 /** Constructor for a Sync node.
1736 * Merges several memory values. The node assumes that a variable
1737 * either occurs only in one of the memories, or it contains the same
1738 * value in all memories where it occurs.
1740 * @param *db A pointer for debug information.
1741 * @param *irg The ir graph the node belongs to.
1742 * @param *block The ir block the node belongs to.
1743 * @param arity The number of memories to synchronize.
1744 * @param *in[] An array of pointers to nodes that produce an output of type
1745 * memory. The constructor copies this array.
1747 ir_node *new_rd_Sync (dbg_info *db, ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
1749 /** Constructor for a Proj node.
1751 * Projects a single value out of a tuple. The parameter proj gives the
1752 * position of the value within the tuple.
1754 * @param *db A pointer for debug information.
1755 * @param *irg The ir graph the node belongs to.
1756 * @param *block The ir block the node belongs to.
1757 * @param arg A node producing a tuple. The node must have mode_T.
1758 * @param *mode The mode of the value to project.
1759 * @param proj The position of the value in the tuple.
1761 ir_node *new_rd_Proj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1762 ir_mode *mode, long proj);
1764 /** Constructor for a defaultProj node.
1766 * Represents the default control flow of a Switch-Cond node.
1768 * @param *db A pointer for debug information.
1769 * @param *irg The ir graph the node belongs to.
1770 * @param *block The ir block the node belongs to.
1771 * @param arg A node producing a tuple.
1772 * @param max_proj The end position of the value in the tuple.
1774 ir_node *new_rd_defaultProj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1777 /** Constructor for a Tuple node.
1779 * This is an auxiliary node to replace a node that returns a tuple
1780 * without changing the corresponding Proj nodes.
1782 * @param *db A pointer for debug information.
1783 * @param *irg The ir graph the node belongs to.
1784 * @param *block The ir block the node belongs to.
1785 * @param arity The number of tuple elements.
1786 * @param *in[] An array containing pointers to the nodes producing the tuple
1787 * elements. The constructor copies this array.
1789 ir_node *new_rd_Tuple (dbg_info *db, ir_graph *irg, ir_node *block,
1790 int arity, ir_node *in[]);
1792 /** Constructor for a Id node.
1794 * This is an auxiliary node to replace a node that returns a single
1797 * @param *db A pointer for debug information.
1798 * @param *irg The ir graph the node belongs to.
1799 * @param *block The ir block the node belongs to.
1800 * @param *val The value
1801 * @param *mode The mode of *val.
1803 ir_node *new_rd_Id (dbg_info *db, ir_graph *irg, ir_node *block,
1804 ir_node *val, ir_mode *mode);
1806 /** Constructor for a Bad node.
1808 * Returns the unique Bad node of the graph. The same as
1811 * @param *irg The ir graph the node belongs to.
1813 ir_node *new_rd_Bad (ir_graph *irg);
1815 /** Constructor for a Confirm node.
1817 * Specifies constraints for a value. To support dataflow analyses.
1819 * Example: If the value never exceeds '100' this is expressed by placing a
1820 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
1822 * @param *irg The ir graph the node belong to.
1823 * @param *block The ir block the node belong to.
1824 * @param *db A pointer for debug information.
1825 * @param *val The value we express a constraint for
1826 * @param *bound The value to compare against. Must be a firm node, typically a constant.
1827 * @param cmp The compare operation.
1829 ir_node *new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block,
1830 ir_node *val, ir_node *bound, pn_Cmp cmp);
1832 /** Constructor for an Unknown node.
1834 * Represents an arbitrary value. Places the node in the start block.
1836 * @param *irg The ir graph the node belongs to.
1837 * @param *m The mode of the unknown value.
1839 ir_node *new_rd_Unknown(ir_graph *irg, ir_mode *m);
1841 /** Constructor for a CallBegin node.
1843 * CallBegin represents control flow depending of the pointer value
1844 * representing the called method to the called methods. The
1845 * constructor copies the method pointer input from the passed Call
1848 * @param *db A pointer for debug information.
1849 * @param *irg The ir graph the node belong to.
1850 * @param *block The block the node belong to.
1851 * @param *callee The call node visible in the intra procedural view.
1853 ir_node *new_rd_CallBegin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *callee);
1855 /** Constructor for a EndReg node.
1857 * Used to represent regular procedure end in interprocedual view.
1859 * @param *db A pointer for debug information.
1860 * @param *irg The ir graph the node belong to.
1861 * @param *block The block the node belong to.
1863 ir_node *new_rd_EndReg (dbg_info *db, ir_graph *irg, ir_node *block);
1865 /** Constructor for a EndExcept node.
1867 * Used to represent exceptional procedure end in interprocedural view.
1869 * @param *db A pointer for debug information.
1870 * @param *irg The ir graph the node belong to.
1871 * @param *block The block the node belong to.
1873 ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
1875 /** Constructor for a Filter node.
1877 * Adds the node to the block in current_ir_block. Filter is a node
1878 * with two views used to construct the interprocedural view. In
1879 * intraprocedural view its semantics are identical to the Proj node.
1880 * In interprocedural view the Filter performs the Phi operation on
1881 * method parameters or results. Other than a Phi a Filter node may
1882 * not be removed if it has only a single input.
1884 * The constructor builds the Filter in intraprocedural view.
1886 * @param *db A pointer for debug information.
1887 * @param *irg The ir graph the node belong to.
1888 * @param *block The block the node belong to.
1889 * @param *arg The tuple value to project from.
1890 * @param *mode The mode of the projected value.
1891 * @param proj The position in the tuple to project from.
1893 ir_node *new_rd_Filter (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1894 ir_mode *mode, long proj);
1896 /** Constructor for a NoMem node.
1898 * Returns the unique NoMem node of the graph. The same as
1901 * @param *irg The ir graph the node belongs to.
1903 ir_node *new_rd_NoMem (ir_graph *irg);
1905 /** Constructor for a Mux node.
1907 * @param *db A pointer for debug information.
1908 * @param *irg The ir graph the node belong to.
1909 * @param *block The block the node belong to.
1910 * @param *sel The ir_node that calculates the boolean select.
1911 * @param *ir_true The ir_node that calculates the true result.
1912 * @param *ir_false The ir_node that calculates the false result.
1913 * @param *mode The mode of the node (and it_true and ir_false).
1915 ir_node *new_rd_Mux (dbg_info *db, ir_graph *irg, ir_node *block,
1916 ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
1918 /** Constructor for a Psi node.
1920 * @param *db A pointer for debug information.
1921 * @param *irg The ir graph the node belong to.
1922 * @param *block The block the node belong to.
1923 * @param *arity The arity of the conditions
1924 * @param *conds The array of mode_b conditions, length must be equal arity
1925 * @param *vals The array of mode values, length must be equal arity + 1
1926 * @param *mode The mode of the node (must be the mode of all vals).
1928 ir_node *new_rd_Psi (dbg_info *db, ir_graph *irg, ir_node *block,
1929 int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
1931 /** Constructor for a CopyB node.
1933 * @param *db A pointer for debug information.
1934 * @param *irg The ir graph the node belong to.
1935 * @param *block The block the node belong to.
1936 * @param *store The current memory
1937 * @param *dst The ir_node that represents the destination address.
1938 * @param *src The ir_node that represents the source address.
1939 * @param *data_type The type of the copied data
1941 ir_node *new_rd_CopyB(dbg_info *db, ir_graph *irg, ir_node *block,
1942 ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
1944 /** Constructor for a InstOf node.
1946 * A High-Level Type check.
1948 * @param *db A pointer for debug information.
1949 * @param *irg The ir graph the node belongs to.
1950 * @param *block The ir block the node belongs to.
1951 * @param *store The memory in which the object the entity should be selected
1952 * from is allocated.
1953 * @param *objptr A pointer to a object of a class type.
1954 * @param *type The type of which objptr must be.
1956 ir_node *new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1957 ir_node *objptr, ir_type *type);
1959 /** Constructor for a Raise node.
1961 * A High-Level Exception throw.
1963 * @param *db A pointer for debug information.
1964 * @param *irg The ir graph the node belongs to.
1965 * @param *block The ir block the node belongs to.
1966 * @param *store The current memory.
1967 * @param *obj A pointer to the Except variable.
1969 ir_node *new_rd_Raise (dbg_info *db, ir_graph *irg, ir_node *block,
1970 ir_node *store, ir_node *obj);
1972 /** Constructor for a Bound node.
1974 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
1976 * @param *db A pointer for debug information.
1977 * @param *irg The ir graph the node belong to.
1978 * @param *block The block the node belong to.
1979 * @param *store The current memory.
1980 * @param *idx The ir_node that represents an index.
1981 * @param *lower The ir_node that represents the lower bound for the index.
1982 * @param *upper The ir_node that represents the upper bound for the index.
1984 ir_node *new_rd_Bound(dbg_info *db, ir_graph *irg, ir_node *block,
1985 ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
1987 /** Constructor for a Pin node.
1989 * @param *db A pointer for debug information.
1990 * @param *irg The ir graph the node belong to.
1991 * @param *block The block the node belong to.
1992 * @param *node The node which value should be pinned.
1994 ir_node *new_rd_Pin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *node);
1996 /*-------------------------------------------------------------------------*/
1997 /* The raw interface without debug support */
1998 /*-------------------------------------------------------------------------*/
2000 /** Constructor for a Block node.
2002 * Constructs a mature block with the given predecessors. Use Unknown
2003 * nodes as predecessors to construct a block if the number of
2004 * predecessors is known, but not the predecessors themselves. This
2005 * constructor does not set current_block. It not be used with
2006 * automatic Phi node construction.
2009 * @param irg The ir graph the block belongs to.
2010 * @param arity The number of control predecessors.
2011 * @param in[] An array of control predecessors. The length of
2012 * the array must be 'arity'. The constructor copies this array.
2014 ir_node *new_r_Block (ir_graph *irg, int arity, ir_node *in[]);
2016 /** Constructor for a Start node.
2018 * @param *irg The ir graph the node belongs to.
2019 * @param *block The ir block the node belongs to.
2021 ir_node *new_r_Start (ir_graph *irg, ir_node *block);
2023 /** Constructor for a End node.
2025 * @param *irg The ir graph the node belongs to.
2026 * @param *block The ir block the node belongs to.
2028 ir_node *new_r_End (ir_graph *irg, ir_node *block);
2030 /** Constructor for a Jmp node.
2032 * Jmp represents control flow to a single control successor.
2034 * @param *irg The ir graph the node belongs to.
2035 * @param *block The ir block the node belongs to.
2037 ir_node *new_r_Jmp (ir_graph *irg, ir_node *block);
2039 /** Constructor for an IJmp node.
2041 * IJmp represents control flow to a single control successor not
2042 * statically known i.e. an indirect Jmp.
2044 * @param *irg The ir graph the node belongs to.
2045 * @param *block The ir block the node belongs to.
2046 * @param *tgt The ir node representing the target address.
2048 ir_node *new_r_IJmp (ir_graph *irg, ir_node *block, ir_node *tgt);
2050 /** Constructor for a Cond node.
2052 * If c is mode_b represents a conditional branch (if/else). If c is
2053 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2054 * node, default Proj is 0.)
2056 * This is not consistent: Input to Cond is Is, Proj has as proj number
2059 * @param *irg The ir graph the node belongs to.
2060 * @param *block The ir block the node belongs to.
2061 * @param *c The conditions parameter.Can be of mode b or I_u.
2063 ir_node *new_r_Cond (ir_graph *irg, ir_node *block, ir_node *c);
2065 /** Constructor for a Return node.
2067 * Returns the memory an zero or more return values. Only node that
2068 * can end regular control flow.
2070 * @param *irg The ir graph the node belongs to.
2071 * @param *block The ir block the node belongs to.
2072 * @param *store The state of memory.
2073 * @param arity Number of array indices.
2074 * @param *in[] Array with index inputs to the node. The constructor copies this array.
2076 ir_node *new_r_Return (ir_graph *irg, ir_node *block,
2077 ir_node *store, int arity, ir_node *in[]);
2079 /** Constructor for a Const node.
2081 * Constructor for a Const node. The constant represents a target
2082 * value. Sets the type information to type_unknown. (No more
2083 * supported: If tv is entity derives a somehow useful type.)
2085 * @param *irg The ir graph the node belongs to.
2086 * @param *block The ir block the node belongs to.
2087 * @param *mode The mode of the operands and the results.
2088 * @param *con Points to an entry in the constant table.
2090 ir_node *new_r_Const (ir_graph *irg, ir_node *block,
2091 ir_mode *mode, tarval *con);
2093 /** Constructor for a Const node.
2095 * Constructor for a Const node. The constant represents a target
2096 * value. Sets the type information to type_unknown. (No more
2097 * supported: If tv is entity derives a somehow useful type.)
2099 * @param *irg The ir graph the node belongs to.
2100 * @param *block The ir block the node belongs to.
2101 * @param *mode The mode of the operands and the results.
2102 * @param value A value from which the tarval is made.
2104 ir_node *new_r_Const_long(ir_graph *irg, ir_node *block,
2105 ir_mode *mode, long value);
2107 /** Constructor for a Const_type node.
2109 * The constant represents a target value. This constructor sets high
2110 * level type information for the constant value.
2112 * @param *irg The ir graph the node belongs to.
2113 * @param *block The ir block the node belongs to.
2114 * @param *mode The mode of the operands and results.
2115 * @param *con Points to an entry in the constant table.
2116 * @param *tp The type of the constant.
2118 ir_node *new_r_Const_type(ir_graph *irg, ir_node *block,
2119 ir_mode *mode, tarval *con, ir_type *tp);
2121 /** Constructor for a SymConst node.
2123 * This is the constructor for a symbolic constant.
2124 * There are four kinds of symbolic constants:
2125 * - type_tag The symbolic constant represents a type tag. The type the
2126 * tag stands for is given explicitly.
2127 * - size The symbolic constant represents the size of a type. The
2128 * type of which the constant represents the size is given
2130 * - addr_name The symbolic constant represents the address of an entity
2131 * (variable or method). The variable is indicated by a name
2132 * that is valid for linking.
2133 * - addr_ent The symbolic constant represents the address of an entity
2134 * (variable or method). The variable is given explicitly by
2137 * Inputs to the node:
2138 * No inputs except the block it belongs to.
2139 * Outputs of the node.
2140 * An unsigned integer (I_u) or a pointer (P).
2142 * @param *irg The ir graph the node belongs to.
2143 * @param *block The ir block the node belongs to.
2144 * @param value A type, entity or a ident depending on the SymConst kind.
2145 * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
2147 ir_node *new_r_SymConst (ir_graph *irg, ir_node *block,
2148 union symconst_symbol value, symconst_kind symkind);
2150 /** Constructor for a simpleSel node.
2152 * This is a shortcut for the new_d_Sel() constructor. To be used for
2153 * Sel nodes that do not select from an array, i.e., have no index
2154 * inputs. It adds the two parameters 0, NULL.
2156 * @param *irg The ir graph the node belongs to.
2157 * @param *block The ir block the node belongs to.
2158 * @param *store The memory in which the object the entity should be selected
2159 * from is allocated.
2160 * @param *objptr The object from that the Sel operation selects a
2161 * single attribute out.
2162 * @param *ent The entity to select.
2164 ir_node *new_r_simpleSel(ir_graph *irg, ir_node *block, ir_node *store,
2165 ir_node *objptr, ir_entity *ent);
2167 /** Constructor for a Sel node.
2169 * The select node selects an entity (field or method) from an entity
2170 * with a compound type. It explicitly specifies the entity selected.
2171 * Dynamically the node may select entities that overwrite the given
2172 * entity. If the selected entity is an array element entity the Sel
2173 * node takes the required array indices as inputs.
2175 * @param *irg The ir graph the node belongs to.
2176 * @param *block The ir block the node belongs to.
2177 * @param *store The memory in which the object the entity should be selected
2178 * from is allocated.
2179 * @param *objptr A pointer to a compound entity the Sel operation selects a
2180 * single attribute from.
2181 * @param *n_index The number of array indices needed to select an array element entity.
2182 * @param *index[] If the compound entity is an array the indices of the selected
2183 * element entity. The constructor copies this array.
2184 * @param *ent The entity to select.
2186 ir_node *new_r_Sel (ir_graph *irg, ir_node *block, ir_node *store,
2187 ir_node *objptr, int n_index, ir_node *index[],
2190 /** Constructor for a Call node.
2192 * Represents all kinds of method and function calls.
2194 * @param *irg The ir graph the node belongs to.
2195 * @param *block The ir block the node belongs to.
2196 * @param *store The actual store.
2197 * @param *callee A pointer to the called procedure.
2198 * @param arity The number of procedure parameters.
2199 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2200 * @param *tp Type information of the procedure called.
2202 ir_node *new_r_Call (ir_graph *irg, ir_node *block, ir_node *store,
2203 ir_node *callee, int arity, ir_node *in[],
2206 /** Constructor for a Add node.
2208 * @param *irg The ir graph the node belongs to.
2209 * @param *block The ir block the node belongs to.
2210 * @param *op1 The first operand.
2211 * @param *op2 The second operand.
2212 * @param *mode The mode of the operands and the result.
2214 ir_node *new_r_Add (ir_graph *irg, ir_node *block,
2215 ir_node *op1, ir_node *op2, ir_mode *mode);
2218 * Constructor for a Sub node.
2220 * @param *irg The ir graph the node belongs to.
2221 * @param *block The ir block the node belongs to.
2222 * @param *op1 The first operand.
2223 * @param *op2 The second operand.
2224 * @param *mode The mode of the operands and the results.
2226 ir_node *new_r_Sub (ir_graph *irg, ir_node *block,
2227 ir_node *op1, ir_node *op2, ir_mode *mode);
2229 /** Constructor for a Minus node.
2231 * @param *irg The ir graph the node belongs to.
2232 * @param *block The ir block the node belongs to.
2233 * @param *op The operand.
2234 * @param *mode The mode of the operand and the result.
2236 ir_node *new_r_Minus (ir_graph *irg, ir_node *block,
2237 ir_node *op, ir_mode *mode);
2238 /** Constructor for a Mul node.
2240 * @param *irg The ir graph the node belongs to.
2241 * @param *block The ir block the node belongs to.
2242 * @param *op1 The first operand.
2243 * @param *op2 The second operand.
2244 * @param *mode The mode of the operands and the result.
2246 ir_node *new_r_Mul (ir_graph *irg, ir_node *block,
2247 ir_node *op1, ir_node *op2, ir_mode *mode);
2249 /** Constructor for a Quot node.
2251 * @param *irg The ir graph the node belongs to.
2252 * @param *block The ir block the node belongs to.
2253 * @param *memop The store needed to model exceptions
2254 * @param *op1 The first operand.
2255 * @param *op2 The second operand.
2257 ir_node *new_r_Quot (ir_graph *irg, ir_node *block,
2258 ir_node *memop, ir_node *op1, ir_node *op2);
2260 /** Constructor for a DivMod node.
2262 * @param *irg The ir graph the node belongs to.
2263 * @param *block The ir block the node belongs to.
2264 * @param *memop The store needed to model exceptions
2265 * @param *op1 The first operand.
2266 * @param *op2 The second operand.
2268 ir_node *new_r_DivMod (ir_graph *irg, ir_node *block,
2269 ir_node *memop, ir_node *op1, ir_node *op2);
2271 /** Constructor for a Div node.
2273 * @param *irg The ir graph the node belongs to.
2274 * @param *block The ir block the node belongs to.
2275 * @param *memop The store needed to model exceptions
2276 * @param *op1 The first operand.
2277 * @param *op2 The second operand.
2279 ir_node *new_r_Div (ir_graph *irg, ir_node *block,
2280 ir_node *memop, ir_node *op1, ir_node *op2);
2282 /** Constructor for a Mod node.
2284 * @param *irg The ir graph the node belongs to.
2285 * @param *block The ir block the node belongs to.
2286 * @param *memop The store needed to model exceptions
2287 * @param *op1 The first operand.
2288 * @param *op2 The second operand.
2290 ir_node *new_r_Mod (ir_graph *irg, ir_node *block,
2291 ir_node *memop, ir_node *op1, ir_node *op2);
2293 /** Constructor for a Abs node.
2295 * @param *irg The ir graph the node belongs to.
2296 * @param *block The ir block the node belongs to.
2297 * @param *op The operand
2298 * @param *mode The mode of the operands and the result.
2300 ir_node *new_r_Abs (ir_graph *irg, ir_node *block,
2301 ir_node *op, ir_mode *mode);
2303 /** Constructor for a And node.
2305 * @param *irg The ir graph the node belongs to.
2306 * @param *block The ir block the node belongs to.
2307 * @param *op1 The first operand.
2308 * @param *op2 The second operand.
2309 * @param *mode The mode of the operands and the result.
2311 ir_node *new_r_And (ir_graph *irg, ir_node *block,
2312 ir_node *op1, ir_node *op2, ir_mode *mode);
2314 /** Constructor for a Or node.
2316 * @param *irg The ir graph the node belongs to.
2317 * @param *block The ir block the node belongs to.
2318 * @param *op1 The first operand.
2319 * @param *op2 The second operand.
2320 * @param *mode The mode of the operands and the result.
2322 ir_node *new_r_Or (ir_graph *irg, ir_node *block,
2323 ir_node *op1, ir_node *op2, ir_mode *mode);
2325 /** Constructor for a Eor node.
2327 * @param *irg The ir graph the node belongs to.
2328 * @param *block The ir block the node belongs to.
2329 * @param *op1 The first operand.
2330 * @param *op2 The second operand.
2331 * @param *mode The mode of the operands and the results.
2333 ir_node *new_r_Eor (ir_graph *irg, ir_node *block,
2334 ir_node *op1, ir_node *op2, ir_mode *mode);
2336 /** Constructor for a Not node.
2338 * @param *irg The ir graph the node belongs to.
2339 * @param *block The ir block the node belongs to.
2340 * @param *op The operand.
2341 * @param *mode The mode of the operand and the result.
2343 ir_node *new_r_Not (ir_graph *irg, ir_node *block,
2344 ir_node *op, ir_mode *mode);
2346 /** Constructor for a Cmp node.
2348 * @param *irg The ir graph the node belongs to.
2349 * @param *block The ir block the node belongs to.
2350 * @param *op1 The first operand.
2351 * @param *op2 The second operand.
2353 ir_node *new_r_Cmp (ir_graph *irg, ir_node *block,
2354 ir_node *op1, ir_node *op2);
2356 /** Constructor for a Shl node.
2358 * @param *irg The ir graph the node belongs to.
2359 * @param *block The ir block the node belongs to.
2360 * @param *op The operand.
2361 * @param *k The number of bits to shift the operand .
2362 * @param *mode The mode of the operand and the result.
2364 ir_node *new_r_Shl (ir_graph *irg, ir_node *block,
2365 ir_node *op, ir_node *k, ir_mode *mode);
2367 /** Constructor for a Shr node.
2369 * @param *irg The ir graph the node belongs to.
2370 * @param *block The ir block the node belongs to.
2371 * @param *op The operand.
2372 * @param *k The number of bits to shift the operand .
2373 * @param *mode The mode of the operand and the result.
2375 ir_node *new_r_Shr (ir_graph *irg, ir_node *block,
2376 ir_node *op, ir_node *k, ir_mode *mode);
2379 * Constructor for a Shrs node.
2381 * @param *irg The ir graph the node belongs to.
2382 * @param *block The ir block the node belongs to.
2383 * @param *op The operand.
2384 * @param *k The number of bits to shift the operand.
2385 * @param *mode The mode of the operand and the result.
2387 ir_node *new_r_Shrs (ir_graph *irg, ir_node *block,
2388 ir_node *op, ir_node *k, ir_mode *mode);
2390 /** Constructor for a Rot node.
2392 * @param *irg The ir graph the node belongs to.
2393 * @param *block The ir block the node belongs to.
2394 * @param *op The operand.
2395 * @param *k The number of bits to rotate the operand.
2396 * @param *mode The mode of the operand.
2398 ir_node *new_r_Rot (ir_graph *irg, ir_node *block,
2399 ir_node *op, ir_node *k, ir_mode *mode);
2401 /** Constructor for a Conv node.
2403 * @param *irg The ir graph the node belongs to.
2404 * @param *block The ir block the node belongs to.
2405 * @param *op The operand.
2406 * @param *mode The mode of this the operand muss be converted .
2408 ir_node *new_r_Conv (ir_graph *irg, ir_node *block,
2409 ir_node *op, ir_mode *mode);
2411 /** Constructor for a Cast node.
2413 * High level type cast
2415 * @param *irg The ir graph the node belongs to.
2416 * @param *block The ir block the node belongs to.
2417 * @param *op The operand.
2418 * @param *to_tp The type of this the operand muss be casted .
2420 ir_node *new_r_Cast (ir_graph *irg, ir_node *block,
2421 ir_node *op, ir_type *to_tp);
2423 /** Constructor for a Carry node.
2425 * @param *irg The ir graph the node belongs to.
2426 * @param *block The ir block the node belongs to.
2427 * @param *op1 The first operand.
2428 * @param *op2 The second operand.
2429 * @param *mode The mode of the operands and the result.
2431 ir_node *new_r_Carry (ir_graph *irg, ir_node *block,
2432 ir_node *op1, ir_node *op2, ir_mode *mode);
2435 * Constructor for a Borrow node.
2437 * @param *irg The ir graph the node belongs to.
2438 * @param *block The ir block the node belongs to.
2439 * @param *op1 The first operand.
2440 * @param *op2 The second operand.
2441 * @param *mode The mode of the operands and the results.
2443 ir_node *new_r_Borrow (ir_graph *irg, ir_node *block,
2444 ir_node *op1, ir_node *op2, ir_mode *mode);
2446 /** Constructor for a Phi node.
2448 * @param *irg The ir graph the node belongs to.
2449 * @param *block The ir block the node belongs to.
2450 * @param arity The number of predecessors
2451 * @param *in[] Array with predecessors. The constructor copies this array.
2452 * @param *mode The mode of it's inputs and output.
2454 ir_node *new_r_Phi (ir_graph *irg, ir_node *block, int arity,
2455 ir_node *in[], ir_mode *mode);
2457 /** Constructor for a Load node.
2459 * @param *irg The ir graph the node belongs to.
2460 * @param *block The ir block the node belongs to.
2461 * @param *store The current memory
2462 * @param *adr A pointer to the variable to be read in this memory.
2463 * @param *mode The mode of the value to be loaded.
2465 ir_node *new_r_Load (ir_graph *irg, ir_node *block,
2466 ir_node *store, ir_node *adr, ir_mode *mode);
2468 /** Constructor for a Store node.
2470 * @param *irg The ir graph the node belongs to.
2471 * @param *block The ir block the node belongs to.
2472 * @param *store The current memory
2473 * @param *adr A pointer to the variable to be read in this memory.
2474 * @param *val The value to write to this variable.
2476 ir_node *new_r_Store (ir_graph *irg, ir_node *block,
2477 ir_node *store, ir_node *adr, ir_node *val);
2479 /** Constructor for a Alloc node.
2481 * The Alloc node extends the memory by space for an entity of type alloc_type.
2483 * @param *irg The ir graph the node belongs to.
2484 * @param *block The ir block the node belongs to.
2485 * @param *store The memory which shall contain the new variable.
2486 * @param *size The number of bytes to allocate.
2487 * @param *alloc_type The type of the allocated variable.
2488 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
2490 ir_node *new_r_Alloc (ir_graph *irg, ir_node *block, ir_node *store,
2491 ir_node *size, ir_type *alloc_type, where_alloc where);
2493 /** Constructor for a Free node.
2495 * Frees the memory occupied by the entity pointed to by the pointer
2496 * arg. Type indicates the type of the entity the argument points to.
2498 * @param *irg The ir graph the node belongs to.
2499 * @param *block The ir block the node belongs to.
2500 * @param *store The memory which shall contain the new variable.
2501 * @param *ptr The pointer to the object to free.
2502 * @param *size The number of objects of type free_type to free in a sequence.
2503 * @param *free_type The type of the freed variable.
2504 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
2506 ir_node *new_r_Free (ir_graph *irg, ir_node *block, ir_node *store,
2507 ir_node *ptr, ir_node *size, ir_type *free_type, where_alloc where);
2509 /** Constructor for a Sync node.
2511 * Merges several memory values. The node assumes that a variable
2512 * either occurs only in one of the memories, or it contains the same
2513 * value in all memories where it occurs.
2515 * @param *irg The ir graph the node belongs to.
2516 * @param *block The ir block the node belongs to.
2517 * @param arity The number of memories to synchronize.
2518 * @param *in[] An array of pointers to nodes that produce an output of type memory.
2519 * The constructor copies this array.
2521 ir_node *new_r_Sync (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2523 /** Constructor for a Proj node.
2525 * Projects a single value out of a tuple. The parameter proj gives the
2526 * position of the value within the tuple.
2528 * @param *irg The ir graph the node belongs to.
2529 * @param *block The ir block the node belongs to.
2530 * @param arg A node producing a tuple.
2531 * @param *mode The mode of the value to project.
2532 * @param proj The position of the value in the tuple.
2534 ir_node *new_r_Proj (ir_graph *irg, ir_node *block, ir_node *arg,
2535 ir_mode *mode, long proj);
2537 /** Constructor for a defaultProj node.
2539 * Represents the default control flow of a Switch-Cond node.
2541 * @param *irg The ir graph the node belongs to.
2542 * @param *block The ir block the node belongs to.
2543 * @param arg A node producing a tuple.
2544 * @param max_proj The end position of the value in the tuple.
2546 ir_node *new_r_defaultProj (ir_graph *irg, ir_node *block, ir_node *arg, long max_proj);
2549 /** Constructor for a Tuple node.
2551 * This is an auxiliary node to replace a node that returns a tuple
2552 * without changing the corresponding Proj nodes.
2554 * @param *irg The ir graph the node belongs to.
2555 * @param *block The ir block the node belongs to.
2556 * @param arity The number of tuple elements.
2557 * @param *in[] An array containing pointers to the nodes producing the tuple elements.
2558 * The constructor copies this array.
2560 ir_node *new_r_Tuple (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2562 /** Constructor for a Id node.
2564 * This is an auxiliary node to replace a node that returns a single
2567 * @param *irg The ir graph the node belongs to.
2568 * @param *block The ir block the node belongs to.
2569 * @param *val The operand to Id.
2570 * @param *mode The mode of *val.
2572 ir_node *new_r_Id (ir_graph *irg, ir_node *block,
2573 ir_node *val, ir_mode *mode);
2575 /** Constructor for a Bad node.
2577 * Returns the unique Bad node of the graph. The same as
2580 * @param *irg The ir graph the node belongs to.
2583 ir_node *new_r_Bad (ir_graph *irg);
2585 /** Constructor for a Confirm node.
2587 * Specifies constraints for a value. To support dataflow analyses.
2589 * Example: If the value never exceeds '100' this is expressed by placing a
2590 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
2592 * @param *irg The ir graph the node belong to.
2593 * @param *block The ir block the node belong to.
2594 * @param *val The value we express a constraint for
2595 * @param *bound The value to compare against. Must be a firm node, typically a constant.
2596 * @param cmp The compare operation.
2598 ir_node *new_r_Confirm (ir_graph *irg, ir_node *block,
2599 ir_node *val, ir_node *bound, pn_Cmp cmp);
2601 /** Constructor for a Unknown node.
2603 * Represents an arbitrary value. Places the node in
2606 * @param *irg The ir graph the node belongs to.
2607 * @param *m The mode of the unknown value.
2609 ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2611 /** Constructor for a CallBegin node.
2613 * CallBegin represents control flow depending of the pointer value
2614 * representing the called method to the called methods. The
2615 * constructor copies the method pointer input from the passed Call
2618 * @param *irg The ir graph the node belong to.
2619 * @param *block The block the node belong to.
2620 * @param *callee The call node visible in the intra procedural view.
2622 ir_node *new_r_CallBegin(ir_graph *irg, ir_node *block, ir_node *callee);
2624 /** Constructor for a EndReg node.
2626 * Used to represent regular procedure end in interprocedual view.
2628 * @param *irg The ir graph the node belong to.
2629 * @param *block The block the node belong to.
2631 ir_node *new_r_EndReg (ir_graph *irg, ir_node *block);
2633 /** Constructor for a EndExcept node.
2635 * Used to represent exceptional procedure end in interprocedural view.
2637 * @param *irg The ir graph the node belong to.
2638 * @param *block The block the node belong to.
2640 ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
2642 /** Constructor for a Break node.
2644 * Break represents control flow to a single control successor just as Jmp.
2645 * The blocks separated by a break may not be concatenated by an optimization.
2646 * It is used for the interprocedural representation where blocks are parted
2647 * behind Call nodes to represent the control flow to called procedures.
2649 * @param *irg The ir graph the node belong to.
2650 * @param *block The block the node belong to.
2652 ir_node *new_r_Break (ir_graph *irg, ir_node *block);
2654 /** Constructor for a Filter node.
2656 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
2657 * Filter is a node with two views used to construct the interprocedural view.
2658 * In intraprocedural view its semantics are identical to the Proj node.
2659 * In interprocedural view the Filter performs the Phi operation on method
2660 * parameters or results. Other than a Phi a Filter node may not be removed
2661 * if it has only a single input.
2663 * The constructor builds the Filter in intraprocedural view.
2665 * @param *irg The ir graph the node belong to.
2666 * @param *block The block the node belong to.
2667 * @param *arg The tuple value to project from.
2668 * @param *mode The mode of the projected value.
2669 * @param proj The position in the tuple to project from.
2671 ir_node *new_r_Filter (ir_graph *irg, ir_node *block, ir_node *arg,
2672 ir_mode *mode, long proj);
2674 /** Constructor for a NoMem node.
2676 * Returns the unique NoMem node of the graph. The same as
2679 * @param *irg The ir graph the node belongs to.
2681 ir_node *new_r_NoMem (ir_graph *irg);
2683 /** Constructor for a Mux node.
2685 * @param *irg The ir graph the node belong to.
2686 * @param *block The block the node belong to.
2687 * @param *sel The ir_node that calculates the boolean select.
2688 * @param *ir_true The ir_node that calculates the true result.
2689 * @param *ir_false The ir_node that calculates the false result.
2690 * @param *mode The mode of the node (and it_true and ir_false).
2692 ir_node *new_r_Mux (ir_graph *irg, ir_node *block,
2693 ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2695 /** Constructor for a Psi node.
2697 * @param *irg The ir graph the node belong to.
2698 * @param *block The block the node belong to.
2699 * @param *arity The arity of the conditions
2700 * @param *conds The array of mode_b conditions, length must be equal arity
2701 * @param *vals The array of mode values, length must be equal arity + 1
2702 * @param *mode The mode of the node (must be the mode of all vals).
2704 ir_node *new_r_Psi (ir_graph *irg, ir_node *block,
2705 int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
2707 /** Constructor for a CopyB node.
2709 * @param *irg The ir graph the node belong to.
2710 * @param *block The block the node belong to.
2711 * @param *store The current memory
2712 * @param *dst The ir_node that represents the destination address.
2713 * @param *src The ir_node that represents the source address.
2714 * @param *data_type The type of the copied data
2716 ir_node *new_r_CopyB(ir_graph *irg, ir_node *block,
2717 ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
2719 /** Constructor for a InstOf node.
2721 * A High-Level Type check.
2723 * @param *irg The ir graph the node belongs to.
2724 * @param *block The ir block the node belongs to.
2725 * @param *store The memory in which the object the entity should be selected
2726 * from is allocated.
2727 * @param *objptr A pointer to a object of a class type.
2728 * @param *type The type of which objptr must be.
2730 ir_node *new_r_InstOf (ir_graph *irg, ir_node *block, ir_node *store,
2731 ir_node *objptr, ir_type *type);
2733 /** Constructor for a Raise node.
2735 * A High-Level Exception throw.
2737 * @param *irg The ir graph the node belongs to.
2738 * @param *block The ir block the node belongs to.
2739 * @param *store The current memory.
2740 * @param *obj A pointer to the Except variable.
2742 ir_node *new_r_Raise (ir_graph *irg, ir_node *block,
2743 ir_node *store, ir_node *obj);
2745 /** Constructor for a Bound node.
2747 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2749 * @param *irg The ir graph the node belong to.
2750 * @param *block The block the node belong to.
2751 * @param *store The current memory.
2752 * @param *idx The ir_node that represents an index.
2753 * @param *lower The ir_node that represents the lower bound for the index.
2754 * @param *upper The ir_node that represents the upper bound for the index.
2756 ir_node *new_r_Bound(ir_graph *irg, ir_node *block,
2757 ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
2759 /** Constructor for a Pin node.
2761 * @param *irg The ir graph the node belong to.
2762 * @param *block The block the node belong to.
2763 * @param *node The node which value should be pinned.
2765 ir_node *new_r_Pin(ir_graph *irg, ir_node *block, ir_node *node);
2767 /*-----------------------------------------------------------------------*/
2768 /* The block oriented interface */
2769 /*-----------------------------------------------------------------------*/
2771 /** Sets the current block in which the following constructors place the
2772 * nodes they construct.
2774 * @param target The new current block.
2776 void set_cur_block (ir_node *target);
2778 /** Returns the current block of the current graph. */
2779 ir_node *get_cur_block(void);
2781 /** Returns the fixed nodes of the current graph. */
2782 #define get_cur_end_block() get_irg_end_block(current_ir_graph)
2783 #define get_cur_end() get_irg_end(current_ir_graph)
2784 #define get_cur_start_block() get_irg_start_block(current_ir_graph)
2785 #define get_cur_start() get_irg_start(current_ir_graph)
2787 /** Constructor for a Block node.
2789 * Adds the block to the graph in current_ir_graph. Constructs a Block
2790 * with a fixed number of predecessors. Does set current_block. Can
2791 * be used with automatic Phi node construction.
2793 * @param *db A Pointer for debug information.
2794 * @param arity The number of control predecessors.
2795 * @param in[] An array of control predecessors. The length of
2796 * the array must be 'arity'.
2798 ir_node *new_d_Block(dbg_info *db, int arity, ir_node *in[]);
2800 /** Constructor for a Start node.
2802 * Adds the node to the block in current_ir_block.
2804 * @param *db A pointer for debug information.
2806 ir_node *new_d_Start (dbg_info *db);
2808 /** Constructor for a End node.
2810 * Adds the node to the block in current_ir_block.
2812 * @param *db A pointer for debug information.
2814 ir_node *new_d_End (dbg_info *db);
2816 /** Constructor for a Jmp node.
2818 * Adds the node to the block in current_ir_block.
2820 * Jmp represents control flow to a single control successor.
2822 * @param *db A pointer for debug information.
2824 ir_node *new_d_Jmp (dbg_info *db);
2826 /** Constructor for an IJmp node.
2828 * IJmp represents control flow to a single control successor not
2829 * statically known i.e. an indirect Jmp.
2831 * @param *db A pointer for debug information.
2832 * @param *tgt The ir node representing the target address.
2834 ir_node *new_d_IJmp (dbg_info *db, ir_node *tgt);
2836 /** Constructor for a Cond node.
2838 * Adds the node to the block in current_ir_block.
2840 * If c is mode_b represents a conditional branch (if/else). If c is
2841 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2842 * node, default Proj is 0.)
2844 * This is not consistent: Input to Cond is Is, Proj has as proj number
2847 * @param *db A pointer for debug information.
2848 * @param *c The conditions parameter.Can be of mode b or I_u.
2850 ir_node *new_d_Cond (dbg_info *db, ir_node *c);
2852 /** Constructor for a Return node.
2854 * Adds the node to the block in current_ir_block.
2856 * Returns the memory an zero or more return values. Only node that
2857 * can end regular control flow.
2859 * @param *db A pointer for debug information.
2860 * @param *store The state of memory.
2861 * @param arity Number of array indices.
2862 * @param *in Array with index inputs to the node.
2864 ir_node *new_d_Return (dbg_info *db, ir_node *store, int arity, ir_node *in[]);
2866 /** Constructor for a Const_type node.
2868 * Adds the node to the block in current_ir_block.
2870 * The constant represents a target value. This constructor sets high
2871 * level type information for the constant value.
2873 * @param *db A pointer for debug information.
2874 * @param *mode The mode of the operands and results.
2875 * @param *con Points to an entry in the constant table. This pointer is
2876 added to the attributes of the node.
2877 * @param *tp The type of the constant.
2879 ir_node *new_d_Const_type (dbg_info *db, ir_mode *mode, tarval *con, ir_type *tp);
2881 /** Constructor for a Const node.
2883 * Adds the node to the block in current_ir_block.
2885 * Constructor for a Const node. The constant represents a target
2886 * value. Sets the type information to type_unknown. (No more
2887 * supported: If tv is entity derives a somehow useful type.)
2889 * @param *db A pointer for debug information.
2890 * @param *mode The mode of the operands and results.
2891 * @param *con Points to an entry in the constant table. This pointer is added
2892 * to the attributes of the node.
2894 ir_node *new_d_Const (dbg_info *db, ir_mode *mode, tarval *con);
2896 /** Constructor for a SymConst_type node.
2898 * Adds the node to the block in current_ir_block.
2899 * This is the constructor for a symbolic constant.
2900 * There are four kinds of symbolic constants:
2901 * - type_tag The symbolic constant represents a type tag. The type the
2902 * tag stands for is given explicitly.
2903 * - size The symbolic constant represents the size of a type. The
2904 * type of which the constant represents the size is given
2906 * - addr_name The symbolic constant represents the address of an entity
2907 * (variable or method). The variable is indicated by a name
2908 * that is valid for linking.
2909 * - addr_ent The symbolic constant represents the address of an entity
2910 * (variable or method). The variable is given explicitly by
2913 * Inputs to the node:
2914 * No inputs except the block it belongs to.
2915 * Outputs of the node.
2916 * An unsigned integer (I_u) or a pointer (P).
2918 * @param *db A pointer for debug information.
2919 * @param value A type, entity or ident depending on the SymConst kind.
2920 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size,
2921 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
2922 * @param tp The source type of the constant.
2924 ir_node *new_d_SymConst_type (dbg_info *db, union symconst_symbol value, symconst_kind kind, ir_type *tp);
2926 /** Constructor for a SymConst node.
2928 * Same as new_d_SymConst_type, except that it sets the type to type_unknown. */
2929 ir_node *new_d_SymConst (dbg_info *db, union symconst_symbol value, symconst_kind kind);
2931 /** Constructor for a simpleSel node.
2933 * This is a shortcut for the new_d_Sel() constructor. To be used for
2934 * Sel nodes that do not select from an array, i.e., have no index
2935 * inputs. It adds the two parameters 0, NULL.
2937 * @param *db A pointer for debug information.
2938 * @param *store The memory in which the object the entity should be
2939 * selected from is allocated.
2940 * @param *objptr The object from that the Sel operation selects a
2941 * single attribute out.
2942 * @param *ent The entity to select.
2944 ir_node *new_d_simpleSel(dbg_info *db, ir_node *store, ir_node *objptr, ir_entity *ent);
2946 /** Constructor for a Sel node.
2948 * The select node selects an entity (field or method) from an entity
2949 * with a compound type. It explicitly specifies the entity selected.
2950 * Dynamically the node may select entities that overwrite the given
2951 * entity. If the selected entity is an array element entity the Sel
2952 * node takes the required array indices as inputs.
2953 * Adds the node to the block in current_ir_block.
2955 * @param *db A pointer for debug information.
2956 * @param *store The memory in which the object the entity should be selected
2957 * from is allocated.
2958 * @param *objptr A pointer to a compound entity the Sel operation selects a
2959 * single attribute from.
2960 * @param arity The number of array indices needed to select an array element entity.
2961 * @param *in[] If the compound entity is an array the indices of the selected
2962 * element entity. The constructor copies this array.
2963 * @param *ent The entity to select.
2965 ir_node *new_d_Sel (dbg_info *db, ir_node *store, ir_node *objptr, int arity, ir_node *in[],
2968 /** Constructor for a Call node.
2970 * Represents all kinds of method and function calls.
2971 * Adds the node to the block in current_ir_block.
2973 * @param *db A pointer for debug information.
2974 * @param *store The actual store.
2975 * @param *callee A pointer to the called procedure.
2976 * @param arity The number of procedure parameters.
2977 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2978 * @param *tp Type information of the procedure called.
2980 ir_node *new_d_Call (dbg_info *db, ir_node *store, ir_node *callee, int arity, ir_node *in[],
2983 /** Constructor for a Add node.
2985 * Adds the node to the block in current_ir_block.
2987 * @param *db A pointer for debug information.
2988 * @param *op1 The first operand.
2989 * @param *op2 The second operand.
2990 * @param *mode The mode of the operands and the result.
2992 ir_node *new_d_Add (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2994 /** Constructor for a Sub node.
2996 * Adds the node to the block in current_ir_block.
2998 * @param *db A pointer for debug information.
2999 * @param *op1 The first operand.
3000 * @param *op2 The second operand.
3001 * @param *mode The mode of the operands and the result.
3003 ir_node *new_d_Sub (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3005 /** Constructor for a Minus node.
3007 * Adds the node to the block in current_ir_block.
3009 * @param *db A pointer for debug information.
3010 * @param *op The operand .
3011 * @param *mode The mode of the operand and the result.
3013 ir_node *new_d_Minus (dbg_info *db, ir_node *op, ir_mode *mode);
3015 /** Constructor for a Mul node.
3017 * Adds the node to the block in current_ir_block.
3019 * @param *db A pointer for debug information.
3020 * @param *op1 The first operand.
3021 * @param *op2 The second operand.
3022 * @param *mode The mode of the operands and the result.
3024 ir_node *new_d_Mul (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3026 /** Constructor for a Quot node.
3028 * Adds the node to the block in current_ir_block.
3030 * @param *db A pointer for debug information.
3031 * @param *memop The store needed to model exceptions
3032 * @param *op1 The first operand.
3033 * @param *op2 The second operand.
3035 ir_node *new_d_Quot (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
3037 /** Constructor for a DivMod node.
3039 * Adds the node to the block in current_ir_block.
3041 * @param *db A pointer for debug information.
3042 * @param *memop The store needed to model exceptions
3043 * @param *op1 The first operand.
3044 * @param *op2 The second operand.
3046 ir_node *new_d_DivMod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
3048 /** Constructor for a Div node.
3050 * Adds the node to the block in current_ir_block.
3052 * @param *db A pointer for debug information.
3053 * @param *memop The store needed to model exceptions
3054 * @param *op1 The first operand.
3055 * @param *op2 The second operand.
3057 ir_node *new_d_Div (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
3059 /** Constructor for a Mod node.
3061 * Adds the node to the block in current_ir_block.
3063 * @param *db A pointer for debug information.
3064 * @param *memop The store needed to model exceptions
3065 * @param *op1 The first operand.
3066 * @param *op2 The second operand.
3068 ir_node *new_d_Mod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
3070 /** Constructor for a Abs node.
3072 * Adds the node to the block in current_ir_block.
3074 * @param *db A pointer for debug information.
3075 * @param *op The operand
3076 * @param *mode The mode of the operands and the result.
3078 ir_node *new_d_Abs (dbg_info *db, ir_node *op, ir_mode *mode);
3080 /** Constructor for a And node.
3082 * Adds the node to the block in current_ir_block.
3084 * @param *db A pointer for debug information.
3085 * @param *op1 The first operand.
3086 * @param *op2 The second operand.
3087 * @param *mode The mode of the operands and the result.
3089 ir_node *new_d_And (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3091 /** Constructor for a Or node.
3093 * Adds the node to the block in current_ir_block.
3095 * @param *db A pointer for debug information.
3096 * @param *op1 The first operand.
3097 * @param *op2 The second operand.
3098 * @param *mode The mode of the operands and the result.
3100 ir_node *new_d_Or (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3102 /** Constructor for a Eor node.
3104 * Adds the node to the block in current_ir_block.
3106 * @param *db A pointer for debug information.
3107 * @param *op1 The first operand.
3108 * @param *op2 The second operand.
3109 * @param *mode The mode of the operands and the results.
3111 ir_node *new_d_Eor (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3113 /** Constructor for a Not node.
3115 * Adds the node to the block in current_ir_block.
3117 * @param *db A pointer for debug information.
3118 * @param *op The operand.
3119 * @param *mode The mode of the operand and the result.
3121 ir_node *new_d_Not (dbg_info *db, ir_node *op, ir_mode *mode);
3123 /** Constructor for a Shl node.
3125 * Adds the node to the block in current_ir_block.
3127 * @param *db A pointer for debug information.
3128 * @param *op The operand.
3129 * @param *k The number of bits to shift the operand .
3130 * @param *mode The mode of the operand and the result.
3132 ir_node *new_d_Shl (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3134 /** Constructor for a Shr node.
3136 * Adds the node to the block in current_ir_block.
3138 * @param *db A pointer for debug information.
3139 * @param *op The operand.
3140 * @param *k The number of bits to shift the operand .
3141 * @param *mode The mode of the operand and the result.
3143 ir_node *new_d_Shr (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3145 /** Constructor for a Shrs node.
3147 * Adds the node to the block in current_ir_block.
3149 * @param *db A pointer for debug information.
3150 * @param *op The operand.
3151 * @param *k The number of bits to shift the operand .
3152 * @param *mode The mode of the operand and the result.
3154 ir_node *new_d_Shrs (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3156 /** Constructor for a Rot node.
3158 * Adds the node to the block in current_ir_block.
3160 * @param *db A pointer for debug information.
3161 * @param *op The operand.
3162 * @param *k The number of bits to rotate the operand.
3163 * @param *mode The mode of the operand.
3165 ir_node *new_d_Rot (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3167 /** Constructor for a Cmp node.
3169 * Adds the node to the block in current_ir_block.
3171 * @param *db A pointer for debug information.
3172 * @param *op1 The first operand.
3173 * @param *op2 The second operand.
3175 ir_node *new_d_Cmp (dbg_info *db, ir_node *op1, ir_node *op2);
3177 /** Constructor for a Conv node.
3179 * Adds the node to the block in current_ir_block.
3181 * @param *db A pointer for debug information.
3182 * @param *op The operand.
3183 * @param *mode The mode of this the operand muss be converted .
3185 ir_node *new_d_Conv (dbg_info *db, ir_node *op, ir_mode *mode);
3187 /** Constructor for a strict Conv node.
3189 * Adds the node to the block in current_ir_block.
3191 * @param *db A pointer for debug information.
3192 * @param *op The operand.
3193 * @param *mode The mode of this the operand muss be converted .
3195 ir_node *new_d_strictConv (dbg_info *db, ir_node *op, ir_mode *mode);
3197 /** Constructor for a Cast node.
3199 * High level type cast
3200 * Adds the node to the block in current_ir_block.
3202 * @param *db A pointer for debug information.
3203 * @param *op The operand.
3204 * @param *to_tp The type of this the operand muss be casted .
3206 ir_node *new_d_Cast (dbg_info *db, ir_node *op, ir_type *to_tp);
3208 /** Constructor for a Carry node.
3210 * Adds the node to the block in current_ir_block.
3212 * @param *db A pointer for debug information.
3213 * @param *op1 The first operand.
3214 * @param *op2 The second operand.
3215 * @param *mode The mode of the operands and the result.
3217 ir_node *new_d_Carry (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3219 /** Constructor for a Borrow node.
3221 * Adds the node to the block in current_ir_block.
3223 * @param *db A pointer for debug information.
3224 * @param *op1 The first operand.
3225 * @param *op2 The second operand.
3226 * @param *mode The mode of the operands and the result.
3228 ir_node *new_d_Borrow (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3230 /** Constructor for a Phi node.
3232 * Adds the node to the block in current_ir_block.
3234 * @param *db A pointer for debug information.
3235 * @param arity The number of predecessors
3236 * @param *in Array with predecessors
3237 * @param *mode The mode of it's inputs and output.
3239 ir_node *new_d_Phi (dbg_info *db, int arity, ir_node *in[], ir_mode *mode);
3241 /** Constructor for a Load node.
3243 * Adds the node to the block in current_ir_block.
3245 * @param *db A pointer for debug information.
3246 * @param *store The current memory
3247 * @param *addr A pointer to the variable to be read in this memory.
3248 * @param *mode The mode of the value to be loaded.
3250 ir_node *new_d_Load (dbg_info *db, ir_node *store, ir_node *addr, ir_mode *mode);
3252 /** Constructor for a Store node.
3254 * Adds the node to the block in current_ir_block.
3256 * @param *db A pointer for debug information.
3257 * @param *store The current memory
3258 * @param *addr A pointer to the variable to be read in this memory.
3259 * @param *val The value to write to this variable.
3261 ir_node *new_d_Store (dbg_info *db, ir_node *store, ir_node *addr, ir_node *val);
3263 /** Constructor for a Alloc node.
3265 * The Alloc node extends the memory by space for an entity of type alloc_type.
3266 * Adds the node to the block in current_ir_block.
3268 * @param *db A pointer for debug information.
3269 * @param *store The memory which shall contain the new variable.
3270 * @param *size The number of bytes to allocate.
3271 * @param *alloc_type The type of the allocated variable.
3272 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3274 ir_node *new_d_Alloc (dbg_info *db, ir_node *store, ir_node *size, ir_type *alloc_type,
3277 /** Constructor for a Free node.
3279 * Frees the memory occupied by the entity pointed to by the pointer
3280 * arg. Type indicates the type of the entity the argument points to.
3281 * Adds the node to the block in current_ir_block.
3283 * @param *db A pointer for debug information.
3284 * @param *store The memory which shall contain the new variable.
3285 * @param *ptr The pointer to the object to free.
3286 * @param *size The number of objects of type free_type to free in a sequence.
3287 * @param *free_type The type of the freed variable.
3288 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
3290 ir_node *new_d_Free (dbg_info *db, ir_node *store, ir_node *ptr, ir_node *size,
3291 ir_type *free_type, where_alloc where);
3293 /** Constructor for a Sync node.
3295 * Merges several memory values. The node assumes that a variable
3296 * either occurs only in one of the memories, or it contains the same
3297 * value in all memories where it occurs.
3298 * Adds the node to the block in current_ir_block.
3300 * @param *db A pointer for debug information.
3301 * @param arity The number of memories to synchronize.
3302 * @param **in An array of pointers to nodes that produce an output of type
3303 * memory. The constructor copies this array.
3305 ir_node *new_d_Sync (dbg_info *db, int arity, ir_node *in[]);
3307 /** Constructor for a Proj node.
3309 * Projects a single value out of a tuple. The parameter proj gives the
3310 * position of the value within the tuple.
3311 * Adds the node to the block in current_ir_block.
3313 * @param *db A pointer for deubug information.
3314 * @param arg A node producing a tuple.
3315 * @param *mode The mode of the value to project.
3316 * @param proj The position of the value in the tuple.
3318 ir_node *new_d_Proj (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3320 /** Constructor for a defaultProj node.
3322 * Represents the default control flow of a Switch-Cond node.
3323 * Adds the node to the block in current_ir_block.
3325 * @param *db A pointer for debug information.
3326 * @param arg A node producing a tuple.
3327 * @param max_proj The end position of the value in the tuple.
3329 ir_node *new_d_defaultProj (dbg_info *db, ir_node *arg, long max_proj);
3331 /** Constructor for a Tuple node.
3333 * This is an auxiliary node to replace a node that returns a tuple
3334 * without changing the corresponding Proj nodes.
3335 * Adds the node to the block in current_ir_block.
3337 * @param *db A pointer for debug information.
3338 * @param arity The number of tuple elements.
3339 * @param **in An array containing pointers to the nodes producing the tuple elements.
3341 ir_node *new_d_Tuple (dbg_info *db, int arity, ir_node *in[]);
3343 /** Constructor for a Id node.
3345 * This is an auxiliary node to replace a node that returns a single
3346 * value. Adds the node to the block in current_ir_block.
3348 * @param *db A pointer for debug information.
3349 * @param *val The operand to Id.
3350 * @param *mode The mode of *val.
3352 ir_node *new_d_Id (dbg_info *db, ir_node *val, ir_mode *mode);
3354 /** Constructor for a Bad node.
3356 * Returns the unique Bad node of the graph. The same as
3359 ir_node *new_d_Bad (void);
3361 /** Constructor for a Confirm node.
3363 * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3364 * Specifies constraints for a value. To support dataflow analyses.
3366 * Example: If the value never exceeds '100' this is expressed by placing a
3367 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
3369 * @param *db A pointer for debug information.
3370 * @param *val The value we express a constraint for
3371 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3372 * @param cmp The compare operation.
3374 ir_node *new_d_Confirm (dbg_info *db, ir_node *val, ir_node *bound, pn_Cmp cmp);
3376 /** Constructor for an Unknown node.
3378 * Represents an arbitrary value. Places the node in
3381 * @param *m The mode of the unknown value.
3383 ir_node *new_d_Unknown(ir_mode *m);
3385 /** Constructor for a CallBegin node.
3387 * CallBegin represents control flow depending of the pointer value
3388 * representing the called method to the called methods. The
3389 * constructor copies the method pointer input from the passed Call
3390 * node.Adds the node to the block in current_ir_block.
3392 * @param *db A pointer for debug information.
3393 * @param *callee The call node visible in the intra procedural view.
3395 ir_node *new_d_CallBegin(dbg_info *db, ir_node *callee);
3397 /** Constructor for an EndReg node.
3399 *Adds the node to the block in current_ir_block.
3401 * @param *db A pointer for debug information.
3403 ir_node *new_d_EndReg (dbg_info *db);
3405 /** Constructor for an EndExcept node.
3407 * Used to represent regular procedure end in interprocedual view.
3408 * Adds the node to the block in current_ir_block.
3410 * @param *db A pointer for debug information.
3412 ir_node *new_d_EndExcept(dbg_info *db);
3414 /** Constructor for a Break node.
3416 * Used to represent exceptional procedure end in interprocedural view.
3417 * Adds the node to the block in current_ir_block.
3419 * Break represents control flow to a single control successor just as Jmp.
3420 * The blocks separated by a break may not be concatenated by an optimization.
3421 * It is used for the interprocedural representation where blocks are parted
3422 * behind Call nodes to represent the control flow to called procedures.
3424 * @param *db A pointer for debug information.
3426 ir_node *new_d_Break (dbg_info *db);
3428 /** Constructor for a Filter node.
3430 * Constructor for a Filter node. Adds the node to the block in
3431 * current_ir_block. Filter is a node with two views used to
3432 * construct the interprocedural view. In intraprocedural view its
3433 * semantics are identical to the Proj node. In interprocedural view
3434 * the Filter performs the Phi operation on method parameters or
3435 * results. Other than a Phi a Filter node may not be removed if it
3436 * has only a single input.
3438 * The constructor builds the Filter in intraprocedural view.
3440 * @param *db A pointer for debug information.
3441 * @param *arg The tuple value to project from.
3442 * @param *mode The mode of the projected value.
3443 * @param proj The position in the tuple to project from.
3445 ir_node *new_d_Filter (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3448 /** Constructor for a NoMem node.
3450 * Returns the unique NoMem node of the graph. The same as
3453 ir_node *new_d_NoMem (void);
3455 /** Constructor for a Mux node.
3457 * @param *db A pointer for debug information.
3458 * @param *sel The ir_node that calculates the boolean select.
3459 * @param *ir_true The ir_node that calculates the true result.
3460 * @param *ir_false The ir_node that calculates the false result.
3461 * @param *mode The mode of the node (and it_true and ir_false).
3463 ir_node *new_d_Mux (dbg_info *db, ir_node *sel,
3464 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
3466 /** Constructor for a Psi node.
3468 * @param *db A pointer for debug information.
3469 * @param *arity The arity of the conditions
3470 * @param *conds The array of mode_b conditions, length must be equal arity
3471 * @param *vals The array of mode values, length must be equal arity + 1
3472 * @param *mode The mode of the node (must be the mode of all vals).
3474 ir_node *new_d_Psi (dbg_info *db,
3475 int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
3477 /** Constructor for a CopyB node.
3479 * @param *db A pointer for debug information.
3480 * @param *store The current memory
3481 * @param *dst The ir_node that represents the destination address.
3482 * @param *src The ir_node that represents the source address.
3483 * @param *data_type The type of the copied data
3485 ir_node *new_d_CopyB(dbg_info *db, ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
3487 /** Constructor for a InstOf node.
3489 * A High-Level Type check.
3491 * @param *db A pointer for debug information.
3492 * @param *store The memory in which the object the entity should be selected
3493 * from is allocated.
3494 * @param *objptr A pointer to a object of a class type.
3495 * @param *type The type of which objptr must be.
3497 ir_node *new_d_InstOf (dbg_info *db, ir_node *store, ir_node *objptr, ir_type *type);
3499 /** Constructor for a Raise node.
3501 * A High-Level Exception throw.
3503 * @param *db A pointer for debug information.
3504 * @param *store The current memory.
3505 * @param *obj A pointer to the Except variable.
3507 ir_node *new_d_Raise (dbg_info *db, ir_node *store, ir_node *obj);
3509 /** Constructor for a Bound node.
3511 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
3513 * @param *db A pointer for debug information.
3514 * @param *store The current memory
3515 * @param *idx The ir_node that represents an index.
3516 * @param *lower The ir_node that represents the lower bound for the index.
3517 * @param *upper The ir_node that represents the upper bound for the index.
3519 ir_node *new_d_Bound(dbg_info *db, ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
3521 /** Constructor for a Pin node.
3523 * @param *db A pointer for debug information.
3524 * @param *node The node which value should be pinned.
3526 ir_node *new_d_Pin(dbg_info *db, ir_node *node);
3528 /*-----------------------------------------------------------------------*/
3529 /* The block oriented interface without debug support */
3530 /*-----------------------------------------------------------------------*/
3532 /* Needed from the interface with debug support:
3533 void set_cur_block (ir_node *target); */
3535 /** Constructor for a Block node.
3537 * Constructor for a Block node. Adds the block to the graph in
3538 * current_ir_graph. Constructs a Block with a fixed number of
3539 * predecessors. Does set current_block. Can be used with automatic
3540 * Phi node construction.
3542 * @param arity The number of control predecessors.
3543 * @param in An array of control predecessors. The length of
3544 * the array must be 'arity'.
3546 ir_node *new_Block(int arity, ir_node *in[]);
3548 /** Constructor for a Start node.
3550 * Adds the node to the block in current_ir_block.
3553 ir_node *new_Start (void);
3555 /** Constructor for an End node.
3557 * Adds the node to the block in current_ir_block.
3559 ir_node *new_End (void);
3561 /** Constructor for an EndReg node.
3563 * Used to represent regular procedure end in interprocedual view.
3564 * Adds the node to the block in current_ir_block.
3566 ir_node *new_EndReg (void);
3568 /** Constructor for an EndExpcept node.
3570 * Used to represent exceptional procedure end in interprocedural view.
3571 * Adds the node to the block in current_ir_block.
3573 ir_node *new_EndExcept(void);
3575 /** Constructor for a Jump node.
3577 * Adds the node to the block in current_ir_block.
3579 * Jmp represents control flow to a single control successor.
3581 ir_node *new_Jmp (void);
3583 /** Constructor for an IJmp node.
3585 * IJmp represents control flow to a single control successor not
3586 * statically known i.e. an indirect Jmp.
3588 * @param *tgt The ir node representing the target address.
3590 ir_node *new_IJmp (ir_node *tgt);
3592 /** Constructor for a Break node.
3593 * Break represents control flow to a single control successor just as Jmp.
3594 * The blocks separated by a break may not be concatenated by an optimization.
3595 * It is used for the interprocedural representation where blocks are parted
3596 * behind Call nodes to represent the control flow to called procedures.
3597 * Adds the node to the block in current_ir_block.
3599 ir_node *new_Break (void);
3601 /** Constructor for a Cond node.
3603 * If c is mode_b represents a conditional branch (if/else). If c is
3604 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
3605 * node, default Proj is 0.). Adds the node to the block in current_ir_block.
3607 * This is not consistent: Input to Cond is Is, Proj has as proj number
3611 * @param *c The conditions parameter.Can be of mode b or I_u.
3613 ir_node *new_Cond (ir_node *c);
3615 /** Constructor for a Return node.
3617 * Returns the memory an zero or more return values. Only node that
3618 * can end regular control flow. Adds the node to the block in current_ir_block.
3620 * @param *store The state of memory.
3621 * @param arity Number of array indices.
3622 * @param *in Array with index inputs to the node.
3624 ir_node *new_Return (ir_node *store, int arity, ir_node *in[]);
3626 /** Constructor for a Const node.
3628 * Constructor for a Const node. The constant represents a target
3629 * value. Sets the type information to type_unknown. (No more
3630 * supported: If tv is entity derives a somehow useful type.)
3631 * Adds the node to the block in current_ir_block.
3633 * @param *mode The mode of the operands and results.
3634 * @param *con Points to an entry in the constant table. This pointer is
3635 * added to the attributes of the node.
3637 ir_node *new_Const (ir_mode *mode, tarval *con);
3640 * Make a const from a long.
3641 * This is just convenience for the usual
3643 * new_Const(mode, tarval_from_long(mode, ...))
3646 * @param mode The mode for the const.
3647 * @param value The value of the constant.
3648 * @return A new const node.
3650 ir_node *new_Const_long(ir_mode *mode, long value);
3652 /** Constructor for a Const node.
3654 * Derives mode from passed type. */
3655 ir_node *new_Const_type(tarval *con, ir_type *tp);
3657 /** Constructor for a SymConst node.
3659 * Adds the node to the block in current_ir_block.
3660 * This is the constructor for a symbolic constant.
3661 * There are four kinds of symbolic constants:
3662 * -# type_tag The symbolic constant represents a type tag. The type the
3663 * tag stands for is given explicitly.
3664 * -# size The symbolic constant represents the size of a type. The
3665 * type of which the constant represents the size is given
3667 * -# align The symbolic constant represents the alignment of a type. The
3668 * type of which the constant represents the size is given
3670 * -# addr_name The symbolic constant represents the address of an entity
3671 * (variable or method). The variable is indicated by a name
3672 * that is valid for linking.
3673 * -# addr_ent The symbolic constant represents the address of an entity
3674 * (variable or method). The variable is given explicitly by
3677 * Inputs to the node:
3678 * No inputs except the block it belongs to.
3679 * Outputs of the node.
3680 * An unsigned integer (I_u) or a pointer (P).
3682 * @param value A type or a ident depending on the SymConst kind.
3683 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3684 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
3685 * @param tp The source type of the constant.
3687 ir_node *new_SymConst_type (union symconst_symbol value, symconst_kind kind, ir_type *tp);
3689 /** Constructor for a SymConst node.
3691 * Adds the node to the block in current_ir_block.
3692 * This is the constructor for a symbolic constant.
3693 * There are four kinds of symbolic constants:
3694 * -# type_tag The symbolic constant represents a type tag. The type the
3695 * tag stands for is given explicitly.
3696 * -# size The symbolic constant represents the size of a type. The
3697 * type of which the constant represents the size is given
3699 * -# align The symbolic constant represents the alignment of a type. The
3700 * type of which the constant represents the size is given
3702 * -# addr_name The symbolic constant represents the address of an entity
3703 * (variable or method). The variable is indicated by a name
3704 * that is valid for linking.
3705 * -# addr_ent The symbolic constant represents the address of an entity
3706 * (variable or method). The variable is given explicitly by
3709 * Inputs to the node:
3710 * No inputs except the block it belongs to.
3711 * Outputs of the node.
3712 * An unsigned integer (I_u) or a pointer (P).
3714 * @param value A type or a ident depending on the SymConst kind.
3715 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3716 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
3718 ir_node *new_SymConst (union symconst_symbol value, symconst_kind kind);
3720 /** Constructor for a simpelSel node.
3722 * This is a shortcut for the new_Sel() constructor. To be used for
3723 * Sel nodes that do not select from an array, i.e., have no index
3724 * inputs. It adds the two parameters 0, NULL.
3726 * @param *store The memory in which the object the entity should be selected from is allocated.
3727 * @param *objptr The object from that the Sel operation selects a single attribute out.
3728 * @param *ent The entity to select.
3730 ir_node *new_simpleSel(ir_node *store, ir_node *objptr, ir_entity *ent);
3732 /** Constructor for a Sel node.
3734 * The select node selects an entity (field or method) from an entity
3735 * with a compound type. It explicitly specifies the entity selected.
3736 * Dynamically the node may select entities that overwrite the given
3737 * entity. If the selected entity is an array element entity the Sel
3738 * node takes the required array indices as inputs.
3739 * Adds the node to the block in current_ir_block.
3741 * @param *store The memory in which the object the entity should be selected
3742 * from is allocated.
3743 * @param *objptr A pointer to a compound entity the Sel operation selects a
3744 * single attribute from.
3745 * @param arity The number of array indices needed to select an array element entity.
3746 * @param *in[] If the compound entity is an array the indices of the selected
3747 * element entity. The constructor copies this array.
3748 * @param *ent The entity to select.
3750 ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3753 /** Constructor for a Call node.
3755 * Adds the node to the block in current_ir_block.
3756 * Represents all kinds of method and function calls.
3758 * @param *store The actual store.
3759 * @param *callee A pointer to the called procedure.
3760 * @param arity The number of procedure parameters.
3761 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3762 * @param *tp Type information of the procedure called.
3764 ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node *in[],
3767 /** Constructor for a CallBegin node.
3769 * CallBegin represents control flow depending of the pointer value
3770 * representing the called method to the called methods. The
3771 * constructor copies the method pointer input from the passed Call
3772 * node. Adds the node to the block in current_ir_block.
3774 * @param *callee A pointer to the called procedure.
3776 ir_node *new_CallBegin(ir_node *callee);
3778 /** Constructor for a Add node.
3780 * Adds the node to the block in current_ir_block.
3782 * @param *op1 The first operand.
3783 * @param *op2 The second operand.
3784 * @param *mode The mode of the operands and the result.
3786 ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
3788 /** Constructor for a Sub node.
3790 * Adds the node to the block in current_ir_block.
3792 * @param *op1 The first operand.
3793 * @param *op2 The second operand.
3794 * @param *mode The mode of the operands and the result.
3796 ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
3798 /** Constructor for a Minus node.
3800 * Adds the node to the block in current_ir_block.
3802 * @param *op The operand .
3803 * @param *mode The mode of the operand and the result.
3805 ir_node *new_Minus (ir_node *op, ir_mode *mode);
3808 * Constructor for a Mul node. Adds the node to the block in current_ir_block.
3810 * @param *op1 The first operand.
3811 * @param *op2 The second operand.
3812 * @param *mode The mode of the operands and the result.
3814 ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
3816 /** Constructor for a Quot node.
3818 * Adds the node to the block in current_ir_block.
3820 * @param *memop The store needed to model exceptions
3821 * @param *op1 The first operand.
3822 * @param *op2 The second operand.
3824 ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2);
3826 /** Constructor for a DivMod node.
3828 * Adds the node to the block in current_ir_block.
3830 * @param *memop The store needed to model exceptions
3831 * @param *op1 The first operand.
3832 * @param *op2 The second operand.
3834 ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
3836 /** Constructor for a Div node.
3838 * Adds the node to the block in current_ir_block.
3840 * @param *memop The store needed to model exceptions
3841 * @param *op1 The first operand.
3842 * @param *op2 The second operand.
3844 ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2);
3846 /** Constructor for a Mod node.
3848 * Adds the node to the block in current_ir_block.
3850 * @param *memop The store needed to model exceptions
3851 * @param *op1 The first operand.
3852 * @param *op2 The second operand.
3854 ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2);
3856 /** Constructor for a Abs node.
3858 * Adds the node to the block in current_ir_block.
3860 * @param *op The operand
3861 * @param *mode The mode of the operands and the result.
3863 ir_node *new_Abs (ir_node *op, ir_mode *mode);
3865 /** Constructor for a And node.
3867 * Adds the node to the block in current_ir_block.
3869 * @param *op1 The first operand.
3870 * @param *op2 The second operand.
3871 * @param *mode The mode of the operands and the result.
3873 ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
3876 * Constructor for a Or node. Adds the node to the block in current_ir_block.
3878 * @param *op1 The first operand.
3879 * @param *op2 The second operand.
3880 * @param *mode The mode of the operands and the result.
3882 ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
3885 * Constructor for a Eor node. Adds the node to the block in current_ir_block.
3887 * @param *op1 The first operand.
3888 * @param *op2 The second operand.
3889 * @param *mode The mode of the operands and the results.
3891 ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
3893 /** Constructor for a Not node.
3895 * Adds the node to the block in current_ir_block.
3897 * @param *op The operand.
3898 * @param *mode The mode of the operand and the result.
3900 ir_node *new_Not (ir_node *op, ir_mode *mode);
3902 /** Constructor for a Shl node.
3904 * Adds the node to the block in current_ir_block.
3906 * @param *op The operand.
3907 * @param *k The number of bits to shift the operand .
3908 * @param *mode The mode of the operand and the result.
3910 ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
3913 * Constructor for a Shr node. Adds the node to the block in current_ir_block.
3915 * @param *op The operand.
3916 * @param *k The number of bits to shift the operand .
3917 * @param *mode The mode of the operand and the result.
3919 ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
3921 /** Constructor for a Shrs node.
3923 * Adds the node to the block in current_ir_block.
3925 * @param *op The operand.
3926 * @param *k The number of bits to shift the operand .
3927 * @param *mode The mode of the operand and the result.
3929 ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
3931 /** Constructor for a Rot node.
3933 * Adds the node to the block in current_ir_block.
3935 * @param *op The operand.
3936 * @param *k The number of bits to rotate the operand.
3937 * @param *mode The mode of the operand.
3939 ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode);
3941 /** Constructor for a Cmp node.
3943 * Adds the node to the block in current_ir_block.
3945 * @param *op1 The first operand.
3946 * @param *op2 The second operand.
3948 ir_node *new_Cmp (ir_node *op1, ir_node *op2);
3950 /** Constructor for a Conv node.
3952 * Adds the node to the block in current_ir_block.
3954 * @param *op The operand.
3955 * @param *mode The mode of this the operand muss be converted.
3957 ir_node *new_Conv (ir_node *op, ir_mode *mode);
3959 /** Constructor for a strict Conv node.
3961 * Adds the node to the block in current_ir_block.
3963 * @param *op The operand.
3964 * @param *mode The mode of this the operand muss be converted.
3966 ir_node *new_strictConv (ir_node *op, ir_mode *mode);
3968 /** Constructor for a Cast node.
3970 * Adds the node to the block in current_ir_block.
3971 * High level type cast
3973 * @param *op The operand.
3974 * @param *to_tp The type of this the operand muss be casted .
3976 ir_node *new_Cast (ir_node *op, ir_type *to_tp);
3978 /** Constructor for a Carry node.
3980 * Adds the node to the block in current_ir_block.
3982 * @param *op1 The first operand.
3983 * @param *op2 The second operand.
3984 * @param *mode The mode of the operands and the result.
3986 ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode);
3988 /** Constructor for a Borrow node.
3990 * Adds the node to the block in current_ir_block.
3992 * @param *op1 The first operand.
3993 * @param *op2 The second operand.
3994 * @param *mode The mode of the operands and the result.
3996 ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode);
3998 /** Constructor for a Phi node.
4000 * Adds the node to the block in current_ir_block.
4002 * @param arity The number of predecessors.
4003 * @param *in Array with predecessors.
4004 * @param *mode The mode of it's inputs and output.
4006 ir_node *new_Phi (int arity, ir_node *in[], ir_mode *mode);
4008 /** Constructor for a Load node.
4010 * @param *store The current memory.
4011 * @param *addr A pointer to the variable to be read in this memory.
4012 * @param *mode The mode of the value to be loaded.
4014 ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode);
4016 /** Constructor for a Store node.
4018 * @param *store The current memory.
4019 * @param *addr A pointer to the variable to be read in this memory.
4020 * @param *val The value to write to this variable.
4022 ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
4024 /** Constructor for a Alloc node.
4026 * The Alloc node extends the memory by space for an entity of type alloc_type.
4027 * Adds the node to the block in current_ir_block.
4029 * @param *store The memory which shall contain the new variable.
4030 * @param *size The number of bytes to allocate.
4031 * @param *alloc_type The type of the allocated variable.
4032 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
4034 ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
4037 /** Constructor for a Free node.
4039 * Frees the memory occupied by the entity pointed to by the pointer
4040 * arg. Type indicates the type of the entity the argument points to.
4041 * Adds the node to the block in current_ir_block.
4043 * @param *store The memory which shall contain the new variable.
4044 * @param *ptr The pointer to the object to free.
4045 * @param *size The number of objects of type free_type to free in a sequence.
4046 * @param *free_type The type of the freed variable.
4047 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
4049 ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
4050 ir_type *free_type, where_alloc where);
4052 /** Constructor for a Sync node.
4054 * Merges several memory values. The node assumes that a variable
4055 * either occurs only in one of the memories, or it contains the same
4056 * value in all memories where it occurs.
4057 * Adds the node to the block in current_ir_block.
4059 * @param arity The number of memories to synchronize.
4060 * @param **in An array of pointers to nodes that produce an output of type
4061 * memory. The constructor copies this array.
4063 ir_node *new_Sync (int arity, ir_node *in[]);
4065 /** Constructor for a Proj node.
4067 * Projects a single value out of a tuple. The parameter proj gives the
4068 * position of the value within the tuple.
4069 * Adds the node to the block in current_ir_block.
4071 * @param arg A node producing a tuple.
4072 * @param *mode The mode of the value to project.
4073 * @param proj The position of the value in the tuple.
4075 ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
4077 /** Constructor for a Filter node.
4079 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
4080 * Filter is a node with two views used to construct the interprocedural view.
4081 * In intraprocedural view its semantics are identical to the Proj node.
4082 * In interprocedural view the Filter performs the Phi operation on method
4083 * parameters or results. Other than a Phi a Filter node may not be removed
4084 * if it has only a single input.
4086 * The constructor builds the Filter in intraprocedural view.
4088 * @param *arg The tuple value to project from.
4089 * @param *mode The mode of the projected value.
4090 * @param proj The position in the tuple to project from.
4092 ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj);
4094 /** Constructor for a defaultProj node.
4096 * Represents the default control flow of a Switch-Cond node.
4097 * Adds the node to the block in current_ir_block.
4099 * @param arg A node producing a tuple.
4100 * @param max_proj The end position of the value in the tuple.
4102 ir_node *new_defaultProj (ir_node *arg, long max_proj);
4104 /** Constructor for a Tuple node.
4106 * This is an auxiliary node to replace a node that returns a tuple
4107 * without changing the corresponding Proj nodes.
4108 * Adds the node to the block in current_ir_block.
4110 * @param arity The number of tuple elements.
4111 * @param **in An array containing pointers to the nodes producing the tuple elements.
4113 ir_node *new_Tuple (int arity, ir_node *in[]);
4115 /** Constructor for an Id node.
4117 * This is an auxiliary node to replace a node that returns a single
4118 * value. Adds the node to the block in current_ir_block.
4120 * @param *val The operand to Id.
4121 * @param *mode The mode of *val.
4123 ir_node *new_Id (ir_node *val, ir_mode *mode);
4125 /** Constructor for a Bad node.
4127 * Returns the unique Bad node of the graph. The same as
4130 ir_node *new_Bad (void);
4132 /** Constructor for a Confirm node.
4134 * Specifies constraints for a value. To support dataflow analyses.
4135 * Adds the node to the block in current_ir_block.
4137 * Example: If the value never exceeds '100' this is expressed by placing a
4138 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
4140 * @param *val The value we express a constraint for
4141 * @param *bound The value to compare against. Must be a firm node, typically a constant.
4142 * @param cmp The compare operation.
4144 ir_node *new_Confirm (ir_node *val, ir_node *bound, pn_Cmp cmp);
4146 /** Constructor for an Unknown node.
4148 * Represents an arbitrary value. Places the node in
4151 * @param *m The mode of the unknown value.
4153 ir_node *new_Unknown(ir_mode *m);
4155 /** Constructor for a NoMem node.
4157 * Returns the unique NoMem node of the graph. The same as
4160 ir_node *new_NoMem (void);
4162 /** Constructor for a Mux node.
4164 * Adds the node to the block in current_ir_block.
4166 * @param *sel The ir_node that calculates the boolean select.
4167 * @param *ir_true The ir_node that calculates the true result.
4168 * @param *ir_false The ir_node that calculates the false result.
4169 * @param *mode The mode of the node (and it_true and ir_false).
4171 ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
4173 /** Constructor for a Psi node.
4175 * @param *arity The arity of the conditions
4176 * @param *conds The array of mode_b conditions, length must be equal arity
4177 * @param *vals The array of mode values, length must be equal arity + 1
4178 * @param *mode The mode of the node (must be the mode of all vals).
4180 ir_node *new_Psi (int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
4182 /** Constructor for a CopyB node.
4184 * Adds the node to the block in current_ir_block.
4186 * @param *store The current memory
4187 * @param *dst The ir_node that represents the destination address.
4188 * @param *src The ir_node that represents the source address.
4189 * @param *data_type The type of the copied data
4191 ir_node *new_CopyB(ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
4193 /** Constructor for a InstOf node.
4195 * A High-Level Type check.
4197 * @param *store The memory in which the object the entity should be selected
4198 * from is allocated.
4199 * @param *objptr A pointer to a object of a class type.
4200 * @param *type The type of which objptr must be.
4202 ir_node *new_InstOf (ir_node *store, ir_node *objptr, ir_type *type);
4204 /**Constructor for a Raise node.
4206 * A High-Level Exception throw.
4208 * @param *store The current memory.
4209 * @param *obj A pointer to the Except variable.
4211 ir_node *new_Raise (ir_node *store, ir_node *obj);
4213 /** Constructor for a Bound node.
4215 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
4217 * Adds the node to the block in current_ir_block.
4219 * @param *store The current memory
4220 * @param *idx The ir_node that represents an index.
4221 * @param *lower The ir_node that represents the lower bound for the index.
4222 * @param *upper The ir_node that represents the upper bound for the index.
4224 ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
4226 /** Constructor for a Pin node.
4228 * @param *node The node which value should be pinned.
4230 ir_node *new_Pin (ir_node *node);
4232 /*---------------------------------------------------------------------*/
4233 /* The comfortable interface. */
4234 /* Supports automatic Phi node construction. */
4235 /* All routines of the block oriented interface except new_Block are */
4237 /*---------------------------------------------------------------------*/
4239 /** Create an immature block.
4241 * An immature block has an unknown number of predecessors. Predecessors
4242 * can be added with add_immBlock_pred(). Once all predecessors are
4243 * added the block must be matured.
4245 * Adds the block to the graph in current_ir_graph. Does set
4246 * current_block. Can be used with automatic Phi node construction.
4247 * This constructor can only be used if the graph is in
4250 ir_node *new_d_immBlock(dbg_info *db);
4251 ir_node *new_immBlock(void);
4253 /** Add a control flow edge to an immature block. */
4254 void add_immBlock_pred(ir_node *immblock, ir_node *jmp);
4256 /** Finalize a Block node, when all control flows are known. */
4257 void mature_immBlock(ir_node *block);
4258 #define mature_cur_block() mature_immBlock(get_cur_block());
4261 /** Get the current value of a local variable.
4263 * Use this function to obtain the last definition of the local variable
4264 * associated with pos. Pos may not exceed the value passed as n_loc
4265 * to new_ir_graph. This call automatically inserts Phi nodes.
4267 * @param *db A pointer for debug information.
4268 * @param pos The position/id of the local variable.
4269 * @param *mode The mode of the value to get.
4271 ir_node *get_d_value(dbg_info *db, int pos, ir_mode *mode);
4272 ir_node *get_value(int pos, ir_mode *mode);
4274 /** Remark a new definition of a variable.
4276 * Use this function to remember a new definition of the value
4277 * associated with pos. Pos may not exceed the value passed as n_loc
4278 * to new_ir_graph. This call is needed to automatically inserts Phi
4281 * @param pos The position/id of the local variable.
4282 * @param *value The new value written to the local variable.
4284 void set_value(int pos, ir_node *value);
4286 /** Find the value number for a node in the current block.
4288 * This function searches all values in the current block for
4289 * a given value and returns its value number if it was found, else
4291 * Note that this does not mean that the value does not exists,
4292 * it's just not equal the node (for instance behind a Phi/Confirm ...)
4294 * @param *value The value to find.
4296 int find_value(ir_node *value);
4298 /** Get the current memory state.
4300 * Use this function to obtain the last definition of the memory
4301 * state. This call automatically inserts Phi nodes for the memory
4304 ir_node *get_store(void);
4306 /** Remark a new definition of the memory state.
4308 * Use this function to remember a new definition of the memory state.
4309 * This call is needed to automatically inserts Phi nodes.
4311 * @param *store The new memory state.
4313 void set_store(ir_node *store);
4315 /** keep this node alive even if End is not control-reachable from it
4317 * @param ka The node to keep alive.
4319 void keep_alive(ir_node *ka);
4321 /** Returns the frame type of the current graph */
4322 ir_type *get_cur_frame_type(void);
4325 /* --- initialize and finalize ir construction --- */
4327 /** Puts the graph into state "phase_high" */
4328 #define irg_finalize_cons(irg) set_irg_phase_state(irg, phase_high)
4330 /** Puts the program and all graphs into state phase_high.
4332 * This also remarks, the construction of types is finished,
4333 * e.g., that no more subtypes will be added. */
4334 void irp_finalize_cons(void);
4336 /* --- Initialization --- */
4339 * This function is called, whenever a local variable is used before definition
4341 * @param irg the IR graph on which this happens
4342 * @param mode the mode of the local var
4343 * @param pos position chosen be the frontend for this variable (n_loc)
4345 * @return a firm node of mode @p mode that initializes the var at position pos
4348 * Do not return NULL!
4349 * If this function is not set, FIRM will create a const node with tarval BAD.
4350 * Use set_irg_loc_description()/get_irg_loc_description() to assign additional
4351 * informations to local variables.
4353 typedef ir_node *uninitialized_local_variable_func_t(ir_graph *irg, ir_mode *mode, int pos);
4355 #endif /* _FIRM_IR_IRCONS_H_ */