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 * @brief Various irnode constructors. Automatic construction of SSA
24 * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Boris Boesler,
30 Ideas for improvement:
31 -# Handle construction of exceptions more comfortable:
32 Add new constructors that pass the exception region (or better the
33 Phi for the memories, the ex. region can be found from there) as parameter,
34 constructor then adds all Proj nodes and returns the pointer
35 to the Proj node that selects the result of the arithmetic operation.
36 -# Maybe hide the exception region in a global variable, especially if
37 it is always unambiguous.
43 * documentation no more supported since 2001
45 * ir node construction.
47 * This file documents all datatypes and constructors needed to
48 * build a FIRM representation of a procedure. The constructors are
49 * also implemented in this file.
51 * The documentation also gives a short manual how to use the library.
53 * For extensive documentation of FIRM see UKA Techreport 1999-14.
56 * Three kinds of nodes
57 * --------------------
59 * There are three kinds of nodes known to the ir: entities,
62 * + ir_nodes are the actual nodes of the FIRM intermediate representation.
63 * They represent operations on the data of the program and control flow
66 * + entity ==> implemented in entity.h
67 * Refers to a single entity of the compiled program, e.g. a field of a
68 * class or a method. If a method or variable can not be assigned to
69 * a method or class or the like, it is a global object.
71 * + types ==> implemented in type.h
72 * With types type information is represented. There are several type
75 * Implementation of the FIRM operations: ir_node
76 * ----------------------------------------------
78 * Ir_nodes represent operations on the data of the program and control flow
79 * operations. Examples of ir_nodes: Add, Jmp, Cmp
81 * FIRM is a dataflow graph. A dataflow graph is a directed graph,
82 * so that every node has incoming and outgoing edges. A node is
83 * executable if every input at it's incoming edges is available.
84 * Execution of the dataflow graph is started at the Start node which
85 * has no incoming edges and ends when the End node executes, even if
86 * there are still executable or not executed nodes. (Is this true,
87 * or must all executable nodes be executed?) (There are exceptions
88 * to the dataflow paradigma that all inputs have to be available
89 * before a node can execute: Phi, Block. See UKA Techreport
92 * The implementation of FIRM differs from the view as a dataflow
93 * graph. To allow fast traversion of the graph edges are
94 * implemented as C-pointers. Inputs to nodes are not ambiguous, the
95 * results can be used by several other nodes. Each input can be
96 * implemented as a single pointer to a predecessor node, outputs
97 * need to be lists of pointers to successors. Therefore a node
98 * contains pointers to it's predecessor so that the implementation is a
99 * dataflow graph with reversed edges. It has to be traversed bottom
102 * All nodes of the ir have the same basic structure. They are
103 * distinguished by a field containing the opcode.
105 * The fields of an ir_node:
107 * kind A firm_kind tag containing k_ir_node. This is useful for
108 * dynamically checking the type of a node.
110 * *op This ir_op gives the opcode as a tag and a string
111 * and the number of attributes of an ir_node. There is
112 * one statically allocated struct ir_op for each opcode.
114 * *mode The ir_mode of the operation represented by this firm
115 * node. The mode of the operation is the mode of it's
116 * result. A Firm mode is a datatype as known to the target,
117 * not a type of the source language.
119 * visit A flag for traversing the ir.
121 * **in An array with pointers to the node's predecessors.
123 * *link A pointer to an ir_node. With this pointer all Phi nodes
124 * are attached to a Block, i.e., a Block points to it's
125 * first Phi node, this node points to the second Phi node
126 * in the Block and so fourth. Used in mature_immBlock
127 * to find all Phi nodes to be matured. It's also used to
128 * annotate a node with a better, optimized version of it.
130 * attr An attr struct containing the attributes of the nodes. The
131 * attributes depend on the opcode of the node. The number
132 * of these attributes is given in op.
136 * Not yet documented. See irop.h.
140 * Not yet documented. See irmode.h.
142 * GLOBAL VARIABLES -- now also fields of ir_graph.
145 * current_ir_graph Points to the current ir_graph. All constructors for
146 * nodes add nodes to this graph.
148 * ir_visited An int used as flag to traverse the ir_graph.
150 * block_visited An int used as a flag to traverse block nodes in the
153 * Others not yet documented.
157 * CONSTRUCTOR FOR IR_GRAPH --> see irgraph.h
158 * ========================
161 * PROCEDURE TO CONSTRUCT AN IR GRAPH --> see also Firm tutorial
162 * ==================================
164 * This library supplies several interfaces to construct a FIRM graph for
166 * - A "comfortable" interface generating SSA automatically. Automatically
167 * computed predecessors of nodes need not be specified in the constructors.
168 * (new_<Node> constructurs and a set of additional routines.)
169 * - A less comfortable interface where all predecessors except the block
170 * an operation belongs to need to be specified. SSA must be constructed
171 * by hand. (new_<Node> constructors and set_cur_block()). This interface
172 * is called "block oriented". It automatically calles the local optimizations
174 * - An even less comfortable interface where the block needs to be specified
175 * explicitly. This is called the "raw" interface. (new_r_<Node>
176 * constructors). These nodes are not optimized.
178 * To use the functionality of the comfortable interface correctly the Front
179 * End needs to follow certain protocols. This is explained in the following.
180 * To build a correct IR with the other interfaces study the semantics of
181 * the firm node (See tech-reprot UKA 1999-14). For the construction of
182 * types and entities see the documentation in those modules.
184 * First the Frontend needs to decide which variables and values used in
185 * a procedure can be represented by dataflow edges. These are variables
186 * that need not be saved to memory as they cause no side effects visible
187 * out of the procedure. Often these are all compiler generated
188 * variables and simple local variables of the procedure as integers,
189 * reals and pointers. The frontend has to count and number these variables.
191 * First an ir_graph needs to be constructed with new_ir_graph. The
192 * constructor gets the number of local variables. The graph is hold in the
193 * global variable irg.
195 * Now the construction of the procedure can start. Several basic blocks can
196 * be constructed in parallel, but the code within each block needs to
197 * be constructed (almost) in program order.
199 * A global variable holds the current basic block. All (non block) nodes
200 * generated are added to this block. The current block can be set with
201 * set_cur_block(block). If several blocks are constructed in parallel block
202 * switches need to be performed constantly.
204 * To generate a Block node (with the comfortable interface) it's predecessor
205 * control flow nodes need not be known. In case of cyclic control flow these
206 * can not be known when the block is constructed. With add_immBlock_pred(block,
207 * cfnode) predecessors can be added to the block. If all predecessors are
208 * added to the block mature_immBlock(b) needs to be called. Calling mature_immBlock
209 * early improves the efficiency of the Phi node construction algorithm.
210 * But if several blocks are constructed at once, mature_immBlock must only
211 * be called after performing all set_values and set_stores in the block!
212 * (See documentation of new_immBlock constructor.)
214 * The constructors of arithmetic nodes require that their predecessors
215 * are mentioned. Sometimes these are available in the Frontend as the
216 * predecessors have just been generated by the frontend. If they are local
217 * values the predecessors can be obtained from the library with a call to
218 * get_value(local_val_nr). (local_val_nr needs to be administered by
219 * the Frontend.) A call to get_value triggers the generation of Phi nodes.
220 * If an arithmetic operation produces a local value this value needs to be
221 * passed to the library by set_value(node, local_val_nr).
222 * In straight line code these two operations just remember and return the
223 * pointer to nodes producing the value. If the value passes block boundaries
224 * Phi nodes can be inserted.
225 * Similar routines exist to manage the Memory operands: set_store and
228 * Several nodes produce more than one result. An example is the Div node.
229 * Such nodes return tuples of values. From these individual values can be
230 * extracted by proj nodes.
232 * The following example illustrates the construction of a simple basic block
233 * with two predecessors stored in variables cf_pred1 and cf_pred2, containing
236 * and finally jumping to an other block. The variable a got the local_val_nr
237 * 42 by the frontend.
239 * ir_node *this_block, *cf_pred1, *cf_pred2, *a_val, *mem, *div, *res, *cf_op;
241 * this_block = new_immBlock();
242 * add_immBlock_pred(this_block, cf_pred1);
243 * add_immBlock_pred(this_block, cf_pred2);
244 * mature_immBlock(this_block);
245 * a_val = get_value(42, mode_Iu);
247 * div = new_Div(mem, a_val, a_val);
248 * mem = new_Proj(div, mode_M, 0); * for the numbers for Proj see docu *
249 * res = new_Proj(div, mode_Iu, 2);
251 * set_value(res, 42);
254 * For further information look at the documentation of the nodes and
255 * constructors and at the paragraph COPING WITH DATA OBJECTS at the
256 * end of this documentation.
258 * The comfortable interface contains the following routines further explained
261 * ir_node *new_immBlock (void);
262 * ir_node *new_Start (void);
263 * ir_node *new_End (void);
264 * ir_node *new_Jmp (void);
265 * ir_node *new_IJmp (ir_node *tgt);
266 * ir_node *new_Cond (ir_node *c);
267 * ir_node *new_Return (ir_node *store, int arity, ir_node **in);
268 * ir_node *new_Const (ir_mode *mode, tarval *con);
269 * ir_node *new_SymConst (symconst_symbol value, symconst_kind kind);
270 * ir_node *new_simpleSel (ir_node *store, ir_node *objptr, ir_entity *ent);
271 * ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity,
272 * ir_node **in, ir_entity *ent);
273 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity,
274 * ir_node **in, type_method *type);
275 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
276 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
277 * ir_node *new_Minus (ir_node *op, ir_mode *mode);
278 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
279 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2);
280 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
281 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2);
282 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2);
283 * ir_node *new_Abs (ir_node *op, ir_mode *mode);
284 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
285 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
286 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
287 * ir_node *new_Not (ir_node *op, ir_mode *mode);
288 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
289 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
290 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
291 * ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode);
292 * ir_node *new_Cmp (ir_node *op1, ir_node *op2);
293 * ir_node *new_Conv (ir_node *op, ir_mode *mode);
294 * ir_node *new_Cast (ir_node *op, ir_type *to_tp);
295 * ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode);
296 * ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode);
297 * ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode);
298 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
299 * ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
300 * where_alloc where);
301 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
302 * ir_type *free_type, where_alloc where);
303 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
304 * ir_node *new_NoMem (void);
305 * ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
306 * ir_node *new_Psi (int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
307 * ir_node *new_CopyB (ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
308 * ir_node *new_InstOf (ir_node *store, ir_node obj, ir_type *ent);
309 * ir_node *new_Raise (ir_node *store, ir_node *obj);
310 * ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
311 * ir_node *new_Pin (ir_node *node);
313 * void add_immBlock_pred (ir_node *block, ir_node *jmp);
314 * void mature_immBlock (ir_node *block);
315 * void set_cur_block (ir_node *target);
316 * ir_node *get_value (int pos, ir_mode *mode);
317 * void set_value (int pos, ir_node *value);
318 * ir_node *get_store (void);
319 * void set_store (ir_node *store);
320 * keep_alive (ir_node ka)
322 * IR_NODES AND CONSTRUCTORS FOR IR_NODES
323 * =======================================
325 * All ir_nodes are defined by a common data structure. They are distinguished
326 * by their opcode and differ in the number of their attributes.
328 * The constructor for the block node sets current_block to itself.
329 * Const nodes are always added to the start block.
330 * All other constructors add the created node to the current_block.
331 * swich_block(block) allows to set the current block to block.
333 * Watch for my inconsistent use of input and predecessor (dataflow view)
334 * and `the node points to' (implementation view).
336 * The following description of the nodes lists four properties them if these
338 * - the parameters to the constructor
339 * - the inputs of the Firm node
340 * - the outputs of the Firm node
341 * - attributes to the node
345 * ir_node *new_immBlock (void)
346 * ----------------------------
348 * Creates a new block. Sets current_block to itself. When a new block is
349 * created it cannot be known how many predecessors this block will have in the
350 * control flow graph. Therefore the list of inputs can not be fixed at
351 * creation. Predecessors can be added with add_immBlock_pred (block, control flow
352 * operation). With every added predecessor the number of inputs to Phi nodes
355 * The block can be completed by mature_immBlock(block) if all predecessors are
356 * known. If several blocks are built at once, mature_immBlock can only be called
357 * after set_value has been called for all values that are life at the end
358 * of the block. This is necessary so that Phi nodes created mature_immBlock
359 * get the right predecessors in case of cyclic dependencies. If all set_values
360 * of this block are called after maturing it and before calling get_value
361 * in some block that is control flow dependent on this block, the construction
364 * Example for faulty ir construction: (draw the graph on a paper and you'll
367 * block_before_loop = new_block();
369 * mature_immBlock(block_before_loop);
370 * before2header = new_Jmp;
372 * loop_header = new_block ();
373 * header2body - new_Jmp();
375 * loop_body = new_block ();
376 * body2header = new_Jmp();
378 * add_immBlock_pred(loop_header, before2header);
379 * add_immBlock_pred(loop_header, body2header);
380 * add_immBlock_pred(loop_body, header2body);
382 * mature_immBlock(loop_header);
383 * mature_immBlock(loop_body);
385 * get_value(loop_body, x); // gets the Phi in loop_header
386 * set_value(loop_header, x); // sets the value the above get_value should
387 * // have returned!!!
389 * Mature_immBlock also fixes the number of inputs to the Phi nodes. Mature_immBlock
390 * should be called as early as possible, as afterwards the generation of Phi
391 * nodes is more efficient.
394 * There is an input for each control flow predecessor of the block.
395 * The input points to an instruction producing an output of type X.
396 * Possible predecessors: Start, Jmp, Cond, Raise or Return or any node
397 * possibly causing an exception. (Often the real predecessors are Projs.)
399 * Mode BB (R), all nodes belonging to this block should consume this output.
400 * As they are strict (except Block and Phi node) it is a necessary condition
401 * that the block node executed before any other node in this block executes.
403 * block.matured Indicates whether the block is mature.
405 * This attribute contains all local values valid in this
406 * block. This is needed to build the Phi nodes and removed
407 * if the graph is complete. This field is used by the
408 * internal construction algorithm and should not be accessed
412 * ir_node *new_Block (int arity, ir_node **in)
413 * --------------------------------------------
415 * Creates a new Block with the given list of predecessors. This block
416 * is mature. As other constructors calls optimization and vrfy for the
417 * block. If one of the predecessors is Unknown (as it has to be filled in
418 * later) optimizations are skipped. This is necessary to
419 * construct Blocks in loops. Leaving Unknown in the Block after finishing
420 * the construction may have strange effects, especially for interprocedural
421 * representation and analysis.
424 * CONTROL FLOW OPERATIONS
425 * -----------------------
427 * In each block there must be exactly one of the control flow
428 * operations Start, End, Jmp, Cond, Return or Raise. The output of a
429 * control flow operation points to the block to be executed next.
431 * ir_node *new_Start (void)
432 * -------------------------
434 * Creates a start node. Not actually needed public. There is only one such
435 * node in each procedure which is automatically created by new_ir_graph.
438 * No inputs except the block it belogns to.
440 * A tuple of 4 (5, 6) distinct values. These are labeled by the following
441 * projection numbers (pn_Start):
442 * * pn_Start_X_initial_exec mode X, points to the first block to be exe * cuted.
443 * * pn_Start_M mode M, the global store
444 * * pn_Start_P_frame_base mode P, a pointer to the base of the proce * dures stack frame.
445 * * pn_Start_P_globals mode P, a pointer to the part of the memory * containing_all_ global things.
446 * * pn_Start_T_args mode T, a tuple containing all arguments of * the procedure.
449 * ir_node *new_End (void)
450 * -----------------------
452 * Creates an end node. Not actually needed public. There is only one such
453 * node in each procedure which is automatically created by new_ir_graph.
456 * No inputs except the block it belongs to.
460 * ir_node *new_Jmp (void)
461 * -----------------------
463 * Creates a Jmp node.
466 * The block the node belongs to
468 * Control flow to the next block.
470 * ir_node *new_IJmp (ir_node *tgt)
471 * -----------------------
473 * Creates an IJmp node.
476 * The node that represents the target jump address
478 * Control flow to an unknown target, must be pinned by
481 * ir_node *new_Cond (ir_node *c)
482 * ------------------------------
484 * Creates a Cond node. There are two versions of this node.
490 * A tuple of two control flows. The first is taken if the input is
491 * false, the second if it is true.
495 * A value of mode I_u. (i)
497 * A tuple of n control flows. If the Cond's input is i, control
498 * flow will procede along output i. If the input is >= n control
499 * flow proceeds along output n.
501 * ir_node *new_Return (ir_node *store, int arity, ir_node **in)
502 * -------------------------------------------------------------
504 * The return node has as inputs the results of the procedure. It
505 * passes the control flow to the end_block.
511 * Control flow to the end block.
515 * ir_node *new_Const (ir_mode *mode, tarval *con)
516 * -----------------------------------------------
518 * Creates a constant in the constant table and adds a Const node
519 * returning this value to the start block.
522 * *mode The mode of the constant.
523 * *con Points to an entry in the constant table.
524 * This pointer is added to the attributes of
525 * the node (self->attr.con)
527 * No inputs except the block it belogns to.
529 * The constant value.
531 * attr.con A tarval* pointer to the proper entry in the constant
534 * ir_node *new_SymConst (union symconst_symbol value, symconst_addr_ent kind)
535 * ---------------------------------------------------------------------------
537 * There are three kinds of symbolic constants:
538 * symconst_type_tag The symbolic constant represents a type tag.
539 * symconst_type_size The symbolic constant represents the size of a type.
540 * symconst_type_align The symbolic constant represents the alignment of a type.
541 * symconst_addr_name Information for the linker, e.g. the name of a global
543 * symconst_addr_name The symbolic constant represents the address of an entity.
545 * To represent a pointer to an entity that is represented by an entity
546 * datastructure don't use
547 * new_SymConst((type_or_id*)get_entity_ld_ident(ent), symconst_addr_name);.
548 * Use a real const instead:
549 * new_SymConst(ent, symconst_addr_ent);
550 * This makes the Constant independent of name changes of the entity due to
554 * kind The kind of the symbolic constant: type_tag, size or link_info.
555 * *type_or_id Points to the type the tag stands for or to the type
556 * whose size is represented by the constant or to an ident
557 * representing the linkage info.
560 * No inputs except the block it belogns to.
562 * An unsigned integer (I_u) or a pointer (P).
565 * attr.i.num The symconst_addr_ent, i.e. one of
567 * -symconst_type_size
568 * -symconst_type_align
569 * -symconst_addr_name
571 * If the attr.i.num is symconst_type_tag, symconst_type_size or symconst_type_align,
572 * the node contains an attribute:
574 * attr.i.*type, a pointer to a type_class. The mode of the node is mode_Is.
575 * if it is linkage_ptr_info it contains
576 * attr.i.*ptrinfo, an ident holding information for the linker. The mode
577 * of the node is mode_P_mach.
581 * ir_node *new_simpleSel (ir_node *store, ir_node *frame, ir_entity *sel)
582 * -----------------------------------------------------------------------
585 * Selects an entity from a compound type. This entity can be a field or
589 * *store The memory in which the object the entity should be selected
591 * *frame The pointer to the object.
592 * *sel The entity to select.
595 * The memory containing the object.
596 * A pointer to the object.
597 * An unsigned integer.
599 * A pointer to the selected entity.
601 * attr.sel Pointer to the entity
604 * ir_node *new_Sel (ir_node *store, ir_node *frame, int arity, ir_node **in,
605 * --------------------------------------------------------------------------
609 * Selects a field from an array type. The entity has as owner the array, as
610 * type the arrays element type. The indices to access an array element are
614 * *store The memory in which the object the entity should be selected from
616 * *frame The pointer to the object.
617 * *arity number of array indices.
618 * *in array with index inputs to the node.
619 * *sel The entity to select.
622 * The memory containing the object.
623 * A pointer to the object.
624 * As much unsigned integer as there are array expressions.
626 * A pointer to the selected entity.
628 * attr.sel Pointer to the entity
630 * The constructors new_Sel and new_simpleSel generate the same ir nodes.
631 * simpleSel just sets the arity of the index inputs to zero.
634 * ARITHMETIC OPERATIONS
635 * ---------------------
637 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node **in,
638 * ----------------------------------------------------------------------------
642 * Creates a procedure call.
645 * *store The actual store.
646 * *callee A pointer to the called procedure.
647 * arity The number of procedure parameters.
648 * **in An array with the pointers to the parameters.
649 * The constructor copies this array.
650 * *type Type information of the procedure called.
653 * The store, the callee and the parameters.
655 * A tuple containing the eventually changed store and the procedure
658 * attr.call Contains the type information for the procedure.
661 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode)
662 * ------------------------------------------------------------
666 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode)
667 * ------------------------------------------------------------
671 * ir_node *new_Minus (ir_node *op, ir_mode *mode)
672 * -----------------------------------------------
674 * Unary Minus operations on integer and floating point values.
676 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode)
677 * ------------------------------------------------------------
681 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2)
682 * --------------------------------------------------------------
684 * Quot performs exact division of floating point numbers. It's mode
685 * is Tuple, the mode of the result must be annotated to the Proj
686 * that extracts the result of the arithmetic operations.
689 * The store needed to model exceptions and the two operands.
691 * A tuple contaning a memory and a execution for modeling exceptions
692 * and the result of the arithmetic operation.
694 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2)
695 * ----------------------------------------------------------------
697 * Performs Div and Mod on interger values.
700 * A tuple contaning a memory and a execution for modeling exceptions
701 * and the two result of the arithmetic operations.
703 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2)
704 * -------------------------------------------------------------
708 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2)
709 * -------------------------------------------------------------
713 * ir_node *new_Abs (ir_node *op, ir_mode *mode)
714 * ---------------------------------------------
718 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode)
719 * ------------------------------------------------------------
723 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode)
724 * -----------------------------------------------------------
728 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode)
729 * ------------------------------------------------------------
733 * ir_node *new_Not (ir_node *op, ir_mode *mode)
734 * ---------------------------------------------
736 * This node constructs a constant where all bits are set to one
737 * and a Eor of this constant and the operator. This simulates a
740 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode)
741 * ---------------------------------------------------------
745 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode)
746 * ---------------------------------------------------------
748 * Logic shift right, i.e., zero extended.
751 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode)
752 * ----------------------------------------------------------
754 * Arithmetic shift right, i.e., sign extended.
756 * ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode)
757 * ---------------------------------------------------------
759 * Rotates the operand to the (right??) by k bits.
761 * ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode)
762 * ------------------------------------------------------------
764 * Calculates the Carry value for integer addition. Used only
767 * ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode)
768 * ------------------------------------------------------------
770 * Calculates the Borrow value for integer substraction. Used only
773 * ir_node *new_Conv (ir_node *op, ir_mode *mode)
774 * ---------------------------------------------
776 * Mode conversion. For allowed conversions see UKA Tech Report
779 * ir_node *new_Cmp (ir_node *op1, ir_node *op2)
780 * ---------------------------------------------
783 * The two values to be compared.
785 * A 16-tuple containing the results of the 16 different comparisons.
786 * The following is a list giving the comparisons and a projection
787 * number (pn_Cmp) to use in Proj nodes to extract the proper result.
791 * pn_Cmp_Le less or equal
793 * pn_Cmp_Ge greater of equal
794 * pn_Cmp_Lg less or greater
795 * pn_Cmp_Leg less, equal or greater = ordered
796 * pn_Cmp_Uo unordered
797 * pn_Cmp_Ue unordered or equal
798 * pn_Cmp_Ul unordered or less
799 * pn_Cmp_Ule unordered, less or equal
800 * pn_Cmp_Ug unordered or greater
801 * pn_Cmp_Uge unordered, greater or equal
802 * pn_Cmp_Ne unordered, less or greater = not equal
809 * In general, Phi nodes are automaitcally inserted. In some cases, if
810 * all predecessors of a block are known, an explicit Phi node constructor
811 * is needed. E.g., to construct a FIRM graph for a statement as
812 * a = (b==c) ? 2 : 5;
814 * ir_node *new_Phi (int arity, ir_node **in, ir_mode *mode)
815 * ---------------------------------------------------------
817 * Creates a Phi node. The in's order has to correspond to the order
818 * of in's of current_block. This is not checked by the library!
819 * If one of the predecessors is Unknown (as it has to be filled in
820 * later) optimizations are skipped. This is necessary to
821 * construct Phi nodes in loops. Leaving Unknown in the Phi after finishing
822 * the construction may have strange effects, especially for interprocedural
823 * representation and analysis.
826 * arity number of predecessors
827 * **in array with predecessors
828 * *mode The mode of it's inputs and output.
830 * A Phi node has as many inputs as the block it belongs to.
831 * Each input points to a definition of the same value on a
832 * different path in the control flow.
834 * The definition valid in this block.
836 * ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode)
837 * -----------------------------------------------------------------------------
839 * Creates a Mux node. This node implements the following semantic:
840 * If the sel node (which must be of mode_b) evaluates to true, its value is
841 * ir_true, else ir_false;
844 * ir_node *new_Psi (int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode)
845 * -----------------------------------------------------------------------------
847 * Creates a Psi node. This node implements the following semantic:
851 * OPERATIONS TO MANAGE MEMORY EXPLICITLY
852 * --------------------------------------
854 * ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode)
855 * ----------------------------------------------------------------
857 * The Load operation reads a value from memory.
860 * *store The current memory.
861 * *addr A pointer to the variable to be read in this memory.
862 * *mode The mode of the value to be loaded.
865 * The memory and a pointer to a variable in this memory.
867 * A tuple of the memory, a control flow to be taken in case of
868 * an exception and the loaded value.
870 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val)
871 * ----------------------------------------------------------------
873 * The Store operation writes a value to a variable in memory.
876 * The memory, a pointer to a variable in this memory and the value
877 * to write to this variable.
879 * A tuple of the changed memory and a control flow to be taken in
880 * case of an exception.
882 * ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
883 * -----------------------------------------------------------------------
887 * The Alloc node allocates a new variable. It can be specified whether the
888 * variable should be allocated to the stack or to the heap.
891 * *store The memory which shall contain the new variable.
892 * ** *size The number of bytes to allocate. Old. **
893 * *size We decided that the size easily can be derived from the type.
894 * This field is for allocating arrays, i.e., it gives the multiple
895 * of the size of alloc_type to allocate memory for.
896 * *alloc_type The type of the allocated variable.
897 * where Where to allocate the variable, either heap_alloc or stack_alloc.
900 * A memory and an unsigned integer.
902 * A tuple of the changed memory, a control flow to be taken in
903 * case of an exception and the pointer to the new variable.
905 * a.where Indicates where the variable is allocated.
906 * a.*type A pointer to the class the allocated data object
909 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size, ir_type *free_type,
910 * -----------------------------------------------------------------------------------
914 * The Free node frees memory of the given variable.
917 * *store The memory which shall contain the new variable.
918 * *ptr The pointer to the object to free.
919 * *size The number of objects of type free_type to free in a sequence.
920 * *free_type The type of the freed variable.
921 * where Where the variable was allocated, either heap_alloc or stack_alloc.
924 * A memory, a pointer and an unsigned integer.
926 * The changed memory.
928 * f.*type A pointer to the type information of the freed data object.
932 * ir_node *new_Sync (int arity, ir_node **in)
933 * -------------------------------------------
935 * The Sync operation unifies several partial memory blocks. These blocks
936 * have to be pairwise disjunct or the values in common locations have to
937 * be identical. This operation allows to specify all operations that eventually
938 * need several partial memory blocks as input with a single entrance by
939 * unifying the memories with a preceding Sync operation.
942 * arity The number of memories to synchronize.
943 * **in An array of pointers to nodes that produce an output of
948 * The unified memory.
954 * ir_node *new_Bad (void)
955 * -----------------------
957 * Returns the unique Bad node current_ir_graph->bad.
958 * This node is used to express results of dead code elimination.
960 * ir_node *new_NoMem (void)
961 * -----------------------------------------------------------------------------------
963 * Returns the unique NoMem node current_ir_graph->no_mem.
964 * This node is used as input for operations that need a Memory, but do not
965 * change it like Div by const != 0, analyzed calls etc.
967 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj)
968 * ----------------------------------------------------------
970 * Selects one entry of a tuple. This is a hidden edge with attributes.
973 * *arg A node producing a tuple.
974 * *mode The mode of the value to project.
975 * proj The position of the value in the tuple.
981 * ir_node *new_Tuple (int arity, ir_node **in)
982 * --------------------------------------------
984 * Builds a Tuple from single values. This is needed to implement
985 * optimizations that remove a node that produced a tuple. The node can be
986 * replaced by the Tuple operation so that the following Proj nodes have not to
987 * be changed. (They are hard to find due to the implementation with pointers
988 * in only one direction.) The Tuple node is smaller than any other
989 * node, so that a node can be changed into a Tuple by just changing it's
990 * opcode and giving it a new in array.
993 * arity The number of tuple elements.
994 * **in An array containing pointers to the nodes producing the
997 * ir_node *new_Id (ir_node *val, ir_mode *mode)
998 * ---------------------------------------------
1000 * The single output of the Id operation is it's input. Also needed
1001 * for optimizations.
1004 * HIGH LEVEL OPERATIONS
1005 * ---------------------
1007 * ir_node *new_CopyB (ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type)
1008 * -----------------------------------------------------------------------------------
1010 * Describes a high level block copy of a compound type from address src to
1011 * address dst. Must be lowered to a Call to a runtime memory copy function.
1014 * HIGH LEVEL OPERATIONS: Exception Support
1015 * ----------------------------------------
1016 * See TechReport 1999-14, chapter Exceptions.
1018 * ir_node *new_InstOf(ir_node *store, ir_node *ptr, ir_type *type);
1019 * -----------------------------------------------------------------------------------
1021 * Describes a high level type check. Must be lowered to a Call to a runtime check
1024 * ir_node *new_Raise (ir_node *store, ir_node *obj)
1025 * -------------------------------------------------
1027 * Raises an exception. Unconditional change of control flow. Writes
1028 * an explicit Except variable to memory to pass it to the exception
1029 * handler. Must be lowered to a Call to a runtime check
1034 * A pointer to the Except variable.
1036 * A tuple of control flow and the changed memory state. The control flow
1037 * points to the exception handler if it is definied in this procedure,
1038 * else it points to the end_block.
1040 * ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
1041 * -----------------------------------------------------------------------------------
1043 * Describes a high level bounds check. Must be lowered to a Call to a runtime check
1046 * ir_node *new_Pin (ir_node *node);
1047 * -----------------------------------------------------------------------------------
1049 * Pin the value of the node node in the current block No users of the Pin node can
1050 * float above the Block of the Pin. The node cannot float behind this block. Often
1051 * used to Pin the NoMem node.
1054 * COPING WITH DATA OBJECTS
1055 * ========================
1057 * Two kinds of data objects have to be distinguished for generating
1058 * FIRM. First there are local variables other than arrays that are
1059 * known to be alias free. Second there are all other data objects.
1060 * For the first a common SSA representation is built, the second
1061 * are modeled by saving them to memory. The memory is treated as
1062 * a single local variable, the alias problem is hidden in the
1063 * content of this variable.
1065 * All values known in a Block are listed in the block's attribute,
1066 * block.**graph_arr which is used to automatically insert Phi nodes.
1067 * The following two functions can be used to add a newly computed value
1068 * to the array, or to get the producer of a value, i.e., the current
1071 * inline void set_value (int pos, ir_node *value)
1072 * -----------------------------------------------
1074 * Has to be called for every assignment to a local variable. It
1075 * adds the value to the array of used values at position pos. Pos
1076 * has to be a unique identifier for an entry in the procedure's
1077 * definition table. It can be used to access the value again.
1078 * Requires current_block to be set correctly.
1080 * ir_node *get_value (int pos, ir_mode *mode)
1081 * -------------------------------------------
1083 * Returns the node defining the value referred to by pos. If the
1084 * value is not defined in this block a Phi node is generated and
1085 * all definitions reaching this Phi node are collected. It can
1086 * happen that the algorithm allocates an unnecessary Phi node,
1087 * e.g. if there is only one definition of this value, but this
1088 * definition reaches the currend block on several different
1089 * paths. This Phi node will be eliminated if optimizations are
1090 * turned on right after it's creation.
1091 * Requires current_block to be set correctly.
1093 * There are two special routines for the global store:
1095 * void set_store (ir_node *store)
1096 * -------------------------------
1098 * Adds the store to the array of known values at a reserved
1100 * Requires current_block to be set correctly.
1102 * ir_node *get_store (void)
1103 * -------------------------
1105 * Returns the node defining the actual store.
1106 * Requires current_block to be set correctly.
1109 * inline void keep_alive (ir_node *ka)
1110 * ------------------------------------
1112 * Keep this node alive because it is (might be) not in the control
1113 * flow from Start to End. Adds the node to the list in the end
1117 #ifndef FIRM_IR_IRCONS_H
1118 #define FIRM_IR_IRCONS_H
1120 #include "firm_common.h"
1122 #include "irgraph.h"
1123 #include "dbginfo.h"
1125 /*-------------------------------------------------------------------------*/
1126 /* The raw interface */
1127 /*-------------------------------------------------------------------------*/
1129 /** Constructor for a Block node.
1131 * Constructs a mature block with the given predecessors. Use Unknown
1132 * nodes as predecessors to construct a block if the number of
1133 * predecessors is known, but not the predecessors themselves. This
1134 * constructor does not set current_block. It not be used with
1135 * automatic Phi node construction.
1137 * @param *db A Pointer for debug information.
1138 * @param irg The ir graph the block belongs to.
1139 * @param arity The number of control predecessors.
1140 * @param in[] An array of control predecessors. The length of
1141 * the array must be 'arity'. The constructor copies this array.
1143 ir_node *new_rd_Block (dbg_info *db, ir_graph *irg, int arity, ir_node *in[]);
1145 /** Constructor for a Start node.
1147 * @param *db A pointer for debug information.
1148 * @param *irg The ir graph the node belongs to.
1149 * @param *block The ir block the node belongs to.
1151 ir_node *new_rd_Start (dbg_info *db, ir_graph *irg, ir_node *block);
1153 /** Constructor for a End node.
1155 * @param *db A pointer for debug information.
1156 * @param *irg The ir graph the node belongs to.
1157 * @param *block The ir block the node belongs to.
1159 ir_node *new_rd_End (dbg_info *db, ir_graph *irg, ir_node *block);
1161 /** Constructor for a Jmp node.
1163 * Jmp represents control flow to a single control successor.
1165 * @param *db A pointer for debug information.
1166 * @param *irg The ir graph the node belongs to.
1167 * @param *block The ir block the node belongs to.
1169 ir_node *new_rd_Jmp (dbg_info *db, ir_graph *irg, ir_node *block);
1171 /** Constructor for an IJmp node.
1173 * IJmp represents control flow to a single control successor not
1174 * statically known i.e. an indirect Jmp.
1176 * @param *db A pointer for debug information.
1177 * @param *irg The ir graph the node belongs to.
1178 * @param *block The ir block the node belongs to.
1179 * @param *tgt The ir node representing the target address.
1181 ir_node *new_rd_IJmp (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *tgt);
1183 /** Constructor for a Break node.
1185 * Break represents control flow to a single control successor just as Jmp.
1186 * The blocks separated by a break may not be concatenated by an optimization.
1187 * It is used for the interprocedural representation where blocks are parted
1188 * behind Call nodes to represent the control flow to called procedures.
1190 * @param *db A pointer for debug information.
1191 * @param *irg The ir graph the node belong to.
1192 * @param *block The block the node belong to.
1194 ir_node *new_rd_Break (dbg_info *db, ir_graph *irg, ir_node *block);
1196 /** Constructor for a Cond node.
1198 * If c is mode_b represents a conditional branch (if/else). If c is
1199 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
1200 * node, default Proj is 0.)
1202 * This is not consistent: Input to Cond is Is, Proj has as proj number
1205 * @param *db A pointer for debug information.
1206 * @param *irg The ir graph the node belongs to.
1207 * @param *block The ir block the node belongs to.
1208 * @param *c The conditions parameter. Can be of mode b or I_u.
1210 ir_node *new_rd_Cond (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *c);
1212 /** Constructor for a Return node.
1214 * Returns the memory an zero or more return values. Only node that
1215 * can end regular control flow.
1217 * @param *db A pointer for debug information.
1218 * @param *irg The ir graph the node belongs to.
1219 * @param *block The ir block the node belongs to.
1220 * @param *store The state of memory.
1221 * @param arity Number of return values.
1222 * @param *in Array of length arity with return values. The constructor copies this array.
1224 ir_node *new_rd_Return (dbg_info *db, ir_graph *irg, ir_node *block,
1225 ir_node *store, int arity, ir_node *in[]);
1227 /** Constructor for a Const_type node.
1229 * The constant represents a target value. This constructor sets high
1230 * level type information for the constant value.
1232 * @param *db A pointer for debug information.
1233 * @param *irg The ir graph the node belongs to.
1234 * @param *block The ir block the node belongs to.
1235 * @param *mode The mode of the operands and results.
1236 * @param *con Points to an entry in the constant table.
1237 * @param *tp The type of the constant.
1239 ir_node *new_rd_Const_type (dbg_info *db, ir_graph *irg, ir_node *block,
1240 ir_mode *mode, tarval *con, ir_type *tp);
1242 /** Constructor for a Const node.
1244 * Constructor for a Const node. The constant represents a target
1245 * value. Sets the type information to type_unknown. (No more
1246 * supported: If tv is entity derives a somehow useful type.)
1248 * @param *db A pointer for debug information.
1249 * @param *irg The ir graph the node belongs to.
1250 * @param *block The ir block the node belongs to.
1251 * @param *mode The mode of the operands and results.
1252 * @param *con Points to an entry in the constant table.
1254 ir_node *new_rd_Const (dbg_info *db, ir_graph *irg, ir_node *block,
1255 ir_mode *mode, tarval *con);
1257 /** Constructor for a SymConst_type node.
1259 * This is the constructor for a symbolic constant.
1260 * There are four kinds of symbolic constants:
1261 * - type_tag The symbolic constant represents a type tag. The type the
1262 * tag stands for is given explicitly.
1263 * - type_size The symbolic constant represents the size of a type. The
1264 * type of which the constant represents the size is given
1266 * - type_align The symbolic constant represents the alignment of a type. The
1267 * type of which the constant represents the size is given
1269 * - addr_name The symbolic constant represents the address of an entity
1270 * (variable or method). The variable is indicated by a name
1271 * that is valid for linking.
1272 * - addr_ent The symbolic constant represents the address of an entity
1273 * (variable or method). The variable is given explicitly by
1276 * Inputs to the node:
1277 * No inputs except the block it belongs to.
1278 * Outputs of the node.
1279 * An unsigned integer (I_u) or a pointer (P).
1281 * Mention union in declaration so that the firmjni generator recognizes that
1282 * it can not cast the argument to an int.
1284 * @param *db A pointer for debug information.
1285 * @param *irg The ir graph the node belongs to.
1286 * @param *block The ir block the node belongs to.
1287 * @param symkind The kind of the symbolic constant: type_tag, size, addr_name or addr_ent.
1288 * @param value A type, entity or a ident depending on the SymConst kind.
1289 * @param tp The source type of the constant.
1291 ir_node *new_rd_SymConst_type (dbg_info *db, ir_graph *irg, ir_node *block, union symconst_symbol value,
1292 symconst_kind symkind, ir_type *tp);
1294 /** Constructor for a SymConst node.
1296 * Same as new_rd_SymConst_type, except that it sets the type to type_unknown. */
1297 ir_node *new_rd_SymConst (dbg_info *db, ir_graph *irg, ir_node *block,
1298 union symconst_symbol value, symconst_kind symkind);
1300 /** Constructor for a SymConst addr_ent node.
1302 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1303 * symconst_addr_ent.
1304 * Adds the SymConst to the start block of irg. */
1305 ir_node *new_rd_SymConst_addr_ent (dbg_info *db, ir_graph *irg, ir_entity *symbol, ir_type *tp);
1307 /** Constructor for a SymConst ofs_ent node.
1309 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1311 * Adds the SymConst to the start block of irg. */
1312 ir_node *new_rd_SymConst_ofs_ent (dbg_info *db, ir_graph *irg, ir_entity *symbol, ir_type *tp);
1314 /** Constructor for a SymConst addr_name node.
1316 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1317 * symconst_addr_ent.
1318 * Adds the SymConst to the start block of irg. */
1319 ir_node *new_rd_SymConst_addr_name (dbg_info *db, ir_graph *irg, ident *symbol, ir_type *tp);
1321 /** Constructor for a SymConst type_tag node.
1323 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1324 * symconst_addr_ent.
1325 * Adds the SymConst to the start block of irg. */
1326 ir_node *new_rd_SymConst_type_tag (dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp);
1328 /** Constructor for a SymConst size node.
1330 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1331 * symconst_type_size.
1332 * Adds the SymConst to the start block of irg. */
1333 ir_node *new_rd_SymConst_size (dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp);
1335 /** Constructor for a SymConst size node.
1337 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1338 * symconst_type_align.
1339 * Adds the SymConst to the start block of irg. */
1340 ir_node *new_rd_SymConst_align (dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp);
1342 /** Constructor for a simpleSel node.
1344 * This is a shortcut for the new_rd_Sel() constructor. To be used for
1345 * Sel nodes that do not select from an array, i.e., have no index
1346 * inputs. It adds the two parameters 0, NULL.
1348 * @param *db A pointer for debug information.
1349 * @param *irg The ir graph the node belongs to.
1350 * @param *block The ir block the node belongs to.
1351 * @param *store The memory in which the object the entity should be
1352 * selected from is allocated.
1353 * @param *objptr The object from that the Sel operation selects a
1354 * single attribute out.
1355 * @param *ent The entity to select.
1357 ir_node *new_rd_simpleSel (dbg_info *db, ir_graph *irg, ir_node *block,
1358 ir_node *store, ir_node *objptr, ir_entity *ent);
1360 /** Constructor for a Sel node.
1362 * The select node selects an entity (field or method) from an entity
1363 * with a compound type. It explicitly specifies the entity selected.
1364 * Dynamically the node may select entities that overwrite the given
1365 * entity. If the selected entity is an array element entity the Sel
1366 * node takes the required array indices as inputs.
1368 * @param *db A pointer for debug information.
1369 * @param *irg The ir graph the node belongs to.
1370 * @param *block The ir block the node belongs to.
1371 * @param *store The memory in which the object the entity should be selected
1372 * from is allocated.
1373 * @param *objptr A pointer to a compound entity the Sel operation selects a
1374 * single attribute from.
1375 * @param *n_index The number of array indices needed to select an array element entity.
1376 * @param *index[] If the compound entity is an array the indices of the selected
1377 * element entity. The constructor copies this array.
1378 * @param *ent The entity to select.
1380 ir_node *new_rd_Sel (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1381 ir_node *objptr, int n_index, ir_node *index[], ir_entity *ent);
1383 /** Constructor for a Call node.
1385 * Represents all kinds of method and function calls.
1387 * @param *db A pointer for debug information.
1388 * @param *irg The ir graph the node belongs to.
1389 * @param *block The ir block the node belongs to.
1390 * @param *store The current memory state.
1391 * @param *callee A pointer to the called procedure.
1392 * @param arity The number of procedure parameters.
1393 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1394 * @param *tp Type information of the procedure called.
1396 ir_node *new_rd_Call (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1397 ir_node *callee, int arity, ir_node *in[], ir_type *tp);
1399 /** Constructor for a Add node.
1401 * @param *db A pointer for debug information.
1402 * @param *irg The ir graph the node belongs to.
1403 * @param *block The ir block the node belongs to.
1404 * @param *op1 The first operand.
1405 * @param *op2 The second operand.
1406 * @param *mode The mode of the operands and the result.
1408 ir_node *new_rd_Add (dbg_info *db, ir_graph *irg, ir_node *block,
1409 ir_node *op1, ir_node *op2, ir_mode *mode);
1411 /** Constructor for a Sub node.
1413 * @param *db A pointer for debug information.
1414 * @param *irg The ir graph the node belongs to.
1415 * @param *block The ir block the node belongs to.
1416 * @param *op1 The first operand.
1417 * @param *op2 The second operand.
1418 * @param *mode The mode of the operands and the result.
1420 ir_node *new_rd_Sub (dbg_info *db, ir_graph *irg, ir_node *block,
1421 ir_node *op1, ir_node *op2, ir_mode *mode);
1423 /** Constructor for a Minus node.
1425 * @param *db A pointer for debug information.
1426 * @param *irg The ir graph the node belongs to.
1427 * @param *block The ir block the node belongs to.
1428 * @param *op The operand .
1429 * @param *mode The mode of the operand and the result.
1431 ir_node *new_rd_Minus (dbg_info *db, ir_graph *irg, ir_node *block,
1432 ir_node *op, ir_mode *mode);
1434 /** Constructor for a Mul node.
1436 * @param *db A pointer for debug information.
1437 * @param *irg The ir graph the node belongs to.
1438 * @param *block The ir block the node belongs to.
1439 * @param *op1 The first operand.
1440 * @param *op2 The second operand.
1441 * @param *mode The mode of the operands and the result.
1443 ir_node *new_rd_Mul (dbg_info *db, ir_graph *irg, ir_node *block,
1444 ir_node *op1, ir_node *op2, ir_mode *mode);
1446 /** Constructor for a Quot node.
1448 * @param *db A pointer for debug information.
1449 * @param *irg The ir graph the node belongs to.
1450 * @param *block The ir block the node belongs to.
1451 * @param *memop The store needed to model exceptions
1452 * @param *op1 The first operand.
1453 * @param *op2 The second operand.
1455 ir_node *new_rd_Quot (dbg_info *db, ir_graph *irg, ir_node *block,
1456 ir_node *memop, ir_node *op1, ir_node *op2);
1458 /** Constructor for a DivMod node.
1460 * @param *db A pointer for debug information.
1461 * @param *irg The ir graph the node belongs to.
1462 * @param *block The ir block the node belongs to.
1463 * @param *memop The store needed to model exceptions
1464 * @param *op1 The first operand.
1465 * @param *op2 The second operand.
1467 ir_node *new_rd_DivMod (dbg_info *db, ir_graph *irg, ir_node *block,
1468 ir_node *memop, ir_node *op1, ir_node *op2);
1470 /** Constructor for a Div node.
1472 * @param *db A pointer for debug information.
1473 * @param *irg The ir graph the node belongs to.
1474 * @param *block The ir block the node belongs to.
1475 * @param *memop The store needed to model exceptions
1476 * @param *op1 The first operand.
1477 * @param *op2 The second operand.
1479 ir_node *new_rd_Div (dbg_info *db, ir_graph *irg, ir_node *block,
1480 ir_node *memop, ir_node *op1, ir_node *op2);
1482 /** Constructor for a Mod node.
1484 * @param *db A pointer for debug information.
1485 * @param *irg The ir graph the node belongs to.
1486 * @param *block The ir block the node belongs to.
1487 * @param *memop The store needed to model exceptions
1488 * @param *op1 The first operand.
1489 * @param *op2 The second operand.
1491 ir_node *new_rd_Mod (dbg_info *db, ir_graph *irg, ir_node *block,
1492 ir_node *memop, ir_node *op1, ir_node *op2);
1494 /** Constructor for a Abs node.
1496 * @param *db A pointer for debug information.
1497 * @param *irg The ir graph the node belongs to.
1498 * @param *block The ir block the node belongs to.
1499 * @param *op The operand
1500 * @param *mode The mode of the operands and the result.
1502 ir_node *new_rd_Abs (dbg_info *db, ir_graph *irg, ir_node *block,
1503 ir_node *op, ir_mode *mode);
1505 /** Constructor for a And node.
1507 * @param *db A pointer for debug information.
1508 * @param *irg The ir graph the node belongs to.
1509 * @param *block The ir block the node belongs to.
1510 * @param *op1 The first operand.
1511 * @param *op2 The second operand.
1512 * @param *mode The mode of the operands and the result.
1514 ir_node *new_rd_And (dbg_info *db, ir_graph *irg, ir_node *block,
1515 ir_node *op1, ir_node *op2, ir_mode *mode);
1517 /** Constructor for a Or node.
1519 * @param *db A pointer for debug information.
1520 * @param *irg The ir graph the node belongs to.
1521 * @param *block The ir block the node belongs to.
1522 * @param *op1 The first operand.
1523 * @param *op2 The second operand.
1524 * @param *mode The mode of the operands and the result.
1526 ir_node *new_rd_Or (dbg_info *db, ir_graph *irg, ir_node *block,
1527 ir_node *op1, ir_node *op2, ir_mode *mode);
1529 /** Constructor for a Eor node.
1531 * @param *db A pointer for debug information.
1532 * @param *irg The ir graph the node belongs to.
1533 * @param *block The ir block the node belongs to.
1534 * @param *op1 The first operand.
1535 * @param *op2 The second operand.
1536 * @param *mode The mode of the operands and the results.
1538 ir_node *new_rd_Eor (dbg_info *db, ir_graph *irg, ir_node *block,
1539 ir_node *op1, ir_node *op2, ir_mode *mode);
1541 /** Constructor for a Not node.
1543 * @param *db A pointer for debug information.
1544 * @param *irg The ir graph the node belongs to.
1545 * @param *block The ir block the node belongs to.
1546 * @param *op The operand.
1547 * @param *mode The mode of the operand and the result.
1549 ir_node *new_rd_Not (dbg_info *db, ir_graph *irg, ir_node *block,
1550 ir_node *op, ir_mode *mode);
1552 /** Constructor for a Cmp node.
1554 * @param *db A pointer for debug information.
1555 * @param *irg The ir graph the node belongs to.
1556 * @param *block The ir block the node belongs to.
1557 * @param *op1 The first operand.
1558 * @param *op2 The second operand.
1560 ir_node *new_rd_Cmp (dbg_info *db, ir_graph *irg, ir_node *block,
1561 ir_node *op1, ir_node *op2);
1563 /** Constructor for a Shl node.
1565 * @param *db A pointer for debug information.
1566 * @param *irg The ir graph the node belongs to.
1567 * @param *block The ir block the node belongs to.
1568 * @param *op The operand.
1569 * @param *k The number of bits to shift the operand .
1570 * @param *mode The mode of the operand and the result.
1572 ir_node *new_rd_Shl (dbg_info *db, ir_graph *irg, ir_node *block,
1573 ir_node *op, ir_node *k, ir_mode *mode);
1575 /** Constructor for a Shr node.
1577 * @param *db A pointer for debug information.
1578 * @param *irg The ir graph the node belongs to.
1579 * @param *block The ir block the node belongs to.
1580 * @param *op The operand.
1581 * @param *k The number of bits to shift the operand .
1582 * @param *mode The mode of the operand and the result.
1584 ir_node *new_rd_Shr (dbg_info *db, ir_graph *irg, ir_node *block,
1585 ir_node *op, ir_node *k, ir_mode *mode);
1587 /** Constructor for a Shrs node.
1589 * @param *db A pointer for debug information.
1590 * @param *irg The ir graph the node belongs to.
1591 * @param *block The ir block the node belongs to.
1592 * @param *op The operand.
1593 * @param *k The number of bits to shift the operand.
1594 * @param *mode The mode of the operand and the result.
1596 ir_node *new_rd_Shrs (dbg_info *db, ir_graph *irg, ir_node *block,
1597 ir_node *op, ir_node *k, ir_mode *mode);
1599 /** Constructor for a Rot node.
1601 * @param *db A pointer for debug information.
1602 * @param *irg The ir graph the node belongs to.
1603 * @param *block The ir block the node belongs to.
1604 * @param *op The operand.
1605 * @param *k The number of bits to rotate the operand.
1606 * @param *mode The mode of the operand.
1608 ir_node *new_rd_Rot (dbg_info *db, ir_graph *irg, ir_node *block,
1609 ir_node *op, ir_node *k, ir_mode *mode);
1612 /** Constructor for a Conv node.
1614 * @param *db A pointer for debug information.
1615 * @param *irg The ir graph the node belongs to.
1616 * @param *block The ir block the node belongs to.
1617 * @param *op The operand.
1618 * @param *mode The mode of this the operand muss be converted .
1620 ir_node *new_rd_Conv (dbg_info *db, ir_graph *irg, ir_node *block,
1621 ir_node *op, ir_mode *mode);
1623 /** Constructor for a Cast node.
1625 * High level type cast.
1627 * @param *db A pointer for debug information.
1628 * @param *irg The ir graph the node belongs to.
1629 * @param *block The ir block the node belongs to.
1630 * @param *op The operand.
1631 * @param *to_tp The type of this the operand muss be casted .
1633 ir_node *new_rd_Cast (dbg_info *db, ir_graph *irg, ir_node *block,
1634 ir_node *op, ir_type *to_tp);
1636 /** Constructor for a Carry node.
1638 * @param *db A pointer for debug information.
1639 * @param *irg The ir graph the node belongs to.
1640 * @param *block The ir block the node belongs to.
1641 * @param *op1 The first operand.
1642 * @param *op2 The second operand.
1643 * @param *mode The mode of the operands and the result.
1645 ir_node *new_rd_Carry (dbg_info *db, ir_graph *irg, ir_node *block,
1646 ir_node *op1, ir_node *op2, ir_mode *mode);
1648 /** Constructor for a Borrow node.
1650 * @param *db A pointer for debug information.
1651 * @param *irg The ir graph the node belongs to.
1652 * @param *block The ir block the node belongs to.
1653 * @param *op1 The first operand.
1654 * @param *op2 The second operand.
1655 * @param *mode The mode of the operands and the result.
1657 ir_node *new_rd_Borrow (dbg_info *db, ir_graph *irg, ir_node *block,
1658 ir_node *op1, ir_node *op2, ir_mode *mode);
1660 /** Constructor for a Phi node.
1662 * @param *db A pointer for debug information.
1663 * @param *irg The ir graph the node belongs to.
1664 * @param *block The ir block the node belongs to.
1665 * @param arity The number of predecessors
1666 * @param *in[] Array with predecessors. The constructor copies this array.
1667 * @param *mode The mode of it's inputs and output.
1669 ir_node *new_rd_Phi (dbg_info *db, ir_graph *irg, ir_node *block, int arity,
1670 ir_node *in[], ir_mode *mode);
1672 /** Constructor for a Load node.
1674 * @param *db A pointer for debug information.
1675 * @param *irg The ir graph the node belongs to.
1676 * @param *block The ir block the node belongs to.
1677 * @param *store The current memory
1678 * @param *adr A pointer to the variable to be read in this memory.
1679 * @param *mode The mode of the value to be loaded.
1681 ir_node *new_rd_Load (dbg_info *db, ir_graph *irg, ir_node *block,
1682 ir_node *store, ir_node *adr, ir_mode *mode);
1684 /** Constructor for a Store node.
1686 * @param *db A pointer for debug information.
1687 * @param *irg The ir graph the node belongs to.
1688 * @param *block The ir block the node belongs to.
1689 * @param *store The current memory
1690 * @param *adr A pointer to the variable to be read in this memory.
1691 * @param *val The value to write to this variable.
1693 ir_node *new_rd_Store (dbg_info *db, ir_graph *irg, ir_node *block,
1694 ir_node *store, ir_node *adr, ir_node *val);
1696 /** Constructor for a Alloc node.
1698 * The Alloc node extends the memory by space for an entity of type alloc_type.
1700 * @param *db A pointer for debug information.
1701 * @param *irg The ir graph the node belongs to.
1702 * @param *block The ir block the node belongs to.
1703 * @param *store The memory which shall contain the new variable.
1704 * @param *size The number of bytes to allocate.
1705 * @param *alloc_type The type of the allocated variable.
1706 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
1708 ir_node *new_rd_Alloc (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1709 ir_node *size, ir_type *alloc_type, where_alloc where);
1711 /** Constructor for a Free node.
1713 * Frees the memory occupied by the entity pointed to by the pointer
1714 * arg. Type indicates the type of the entity the argument points to.
1716 * @param *db A pointer for debug information.
1717 * @param *irg The ir graph the node belongs to.
1718 * @param *block The ir block the node belongs to.
1719 * @param *store The memory which shall contain the new variable.
1720 * @param *ptr The pointer to the object to free.
1721 * @param *size The number of objects of type free_type to free in a sequence.
1722 * @param *free_type The type of the freed variable.
1723 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
1725 ir_node *new_rd_Free (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1726 ir_node *ptr, ir_node *size, ir_type *free_type, where_alloc where);
1728 /** Constructor for a Sync node.
1730 * Merges several memory values. The node assumes that a variable
1731 * either occurs only in one of the memories, or it contains the same
1732 * value in all memories where it occurs.
1734 * @param *db A pointer for debug information.
1735 * @param *irg The ir graph the node belongs to.
1736 * @param *block The ir block the node belongs to.
1737 * @param arity The number of memories to synchronize.
1738 * @param *in[] An array of pointers to nodes that produce an output of type
1739 * memory. The constructor copies this array.
1741 ir_node *new_rd_Sync (dbg_info *db, ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
1743 /** Constructor for a Proj node.
1745 * Projects a single value out of a tuple. The parameter proj gives the
1746 * position of the value within the tuple.
1748 * @param *db A pointer for debug information.
1749 * @param *irg The ir graph the node belongs to.
1750 * @param *block The ir block the node belongs to.
1751 * @param arg A node producing a tuple. The node must have mode_T.
1752 * @param *mode The mode of the value to project.
1753 * @param proj The position of the value in the tuple.
1755 ir_node *new_rd_Proj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1756 ir_mode *mode, long proj);
1758 /** Constructor for a defaultProj node.
1760 * Represents the default control flow of a Switch-Cond node.
1762 * @param *db A pointer for debug information.
1763 * @param *irg The ir graph the node belongs to.
1764 * @param *block The ir block the node belongs to.
1765 * @param arg A node producing a tuple.
1766 * @param max_proj The end position of the value in the tuple.
1768 ir_node *new_rd_defaultProj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1771 /** Constructor for a Tuple node.
1773 * This is an auxiliary node to replace a node that returns a tuple
1774 * without changing the corresponding Proj nodes.
1776 * @param *db A pointer for debug information.
1777 * @param *irg The ir graph the node belongs to.
1778 * @param *block The ir block the node belongs to.
1779 * @param arity The number of tuple elements.
1780 * @param *in[] An array containing pointers to the nodes producing the tuple
1781 * elements. The constructor copies this array.
1783 ir_node *new_rd_Tuple (dbg_info *db, ir_graph *irg, ir_node *block,
1784 int arity, ir_node *in[]);
1786 /** Constructor for a Id node.
1788 * This is an auxiliary node to replace a node that returns a single
1791 * @param *db A pointer for debug information.
1792 * @param *irg The ir graph the node belongs to.
1793 * @param *block The ir block the node belongs to.
1794 * @param *val The value
1795 * @param *mode The mode of *val.
1797 ir_node *new_rd_Id (dbg_info *db, ir_graph *irg, ir_node *block,
1798 ir_node *val, ir_mode *mode);
1800 /** Constructor for a Bad node.
1802 * Returns the unique Bad node of the graph. The same as
1805 * @param *irg The ir graph the node belongs to.
1807 ir_node *new_rd_Bad (ir_graph *irg);
1809 /** Constructor for a Confirm node.
1811 * Specifies constraints for a value. To support dataflow analyses.
1813 * Example: If the value never exceeds '100' this is expressed by placing a
1814 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
1816 * @param *irg The ir graph the node belong to.
1817 * @param *block The ir block the node belong to.
1818 * @param *db A pointer for debug information.
1819 * @param *val The value we express a constraint for
1820 * @param *bound The value to compare against. Must be a firm node, typically a constant.
1821 * @param cmp The compare operation.
1823 ir_node *new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block,
1824 ir_node *val, ir_node *bound, pn_Cmp cmp);
1826 /** Constructor for an Unknown node.
1828 * Represents an arbitrary value. Places the node in the start block.
1830 * @param *irg The ir graph the node belongs to.
1831 * @param *m The mode of the unknown value.
1833 ir_node *new_rd_Unknown(ir_graph *irg, ir_mode *m);
1835 /** Constructor for a CallBegin node.
1837 * CallBegin represents control flow depending of the pointer value
1838 * representing the called method to the called methods. The
1839 * constructor copies the method pointer input from the passed Call
1842 * @param *db A pointer for debug information.
1843 * @param *irg The ir graph the node belong to.
1844 * @param *block The block the node belong to.
1845 * @param *callee The call node visible in the intra procedural view.
1847 ir_node *new_rd_CallBegin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *callee);
1849 /** Constructor for a EndReg node.
1851 * Used to represent regular procedure end in interprocedual view.
1853 * @param *db A pointer for debug information.
1854 * @param *irg The ir graph the node belong to.
1855 * @param *block The block the node belong to.
1857 ir_node *new_rd_EndReg (dbg_info *db, ir_graph *irg, ir_node *block);
1859 /** Constructor for a EndExcept node.
1861 * Used to represent exceptional procedure end in interprocedural view.
1863 * @param *db A pointer for debug information.
1864 * @param *irg The ir graph the node belong to.
1865 * @param *block The block the node belong to.
1867 ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
1869 /** Constructor for a Filter node.
1871 * Adds the node to the block in current_ir_block. Filter is a node
1872 * with two views used to construct the interprocedural view. In
1873 * intraprocedural view its semantics are identical to the Proj node.
1874 * In interprocedural view the Filter performs the Phi operation on
1875 * method parameters or results. Other than a Phi a Filter node may
1876 * not be removed if it has only a single input.
1878 * The constructor builds the Filter in intraprocedural view.
1880 * @param *db A pointer for debug information.
1881 * @param *irg The ir graph the node belong to.
1882 * @param *block The block the node belong to.
1883 * @param *arg The tuple value to project from.
1884 * @param *mode The mode of the projected value.
1885 * @param proj The position in the tuple to project from.
1887 ir_node *new_rd_Filter (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1888 ir_mode *mode, long proj);
1890 /** Constructor for a NoMem node.
1892 * Returns the unique NoMem node of the graph. The same as
1895 * @param *irg The ir graph the node belongs to.
1897 ir_node *new_rd_NoMem (ir_graph *irg);
1899 /** Constructor for a Mux node.
1901 * @param *db A pointer for debug information.
1902 * @param *irg The ir graph the node belong to.
1903 * @param *block The block the node belong to.
1904 * @param *sel The ir_node that calculates the boolean select.
1905 * @param *ir_true The ir_node that calculates the true result.
1906 * @param *ir_false The ir_node that calculates the false result.
1907 * @param *mode The mode of the node (and it_true and ir_false).
1909 ir_node *new_rd_Mux (dbg_info *db, ir_graph *irg, ir_node *block,
1910 ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
1912 /** Constructor for a Psi node.
1914 * @param *db A pointer for debug information.
1915 * @param *irg The ir graph the node belong to.
1916 * @param *block The block the node belong to.
1917 * @param *arity The arity of the conditions
1918 * @param *conds The array of mode_b conditions, length must be equal arity
1919 * @param *vals The array of mode values, length must be equal arity + 1
1920 * @param *mode The mode of the node (must be the mode of all vals).
1922 ir_node *new_rd_Psi (dbg_info *db, ir_graph *irg, ir_node *block,
1923 int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
1925 /** Constructor for a CopyB node.
1927 * @param *db A pointer for debug information.
1928 * @param *irg The ir graph the node belong to.
1929 * @param *block The block the node belong to.
1930 * @param *store The current memory
1931 * @param *dst The ir_node that represents the destination address.
1932 * @param *src The ir_node that represents the source address.
1933 * @param *data_type The type of the copied data
1935 ir_node *new_rd_CopyB(dbg_info *db, ir_graph *irg, ir_node *block,
1936 ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
1938 /** Constructor for a InstOf node.
1940 * A High-Level Type check.
1942 * @param *db A pointer for debug information.
1943 * @param *irg The ir graph the node belongs to.
1944 * @param *block The ir block the node belongs to.
1945 * @param *store The memory in which the object the entity should be selected
1946 * from is allocated.
1947 * @param *objptr A pointer to a object of a class type.
1948 * @param *type The type of which objptr must be.
1950 ir_node *new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1951 ir_node *objptr, ir_type *type);
1953 /** Constructor for a Raise node.
1955 * A High-Level Exception throw.
1957 * @param *db A pointer for debug information.
1958 * @param *irg The ir graph the node belongs to.
1959 * @param *block The ir block the node belongs to.
1960 * @param *store The current memory.
1961 * @param *obj A pointer to the Except variable.
1963 ir_node *new_rd_Raise (dbg_info *db, ir_graph *irg, ir_node *block,
1964 ir_node *store, ir_node *obj);
1966 /** Constructor for a Bound node.
1968 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
1970 * @param *db A pointer for debug information.
1971 * @param *irg The ir graph the node belong to.
1972 * @param *block The block the node belong to.
1973 * @param *store The current memory.
1974 * @param *idx The ir_node that represents an index.
1975 * @param *lower The ir_node that represents the lower bound for the index.
1976 * @param *upper The ir_node that represents the upper bound for the index.
1978 ir_node *new_rd_Bound(dbg_info *db, ir_graph *irg, ir_node *block,
1979 ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
1981 /** Constructor for a Pin node.
1983 * @param *db A pointer for debug information.
1984 * @param *irg The ir graph the node belong to.
1985 * @param *block The block the node belong to.
1986 * @param *node The node which value should be pinned.
1988 ir_node *new_rd_Pin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *node);
1990 /*-------------------------------------------------------------------------*/
1991 /* The raw interface without debug support */
1992 /*-------------------------------------------------------------------------*/
1994 /** Constructor for a Block node.
1996 * Constructs a mature block with the given predecessors. Use Unknown
1997 * nodes as predecessors to construct a block if the number of
1998 * predecessors is known, but not the predecessors themselves. This
1999 * constructor does not set current_block. It not be used with
2000 * automatic Phi node construction.
2003 * @param irg The ir graph the block belongs to.
2004 * @param arity The number of control predecessors.
2005 * @param in[] An array of control predecessors. The length of
2006 * the array must be 'arity'. The constructor copies this array.
2008 ir_node *new_r_Block (ir_graph *irg, int arity, ir_node *in[]);
2010 /** Constructor for a Start node.
2012 * @param *irg The ir graph the node belongs to.
2013 * @param *block The ir block the node belongs to.
2015 ir_node *new_r_Start (ir_graph *irg, ir_node *block);
2017 /** Constructor for a End node.
2019 * @param *irg The ir graph the node belongs to.
2020 * @param *block The ir block the node belongs to.
2022 ir_node *new_r_End (ir_graph *irg, ir_node *block);
2024 /** Constructor for a Jmp node.
2026 * Jmp represents control flow to a single control successor.
2028 * @param *irg The ir graph the node belongs to.
2029 * @param *block The ir block the node belongs to.
2031 ir_node *new_r_Jmp (ir_graph *irg, ir_node *block);
2033 /** Constructor for an IJmp node.
2035 * IJmp represents control flow to a single control successor not
2036 * statically known i.e. an indirect Jmp.
2038 * @param *irg The ir graph the node belongs to.
2039 * @param *block The ir block the node belongs to.
2040 * @param *tgt The ir node representing the target address.
2042 ir_node *new_r_IJmp (ir_graph *irg, ir_node *block, ir_node *tgt);
2044 /** Constructor for a Cond node.
2046 * If c is mode_b represents a conditional branch (if/else). If c is
2047 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2048 * node, default Proj is 0.)
2050 * This is not consistent: Input to Cond is Is, Proj has as proj number
2053 * @param *irg The ir graph the node belongs to.
2054 * @param *block The ir block the node belongs to.
2055 * @param *c The conditions parameter.Can be of mode b or I_u.
2057 ir_node *new_r_Cond (ir_graph *irg, ir_node *block, ir_node *c);
2059 /** Constructor for a Return node.
2061 * Returns the memory an zero or more return values. Only node that
2062 * can end regular control flow.
2064 * @param *irg The ir graph the node belongs to.
2065 * @param *block The ir block the node belongs to.
2066 * @param *store The state of memory.
2067 * @param arity Number of array indices.
2068 * @param *in[] Array with index inputs to the node. The constructor copies this array.
2070 ir_node *new_r_Return (ir_graph *irg, ir_node *block,
2071 ir_node *store, int arity, ir_node *in[]);
2073 /** Constructor for a Const node.
2075 * Constructor for a Const node. The constant represents a target
2076 * value. Sets the type information to type_unknown. (No more
2077 * supported: If tv is entity derives a somehow useful type.)
2079 * @param *irg The ir graph the node belongs to.
2080 * @param *block The ir block the node belongs to.
2081 * @param *mode The mode of the operands and the results.
2082 * @param *con Points to an entry in the constant table.
2084 ir_node *new_r_Const (ir_graph *irg, ir_node *block,
2085 ir_mode *mode, tarval *con);
2087 /** Constructor for a Const node.
2089 * Constructor for a Const node. The constant represents a target
2090 * value. Sets the type information to type_unknown. (No more
2091 * supported: If tv is entity derives a somehow useful type.)
2093 * @param *irg The ir graph the node belongs to.
2094 * @param *block The ir block the node belongs to.
2095 * @param *mode The mode of the operands and the results.
2096 * @param value A value from which the tarval is made.
2098 ir_node *new_r_Const_long(ir_graph *irg, ir_node *block,
2099 ir_mode *mode, long value);
2101 /** Constructor for a Const_type node.
2103 * The constant represents a target value. This constructor sets high
2104 * level type information for the constant value.
2106 * @param *irg The ir graph the node belongs to.
2107 * @param *block The ir block the node belongs to.
2108 * @param *mode The mode of the operands and results.
2109 * @param *con Points to an entry in the constant table.
2110 * @param *tp The type of the constant.
2112 ir_node *new_r_Const_type(ir_graph *irg, ir_node *block,
2113 ir_mode *mode, tarval *con, ir_type *tp);
2115 /** Constructor for a SymConst node.
2117 * This is the constructor for a symbolic constant.
2118 * There are four kinds of symbolic constants:
2119 * - type_tag The symbolic constant represents a type tag. The type the
2120 * tag stands for is given explicitly.
2121 * - size The symbolic constant represents the size of a type. The
2122 * type of which the constant represents the size is given
2124 * - addr_name The symbolic constant represents the address of an entity
2125 * (variable or method). The variable is indicated by a name
2126 * that is valid for linking.
2127 * - addr_ent The symbolic constant represents the address of an entity
2128 * (variable or method). The variable is given explicitly by
2131 * Inputs to the node:
2132 * No inputs except the block it belongs to.
2133 * Outputs of the node.
2134 * An unsigned integer (I_u) or a pointer (P).
2136 * @param *irg The ir graph the node belongs to.
2137 * @param *block The ir block the node belongs to.
2138 * @param value A type, entity or a ident depending on the SymConst kind.
2139 * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
2141 ir_node *new_r_SymConst (ir_graph *irg, ir_node *block,
2142 union symconst_symbol value, symconst_kind symkind);
2144 /** Constructor for a simpleSel node.
2146 * This is a shortcut for the new_d_Sel() constructor. To be used for
2147 * Sel nodes that do not select from an array, i.e., have no index
2148 * inputs. It adds the two parameters 0, NULL.
2150 * @param *irg The ir graph the node belongs to.
2151 * @param *block The ir block the node belongs to.
2152 * @param *store The memory in which the object the entity should be selected
2153 * from is allocated.
2154 * @param *objptr The object from that the Sel operation selects a
2155 * single attribute out.
2156 * @param *ent The entity to select.
2158 ir_node *new_r_simpleSel(ir_graph *irg, ir_node *block, ir_node *store,
2159 ir_node *objptr, ir_entity *ent);
2161 /** Constructor for a Sel node.
2163 * The select node selects an entity (field or method) from an entity
2164 * with a compound type. It explicitly specifies the entity selected.
2165 * Dynamically the node may select entities that overwrite the given
2166 * entity. If the selected entity is an array element entity the Sel
2167 * node takes the required array indices as inputs.
2169 * @param *irg The ir graph the node belongs to.
2170 * @param *block The ir block the node belongs to.
2171 * @param *store The memory in which the object the entity should be selected
2172 * from is allocated.
2173 * @param *objptr A pointer to a compound entity the Sel operation selects a
2174 * single attribute from.
2175 * @param *n_index The number of array indices needed to select an array element entity.
2176 * @param *index[] If the compound entity is an array the indices of the selected
2177 * element entity. The constructor copies this array.
2178 * @param *ent The entity to select.
2180 ir_node *new_r_Sel (ir_graph *irg, ir_node *block, ir_node *store,
2181 ir_node *objptr, int n_index, ir_node *index[],
2184 /** Constructor for a Call node.
2186 * Represents all kinds of method and function calls.
2188 * @param *irg The ir graph the node belongs to.
2189 * @param *block The ir block the node belongs to.
2190 * @param *store The actual store.
2191 * @param *callee A pointer to the called procedure.
2192 * @param arity The number of procedure parameters.
2193 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2194 * @param *tp Type information of the procedure called.
2196 ir_node *new_r_Call (ir_graph *irg, ir_node *block, ir_node *store,
2197 ir_node *callee, int arity, ir_node *in[],
2200 /** Constructor for a Add node.
2202 * @param *irg The ir graph the node belongs to.
2203 * @param *block The ir block the node belongs to.
2204 * @param *op1 The first operand.
2205 * @param *op2 The second operand.
2206 * @param *mode The mode of the operands and the result.
2208 ir_node *new_r_Add (ir_graph *irg, ir_node *block,
2209 ir_node *op1, ir_node *op2, ir_mode *mode);
2212 * Constructor for a Sub node.
2214 * @param *irg The ir graph the node belongs to.
2215 * @param *block The ir block the node belongs to.
2216 * @param *op1 The first operand.
2217 * @param *op2 The second operand.
2218 * @param *mode The mode of the operands and the results.
2220 ir_node *new_r_Sub (ir_graph *irg, ir_node *block,
2221 ir_node *op1, ir_node *op2, ir_mode *mode);
2223 /** Constructor for a Minus node.
2225 * @param *irg The ir graph the node belongs to.
2226 * @param *block The ir block the node belongs to.
2227 * @param *op The operand.
2228 * @param *mode The mode of the operand and the result.
2230 ir_node *new_r_Minus (ir_graph *irg, ir_node *block,
2231 ir_node *op, ir_mode *mode);
2232 /** Constructor for a Mul node.
2234 * @param *irg The ir graph the node belongs to.
2235 * @param *block The ir block the node belongs to.
2236 * @param *op1 The first operand.
2237 * @param *op2 The second operand.
2238 * @param *mode The mode of the operands and the result.
2240 ir_node *new_r_Mul (ir_graph *irg, ir_node *block,
2241 ir_node *op1, ir_node *op2, ir_mode *mode);
2243 /** Constructor for a Quot node.
2245 * @param *irg The ir graph the node belongs to.
2246 * @param *block The ir block the node belongs to.
2247 * @param *memop The store needed to model exceptions
2248 * @param *op1 The first operand.
2249 * @param *op2 The second operand.
2251 ir_node *new_r_Quot (ir_graph *irg, ir_node *block,
2252 ir_node *memop, ir_node *op1, ir_node *op2);
2254 /** Constructor for a DivMod node.
2256 * @param *irg The ir graph the node belongs to.
2257 * @param *block The ir block the node belongs to.
2258 * @param *memop The store needed to model exceptions
2259 * @param *op1 The first operand.
2260 * @param *op2 The second operand.
2262 ir_node *new_r_DivMod (ir_graph *irg, ir_node *block,
2263 ir_node *memop, ir_node *op1, ir_node *op2);
2265 /** Constructor for a Div node.
2267 * @param *irg The ir graph the node belongs to.
2268 * @param *block The ir block the node belongs to.
2269 * @param *memop The store needed to model exceptions
2270 * @param *op1 The first operand.
2271 * @param *op2 The second operand.
2273 ir_node *new_r_Div (ir_graph *irg, ir_node *block,
2274 ir_node *memop, ir_node *op1, ir_node *op2);
2276 /** Constructor for a Mod node.
2278 * @param *irg The ir graph the node belongs to.
2279 * @param *block The ir block the node belongs to.
2280 * @param *memop The store needed to model exceptions
2281 * @param *op1 The first operand.
2282 * @param *op2 The second operand.
2284 ir_node *new_r_Mod (ir_graph *irg, ir_node *block,
2285 ir_node *memop, ir_node *op1, ir_node *op2);
2287 /** Constructor for a Abs node.
2289 * @param *irg The ir graph the node belongs to.
2290 * @param *block The ir block the node belongs to.
2291 * @param *op The operand
2292 * @param *mode The mode of the operands and the result.
2294 ir_node *new_r_Abs (ir_graph *irg, ir_node *block,
2295 ir_node *op, ir_mode *mode);
2297 /** Constructor for a And node.
2299 * @param *irg The ir graph the node belongs to.
2300 * @param *block The ir block the node belongs to.
2301 * @param *op1 The first operand.
2302 * @param *op2 The second operand.
2303 * @param *mode The mode of the operands and the result.
2305 ir_node *new_r_And (ir_graph *irg, ir_node *block,
2306 ir_node *op1, ir_node *op2, ir_mode *mode);
2308 /** Constructor for a Or node.
2310 * @param *irg The ir graph the node belongs to.
2311 * @param *block The ir block the node belongs to.
2312 * @param *op1 The first operand.
2313 * @param *op2 The second operand.
2314 * @param *mode The mode of the operands and the result.
2316 ir_node *new_r_Or (ir_graph *irg, ir_node *block,
2317 ir_node *op1, ir_node *op2, ir_mode *mode);
2319 /** Constructor for a Eor node.
2321 * @param *irg The ir graph the node belongs to.
2322 * @param *block The ir block the node belongs to.
2323 * @param *op1 The first operand.
2324 * @param *op2 The second operand.
2325 * @param *mode The mode of the operands and the results.
2327 ir_node *new_r_Eor (ir_graph *irg, ir_node *block,
2328 ir_node *op1, ir_node *op2, ir_mode *mode);
2330 /** Constructor for a Not node.
2332 * @param *irg The ir graph the node belongs to.
2333 * @param *block The ir block the node belongs to.
2334 * @param *op The operand.
2335 * @param *mode The mode of the operand and the result.
2337 ir_node *new_r_Not (ir_graph *irg, ir_node *block,
2338 ir_node *op, ir_mode *mode);
2340 /** Constructor for a Cmp node.
2342 * @param *irg The ir graph the node belongs to.
2343 * @param *block The ir block the node belongs to.
2344 * @param *op1 The first operand.
2345 * @param *op2 The second operand.
2347 ir_node *new_r_Cmp (ir_graph *irg, ir_node *block,
2348 ir_node *op1, ir_node *op2);
2350 /** Constructor for a Shl node.
2352 * @param *irg The ir graph the node belongs to.
2353 * @param *block The ir block the node belongs to.
2354 * @param *op The operand.
2355 * @param *k The number of bits to shift the operand .
2356 * @param *mode The mode of the operand and the result.
2358 ir_node *new_r_Shl (ir_graph *irg, ir_node *block,
2359 ir_node *op, ir_node *k, ir_mode *mode);
2361 /** Constructor for a Shr node.
2363 * @param *irg The ir graph the node belongs to.
2364 * @param *block The ir block the node belongs to.
2365 * @param *op The operand.
2366 * @param *k The number of bits to shift the operand .
2367 * @param *mode The mode of the operand and the result.
2369 ir_node *new_r_Shr (ir_graph *irg, ir_node *block,
2370 ir_node *op, ir_node *k, ir_mode *mode);
2373 * Constructor for a Shrs node.
2375 * @param *irg The ir graph the node belongs to.
2376 * @param *block The ir block the node belongs to.
2377 * @param *op The operand.
2378 * @param *k The number of bits to shift the operand.
2379 * @param *mode The mode of the operand and the result.
2381 ir_node *new_r_Shrs (ir_graph *irg, ir_node *block,
2382 ir_node *op, ir_node *k, ir_mode *mode);
2384 /** Constructor for a Rot node.
2386 * @param *irg The ir graph the node belongs to.
2387 * @param *block The ir block the node belongs to.
2388 * @param *op The operand.
2389 * @param *k The number of bits to rotate the operand.
2390 * @param *mode The mode of the operand.
2392 ir_node *new_r_Rot (ir_graph *irg, ir_node *block,
2393 ir_node *op, ir_node *k, ir_mode *mode);
2395 /** Constructor for a Conv node.
2397 * @param *irg The ir graph the node belongs to.
2398 * @param *block The ir block the node belongs to.
2399 * @param *op The operand.
2400 * @param *mode The mode of this the operand muss be converted .
2402 ir_node *new_r_Conv (ir_graph *irg, ir_node *block,
2403 ir_node *op, ir_mode *mode);
2405 /** Constructor for a Cast node.
2407 * High level type cast
2409 * @param *irg The ir graph the node belongs to.
2410 * @param *block The ir block the node belongs to.
2411 * @param *op The operand.
2412 * @param *to_tp The type of this the operand muss be casted .
2414 ir_node *new_r_Cast (ir_graph *irg, ir_node *block,
2415 ir_node *op, ir_type *to_tp);
2417 /** Constructor for a Carry node.
2419 * @param *irg The ir graph the node belongs to.
2420 * @param *block The ir block the node belongs to.
2421 * @param *op1 The first operand.
2422 * @param *op2 The second operand.
2423 * @param *mode The mode of the operands and the result.
2425 ir_node *new_r_Carry (ir_graph *irg, ir_node *block,
2426 ir_node *op1, ir_node *op2, ir_mode *mode);
2429 * Constructor for a Borrow node.
2431 * @param *irg The ir graph the node belongs to.
2432 * @param *block The ir block the node belongs to.
2433 * @param *op1 The first operand.
2434 * @param *op2 The second operand.
2435 * @param *mode The mode of the operands and the results.
2437 ir_node *new_r_Borrow (ir_graph *irg, ir_node *block,
2438 ir_node *op1, ir_node *op2, ir_mode *mode);
2440 /** Constructor for a Phi node.
2442 * @param *irg The ir graph the node belongs to.
2443 * @param *block The ir block the node belongs to.
2444 * @param arity The number of predecessors
2445 * @param *in[] Array with predecessors. The constructor copies this array.
2446 * @param *mode The mode of it's inputs and output.
2448 ir_node *new_r_Phi (ir_graph *irg, ir_node *block, int arity,
2449 ir_node *in[], ir_mode *mode);
2451 /** Constructor for a Load node.
2453 * @param *irg The ir graph the node belongs to.
2454 * @param *block The ir block the node belongs to.
2455 * @param *store The current memory
2456 * @param *adr A pointer to the variable to be read in this memory.
2457 * @param *mode The mode of the value to be loaded.
2459 ir_node *new_r_Load (ir_graph *irg, ir_node *block,
2460 ir_node *store, ir_node *adr, ir_mode *mode);
2462 /** Constructor for a Store node.
2464 * @param *irg The ir graph the node belongs to.
2465 * @param *block The ir block the node belongs to.
2466 * @param *store The current memory
2467 * @param *adr A pointer to the variable to be read in this memory.
2468 * @param *val The value to write to this variable.
2470 ir_node *new_r_Store (ir_graph *irg, ir_node *block,
2471 ir_node *store, ir_node *adr, ir_node *val);
2473 /** Constructor for a Alloc node.
2475 * The Alloc node extends the memory by space for an entity of type alloc_type.
2477 * @param *irg The ir graph the node belongs to.
2478 * @param *block The ir block the node belongs to.
2479 * @param *store The memory which shall contain the new variable.
2480 * @param *size The number of bytes to allocate.
2481 * @param *alloc_type The type of the allocated variable.
2482 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
2484 ir_node *new_r_Alloc (ir_graph *irg, ir_node *block, ir_node *store,
2485 ir_node *size, ir_type *alloc_type, where_alloc where);
2487 /** Constructor for a Free node.
2489 * Frees the memory occupied by the entity pointed to by the pointer
2490 * arg. Type indicates the type of the entity the argument points to.
2492 * @param *irg The ir graph the node belongs to.
2493 * @param *block The ir block the node belongs to.
2494 * @param *store The memory which shall contain the new variable.
2495 * @param *ptr The pointer to the object to free.
2496 * @param *size The number of objects of type free_type to free in a sequence.
2497 * @param *free_type The type of the freed variable.
2498 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
2500 ir_node *new_r_Free (ir_graph *irg, ir_node *block, ir_node *store,
2501 ir_node *ptr, ir_node *size, ir_type *free_type, where_alloc where);
2503 /** Constructor for a Sync node.
2505 * Merges several memory values. The node assumes that a variable
2506 * either occurs only in one of the memories, or it contains the same
2507 * value in all memories where it occurs.
2509 * @param *irg The ir graph the node belongs to.
2510 * @param *block The ir block the node belongs to.
2511 * @param arity The number of memories to synchronize.
2512 * @param *in[] An array of pointers to nodes that produce an output of type memory.
2513 * The constructor copies this array.
2515 ir_node *new_r_Sync (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2517 /** Constructor for a Proj node.
2519 * Projects a single value out of a tuple. The parameter proj gives the
2520 * position of the value within the tuple.
2522 * @param *irg The ir graph the node belongs to.
2523 * @param *block The ir block the node belongs to.
2524 * @param arg A node producing a tuple.
2525 * @param *mode The mode of the value to project.
2526 * @param proj The position of the value in the tuple.
2528 ir_node *new_r_Proj (ir_graph *irg, ir_node *block, ir_node *arg,
2529 ir_mode *mode, long proj);
2531 /** Constructor for a defaultProj node.
2533 * Represents the default control flow of a Switch-Cond node.
2535 * @param *irg The ir graph the node belongs to.
2536 * @param *block The ir block the node belongs to.
2537 * @param arg A node producing a tuple.
2538 * @param max_proj The end position of the value in the tuple.
2540 ir_node *new_r_defaultProj (ir_graph *irg, ir_node *block, ir_node *arg, long max_proj);
2543 /** Constructor for a Tuple node.
2545 * This is an auxiliary node to replace a node that returns a tuple
2546 * without changing the corresponding Proj nodes.
2548 * @param *irg The ir graph the node belongs to.
2549 * @param *block The ir block the node belongs to.
2550 * @param arity The number of tuple elements.
2551 * @param *in[] An array containing pointers to the nodes producing the tuple elements.
2552 * The constructor copies this array.
2554 ir_node *new_r_Tuple (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2556 /** Constructor for a Id node.
2558 * This is an auxiliary node to replace a node that returns a single
2561 * @param *irg The ir graph the node belongs to.
2562 * @param *block The ir block the node belongs to.
2563 * @param *val The operand to Id.
2564 * @param *mode The mode of *val.
2566 ir_node *new_r_Id (ir_graph *irg, ir_node *block,
2567 ir_node *val, ir_mode *mode);
2569 /** Constructor for a Bad node.
2571 * Returns the unique Bad node of the graph. The same as
2574 * @param *irg The ir graph the node belongs to.
2577 ir_node *new_r_Bad (ir_graph *irg);
2579 /** Constructor for a Confirm node.
2581 * Specifies constraints for a value. To support dataflow analyses.
2583 * Example: If the value never exceeds '100' this is expressed by placing a
2584 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
2586 * @param *irg The ir graph the node belong to.
2587 * @param *block The ir block the node belong to.
2588 * @param *val The value we express a constraint for
2589 * @param *bound The value to compare against. Must be a firm node, typically a constant.
2590 * @param cmp The compare operation.
2592 ir_node *new_r_Confirm (ir_graph *irg, ir_node *block,
2593 ir_node *val, ir_node *bound, pn_Cmp cmp);
2595 /** Constructor for a Unknown node.
2597 * Represents an arbitrary value. Places the node in
2600 * @param *irg The ir graph the node belongs to.
2601 * @param *m The mode of the unknown value.
2603 ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2605 /** Constructor for a CallBegin node.
2607 * CallBegin represents control flow depending of the pointer value
2608 * representing the called method to the called methods. The
2609 * constructor copies the method pointer input from the passed Call
2612 * @param *irg The ir graph the node belong to.
2613 * @param *block The block the node belong to.
2614 * @param *callee The call node visible in the intra procedural view.
2616 ir_node *new_r_CallBegin(ir_graph *irg, ir_node *block, ir_node *callee);
2618 /** Constructor for a EndReg node.
2620 * Used to represent regular procedure end in interprocedual view.
2622 * @param *irg The ir graph the node belong to.
2623 * @param *block The block the node belong to.
2625 ir_node *new_r_EndReg (ir_graph *irg, ir_node *block);
2627 /** Constructor for a EndExcept node.
2629 * Used to represent exceptional procedure end in interprocedural view.
2631 * @param *irg The ir graph the node belong to.
2632 * @param *block The block the node belong to.
2634 ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
2636 /** Constructor for a Break node.
2638 * Break represents control flow to a single control successor just as Jmp.
2639 * The blocks separated by a break may not be concatenated by an optimization.
2640 * It is used for the interprocedural representation where blocks are parted
2641 * behind Call nodes to represent the control flow to called procedures.
2643 * @param *irg The ir graph the node belong to.
2644 * @param *block The block the node belong to.
2646 ir_node *new_r_Break (ir_graph *irg, ir_node *block);
2648 /** Constructor for a Filter node.
2650 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
2651 * Filter is a node with two views used to construct the interprocedural view.
2652 * In intraprocedural view its semantics are identical to the Proj node.
2653 * In interprocedural view the Filter performs the Phi operation on method
2654 * parameters or results. Other than a Phi a Filter node may not be removed
2655 * if it has only a single input.
2657 * The constructor builds the Filter in intraprocedural view.
2659 * @param *irg The ir graph the node belong to.
2660 * @param *block The block the node belong to.
2661 * @param *arg The tuple value to project from.
2662 * @param *mode The mode of the projected value.
2663 * @param proj The position in the tuple to project from.
2665 ir_node *new_r_Filter (ir_graph *irg, ir_node *block, ir_node *arg,
2666 ir_mode *mode, long proj);
2668 /** Constructor for a NoMem node.
2670 * Returns the unique NoMem node of the graph. The same as
2673 * @param *irg The ir graph the node belongs to.
2675 ir_node *new_r_NoMem (ir_graph *irg);
2677 /** Constructor for a Mux node.
2679 * @param *irg The ir graph the node belong to.
2680 * @param *block The block the node belong to.
2681 * @param *sel The ir_node that calculates the boolean select.
2682 * @param *ir_true The ir_node that calculates the true result.
2683 * @param *ir_false The ir_node that calculates the false result.
2684 * @param *mode The mode of the node (and it_true and ir_false).
2686 ir_node *new_r_Mux (ir_graph *irg, ir_node *block,
2687 ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2689 /** Constructor for a Psi node.
2691 * @param *irg The ir graph the node belong to.
2692 * @param *block The block the node belong to.
2693 * @param *arity The arity of the conditions
2694 * @param *conds The array of mode_b conditions, length must be equal arity
2695 * @param *vals The array of mode values, length must be equal arity + 1
2696 * @param *mode The mode of the node (must be the mode of all vals).
2698 ir_node *new_r_Psi (ir_graph *irg, ir_node *block,
2699 int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
2701 /** Constructor for a CopyB node.
2703 * @param *irg The ir graph the node belong to.
2704 * @param *block The block the node belong to.
2705 * @param *store The current memory
2706 * @param *dst The ir_node that represents the destination address.
2707 * @param *src The ir_node that represents the source address.
2708 * @param *data_type The type of the copied data
2710 ir_node *new_r_CopyB(ir_graph *irg, ir_node *block,
2711 ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
2713 /** Constructor for a InstOf node.
2715 * A High-Level Type check.
2717 * @param *irg The ir graph the node belongs to.
2718 * @param *block The ir block the node belongs to.
2719 * @param *store The memory in which the object the entity should be selected
2720 * from is allocated.
2721 * @param *objptr A pointer to a object of a class type.
2722 * @param *type The type of which objptr must be.
2724 ir_node *new_r_InstOf (ir_graph *irg, ir_node *block, ir_node *store,
2725 ir_node *objptr, ir_type *type);
2727 /** Constructor for a Raise node.
2729 * A High-Level Exception throw.
2731 * @param *irg The ir graph the node belongs to.
2732 * @param *block The ir block the node belongs to.
2733 * @param *store The current memory.
2734 * @param *obj A pointer to the Except variable.
2736 ir_node *new_r_Raise (ir_graph *irg, ir_node *block,
2737 ir_node *store, ir_node *obj);
2739 /** Constructor for a Bound node.
2741 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2743 * @param *irg The ir graph the node belong to.
2744 * @param *block The block the node belong to.
2745 * @param *store The current memory.
2746 * @param *idx The ir_node that represents an index.
2747 * @param *lower The ir_node that represents the lower bound for the index.
2748 * @param *upper The ir_node that represents the upper bound for the index.
2750 ir_node *new_r_Bound(ir_graph *irg, ir_node *block,
2751 ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
2753 /** Constructor for a Pin node.
2755 * @param *irg The ir graph the node belong to.
2756 * @param *block The block the node belong to.
2757 * @param *node The node which value should be pinned.
2759 ir_node *new_r_Pin(ir_graph *irg, ir_node *block, ir_node *node);
2761 /*-----------------------------------------------------------------------*/
2762 /* The block oriented interface */
2763 /*-----------------------------------------------------------------------*/
2765 /** Sets the current block in which the following constructors place the
2766 * nodes they construct.
2768 * @param target The new current block.
2770 void set_cur_block (ir_node *target);
2772 /** Returns the current block of the current graph. */
2773 ir_node *get_cur_block(void);
2775 /** Returns the fixed nodes of the current graph. */
2776 #define get_cur_end_block() get_irg_end_block(current_ir_graph)
2777 #define get_cur_end() get_irg_end(current_ir_graph)
2778 #define get_cur_start_block() get_irg_start_block(current_ir_graph)
2779 #define get_cur_start() get_irg_start(current_ir_graph)
2781 /** Constructor for a Block node.
2783 * Adds the block to the graph in current_ir_graph. Constructs a Block
2784 * with a fixed number of predecessors. Does set current_block. Can
2785 * be used with automatic Phi node construction.
2787 * @param *db A Pointer for debug information.
2788 * @param arity The number of control predecessors.
2789 * @param in[] An array of control predecessors. The length of
2790 * the array must be 'arity'.
2792 ir_node *new_d_Block(dbg_info *db, int arity, ir_node *in[]);
2794 /** Constructor for a Start node.
2796 * Adds the node to the block in current_ir_block.
2798 * @param *db A pointer for debug information.
2800 ir_node *new_d_Start (dbg_info *db);
2802 /** Constructor for a End node.
2804 * Adds the node to the block in current_ir_block.
2806 * @param *db A pointer for debug information.
2808 ir_node *new_d_End (dbg_info *db);
2810 /** Constructor for a Jmp node.
2812 * Adds the node to the block in current_ir_block.
2814 * Jmp represents control flow to a single control successor.
2816 * @param *db A pointer for debug information.
2818 ir_node *new_d_Jmp (dbg_info *db);
2820 /** Constructor for an IJmp node.
2822 * IJmp represents control flow to a single control successor not
2823 * statically known i.e. an indirect Jmp.
2825 * @param *db A pointer for debug information.
2826 * @param *tgt The ir node representing the target address.
2828 ir_node *new_d_IJmp (dbg_info *db, ir_node *tgt);
2830 /** Constructor for a Cond node.
2832 * Adds the node to the block in current_ir_block.
2834 * If c is mode_b represents a conditional branch (if/else). If c is
2835 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2836 * node, default Proj is 0.)
2838 * This is not consistent: Input to Cond is Is, Proj has as proj number
2841 * @param *db A pointer for debug information.
2842 * @param *c The conditions parameter.Can be of mode b or I_u.
2844 ir_node *new_d_Cond (dbg_info *db, ir_node *c);
2846 /** Constructor for a Return node.
2848 * Adds the node to the block in current_ir_block.
2850 * Returns the memory an zero or more return values. Only node that
2851 * can end regular control flow.
2853 * @param *db A pointer for debug information.
2854 * @param *store The state of memory.
2855 * @param arity Number of array indices.
2856 * @param *in Array with index inputs to the node.
2858 ir_node *new_d_Return (dbg_info *db, ir_node *store, int arity, ir_node *in[]);
2860 /** Constructor for a Const_type node.
2862 * Adds the node to the block in current_ir_block.
2864 * The constant represents a target value. This constructor sets high
2865 * level type information for the constant value.
2867 * @param *db A pointer for debug information.
2868 * @param *mode The mode of the operands and results.
2869 * @param *con Points to an entry in the constant table. This pointer is
2870 added to the attributes of the node.
2871 * @param *tp The type of the constant.
2873 ir_node *new_d_Const_type (dbg_info *db, ir_mode *mode, tarval *con, ir_type *tp);
2875 /** Constructor for a Const node.
2877 * Adds the node to the block in current_ir_block.
2879 * Constructor for a Const node. The constant represents a target
2880 * value. Sets the type information to type_unknown. (No more
2881 * supported: If tv is entity derives a somehow useful type.)
2883 * @param *db A pointer for debug information.
2884 * @param *mode The mode of the operands and results.
2885 * @param *con Points to an entry in the constant table. This pointer is added
2886 * to the attributes of the node.
2888 ir_node *new_d_Const (dbg_info *db, ir_mode *mode, tarval *con);
2890 /** Constructor for a SymConst_type node.
2892 * Adds the node to the block in current_ir_block.
2893 * This is the constructor for a symbolic constant.
2894 * There are four kinds of symbolic constants:
2895 * - type_tag The symbolic constant represents a type tag. The type the
2896 * tag stands for is given explicitly.
2897 * - size The symbolic constant represents the size of a type. The
2898 * type of which the constant represents the size is given
2900 * - addr_name The symbolic constant represents the address of an entity
2901 * (variable or method). The variable is indicated by a name
2902 * that is valid for linking.
2903 * - addr_ent The symbolic constant represents the address of an entity
2904 * (variable or method). The variable is given explicitly by
2907 * Inputs to the node:
2908 * No inputs except the block it belongs to.
2909 * Outputs of the node.
2910 * An unsigned integer (I_u) or a pointer (P).
2912 * @param *db A pointer for debug information.
2913 * @param value A type, entity or ident depending on the SymConst kind.
2914 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size,
2915 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
2916 * @param tp The source type of the constant.
2918 ir_node *new_d_SymConst_type (dbg_info *db, union symconst_symbol value, symconst_kind kind, ir_type *tp);
2920 /** Constructor for a SymConst node.
2922 * Same as new_d_SymConst_type, except that it sets the type to type_unknown. */
2923 ir_node *new_d_SymConst (dbg_info *db, union symconst_symbol value, symconst_kind kind);
2925 /** Constructor for a simpleSel node.
2927 * This is a shortcut for the new_d_Sel() constructor. To be used for
2928 * Sel nodes that do not select from an array, i.e., have no index
2929 * inputs. It adds the two parameters 0, NULL.
2931 * @param *db A pointer for debug information.
2932 * @param *store The memory in which the object the entity should be
2933 * selected from is allocated.
2934 * @param *objptr The object from that the Sel operation selects a
2935 * single attribute out.
2936 * @param *ent The entity to select.
2938 ir_node *new_d_simpleSel(dbg_info *db, ir_node *store, ir_node *objptr, ir_entity *ent);
2940 /** Constructor for a Sel node.
2942 * The select node selects an entity (field or method) from an entity
2943 * with a compound type. It explicitly specifies the entity selected.
2944 * Dynamically the node may select entities that overwrite the given
2945 * entity. If the selected entity is an array element entity the Sel
2946 * node takes the required array indices as inputs.
2947 * Adds the node to the block in current_ir_block.
2949 * @param *db A pointer for debug information.
2950 * @param *store The memory in which the object the entity should be selected
2951 * from is allocated.
2952 * @param *objptr A pointer to a compound entity the Sel operation selects a
2953 * single attribute from.
2954 * @param arity The number of array indices needed to select an array element entity.
2955 * @param *in[] If the compound entity is an array the indices of the selected
2956 * element entity. The constructor copies this array.
2957 * @param *ent The entity to select.
2959 ir_node *new_d_Sel (dbg_info *db, ir_node *store, ir_node *objptr, int arity, ir_node *in[],
2962 /** Constructor for a Call node.
2964 * Represents all kinds of method and function calls.
2965 * Adds the node to the block in current_ir_block.
2967 * @param *db A pointer for debug information.
2968 * @param *store The actual store.
2969 * @param *callee A pointer to the called procedure.
2970 * @param arity The number of procedure parameters.
2971 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2972 * @param *tp Type information of the procedure called.
2974 ir_node *new_d_Call (dbg_info *db, ir_node *store, ir_node *callee, int arity, ir_node *in[],
2977 /** Constructor for a Add node.
2979 * Adds the node to the block in current_ir_block.
2981 * @param *db A pointer for debug information.
2982 * @param *op1 The first operand.
2983 * @param *op2 The second operand.
2984 * @param *mode The mode of the operands and the result.
2986 ir_node *new_d_Add (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2988 /** Constructor for a Sub node.
2990 * Adds the node to the block in current_ir_block.
2992 * @param *db A pointer for debug information.
2993 * @param *op1 The first operand.
2994 * @param *op2 The second operand.
2995 * @param *mode The mode of the operands and the result.
2997 ir_node *new_d_Sub (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2999 /** Constructor for a Minus node.
3001 * Adds the node to the block in current_ir_block.
3003 * @param *db A pointer for debug information.
3004 * @param *op The operand .
3005 * @param *mode The mode of the operand and the result.
3007 ir_node *new_d_Minus (dbg_info *db, ir_node *op, ir_mode *mode);
3009 /** Constructor for a Mul node.
3011 * Adds the node to the block in current_ir_block.
3013 * @param *db A pointer for debug information.
3014 * @param *op1 The first operand.
3015 * @param *op2 The second operand.
3016 * @param *mode The mode of the operands and the result.
3018 ir_node *new_d_Mul (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3020 /** Constructor for a Quot node.
3022 * Adds the node to the block in current_ir_block.
3024 * @param *db A pointer for debug information.
3025 * @param *memop The store needed to model exceptions
3026 * @param *op1 The first operand.
3027 * @param *op2 The second operand.
3029 ir_node *new_d_Quot (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
3031 /** Constructor for a DivMod node.
3033 * Adds the node to the block in current_ir_block.
3035 * @param *db A pointer for debug information.
3036 * @param *memop The store needed to model exceptions
3037 * @param *op1 The first operand.
3038 * @param *op2 The second operand.
3040 ir_node *new_d_DivMod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
3042 /** Constructor for a Div node.
3044 * Adds the node to the block in current_ir_block.
3046 * @param *db A pointer for debug information.
3047 * @param *memop The store needed to model exceptions
3048 * @param *op1 The first operand.
3049 * @param *op2 The second operand.
3051 ir_node *new_d_Div (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
3053 /** Constructor for a Mod node.
3055 * Adds the node to the block in current_ir_block.
3057 * @param *db A pointer for debug information.
3058 * @param *memop The store needed to model exceptions
3059 * @param *op1 The first operand.
3060 * @param *op2 The second operand.
3062 ir_node *new_d_Mod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
3064 /** Constructor for a Abs node.
3066 * Adds the node to the block in current_ir_block.
3068 * @param *db A pointer for debug information.
3069 * @param *op The operand
3070 * @param *mode The mode of the operands and the result.
3072 ir_node *new_d_Abs (dbg_info *db, ir_node *op, ir_mode *mode);
3074 /** Constructor for a And node.
3076 * Adds the node to the block in current_ir_block.
3078 * @param *db A pointer for debug information.
3079 * @param *op1 The first operand.
3080 * @param *op2 The second operand.
3081 * @param *mode The mode of the operands and the result.
3083 ir_node *new_d_And (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3085 /** Constructor for a Or node.
3087 * Adds the node to the block in current_ir_block.
3089 * @param *db A pointer for debug information.
3090 * @param *op1 The first operand.
3091 * @param *op2 The second operand.
3092 * @param *mode The mode of the operands and the result.
3094 ir_node *new_d_Or (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3096 /** Constructor for a Eor node.
3098 * Adds the node to the block in current_ir_block.
3100 * @param *db A pointer for debug information.
3101 * @param *op1 The first operand.
3102 * @param *op2 The second operand.
3103 * @param *mode The mode of the operands and the results.
3105 ir_node *new_d_Eor (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3107 /** Constructor for a Not node.
3109 * Adds the node to the block in current_ir_block.
3111 * @param *db A pointer for debug information.
3112 * @param *op The operand.
3113 * @param *mode The mode of the operand and the result.
3115 ir_node *new_d_Not (dbg_info *db, ir_node *op, ir_mode *mode);
3117 /** Constructor for a Shl node.
3119 * Adds the node to the block in current_ir_block.
3121 * @param *db A pointer for debug information.
3122 * @param *op The operand.
3123 * @param *k The number of bits to shift the operand .
3124 * @param *mode The mode of the operand and the result.
3126 ir_node *new_d_Shl (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3128 /** Constructor for a Shr node.
3130 * Adds the node to the block in current_ir_block.
3132 * @param *db A pointer for debug information.
3133 * @param *op The operand.
3134 * @param *k The number of bits to shift the operand .
3135 * @param *mode The mode of the operand and the result.
3137 ir_node *new_d_Shr (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3139 /** Constructor for a Shrs node.
3141 * Adds the node to the block in current_ir_block.
3143 * @param *db A pointer for debug information.
3144 * @param *op The operand.
3145 * @param *k The number of bits to shift the operand .
3146 * @param *mode The mode of the operand and the result.
3148 ir_node *new_d_Shrs (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3150 /** Constructor for a Rot node.
3152 * Adds the node to the block in current_ir_block.
3154 * @param *db A pointer for debug information.
3155 * @param *op The operand.
3156 * @param *k The number of bits to rotate the operand.
3157 * @param *mode The mode of the operand.
3159 ir_node *new_d_Rot (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3161 /** Constructor for a Cmp node.
3163 * Adds the node to the block in current_ir_block.
3165 * @param *db A pointer for debug information.
3166 * @param *op1 The first operand.
3167 * @param *op2 The second operand.
3169 ir_node *new_d_Cmp (dbg_info *db, ir_node *op1, ir_node *op2);
3171 /** Constructor for a Conv node.
3173 * Adds the node to the block in current_ir_block.
3175 * @param *db A pointer for debug information.
3176 * @param *op The operand.
3177 * @param *mode The mode of this the operand muss be converted .
3179 ir_node *new_d_Conv (dbg_info *db, ir_node *op, ir_mode *mode);
3181 /** Constructor for a strict Conv node.
3183 * Adds the node to the block in current_ir_block.
3185 * @param *db A pointer for debug information.
3186 * @param *op The operand.
3187 * @param *mode The mode of this the operand muss be converted .
3189 ir_node *new_d_strictConv (dbg_info *db, ir_node *op, ir_mode *mode);
3191 /** Constructor for a Cast node.
3193 * High level type cast
3194 * Adds the node to the block in current_ir_block.
3196 * @param *db A pointer for debug information.
3197 * @param *op The operand.
3198 * @param *to_tp The type of this the operand muss be casted .
3200 ir_node *new_d_Cast (dbg_info *db, ir_node *op, ir_type *to_tp);
3202 /** Constructor for a Carry node.
3204 * Adds the node to the block in current_ir_block.
3206 * @param *db A pointer for debug information.
3207 * @param *op1 The first operand.
3208 * @param *op2 The second operand.
3209 * @param *mode The mode of the operands and the result.
3211 ir_node *new_d_Carry (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3213 /** Constructor for a Borrow node.
3215 * Adds the node to the block in current_ir_block.
3217 * @param *db A pointer for debug information.
3218 * @param *op1 The first operand.
3219 * @param *op2 The second operand.
3220 * @param *mode The mode of the operands and the result.
3222 ir_node *new_d_Borrow (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3224 /** Constructor for a Phi node.
3226 * Adds the node to the block in current_ir_block.
3228 * @param *db A pointer for debug information.
3229 * @param arity The number of predecessors
3230 * @param *in Array with predecessors
3231 * @param *mode The mode of it's inputs and output.
3233 ir_node *new_d_Phi (dbg_info *db, int arity, ir_node *in[], ir_mode *mode);
3235 /** Constructor for a Load node.
3237 * Adds the node to the block in current_ir_block.
3239 * @param *db A pointer for debug information.
3240 * @param *store The current memory
3241 * @param *addr A pointer to the variable to be read in this memory.
3242 * @param *mode The mode of the value to be loaded.
3244 ir_node *new_d_Load (dbg_info *db, ir_node *store, ir_node *addr, ir_mode *mode);
3246 /** Constructor for a Store node.
3248 * Adds the node to the block in current_ir_block.
3250 * @param *db A pointer for debug information.
3251 * @param *store The current memory
3252 * @param *addr A pointer to the variable to be read in this memory.
3253 * @param *val The value to write to this variable.
3255 ir_node *new_d_Store (dbg_info *db, ir_node *store, ir_node *addr, ir_node *val);
3257 /** Constructor for a Alloc node.
3259 * The Alloc node extends the memory by space for an entity of type alloc_type.
3260 * Adds the node to the block in current_ir_block.
3262 * @param *db A pointer for debug information.
3263 * @param *store The memory which shall contain the new variable.
3264 * @param *size The number of bytes to allocate.
3265 * @param *alloc_type The type of the allocated variable.
3266 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3268 ir_node *new_d_Alloc (dbg_info *db, ir_node *store, ir_node *size, ir_type *alloc_type,
3271 /** Constructor for a Free node.
3273 * Frees the memory occupied by the entity pointed to by the pointer
3274 * arg. Type indicates the type of the entity the argument points to.
3275 * Adds the node to the block in current_ir_block.
3277 * @param *db A pointer for debug information.
3278 * @param *store The memory which shall contain the new variable.
3279 * @param *ptr The pointer to the object to free.
3280 * @param *size The number of objects of type free_type to free in a sequence.
3281 * @param *free_type The type of the freed variable.
3282 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
3284 ir_node *new_d_Free (dbg_info *db, ir_node *store, ir_node *ptr, ir_node *size,
3285 ir_type *free_type, where_alloc where);
3287 /** Constructor for a Sync node.
3289 * Merges several memory values. The node assumes that a variable
3290 * either occurs only in one of the memories, or it contains the same
3291 * value in all memories where it occurs.
3292 * Adds the node to the block in current_ir_block.
3294 * @param *db A pointer for debug information.
3295 * @param arity The number of memories to synchronize.
3296 * @param **in An array of pointers to nodes that produce an output of type
3297 * memory. The constructor copies this array.
3299 ir_node *new_d_Sync (dbg_info *db, int arity, ir_node *in[]);
3301 /** Constructor for a Proj node.
3303 * Projects a single value out of a tuple. The parameter proj gives the
3304 * position of the value within the tuple.
3305 * Adds the node to the block in current_ir_block.
3307 * @param *db A pointer for deubug information.
3308 * @param arg A node producing a tuple.
3309 * @param *mode The mode of the value to project.
3310 * @param proj The position of the value in the tuple.
3312 ir_node *new_d_Proj (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3314 /** Constructor for a defaultProj node.
3316 * Represents the default control flow of a Switch-Cond node.
3317 * Adds the node to the block in current_ir_block.
3319 * @param *db A pointer for debug information.
3320 * @param arg A node producing a tuple.
3321 * @param max_proj The end position of the value in the tuple.
3323 ir_node *new_d_defaultProj (dbg_info *db, ir_node *arg, long max_proj);
3325 /** Constructor for a Tuple node.
3327 * This is an auxiliary node to replace a node that returns a tuple
3328 * without changing the corresponding Proj nodes.
3329 * Adds the node to the block in current_ir_block.
3331 * @param *db A pointer for debug information.
3332 * @param arity The number of tuple elements.
3333 * @param **in An array containing pointers to the nodes producing the tuple elements.
3335 ir_node *new_d_Tuple (dbg_info *db, int arity, ir_node *in[]);
3337 /** Constructor for a Id node.
3339 * This is an auxiliary node to replace a node that returns a single
3340 * value. Adds the node to the block in current_ir_block.
3342 * @param *db A pointer for debug information.
3343 * @param *val The operand to Id.
3344 * @param *mode The mode of *val.
3346 ir_node *new_d_Id (dbg_info *db, ir_node *val, ir_mode *mode);
3348 /** Constructor for a Bad node.
3350 * Returns the unique Bad node of the graph. The same as
3353 ir_node *new_d_Bad (void);
3355 /** Constructor for a Confirm node.
3357 * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3358 * Specifies constraints for a value. To support dataflow analyses.
3360 * Example: If the value never exceeds '100' this is expressed by placing a
3361 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
3363 * @param *db A pointer for debug information.
3364 * @param *val The value we express a constraint for
3365 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3366 * @param cmp The compare operation.
3368 ir_node *new_d_Confirm (dbg_info *db, ir_node *val, ir_node *bound, pn_Cmp cmp);
3370 /** Constructor for an Unknown node.
3372 * Represents an arbitrary value. Places the node in
3375 * @param *m The mode of the unknown value.
3377 ir_node *new_d_Unknown(ir_mode *m);
3379 /** Constructor for a CallBegin node.
3381 * CallBegin represents control flow depending of the pointer value
3382 * representing the called method to the called methods. The
3383 * constructor copies the method pointer input from the passed Call
3384 * node.Adds the node to the block in current_ir_block.
3386 * @param *db A pointer for debug information.
3387 * @param *callee The call node visible in the intra procedural view.
3389 ir_node *new_d_CallBegin(dbg_info *db, ir_node *callee);
3391 /** Constructor for an EndReg node.
3393 *Adds the node to the block in current_ir_block.
3395 * @param *db A pointer for debug information.
3397 ir_node *new_d_EndReg (dbg_info *db);
3399 /** Constructor for an EndExcept node.
3401 * Used to represent regular procedure end in interprocedual view.
3402 * Adds the node to the block in current_ir_block.
3404 * @param *db A pointer for debug information.
3406 ir_node *new_d_EndExcept(dbg_info *db);
3408 /** Constructor for a Break node.
3410 * Used to represent exceptional procedure end in interprocedural view.
3411 * Adds the node to the block in current_ir_block.
3413 * Break represents control flow to a single control successor just as Jmp.
3414 * The blocks separated by a break may not be concatenated by an optimization.
3415 * It is used for the interprocedural representation where blocks are parted
3416 * behind Call nodes to represent the control flow to called procedures.
3418 * @param *db A pointer for debug information.
3420 ir_node *new_d_Break (dbg_info *db);
3422 /** Constructor for a Filter node.
3424 * Constructor for a Filter node. Adds the node to the block in
3425 * current_ir_block. Filter is a node with two views used to
3426 * construct the interprocedural view. In intraprocedural view its
3427 * semantics are identical to the Proj node. In interprocedural view
3428 * the Filter performs the Phi operation on method parameters or
3429 * results. Other than a Phi a Filter node may not be removed if it
3430 * has only a single input.
3432 * The constructor builds the Filter in intraprocedural view.
3434 * @param *db A pointer for debug information.
3435 * @param *arg The tuple value to project from.
3436 * @param *mode The mode of the projected value.
3437 * @param proj The position in the tuple to project from.
3439 ir_node *new_d_Filter (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3442 /** Constructor for a NoMem node.
3444 * Returns the unique NoMem node of the graph. The same as
3447 ir_node *new_d_NoMem (void);
3449 /** Constructor for a Mux node.
3451 * @param *db A pointer for debug information.
3452 * @param *sel The ir_node that calculates the boolean select.
3453 * @param *ir_true The ir_node that calculates the true result.
3454 * @param *ir_false The ir_node that calculates the false result.
3455 * @param *mode The mode of the node (and it_true and ir_false).
3457 ir_node *new_d_Mux (dbg_info *db, ir_node *sel,
3458 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
3460 /** Constructor for a Psi node.
3462 * @param *db A pointer for debug information.
3463 * @param *arity The arity of the conditions
3464 * @param *conds The array of mode_b conditions, length must be equal arity
3465 * @param *vals The array of mode values, length must be equal arity + 1
3466 * @param *mode The mode of the node (must be the mode of all vals).
3468 ir_node *new_d_Psi (dbg_info *db,
3469 int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
3471 /** Constructor for a CopyB node.
3473 * @param *db A pointer for debug information.
3474 * @param *store The current memory
3475 * @param *dst The ir_node that represents the destination address.
3476 * @param *src The ir_node that represents the source address.
3477 * @param *data_type The type of the copied data
3479 ir_node *new_d_CopyB(dbg_info *db, ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
3481 /** Constructor for a InstOf node.
3483 * A High-Level Type check.
3485 * @param *db A pointer for debug information.
3486 * @param *store The memory in which the object the entity should be selected
3487 * from is allocated.
3488 * @param *objptr A pointer to a object of a class type.
3489 * @param *type The type of which objptr must be.
3491 ir_node *new_d_InstOf (dbg_info *db, ir_node *store, ir_node *objptr, ir_type *type);
3493 /** Constructor for a Raise node.
3495 * A High-Level Exception throw.
3497 * @param *db A pointer for debug information.
3498 * @param *store The current memory.
3499 * @param *obj A pointer to the Except variable.
3501 ir_node *new_d_Raise (dbg_info *db, ir_node *store, ir_node *obj);
3503 /** Constructor for a Bound node.
3505 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
3507 * @param *db A pointer for debug information.
3508 * @param *store The current memory
3509 * @param *idx The ir_node that represents an index.
3510 * @param *lower The ir_node that represents the lower bound for the index.
3511 * @param *upper The ir_node that represents the upper bound for the index.
3513 ir_node *new_d_Bound(dbg_info *db, ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
3515 /** Constructor for a Pin node.
3517 * @param *db A pointer for debug information.
3518 * @param *node The node which value should be pinned.
3520 ir_node *new_d_Pin(dbg_info *db, ir_node *node);
3522 /*-----------------------------------------------------------------------*/
3523 /* The block oriented interface without debug support */
3524 /*-----------------------------------------------------------------------*/
3526 /* Needed from the interface with debug support:
3527 void set_cur_block (ir_node *target); */
3529 /** Constructor for a Block node.
3531 * Constructor for a Block node. Adds the block to the graph in
3532 * current_ir_graph. Constructs a Block with a fixed number of
3533 * predecessors. Does set current_block. Can be used with automatic
3534 * Phi node construction.
3536 * @param arity The number of control predecessors.
3537 * @param in An array of control predecessors. The length of
3538 * the array must be 'arity'.
3540 ir_node *new_Block(int arity, ir_node *in[]);
3542 /** Constructor for a Start node.
3544 * Adds the node to the block in current_ir_block.
3547 ir_node *new_Start (void);
3549 /** Constructor for an End node.
3551 * Adds the node to the block in current_ir_block.
3553 ir_node *new_End (void);
3555 /** Constructor for an EndReg node.
3557 * Used to represent regular procedure end in interprocedual view.
3558 * Adds the node to the block in current_ir_block.
3560 ir_node *new_EndReg (void);
3562 /** Constructor for an EndExpcept node.
3564 * Used to represent exceptional procedure end in interprocedural view.
3565 * Adds the node to the block in current_ir_block.
3567 ir_node *new_EndExcept(void);
3569 /** Constructor for a Jump node.
3571 * Adds the node to the block in current_ir_block.
3573 * Jmp represents control flow to a single control successor.
3575 ir_node *new_Jmp (void);
3577 /** Constructor for an IJmp node.
3579 * IJmp represents control flow to a single control successor not
3580 * statically known i.e. an indirect Jmp.
3582 * @param *tgt The ir node representing the target address.
3584 ir_node *new_IJmp (ir_node *tgt);
3586 /** Constructor for a Break node.
3587 * Break represents control flow to a single control successor just as Jmp.
3588 * The blocks separated by a break may not be concatenated by an optimization.
3589 * It is used for the interprocedural representation where blocks are parted
3590 * behind Call nodes to represent the control flow to called procedures.
3591 * Adds the node to the block in current_ir_block.
3593 ir_node *new_Break (void);
3595 /** Constructor for a Cond node.
3597 * If c is mode_b represents a conditional branch (if/else). If c is
3598 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
3599 * node, default Proj is 0.). Adds the node to the block in current_ir_block.
3601 * This is not consistent: Input to Cond is Is, Proj has as proj number
3605 * @param *c The conditions parameter.Can be of mode b or I_u.
3607 ir_node *new_Cond (ir_node *c);
3609 /** Constructor for a Return node.
3611 * Returns the memory an zero or more return values. Only node that
3612 * can end regular control flow. Adds the node to the block in current_ir_block.
3614 * @param *store The state of memory.
3615 * @param arity Number of array indices.
3616 * @param *in Array with index inputs to the node.
3618 ir_node *new_Return (ir_node *store, int arity, ir_node *in[]);
3620 /** Constructor for a Const node.
3622 * Constructor for a Const node. The constant represents a target
3623 * value. Sets the type information to type_unknown. (No more
3624 * supported: If tv is entity derives a somehow useful type.)
3625 * Adds the node to the block in current_ir_block.
3627 * @param *mode The mode of the operands and results.
3628 * @param *con Points to an entry in the constant table. This pointer is
3629 * added to the attributes of the node.
3631 ir_node *new_Const (ir_mode *mode, tarval *con);
3634 * Make a const from a long.
3635 * This is just convenience for the usual
3637 * new_Const(mode, tarval_from_long(mode, ...))
3640 * @param mode The mode for the const.
3641 * @param value The value of the constant.
3642 * @return A new const node.
3644 ir_node *new_Const_long(ir_mode *mode, long value);
3646 /** Constructor for a Const node.
3648 * Derives mode from passed type. */
3649 ir_node *new_Const_type(tarval *con, ir_type *tp);
3651 /** Constructor for a SymConst node.
3653 * Adds the node to the block in current_ir_block.
3654 * This is the constructor for a symbolic constant.
3655 * There are four kinds of symbolic constants:
3656 * -# type_tag The symbolic constant represents a type tag. The type the
3657 * tag stands for is given explicitly.
3658 * -# size The symbolic constant represents the size of a type. The
3659 * type of which the constant represents the size is given
3661 * -# align The symbolic constant represents the alignment of a type. The
3662 * type of which the constant represents the size is given
3664 * -# addr_name The symbolic constant represents the address of an entity
3665 * (variable or method). The variable is indicated by a name
3666 * that is valid for linking.
3667 * -# addr_ent The symbolic constant represents the address of an entity
3668 * (variable or method). The variable is given explicitly by
3671 * Inputs to the node:
3672 * No inputs except the block it belongs to.
3673 * Outputs of the node.
3674 * An unsigned integer (I_u) or a pointer (P).
3676 * @param value A type or a ident depending on the SymConst kind.
3677 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3678 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
3679 * @param tp The source type of the constant.
3681 ir_node *new_SymConst_type (union symconst_symbol value, symconst_kind kind, ir_type *tp);
3683 /** Constructor for a SymConst node.
3685 * Adds the node to the block in current_ir_block.
3686 * This is the constructor for a symbolic constant.
3687 * There are four kinds of symbolic constants:
3688 * -# type_tag The symbolic constant represents a type tag. The type the
3689 * tag stands for is given explicitly.
3690 * -# size The symbolic constant represents the size of a type. The
3691 * type of which the constant represents the size is given
3693 * -# align The symbolic constant represents the alignment of a type. The
3694 * type of which the constant represents the size is given
3696 * -# addr_name The symbolic constant represents the address of an entity
3697 * (variable or method). The variable is indicated by a name
3698 * that is valid for linking.
3699 * -# addr_ent The symbolic constant represents the address of an entity
3700 * (variable or method). The variable is given explicitly by
3703 * Inputs to the node:
3704 * No inputs except the block it belongs to.
3705 * Outputs of the node.
3706 * An unsigned integer (I_u) or a pointer (P).
3708 * @param value A type or a ident depending on the SymConst kind.
3709 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3710 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
3712 ir_node *new_SymConst (union symconst_symbol value, symconst_kind kind);
3714 /** Constructor for a simpelSel node.
3716 * This is a shortcut for the new_Sel() constructor. To be used for
3717 * Sel nodes that do not select from an array, i.e., have no index
3718 * inputs. It adds the two parameters 0, NULL.
3720 * @param *store The memory in which the object the entity should be selected from is allocated.
3721 * @param *objptr The object from that the Sel operation selects a single attribute out.
3722 * @param *ent The entity to select.
3724 ir_node *new_simpleSel(ir_node *store, ir_node *objptr, ir_entity *ent);
3726 /** Constructor for a Sel node.
3728 * The select node selects an entity (field or method) from an entity
3729 * with a compound type. It explicitly specifies the entity selected.
3730 * Dynamically the node may select entities that overwrite the given
3731 * entity. If the selected entity is an array element entity the Sel
3732 * node takes the required array indices as inputs.
3733 * Adds the node to the block in current_ir_block.
3735 * @param *store The memory in which the object the entity should be selected
3736 * from is allocated.
3737 * @param *objptr A pointer to a compound entity the Sel operation selects a
3738 * single attribute from.
3739 * @param arity The number of array indices needed to select an array element entity.
3740 * @param *in[] If the compound entity is an array the indices of the selected
3741 * element entity. The constructor copies this array.
3742 * @param *ent The entity to select.
3744 ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3747 /** Constructor for a Call node.
3749 * Adds the node to the block in current_ir_block.
3750 * Represents all kinds of method and function calls.
3752 * @param *store The actual store.
3753 * @param *callee A pointer to the called procedure.
3754 * @param arity The number of procedure parameters.
3755 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3756 * @param *tp Type information of the procedure called.
3758 ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node *in[],
3761 /** Constructor for a CallBegin node.
3763 * CallBegin represents control flow depending of the pointer value
3764 * representing the called method to the called methods. The
3765 * constructor copies the method pointer input from the passed Call
3766 * node. Adds the node to the block in current_ir_block.
3768 * @param *callee A pointer to the called procedure.
3770 ir_node *new_CallBegin(ir_node *callee);
3772 /** Constructor for a Add node.
3774 * Adds the node to the block in current_ir_block.
3776 * @param *op1 The first operand.
3777 * @param *op2 The second operand.
3778 * @param *mode The mode of the operands and the result.
3780 ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
3782 /** Constructor for a Sub node.
3784 * Adds the node to the block in current_ir_block.
3786 * @param *op1 The first operand.
3787 * @param *op2 The second operand.
3788 * @param *mode The mode of the operands and the result.
3790 ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
3792 /** Constructor for a Minus node.
3794 * Adds the node to the block in current_ir_block.
3796 * @param *op The operand .
3797 * @param *mode The mode of the operand and the result.
3799 ir_node *new_Minus (ir_node *op, ir_mode *mode);
3802 * Constructor for a Mul node. Adds the node to the block in current_ir_block.
3804 * @param *op1 The first operand.
3805 * @param *op2 The second operand.
3806 * @param *mode The mode of the operands and the result.
3808 ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
3810 /** Constructor for a Quot node.
3812 * Adds the node to the block in current_ir_block.
3814 * @param *memop The store needed to model exceptions
3815 * @param *op1 The first operand.
3816 * @param *op2 The second operand.
3818 ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2);
3820 /** Constructor for a DivMod node.
3822 * Adds the node to the block in current_ir_block.
3824 * @param *memop The store needed to model exceptions
3825 * @param *op1 The first operand.
3826 * @param *op2 The second operand.
3828 ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
3830 /** Constructor for a Div node.
3832 * Adds the node to the block in current_ir_block.
3834 * @param *memop The store needed to model exceptions
3835 * @param *op1 The first operand.
3836 * @param *op2 The second operand.
3838 ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2);
3840 /** Constructor for a Mod node.
3842 * Adds the node to the block in current_ir_block.
3844 * @param *memop The store needed to model exceptions
3845 * @param *op1 The first operand.
3846 * @param *op2 The second operand.
3848 ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2);
3850 /** Constructor for a Abs node.
3852 * Adds the node to the block in current_ir_block.
3854 * @param *op The operand
3855 * @param *mode The mode of the operands and the result.
3857 ir_node *new_Abs (ir_node *op, ir_mode *mode);
3859 /** Constructor for a And node.
3861 * Adds the node to the block in current_ir_block.
3863 * @param *op1 The first operand.
3864 * @param *op2 The second operand.
3865 * @param *mode The mode of the operands and the result.
3867 ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
3870 * Constructor for a Or node. Adds the node to the block in current_ir_block.
3872 * @param *op1 The first operand.
3873 * @param *op2 The second operand.
3874 * @param *mode The mode of the operands and the result.
3876 ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
3879 * Constructor for a Eor node. Adds the node to the block in current_ir_block.
3881 * @param *op1 The first operand.
3882 * @param *op2 The second operand.
3883 * @param *mode The mode of the operands and the results.
3885 ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
3887 /** Constructor for a Not node.
3889 * Adds the node to the block in current_ir_block.
3891 * @param *op The operand.
3892 * @param *mode The mode of the operand and the result.
3894 ir_node *new_Not (ir_node *op, ir_mode *mode);
3896 /** Constructor for a Shl node.
3898 * Adds the node to the block in current_ir_block.
3900 * @param *op The operand.
3901 * @param *k The number of bits to shift the operand .
3902 * @param *mode The mode of the operand and the result.
3904 ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
3907 * Constructor for a Shr node. Adds the node to the block in current_ir_block.
3909 * @param *op The operand.
3910 * @param *k The number of bits to shift the operand .
3911 * @param *mode The mode of the operand and the result.
3913 ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
3915 /** Constructor for a Shrs node.
3917 * Adds the node to the block in current_ir_block.
3919 * @param *op The operand.
3920 * @param *k The number of bits to shift the operand .
3921 * @param *mode The mode of the operand and the result.
3923 ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
3925 /** Constructor for a Rot node.
3927 * Adds the node to the block in current_ir_block.
3929 * @param *op The operand.
3930 * @param *k The number of bits to rotate the operand.
3931 * @param *mode The mode of the operand.
3933 ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode);
3935 /** Constructor for a Cmp node.
3937 * Adds the node to the block in current_ir_block.
3939 * @param *op1 The first operand.
3940 * @param *op2 The second operand.
3942 ir_node *new_Cmp (ir_node *op1, ir_node *op2);
3944 /** Constructor for a Conv node.
3946 * Adds the node to the block in current_ir_block.
3948 * @param *op The operand.
3949 * @param *mode The mode of this the operand muss be converted.
3951 ir_node *new_Conv (ir_node *op, ir_mode *mode);
3953 /** Constructor for a strict Conv node.
3955 * Adds the node to the block in current_ir_block.
3957 * @param *op The operand.
3958 * @param *mode The mode of this the operand muss be converted.
3960 ir_node *new_strictConv (ir_node *op, ir_mode *mode);
3962 /** Constructor for a Cast node.
3964 * Adds the node to the block in current_ir_block.
3965 * High level type cast
3967 * @param *op The operand.
3968 * @param *to_tp The type of this the operand muss be casted .
3970 ir_node *new_Cast (ir_node *op, ir_type *to_tp);
3972 /** Constructor for a Carry node.
3974 * Adds the node to the block in current_ir_block.
3976 * @param *op1 The first operand.
3977 * @param *op2 The second operand.
3978 * @param *mode The mode of the operands and the result.
3980 ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode);
3982 /** Constructor for a Borrow node.
3984 * Adds the node to the block in current_ir_block.
3986 * @param *op1 The first operand.
3987 * @param *op2 The second operand.
3988 * @param *mode The mode of the operands and the result.
3990 ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode);
3992 /** Constructor for a Phi node.
3994 * Adds the node to the block in current_ir_block.
3996 * @param arity The number of predecessors.
3997 * @param *in Array with predecessors.
3998 * @param *mode The mode of it's inputs and output.
4000 ir_node *new_Phi (int arity, ir_node *in[], ir_mode *mode);
4002 /** Constructor for a Load node.
4004 * @param *store The current memory.
4005 * @param *addr A pointer to the variable to be read in this memory.
4006 * @param *mode The mode of the value to be loaded.
4008 ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode);
4010 /** Constructor for a Store node.
4012 * @param *store The current memory.
4013 * @param *addr A pointer to the variable to be read in this memory.
4014 * @param *val The value to write to this variable.
4016 ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
4018 /** Constructor for a Alloc node.
4020 * The Alloc node extends the memory by space for an entity of type alloc_type.
4021 * Adds the node to the block in current_ir_block.
4023 * @param *store The memory which shall contain the new variable.
4024 * @param *size The number of bytes to allocate.
4025 * @param *alloc_type The type of the allocated variable.
4026 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
4028 ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
4031 /** Constructor for a Free node.
4033 * Frees the memory occupied by the entity pointed to by the pointer
4034 * arg. Type indicates the type of the entity the argument points to.
4035 * Adds the node to the block in current_ir_block.
4037 * @param *store The memory which shall contain the new variable.
4038 * @param *ptr The pointer to the object to free.
4039 * @param *size The number of objects of type free_type to free in a sequence.
4040 * @param *free_type The type of the freed variable.
4041 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
4043 ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
4044 ir_type *free_type, where_alloc where);
4046 /** Constructor for a Sync node.
4048 * Merges several memory values. The node assumes that a variable
4049 * either occurs only in one of the memories, or it contains the same
4050 * value in all memories where it occurs.
4051 * Adds the node to the block in current_ir_block.
4053 * @param arity The number of memories to synchronize.
4054 * @param **in An array of pointers to nodes that produce an output of type
4055 * memory. The constructor copies this array.
4057 ir_node *new_Sync (int arity, ir_node *in[]);
4059 /** Constructor for a Proj node.
4061 * Projects a single value out of a tuple. The parameter proj gives the
4062 * position of the value within the tuple.
4063 * Adds the node to the block in current_ir_block.
4065 * @param arg A node producing a tuple.
4066 * @param *mode The mode of the value to project.
4067 * @param proj The position of the value in the tuple.
4069 ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
4071 /** Constructor for a Filter node.
4073 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
4074 * Filter is a node with two views used to construct the interprocedural view.
4075 * In intraprocedural view its semantics are identical to the Proj node.
4076 * In interprocedural view the Filter performs the Phi operation on method
4077 * parameters or results. Other than a Phi a Filter node may not be removed
4078 * if it has only a single input.
4080 * The constructor builds the Filter in intraprocedural view.
4082 * @param *arg The tuple value to project from.
4083 * @param *mode The mode of the projected value.
4084 * @param proj The position in the tuple to project from.
4086 ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj);
4088 /** Constructor for a defaultProj node.
4090 * Represents the default control flow of a Switch-Cond node.
4091 * Adds the node to the block in current_ir_block.
4093 * @param arg A node producing a tuple.
4094 * @param max_proj The end position of the value in the tuple.
4096 ir_node *new_defaultProj (ir_node *arg, long max_proj);
4098 /** Constructor for a Tuple node.
4100 * This is an auxiliary node to replace a node that returns a tuple
4101 * without changing the corresponding Proj nodes.
4102 * Adds the node to the block in current_ir_block.
4104 * @param arity The number of tuple elements.
4105 * @param **in An array containing pointers to the nodes producing the tuple elements.
4107 ir_node *new_Tuple (int arity, ir_node *in[]);
4109 /** Constructor for an Id node.
4111 * This is an auxiliary node to replace a node that returns a single
4112 * value. Adds the node to the block in current_ir_block.
4114 * @param *val The operand to Id.
4115 * @param *mode The mode of *val.
4117 ir_node *new_Id (ir_node *val, ir_mode *mode);
4119 /** Constructor for a Bad node.
4121 * Returns the unique Bad node of the graph. The same as
4124 ir_node *new_Bad (void);
4126 /** Constructor for a Confirm node.
4128 * Specifies constraints for a value. To support dataflow analyses.
4129 * Adds the node to the block in current_ir_block.
4131 * Example: If the value never exceeds '100' this is expressed by placing a
4132 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
4134 * @param *val The value we express a constraint for
4135 * @param *bound The value to compare against. Must be a firm node, typically a constant.
4136 * @param cmp The compare operation.
4138 ir_node *new_Confirm (ir_node *val, ir_node *bound, pn_Cmp cmp);
4140 /** Constructor for an Unknown node.
4142 * Represents an arbitrary value. Places the node in
4145 * @param *m The mode of the unknown value.
4147 ir_node *new_Unknown(ir_mode *m);
4149 /** Constructor for a NoMem node.
4151 * Returns the unique NoMem node of the graph. The same as
4154 ir_node *new_NoMem (void);
4156 /** Constructor for a Mux node.
4158 * Adds the node to the block in current_ir_block.
4160 * @param *sel The ir_node that calculates the boolean select.
4161 * @param *ir_true The ir_node that calculates the true result.
4162 * @param *ir_false The ir_node that calculates the false result.
4163 * @param *mode The mode of the node (and it_true and ir_false).
4165 ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
4167 /** Constructor for a Psi node.
4169 * @param *arity The arity of the conditions
4170 * @param *conds The array of mode_b conditions, length must be equal arity
4171 * @param *vals The array of mode values, length must be equal arity + 1
4172 * @param *mode The mode of the node (must be the mode of all vals).
4174 ir_node *new_Psi (int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
4176 /** Constructor for a CopyB node.
4178 * Adds the node to the block in current_ir_block.
4180 * @param *store The current memory
4181 * @param *dst The ir_node that represents the destination address.
4182 * @param *src The ir_node that represents the source address.
4183 * @param *data_type The type of the copied data
4185 ir_node *new_CopyB(ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
4187 /** Constructor for a InstOf node.
4189 * A High-Level Type check.
4191 * @param *store The memory in which the object the entity should be selected
4192 * from is allocated.
4193 * @param *objptr A pointer to a object of a class type.
4194 * @param *type The type of which objptr must be.
4196 ir_node *new_InstOf (ir_node *store, ir_node *objptr, ir_type *type);
4198 /**Constructor for a Raise node.
4200 * A High-Level Exception throw.
4202 * @param *store The current memory.
4203 * @param *obj A pointer to the Except variable.
4205 ir_node *new_Raise (ir_node *store, ir_node *obj);
4207 /** Constructor for a Bound node.
4209 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
4211 * Adds the node to the block in current_ir_block.
4213 * @param *store The current memory
4214 * @param *idx The ir_node that represents an index.
4215 * @param *lower The ir_node that represents the lower bound for the index.
4216 * @param *upper The ir_node that represents the upper bound for the index.
4218 ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
4220 /** Constructor for a Pin node.
4222 * @param *node The node which value should be pinned.
4224 ir_node *new_Pin (ir_node *node);
4226 /*---------------------------------------------------------------------*/
4227 /* The comfortable interface. */
4228 /* Supports automatic Phi node construction. */
4229 /* All routines of the block oriented interface except new_Block are */
4231 /*---------------------------------------------------------------------*/
4233 /** Create an immature block.
4235 * An immature block has an unknown number of predecessors. Predecessors
4236 * can be added with add_immBlock_pred(). Once all predecessors are
4237 * added the block must be matured.
4239 * Adds the block to the graph in current_ir_graph. Does set
4240 * current_block. Can be used with automatic Phi node construction.
4241 * This constructor can only be used if the graph is in
4244 ir_node *new_d_immBlock(dbg_info *db);
4245 ir_node *new_immBlock(void);
4247 /** Add a control flow edge to an immature block. */
4248 void add_immBlock_pred(ir_node *immblock, ir_node *jmp);
4250 /** Finalize a Block node, when all control flows are known. */
4251 void mature_immBlock(ir_node *block);
4252 #define mature_cur_block() mature_immBlock(get_cur_block());
4255 /** Get the current value of a local variable.
4257 * Use this function to obtain the last definition of the local variable
4258 * associated with pos. Pos may not exceed the value passed as n_loc
4259 * to new_ir_graph. This call automatically inserts Phi nodes.
4261 * @param *db A pointer for debug information.
4262 * @param pos The position/id of the local variable.
4263 * @param *mode The mode of the value to get.
4265 ir_node *get_d_value(dbg_info *db, int pos, ir_mode *mode);
4266 ir_node *get_value(int pos, ir_mode *mode);
4268 /** Remark a new definition of a variable.
4270 * Use this function to remember a new definition of the value
4271 * associated with pos. Pos may not exceed the value passed as n_loc
4272 * to new_ir_graph. This call is needed to automatically inserts Phi
4275 * @param pos The position/id of the local variable.
4276 * @param *value The new value written to the local variable.
4278 void set_value(int pos, ir_node *value);
4280 /** Find the value number for a node in the current block.
4282 * This function searches all values in the current block for
4283 * a given value and returns its value number if it was found, else
4285 * Note that this does not mean that the value does not exists,
4286 * it's just not equal the node (for instance behind a Phi/Confirm ...)
4288 * @param *value The value to find.
4290 int find_value(ir_node *value);
4292 /** Get the current memory state.
4294 * Use this function to obtain the last definition of the memory
4295 * state. This call automatically inserts Phi nodes for the memory
4298 ir_node *get_store(void);
4300 /** Remark a new definition of the memory state.
4302 * Use this function to remember a new definition of the memory state.
4303 * This call is needed to automatically inserts Phi nodes.
4305 * @param *store The new memory state.
4307 void set_store(ir_node *store);
4309 /** keep this node alive even if End is not control-reachable from it
4311 * @param ka The node to keep alive.
4313 void keep_alive(ir_node *ka);
4315 /** Returns the frame type of the current graph */
4316 ir_type *get_cur_frame_type(void);
4319 /* --- initialize and finalize ir construction --- */
4321 /** Puts the graph into state "phase_high" */
4322 #define irg_finalize_cons(irg) set_irg_phase_state(irg, phase_high)
4324 /** Puts the program and all graphs into state phase_high.
4326 * This also remarks, the construction of types is finished,
4327 * e.g., that no more subtypes will be added. */
4328 void irp_finalize_cons(void);
4330 /* --- Initialization --- */
4333 * This function is called, whenever a local variable is used before definition
4335 * @param irg the IR graph on which this happens
4336 * @param mode the mode of the local var
4337 * @param pos position chosen be the frontend for this variable (n_loc)
4339 * @return a firm node of mode @p mode that initializes the var at position pos
4342 * Do not return NULL!
4343 * If this function is not set, FIRM will create a const node with tarval BAD.
4344 * Use set_irg_loc_description()/get_irg_loc_description() to assign additional
4345 * informations to local variables.
4347 typedef ir_node *uninitialized_local_variable_func_t(ir_graph *irg, ir_mode *mode, int pos);