3 * File name: ir/ir/ircons.h
4 * Purpose: Various irnode constructors. Automatic construction
5 * of SSA representation.
6 * Author: Martin Trapp, Christian Schaefer
7 * Modified by: Goetz Lindenmaier, Boris Boesler
10 * Copyright: (c) 1998-2003 Universität Karlsruhe
11 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
16 Ideas for improvement:
17 -# Handle construction of exceptions more comfortable:
18 Add new constructors that pass the exception region (or better the
19 Phi for the memories, the ex. region can be found from there) as parameter,
20 constructor then adds all Proj nodes and returns the pointer
21 to the Proj node that selects the result of the arithmetic operation.
22 -# Maybe hide the exception region in a global variable, especially if
23 it is always unambiguous.
29 * documentation no more supported since 2001
31 * ir node construction.
33 * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier
35 * This file documents all datatypes and constructors needed to
36 * build a FIRM representation of a procedure. The constructors are
37 * also implemented in this file.
39 * The documentation also gives a short manual how to use the library.
41 * For extensive documentation of FIRM see UKA Techreport 1999-14.
44 * Three kinds of nodes
45 * --------------------
47 * There are three kinds of nodes known to the ir: entities,
50 * + ir_nodes are the actual nodes of the FIRM intermediate representation.
51 * They represent operations on the data of the program and control flow
54 * + entity ==> implemented in entity.h
55 * Refers to a single entity of the compiled program, e.g. a field of a
56 * class or a method. If a method or variable can not be assigned to
57 * a method or class or the like, it is a global object.
59 * + types ==> implemented in type.h
60 * With types type information is represented. There are several type
63 * Implementation of the FIRM operations: ir_node
64 * ----------------------------------------------
66 * Ir_nodes represent operations on the data of the program and control flow
67 * operations. Examples of ir_nodes: Add, Jmp, Cmp
69 * FIRM is a dataflow graph. A dataflow graph is a directed graph,
70 * so that every node has incoming and outgoing edges. A node is
71 * executable if every input at it's incoming edges is available.
72 * Execution of the dataflow graph is started at the Start node which
73 * has no incoming edges and ends when the End node executes, even if
74 * there are still executable or not executed nodes. (Is this true,
75 * or must all executable nodes be executed?) (There are exceptions
76 * to the dataflow paradigma that all inputs have to be available
77 * before a node can execute: Phi, Block. See UKA Techreport
80 * The implementation of FIRM differs from the view as a dataflow
81 * graph. To allow fast traversion of the graph edges are
82 * implemented as C-pointers. Inputs to nodes are not ambiguous, the
83 * results can be used by several other nodes. Each input can be
84 * implemented as a single pointer to a predecessor node, outputs
85 * need to be lists of pointers to successors. Therefore a node
86 * contains pointers to it's predecessor so that the implementation is a
87 * dataflow graph with reversed edges. It has to be traversed bottom
90 * All nodes of the ir have the same basic structure. They are
91 * distinguished by a field containing the opcode.
93 * The fields of an ir_node:
95 * kind A firm_kind tag containing k_ir_node. This is useful for
96 * dynamically checking the type of a node.
98 * *op This ir_op gives the opcode as a tag and a string
99 * and the number of attributes of an ir_node. There is
100 * one statically allocated struct ir_op for each opcode.
102 * *mode The ir_mode of the operation represented by this firm
103 * node. The mode of the operation is the mode of it's
104 * result. A Firm mode is a datatype as known to the target,
105 * not a type of the source language.
107 * visit A flag for traversing the ir.
109 * **in An array with pointers to the node's predecessors.
111 * *link A pointer to an ir_node. With this pointer all Phi nodes
112 * are attached to a Block, i.e., a Block points to it's
113 * first Phi node, this node points to the second Phi node
114 * in the Block and so fourth. Used in mature_immBlock
115 * to find all Phi nodes to be matured. It's also used to
116 * annotate a node with a better, optimized version of it.
118 * attr An attr struct containing the attributes of the nodes. The
119 * attributes depend on the opcode of the node. The number
120 * of these attributes is given in op.
124 * Not yet documented. See irop.h.
128 * Not yet documented. See irmode.h.
130 * GLOBAL VARIABLES -- now also fields of ir_graph.
133 * current_ir_graph Points to the current ir_graph. All constructors for
134 * nodes add nodes to this graph.
136 * ir_visited An int used as flag to traverse the ir_graph.
138 * block_visited An int used as a flag to traverse block nodes in the
141 * Others not yet documented.
145 * CONSTRUCTOR FOR IR_GRAPH --> see irgraph.h
146 * ========================
149 * PROCEDURE TO CONSTRUCT AN IR GRAPH --> see also Firm tutorial
150 * ==================================
152 * This library supplies several interfaces to construct a FIRM graph for
154 * - A "comfortable" interface generating SSA automatically. Automatically
155 * computed predecessors of nodes need not be specified in the constructors.
156 * (new_<Node> constructurs and a set of additional routines.)
157 * - A less comfortable interface where all predecessors except the block
158 * an operation belongs to need to be specified. SSA must be constructed
159 * by hand. (new_<Node> constructors and set_cur_block()). This interface
160 * is called "block oriented". It automatically calles the local optimizations
162 * - An even less comfortable interface where the block needs to be specified
163 * explicitly. This is called the "raw" interface. (new_r_<Node>
164 * constructors). These nodes are not optimized.
166 * To use the functionality of the comfortable interface correctly the Front
167 * End needs to follow certain protocols. This is explained in the following.
168 * To build a correct IR with the other interfaces study the semantics of
169 * the firm node (See tech-reprot UKA 1999-14). For the construction of
170 * types and entities see the documentation in those modules.
172 * First the Frontend needs to decide which variables and values used in
173 * a procedure can be represented by dataflow edges. These are variables
174 * that need not be saved to memory as they cause no side effects visible
175 * out of the procedure. Often these are all compiler generated
176 * variables and simple local variables of the procedure as integers,
177 * reals and pointers. The frontend has to count and number these variables.
179 * First an ir_graph needs to be constructed with new_ir_graph. The
180 * constructor gets the number of local variables. The graph is hold in the
181 * global variable irg.
183 * Now the construction of the procedure can start. Several basic blocks can
184 * be constructed in parallel, but the code within each block needs to
185 * be constructed (almost) in program order.
187 * A global variable holds the current basic block. All (non block) nodes
188 * generated are added to this block. The current block can be set with
189 * set_cur_block(block). If several blocks are constructed in parallel block
190 * switches need to be performed constantly.
192 * To generate a Block node (with the comfortable interface) it's predecessor
193 * control flow nodes need not be known. In case of cyclic control flow these
194 * can not be known when the block is constructed. With add_immBlock_pred(block,
195 * cfnode) predecessors can be added to the block. If all predecessors are
196 * added to the block mature_immBlock(b) needs to be called. Calling mature_immBlock
197 * early improves the efficiency of the Phi node construction algorithm.
198 * But if several blocks are constructed at once, mature_immBlock must only
199 * be called after performing all set_values and set_stores in the block!
200 * (See documentation of new_immBlock constructor.)
202 * The constructors of arithmetic nodes require that their predecessors
203 * are mentioned. Sometimes these are available in the Frontend as the
204 * predecessors have just been generated by the frontend. If they are local
205 * values the predecessors can be obtained from the library with a call to
206 * get_value(local_val_nr). (local_val_nr needs to be administered by
207 * the Frontend.) A call to get_value triggers the generation of Phi nodes.
208 * If an arithmetic operation produces a local value this value needs to be
209 * passed to the library by set_value(node, local_val_nr).
210 * In straight line code these two operations just remember and return the
211 * pointer to nodes producing the value. If the value passes block boundaries
212 * Phi nodes can be inserted.
213 * Similar routines exist to manage the Memory operands: set_store and
216 * Several nodes produce more than one result. An example is the Div node.
217 * Such nodes return tuples of values. From these individual values can be
218 * extracted by proj nodes.
220 * The following example illustrates the construction of a simple basic block
221 * with two predecessors stored in variables cf_pred1 and cf_pred2, containing
224 * and finally jumping to an other block. The variable a got the local_val_nr
225 * 42 by the frontend.
227 * ir_node *this_block, *cf_pred1, *cf_pred2, *a_val, *mem, *div, *res, *cf_op;
229 * this_block = new_immBlock();
230 * add_immBlock_pred(this_block, cf_pred1);
231 * add_immBlock_pred(this_block, cf_pred2);
232 * mature_immBlock(this_block);
233 * a_val = get_value(42, mode_Iu);
235 * div = new_Div(mem, a_val, a_val);
236 * mem = new_Proj(div, mode_M, 0); * for the numbers for Proj see docu *
237 * res = new_Proj(div, mode_Iu, 2);
239 * set_value(res, 42);
242 * For further information look at the documentation of the nodes and
243 * constructors and at the paragraph COPING WITH DATA OBJECTS at the
244 * end of this documentation.
246 * The comfortable interface contains the following routines further explained
249 * ir_node *new_immBlock (void);
250 * ir_node *new_Start (void);
251 * ir_node *new_End (void);
252 * ir_node *new_Jmp (void);
253 * ir_node *new_IJmp (ir_node *tgt);
254 * ir_node *new_Cond (ir_node *c);
255 * ir_node *new_Return (ir_node *store, int arity, ir_node **in);
256 * ir_node *new_Const (ir_mode *mode, tarval *con);
257 * ir_node *new_SymConst (symconst_symbol value, symconst_kind kind);
258 * ir_node *new_simpleSel (ir_node *store, ir_node *objptr, entity *ent);
259 * ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity,
260 * ir_node **in, entity *ent);
261 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity,
262 * ir_node **in, type_method *type);
263 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
264 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
265 * ir_node *new_Minus (ir_node *op, ir_mode *mode);
266 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
267 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2);
268 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
269 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2);
270 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2);
271 * ir_node *new_Abs (ir_node *op, ir_mode *mode);
272 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
273 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
274 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
275 * ir_node *new_Not (ir_node *op, ir_mode *mode);
276 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
277 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
278 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
279 * ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode);
280 * ir_node *new_Cmp (ir_node *op1, ir_node *op2);
281 * ir_node *new_Conv (ir_node *op, ir_mode *mode);
282 * ir_node *new_Cast (ir_node *op, ir_type *to_tp);
283 * ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode);
284 * ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode);
285 * ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode);
286 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
287 * ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
288 * where_alloc where);
289 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
290 * ir_type *free_type, where_alloc where);
291 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
292 * ir_node *new_NoMem (void);
293 * ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
294 * ir_node *new_Psi (int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
295 * ir_node *new_CopyB (ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
296 * ir_node *new_InstOf (ir_node *store, ir_node obj, ir_type *ent);
297 * ir_node *new_Raise (ir_node *store, ir_node *obj);
298 * ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
300 * void add_immBlock_pred (ir_node *block, ir_node *jmp);
301 * void mature_immBlock (ir_node *block);
302 * void set_cur_block (ir_node *target);
303 * ir_node *get_value (int pos, ir_mode *mode);
304 * void set_value (int pos, ir_node *value);
305 * ir_node *get_store (void);
306 * void set_store (ir_node *store);
307 * keep_alive (ir_node ka)
309 * IR_NODES AND CONSTRUCTORS FOR IR_NODES
310 * =======================================
312 * All ir_nodes are defined by a common data structure. They are distinguished
313 * by their opcode and differ in the number of their attributes.
315 * The constructor for the block node sets current_block to itself.
316 * Const nodes are always added to the start block.
317 * All other constructors add the created node to the current_block.
318 * swich_block(block) allows to set the current block to block.
320 * Watch for my inconsistent use of input and predecessor (dataflow view)
321 * and `the node points to' (implementation view).
323 * The following description of the nodes lists four properties them if these
325 * - the parameters to the constructor
326 * - the inputs of the Firm node
327 * - the outputs of the Firm node
328 * - attributes to the node
332 * ir_node *new_immBlock (void)
333 * ----------------------------
335 * Creates a new block. Sets current_block to itself. When a new block is
336 * created it cannot be known how many predecessors this block will have in the
337 * control flow graph. Therefore the list of inputs can not be fixed at
338 * creation. Predecessors can be added with add_immBlock_pred (block, control flow
339 * operation). With every added predecessor the number of inputs to Phi nodes
342 * The block can be completed by mature_immBlock(block) if all predecessors are
343 * known. If several blocks are built at once, mature_immBlock can only be called
344 * after set_value has been called for all values that are life at the end
345 * of the block. This is necessary so that Phi nodes created mature_immBlock
346 * get the right predecessors in case of cyclic dependencies. If all set_values
347 * of this block are called after maturing it and before calling get_value
348 * in some block that is control flow dependent on this block, the construction
351 * Example for faulty ir construction: (draw the graph on a paper and you'll
354 * block_before_loop = new_block();
356 * mature_immBlock(block_before_loop);
357 * before2header = new_Jmp;
359 * loop_header = new_block ();
360 * header2body - new_Jmp();
362 * loop_body = new_block ();
363 * body2header = new_Jmp();
365 * add_immBlock_pred(loop_header, before2header);
366 * add_immBlock_pred(loop_header, body2header);
367 * add_immBlock_pred(loop_body, header2body);
369 * mature_immBlock(loop_header);
370 * mature_immBlock(loop_body);
372 * get_value(loop_body, x); // gets the Phi in loop_header
373 * set_value(loop_header, x); // sets the value the above get_value should
374 * // have returned!!!
376 * Mature_immBlock also fixes the number of inputs to the Phi nodes. Mature_immBlock
377 * should be called as early as possible, as afterwards the generation of Phi
378 * nodes is more efficient.
381 * There is an input for each control flow predecessor of the block.
382 * The input points to an instruction producing an output of type X.
383 * Possible predecessors: Start, Jmp, Cond, Raise or Return or any node
384 * possibly causing an exception. (Often the real predecessors are Projs.)
386 * Mode BB (R), all nodes belonging to this block should consume this output.
387 * As they are strict (except Block and Phi node) it is a necessary condition
388 * that the block node executed before any other node in this block executes.
390 * block.matured Indicates whether the block is mature.
392 * This attribute contains all local values valid in this
393 * block. This is needed to build the Phi nodes and removed
394 * if the graph is complete. This field is used by the
395 * internal construction algorithm and should not be accessed
399 * ir_node *new_Block (int arity, ir_node **in)
400 * --------------------------------------------
402 * Creates a new Block with the given list of predecessors. This block
403 * is mature. As other constructors calls optimization and vrfy for the
404 * block. If one of the predecessors is Unknown (as it has to be filled in
405 * later) optimizations are skipped. This is necessary to
406 * construct Blocks in loops. Leaving Unknown in the Block after finishing
407 * the construction may have strange effects, especially for interprocedural
408 * representation and analysis.
411 * CONTROL FLOW OPERATIONS
412 * -----------------------
414 * In each block there must be exactly one of the control flow
415 * operations Start, End, Jmp, Cond, Return or Raise. The output of a
416 * control flow operation points to the block to be executed next.
418 * ir_node *new_Start (void)
419 * -------------------------
421 * Creates a start node. Not actually needed public. There is only one such
422 * node in each procedure which is automatically created by new_ir_graph.
425 * No inputs except the block it belogns to.
427 * A tuple of 4 (5, 6) distinct values. These are labeled by the following
428 * projection numbers (pn_Start):
429 * * pn_Start_X_initial_exec mode X, points to the first block to be exe * cuted.
430 * * pn_Start_M mode M, the global store
431 * * pn_Start_P_frame_base mode P, a pointer to the base of the proce * dures stack frame.
432 * * pn_Start_P_globals mode P, a pointer to the part of the memory * containing_all_ global things.
433 * * pn_Start_T_args mode T, a tuple containing all arguments of * the procedure.
436 * ir_node *new_End (void)
437 * -----------------------
439 * Creates an end node. Not actually needed public. There is only one such
440 * node in each procedure which is automatically created by new_ir_graph.
443 * No inputs except the block it belongs to.
447 * ir_node *new_Jmp (void)
448 * -----------------------
450 * Creates a Jmp node.
453 * The block the node belongs to
455 * Control flow to the next block.
457 * ir_node *new_IJmp (ir_node *tgt)
458 * -----------------------
460 * Creates an IJmp node.
463 * The node that represents the target jump address
465 * Control flow to an unknown target, must be pinned by
468 * ir_node *new_Cond (ir_node *c)
469 * ------------------------------
471 * Creates a Cond node. There are two versions of this node.
477 * A tuple of two control flows. The first is taken if the input is
478 * false, the second if it is true.
482 * A value of mode I_u. (i)
484 * A tuple of n control flows. If the Cond's input is i, control
485 * flow will procede along output i. If the input is >= n control
486 * flow proceeds along output n.
488 * ir_node *new_Return (ir_node *store, int arity, ir_node **in)
489 * -------------------------------------------------------------
491 * The return node has as inputs the results of the procedure. It
492 * passes the control flow to the end_block.
498 * Control flow to the end block.
502 * ir_node *new_Const (ir_mode *mode, tarval *con)
503 * -----------------------------------------------
505 * Creates a constant in the constant table and adds a Const node
506 * returning this value to the start block.
509 * *mode The mode of the constant.
510 * *con Points to an entry in the constant table.
511 * This pointer is added to the attributes of
512 * the node (self->attr.con)
514 * No inputs except the block it belogns to.
516 * The constant value.
518 * attr.con A tarval* pointer to the proper entry in the constant
521 * ir_node *new_SymConst (union symconst_symbol value, symconst_addr_ent kind)
522 * ---------------------------------------------------------------------------
524 * There are three kinds of symbolic constants:
525 * symconst_type_tag The symbolic constant represents a type tag.
526 * symconst_type_size The symbolic constant represents the size of a type.
527 * symconst_type_align The symbolic constant represents the alignment of a type.
528 * symconst_addr_name Information for the linker, e.g. the name of a global
530 * symconst_addr_name The symbolic constant represents the address of an entity.
532 * To represent a pointer to an entity that is represented by an entity
533 * datastructure don't use
534 * new_SymConst((type_or_id*)get_entity_ld_ident(ent), symconst_addr_name);.
535 * Use a real const instead:
536 * new_SymConst(ent, symconst_addr_ent);
537 * This makes the Constant independent of name changes of the entity due to
541 * kind The kind of the symbolic constant: type_tag, size or link_info.
542 * *type_or_id Points to the type the tag stands for or to the type
543 * whose size is represented by the constant or to an ident
544 * representing the linkage info.
547 * No inputs except the block it belogns to.
549 * An unsigned integer (I_u) or a pointer (P).
552 * attr.i.num The symconst_addr_ent, i.e. one of
554 * -symconst_type_size
555 * -symconst_type_align
556 * -symconst_addr_name
558 * If the attr.i.num is symconst_type_tag, symconst_type_size or symconst_type_align,
559 * the node contains an attribute:
561 * attr.i.*type, a pointer to a type_class. The mode of the node is mode_Is.
562 * if it is linkage_ptr_info it contains
563 * attr.i.*ptrinfo, an ident holding information for the linker. The mode
564 * of the node is mode_P_mach.
568 * ir_node *new_simpleSel (ir_node *store, ir_node *frame, entity *sel)
569 * --------------------------------------------------------------------
572 * Selects an entity from a compound type. This entity can be a field or
576 * *store The memory in which the object the entity should be selected
578 * *frame The pointer to the object.
579 * *sel The entity to select.
582 * The memory containing the object.
583 * A pointer to the object.
584 * An unsigned integer.
586 * A pointer to the selected entity.
588 * attr.sel Pointer to the entity
591 * ir_node *new_Sel (ir_node *store, ir_node *frame, int arity, ir_node **in,
592 * --------------------------------------------------------------------------
596 * Selects a field from an array type. The entity has as owner the array, as
597 * type the arrays element type. The indices to access an array element are
601 * *store The memory in which the object the entity should be selected from
603 * *frame The pointer to the object.
604 * *arity number of array indices.
605 * *in array with index inputs to the node.
606 * *sel The entity to select.
609 * The memory containing the object.
610 * A pointer to the object.
611 * As much unsigned integer as there are array expressions.
613 * A pointer to the selected entity.
615 * attr.sel Pointer to the entity
617 * The constructors new_Sel and new_simpleSel generate the same ir nodes.
618 * simpleSel just sets the arity of the index inputs to zero.
621 * ARITHMETIC OPERATIONS
622 * ---------------------
624 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node **in,
625 * ----------------------------------------------------------------------------
629 * Creates a procedure call.
632 * *store The actual store.
633 * *callee A pointer to the called procedure.
634 * arity The number of procedure parameters.
635 * **in An array with the pointers to the parameters.
636 * The constructor copies this array.
637 * *type Type information of the procedure called.
640 * The store, the callee and the parameters.
642 * A tuple containing the eventually changed store and the procedure
645 * attr.call Contains the type information for the procedure.
648 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode)
649 * ------------------------------------------------------------
653 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode)
654 * ------------------------------------------------------------
658 * ir_node *new_Minus (ir_node *op, ir_mode *mode)
659 * -----------------------------------------------
661 * Unary Minus operations on integer and floating point values.
663 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode)
664 * ------------------------------------------------------------
668 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2)
669 * --------------------------------------------------------------
671 * Quot performs exact division of floating point numbers. It's mode
672 * is Tuple, the mode of the result must be annotated to the Proj
673 * that extracts the result of the arithmetic operations.
676 * The store needed to model exceptions and the two operands.
678 * A tuple contaning a memory and a execution for modeling exceptions
679 * and the result of the arithmetic operation.
681 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2)
682 * ----------------------------------------------------------------
684 * Performs Div and Mod on interger values.
687 * A tuple contaning a memory and a execution for modeling exceptions
688 * and the two result of the arithmetic operations.
690 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2)
691 * -------------------------------------------------------------
695 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2)
696 * -------------------------------------------------------------
700 * ir_node *new_Abs (ir_node *op, ir_mode *mode)
701 * ---------------------------------------------
705 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode)
706 * ------------------------------------------------------------
710 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode)
711 * -----------------------------------------------------------
715 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode)
716 * ------------------------------------------------------------
720 * ir_node *new_Not (ir_node *op, ir_mode *mode)
721 * ---------------------------------------------
723 * This node constructs a constant where all bits are set to one
724 * and a Eor of this constant and the operator. This simulates a
727 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode)
728 * ---------------------------------------------------------
732 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode)
733 * ---------------------------------------------------------
735 * Logic shift right, i.e., zero extended.
738 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode)
739 * ----------------------------------------------------------
741 * Arithmetic shift right, i.e., sign extended.
743 * ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode)
744 * ---------------------------------------------------------
746 * Rotates the operand to the (right??) by k bits.
748 * ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode)
749 * ------------------------------------------------------------
751 * Calculates the Carry value for integer addition. Used only
754 * ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode)
755 * ------------------------------------------------------------
757 * Calculates the Borrow value for integer substraction. Used only
760 * ir_node *new_Conv (ir_node *op, ir_mode *mode)
761 * ---------------------------------------------
763 * Mode conversion. For allowed conversions see UKA Tech Report
766 * ir_node *new_Cmp (ir_node *op1, ir_node *op2)
767 * ---------------------------------------------
770 * The two values to be compared.
772 * A 16-tuple containing the results of the 16 different comparisons.
773 * The following is a list giving the comparisons and a projection
774 * number (pn_Cmp) to use in Proj nodes to extract the proper result.
778 * pn_Cmp_Le less or equal
780 * pn_Cmp_Ge greater of equal
781 * pn_Cmp_Lg less or greater
782 * pn_Cmp_Leg less, equal or greater = ordered
783 * pn_Cmp_Uo unordered
784 * pn_Cmp_Ue unordered or equal
785 * pn_Cmp_Ul unordered or less
786 * pn_Cmp_Ule unordered, less or equal
787 * pn_Cmp_Ug unordered or greater
788 * pn_Cmp_Uge unordered, greater or equal
789 * pn_Cmp_Ne unordered, less or greater = not equal
796 * In general, Phi nodes are automaitcally inserted. In some cases, if
797 * all predecessors of a block are known, an explicit Phi node constructor
798 * is needed. E.g., to construct a FIRM graph for a statement as
799 * a = (b==c) ? 2 : 5;
801 * ir_node *new_Phi (int arity, ir_node **in, ir_mode *mode)
802 * ---------------------------------------------------------
804 * Creates a Phi node. The in's order has to correspond to the order
805 * of in's of current_block. This is not checked by the library!
806 * If one of the predecessors is Unknown (as it has to be filled in
807 * later) optimizations are skipped. This is necessary to
808 * construct Phi nodes in loops. Leaving Unknown in the Phi after finishing
809 * the construction may have strange effects, especially for interprocedural
810 * representation and analysis.
813 * arity number of predecessors
814 * **in array with predecessors
815 * *mode The mode of it's inputs and output.
817 * A Phi node has as many inputs as the block it belongs to.
818 * Each input points to a definition of the same value on a
819 * different path in the control flow.
821 * The definition valid in this block.
823 * ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode)
824 * -----------------------------------------------------------------------------
826 * Creates a Mux node. This node implements the following semantic:
827 * If the sel node (which must be of mode_b) evaluates to true, its value is
828 * ir_true, else ir_false;
831 * ir_node *new_Psi (int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode)
832 * -----------------------------------------------------------------------------
834 * Creates a Psi node. This node implements the following semantic:
838 * OPERATIONS TO MANAGE MEMORY EXPLICITLY
839 * --------------------------------------
841 * ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode)
842 * ----------------------------------------------------------------
844 * The Load operation reads a value from memory.
847 * *store The current memory.
848 * *addr A pointer to the variable to be read in this memory.
849 * *mode The mode of the value to be loaded.
852 * The memory and a pointer to a variable in this memory.
854 * A tuple of the memory, a control flow to be taken in case of
855 * an exception and the loaded value.
857 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val)
858 * ----------------------------------------------------------------
860 * The Store operation writes a value to a variable in memory.
863 * The memory, a pointer to a variable in this memory and the value
864 * to write to this variable.
866 * A tuple of the changed memory and a control flow to be taken in
867 * case of an exception.
869 * ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
870 * -----------------------------------------------------------------------
874 * The Alloc node allocates a new variable. It can be specified whether the
875 * variable should be allocated to the stack or to the heap.
878 * *store The memory which shall contain the new variable.
879 * ** *size The number of bytes to allocate. Old. **
880 * *size We decided that the size easily can be derived from the type.
881 * This field is for allocating arrays, i.e., it gives the multiple
882 * of the size of alloc_type to allocate memory for.
883 * *alloc_type The type of the allocated variable.
884 * where Where to allocate the variable, either heap_alloc or stack_alloc.
887 * A memory and an unsigned integer.
889 * A tuple of the changed memory, a control flow to be taken in
890 * case of an exception and the pointer to the new variable.
892 * a.where Indicates where the variable is allocated.
893 * a.*type A pointer to the class the allocated data object
896 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size, ir_type *free_type,
897 * -----------------------------------------------------------------------------------
901 * The Free node frees memory of the given variable.
904 * *store The memory which shall contain the new variable.
905 * *ptr The pointer to the object to free.
906 * *size The number of objects of type free_type to free in a sequence.
907 * *free_type The type of the freed variable.
908 * where Where the variable was allocated, either heap_alloc or stack_alloc.
911 * A memory, a pointer and an unsigned integer.
913 * The changed memory.
915 * f.*type A pointer to the type information of the freed data object.
919 * ir_node *new_Sync (int arity, ir_node **in)
920 * -------------------------------------------
922 * The Sync operation unifies several partial memory blocks. These blocks
923 * have to be pairwise disjunct or the values in common locations have to
924 * be identical. This operation allows to specify all operations that eventually
925 * need several partial memory blocks as input with a single entrance by
926 * unifying the memories with a preceding Sync operation.
929 * arity The number of memories to synchronize.
930 * **in An array of pointers to nodes that produce an output of
935 * The unified memory.
941 * ir_node *new_Bad (void)
942 * -----------------------
944 * Returns the unique Bad node current_ir_graph->bad.
945 * This node is used to express results of dead code elimination.
947 * ir_node *new_NoMem (void)
948 * -----------------------------------------------------------------------------------
950 * Returns the unique NoMem node current_ir_graph->no_mem.
951 * This node is used as input for operations that need a Memory, but do not
952 * change it like Div by const != 0, analyzed calls etc.
954 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj)
955 * ----------------------------------------------------------
957 * Selects one entry of a tuple. This is a hidden edge with attributes.
960 * *arg A node producing a tuple.
961 * *mode The mode of the value to project.
962 * proj The position of the value in the tuple.
968 * ir_node *new_Tuple (int arity, ir_node **in)
969 * --------------------------------------------
971 * Builds a Tuple from single values. This is needed to implement
972 * optimizations that remove a node that produced a tuple. The node can be
973 * replaced by the Tuple operation so that the following Proj nodes have not to
974 * be changed. (They are hard to find due to the implementation with pointers
975 * in only one direction.) The Tuple node is smaller than any other
976 * node, so that a node can be changed into a Tuple by just changing it's
977 * opcode and giving it a new in array.
980 * arity The number of tuple elements.
981 * **in An array containing pointers to the nodes producing the
984 * ir_node *new_Id (ir_node *val, ir_mode *mode)
985 * ---------------------------------------------
987 * The single output of the Id operation is it's input. Also needed
991 * HIGH LEVEL OPERATIONS
992 * ---------------------
994 * ir_node *new_CopyB (ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type)
995 * -----------------------------------------------------------------------------------
997 * Describes a high level block copy of a compound type from address src to
998 * address dst. Must be lowered to a Call to a runtime memory copy function.
1001 * HIGH LEVEL OPERATIONS: Exception Support
1002 * ----------------------------------------
1003 * See TechReport 1999-14, chapter Exceptions.
1005 * ir_node *new_InstOf(ir_node *store, ir_node *ptr, ir_type *type);
1006 * -----------------------------------------------------------------------------------
1008 * Describes a high level type check. Must be lowered to a Call to a runtime check
1011 * ir_node *new_Raise (ir_node *store, ir_node *obj)
1012 * -------------------------------------------------
1014 * Raises an exception. Unconditional change of control flow. Writes
1015 * an explicit Except variable to memory to pass it to the exception
1016 * handler. Must be lowered to a Call to a runtime check
1021 * A pointer to the Except variable.
1023 * A tuple of control flow and the changed memory state. The control flow
1024 * points to the exception handler if it is definied in this procedure,
1025 * else it points to the end_block.
1027 * ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
1028 * -----------------------------------------------------------------------------------
1030 * Describes a high level bounds check. Must be lowered to a Call to a runtime check
1034 * COPING WITH DATA OBJECTS
1035 * ========================
1037 * Two kinds of data objects have to be distinguished for generating
1038 * FIRM. First there are local variables other than arrays that are
1039 * known to be alias free. Second there are all other data objects.
1040 * For the first a common SSA representation is built, the second
1041 * are modeled by saving them to memory. The memory is treated as
1042 * a single local variable, the alias problem is hidden in the
1043 * content of this variable.
1045 * All values known in a Block are listed in the block's attribute,
1046 * block.**graph_arr which is used to automatically insert Phi nodes.
1047 * The following two funcions can be used to add a newly computed value
1048 * to the array, or to get the producer of a value, i.e., the current
1051 * inline void set_value (int pos, ir_node *value)
1052 * -----------------------------------------------
1054 * Has to be called for every assignment to a local variable. It
1055 * adds the value to the array of used values at position pos. Pos
1056 * has to be a unique identifier for an entry in the procedure's
1057 * definition table. It can be used to access the value again.
1058 * Requires current_block to be set correctly.
1060 * ir_node *get_value (int pos, ir_mode *mode)
1061 * -------------------------------------------
1063 * Returns the node defining the value referred to by pos. If the
1064 * value is not defined in this block a Phi node is generated and
1065 * all definitions reaching this Phi node are collected. It can
1066 * happen that the algorithm allocates an unnecessary Phi node,
1067 * e.g. if there is only one definition of this value, but this
1068 * definition reaches the currend block on several different
1069 * paths. This Phi node will be eliminated if optimizations are
1070 * turned on right after it's creation.
1071 * Requires current_block to be set correctly.
1073 * There are two special routines for the global store:
1075 * void set_store (ir_node *store)
1076 * -------------------------------
1078 * Adds the store to the array of known values at a reserved
1080 * Requires current_block to be set correctly.
1082 * ir_node *get_store (void)
1083 * -------------------------
1085 * Returns the node defining the actual store.
1086 * Requires current_block to be set correctly.
1089 * inline void keep_alive (ir_node *ka)
1090 * ------------------------------------
1092 * Keep this node alive because it is (might be) not in the control
1093 * flow from Start to End. Adds the node to the list in the end
1097 #ifndef _FIRM_IR_IRCONS_H_
1098 #define _FIRM_IR_IRCONS_H_
1100 #include "firm_common.h"
1102 #include "irgraph.h"
1103 #include "dbginfo.h"
1105 /*-------------------------------------------------------------------------*/
1106 /* The raw interface */
1107 /*-------------------------------------------------------------------------*/
1109 /** Constructor for a Block node.
1111 * Constructs a mature block with the given predecessors. Use Unknown
1112 * nodes as predecessors to construct a block if the number of
1113 * predecessors is known, but not the predecessors themselves. This
1114 * constructor does not set current_block. It not be used with
1115 * automatic Phi node construction.
1117 * @param *db A Pointer for debug information.
1118 * @param irg The ir graph the block belongs to.
1119 * @param arity The number of control predecessors.
1120 * @param in[] An array of control predecessors. The length of
1121 * the array must be 'arity'. The constructor copies this array.
1123 ir_node *new_rd_Block (dbg_info *db, ir_graph *irg, int arity, ir_node *in[]);
1125 /** Constructor for a Start node.
1127 * @param *db A pointer for debug information.
1128 * @param *irg The ir graph the node belongs to.
1129 * @param *block The ir block the node belongs to.
1131 ir_node *new_rd_Start (dbg_info *db, ir_graph *irg, ir_node *block);
1133 /** Constructor for a End node.
1135 * @param *db A pointer for debug information.
1136 * @param *irg The ir graph the node belongs to.
1137 * @param *block The ir block the node belongs to.
1139 ir_node *new_rd_End (dbg_info *db, ir_graph *irg, ir_node *block);
1141 /** Constructor for a Jmp node.
1143 * Jmp represents control flow to a single control successor.
1145 * @param *db A pointer for debug information.
1146 * @param *irg The ir graph the node belongs to.
1147 * @param *block The ir block the node belongs to.
1149 ir_node *new_rd_Jmp (dbg_info *db, ir_graph *irg, ir_node *block);
1151 /** Constructor for an IJmp node.
1153 * IJmp represents control flow to a single control successor not
1154 * statically known i.e. an indirect Jmp.
1156 * @param *db A pointer for debug information.
1157 * @param *irg The ir graph the node belongs to.
1158 * @param *block The ir block the node belongs to.
1159 * @param *tgt The ir node representing the target address.
1161 ir_node *new_rd_IJmp (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *tgt);
1163 /** Constructor for a Break node.
1165 * Break represents control flow to a single control successor just as Jmp.
1166 * The blocks separated by a break may not be concatenated by an optimization.
1167 * It is used for the interprocedural representation where blocks are parted
1168 * behind Call nodes to represent the control flow to called procedures.
1170 * @param *db A pointer for debug information.
1171 * @param *irg The ir graph the node belong to.
1172 * @param *block The block the node belong to.
1174 ir_node *new_rd_Break (dbg_info *db, ir_graph *irg, ir_node *block);
1176 /** Constructor for a Cond node.
1178 * If c is mode_b represents a conditional branch (if/else). If c is
1179 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
1180 * node, default Proj is 0.)
1182 * This is not consistent: Input to Cond is Is, Proj has as proj number
1185 * @param *db A pointer for debug information.
1186 * @param *irg The ir graph the node belongs to.
1187 * @param *block The ir block the node belongs to.
1188 * @param *c The conditions parameter. Can be of mode b or I_u.
1190 ir_node *new_rd_Cond (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *c);
1192 /** Constructor for a Return node.
1194 * Returns the memory an zero or more return values. Only node that
1195 * can end regular control flow.
1197 * @param *db A pointer for debug information.
1198 * @param *irg The ir graph the node belongs to.
1199 * @param *block The ir block the node belongs to.
1200 * @param *store The state of memory.
1201 * @param arity Number of return values.
1202 * @param *in Array of length arity with return values. The constructor copies this array.
1204 ir_node *new_rd_Return (dbg_info *db, ir_graph *irg, ir_node *block,
1205 ir_node *store, int arity, ir_node *in[]);
1207 /** Constructor for a Const_type node.
1209 * The constant represents a target value. This constructor sets high
1210 * level type information for the constant value.
1212 * @param *db A pointer for debug information.
1213 * @param *irg The ir graph the node belongs to.
1214 * @param *block The ir block the node belongs to.
1215 * @param *mode The mode of the operands and results.
1216 * @param *con Points to an entry in the constant table.
1217 * @param *tp The type of the constant.
1219 ir_node *new_rd_Const_type (dbg_info *db, ir_graph *irg, ir_node *block,
1220 ir_mode *mode, tarval *con, ir_type *tp);
1222 /** Constructor for a Const node.
1224 * Constructor for a Const node. The constant represents a target
1225 * value. Sets the type information to type_unknown. (No more
1226 * supported: If tv is entity derives a somehow useful type.)
1228 * @param *db A pointer for debug information.
1229 * @param *irg The ir graph the node belongs to.
1230 * @param *block The ir block the node belongs to.
1231 * @param *mode The mode of the operands and results.
1232 * @param *con Points to an entry in the constant table.
1234 ir_node *new_rd_Const (dbg_info *db, ir_graph *irg, ir_node *block,
1235 ir_mode *mode, tarval *con);
1237 /** Constructor for a SymConst_type node.
1239 * This is the constructor for a symbolic constant.
1240 * There are four kinds of symbolic constants:
1241 * - type_tag The symbolic constant represents a type tag. The type the
1242 * tag stands for is given explicitly.
1243 * - type_size The symbolic constant represents the size of a type. The
1244 * type of which the constant represents the size is given
1246 * - type_align The symbolic constant represents the alignment of a type. The
1247 * type of which the constant represents the size is given
1249 * - addr_name The symbolic constant represents the address of an entity
1250 * (variable or method). The variable is indicated by a name
1251 * that is valid for linking.
1252 * - addr_ent The symbolic constant represents the address of an entity
1253 * (variable or method). The variable is given explicitly by
1256 * Inputs to the node:
1257 * No inputs except the block it belongs to.
1258 * Outputs of the node.
1259 * An unsigned integer (I_u) or a pointer (P).
1261 * Mention union in declaration so that the firmjni generator recognizes that
1262 * it can not cast the argument to an int.
1264 * @param *db A pointer for debug information.
1265 * @param *irg The ir graph the node belongs to.
1266 * @param *block The ir block the node belongs to.
1267 * @param symkind The kind of the symbolic constant: type_tag, size, addr_name or addr_ent.
1268 * @param value A type, entity or a ident depending on the SymConst kind.
1269 * @param tp The source type of the constant.
1271 ir_node *new_rd_SymConst_type (dbg_info *db, ir_graph *irg, ir_node *block, union symconst_symbol value,
1272 symconst_kind symkind, ir_type *tp);
1274 /** Constructor for a SymConst node.
1276 * Same as new_rd_SymConst_type, except that it sets the type to type_unknown. */
1277 ir_node *new_rd_SymConst (dbg_info *db, ir_graph *irg, ir_node *block,
1278 union symconst_symbol value, symconst_kind symkind);
1280 /** Constructor for a SymConst addr_ent node.
1282 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1283 * symconst_addr_ent.
1284 * Adds the SymConst to the start block of irg. */
1285 ir_node *new_rd_SymConst_addr_ent (dbg_info *db, ir_graph *irg, entity *symbol, ir_type *tp);
1287 /** Constructor for a SymConst addr_name node.
1289 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1290 * symconst_addr_ent.
1291 * Adds the SymConst to the start block of irg. */
1292 ir_node *new_rd_SymConst_addr_name (dbg_info *db, ir_graph *irg, ident *symbol, ir_type *tp);
1294 /** Constructor for a SymConst type_tag node.
1296 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1297 * symconst_addr_ent.
1298 * Adds the SymConst to the start block of irg. */
1299 ir_node *new_rd_SymConst_type_tag (dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp);
1301 /** Constructor for a SymConst size node.
1303 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1304 * symconst_type_size.
1305 * Adds the SymConst to the start block of irg. */
1306 ir_node *new_rd_SymConst_size (dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp);
1308 /** Constructor for a SymConst size node.
1310 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1311 * symconst_type_align.
1312 * Adds the SymConst to the start block of irg. */
1313 ir_node *new_rd_SymConst_align (dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp);
1315 /** Constructor for a simpleSel node.
1317 * This is a shortcut for the new_rd_Sel() constructor. To be used for
1318 * Sel nodes that do not select from an array, i.e., have no index
1319 * inputs. It adds the two parameters 0, NULL.
1321 * @param *db A pointer for debug information.
1322 * @param *irg The ir graph the node belongs to.
1323 * @param *block The ir block the node belongs to.
1324 * @param *store The memory in which the object the entity should be
1325 * selected from is allocated.
1326 * @param *objptr The object from that the Sel operation selects a
1327 * single attribute out.
1328 * @param *ent The entity to select.
1330 ir_node *new_rd_simpleSel (dbg_info *db, ir_graph *irg, ir_node *block,
1331 ir_node *store, ir_node *objptr, entity *ent);
1333 /** Constructor for a Sel node.
1335 * The select node selects an entity (field or method) from an entity
1336 * with a compound type. It explicitly specifies the entity selected.
1337 * Dynamically the node may select entities that overwrite the given
1338 * entity. If the selected entity is an array element entity the Sel
1339 * node takes the required array indices as inputs.
1341 * @param *db A pointer for debug information.
1342 * @param *irg The ir graph the node belongs to.
1343 * @param *block The ir block the node belongs to.
1344 * @param *store The memory in which the object the entity should be selected
1345 * from is allocated.
1346 * @param *objptr A pointer to a compound entity the Sel operation selects a
1347 * single attribute from.
1348 * @param *n_index The number of array indices needed to select an array element entity.
1349 * @param *index[] If the compound entity is an array the indices of the selected
1350 * element entity. The constructor copies this array.
1351 * @param *ent The entity to select.
1353 ir_node *new_rd_Sel (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1354 ir_node *objptr, int n_index, ir_node *index[], entity *ent);
1356 /** Constructor for a Call node.
1358 * Represents all kinds of method and function calls.
1360 * @param *db A pointer for debug information.
1361 * @param *irg The ir graph the node belongs to.
1362 * @param *block The ir block the node belongs to.
1363 * @param *store The current memory state.
1364 * @param *callee A pointer to the called procedure.
1365 * @param arity The number of procedure parameters.
1366 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1367 * @param *tp Type information of the procedure called.
1369 ir_node *new_rd_Call (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1370 ir_node *callee, int arity, ir_node *in[], ir_type *tp);
1372 /** Constructor for a Add node.
1374 * @param *db A pointer for debug information.
1375 * @param *irg The ir graph the node belongs to.
1376 * @param *block The ir block the node belongs to.
1377 * @param *op1 The first operand.
1378 * @param *op2 The second operand.
1379 * @param *mode The mode of the operands and the result.
1381 ir_node *new_rd_Add (dbg_info *db, ir_graph *irg, ir_node *block,
1382 ir_node *op1, ir_node *op2, ir_mode *mode);
1384 /** Constructor for a Sub node.
1386 * @param *db A pointer for debug information.
1387 * @param *irg The ir graph the node belongs to.
1388 * @param *block The ir block the node belongs to.
1389 * @param *op1 The first operand.
1390 * @param *op2 The second operand.
1391 * @param *mode The mode of the operands and the result.
1393 ir_node *new_rd_Sub (dbg_info *db, ir_graph *irg, ir_node *block,
1394 ir_node *op1, ir_node *op2, ir_mode *mode);
1396 /** Constructor for a Minus node.
1398 * @param *db A pointer for debug information.
1399 * @param *irg The ir graph the node belongs to.
1400 * @param *block The ir block the node belongs to.
1401 * @param *op The operand .
1402 * @param *mode The mode of the operand and the result.
1404 ir_node *new_rd_Minus (dbg_info *db, ir_graph *irg, ir_node *block,
1405 ir_node *op, ir_mode *mode);
1407 /** Constructor for a Mul node.
1409 * @param *db A pointer for debug information.
1410 * @param *irg The ir graph the node belongs to.
1411 * @param *block The ir block the node belongs to.
1412 * @param *op1 The first operand.
1413 * @param *op2 The second operand.
1414 * @param *mode The mode of the operands and the result.
1416 ir_node *new_rd_Mul (dbg_info *db, ir_graph *irg, ir_node *block,
1417 ir_node *op1, ir_node *op2, ir_mode *mode);
1419 /** Constructor for a Quot node.
1421 * @param *db A pointer for debug information.
1422 * @param *irg The ir graph the node belongs to.
1423 * @param *block The ir block the node belongs to.
1424 * @param *memop The store needed to model exceptions
1425 * @param *op1 The first operand.
1426 * @param *op2 The second operand.
1428 ir_node *new_rd_Quot (dbg_info *db, ir_graph *irg, ir_node *block,
1429 ir_node *memop, ir_node *op1, ir_node *op2);
1431 /** Constructor for a DivMod node.
1433 * @param *db A pointer for debug information.
1434 * @param *irg The ir graph the node belongs to.
1435 * @param *block The ir block the node belongs to.
1436 * @param *memop The store needed to model exceptions
1437 * @param *op1 The first operand.
1438 * @param *op2 The second operand.
1440 ir_node *new_rd_DivMod (dbg_info *db, ir_graph *irg, ir_node *block,
1441 ir_node *memop, ir_node *op1, ir_node *op2);
1443 /** Constructor for a Div node.
1445 * @param *db A pointer for debug information.
1446 * @param *irg The ir graph the node belongs to.
1447 * @param *block The ir block the node belongs to.
1448 * @param *memop The store needed to model exceptions
1449 * @param *op1 The first operand.
1450 * @param *op2 The second operand.
1452 ir_node *new_rd_Div (dbg_info *db, ir_graph *irg, ir_node *block,
1453 ir_node *memop, ir_node *op1, ir_node *op2);
1455 /** Constructor for a Mod node.
1457 * @param *db A pointer for debug information.
1458 * @param *irg The ir graph the node belongs to.
1459 * @param *block The ir block the node belongs to.
1460 * @param *memop The store needed to model exceptions
1461 * @param *op1 The first operand.
1462 * @param *op2 The second operand.
1464 ir_node *new_rd_Mod (dbg_info *db, ir_graph *irg, ir_node *block,
1465 ir_node *memop, ir_node *op1, ir_node *op2);
1467 /** Constructor for a Abs node.
1469 * @param *db A pointer for debug information.
1470 * @param *irg The ir graph the node belongs to.
1471 * @param *block The ir block the node belongs to.
1472 * @param *op The operand
1473 * @param *mode The mode of the operands and the result.
1475 ir_node *new_rd_Abs (dbg_info *db, ir_graph *irg, ir_node *block,
1476 ir_node *op, ir_mode *mode);
1478 /** Constructor for a And node.
1480 * @param *db A pointer for debug information.
1481 * @param *irg The ir graph the node belongs to.
1482 * @param *block The ir block the node belongs to.
1483 * @param *op1 The first operand.
1484 * @param *op2 The second operand.
1485 * @param *mode The mode of the operands and the result.
1487 ir_node *new_rd_And (dbg_info *db, ir_graph *irg, ir_node *block,
1488 ir_node *op1, ir_node *op2, ir_mode *mode);
1490 /** Constructor for a Or node.
1492 * @param *db A pointer for debug information.
1493 * @param *irg The ir graph the node belongs to.
1494 * @param *block The ir block the node belongs to.
1495 * @param *op1 The first operand.
1496 * @param *op2 The second operand.
1497 * @param *mode The mode of the operands and the result.
1499 ir_node *new_rd_Or (dbg_info *db, ir_graph *irg, ir_node *block,
1500 ir_node *op1, ir_node *op2, ir_mode *mode);
1502 /** Constructor for a Eor node.
1504 * @param *db A pointer for debug information.
1505 * @param *irg The ir graph the node belongs to.
1506 * @param *block The ir block the node belongs to.
1507 * @param *op1 The first operand.
1508 * @param *op2 The second operand.
1509 * @param *mode The mode of the operands and the results.
1511 ir_node *new_rd_Eor (dbg_info *db, ir_graph *irg, ir_node *block,
1512 ir_node *op1, ir_node *op2, ir_mode *mode);
1514 /** Constructor for a Not node.
1516 * @param *db A pointer for debug information.
1517 * @param *irg The ir graph the node belongs to.
1518 * @param *block The ir block the node belongs to.
1519 * @param *op The operand.
1520 * @param *mode The mode of the operand and the result.
1522 ir_node *new_rd_Not (dbg_info *db, ir_graph *irg, ir_node *block,
1523 ir_node *op, ir_mode *mode);
1525 /** Constructor for a Cmp node.
1527 * @param *db A pointer for debug information.
1528 * @param *irg The ir graph the node belongs to.
1529 * @param *block The ir block the node belongs to.
1530 * @param *op1 The first operand.
1531 * @param *op2 The second operand.
1533 ir_node *new_rd_Cmp (dbg_info *db, ir_graph *irg, ir_node *block,
1534 ir_node *op1, ir_node *op2);
1536 /** Constructor for a Shl node.
1538 * @param *db A pointer for debug information.
1539 * @param *irg The ir graph the node belongs to.
1540 * @param *block The ir block the node belongs to.
1541 * @param *op The operand.
1542 * @param *k The number of bits to shift the operand .
1543 * @param *mode The mode of the operand and the result.
1545 ir_node *new_rd_Shl (dbg_info *db, ir_graph *irg, ir_node *block,
1546 ir_node *op, ir_node *k, ir_mode *mode);
1548 /** Constructor for a Shr node.
1550 * @param *db A pointer for debug information.
1551 * @param *irg The ir graph the node belongs to.
1552 * @param *block The ir block the node belongs to.
1553 * @param *op The operand.
1554 * @param *k The number of bits to shift the operand .
1555 * @param *mode The mode of the operand and the result.
1557 ir_node *new_rd_Shr (dbg_info *db, ir_graph *irg, ir_node *block,
1558 ir_node *op, ir_node *k, ir_mode *mode);
1560 /** Constructor for a Shrs node.
1562 * @param *db A pointer for debug information.
1563 * @param *irg The ir graph the node belongs to.
1564 * @param *block The ir block the node belongs to.
1565 * @param *op The operand.
1566 * @param *k The number of bits to shift the operand.
1567 * @param *mode The mode of the operand and the result.
1569 ir_node *new_rd_Shrs (dbg_info *db, ir_graph *irg, ir_node *block,
1570 ir_node *op, ir_node *k, ir_mode *mode);
1572 /** Constructor for a Rot node.
1574 * @param *db A pointer for debug information.
1575 * @param *irg The ir graph the node belongs to.
1576 * @param *block The ir block the node belongs to.
1577 * @param *op The operand.
1578 * @param *k The number of bits to rotate the operand.
1579 * @param *mode The mode of the operand.
1581 ir_node *new_rd_Rot (dbg_info *db, ir_graph *irg, ir_node *block,
1582 ir_node *op, ir_node *k, ir_mode *mode);
1585 /** Constructor for a Conv node.
1587 * @param *db A pointer for debug information.
1588 * @param *irg The ir graph the node belongs to.
1589 * @param *block The ir block the node belongs to.
1590 * @param *op The operand.
1591 * @param *mode The mode of this the operand muss be converted .
1593 ir_node *new_rd_Conv (dbg_info *db, ir_graph *irg, ir_node *block,
1594 ir_node *op, ir_mode *mode);
1596 /** Constructor for a Cast node.
1598 * High level type cast.
1600 * @param *db A pointer for debug information.
1601 * @param *irg The ir graph the node belongs to.
1602 * @param *block The ir block the node belongs to.
1603 * @param *op The operand.
1604 * @param *to_tp The type of this the operand muss be casted .
1606 ir_node *new_rd_Cast (dbg_info *db, ir_graph *irg, ir_node *block,
1607 ir_node *op, ir_type *to_tp);
1609 /** Constructor for a Carry node.
1611 * @param *db A pointer for debug information.
1612 * @param *irg The ir graph the node belongs to.
1613 * @param *block The ir block the node belongs to.
1614 * @param *op1 The first operand.
1615 * @param *op2 The second operand.
1616 * @param *mode The mode of the operands and the result.
1618 ir_node *new_rd_Carry (dbg_info *db, ir_graph *irg, ir_node *block,
1619 ir_node *op1, ir_node *op2, ir_mode *mode);
1621 /** Constructor for a Borrow node.
1623 * @param *db A pointer for debug information.
1624 * @param *irg The ir graph the node belongs to.
1625 * @param *block The ir block the node belongs to.
1626 * @param *op1 The first operand.
1627 * @param *op2 The second operand.
1628 * @param *mode The mode of the operands and the result.
1630 ir_node *new_rd_Borrow (dbg_info *db, ir_graph *irg, ir_node *block,
1631 ir_node *op1, ir_node *op2, ir_mode *mode);
1633 /** Constructor for a Phi node.
1635 * @param *db A pointer for debug information.
1636 * @param *irg The ir graph the node belongs to.
1637 * @param *block The ir block the node belongs to.
1638 * @param arity The number of predecessors
1639 * @param *in[] Array with predecessors. The constructor copies this array.
1640 * @param *mode The mode of it's inputs and output.
1642 ir_node *new_rd_Phi (dbg_info *db, ir_graph *irg, ir_node *block, int arity,
1643 ir_node *in[], ir_mode *mode);
1645 /** Constructor for a Load node.
1647 * @param *db A pointer for debug information.
1648 * @param *irg The ir graph the node belongs to.
1649 * @param *block The ir block the node belongs to.
1650 * @param *store The current memory
1651 * @param *adr A pointer to the variable to be read in this memory.
1652 * @param *mode The mode of the value to be loaded.
1654 ir_node *new_rd_Load (dbg_info *db, ir_graph *irg, ir_node *block,
1655 ir_node *store, ir_node *adr, ir_mode *mode);
1657 /** Constructor for a Store node.
1659 * @param *db A pointer for debug information.
1660 * @param *irg The ir graph the node belongs to.
1661 * @param *block The ir block the node belongs to.
1662 * @param *store The current memory
1663 * @param *adr A pointer to the variable to be read in this memory.
1664 * @param *val The value to write to this variable.
1666 ir_node *new_rd_Store (dbg_info *db, ir_graph *irg, ir_node *block,
1667 ir_node *store, ir_node *adr, ir_node *val);
1669 /** Constructor for a Alloc node.
1671 * The Alloc node extends the memory by space for an entity of type alloc_type.
1673 * @param *db A pointer for debug information.
1674 * @param *irg The ir graph the node belongs to.
1675 * @param *block The ir block the node belongs to.
1676 * @param *store The memory which shall contain the new variable.
1677 * @param *size The number of bytes to allocate.
1678 * @param *alloc_type The type of the allocated variable.
1679 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
1681 ir_node *new_rd_Alloc (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1682 ir_node *size, ir_type *alloc_type, where_alloc where);
1684 /** Constructor for a Free node.
1686 * Frees the memory occupied by the entity pointed to by the pointer
1687 * arg. Type indicates the type of the entity the argument points to.
1689 * @param *db A pointer for debug information.
1690 * @param *irg The ir graph the node belongs to.
1691 * @param *block The ir block the node belongs to.
1692 * @param *store The memory which shall contain the new variable.
1693 * @param *ptr The pointer to the object to free.
1694 * @param *size The number of objects of type free_type to free in a sequence.
1695 * @param *free_type The type of the freed variable.
1696 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
1698 ir_node *new_rd_Free (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1699 ir_node *ptr, ir_node *size, ir_type *free_type, where_alloc where);
1701 /** Constructor for a Sync node.
1703 * Merges several memory values. The node assumes that a variable
1704 * either occurs only in one of the memories, or it contains the same
1705 * value in all memories where it occurs.
1707 * @param *db A pointer for debug information.
1708 * @param *irg The ir graph the node belongs to.
1709 * @param *block The ir block the node belongs to.
1710 * @param arity The number of memories to synchronize.
1711 * @param *in[] An array of pointers to nodes that produce an output of type
1712 * memory. The constructor copies this array.
1714 ir_node *new_rd_Sync (dbg_info *db, ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
1716 /** Constructor for a Proj node.
1718 * Projects a single value out of a tuple. The parameter proj gives the
1719 * position of the value within the tuple.
1721 * @param *db A pointer for debug information.
1722 * @param *irg The ir graph the node belongs to.
1723 * @param *block The ir block the node belongs to.
1724 * @param arg A node producing a tuple. The node must have mode_T.
1725 * @param *mode The mode of the value to project.
1726 * @param proj The position of the value in the tuple.
1728 ir_node *new_rd_Proj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1729 ir_mode *mode, long proj);
1731 /** Constructor for a defaultProj node.
1733 * Represents the default control flow of a Switch-Cond node.
1735 * @param *db A pointer for debug information.
1736 * @param *irg The ir graph the node belongs to.
1737 * @param *block The ir block the node belongs to.
1738 * @param arg A node producing a tuple.
1739 * @param max_proj The end position of the value in the tuple.
1741 ir_node *new_rd_defaultProj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1744 /** Constructor for a Tuple node.
1746 * This is an auxiliary node to replace a node that returns a tuple
1747 * without changing the corresponding Proj nodes.
1749 * @param *db A pointer for debug information.
1750 * @param *irg The ir graph the node belongs to.
1751 * @param *block The ir block the node belongs to.
1752 * @param arity The number of tuple elements.
1753 * @param *in[] An array containing pointers to the nodes producing the tuple
1754 * elements. The constructor copies this array.
1756 ir_node *new_rd_Tuple (dbg_info *db, ir_graph *irg, ir_node *block,
1757 int arity, ir_node *in[]);
1759 /** Constructor for a Id node.
1761 * This is an auxiliary node to replace a node that returns a single
1764 * @param *db A pointer for debug information.
1765 * @param *irg The ir graph the node belongs to.
1766 * @param *block The ir block the node belongs to.
1767 * @param *val The value
1768 * @param *mode The mode of *val.
1770 ir_node *new_rd_Id (dbg_info *db, ir_graph *irg, ir_node *block,
1771 ir_node *val, ir_mode *mode);
1773 /** Constructor for a Bad node.
1775 * Returns the unique Bad node of the graph. The same as
1778 * @param *irg The ir graph the node belongs to.
1780 ir_node *new_rd_Bad (ir_graph *irg);
1782 /** Constructor for a Confirm node.
1784 * Specifies constraints for a value. To support dataflow analyses.
1786 * Example: If the value never exceeds '100' this is expressed by placing a
1787 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
1789 * @param *irg The ir graph the node belong to.
1790 * @param *block The ir block the node belong to.
1791 * @param *db A pointer for debug information.
1792 * @param *val The value we express a constraint for
1793 * @param *bound The value to compare against. Must be a firm node, typically a constant.
1794 * @param cmp The compare operation.
1796 ir_node *new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block,
1797 ir_node *val, ir_node *bound, pn_Cmp cmp);
1799 /** Constructor for an Unknown node.
1801 * Represents an arbitrary value. Places the node in the start block.
1803 * @param *irg The ir graph the node belongs to.
1804 * @param *m The mode of the unknown value.
1806 ir_node *new_rd_Unknown(ir_graph *irg, ir_mode *m);
1808 /** Constructor for a CallBegin node.
1810 * CallBegin represents control flow depending of the pointer value
1811 * representing the called method to the called methods. The
1812 * constructor copies the method pointer input from the passed Call
1815 * @param *db A pointer for debug information.
1816 * @param *irg The ir graph the node belong to.
1817 * @param *block The block the node belong to.
1818 * @param *callee The call node visible in the intra procedural view.
1820 ir_node *new_rd_CallBegin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *callee);
1822 /** Constructor for a EndReg node.
1824 * Used to represent regular procedure end in interprocedual view.
1826 * @param *db A pointer for debug information.
1827 * @param *irg The ir graph the node belong to.
1828 * @param *block The block the node belong to.
1830 ir_node *new_rd_EndReg (dbg_info *db, ir_graph *irg, ir_node *block);
1832 /** Constructor for a EndExcept node.
1834 * Used to represent exceptional procedure end in interprocedural view.
1836 * @param *db A pointer for debug information.
1837 * @param *irg The ir graph the node belong to.
1838 * @param *block The block the node belong to.
1840 ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
1842 /** Constructor for a Filter node.
1844 * Adds the node to the block in current_ir_block. Filter is a node
1845 * with two views used to construct the interprocedural view. In
1846 * intraprocedural view its semantics are identical to the Proj node.
1847 * In interprocedural view the Filter performs the Phi operation on
1848 * method parameters or results. Other than a Phi a Filter node may
1849 * not be removed if it has only a single input.
1851 * The constructor builds the Filter in intraprocedural 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.
1856 * @param *arg The tuple value to project from.
1857 * @param *mode The mode of the projected value.
1858 * @param proj The position in the tuple to project from.
1860 ir_node *new_rd_Filter (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1861 ir_mode *mode, long proj);
1863 /** Constructor for a NoMem node.
1865 * Returns the unique NoMem node of the graph. The same as
1868 * @param *irg The ir graph the node belongs to.
1870 ir_node *new_rd_NoMem (ir_graph *irg);
1872 /** Constructor for a Mux node.
1874 * @param *db A pointer for debug information.
1875 * @param *irg The ir graph the node belong to.
1876 * @param *block The block the node belong to.
1877 * @param *sel The ir_node that calculates the boolean select.
1878 * @param *ir_true The ir_node that calculates the true result.
1879 * @param *ir_false The ir_node that calculates the false result.
1880 * @param *mode The mode of the node (and it_true and ir_false).
1882 ir_node *new_rd_Mux (dbg_info *db, ir_graph *irg, ir_node *block,
1883 ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
1885 /** Constructor for a Psi node.
1887 * @param *db A pointer for debug information.
1888 * @param *irg The ir graph the node belong to.
1889 * @param *block The block the node belong to.
1890 * @param *arity The arity of the conditions
1891 * @param *conds The array of mode_b conditions, length must be equal arity
1892 * @param *vals The array of mode values, length must be equal arity + 1
1893 * @param *mode The mode of the node (must be the mode of all vals).
1895 ir_node *new_rd_Psi (dbg_info *db, ir_graph *irg, ir_node *block,
1896 int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
1898 /** Constructor for a CopyB node.
1900 * @param *db A pointer for debug information.
1901 * @param *irg The ir graph the node belong to.
1902 * @param *block The block the node belong to.
1903 * @param *store The current memory
1904 * @param *dst The ir_node that represents the destination address.
1905 * @param *src The ir_node that represents the source address.
1906 * @param *data_type The type of the copied data
1908 ir_node *new_rd_CopyB(dbg_info *db, ir_graph *irg, ir_node *block,
1909 ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
1911 /** Constructor for a InstOf node.
1913 * A High-Level Type check.
1915 * @param *db A pointer for debug information.
1916 * @param *irg The ir graph the node belongs to.
1917 * @param *block The ir block the node belongs to.
1918 * @param *store The memory in which the object the entity should be selected
1919 * from is allocated.
1920 * @param *objptr A pointer to a object of a class type.
1921 * @param *type The type of which objptr must be.
1923 ir_node *new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1924 ir_node *objptr, ir_type *type);
1926 /** Constructor for a Raise node.
1928 * A High-Level Exception throw.
1930 * @param *db A pointer for debug information.
1931 * @param *irg The ir graph the node belongs to.
1932 * @param *block The ir block the node belongs to.
1933 * @param *store The current memory.
1934 * @param *obj A pointer to the Except variable.
1936 ir_node *new_rd_Raise (dbg_info *db, ir_graph *irg, ir_node *block,
1937 ir_node *store, ir_node *obj);
1939 /** Constructor for a Bound node.
1941 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
1943 * @param *db A pointer for debug information.
1944 * @param *irg The ir graph the node belong to.
1945 * @param *block The block the node belong to.
1946 * @param *store The current memory
1947 * @param *idx The ir_node that represents an index.
1948 * @param *lower The ir_node that represents the lower bound for the index.
1949 * @param *upper The ir_node that represents the upper bound for the index.
1951 ir_node *new_rd_Bound(dbg_info *db, ir_graph *irg, ir_node *block,
1952 ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
1954 /*-------------------------------------------------------------------------*/
1955 /* The raw interface without debug support */
1956 /*-------------------------------------------------------------------------*/
1958 /** Constructor for a Block node.
1960 * Constructs a mature block with the given predecessors. Use Unknown
1961 * nodes as predecessors to construct a block if the number of
1962 * predecessors is known, but not the predecessors themselves. This
1963 * constructor does not set current_block. It not be used with
1964 * automatic Phi node construction.
1967 * @param irg The ir graph the block belongs to.
1968 * @param arity The number of control predecessors.
1969 * @param in[] An array of control predecessors. The length of
1970 * the array must be 'arity'. The constructor copies this array.
1972 ir_node *new_r_Block (ir_graph *irg, int arity, ir_node *in[]);
1974 /** Constructor for a Start node.
1976 * @param *irg The ir graph the node belongs to.
1977 * @param *block The ir block the node belongs to.
1979 ir_node *new_r_Start (ir_graph *irg, ir_node *block);
1981 /** Constructor for a End node.
1983 * @param *irg The ir graph the node belongs to.
1984 * @param *block The ir block the node belongs to.
1986 ir_node *new_r_End (ir_graph *irg, ir_node *block);
1988 /** Constructor for a Jmp node.
1990 * Jmp represents control flow to a single control successor.
1992 * @param *irg The ir graph the node belongs to.
1993 * @param *block The ir block the node belongs to.
1995 ir_node *new_r_Jmp (ir_graph *irg, ir_node *block);
1997 /** Constructor for an IJmp node.
1999 * IJmp represents control flow to a single control successor not
2000 * statically known i.e. an indirect Jmp.
2002 * @param *irg The ir graph the node belongs to.
2003 * @param *block The ir block the node belongs to.
2004 * @param *tgt The ir node representing the target address.
2006 ir_node *new_r_IJmp (ir_graph *irg, ir_node *block, ir_node *tgt);
2008 /** Constructor for a Cond node.
2010 * If c is mode_b represents a conditional branch (if/else). If c is
2011 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2012 * node, default Proj is 0.)
2014 * This is not consistent: Input to Cond is Is, Proj has as proj number
2017 * @param *irg The ir graph the node belongs to.
2018 * @param *block The ir block the node belongs to.
2019 * @param *c The conditions parameter.Can be of mode b or I_u.
2021 ir_node *new_r_Cond (ir_graph *irg, ir_node *block, ir_node *c);
2023 /** Constructor for a Return node.
2025 * Returns the memory an zero or more return values. Only node that
2026 * can end regular control flow.
2028 * @param *irg The ir graph the node belongs to.
2029 * @param *block The ir block the node belongs to.
2030 * @param *store The state of memory.
2031 * @param arity Number of array indices.
2032 * @param *in[] Array with index inputs to the node. The constructor copies this array.
2034 ir_node *new_r_Return (ir_graph *irg, ir_node *block,
2035 ir_node *store, int arity, ir_node *in[]);
2037 /** Constructor for a Const node.
2039 * Constructor for a Const node. The constant represents a target
2040 * value. Sets the type information to type_unknown. (No more
2041 * supported: If tv is entity derives a somehow useful type.)
2043 * @param *irg The ir graph the node belongs to.
2044 * @param *block The ir block the node belongs to.
2045 * @param *mode The mode of the operands and the results.
2046 * @param *con Points to an entry in the constant table.
2048 ir_node *new_r_Const (ir_graph *irg, ir_node *block,
2049 ir_mode *mode, tarval *con);
2051 /** Constructor for a Const node.
2053 * Constructor for a Const node. The constant represents a target
2054 * value. Sets the type information to type_unknown. (No more
2055 * supported: If tv is entity derives a somehow useful type.)
2057 * @param *irg The ir graph the node belongs to.
2058 * @param *block The ir block the node belongs to.
2059 * @param *mode The mode of the operands and the results.
2060 * @param value A value from which the tarval is made.
2062 ir_node *new_r_Const_long(ir_graph *irg, ir_node *block,
2063 ir_mode *mode, long value);
2065 /** Constructor for a Const_type node.
2067 * The constant represents a target value. This constructor sets high
2068 * level type information for the constant value.
2070 * @param *irg The ir graph the node belongs to.
2071 * @param *block The ir block the node belongs to.
2072 * @param *mode The mode of the operands and results.
2073 * @param *con Points to an entry in the constant table.
2074 * @param *tp The type of the constant.
2076 ir_node *new_r_Const_type(ir_graph *irg, ir_node *block,
2077 ir_mode *mode, tarval *con, ir_type *tp);
2079 /** Constructor for a SymConst node.
2081 * This is the constructor for a symbolic constant.
2082 * There are four kinds of symbolic constants:
2083 * - type_tag The symbolic constant represents a type tag. The type the
2084 * tag stands for is given explicitly.
2085 * - size The symbolic constant represents the size of a type. The
2086 * type of which the constant represents the size is given
2088 * - addr_name The symbolic constant represents the address of an entity
2089 * (variable or method). The variable is indicated by a name
2090 * that is valid for linking.
2091 * - addr_ent The symbolic constant represents the address of an entity
2092 * (variable or method). The variable is given explicitly by
2095 * Inputs to the node:
2096 * No inputs except the block it belongs to.
2097 * Outputs of the node.
2098 * An unsigned integer (I_u) or a pointer (P).
2100 * @param *irg The ir graph the node belongs to.
2101 * @param *block The ir block the node belongs to.
2102 * @param value A type, entity or a ident depending on the SymConst kind.
2103 * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
2105 ir_node *new_r_SymConst (ir_graph *irg, ir_node *block,
2106 union symconst_symbol value, symconst_kind symkind);
2108 /** Constructor for a simpleSel node.
2110 * This is a shortcut for the new_d_Sel() constructor. To be used for
2111 * Sel nodes that do not select from an array, i.e., have no index
2112 * inputs. It adds the two parameters 0, NULL.
2114 * @param *irg The ir graph the node belongs to.
2115 * @param *block The ir block the node belongs to.
2116 * @param *store The memory in which the object the entity should be selected
2117 * from is allocated.
2118 * @param *objptr The object from that the Sel operation selects a
2119 * single attribute out.
2120 * @param *ent The entity to select.
2122 ir_node *new_r_simpleSel(ir_graph *irg, ir_node *block, ir_node *store,
2123 ir_node *objptr, entity *ent);
2125 /** Constructor for a Sel node.
2127 * The select node selects an entity (field or method) from an entity
2128 * with a compound type. It explicitly specifies the entity selected.
2129 * Dynamically the node may select entities that overwrite the given
2130 * entity. If the selected entity is an array element entity the Sel
2131 * node takes the required array indices as inputs.
2133 * @param *irg The ir graph the node belongs to.
2134 * @param *block The ir block the node belongs to.
2135 * @param *store The memory in which the object the entity should be selected
2136 * from is allocated.
2137 * @param *objptr A pointer to a compound entity the Sel operation selects a
2138 * single attribute from.
2139 * @param *n_index The number of array indices needed to select an array element entity.
2140 * @param *index[] If the compound entity is an array the indices of the selected
2141 * element entity. The constructor copies this array.
2142 * @param *ent The entity to select.
2144 ir_node *new_r_Sel (ir_graph *irg, ir_node *block, ir_node *store,
2145 ir_node *objptr, int n_index, ir_node *index[],
2148 /** Constructor for a Call node.
2150 * Represents all kinds of method and function calls.
2152 * @param *irg The ir graph the node belongs to.
2153 * @param *block The ir block the node belongs to.
2154 * @param *store The actual store.
2155 * @param *callee A pointer to the called procedure.
2156 * @param arity The number of procedure parameters.
2157 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2158 * @param *tp Type information of the procedure called.
2160 ir_node *new_r_Call (ir_graph *irg, ir_node *block, ir_node *store,
2161 ir_node *callee, int arity, ir_node *in[],
2164 /** Constructor for a Add node.
2166 * @param *irg The ir graph the node belongs to.
2167 * @param *block The ir block the node belongs to.
2168 * @param *op1 The first operand.
2169 * @param *op2 The second operand.
2170 * @param *mode The mode of the operands and the result.
2172 ir_node *new_r_Add (ir_graph *irg, ir_node *block,
2173 ir_node *op1, ir_node *op2, ir_mode *mode);
2176 * Constructor for a Sub node.
2178 * @param *irg The ir graph the node belongs to.
2179 * @param *block The ir block the node belongs to.
2180 * @param *op1 The first operand.
2181 * @param *op2 The second operand.
2182 * @param *mode The mode of the operands and the results.
2184 ir_node *new_r_Sub (ir_graph *irg, ir_node *block,
2185 ir_node *op1, ir_node *op2, ir_mode *mode);
2187 /** Constructor for a Minus node.
2189 * @param *irg The ir graph the node belongs to.
2190 * @param *block The ir block the node belongs to.
2191 * @param *op The operand.
2192 * @param *mode The mode of the operand and the result.
2194 ir_node *new_r_Minus (ir_graph *irg, ir_node *block,
2195 ir_node *op, ir_mode *mode);
2196 /** Constructor for a Mul node.
2198 * @param *irg The ir graph the node belongs to.
2199 * @param *block The ir block the node belongs to.
2200 * @param *op1 The first operand.
2201 * @param *op2 The second operand.
2202 * @param *mode The mode of the operands and the result.
2204 ir_node *new_r_Mul (ir_graph *irg, ir_node *block,
2205 ir_node *op1, ir_node *op2, ir_mode *mode);
2207 /** Constructor for a Quot node.
2209 * @param *irg The ir graph the node belongs to.
2210 * @param *block The ir block the node belongs to.
2211 * @param *memop The store needed to model exceptions
2212 * @param *op1 The first operand.
2213 * @param *op2 The second operand.
2215 ir_node *new_r_Quot (ir_graph *irg, ir_node *block,
2216 ir_node *memop, ir_node *op1, ir_node *op2);
2218 /** Constructor for a DivMod node.
2220 * @param *irg The ir graph the node belongs to.
2221 * @param *block The ir block the node belongs to.
2222 * @param *memop The store needed to model exceptions
2223 * @param *op1 The first operand.
2224 * @param *op2 The second operand.
2226 ir_node *new_r_DivMod (ir_graph *irg, ir_node *block,
2227 ir_node *memop, ir_node *op1, ir_node *op2);
2229 /** Constructor for a Div node.
2231 * @param *irg The ir graph the node belongs to.
2232 * @param *block The ir block the node belongs to.
2233 * @param *memop The store needed to model exceptions
2234 * @param *op1 The first operand.
2235 * @param *op2 The second operand.
2237 ir_node *new_r_Div (ir_graph *irg, ir_node *block,
2238 ir_node *memop, ir_node *op1, ir_node *op2);
2240 /** Constructor for a Mod node.
2242 * @param *irg The ir graph the node belongs to.
2243 * @param *block The ir block the node belongs to.
2244 * @param *memop The store needed to model exceptions
2245 * @param *op1 The first operand.
2246 * @param *op2 The second operand.
2248 ir_node *new_r_Mod (ir_graph *irg, ir_node *block,
2249 ir_node *memop, ir_node *op1, ir_node *op2);
2251 /** Constructor for a Abs node.
2253 * @param *irg The ir graph the node belongs to.
2254 * @param *block The ir block the node belongs to.
2255 * @param *op The operand
2256 * @param *mode The mode of the operands and the result.
2258 ir_node *new_r_Abs (ir_graph *irg, ir_node *block,
2259 ir_node *op, ir_mode *mode);
2261 /** Constructor for a And node.
2263 * @param *irg The ir graph the node belongs to.
2264 * @param *block The ir block the node belongs to.
2265 * @param *op1 The first operand.
2266 * @param *op2 The second operand.
2267 * @param *mode The mode of the operands and the result.
2269 ir_node *new_r_And (ir_graph *irg, ir_node *block,
2270 ir_node *op1, ir_node *op2, ir_mode *mode);
2272 /** Constructor for a Or node.
2274 * @param *irg The ir graph the node belongs to.
2275 * @param *block The ir block the node belongs to.
2276 * @param *op1 The first operand.
2277 * @param *op2 The second operand.
2278 * @param *mode The mode of the operands and the result.
2280 ir_node *new_r_Or (ir_graph *irg, ir_node *block,
2281 ir_node *op1, ir_node *op2, ir_mode *mode);
2283 /** Constructor for a Eor node.
2285 * @param *irg The ir graph the node belongs to.
2286 * @param *block The ir block the node belongs to.
2287 * @param *op1 The first operand.
2288 * @param *op2 The second operand.
2289 * @param *mode The mode of the operands and the results.
2291 ir_node *new_r_Eor (ir_graph *irg, ir_node *block,
2292 ir_node *op1, ir_node *op2, ir_mode *mode);
2294 /** Constructor for a Not node.
2296 * @param *irg The ir graph the node belongs to.
2297 * @param *block The ir block the node belongs to.
2298 * @param *op The operand.
2299 * @param *mode The mode of the operand and the result.
2301 ir_node *new_r_Not (ir_graph *irg, ir_node *block,
2302 ir_node *op, ir_mode *mode);
2304 /** Constructor for a Cmp node.
2306 * @param *irg The ir graph the node belongs to.
2307 * @param *block The ir block the node belongs to.
2308 * @param *op1 The first operand.
2309 * @param *op2 The second operand.
2311 ir_node *new_r_Cmp (ir_graph *irg, ir_node *block,
2312 ir_node *op1, ir_node *op2);
2314 /** Constructor for a Shl node.
2316 * @param *irg The ir graph the node belongs to.
2317 * @param *block The ir block the node belongs to.
2318 * @param *op The operand.
2319 * @param *k The number of bits to shift the operand .
2320 * @param *mode The mode of the operand and the result.
2322 ir_node *new_r_Shl (ir_graph *irg, ir_node *block,
2323 ir_node *op, ir_node *k, ir_mode *mode);
2325 /** Constructor for a Shr node.
2327 * @param *irg The ir graph the node belongs to.
2328 * @param *block The ir block the node belongs to.
2329 * @param *op The operand.
2330 * @param *k The number of bits to shift the operand .
2331 * @param *mode The mode of the operand and the result.
2333 ir_node *new_r_Shr (ir_graph *irg, ir_node *block,
2334 ir_node *op, ir_node *k, ir_mode *mode);
2337 * Constructor for a Shrs node.
2339 * @param *irg The ir graph the node belongs to.
2340 * @param *block The ir block the node belongs to.
2341 * @param *op The operand.
2342 * @param *k The number of bits to shift the operand.
2343 * @param *mode The mode of the operand and the result.
2345 ir_node *new_r_Shrs (ir_graph *irg, ir_node *block,
2346 ir_node *op, ir_node *k, ir_mode *mode);
2348 /** Constructor for a Rot node.
2350 * @param *irg The ir graph the node belongs to.
2351 * @param *block The ir block the node belongs to.
2352 * @param *op The operand.
2353 * @param *k The number of bits to rotate the operand.
2354 * @param *mode The mode of the operand.
2356 ir_node *new_r_Rot (ir_graph *irg, ir_node *block,
2357 ir_node *op, ir_node *k, ir_mode *mode);
2359 /** Constructor for a Conv node.
2361 * @param *irg The ir graph the node belongs to.
2362 * @param *block The ir block the node belongs to.
2363 * @param *op The operand.
2364 * @param *mode The mode of this the operand muss be converted .
2366 ir_node *new_r_Conv (ir_graph *irg, ir_node *block,
2367 ir_node *op, ir_mode *mode);
2369 /** Constructor for a Cast node.
2371 * High level type cast
2373 * @param *irg The ir graph the node belongs to.
2374 * @param *block The ir block the node belongs to.
2375 * @param *op The operand.
2376 * @param *to_tp The type of this the operand muss be casted .
2378 ir_node *new_r_Cast (ir_graph *irg, ir_node *block,
2379 ir_node *op, ir_type *to_tp);
2381 /** Constructor for a Carry node.
2383 * @param *irg The ir graph the node belongs to.
2384 * @param *block The ir block the node belongs to.
2385 * @param *op1 The first operand.
2386 * @param *op2 The second operand.
2387 * @param *mode The mode of the operands and the result.
2389 ir_node *new_r_Carry (ir_graph *irg, ir_node *block,
2390 ir_node *op1, ir_node *op2, ir_mode *mode);
2393 * Constructor for a Borrow node.
2395 * @param *irg The ir graph the node belongs to.
2396 * @param *block The ir block the node belongs to.
2397 * @param *op1 The first operand.
2398 * @param *op2 The second operand.
2399 * @param *mode The mode of the operands and the results.
2401 ir_node *new_r_Borrow (ir_graph *irg, ir_node *block,
2402 ir_node *op1, ir_node *op2, ir_mode *mode);
2404 /** Constructor for a Phi node.
2406 * @param *irg The ir graph the node belongs to.
2407 * @param *block The ir block the node belongs to.
2408 * @param arity The number of predecessors
2409 * @param *in[] Array with predecessors. The constructor copies this array.
2410 * @param *mode The mode of it's inputs and output.
2412 ir_node *new_r_Phi (ir_graph *irg, ir_node *block, int arity,
2413 ir_node *in[], ir_mode *mode);
2415 /** Constructor for a Load node.
2417 * @param *irg The ir graph the node belongs to.
2418 * @param *block The ir block the node belongs to.
2419 * @param *store The current memory
2420 * @param *adr A pointer to the variable to be read in this memory.
2421 * @param *mode The mode of the value to be loaded.
2423 ir_node *new_r_Load (ir_graph *irg, ir_node *block,
2424 ir_node *store, ir_node *adr, ir_mode *mode);
2426 /** Constructor for a Store node.
2428 * @param *irg The ir graph the node belongs to.
2429 * @param *block The ir block the node belongs to.
2430 * @param *store The current memory
2431 * @param *adr A pointer to the variable to be read in this memory.
2432 * @param *val The value to write to this variable.
2434 ir_node *new_r_Store (ir_graph *irg, ir_node *block,
2435 ir_node *store, ir_node *adr, ir_node *val);
2437 /** Constructor for a Alloc node.
2439 * The Alloc node extends the memory by space for an entity of type alloc_type.
2441 * @param *irg The ir graph the node belongs to.
2442 * @param *block The ir block the node belongs to.
2443 * @param *store The memory which shall contain the new variable.
2444 * @param *size The number of bytes to allocate.
2445 * @param *alloc_type The type of the allocated variable.
2446 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
2448 ir_node *new_r_Alloc (ir_graph *irg, ir_node *block, ir_node *store,
2449 ir_node *size, ir_type *alloc_type, where_alloc where);
2451 /** Constructor for a Free node.
2453 * Frees the memory occupied by the entity pointed to by the pointer
2454 * arg. Type indicates the type of the entity the argument points to.
2456 * @param *irg The ir graph the node belongs to.
2457 * @param *block The ir block the node belongs to.
2458 * @param *store The memory which shall contain the new variable.
2459 * @param *ptr The pointer to the object to free.
2460 * @param *size The number of objects of type free_type to free in a sequence.
2461 * @param *free_type The type of the freed variable.
2462 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
2464 ir_node *new_r_Free (ir_graph *irg, ir_node *block, ir_node *store,
2465 ir_node *ptr, ir_node *size, ir_type *free_type, where_alloc where);
2467 /** Constructor for a Sync node.
2469 * Merges several memory values. The node assumes that a variable
2470 * either occurs only in one of the memories, or it contains the same
2471 * value in all memories where it occurs.
2473 * @param *irg The ir graph the node belongs to.
2474 * @param *block The ir block the node belongs to.
2475 * @param arity The number of memories to synchronize.
2476 * @param *in[] An array of pointers to nodes that produce an output of type memory.
2477 * The constructor copies this array.
2479 ir_node *new_r_Sync (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2481 /** Constructor for a Proj node.
2483 * Projects a single value out of a tuple. The parameter proj gives the
2484 * position of the value within the tuple.
2486 * @param *irg The ir graph the node belongs to.
2487 * @param *block The ir block the node belongs to.
2488 * @param arg A node producing a tuple.
2489 * @param *mode The mode of the value to project.
2490 * @param proj The position of the value in the tuple.
2492 ir_node *new_r_Proj (ir_graph *irg, ir_node *block, ir_node *arg,
2493 ir_mode *mode, long proj);
2495 /** Constructor for a defaultProj node.
2497 * Represents the default control flow of a Switch-Cond node.
2499 * @param *irg The ir graph the node belongs to.
2500 * @param *block The ir block the node belongs to.
2501 * @param arg A node producing a tuple.
2502 * @param max_proj The end position of the value in the tuple.
2504 ir_node *new_r_defaultProj (ir_graph *irg, ir_node *block, ir_node *arg, long max_proj);
2507 /** Constructor for a Tuple node.
2509 * This is an auxiliary node to replace a node that returns a tuple
2510 * without changing the corresponding Proj nodes.
2512 * @param *irg The ir graph the node belongs to.
2513 * @param *block The ir block the node belongs to.
2514 * @param arity The number of tuple elements.
2515 * @param *in[] An array containing pointers to the nodes producing the tuple elements.
2516 * The constructor copies this array.
2518 ir_node *new_r_Tuple (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2520 /** Constructor for a Id node.
2522 * This is an auxiliary node to replace a node that returns a single
2525 * @param *irg The ir graph the node belongs to.
2526 * @param *block The ir block the node belongs to.
2527 * @param *val The operand to Id.
2528 * @param *mode The mode of *val.
2530 ir_node *new_r_Id (ir_graph *irg, ir_node *block,
2531 ir_node *val, ir_mode *mode);
2533 /** Constructor for a Bad node.
2535 * Returns the unique Bad node of the graph. The same as
2538 * @param *irg The ir graph the node belongs to.
2541 ir_node *new_r_Bad (ir_graph *irg);
2543 /** Constructor for a Confirm node.
2545 * Specifies constraints for a value. To support dataflow analyses.
2547 * Example: If the value never exceeds '100' this is expressed by placing a
2548 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
2550 * @param *irg The ir graph the node belong to.
2551 * @param *block The ir block the node belong to.
2552 * @param *val The value we express a constraint for
2553 * @param *bound The value to compare against. Must be a firm node, typically a constant.
2554 * @param cmp The compare operation.
2556 ir_node *new_r_Confirm (ir_graph *irg, ir_node *block,
2557 ir_node *val, ir_node *bound, pn_Cmp cmp);
2559 /** Constructor for a Unknown node.
2561 * Represents an arbitrary value. Places the node in
2564 * @param *irg The ir graph the node belongs to.
2565 * @param *m The mode of the unknown value.
2567 ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2569 /** Constructor for a CallBegin node.
2571 * CallBegin represents control flow depending of the pointer value
2572 * representing the called method to the called methods. The
2573 * constructor copies the method pointer input from the passed Call
2576 * @param *irg The ir graph the node belong to.
2577 * @param *block The block the node belong to.
2578 * @param *callee The call node visible in the intra procedural view.
2580 ir_node *new_r_CallBegin(ir_graph *irg, ir_node *block, ir_node *callee);
2582 /** Constructor for a EndReg node.
2584 * Used to represent regular procedure end in interprocedual view.
2586 * @param *irg The ir graph the node belong to.
2587 * @param *block The block the node belong to.
2589 ir_node *new_r_EndReg (ir_graph *irg, ir_node *block);
2591 /** Constructor for a EndExcept node.
2593 * Used to represent exceptional procedure end in interprocedural view.
2595 * @param *irg The ir graph the node belong to.
2596 * @param *block The block the node belong to.
2598 ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
2600 /** Constructor for a Break node.
2602 * Break represents control flow to a single control successor just as Jmp.
2603 * The blocks separated by a break may not be concatenated by an optimization.
2604 * It is used for the interprocedural representation where blocks are parted
2605 * behind Call nodes to represent the control flow to called procedures.
2607 * @param *irg The ir graph the node belong to.
2608 * @param *block The block the node belong to.
2610 ir_node *new_r_Break (ir_graph *irg, ir_node *block);
2612 /** Constructor for a Filter node.
2614 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
2615 * Filter is a node with two views used to construct the interprocedural view.
2616 * In intraprocedural view its semantics are identical to the Proj node.
2617 * In interprocedural view the Filter performs the Phi operation on method
2618 * parameters or results. Other than a Phi a Filter node may not be removed
2619 * if it has only a single input.
2621 * The constructor builds the Filter in intraprocedural view.
2623 * @param *irg The ir graph the node belong to.
2624 * @param *block The block the node belong to.
2625 * @param *arg The tuple value to project from.
2626 * @param *mode The mode of the projected value.
2627 * @param proj The position in the tuple to project from.
2629 ir_node *new_r_Filter (ir_graph *irg, ir_node *block, ir_node *arg,
2630 ir_mode *mode, long proj);
2632 /** Constructor for a NoMem node.
2634 * Returns the unique NoMem node of the graph. The same as
2637 * @param *irg The ir graph the node belongs to.
2639 ir_node *new_r_NoMem (ir_graph *irg);
2641 /** Constructor for a Mux node.
2643 * @param *irg The ir graph the node belong to.
2644 * @param *block The block the node belong to.
2645 * @param *sel The ir_node that calculates the boolean select.
2646 * @param *ir_true The ir_node that calculates the true result.
2647 * @param *ir_false The ir_node that calculates the false result.
2648 * @param *mode The mode of the node (and it_true and ir_false).
2650 ir_node *new_r_Mux (ir_graph *irg, ir_node *block,
2651 ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2653 /** Constructor for a Psi node.
2655 * @param *irg The ir graph the node belong to.
2656 * @param *block The block the node belong to.
2657 * @param *arity The arity of the conditions
2658 * @param *conds The array of mode_b conditions, length must be equal arity
2659 * @param *vals The array of mode values, length must be equal arity + 1
2660 * @param *mode The mode of the node (must be the mode of all vals).
2662 ir_node *new_r_Psi (ir_graph *irg, ir_node *block,
2663 int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
2665 /** Constructor for a CopyB node.
2667 * @param *irg The ir graph the node belong to.
2668 * @param *block The block the node belong to.
2669 * @param *store The current memory
2670 * @param *dst The ir_node that represents the destination address.
2671 * @param *src The ir_node that represents the source address.
2672 * @param *data_type The type of the copied data
2674 ir_node *new_r_CopyB(ir_graph *irg, ir_node *block,
2675 ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
2677 /** Constructor for a InstOf node.
2679 * A High-Level Type check.
2681 * @param *irg The ir graph the node belongs to.
2682 * @param *block The ir block the node belongs to.
2683 * @param *store The memory in which the object the entity should be selected
2684 * from is allocated.
2685 * @param *objptr A pointer to a object of a class type.
2686 * @param *type The type of which objptr must be.
2688 ir_node *new_r_InstOf (ir_graph *irg, ir_node *block, ir_node *store,
2689 ir_node *objptr, ir_type *type);
2691 /** Constructor for a Raise node.
2693 * A High-Level Exception throw.
2695 * @param *irg The ir graph the node belongs to.
2696 * @param *block The ir block the node belongs to.
2697 * @param *store The current memory.
2698 * @param *obj A pointer to the Except variable.
2700 ir_node *new_r_Raise (ir_graph *irg, ir_node *block,
2701 ir_node *store, ir_node *obj);
2703 /** Constructor for a Bound node.
2705 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2707 * @param *irg The ir graph the node belong to.
2708 * @param *block The block the node belong to.
2709 * @param *store The current memory
2710 * @param *idx The ir_node that represents an index.
2711 * @param *lower The ir_node that represents the lower bound for the index.
2712 * @param *upper The ir_node that represents the upper bound for the index.
2714 ir_node *new_r_Bound(ir_graph *irg, ir_node *block,
2715 ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
2717 /*-----------------------------------------------------------------------*/
2718 /* The block oriented interface */
2719 /*-----------------------------------------------------------------------*/
2721 /** Sets the current block in which the following constructors place the
2722 * nodes they construct.
2724 * @param target The new current block.
2726 void set_cur_block (ir_node *target);
2728 /** Returns the current block of the current graph. */
2729 ir_node *get_cur_block(void);
2731 /** Returns the fixed nodes of the current graph. */
2732 #define get_cur_end_block() get_irg_end_block(current_ir_graph)
2733 #define get_cur_end() get_irg_end(current_ir_graph)
2734 #define get_cur_start_block() get_irg_start_block(current_ir_graph)
2735 #define get_cur_start() get_irg_start(current_ir_graph)
2737 /** Constructor for a Block node.
2739 * Adds the block to the graph in current_ir_graph. Constructs a Block
2740 * with a fixed number of predecessors. Does set current_block. Can
2741 * be used with automatic Phi node construction.
2743 * @param *db A Pointer for debug information.
2744 * @param arity The number of control predecessors.
2745 * @param in[] An array of control predecessors. The length of
2746 * the array must be 'arity'.
2748 ir_node *new_d_Block(dbg_info *db, int arity, ir_node *in[]);
2750 /** Constructor for a Start node.
2752 * Adds the node to the block in current_ir_block.
2754 * @param *db A pointer for debug information.
2756 ir_node *new_d_Start (dbg_info *db);
2758 /** Constructor for a End node.
2760 * Adds the node to the block in current_ir_block.
2762 * @param *db A pointer for debug information.
2764 ir_node *new_d_End (dbg_info *db);
2766 /** Constructor for a Jmp node.
2768 * Adds the node to the block in current_ir_block.
2770 * Jmp represents control flow to a single control successor.
2772 * @param *db A pointer for debug information.
2774 ir_node *new_d_Jmp (dbg_info *db);
2776 /** Constructor for an IJmp node.
2778 * IJmp represents control flow to a single control successor not
2779 * statically known i.e. an indirect Jmp.
2781 * @param *db A pointer for debug information.
2782 * @param *tgt The ir node representing the target address.
2784 ir_node *new_d_IJmp (dbg_info *db, ir_node *tgt);
2786 /** Constructor for a Cond node.
2788 * Adds the node to the block in current_ir_block.
2790 * If c is mode_b represents a conditional branch (if/else). If c is
2791 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2792 * node, default Proj is 0.)
2794 * This is not consistent: Input to Cond is Is, Proj has as proj number
2797 * @param *db A pointer for debug information.
2798 * @param *c The conditions parameter.Can be of mode b or I_u.
2800 ir_node *new_d_Cond (dbg_info *db, ir_node *c);
2802 /** Constructor for a Return node.
2804 * Adds the node to the block in current_ir_block.
2806 * Returns the memory an zero or more return values. Only node that
2807 * can end regular control flow.
2809 * @param *db A pointer for debug information.
2810 * @param *store The state of memory.
2811 * @param arity Number of array indices.
2812 * @param *in Array with index inputs to the node.
2814 ir_node *new_d_Return (dbg_info *db, ir_node *store, int arity, ir_node *in[]);
2816 /** Constructor for a Const_type node.
2818 * Adds the node to the block in current_ir_block.
2820 * The constant represents a target value. This constructor sets high
2821 * level type information for the constant value.
2823 * @param *db A pointer for debug information.
2824 * @param *mode The mode of the operands and results.
2825 * @param *con Points to an entry in the constant table. This pointer is
2826 added to the attributes of the node.
2827 * @param *tp The type of the constant.
2829 ir_node *new_d_Const_type (dbg_info *db, ir_mode *mode, tarval *con, ir_type *tp);
2831 /** Constructor for a Const node.
2833 * Adds the node to the block in current_ir_block.
2835 * Constructor for a Const node. The constant represents a target
2836 * value. Sets the type information to type_unknown. (No more
2837 * supported: If tv is entity derives a somehow useful type.)
2839 * @param *db A pointer for debug information.
2840 * @param *mode The mode of the operands and results.
2841 * @param *con Points to an entry in the constant table. This pointer is added
2842 * to the attributes of the node.
2844 ir_node *new_d_Const (dbg_info *db, ir_mode *mode, tarval *con);
2846 /** Constructor for a SymConst_type node.
2848 * Adds the node to the block in current_ir_block.
2849 * This is the constructor for a symbolic constant.
2850 * There are four kinds of symbolic constants:
2851 * - type_tag The symbolic constant represents a type tag. The type the
2852 * tag stands for is given explicitly.
2853 * - size The symbolic constant represents the size of a type. The
2854 * type of which the constant represents the size is given
2856 * - addr_name The symbolic constant represents the address of an entity
2857 * (variable or method). The variable is indicated by a name
2858 * that is valid for linking.
2859 * - addr_ent The symbolic constant represents the address of an entity
2860 * (variable or method). The variable is given explicitly by
2863 * Inputs to the node:
2864 * No inputs except the block it belongs to.
2865 * Outputs of the node.
2866 * An unsigned integer (I_u) or a pointer (P).
2868 * @param *db A pointer for debug information.
2869 * @param value A type, entity or ident depending on the SymConst kind.
2870 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size,
2871 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
2872 * @param tp The source type of the constant.
2874 ir_node *new_d_SymConst_type (dbg_info *db, union symconst_symbol value, symconst_kind kind, ir_type *tp);
2876 /** Constructor for a SymConst node.
2878 * Same as new_d_SymConst_type, except that it sets the type to type_unknown. */
2879 ir_node *new_d_SymConst (dbg_info *db, union symconst_symbol value, symconst_kind kind);
2881 /** Constructor for a simpleSel node.
2883 * This is a shortcut for the new_d_Sel() constructor. To be used for
2884 * Sel nodes that do not select from an array, i.e., have no index
2885 * inputs. It adds the two parameters 0, NULL.
2887 * @param *db A pointer for debug information.
2888 * @param *store The memory in which the object the entity should be
2889 * selected from is allocated.
2890 * @param *objptr The object from that the Sel operation selects a
2891 * single attribute out.
2892 * @param *ent The entity to select.
2894 ir_node *new_d_simpleSel(dbg_info *db, ir_node *store, ir_node *objptr, entity *ent);
2896 /** Constructor for a Sel node.
2898 * The select node selects an entity (field or method) from an entity
2899 * with a compound type. It explicitly specifies the entity selected.
2900 * Dynamically the node may select entities that overwrite the given
2901 * entity. If the selected entity is an array element entity the Sel
2902 * node takes the required array indices as inputs.
2903 * Adds the node to the block in current_ir_block.
2905 * @param *db A pointer for debug information.
2906 * @param *store The memory in which the object the entity should be selected
2907 * from is allocated.
2908 * @param *objptr A pointer to a compound entity the Sel operation selects a
2909 * single attribute from.
2910 * @param arity The number of array indices needed to select an array element entity.
2911 * @param *in[] If the compound entity is an array the indices of the selected
2912 * element entity. The constructor copies this array.
2913 * @param *ent The entity to select.
2915 ir_node *new_d_Sel (dbg_info *db, ir_node *store, ir_node *objptr, int arity, ir_node *in[],
2918 /** Constructor for a Call node.
2920 * Represents all kinds of method and function calls.
2921 * Adds the node to the block in current_ir_block.
2923 * @param *db A pointer for debug information.
2924 * @param *store The actual store.
2925 * @param *callee A pointer to the called procedure.
2926 * @param arity The number of procedure parameters.
2927 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2928 * @param *tp Type information of the procedure called.
2930 ir_node *new_d_Call (dbg_info *db, ir_node *store, ir_node *callee, int arity, ir_node *in[],
2933 /** Constructor for a Add node.
2935 * Adds the node to the block in current_ir_block.
2937 * @param *db A pointer for debug information.
2938 * @param *op1 The first operand.
2939 * @param *op2 The second operand.
2940 * @param *mode The mode of the operands and the result.
2942 ir_node *new_d_Add (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2944 /** Constructor for a Sub node.
2946 * Adds the node to the block in current_ir_block.
2948 * @param *db A pointer for debug information.
2949 * @param *op1 The first operand.
2950 * @param *op2 The second operand.
2951 * @param *mode The mode of the operands and the result.
2953 ir_node *new_d_Sub (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2955 /** Constructor for a Minus node.
2957 * Adds the node to the block in current_ir_block.
2959 * @param *db A pointer for debug information.
2960 * @param *op The operand .
2961 * @param *mode The mode of the operand and the result.
2963 ir_node *new_d_Minus (dbg_info *db, ir_node *op, ir_mode *mode);
2965 /** Constructor for a Mul node.
2967 * Adds the node to the block in current_ir_block.
2969 * @param *db A pointer for debug information.
2970 * @param *op1 The first operand.
2971 * @param *op2 The second operand.
2972 * @param *mode The mode of the operands and the result.
2974 ir_node *new_d_Mul (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2976 /** Constructor for a Quot node.
2978 * Adds the node to the block in current_ir_block.
2980 * @param *db A pointer for debug information.
2981 * @param *memop The store needed to model exceptions
2982 * @param *op1 The first operand.
2983 * @param *op2 The second operand.
2985 ir_node *new_d_Quot (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
2987 /** Constructor for a DivMod node.
2989 * Adds the node to the block in current_ir_block.
2991 * @param *db A pointer for debug information.
2992 * @param *memop The store needed to model exceptions
2993 * @param *op1 The first operand.
2994 * @param *op2 The second operand.
2996 ir_node *new_d_DivMod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
2998 /** Constructor for a Div node.
3000 * Adds the node to the block in current_ir_block.
3002 * @param *db A pointer for debug information.
3003 * @param *memop The store needed to model exceptions
3004 * @param *op1 The first operand.
3005 * @param *op2 The second operand.
3007 ir_node *new_d_Div (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
3009 /** Constructor for a Mod node.
3011 * Adds the node to the block in current_ir_block.
3013 * @param *db A pointer for debug information.
3014 * @param *memop The store needed to model exceptions
3015 * @param *op1 The first operand.
3016 * @param *op2 The second operand.
3018 ir_node *new_d_Mod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
3020 /** Constructor for a Abs node.
3022 * Adds the node to the block in current_ir_block.
3024 * @param *db A pointer for debug information.
3025 * @param *op The operand
3026 * @param *mode The mode of the operands and the result.
3028 ir_node *new_d_Abs (dbg_info *db, ir_node *op, ir_mode *mode);
3030 /** Constructor for a And node.
3032 * Adds the node to the block in current_ir_block.
3034 * @param *db A pointer for debug information.
3035 * @param *op1 The first operand.
3036 * @param *op2 The second operand.
3037 * @param *mode The mode of the operands and the result.
3039 ir_node *new_d_And (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3041 /** Constructor for a Or node.
3043 * Adds the node to the block in current_ir_block.
3045 * @param *db A pointer for debug information.
3046 * @param *op1 The first operand.
3047 * @param *op2 The second operand.
3048 * @param *mode The mode of the operands and the result.
3050 ir_node *new_d_Or (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3052 /** Constructor for a Eor node.
3054 * Adds the node to the block in current_ir_block.
3056 * @param *db A pointer for debug information.
3057 * @param *op1 The first operand.
3058 * @param *op2 The second operand.
3059 * @param *mode The mode of the operands and the results.
3061 ir_node *new_d_Eor (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3063 /** Constructor for a Not node.
3065 * Adds the node to the block in current_ir_block.
3067 * @param *db A pointer for debug information.
3068 * @param *op The operand.
3069 * @param *mode The mode of the operand and the result.
3071 ir_node *new_d_Not (dbg_info *db, ir_node *op, ir_mode *mode);
3073 /** Constructor for a Shl node.
3075 * Adds the node to the block in current_ir_block.
3077 * @param *db A pointer for debug information.
3078 * @param *op The operand.
3079 * @param *k The number of bits to shift the operand .
3080 * @param *mode The mode of the operand and the result.
3082 ir_node *new_d_Shl (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3084 /** Constructor for a Shr node.
3086 * Adds the node to the block in current_ir_block.
3088 * @param *db A pointer for debug information.
3089 * @param *op The operand.
3090 * @param *k The number of bits to shift the operand .
3091 * @param *mode The mode of the operand and the result.
3093 ir_node *new_d_Shr (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3095 /** Constructor for a Shrs node.
3097 * Adds the node to the block in current_ir_block.
3099 * @param *db A pointer for debug information.
3100 * @param *op The operand.
3101 * @param *k The number of bits to shift the operand .
3102 * @param *mode The mode of the operand and the result.
3104 ir_node *new_d_Shrs (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3106 /** Constructor for a Rot node.
3108 * Adds the node to the block in current_ir_block.
3110 * @param *db A pointer for debug information.
3111 * @param *op The operand.
3112 * @param *k The number of bits to rotate the operand.
3113 * @param *mode The mode of the operand.
3115 ir_node *new_d_Rot (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3117 /** Constructor for a Cmp node.
3119 * Adds the node to the block in current_ir_block.
3121 * @param *db A pointer for debug information.
3122 * @param *op1 The first operand.
3123 * @param *op2 The second operand.
3125 ir_node *new_d_Cmp (dbg_info *db, ir_node *op1, ir_node *op2);
3127 /** Constructor for a Conv node.
3129 * Adds the node to the block in current_ir_block.
3131 * @param *db A pointer for debug information.
3132 * @param *op The operand.
3133 * @param *mode The mode of this the operand muss be converted .
3135 ir_node *new_d_Conv (dbg_info *db, ir_node *op, ir_mode *mode);
3137 /** Constructor for a strict Conv node.
3139 * Adds the node to the block in current_ir_block.
3141 * @param *db A pointer for debug information.
3142 * @param *op The operand.
3143 * @param *mode The mode of this the operand muss be converted .
3145 ir_node *new_d_strictConv (dbg_info *db, ir_node *op, ir_mode *mode);
3147 /** Constructor for a Cast node.
3149 * High level type cast
3150 * Adds the node to the block in current_ir_block.
3152 * @param *db A pointer for debug information.
3153 * @param *op The operand.
3154 * @param *to_tp The type of this the operand muss be casted .
3156 ir_node *new_d_Cast (dbg_info *db, ir_node *op, ir_type *to_tp);
3158 /** Constructor for a Carry node.
3160 * Adds the node to the block in current_ir_block.
3162 * @param *db A pointer for debug information.
3163 * @param *op1 The first operand.
3164 * @param *op2 The second operand.
3165 * @param *mode The mode of the operands and the result.
3167 ir_node *new_d_Carry (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3169 /** Constructor for a Borrow node.
3171 * Adds the node to the block in current_ir_block.
3173 * @param *db A pointer for debug information.
3174 * @param *op1 The first operand.
3175 * @param *op2 The second operand.
3176 * @param *mode The mode of the operands and the result.
3178 ir_node *new_d_Borrow (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3180 /** Constructor for a Phi node.
3182 * Adds the node to the block in current_ir_block.
3184 * @param *db A pointer for debug information.
3185 * @param arity The number of predecessors
3186 * @param *in Array with predecessors
3187 * @param *mode The mode of it's inputs and output.
3189 ir_node *new_d_Phi (dbg_info *db, int arity, ir_node *in[], ir_mode *mode);
3191 /** Constructor for a Load node.
3193 * Adds the node to the block in current_ir_block.
3195 * @param *db A pointer for debug information.
3196 * @param *store The current memory
3197 * @param *addr A pointer to the variable to be read in this memory.
3198 * @param *mode The mode of the value to be loaded.
3200 ir_node *new_d_Load (dbg_info *db, ir_node *store, ir_node *addr, ir_mode *mode);
3202 /** Constructor for a Store node.
3204 * Adds the node to the block in current_ir_block.
3206 * @param *db A pointer for debug information.
3207 * @param *store The current memory
3208 * @param *addr A pointer to the variable to be read in this memory.
3209 * @param *val The value to write to this variable.
3211 ir_node *new_d_Store (dbg_info *db, ir_node *store, ir_node *addr, ir_node *val);
3213 /** Constructor for a Alloc node.
3215 * The Alloc node extends the memory by space for an entity of type alloc_type.
3216 * Adds the node to the block in current_ir_block.
3218 * @param *db A pointer for debug information.
3219 * @param *store The memory which shall contain the new variable.
3220 * @param *size The number of bytes to allocate.
3221 * @param *alloc_type The type of the allocated variable.
3222 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3224 ir_node *new_d_Alloc (dbg_info *db, ir_node *store, ir_node *size, ir_type *alloc_type,
3227 /** Constructor for a Free node.
3229 * Frees the memory occupied by the entity pointed to by the pointer
3230 * arg. Type indicates the type of the entity the argument points to.
3231 * Adds the node to the block in current_ir_block.
3233 * @param *db A pointer for debug information.
3234 * @param *store The memory which shall contain the new variable.
3235 * @param *ptr The pointer to the object to free.
3236 * @param *size The number of objects of type free_type to free in a sequence.
3237 * @param *free_type The type of the freed variable.
3238 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
3240 ir_node *new_d_Free (dbg_info *db, ir_node *store, ir_node *ptr, ir_node *size,
3241 ir_type *free_type, where_alloc where);
3243 /** Constructor for a Sync node.
3245 * Merges several memory values. The node assumes that a variable
3246 * either occurs only in one of the memories, or it contains the same
3247 * value in all memories where it occurs.
3248 * Adds the node to the block in current_ir_block.
3250 * @param *db A pointer for debug information.
3251 * @param arity The number of memories to synchronize.
3252 * @param **in An array of pointers to nodes that produce an output of type
3253 * memory. The constructor copies this array.
3255 ir_node *new_d_Sync (dbg_info *db, int arity, ir_node *in[]);
3257 /** Constructor for a Proj node.
3259 * Projects a single value out of a tuple. The parameter proj gives the
3260 * position of the value within the tuple.
3261 * Adds the node to the block in current_ir_block.
3263 * @param *db A pointer for deubug information.
3264 * @param arg A node producing a tuple.
3265 * @param *mode The mode of the value to project.
3266 * @param proj The position of the value in the tuple.
3268 ir_node *new_d_Proj (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3270 /** Constructor for a defaultProj node.
3272 * Represents the default control flow of a Switch-Cond node.
3273 * Adds the node to the block in current_ir_block.
3275 * @param *db A pointer for debug information.
3276 * @param arg A node producing a tuple.
3277 * @param max_proj The end position of the value in the tuple.
3279 ir_node *new_d_defaultProj (dbg_info *db, ir_node *arg, long max_proj);
3281 /** Constructor for a Tuple node.
3283 * This is an auxiliary node to replace a node that returns a tuple
3284 * without changing the corresponding Proj nodes.
3285 * Adds the node to the block in current_ir_block.
3287 * @param *db A pointer for debug information.
3288 * @param arity The number of tuple elements.
3289 * @param **in An array containing pointers to the nodes producing the tuple elements.
3291 ir_node *new_d_Tuple (dbg_info *db, int arity, ir_node *in[]);
3293 /** Constructor for a Id node.
3295 * This is an auxiliary node to replace a node that returns a single
3296 * value. Adds the node to the block in current_ir_block.
3298 * @param *db A pointer for debug information.
3299 * @param *val The operand to Id.
3300 * @param *mode The mode of *val.
3302 ir_node *new_d_Id (dbg_info *db, ir_node *val, ir_mode *mode);
3304 /** Constructor for a Bad node.
3306 * Returns the unique Bad node of the graph. The same as
3309 ir_node *new_d_Bad (void);
3311 /** Constructor for a Confirm node.
3313 * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3314 * Specifies constraints for a value. To support dataflow analyses.
3316 * Example: If the value never exceeds '100' this is expressed by placing a
3317 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
3319 * @param *db A pointer for debug information.
3320 * @param *val The value we express a constraint for
3321 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3322 * @param cmp The compare operation.
3324 ir_node *new_d_Confirm (dbg_info *db, ir_node *val, ir_node *bound, pn_Cmp cmp);
3326 /** Constructor for an Unknown node.
3328 * Represents an arbitrary value. Places the node in
3331 * @param *m The mode of the unknown value.
3333 ir_node *new_d_Unknown(ir_mode *m);
3335 /** Constructor for a CallBegin node.
3337 * CallBegin represents control flow depending of the pointer value
3338 * representing the called method to the called methods. The
3339 * constructor copies the method pointer input from the passed Call
3340 * node.Adds the node to the block in current_ir_block.
3342 * @param *db A pointer for debug information.
3343 * @param *callee The call node visible in the intra procedural view.
3345 ir_node *new_d_CallBegin(dbg_info *db, ir_node *callee);
3347 /** Constructor for an EndReg node.
3349 *Adds the node to the block in current_ir_block.
3351 * @param *db A pointer for debug information.
3353 ir_node *new_d_EndReg (dbg_info *db);
3355 /** Constructor for an EndExcept node.
3357 * Used to represent regular procedure end in interprocedual view.
3358 * Adds the node to the block in current_ir_block.
3360 * @param *db A pointer for debug information.
3362 ir_node *new_d_EndExcept(dbg_info *db);
3364 /** Constructor for a Break node.
3366 * Used to represent exceptional procedure end in interprocedural view.
3367 * Adds the node to the block in current_ir_block.
3369 * Break represents control flow to a single control successor just as Jmp.
3370 * The blocks separated by a break may not be concatenated by an optimization.
3371 * It is used for the interprocedural representation where blocks are parted
3372 * behind Call nodes to represent the control flow to called procedures.
3374 * @param *db A pointer for debug information.
3376 ir_node *new_d_Break (dbg_info *db);
3378 /** Constructor for a Filter node.
3380 * Constructor for a Filter node. Adds the node to the block in
3381 * current_ir_block. Filter is a node with two views used to
3382 * construct the interprocedural view. In intraprocedural view its
3383 * semantics are identical to the Proj node. In interprocedural view
3384 * the Filter performs the Phi operation on method parameters or
3385 * results. Other than a Phi a Filter node may not be removed if it
3386 * has only a single input.
3388 * The constructor builds the Filter in intraprocedural view.
3390 * @param *db A pointer for debug information.
3391 * @param *arg The tuple value to project from.
3392 * @param *mode The mode of the projected value.
3393 * @param proj The position in the tuple to project from.
3395 ir_node *new_d_Filter (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3398 /** Constructor for a NoMem node.
3400 * Returns the unique NoMem node of the graph. The same as
3403 ir_node *new_d_NoMem (void);
3405 /** Constructor for a Mux node.
3407 * @param *db A pointer for debug information.
3408 * @param *sel The ir_node that calculates the boolean select.
3409 * @param *ir_true The ir_node that calculates the true result.
3410 * @param *ir_false The ir_node that calculates the false result.
3411 * @param *mode The mode of the node (and it_true and ir_false).
3413 ir_node *new_d_Mux (dbg_info *db, ir_node *sel,
3414 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
3416 /** Constructor for a Psi node.
3418 * @param *db A pointer for debug information.
3419 * @param *arity The arity of the conditions
3420 * @param *conds The array of mode_b conditions, length must be equal arity
3421 * @param *vals The array of mode values, length must be equal arity + 1
3422 * @param *mode The mode of the node (must be the mode of all vals).
3424 ir_node *new_d_Psi (dbg_info *db,
3425 int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
3427 /** Constructor for a CopyB node.
3429 * @param *db A pointer for debug information.
3430 * @param *store The current memory
3431 * @param *dst The ir_node that represents the destination address.
3432 * @param *src The ir_node that represents the source address.
3433 * @param *data_type The type of the copied data
3435 ir_node *new_d_CopyB(dbg_info *db, ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
3437 /** Constructor for a InstOf node.
3439 * A High-Level Type check.
3441 * @param *db A pointer for debug information.
3442 * @param *store The memory in which the object the entity should be selected
3443 * from is allocated.
3444 * @param *objptr A pointer to a object of a class type.
3445 * @param *type The type of which objptr must be.
3447 ir_node *new_d_InstOf (dbg_info *db, ir_node *store, ir_node *objptr, ir_type *type);
3449 /** Constructor for a Raise node.
3451 * A High-Level Exception throw.
3453 * @param *db A pointer for debug information.
3454 * @param *store The current memory.
3455 * @param *obj A pointer to the Except variable.
3457 ir_node *new_d_Raise (dbg_info *db, ir_node *store, ir_node *obj);
3459 /** Constructor for a Bound node.
3461 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
3463 * @param *db A pointer for debug information.
3464 * @param *store The current memory
3465 * @param *idx The ir_node that represents an index.
3466 * @param *lower The ir_node that represents the lower bound for the index.
3467 * @param *upper The ir_node that represents the upper bound for the index.
3469 ir_node *new_d_Bound(dbg_info *db, ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
3471 /*-----------------------------------------------------------------------*/
3472 /* The block oriented interface without debug support */
3473 /*-----------------------------------------------------------------------*/
3475 /* Needed from the interface with debug support:
3476 void set_cur_block (ir_node *target); */
3478 /** Constructor for a Block node.
3480 * Constructor for a Block node. Adds the block to the graph in
3481 * current_ir_graph. Constructs a Block with a fixed number of
3482 * predecessors. Does set current_block. Can be used with automatic
3483 * Phi node construction.
3485 * @param arity The number of control predecessors.
3486 * @param in An array of control predecessors. The length of
3487 * the array must be 'arity'.
3489 ir_node *new_Block(int arity, ir_node *in[]);
3491 /** Constructor for a Start node.
3493 * Adds the node to the block in current_ir_block.
3496 ir_node *new_Start (void);
3498 /** Constructor for an End node.
3500 * Adds the node to the block in current_ir_block.
3502 ir_node *new_End (void);
3504 /** Constructor for an EndReg node.
3506 * Used to represent regular procedure end in interprocedual view.
3507 * Adds the node to the block in current_ir_block.
3509 ir_node *new_EndReg (void);
3511 /** Constructor for an EndExpcept node.
3513 * Used to represent exceptional procedure end in interprocedural view.
3514 * Adds the node to the block in current_ir_block.
3516 ir_node *new_EndExcept(void);
3518 /** Constructor for a Jump node.
3520 * Adds the node to the block in current_ir_block.
3522 * Jmp represents control flow to a single control successor.
3524 ir_node *new_Jmp (void);
3526 /** Constructor for an IJmp node.
3528 * IJmp represents control flow to a single control successor not
3529 * statically known i.e. an indirect Jmp.
3531 * @param *tgt The ir node representing the target address.
3533 ir_node *new_IJmp (ir_node *tgt);
3535 /** Constructor for a Break node.
3536 * Break represents control flow to a single control successor just as Jmp.
3537 * The blocks separated by a break may not be concatenated by an optimization.
3538 * It is used for the interprocedural representation where blocks are parted
3539 * behind Call nodes to represent the control flow to called procedures.
3540 * Adds the node to the block in current_ir_block.
3542 ir_node *new_Break (void);
3544 /** Constructor for a Cond node.
3546 * If c is mode_b represents a conditional branch (if/else). If c is
3547 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
3548 * node, default Proj is 0.). Adds the node to the block in current_ir_block.
3550 * This is not consistent: Input to Cond is Is, Proj has as proj number
3554 * @param *c The conditions parameter.Can be of mode b or I_u.
3556 ir_node *new_Cond (ir_node *c);
3558 /** Constructor for a Return node.
3560 * Returns the memory an zero or more return values. Only node that
3561 * can end regular control flow. Adds the node to the block in current_ir_block.
3563 * @param *store The state of memory.
3564 * @param arity Number of array indices.
3565 * @param *in Array with index inputs to the node.
3567 ir_node *new_Return (ir_node *store, int arity, ir_node *in[]);
3569 /** Constructor for a Const node.
3571 * Constructor for a Const node. The constant represents a target
3572 * value. Sets the type information to type_unknown. (No more
3573 * supported: If tv is entity derives a somehow useful type.)
3574 * Adds the node to the block in current_ir_block.
3576 * @param *mode The mode of the operands and results.
3577 * @param *con Points to an entry in the constant table. This pointer is
3578 * added to the attributes of the node.
3580 ir_node *new_Const (ir_mode *mode, tarval *con);
3583 * Make a const from a long.
3584 * This is just convenience for the usual
3586 * new_Const(mode, tarval_from_long(mode, ...))
3589 * @param mode The mode for the const.
3590 * @param value The value of the constant.
3591 * @return A new const node.
3593 ir_node *new_Const_long(ir_mode *mode, long value);
3595 /** Constructor for a Const node.
3597 * Derives mode from passed type. */
3598 ir_node *new_Const_type(tarval *con, ir_type *tp);
3600 /** Constructor for a SymConst node.
3602 * Adds the node to the block in current_ir_block.
3603 * This is the constructor for a symbolic constant.
3604 * There are four kinds of symbolic constants:
3605 * -# type_tag The symbolic constant represents a type tag. The type the
3606 * tag stands for is given explicitly.
3607 * -# size The symbolic constant represents the size of a type. The
3608 * type of which the constant represents the size is given
3610 * -# align The symbolic constant represents the alignment of a type. The
3611 * type of which the constant represents the size is given
3613 * -# addr_name The symbolic constant represents the address of an entity
3614 * (variable or method). The variable is indicated by a name
3615 * that is valid for linking.
3616 * -# addr_ent The symbolic constant represents the address of an entity
3617 * (variable or method). The variable is given explicitly by
3620 * Inputs to the node:
3621 * No inputs except the block it belongs to.
3622 * Outputs of the node.
3623 * An unsigned integer (I_u) or a pointer (P).
3625 * @param value A type or a ident depending on the SymConst kind.
3626 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3627 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
3629 ir_node *new_SymConst (union symconst_symbol value, symconst_kind kind);
3631 /** Constructor for a simpelSel node.
3633 * This is a shortcut for the new_Sel() constructor. To be used for
3634 * Sel nodes that do not select from an array, i.e., have no index
3635 * inputs. It adds the two parameters 0, NULL.
3637 * @param *store The memory in which the object the entity should be selected from is allocated.
3638 * @param *objptr The object from that the Sel operation selects a single attribute out.
3639 * @param *ent The entity to select.
3641 ir_node *new_simpleSel(ir_node *store, ir_node *objptr, entity *ent);
3643 /** Constructor for a Sel node.
3645 * The select node selects an entity (field or method) from an entity
3646 * with a compound type. It explicitly specifies the entity selected.
3647 * Dynamically the node may select entities that overwrite the given
3648 * entity. If the selected entity is an array element entity the Sel
3649 * node takes the required array indices as inputs.
3650 * Adds the node to the block in current_ir_block.
3652 * @param *store The memory in which the object the entity should be selected
3653 * from is allocated.
3654 * @param *objptr A pointer to a compound entity the Sel operation selects a
3655 * single attribute from.
3656 * @param arity The number of array indices needed to select an array element entity.
3657 * @param *in[] If the compound entity is an array the indices of the selected
3658 * element entity. The constructor copies this array.
3659 * @param *ent The entity to select.
3661 ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3664 /** Constructor for a Call node.
3666 * Adds the node to the block in current_ir_block.
3667 * Represents all kinds of method and function calls.
3669 * @param *store The actual store.
3670 * @param *callee A pointer to the called procedure.
3671 * @param arity The number of procedure parameters.
3672 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3673 * @param *tp Type information of the procedure called.
3675 ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node *in[],
3678 /** Constructor for a CallBegin node.
3680 * CallBegin represents control flow depending of the pointer value
3681 * representing the called method to the called methods. The
3682 * constructor copies the method pointer input from the passed Call
3683 * node. Adds the node to the block in current_ir_block.
3685 * @param *callee A pointer to the called procedure.
3687 ir_node *new_CallBegin(ir_node *callee);
3689 /** Constructor for a Add node.
3691 * Adds the node to the block in current_ir_block.
3693 * @param *op1 The first operand.
3694 * @param *op2 The second operand.
3695 * @param *mode The mode of the operands and the result.
3697 ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
3699 /** Constructor for a Sub node.
3701 * Adds the node to the block in current_ir_block.
3703 * @param *op1 The first operand.
3704 * @param *op2 The second operand.
3705 * @param *mode The mode of the operands and the result.
3707 ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
3709 /** Constructor for a Minus node.
3711 * Adds the node to the block in current_ir_block.
3713 * @param *op The operand .
3714 * @param *mode The mode of the operand and the result.
3716 ir_node *new_Minus (ir_node *op, ir_mode *mode);
3719 * Constructor for a Mul node. Adds the node to the block in current_ir_block.
3721 * @param *op1 The first operand.
3722 * @param *op2 The second operand.
3723 * @param *mode The mode of the operands and the result.
3725 ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
3727 /** Constructor for a Quot node.
3729 * Adds the node to the block in current_ir_block.
3731 * @param *memop The store needed to model exceptions
3732 * @param *op1 The first operand.
3733 * @param *op2 The second operand.
3735 ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2);
3737 /** Constructor for a DivMod node.
3739 * Adds the node to the block in current_ir_block.
3741 * @param *memop The store needed to model exceptions
3742 * @param *op1 The first operand.
3743 * @param *op2 The second operand.
3745 ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
3747 /** Constructor for a Div node.
3749 * Adds the node to the block in current_ir_block.
3751 * @param *memop The store needed to model exceptions
3752 * @param *op1 The first operand.
3753 * @param *op2 The second operand.
3755 ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2);
3757 /** Constructor for a Mod node.
3759 * Adds the node to the block in current_ir_block.
3761 * @param *memop The store needed to model exceptions
3762 * @param *op1 The first operand.
3763 * @param *op2 The second operand.
3765 ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2);
3767 /** Constructor for a Abs node.
3769 * Adds the node to the block in current_ir_block.
3771 * @param *op The operand
3772 * @param *mode The mode of the operands and the result.
3774 ir_node *new_Abs (ir_node *op, ir_mode *mode);
3776 /** Constructor for a And node.
3778 * Adds the node to the block in current_ir_block.
3780 * @param *op1 The first operand.
3781 * @param *op2 The second operand.
3782 * @param *mode The mode of the operands and the result.
3784 ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
3787 * Constructor for a Or node. Adds the node to the block in current_ir_block.
3789 * @param *op1 The first operand.
3790 * @param *op2 The second operand.
3791 * @param *mode The mode of the operands and the result.
3793 ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
3796 * Constructor for a Eor node. Adds the node to the block in current_ir_block.
3798 * @param *op1 The first operand.
3799 * @param *op2 The second operand.
3800 * @param *mode The mode of the operands and the results.
3802 ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
3804 /** Constructor for a Not node.
3806 * Adds the node to the block in current_ir_block.
3808 * @param *op The operand.
3809 * @param *mode The mode of the operand and the result.
3811 ir_node *new_Not (ir_node *op, ir_mode *mode);
3813 /** Constructor for a Shl node.
3815 * Adds the node to the block in current_ir_block.
3817 * @param *op The operand.
3818 * @param *k The number of bits to shift the operand .
3819 * @param *mode The mode of the operand and the result.
3821 ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
3824 * Constructor for a Shr node. Adds the node to the block in current_ir_block.
3826 * @param *op The operand.
3827 * @param *k The number of bits to shift the operand .
3828 * @param *mode The mode of the operand and the result.
3830 ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
3832 /** Constructor for a Shrs node.
3834 * Adds the node to the block in current_ir_block.
3836 * @param *op The operand.
3837 * @param *k The number of bits to shift the operand .
3838 * @param *mode The mode of the operand and the result.
3840 ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
3842 /** Constructor for a Rot node.
3844 * Adds the node to the block in current_ir_block.
3846 * @param *op The operand.
3847 * @param *k The number of bits to rotate the operand.
3848 * @param *mode The mode of the operand.
3850 ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode);
3852 /** Constructor for a Cmp node.
3854 * Adds the node to the block in current_ir_block.
3856 * @param *op1 The first operand.
3857 * @param *op2 The second operand.
3859 ir_node *new_Cmp (ir_node *op1, ir_node *op2);
3861 /** Constructor for a Conv node.
3863 * Adds the node to the block in current_ir_block.
3865 * @param *op The operand.
3866 * @param *mode The mode of this the operand muss be converted.
3868 ir_node *new_Conv (ir_node *op, ir_mode *mode);
3870 /** Constructor for a strict Conv node.
3872 * Adds the node to the block in current_ir_block.
3874 * @param *op The operand.
3875 * @param *mode The mode of this the operand muss be converted.
3877 ir_node *new_strictConv (ir_node *op, ir_mode *mode);
3879 /** Constructor for a Cast node.
3881 * Adds the node to the block in current_ir_block.
3882 * High level type cast
3884 * @param *op The operand.
3885 * @param *to_tp The type of this the operand muss be casted .
3887 ir_node *new_Cast (ir_node *op, ir_type *to_tp);
3889 /** Constructor for a Carry node.
3891 * Adds the node to the block in current_ir_block.
3893 * @param *op1 The first operand.
3894 * @param *op2 The second operand.
3895 * @param *mode The mode of the operands and the result.
3897 ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode);
3899 /** Constructor for a Borrow node.
3901 * Adds the node to the block in current_ir_block.
3903 * @param *op1 The first operand.
3904 * @param *op2 The second operand.
3905 * @param *mode The mode of the operands and the result.
3907 ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode);
3909 /** Constructor for a Phi node.
3911 * Adds the node to the block in current_ir_block.
3913 * @param arity The number of predecessors.
3914 * @param *in Array with predecessors.
3915 * @param *mode The mode of it's inputs and output.
3917 ir_node *new_Phi (int arity, ir_node *in[], ir_mode *mode);
3919 /** Constructor for a Load node.
3921 * @param *store The current memory.
3922 * @param *addr A pointer to the variable to be read in this memory.
3923 * @param *mode The mode of the value to be loaded.
3925 ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode);
3927 /** Constructor for a Store node.
3929 * @param *store The current memory.
3930 * @param *addr A pointer to the variable to be read in this memory.
3931 * @param *val The value to write to this variable.
3933 ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
3935 /** Constructor for a Alloc node.
3937 * The Alloc node extends the memory by space for an entity of type alloc_type.
3938 * Adds the node to the block in current_ir_block.
3940 * @param *store The memory which shall contain the new variable.
3941 * @param *size The number of bytes to allocate.
3942 * @param *alloc_type The type of the allocated variable.
3943 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3945 ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
3948 /** Constructor for a Free node.
3950 * Frees the memory occupied by the entity pointed to by the pointer
3951 * arg. Type indicates the type of the entity the argument points to.
3952 * Adds the node to the block in current_ir_block.
3954 * @param *store The memory which shall contain the new variable.
3955 * @param *ptr The pointer to the object to free.
3956 * @param *size The number of objects of type free_type to free in a sequence.
3957 * @param *free_type The type of the freed variable.
3958 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
3960 ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
3961 ir_type *free_type, where_alloc where);
3963 /** Constructor for a Sync node.
3965 * Merges several memory values. The node assumes that a variable
3966 * either occurs only in one of the memories, or it contains the same
3967 * value in all memories where it occurs.
3968 * Adds the node to the block in current_ir_block.
3970 * @param arity The number of memories to synchronize.
3971 * @param **in An array of pointers to nodes that produce an output of type
3972 * memory. The constructor copies this array.
3974 ir_node *new_Sync (int arity, ir_node *in[]);
3976 /** Constructor for a Proj node.
3978 * Projects a single value out of a tuple. The parameter proj gives the
3979 * position of the value within the tuple.
3980 * Adds the node to the block in current_ir_block.
3982 * @param arg A node producing a tuple.
3983 * @param *mode The mode of the value to project.
3984 * @param proj The position of the value in the tuple.
3986 ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
3988 /** Constructor for a Filter node.
3990 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
3991 * Filter is a node with two views used to construct the interprocedural view.
3992 * In intraprocedural view its semantics are identical to the Proj node.
3993 * In interprocedural view the Filter performs the Phi operation on method
3994 * parameters or results. Other than a Phi a Filter node may not be removed
3995 * if it has only a single input.
3997 * The constructor builds the Filter in intraprocedural view.
3999 * @param *arg The tuple value to project from.
4000 * @param *mode The mode of the projected value.
4001 * @param proj The position in the tuple to project from.
4003 ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj);
4005 /** Constructor for a defaultProj node.
4007 * Represents the default control flow of a Switch-Cond node.
4008 * Adds the node to the block in current_ir_block.
4010 * @param arg A node producing a tuple.
4011 * @param max_proj The end position of the value in the tuple.
4013 ir_node *new_defaultProj (ir_node *arg, long max_proj);
4015 /** Constructor for a Tuple node.
4017 * This is an auxiliary node to replace a node that returns a tuple
4018 * without changing the corresponding Proj nodes.
4019 * Adds the node to the block in current_ir_block.
4021 * @param arity The number of tuple elements.
4022 * @param **in An array containing pointers to the nodes producing the tuple elements.
4024 ir_node *new_Tuple (int arity, ir_node *in[]);
4026 /** Constructor for an Id node.
4028 * This is an auxiliary node to replace a node that returns a single
4029 * value. Adds the node to the block in current_ir_block.
4031 * @param *val The operand to Id.
4032 * @param *mode The mode of *val.
4034 ir_node *new_Id (ir_node *val, ir_mode *mode);
4036 /** Constructor for a Bad node.
4038 * Returns the unique Bad node of the graph. The same as
4041 ir_node *new_Bad (void);
4043 /** Constructor for a Confirm node.
4045 * Specifies constraints for a value. To support dataflow analyses.
4046 * Adds the node to the block in current_ir_block.
4048 * Example: If the value never exceeds '100' this is expressed by placing a
4049 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
4051 * @param *val The value we express a constraint for
4052 * @param *bound The value to compare against. Must be a firm node, typically a constant.
4053 * @param cmp The compare operation.
4055 ir_node *new_Confirm (ir_node *val, ir_node *bound, pn_Cmp cmp);
4057 /** Constructor for an Unknown node.
4059 * Represents an arbitrary value. Places the node in
4062 * @param *m The mode of the unknown value.
4064 ir_node *new_Unknown(ir_mode *m);
4066 /** Constructor for a NoMem node.
4068 * Returns the unique NoMem node of the graph. The same as
4071 ir_node *new_NoMem (void);
4073 /** Constructor for a Mux node.
4075 * Adds the node to the block in current_ir_block.
4077 * @param *sel The ir_node that calculates the boolean select.
4078 * @param *ir_true The ir_node that calculates the true result.
4079 * @param *ir_false The ir_node that calculates the false result.
4080 * @param *mode The mode of the node (and it_true and ir_false).
4082 ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
4084 /** Constructor for a Psi node.
4086 * @param *arity The arity of the conditions
4087 * @param *conds The array of mode_b conditions, length must be equal arity
4088 * @param *vals The array of mode values, length must be equal arity + 1
4089 * @param *mode The mode of the node (must be the mode of all vals).
4091 ir_node *new_Psi (int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
4093 /** Constructor for a CopyB node.
4095 * Adds the node to the block in current_ir_block.
4097 * @param *store The current memory
4098 * @param *dst The ir_node that represents the destination address.
4099 * @param *src The ir_node that represents the source address.
4100 * @param *data_type The type of the copied data
4102 ir_node *new_CopyB(ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
4104 /** Constructor for a InstOf node.
4106 * A High-Level Type check.
4108 * @param *store The memory in which the object the entity should be selected
4109 * from is allocated.
4110 * @param *objptr A pointer to a object of a class type.
4111 * @param *type The type of which objptr must be.
4113 ir_node *new_InstOf (ir_node *store, ir_node *objptr, ir_type *type);
4115 /**Constructor for a Raise node.
4117 * A High-Level Exception throw.
4119 * @param *store The current memory.
4120 * @param *obj A pointer to the Except variable.
4122 ir_node *new_Raise (ir_node *store, ir_node *obj);
4124 /** Constructor for a Bound node.
4126 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
4128 * Adds the node to the block in current_ir_block.
4130 * @param *store The current memory
4131 * @param *idx The ir_node that represents an index.
4132 * @param *lower The ir_node that represents the lower bound for the index.
4133 * @param *upper The ir_node that represents the upper bound for the index.
4135 ir_node *new_Bound(ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
4137 /*---------------------------------------------------------------------*/
4138 /* The comfortable interface. */
4139 /* Supports automatic Phi node construction. */
4140 /* All routines of the block oriented interface except new_Block are */
4142 /*---------------------------------------------------------------------*/
4144 /** Create an immature block.
4146 * An immature block has an unknown number of predecessors. Predecessors
4147 * can be added with add_immBlock_pred(). Once all predecessors are
4148 * added the block must be matured.
4150 * Adds the block to the graph in current_ir_graph. Does set
4151 * current_block. Can be used with automatic Phi node construction.
4152 * This constructor can only be used if the graph is in
4155 ir_node *new_d_immBlock (dbg_info *db);
4156 ir_node *new_immBlock (void);
4158 /** Add a control flow edge to an immature block. */
4159 void add_immBlock_pred (ir_node *immblock, ir_node *jmp);
4161 /** Finalize a Block node, when all control flows are known. */
4162 void mature_immBlock (ir_node *block);
4163 #define mature_cur_block() mature_immBlock(get_cur_block());
4166 /** Get the current value of a local variable.
4168 * Use this function to obtain the last definition of the local variable
4169 * associated with pos. Pos may not exceed the value passed as n_loc
4170 * to new_ir_graph. This call automatically inserts Phi nodes.
4172 * @param *db A pointer for debug information.
4173 * @param pos The position/id of the local variable.
4174 * @param *mode The mode of the value to get.
4176 ir_node *get_d_value (dbg_info *db, int pos, ir_mode *mode);
4177 ir_node *get_value (int pos, ir_mode *mode);
4179 /** Remark a new definition of a variable.
4181 * Use this function to remember a new definition of the value
4182 * associated with pos. Pos may not exceed the value passed as n_loc
4183 * to new_ir_graph. This call is needed to automatically inserts Phi
4186 * @param pos The position/id of the local variable.
4187 * @param *value The new value written to the local variable.
4189 void set_value (int pos, ir_node *value);
4191 /** Get the current memory state.
4193 * Use this function to obtain the last definition of the memory
4194 * state. This call automatically inserts Phi nodes for the memory
4197 ir_node *get_store (void);
4199 /** Remark a new definition of the memory state.
4201 * Use this function to remember a new definition of the memory state.
4202 * This call is needed to automatically inserts Phi nodes.
4204 * @param *store The new memory state.
4206 void set_store (ir_node *store);
4208 /** keep this node alive even if End is not control-reachable from it
4210 * @param ka The node to keep alive.
4212 void keep_alive (ir_node *ka);
4214 /** Returns the frame type of the current graph */
4215 ir_type *get_cur_frame_type(void);
4218 /* --- initialize and finalize ir construction --- */
4220 /** Puts the graph into state "phase_high" */
4221 #define irg_finalize_cons(irg) set_irg_phase_state(irg, phase_high)
4223 /** Puts the program and all graphs into state phase_high.
4225 * This also remarks, the construction of types is finished,
4226 * e.g., that no more subtypes will be added. */
4227 void irp_finalize_cons(void);
4229 /* --- Initialization --- */
4232 * This function is called, whenever a local variable is used before definition
4234 * @param irg the IR graph on which this happens
4235 * @param mode the mode of the local var
4236 * @param pos position chosen be the frontend for this variable (n_loc)
4238 * @return a firm node of mode @p mode that initializes the var at position pos
4241 * Do not return NULL!
4242 * If this function is not set, FIRM will create a const node with tarval BAD.
4243 * Use set_irg_loc_description()/get_irg_loc_description() to assign additional
4244 * informations to local variables.
4246 typedef ir_node *uninitialized_local_variable_func_t(ir_graph *irg, ir_mode *mode, int pos);
4248 #endif /* _FIRM_IR_IRCONS_H_ */