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, Michael Beck
10 * Copyright: (c) 1998-2006 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, ir_entity *ent);
259 * ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity,
260 * ir_node **in, ir_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);
299 * ir_node *new_Pin (ir_node *node);
301 * void add_immBlock_pred (ir_node *block, ir_node *jmp);
302 * void mature_immBlock (ir_node *block);
303 * void set_cur_block (ir_node *target);
304 * ir_node *get_value (int pos, ir_mode *mode);
305 * void set_value (int pos, ir_node *value);
306 * ir_node *get_store (void);
307 * void set_store (ir_node *store);
308 * keep_alive (ir_node ka)
310 * IR_NODES AND CONSTRUCTORS FOR IR_NODES
311 * =======================================
313 * All ir_nodes are defined by a common data structure. They are distinguished
314 * by their opcode and differ in the number of their attributes.
316 * The constructor for the block node sets current_block to itself.
317 * Const nodes are always added to the start block.
318 * All other constructors add the created node to the current_block.
319 * swich_block(block) allows to set the current block to block.
321 * Watch for my inconsistent use of input and predecessor (dataflow view)
322 * and `the node points to' (implementation view).
324 * The following description of the nodes lists four properties them if these
326 * - the parameters to the constructor
327 * - the inputs of the Firm node
328 * - the outputs of the Firm node
329 * - attributes to the node
333 * ir_node *new_immBlock (void)
334 * ----------------------------
336 * Creates a new block. Sets current_block to itself. When a new block is
337 * created it cannot be known how many predecessors this block will have in the
338 * control flow graph. Therefore the list of inputs can not be fixed at
339 * creation. Predecessors can be added with add_immBlock_pred (block, control flow
340 * operation). With every added predecessor the number of inputs to Phi nodes
343 * The block can be completed by mature_immBlock(block) if all predecessors are
344 * known. If several blocks are built at once, mature_immBlock can only be called
345 * after set_value has been called for all values that are life at the end
346 * of the block. This is necessary so that Phi nodes created mature_immBlock
347 * get the right predecessors in case of cyclic dependencies. If all set_values
348 * of this block are called after maturing it and before calling get_value
349 * in some block that is control flow dependent on this block, the construction
352 * Example for faulty ir construction: (draw the graph on a paper and you'll
355 * block_before_loop = new_block();
357 * mature_immBlock(block_before_loop);
358 * before2header = new_Jmp;
360 * loop_header = new_block ();
361 * header2body - new_Jmp();
363 * loop_body = new_block ();
364 * body2header = new_Jmp();
366 * add_immBlock_pred(loop_header, before2header);
367 * add_immBlock_pred(loop_header, body2header);
368 * add_immBlock_pred(loop_body, header2body);
370 * mature_immBlock(loop_header);
371 * mature_immBlock(loop_body);
373 * get_value(loop_body, x); // gets the Phi in loop_header
374 * set_value(loop_header, x); // sets the value the above get_value should
375 * // have returned!!!
377 * Mature_immBlock also fixes the number of inputs to the Phi nodes. Mature_immBlock
378 * should be called as early as possible, as afterwards the generation of Phi
379 * nodes is more efficient.
382 * There is an input for each control flow predecessor of the block.
383 * The input points to an instruction producing an output of type X.
384 * Possible predecessors: Start, Jmp, Cond, Raise or Return or any node
385 * possibly causing an exception. (Often the real predecessors are Projs.)
387 * Mode BB (R), all nodes belonging to this block should consume this output.
388 * As they are strict (except Block and Phi node) it is a necessary condition
389 * that the block node executed before any other node in this block executes.
391 * block.matured Indicates whether the block is mature.
393 * This attribute contains all local values valid in this
394 * block. This is needed to build the Phi nodes and removed
395 * if the graph is complete. This field is used by the
396 * internal construction algorithm and should not be accessed
400 * ir_node *new_Block (int arity, ir_node **in)
401 * --------------------------------------------
403 * Creates a new Block with the given list of predecessors. This block
404 * is mature. As other constructors calls optimization and vrfy for the
405 * block. If one of the predecessors is Unknown (as it has to be filled in
406 * later) optimizations are skipped. This is necessary to
407 * construct Blocks in loops. Leaving Unknown in the Block after finishing
408 * the construction may have strange effects, especially for interprocedural
409 * representation and analysis.
412 * CONTROL FLOW OPERATIONS
413 * -----------------------
415 * In each block there must be exactly one of the control flow
416 * operations Start, End, Jmp, Cond, Return or Raise. The output of a
417 * control flow operation points to the block to be executed next.
419 * ir_node *new_Start (void)
420 * -------------------------
422 * Creates a start node. Not actually needed public. There is only one such
423 * node in each procedure which is automatically created by new_ir_graph.
426 * No inputs except the block it belogns to.
428 * A tuple of 4 (5, 6) distinct values. These are labeled by the following
429 * projection numbers (pn_Start):
430 * * pn_Start_X_initial_exec mode X, points to the first block to be exe * cuted.
431 * * pn_Start_M mode M, the global store
432 * * pn_Start_P_frame_base mode P, a pointer to the base of the proce * dures stack frame.
433 * * pn_Start_P_globals mode P, a pointer to the part of the memory * containing_all_ global things.
434 * * pn_Start_T_args mode T, a tuple containing all arguments of * the procedure.
437 * ir_node *new_End (void)
438 * -----------------------
440 * Creates an end node. Not actually needed public. There is only one such
441 * node in each procedure which is automatically created by new_ir_graph.
444 * No inputs except the block it belongs to.
448 * ir_node *new_Jmp (void)
449 * -----------------------
451 * Creates a Jmp node.
454 * The block the node belongs to
456 * Control flow to the next block.
458 * ir_node *new_IJmp (ir_node *tgt)
459 * -----------------------
461 * Creates an IJmp node.
464 * The node that represents the target jump address
466 * Control flow to an unknown target, must be pinned by
469 * ir_node *new_Cond (ir_node *c)
470 * ------------------------------
472 * Creates a Cond node. There are two versions of this node.
478 * A tuple of two control flows. The first is taken if the input is
479 * false, the second if it is true.
483 * A value of mode I_u. (i)
485 * A tuple of n control flows. If the Cond's input is i, control
486 * flow will procede along output i. If the input is >= n control
487 * flow proceeds along output n.
489 * ir_node *new_Return (ir_node *store, int arity, ir_node **in)
490 * -------------------------------------------------------------
492 * The return node has as inputs the results of the procedure. It
493 * passes the control flow to the end_block.
499 * Control flow to the end block.
503 * ir_node *new_Const (ir_mode *mode, tarval *con)
504 * -----------------------------------------------
506 * Creates a constant in the constant table and adds a Const node
507 * returning this value to the start block.
510 * *mode The mode of the constant.
511 * *con Points to an entry in the constant table.
512 * This pointer is added to the attributes of
513 * the node (self->attr.con)
515 * No inputs except the block it belogns to.
517 * The constant value.
519 * attr.con A tarval* pointer to the proper entry in the constant
522 * ir_node *new_SymConst (union symconst_symbol value, symconst_addr_ent kind)
523 * ---------------------------------------------------------------------------
525 * There are three kinds of symbolic constants:
526 * symconst_type_tag The symbolic constant represents a type tag.
527 * symconst_type_size The symbolic constant represents the size of a type.
528 * symconst_type_align The symbolic constant represents the alignment of a type.
529 * symconst_addr_name Information for the linker, e.g. the name of a global
531 * symconst_addr_name The symbolic constant represents the address of an entity.
533 * To represent a pointer to an entity that is represented by an entity
534 * datastructure don't use
535 * new_SymConst((type_or_id*)get_entity_ld_ident(ent), symconst_addr_name);.
536 * Use a real const instead:
537 * new_SymConst(ent, symconst_addr_ent);
538 * This makes the Constant independent of name changes of the entity due to
542 * kind The kind of the symbolic constant: type_tag, size or link_info.
543 * *type_or_id Points to the type the tag stands for or to the type
544 * whose size is represented by the constant or to an ident
545 * representing the linkage info.
548 * No inputs except the block it belogns to.
550 * An unsigned integer (I_u) or a pointer (P).
553 * attr.i.num The symconst_addr_ent, i.e. one of
555 * -symconst_type_size
556 * -symconst_type_align
557 * -symconst_addr_name
559 * If the attr.i.num is symconst_type_tag, symconst_type_size or symconst_type_align,
560 * the node contains an attribute:
562 * attr.i.*type, a pointer to a type_class. The mode of the node is mode_Is.
563 * if it is linkage_ptr_info it contains
564 * attr.i.*ptrinfo, an ident holding information for the linker. The mode
565 * of the node is mode_P_mach.
569 * ir_node *new_simpleSel (ir_node *store, ir_node *frame, ir_entity *sel)
570 * -----------------------------------------------------------------------
573 * Selects an entity from a compound type. This entity can be a field or
577 * *store The memory in which the object the entity should be selected
579 * *frame The pointer to the object.
580 * *sel The entity to select.
583 * The memory containing the object.
584 * A pointer to the object.
585 * An unsigned integer.
587 * A pointer to the selected entity.
589 * attr.sel Pointer to the entity
592 * ir_node *new_Sel (ir_node *store, ir_node *frame, int arity, ir_node **in,
593 * --------------------------------------------------------------------------
597 * Selects a field from an array type. The entity has as owner the array, as
598 * type the arrays element type. The indices to access an array element are
602 * *store The memory in which the object the entity should be selected from
604 * *frame The pointer to the object.
605 * *arity number of array indices.
606 * *in array with index inputs to the node.
607 * *sel The entity to select.
610 * The memory containing the object.
611 * A pointer to the object.
612 * As much unsigned integer as there are array expressions.
614 * A pointer to the selected entity.
616 * attr.sel Pointer to the entity
618 * The constructors new_Sel and new_simpleSel generate the same ir nodes.
619 * simpleSel just sets the arity of the index inputs to zero.
622 * ARITHMETIC OPERATIONS
623 * ---------------------
625 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node **in,
626 * ----------------------------------------------------------------------------
630 * Creates a procedure call.
633 * *store The actual store.
634 * *callee A pointer to the called procedure.
635 * arity The number of procedure parameters.
636 * **in An array with the pointers to the parameters.
637 * The constructor copies this array.
638 * *type Type information of the procedure called.
641 * The store, the callee and the parameters.
643 * A tuple containing the eventually changed store and the procedure
646 * attr.call Contains the type information for the procedure.
649 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode)
650 * ------------------------------------------------------------
654 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode)
655 * ------------------------------------------------------------
659 * ir_node *new_Minus (ir_node *op, ir_mode *mode)
660 * -----------------------------------------------
662 * Unary Minus operations on integer and floating point values.
664 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode)
665 * ------------------------------------------------------------
669 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2)
670 * --------------------------------------------------------------
672 * Quot performs exact division of floating point numbers. It's mode
673 * is Tuple, the mode of the result must be annotated to the Proj
674 * that extracts the result of the arithmetic operations.
677 * The store needed to model exceptions and the two operands.
679 * A tuple contaning a memory and a execution for modeling exceptions
680 * and the result of the arithmetic operation.
682 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2)
683 * ----------------------------------------------------------------
685 * Performs Div and Mod on interger values.
688 * A tuple contaning a memory and a execution for modeling exceptions
689 * and the two result of the arithmetic operations.
691 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2)
692 * -------------------------------------------------------------
696 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2)
697 * -------------------------------------------------------------
701 * ir_node *new_Abs (ir_node *op, ir_mode *mode)
702 * ---------------------------------------------
706 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode)
707 * ------------------------------------------------------------
711 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode)
712 * -----------------------------------------------------------
716 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode)
717 * ------------------------------------------------------------
721 * ir_node *new_Not (ir_node *op, ir_mode *mode)
722 * ---------------------------------------------
724 * This node constructs a constant where all bits are set to one
725 * and a Eor of this constant and the operator. This simulates a
728 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode)
729 * ---------------------------------------------------------
733 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode)
734 * ---------------------------------------------------------
736 * Logic shift right, i.e., zero extended.
739 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode)
740 * ----------------------------------------------------------
742 * Arithmetic shift right, i.e., sign extended.
744 * ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode)
745 * ---------------------------------------------------------
747 * Rotates the operand to the (right??) by k bits.
749 * ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode)
750 * ------------------------------------------------------------
752 * Calculates the Carry value for integer addition. Used only
755 * ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode)
756 * ------------------------------------------------------------
758 * Calculates the Borrow value for integer substraction. Used only
761 * ir_node *new_Conv (ir_node *op, ir_mode *mode)
762 * ---------------------------------------------
764 * Mode conversion. For allowed conversions see UKA Tech Report
767 * ir_node *new_Cmp (ir_node *op1, ir_node *op2)
768 * ---------------------------------------------
771 * The two values to be compared.
773 * A 16-tuple containing the results of the 16 different comparisons.
774 * The following is a list giving the comparisons and a projection
775 * number (pn_Cmp) to use in Proj nodes to extract the proper result.
779 * pn_Cmp_Le less or equal
781 * pn_Cmp_Ge greater of equal
782 * pn_Cmp_Lg less or greater
783 * pn_Cmp_Leg less, equal or greater = ordered
784 * pn_Cmp_Uo unordered
785 * pn_Cmp_Ue unordered or equal
786 * pn_Cmp_Ul unordered or less
787 * pn_Cmp_Ule unordered, less or equal
788 * pn_Cmp_Ug unordered or greater
789 * pn_Cmp_Uge unordered, greater or equal
790 * pn_Cmp_Ne unordered, less or greater = not equal
797 * In general, Phi nodes are automaitcally inserted. In some cases, if
798 * all predecessors of a block are known, an explicit Phi node constructor
799 * is needed. E.g., to construct a FIRM graph for a statement as
800 * a = (b==c) ? 2 : 5;
802 * ir_node *new_Phi (int arity, ir_node **in, ir_mode *mode)
803 * ---------------------------------------------------------
805 * Creates a Phi node. The in's order has to correspond to the order
806 * of in's of current_block. This is not checked by the library!
807 * If one of the predecessors is Unknown (as it has to be filled in
808 * later) optimizations are skipped. This is necessary to
809 * construct Phi nodes in loops. Leaving Unknown in the Phi after finishing
810 * the construction may have strange effects, especially for interprocedural
811 * representation and analysis.
814 * arity number of predecessors
815 * **in array with predecessors
816 * *mode The mode of it's inputs and output.
818 * A Phi node has as many inputs as the block it belongs to.
819 * Each input points to a definition of the same value on a
820 * different path in the control flow.
822 * The definition valid in this block.
824 * ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode)
825 * -----------------------------------------------------------------------------
827 * Creates a Mux node. This node implements the following semantic:
828 * If the sel node (which must be of mode_b) evaluates to true, its value is
829 * ir_true, else ir_false;
832 * ir_node *new_Psi (int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode)
833 * -----------------------------------------------------------------------------
835 * Creates a Psi node. This node implements the following semantic:
839 * OPERATIONS TO MANAGE MEMORY EXPLICITLY
840 * --------------------------------------
842 * ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode)
843 * ----------------------------------------------------------------
845 * The Load operation reads a value from memory.
848 * *store The current memory.
849 * *addr A pointer to the variable to be read in this memory.
850 * *mode The mode of the value to be loaded.
853 * The memory and a pointer to a variable in this memory.
855 * A tuple of the memory, a control flow to be taken in case of
856 * an exception and the loaded value.
858 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val)
859 * ----------------------------------------------------------------
861 * The Store operation writes a value to a variable in memory.
864 * The memory, a pointer to a variable in this memory and the value
865 * to write to this variable.
867 * A tuple of the changed memory and a control flow to be taken in
868 * case of an exception.
870 * ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
871 * -----------------------------------------------------------------------
875 * The Alloc node allocates a new variable. It can be specified whether the
876 * variable should be allocated to the stack or to the heap.
879 * *store The memory which shall contain the new variable.
880 * ** *size The number of bytes to allocate. Old. **
881 * *size We decided that the size easily can be derived from the type.
882 * This field is for allocating arrays, i.e., it gives the multiple
883 * of the size of alloc_type to allocate memory for.
884 * *alloc_type The type of the allocated variable.
885 * where Where to allocate the variable, either heap_alloc or stack_alloc.
888 * A memory and an unsigned integer.
890 * A tuple of the changed memory, a control flow to be taken in
891 * case of an exception and the pointer to the new variable.
893 * a.where Indicates where the variable is allocated.
894 * a.*type A pointer to the class the allocated data object
897 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size, ir_type *free_type,
898 * -----------------------------------------------------------------------------------
902 * The Free node frees memory of the given variable.
905 * *store The memory which shall contain the new variable.
906 * *ptr The pointer to the object to free.
907 * *size The number of objects of type free_type to free in a sequence.
908 * *free_type The type of the freed variable.
909 * where Where the variable was allocated, either heap_alloc or stack_alloc.
912 * A memory, a pointer and an unsigned integer.
914 * The changed memory.
916 * f.*type A pointer to the type information of the freed data object.
920 * ir_node *new_Sync (int arity, ir_node **in)
921 * -------------------------------------------
923 * The Sync operation unifies several partial memory blocks. These blocks
924 * have to be pairwise disjunct or the values in common locations have to
925 * be identical. This operation allows to specify all operations that eventually
926 * need several partial memory blocks as input with a single entrance by
927 * unifying the memories with a preceding Sync operation.
930 * arity The number of memories to synchronize.
931 * **in An array of pointers to nodes that produce an output of
936 * The unified memory.
942 * ir_node *new_Bad (void)
943 * -----------------------
945 * Returns the unique Bad node current_ir_graph->bad.
946 * This node is used to express results of dead code elimination.
948 * ir_node *new_NoMem (void)
949 * -----------------------------------------------------------------------------------
951 * Returns the unique NoMem node current_ir_graph->no_mem.
952 * This node is used as input for operations that need a Memory, but do not
953 * change it like Div by const != 0, analyzed calls etc.
955 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj)
956 * ----------------------------------------------------------
958 * Selects one entry of a tuple. This is a hidden edge with attributes.
961 * *arg A node producing a tuple.
962 * *mode The mode of the value to project.
963 * proj The position of the value in the tuple.
969 * ir_node *new_Tuple (int arity, ir_node **in)
970 * --------------------------------------------
972 * Builds a Tuple from single values. This is needed to implement
973 * optimizations that remove a node that produced a tuple. The node can be
974 * replaced by the Tuple operation so that the following Proj nodes have not to
975 * be changed. (They are hard to find due to the implementation with pointers
976 * in only one direction.) The Tuple node is smaller than any other
977 * node, so that a node can be changed into a Tuple by just changing it's
978 * opcode and giving it a new in array.
981 * arity The number of tuple elements.
982 * **in An array containing pointers to the nodes producing the
985 * ir_node *new_Id (ir_node *val, ir_mode *mode)
986 * ---------------------------------------------
988 * The single output of the Id operation is it's input. Also needed
992 * HIGH LEVEL OPERATIONS
993 * ---------------------
995 * ir_node *new_CopyB (ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type)
996 * -----------------------------------------------------------------------------------
998 * Describes a high level block copy of a compound type from address src to
999 * address dst. Must be lowered to a Call to a runtime memory copy function.
1002 * HIGH LEVEL OPERATIONS: Exception Support
1003 * ----------------------------------------
1004 * See TechReport 1999-14, chapter Exceptions.
1006 * ir_node *new_InstOf(ir_node *store, ir_node *ptr, ir_type *type);
1007 * -----------------------------------------------------------------------------------
1009 * Describes a high level type check. Must be lowered to a Call to a runtime check
1012 * ir_node *new_Raise (ir_node *store, ir_node *obj)
1013 * -------------------------------------------------
1015 * Raises an exception. Unconditional change of control flow. Writes
1016 * an explicit Except variable to memory to pass it to the exception
1017 * handler. Must be lowered to a Call to a runtime check
1022 * A pointer to the Except variable.
1024 * A tuple of control flow and the changed memory state. The control flow
1025 * points to the exception handler if it is definied in this procedure,
1026 * else it points to the end_block.
1028 * ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
1029 * -----------------------------------------------------------------------------------
1031 * Describes a high level bounds check. Must be lowered to a Call to a runtime check
1034 * ir_node *new_Pin (ir_node *node);
1035 * -----------------------------------------------------------------------------------
1037 * Pin the value of the node node in the current block No users of the Pin node can
1038 * float above the Block of the Pin. The node cannot float behind this block. Often
1039 * used to Pin the NoMem node.
1042 * COPING WITH DATA OBJECTS
1043 * ========================
1045 * Two kinds of data objects have to be distinguished for generating
1046 * FIRM. First there are local variables other than arrays that are
1047 * known to be alias free. Second there are all other data objects.
1048 * For the first a common SSA representation is built, the second
1049 * are modeled by saving them to memory. The memory is treated as
1050 * a single local variable, the alias problem is hidden in the
1051 * content of this variable.
1053 * All values known in a Block are listed in the block's attribute,
1054 * block.**graph_arr which is used to automatically insert Phi nodes.
1055 * The following two functions can be used to add a newly computed value
1056 * to the array, or to get the producer of a value, i.e., the current
1059 * inline void set_value (int pos, ir_node *value)
1060 * -----------------------------------------------
1062 * Has to be called for every assignment to a local variable. It
1063 * adds the value to the array of used values at position pos. Pos
1064 * has to be a unique identifier for an entry in the procedure's
1065 * definition table. It can be used to access the value again.
1066 * Requires current_block to be set correctly.
1068 * ir_node *get_value (int pos, ir_mode *mode)
1069 * -------------------------------------------
1071 * Returns the node defining the value referred to by pos. If the
1072 * value is not defined in this block a Phi node is generated and
1073 * all definitions reaching this Phi node are collected. It can
1074 * happen that the algorithm allocates an unnecessary Phi node,
1075 * e.g. if there is only one definition of this value, but this
1076 * definition reaches the currend block on several different
1077 * paths. This Phi node will be eliminated if optimizations are
1078 * turned on right after it's creation.
1079 * Requires current_block to be set correctly.
1081 * There are two special routines for the global store:
1083 * void set_store (ir_node *store)
1084 * -------------------------------
1086 * Adds the store to the array of known values at a reserved
1088 * Requires current_block to be set correctly.
1090 * ir_node *get_store (void)
1091 * -------------------------
1093 * Returns the node defining the actual store.
1094 * Requires current_block to be set correctly.
1097 * inline void keep_alive (ir_node *ka)
1098 * ------------------------------------
1100 * Keep this node alive because it is (might be) not in the control
1101 * flow from Start to End. Adds the node to the list in the end
1105 #ifndef _FIRM_IR_IRCONS_H_
1106 #define _FIRM_IR_IRCONS_H_
1108 #include "firm_common.h"
1110 #include "irgraph.h"
1111 #include "dbginfo.h"
1113 /*-------------------------------------------------------------------------*/
1114 /* The raw interface */
1115 /*-------------------------------------------------------------------------*/
1117 /** Constructor for a Block node.
1119 * Constructs a mature block with the given predecessors. Use Unknown
1120 * nodes as predecessors to construct a block if the number of
1121 * predecessors is known, but not the predecessors themselves. This
1122 * constructor does not set current_block. It not be used with
1123 * automatic Phi node construction.
1125 * @param *db A Pointer for debug information.
1126 * @param irg The ir graph the block belongs to.
1127 * @param arity The number of control predecessors.
1128 * @param in[] An array of control predecessors. The length of
1129 * the array must be 'arity'. The constructor copies this array.
1131 ir_node *new_rd_Block (dbg_info *db, ir_graph *irg, int arity, ir_node *in[]);
1133 /** Constructor for a Start 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_Start (dbg_info *db, ir_graph *irg, ir_node *block);
1141 /** Constructor for a End node.
1143 * @param *db A pointer for debug information.
1144 * @param *irg The ir graph the node belongs to.
1145 * @param *block The ir block the node belongs to.
1147 ir_node *new_rd_End (dbg_info *db, ir_graph *irg, ir_node *block);
1149 /** Constructor for a Jmp node.
1151 * Jmp represents control flow to a single control successor.
1153 * @param *db A pointer for debug information.
1154 * @param *irg The ir graph the node belongs to.
1155 * @param *block The ir block the node belongs to.
1157 ir_node *new_rd_Jmp (dbg_info *db, ir_graph *irg, ir_node *block);
1159 /** Constructor for an IJmp node.
1161 * IJmp represents control flow to a single control successor not
1162 * statically known i.e. an indirect Jmp.
1164 * @param *db A pointer for debug information.
1165 * @param *irg The ir graph the node belongs to.
1166 * @param *block The ir block the node belongs to.
1167 * @param *tgt The ir node representing the target address.
1169 ir_node *new_rd_IJmp (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *tgt);
1171 /** Constructor for a Break node.
1173 * Break represents control flow to a single control successor just as Jmp.
1174 * The blocks separated by a break may not be concatenated by an optimization.
1175 * It is used for the interprocedural representation where blocks are parted
1176 * behind Call nodes to represent the control flow to called procedures.
1178 * @param *db A pointer for debug information.
1179 * @param *irg The ir graph the node belong to.
1180 * @param *block The block the node belong to.
1182 ir_node *new_rd_Break (dbg_info *db, ir_graph *irg, ir_node *block);
1184 /** Constructor for a Cond node.
1186 * If c is mode_b represents a conditional branch (if/else). If c is
1187 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
1188 * node, default Proj is 0.)
1190 * This is not consistent: Input to Cond is Is, Proj has as proj number
1193 * @param *db A pointer for debug information.
1194 * @param *irg The ir graph the node belongs to.
1195 * @param *block The ir block the node belongs to.
1196 * @param *c The conditions parameter. Can be of mode b or I_u.
1198 ir_node *new_rd_Cond (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *c);
1200 /** Constructor for a Return node.
1202 * Returns the memory an zero or more return values. Only node that
1203 * can end regular control flow.
1205 * @param *db A pointer for debug information.
1206 * @param *irg The ir graph the node belongs to.
1207 * @param *block The ir block the node belongs to.
1208 * @param *store The state of memory.
1209 * @param arity Number of return values.
1210 * @param *in Array of length arity with return values. The constructor copies this array.
1212 ir_node *new_rd_Return (dbg_info *db, ir_graph *irg, ir_node *block,
1213 ir_node *store, int arity, ir_node *in[]);
1215 /** Constructor for a Const_type node.
1217 * The constant represents a target value. This constructor sets high
1218 * level type information for the constant value.
1220 * @param *db A pointer for debug information.
1221 * @param *irg The ir graph the node belongs to.
1222 * @param *block The ir block the node belongs to.
1223 * @param *mode The mode of the operands and results.
1224 * @param *con Points to an entry in the constant table.
1225 * @param *tp The type of the constant.
1227 ir_node *new_rd_Const_type (dbg_info *db, ir_graph *irg, ir_node *block,
1228 ir_mode *mode, tarval *con, ir_type *tp);
1230 /** Constructor for a Const node.
1232 * Constructor for a Const node. The constant represents a target
1233 * value. Sets the type information to type_unknown. (No more
1234 * supported: If tv is entity derives a somehow useful type.)
1236 * @param *db A pointer for debug information.
1237 * @param *irg The ir graph the node belongs to.
1238 * @param *block The ir block the node belongs to.
1239 * @param *mode The mode of the operands and results.
1240 * @param *con Points to an entry in the constant table.
1242 ir_node *new_rd_Const (dbg_info *db, ir_graph *irg, ir_node *block,
1243 ir_mode *mode, tarval *con);
1245 /** Constructor for a SymConst_type node.
1247 * This is the constructor for a symbolic constant.
1248 * There are four kinds of symbolic constants:
1249 * - type_tag The symbolic constant represents a type tag. The type the
1250 * tag stands for is given explicitly.
1251 * - type_size The symbolic constant represents the size of a type. The
1252 * type of which the constant represents the size is given
1254 * - type_align The symbolic constant represents the alignment of a type. The
1255 * type of which the constant represents the size is given
1257 * - addr_name The symbolic constant represents the address of an entity
1258 * (variable or method). The variable is indicated by a name
1259 * that is valid for linking.
1260 * - addr_ent The symbolic constant represents the address of an entity
1261 * (variable or method). The variable is given explicitly by
1264 * Inputs to the node:
1265 * No inputs except the block it belongs to.
1266 * Outputs of the node.
1267 * An unsigned integer (I_u) or a pointer (P).
1269 * Mention union in declaration so that the firmjni generator recognizes that
1270 * it can not cast the argument to an int.
1272 * @param *db A pointer for debug information.
1273 * @param *irg The ir graph the node belongs to.
1274 * @param *block The ir block the node belongs to.
1275 * @param symkind The kind of the symbolic constant: type_tag, size, addr_name or addr_ent.
1276 * @param value A type, entity or a ident depending on the SymConst kind.
1277 * @param tp The source type of the constant.
1279 ir_node *new_rd_SymConst_type (dbg_info *db, ir_graph *irg, ir_node *block, union symconst_symbol value,
1280 symconst_kind symkind, ir_type *tp);
1282 /** Constructor for a SymConst node.
1284 * Same as new_rd_SymConst_type, except that it sets the type to type_unknown. */
1285 ir_node *new_rd_SymConst (dbg_info *db, ir_graph *irg, ir_node *block,
1286 union symconst_symbol value, symconst_kind symkind);
1288 /** Constructor for a SymConst addr_ent node.
1290 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1291 * symconst_addr_ent.
1292 * Adds the SymConst to the start block of irg. */
1293 ir_node *new_rd_SymConst_addr_ent (dbg_info *db, ir_graph *irg, ir_entity *symbol, ir_type *tp);
1295 /** Constructor for a SymConst ofs_ent node.
1297 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1299 * Adds the SymConst to the start block of irg. */
1300 ir_node *new_rd_SymConst_ofs_ent (dbg_info *db, ir_graph *irg, ir_entity *symbol, ir_type *tp);
1302 /** Constructor for a SymConst addr_name node.
1304 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1305 * symconst_addr_ent.
1306 * Adds the SymConst to the start block of irg. */
1307 ir_node *new_rd_SymConst_addr_name (dbg_info *db, ir_graph *irg, ident *symbol, ir_type *tp);
1309 /** Constructor for a SymConst type_tag node.
1311 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1312 * symconst_addr_ent.
1313 * Adds the SymConst to the start block of irg. */
1314 ir_node *new_rd_SymConst_type_tag (dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp);
1316 /** Constructor for a SymConst size node.
1318 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1319 * symconst_type_size.
1320 * Adds the SymConst to the start block of irg. */
1321 ir_node *new_rd_SymConst_size (dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp);
1323 /** Constructor for a SymConst size node.
1325 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1326 * symconst_type_align.
1327 * Adds the SymConst to the start block of irg. */
1328 ir_node *new_rd_SymConst_align (dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp);
1330 /** Constructor for a simpleSel node.
1332 * This is a shortcut for the new_rd_Sel() constructor. To be used for
1333 * Sel nodes that do not select from an array, i.e., have no index
1334 * inputs. It adds the two parameters 0, NULL.
1336 * @param *db A pointer for debug information.
1337 * @param *irg The ir graph the node belongs to.
1338 * @param *block The ir block the node belongs to.
1339 * @param *store The memory in which the object the entity should be
1340 * selected from is allocated.
1341 * @param *objptr The object from that the Sel operation selects a
1342 * single attribute out.
1343 * @param *ent The entity to select.
1345 ir_node *new_rd_simpleSel (dbg_info *db, ir_graph *irg, ir_node *block,
1346 ir_node *store, ir_node *objptr, ir_entity *ent);
1348 /** Constructor for a Sel node.
1350 * The select node selects an entity (field or method) from an entity
1351 * with a compound type. It explicitly specifies the entity selected.
1352 * Dynamically the node may select entities that overwrite the given
1353 * entity. If the selected entity is an array element entity the Sel
1354 * node takes the required array indices as inputs.
1356 * @param *db A pointer for debug information.
1357 * @param *irg The ir graph the node belongs to.
1358 * @param *block The ir block the node belongs to.
1359 * @param *store The memory in which the object the entity should be selected
1360 * from is allocated.
1361 * @param *objptr A pointer to a compound entity the Sel operation selects a
1362 * single attribute from.
1363 * @param *n_index The number of array indices needed to select an array element entity.
1364 * @param *index[] If the compound entity is an array the indices of the selected
1365 * element entity. The constructor copies this array.
1366 * @param *ent The entity to select.
1368 ir_node *new_rd_Sel (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1369 ir_node *objptr, int n_index, ir_node *index[], ir_entity *ent);
1371 /** Constructor for a Call node.
1373 * Represents all kinds of method and function calls.
1375 * @param *db A pointer for debug information.
1376 * @param *irg The ir graph the node belongs to.
1377 * @param *block The ir block the node belongs to.
1378 * @param *store The current memory state.
1379 * @param *callee A pointer to the called procedure.
1380 * @param arity The number of procedure parameters.
1381 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1382 * @param *tp Type information of the procedure called.
1384 ir_node *new_rd_Call (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1385 ir_node *callee, int arity, ir_node *in[], ir_type *tp);
1387 /** Constructor for a Add node.
1389 * @param *db A pointer for debug information.
1390 * @param *irg The ir graph the node belongs to.
1391 * @param *block The ir block the node belongs to.
1392 * @param *op1 The first operand.
1393 * @param *op2 The second operand.
1394 * @param *mode The mode of the operands and the result.
1396 ir_node *new_rd_Add (dbg_info *db, ir_graph *irg, ir_node *block,
1397 ir_node *op1, ir_node *op2, ir_mode *mode);
1399 /** Constructor for a Sub node.
1401 * @param *db A pointer for debug information.
1402 * @param *irg The ir graph the node belongs to.
1403 * @param *block The ir block the node belongs to.
1404 * @param *op1 The first operand.
1405 * @param *op2 The second operand.
1406 * @param *mode The mode of the operands and the result.
1408 ir_node *new_rd_Sub (dbg_info *db, ir_graph *irg, ir_node *block,
1409 ir_node *op1, ir_node *op2, ir_mode *mode);
1411 /** Constructor for a Minus node.
1413 * @param *db A pointer for debug information.
1414 * @param *irg The ir graph the node belongs to.
1415 * @param *block The ir block the node belongs to.
1416 * @param *op The operand .
1417 * @param *mode The mode of the operand and the result.
1419 ir_node *new_rd_Minus (dbg_info *db, ir_graph *irg, ir_node *block,
1420 ir_node *op, ir_mode *mode);
1422 /** Constructor for a Mul node.
1424 * @param *db A pointer for debug information.
1425 * @param *irg The ir graph the node belongs to.
1426 * @param *block The ir block the node belongs to.
1427 * @param *op1 The first operand.
1428 * @param *op2 The second operand.
1429 * @param *mode The mode of the operands and the result.
1431 ir_node *new_rd_Mul (dbg_info *db, ir_graph *irg, ir_node *block,
1432 ir_node *op1, ir_node *op2, ir_mode *mode);
1434 /** Constructor for a Quot node.
1436 * @param *db A pointer for debug information.
1437 * @param *irg The ir graph the node belongs to.
1438 * @param *block The ir block the node belongs to.
1439 * @param *memop The store needed to model exceptions
1440 * @param *op1 The first operand.
1441 * @param *op2 The second operand.
1443 ir_node *new_rd_Quot (dbg_info *db, ir_graph *irg, ir_node *block,
1444 ir_node *memop, ir_node *op1, ir_node *op2);
1446 /** Constructor for a DivMod node.
1448 * @param *db A pointer for debug information.
1449 * @param *irg The ir graph the node belongs to.
1450 * @param *block The ir block the node belongs to.
1451 * @param *memop The store needed to model exceptions
1452 * @param *op1 The first operand.
1453 * @param *op2 The second operand.
1455 ir_node *new_rd_DivMod (dbg_info *db, ir_graph *irg, ir_node *block,
1456 ir_node *memop, ir_node *op1, ir_node *op2);
1458 /** Constructor for a Div node.
1460 * @param *db A pointer for debug information.
1461 * @param *irg The ir graph the node belongs to.
1462 * @param *block The ir block the node belongs to.
1463 * @param *memop The store needed to model exceptions
1464 * @param *op1 The first operand.
1465 * @param *op2 The second operand.
1467 ir_node *new_rd_Div (dbg_info *db, ir_graph *irg, ir_node *block,
1468 ir_node *memop, ir_node *op1, ir_node *op2);
1470 /** Constructor for a Mod node.
1472 * @param *db A pointer for debug information.
1473 * @param *irg The ir graph the node belongs to.
1474 * @param *block The ir block the node belongs to.
1475 * @param *memop The store needed to model exceptions
1476 * @param *op1 The first operand.
1477 * @param *op2 The second operand.
1479 ir_node *new_rd_Mod (dbg_info *db, ir_graph *irg, ir_node *block,
1480 ir_node *memop, ir_node *op1, ir_node *op2);
1482 /** Constructor for a Abs node.
1484 * @param *db A pointer for debug information.
1485 * @param *irg The ir graph the node belongs to.
1486 * @param *block The ir block the node belongs to.
1487 * @param *op The operand
1488 * @param *mode The mode of the operands and the result.
1490 ir_node *new_rd_Abs (dbg_info *db, ir_graph *irg, ir_node *block,
1491 ir_node *op, ir_mode *mode);
1493 /** Constructor for a And node.
1495 * @param *db A pointer for debug information.
1496 * @param *irg The ir graph the node belongs to.
1497 * @param *block The ir block the node belongs to.
1498 * @param *op1 The first operand.
1499 * @param *op2 The second operand.
1500 * @param *mode The mode of the operands and the result.
1502 ir_node *new_rd_And (dbg_info *db, ir_graph *irg, ir_node *block,
1503 ir_node *op1, ir_node *op2, ir_mode *mode);
1505 /** Constructor for a Or node.
1507 * @param *db A pointer for debug information.
1508 * @param *irg The ir graph the node belongs to.
1509 * @param *block The ir block the node belongs to.
1510 * @param *op1 The first operand.
1511 * @param *op2 The second operand.
1512 * @param *mode The mode of the operands and the result.
1514 ir_node *new_rd_Or (dbg_info *db, ir_graph *irg, ir_node *block,
1515 ir_node *op1, ir_node *op2, ir_mode *mode);
1517 /** Constructor for a Eor node.
1519 * @param *db A pointer for debug information.
1520 * @param *irg The ir graph the node belongs to.
1521 * @param *block The ir block the node belongs to.
1522 * @param *op1 The first operand.
1523 * @param *op2 The second operand.
1524 * @param *mode The mode of the operands and the results.
1526 ir_node *new_rd_Eor (dbg_info *db, ir_graph *irg, ir_node *block,
1527 ir_node *op1, ir_node *op2, ir_mode *mode);
1529 /** Constructor for a Not node.
1531 * @param *db A pointer for debug information.
1532 * @param *irg The ir graph the node belongs to.
1533 * @param *block The ir block the node belongs to.
1534 * @param *op The operand.
1535 * @param *mode The mode of the operand and the result.
1537 ir_node *new_rd_Not (dbg_info *db, ir_graph *irg, ir_node *block,
1538 ir_node *op, ir_mode *mode);
1540 /** Constructor for a Cmp node.
1542 * @param *db A pointer for debug information.
1543 * @param *irg The ir graph the node belongs to.
1544 * @param *block The ir block the node belongs to.
1545 * @param *op1 The first operand.
1546 * @param *op2 The second operand.
1548 ir_node *new_rd_Cmp (dbg_info *db, ir_graph *irg, ir_node *block,
1549 ir_node *op1, ir_node *op2);
1551 /** Constructor for a Shl node.
1553 * @param *db A pointer for debug information.
1554 * @param *irg The ir graph the node belongs to.
1555 * @param *block The ir block the node belongs to.
1556 * @param *op The operand.
1557 * @param *k The number of bits to shift the operand .
1558 * @param *mode The mode of the operand and the result.
1560 ir_node *new_rd_Shl (dbg_info *db, ir_graph *irg, ir_node *block,
1561 ir_node *op, ir_node *k, ir_mode *mode);
1563 /** Constructor for a Shr node.
1565 * @param *db A pointer for debug information.
1566 * @param *irg The ir graph the node belongs to.
1567 * @param *block The ir block the node belongs to.
1568 * @param *op The operand.
1569 * @param *k The number of bits to shift the operand .
1570 * @param *mode The mode of the operand and the result.
1572 ir_node *new_rd_Shr (dbg_info *db, ir_graph *irg, ir_node *block,
1573 ir_node *op, ir_node *k, ir_mode *mode);
1575 /** Constructor for a Shrs node.
1577 * @param *db A pointer for debug information.
1578 * @param *irg The ir graph the node belongs to.
1579 * @param *block The ir block the node belongs to.
1580 * @param *op The operand.
1581 * @param *k The number of bits to shift the operand.
1582 * @param *mode The mode of the operand and the result.
1584 ir_node *new_rd_Shrs (dbg_info *db, ir_graph *irg, ir_node *block,
1585 ir_node *op, ir_node *k, ir_mode *mode);
1587 /** Constructor for a Rot node.
1589 * @param *db A pointer for debug information.
1590 * @param *irg The ir graph the node belongs to.
1591 * @param *block The ir block the node belongs to.
1592 * @param *op The operand.
1593 * @param *k The number of bits to rotate the operand.
1594 * @param *mode The mode of the operand.
1596 ir_node *new_rd_Rot (dbg_info *db, ir_graph *irg, ir_node *block,
1597 ir_node *op, ir_node *k, ir_mode *mode);
1600 /** Constructor for a Conv node.
1602 * @param *db A pointer for debug information.
1603 * @param *irg The ir graph the node belongs to.
1604 * @param *block The ir block the node belongs to.
1605 * @param *op The operand.
1606 * @param *mode The mode of this the operand muss be converted .
1608 ir_node *new_rd_Conv (dbg_info *db, ir_graph *irg, ir_node *block,
1609 ir_node *op, ir_mode *mode);
1611 /** Constructor for a Cast node.
1613 * High level type cast.
1615 * @param *db A pointer for debug information.
1616 * @param *irg The ir graph the node belongs to.
1617 * @param *block The ir block the node belongs to.
1618 * @param *op The operand.
1619 * @param *to_tp The type of this the operand muss be casted .
1621 ir_node *new_rd_Cast (dbg_info *db, ir_graph *irg, ir_node *block,
1622 ir_node *op, ir_type *to_tp);
1624 /** Constructor for a Carry node.
1626 * @param *db A pointer for debug information.
1627 * @param *irg The ir graph the node belongs to.
1628 * @param *block The ir block the node belongs to.
1629 * @param *op1 The first operand.
1630 * @param *op2 The second operand.
1631 * @param *mode The mode of the operands and the result.
1633 ir_node *new_rd_Carry (dbg_info *db, ir_graph *irg, ir_node *block,
1634 ir_node *op1, ir_node *op2, ir_mode *mode);
1636 /** Constructor for a Borrow node.
1638 * @param *db A pointer for debug information.
1639 * @param *irg The ir graph the node belongs to.
1640 * @param *block The ir block the node belongs to.
1641 * @param *op1 The first operand.
1642 * @param *op2 The second operand.
1643 * @param *mode The mode of the operands and the result.
1645 ir_node *new_rd_Borrow (dbg_info *db, ir_graph *irg, ir_node *block,
1646 ir_node *op1, ir_node *op2, ir_mode *mode);
1648 /** Constructor for a Phi node.
1650 * @param *db A pointer for debug information.
1651 * @param *irg The ir graph the node belongs to.
1652 * @param *block The ir block the node belongs to.
1653 * @param arity The number of predecessors
1654 * @param *in[] Array with predecessors. The constructor copies this array.
1655 * @param *mode The mode of it's inputs and output.
1657 ir_node *new_rd_Phi (dbg_info *db, ir_graph *irg, ir_node *block, int arity,
1658 ir_node *in[], ir_mode *mode);
1660 /** Constructor for a Load node.
1662 * @param *db A pointer for debug information.
1663 * @param *irg The ir graph the node belongs to.
1664 * @param *block The ir block the node belongs to.
1665 * @param *store The current memory
1666 * @param *adr A pointer to the variable to be read in this memory.
1667 * @param *mode The mode of the value to be loaded.
1669 ir_node *new_rd_Load (dbg_info *db, ir_graph *irg, ir_node *block,
1670 ir_node *store, ir_node *adr, ir_mode *mode);
1672 /** Constructor for a Store node.
1674 * @param *db A pointer for debug information.
1675 * @param *irg The ir graph the node belongs to.
1676 * @param *block The ir block the node belongs to.
1677 * @param *store The current memory
1678 * @param *adr A pointer to the variable to be read in this memory.
1679 * @param *val The value to write to this variable.
1681 ir_node *new_rd_Store (dbg_info *db, ir_graph *irg, ir_node *block,
1682 ir_node *store, ir_node *adr, ir_node *val);
1684 /** Constructor for a Alloc node.
1686 * The Alloc node extends the memory by space for an entity of type alloc_type.
1688 * @param *db A pointer for debug information.
1689 * @param *irg The ir graph the node belongs to.
1690 * @param *block The ir block the node belongs to.
1691 * @param *store The memory which shall contain the new variable.
1692 * @param *size The number of bytes to allocate.
1693 * @param *alloc_type The type of the allocated variable.
1694 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
1696 ir_node *new_rd_Alloc (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1697 ir_node *size, ir_type *alloc_type, where_alloc where);
1699 /** Constructor for a Free node.
1701 * Frees the memory occupied by the entity pointed to by the pointer
1702 * arg. Type indicates the type of the entity the argument points to.
1704 * @param *db A pointer for debug information.
1705 * @param *irg The ir graph the node belongs to.
1706 * @param *block The ir block the node belongs to.
1707 * @param *store The memory which shall contain the new variable.
1708 * @param *ptr The pointer to the object to free.
1709 * @param *size The number of objects of type free_type to free in a sequence.
1710 * @param *free_type The type of the freed variable.
1711 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
1713 ir_node *new_rd_Free (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1714 ir_node *ptr, ir_node *size, ir_type *free_type, where_alloc where);
1716 /** Constructor for a Sync node.
1718 * Merges several memory values. The node assumes that a variable
1719 * either occurs only in one of the memories, or it contains the same
1720 * value in all memories where it occurs.
1722 * @param *db A pointer for debug information.
1723 * @param *irg The ir graph the node belongs to.
1724 * @param *block The ir block the node belongs to.
1725 * @param arity The number of memories to synchronize.
1726 * @param *in[] An array of pointers to nodes that produce an output of type
1727 * memory. The constructor copies this array.
1729 ir_node *new_rd_Sync (dbg_info *db, ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
1731 /** Constructor for a Proj node.
1733 * Projects a single value out of a tuple. The parameter proj gives the
1734 * position of the value within the tuple.
1736 * @param *db A pointer for debug information.
1737 * @param *irg The ir graph the node belongs to.
1738 * @param *block The ir block the node belongs to.
1739 * @param arg A node producing a tuple. The node must have mode_T.
1740 * @param *mode The mode of the value to project.
1741 * @param proj The position of the value in the tuple.
1743 ir_node *new_rd_Proj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1744 ir_mode *mode, long proj);
1746 /** Constructor for a defaultProj node.
1748 * Represents the default control flow of a Switch-Cond node.
1750 * @param *db A pointer for debug information.
1751 * @param *irg The ir graph the node belongs to.
1752 * @param *block The ir block the node belongs to.
1753 * @param arg A node producing a tuple.
1754 * @param max_proj The end position of the value in the tuple.
1756 ir_node *new_rd_defaultProj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1759 /** Constructor for a Tuple node.
1761 * This is an auxiliary node to replace a node that returns a tuple
1762 * without changing the corresponding Proj nodes.
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 arity The number of tuple elements.
1768 * @param *in[] An array containing pointers to the nodes producing the tuple
1769 * elements. The constructor copies this array.
1771 ir_node *new_rd_Tuple (dbg_info *db, ir_graph *irg, ir_node *block,
1772 int arity, ir_node *in[]);
1774 /** Constructor for a Id node.
1776 * This is an auxiliary node to replace a node that returns a single
1779 * @param *db A pointer for debug information.
1780 * @param *irg The ir graph the node belongs to.
1781 * @param *block The ir block the node belongs to.
1782 * @param *val The value
1783 * @param *mode The mode of *val.
1785 ir_node *new_rd_Id (dbg_info *db, ir_graph *irg, ir_node *block,
1786 ir_node *val, ir_mode *mode);
1788 /** Constructor for a Bad node.
1790 * Returns the unique Bad node of the graph. The same as
1793 * @param *irg The ir graph the node belongs to.
1795 ir_node *new_rd_Bad (ir_graph *irg);
1797 /** Constructor for a Confirm node.
1799 * Specifies constraints for a value. To support dataflow analyses.
1801 * Example: If the value never exceeds '100' this is expressed by placing a
1802 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
1804 * @param *irg The ir graph the node belong to.
1805 * @param *block The ir block the node belong to.
1806 * @param *db A pointer for debug information.
1807 * @param *val The value we express a constraint for
1808 * @param *bound The value to compare against. Must be a firm node, typically a constant.
1809 * @param cmp The compare operation.
1811 ir_node *new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block,
1812 ir_node *val, ir_node *bound, pn_Cmp cmp);
1814 /** Constructor for an Unknown node.
1816 * Represents an arbitrary value. Places the node in the start block.
1818 * @param *irg The ir graph the node belongs to.
1819 * @param *m The mode of the unknown value.
1821 ir_node *new_rd_Unknown(ir_graph *irg, ir_mode *m);
1823 /** Constructor for a CallBegin node.
1825 * CallBegin represents control flow depending of the pointer value
1826 * representing the called method to the called methods. The
1827 * constructor copies the method pointer input from the passed Call
1830 * @param *db A pointer for debug information.
1831 * @param *irg The ir graph the node belong to.
1832 * @param *block The block the node belong to.
1833 * @param *callee The call node visible in the intra procedural view.
1835 ir_node *new_rd_CallBegin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *callee);
1837 /** Constructor for a EndReg node.
1839 * Used to represent regular procedure end in interprocedual view.
1841 * @param *db A pointer for debug information.
1842 * @param *irg The ir graph the node belong to.
1843 * @param *block The block the node belong to.
1845 ir_node *new_rd_EndReg (dbg_info *db, ir_graph *irg, ir_node *block);
1847 /** Constructor for a EndExcept node.
1849 * Used to represent exceptional procedure end in interprocedural view.
1851 * @param *db A pointer for debug information.
1852 * @param *irg The ir graph the node belong to.
1853 * @param *block The block the node belong to.
1855 ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
1857 /** Constructor for a Filter node.
1859 * Adds the node to the block in current_ir_block. Filter is a node
1860 * with two views used to construct the interprocedural view. In
1861 * intraprocedural view its semantics are identical to the Proj node.
1862 * In interprocedural view the Filter performs the Phi operation on
1863 * method parameters or results. Other than a Phi a Filter node may
1864 * not be removed if it has only a single input.
1866 * The constructor builds the Filter in intraprocedural view.
1868 * @param *db A pointer for debug information.
1869 * @param *irg The ir graph the node belong to.
1870 * @param *block The block the node belong to.
1871 * @param *arg The tuple value to project from.
1872 * @param *mode The mode of the projected value.
1873 * @param proj The position in the tuple to project from.
1875 ir_node *new_rd_Filter (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1876 ir_mode *mode, long proj);
1878 /** Constructor for a NoMem node.
1880 * Returns the unique NoMem node of the graph. The same as
1883 * @param *irg The ir graph the node belongs to.
1885 ir_node *new_rd_NoMem (ir_graph *irg);
1887 /** Constructor for a Mux node.
1889 * @param *db A pointer for debug information.
1890 * @param *irg The ir graph the node belong to.
1891 * @param *block The block the node belong to.
1892 * @param *sel The ir_node that calculates the boolean select.
1893 * @param *ir_true The ir_node that calculates the true result.
1894 * @param *ir_false The ir_node that calculates the false result.
1895 * @param *mode The mode of the node (and it_true and ir_false).
1897 ir_node *new_rd_Mux (dbg_info *db, ir_graph *irg, ir_node *block,
1898 ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
1900 /** Constructor for a Psi node.
1902 * @param *db A pointer for debug information.
1903 * @param *irg The ir graph the node belong to.
1904 * @param *block The block the node belong to.
1905 * @param *arity The arity of the conditions
1906 * @param *conds The array of mode_b conditions, length must be equal arity
1907 * @param *vals The array of mode values, length must be equal arity + 1
1908 * @param *mode The mode of the node (must be the mode of all vals).
1910 ir_node *new_rd_Psi (dbg_info *db, ir_graph *irg, ir_node *block,
1911 int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
1913 /** Constructor for a CopyB node.
1915 * @param *db A pointer for debug information.
1916 * @param *irg The ir graph the node belong to.
1917 * @param *block The block the node belong to.
1918 * @param *store The current memory
1919 * @param *dst The ir_node that represents the destination address.
1920 * @param *src The ir_node that represents the source address.
1921 * @param *data_type The type of the copied data
1923 ir_node *new_rd_CopyB(dbg_info *db, ir_graph *irg, ir_node *block,
1924 ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
1926 /** Constructor for a InstOf node.
1928 * A High-Level Type check.
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 memory in which the object the entity should be selected
1934 * from is allocated.
1935 * @param *objptr A pointer to a object of a class type.
1936 * @param *type The type of which objptr must be.
1938 ir_node *new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1939 ir_node *objptr, ir_type *type);
1941 /** Constructor for a Raise node.
1943 * A High-Level Exception throw.
1945 * @param *db A pointer for debug information.
1946 * @param *irg The ir graph the node belongs to.
1947 * @param *block The ir block the node belongs to.
1948 * @param *store The current memory.
1949 * @param *obj A pointer to the Except variable.
1951 ir_node *new_rd_Raise (dbg_info *db, ir_graph *irg, ir_node *block,
1952 ir_node *store, ir_node *obj);
1954 /** Constructor for a Bound node.
1956 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
1958 * @param *db A pointer for debug information.
1959 * @param *irg The ir graph the node belong to.
1960 * @param *block The block the node belong to.
1961 * @param *store The current memory.
1962 * @param *idx The ir_node that represents an index.
1963 * @param *lower The ir_node that represents the lower bound for the index.
1964 * @param *upper The ir_node that represents the upper bound for the index.
1966 ir_node *new_rd_Bound(dbg_info *db, ir_graph *irg, ir_node *block,
1967 ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
1969 /** Constructor for a Pin node.
1971 * @param *db A pointer for debug information.
1972 * @param *irg The ir graph the node belong to.
1973 * @param *block The block the node belong to.
1974 * @param *node The node which value should be pinned.
1976 ir_node *new_rd_Pin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *node);
1978 /*-------------------------------------------------------------------------*/
1979 /* The raw interface without debug support */
1980 /*-------------------------------------------------------------------------*/
1982 /** Constructor for a Block node.
1984 * Constructs a mature block with the given predecessors. Use Unknown
1985 * nodes as predecessors to construct a block if the number of
1986 * predecessors is known, but not the predecessors themselves. This
1987 * constructor does not set current_block. It not be used with
1988 * automatic Phi node construction.
1991 * @param irg The ir graph the block belongs to.
1992 * @param arity The number of control predecessors.
1993 * @param in[] An array of control predecessors. The length of
1994 * the array must be 'arity'. The constructor copies this array.
1996 ir_node *new_r_Block (ir_graph *irg, int arity, ir_node *in[]);
1998 /** Constructor for a Start node.
2000 * @param *irg The ir graph the node belongs to.
2001 * @param *block The ir block the node belongs to.
2003 ir_node *new_r_Start (ir_graph *irg, ir_node *block);
2005 /** Constructor for a End node.
2007 * @param *irg The ir graph the node belongs to.
2008 * @param *block The ir block the node belongs to.
2010 ir_node *new_r_End (ir_graph *irg, ir_node *block);
2012 /** Constructor for a Jmp node.
2014 * Jmp represents control flow to a single control successor.
2016 * @param *irg The ir graph the node belongs to.
2017 * @param *block The ir block the node belongs to.
2019 ir_node *new_r_Jmp (ir_graph *irg, ir_node *block);
2021 /** Constructor for an IJmp node.
2023 * IJmp represents control flow to a single control successor not
2024 * statically known i.e. an indirect Jmp.
2026 * @param *irg The ir graph the node belongs to.
2027 * @param *block The ir block the node belongs to.
2028 * @param *tgt The ir node representing the target address.
2030 ir_node *new_r_IJmp (ir_graph *irg, ir_node *block, ir_node *tgt);
2032 /** Constructor for a Cond node.
2034 * If c is mode_b represents a conditional branch (if/else). If c is
2035 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2036 * node, default Proj is 0.)
2038 * This is not consistent: Input to Cond is Is, Proj has as proj number
2041 * @param *irg The ir graph the node belongs to.
2042 * @param *block The ir block the node belongs to.
2043 * @param *c The conditions parameter.Can be of mode b or I_u.
2045 ir_node *new_r_Cond (ir_graph *irg, ir_node *block, ir_node *c);
2047 /** Constructor for a Return node.
2049 * Returns the memory an zero or more return values. Only node that
2050 * can end regular control flow.
2052 * @param *irg The ir graph the node belongs to.
2053 * @param *block The ir block the node belongs to.
2054 * @param *store The state of memory.
2055 * @param arity Number of array indices.
2056 * @param *in[] Array with index inputs to the node. The constructor copies this array.
2058 ir_node *new_r_Return (ir_graph *irg, ir_node *block,
2059 ir_node *store, int arity, ir_node *in[]);
2061 /** Constructor for a Const node.
2063 * Constructor for a Const node. The constant represents a target
2064 * value. Sets the type information to type_unknown. (No more
2065 * supported: If tv is entity derives a somehow useful type.)
2067 * @param *irg The ir graph the node belongs to.
2068 * @param *block The ir block the node belongs to.
2069 * @param *mode The mode of the operands and the results.
2070 * @param *con Points to an entry in the constant table.
2072 ir_node *new_r_Const (ir_graph *irg, ir_node *block,
2073 ir_mode *mode, tarval *con);
2075 /** Constructor for a Const node.
2077 * Constructor for a Const node. The constant represents a target
2078 * value. Sets the type information to type_unknown. (No more
2079 * supported: If tv is entity derives a somehow useful type.)
2081 * @param *irg The ir graph the node belongs to.
2082 * @param *block The ir block the node belongs to.
2083 * @param *mode The mode of the operands and the results.
2084 * @param value A value from which the tarval is made.
2086 ir_node *new_r_Const_long(ir_graph *irg, ir_node *block,
2087 ir_mode *mode, long value);
2089 /** Constructor for a Const_type node.
2091 * The constant represents a target value. This constructor sets high
2092 * level type information for the constant value.
2094 * @param *irg The ir graph the node belongs to.
2095 * @param *block The ir block the node belongs to.
2096 * @param *mode The mode of the operands and results.
2097 * @param *con Points to an entry in the constant table.
2098 * @param *tp The type of the constant.
2100 ir_node *new_r_Const_type(ir_graph *irg, ir_node *block,
2101 ir_mode *mode, tarval *con, ir_type *tp);
2103 /** Constructor for a SymConst node.
2105 * This is the constructor for a symbolic constant.
2106 * There are four kinds of symbolic constants:
2107 * - type_tag The symbolic constant represents a type tag. The type the
2108 * tag stands for is given explicitly.
2109 * - size The symbolic constant represents the size of a type. The
2110 * type of which the constant represents the size is given
2112 * - addr_name The symbolic constant represents the address of an entity
2113 * (variable or method). The variable is indicated by a name
2114 * that is valid for linking.
2115 * - addr_ent The symbolic constant represents the address of an entity
2116 * (variable or method). The variable is given explicitly by
2119 * Inputs to the node:
2120 * No inputs except the block it belongs to.
2121 * Outputs of the node.
2122 * An unsigned integer (I_u) or a pointer (P).
2124 * @param *irg The ir graph the node belongs to.
2125 * @param *block The ir block the node belongs to.
2126 * @param value A type, entity or a ident depending on the SymConst kind.
2127 * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
2129 ir_node *new_r_SymConst (ir_graph *irg, ir_node *block,
2130 union symconst_symbol value, symconst_kind symkind);
2132 /** Constructor for a simpleSel node.
2134 * This is a shortcut for the new_d_Sel() constructor. To be used for
2135 * Sel nodes that do not select from an array, i.e., have no index
2136 * inputs. It adds the two parameters 0, NULL.
2138 * @param *irg The ir graph the node belongs to.
2139 * @param *block The ir block the node belongs to.
2140 * @param *store The memory in which the object the entity should be selected
2141 * from is allocated.
2142 * @param *objptr The object from that the Sel operation selects a
2143 * single attribute out.
2144 * @param *ent The entity to select.
2146 ir_node *new_r_simpleSel(ir_graph *irg, ir_node *block, ir_node *store,
2147 ir_node *objptr, ir_entity *ent);
2149 /** Constructor for a Sel node.
2151 * The select node selects an entity (field or method) from an entity
2152 * with a compound type. It explicitly specifies the entity selected.
2153 * Dynamically the node may select entities that overwrite the given
2154 * entity. If the selected entity is an array element entity the Sel
2155 * node takes the required array indices as inputs.
2157 * @param *irg The ir graph the node belongs to.
2158 * @param *block The ir block the node belongs to.
2159 * @param *store The memory in which the object the entity should be selected
2160 * from is allocated.
2161 * @param *objptr A pointer to a compound entity the Sel operation selects a
2162 * single attribute from.
2163 * @param *n_index The number of array indices needed to select an array element entity.
2164 * @param *index[] If the compound entity is an array the indices of the selected
2165 * element entity. The constructor copies this array.
2166 * @param *ent The entity to select.
2168 ir_node *new_r_Sel (ir_graph *irg, ir_node *block, ir_node *store,
2169 ir_node *objptr, int n_index, ir_node *index[],
2172 /** Constructor for a Call node.
2174 * Represents all kinds of method and function calls.
2176 * @param *irg The ir graph the node belongs to.
2177 * @param *block The ir block the node belongs to.
2178 * @param *store The actual store.
2179 * @param *callee A pointer to the called procedure.
2180 * @param arity The number of procedure parameters.
2181 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2182 * @param *tp Type information of the procedure called.
2184 ir_node *new_r_Call (ir_graph *irg, ir_node *block, ir_node *store,
2185 ir_node *callee, int arity, ir_node *in[],
2188 /** Constructor for a Add node.
2190 * @param *irg The ir graph the node belongs to.
2191 * @param *block The ir block the node belongs to.
2192 * @param *op1 The first operand.
2193 * @param *op2 The second operand.
2194 * @param *mode The mode of the operands and the result.
2196 ir_node *new_r_Add (ir_graph *irg, ir_node *block,
2197 ir_node *op1, ir_node *op2, ir_mode *mode);
2200 * Constructor for a Sub node.
2202 * @param *irg The ir graph the node belongs to.
2203 * @param *block The ir block the node belongs to.
2204 * @param *op1 The first operand.
2205 * @param *op2 The second operand.
2206 * @param *mode The mode of the operands and the results.
2208 ir_node *new_r_Sub (ir_graph *irg, ir_node *block,
2209 ir_node *op1, ir_node *op2, ir_mode *mode);
2211 /** Constructor for a Minus node.
2213 * @param *irg The ir graph the node belongs to.
2214 * @param *block The ir block the node belongs to.
2215 * @param *op The operand.
2216 * @param *mode The mode of the operand and the result.
2218 ir_node *new_r_Minus (ir_graph *irg, ir_node *block,
2219 ir_node *op, ir_mode *mode);
2220 /** Constructor for a Mul node.
2222 * @param *irg The ir graph the node belongs to.
2223 * @param *block The ir block the node belongs to.
2224 * @param *op1 The first operand.
2225 * @param *op2 The second operand.
2226 * @param *mode The mode of the operands and the result.
2228 ir_node *new_r_Mul (ir_graph *irg, ir_node *block,
2229 ir_node *op1, ir_node *op2, ir_mode *mode);
2231 /** Constructor for a Quot node.
2233 * @param *irg The ir graph the node belongs to.
2234 * @param *block The ir block the node belongs to.
2235 * @param *memop The store needed to model exceptions
2236 * @param *op1 The first operand.
2237 * @param *op2 The second operand.
2239 ir_node *new_r_Quot (ir_graph *irg, ir_node *block,
2240 ir_node *memop, ir_node *op1, ir_node *op2);
2242 /** Constructor for a DivMod node.
2244 * @param *irg The ir graph the node belongs to.
2245 * @param *block The ir block the node belongs to.
2246 * @param *memop The store needed to model exceptions
2247 * @param *op1 The first operand.
2248 * @param *op2 The second operand.
2250 ir_node *new_r_DivMod (ir_graph *irg, ir_node *block,
2251 ir_node *memop, ir_node *op1, ir_node *op2);
2253 /** Constructor for a Div node.
2255 * @param *irg The ir graph the node belongs to.
2256 * @param *block The ir block the node belongs to.
2257 * @param *memop The store needed to model exceptions
2258 * @param *op1 The first operand.
2259 * @param *op2 The second operand.
2261 ir_node *new_r_Div (ir_graph *irg, ir_node *block,
2262 ir_node *memop, ir_node *op1, ir_node *op2);
2264 /** Constructor for a Mod node.
2266 * @param *irg The ir graph the node belongs to.
2267 * @param *block The ir block the node belongs to.
2268 * @param *memop The store needed to model exceptions
2269 * @param *op1 The first operand.
2270 * @param *op2 The second operand.
2272 ir_node *new_r_Mod (ir_graph *irg, ir_node *block,
2273 ir_node *memop, ir_node *op1, ir_node *op2);
2275 /** Constructor for a Abs node.
2277 * @param *irg The ir graph the node belongs to.
2278 * @param *block The ir block the node belongs to.
2279 * @param *op The operand
2280 * @param *mode The mode of the operands and the result.
2282 ir_node *new_r_Abs (ir_graph *irg, ir_node *block,
2283 ir_node *op, ir_mode *mode);
2285 /** Constructor for a And node.
2287 * @param *irg The ir graph the node belongs to.
2288 * @param *block The ir block the node belongs to.
2289 * @param *op1 The first operand.
2290 * @param *op2 The second operand.
2291 * @param *mode The mode of the operands and the result.
2293 ir_node *new_r_And (ir_graph *irg, ir_node *block,
2294 ir_node *op1, ir_node *op2, ir_mode *mode);
2296 /** Constructor for a Or node.
2298 * @param *irg The ir graph the node belongs to.
2299 * @param *block The ir block the node belongs to.
2300 * @param *op1 The first operand.
2301 * @param *op2 The second operand.
2302 * @param *mode The mode of the operands and the result.
2304 ir_node *new_r_Or (ir_graph *irg, ir_node *block,
2305 ir_node *op1, ir_node *op2, ir_mode *mode);
2307 /** Constructor for a Eor node.
2309 * @param *irg The ir graph the node belongs to.
2310 * @param *block The ir block the node belongs to.
2311 * @param *op1 The first operand.
2312 * @param *op2 The second operand.
2313 * @param *mode The mode of the operands and the results.
2315 ir_node *new_r_Eor (ir_graph *irg, ir_node *block,
2316 ir_node *op1, ir_node *op2, ir_mode *mode);
2318 /** Constructor for a Not node.
2320 * @param *irg The ir graph the node belongs to.
2321 * @param *block The ir block the node belongs to.
2322 * @param *op The operand.
2323 * @param *mode The mode of the operand and the result.
2325 ir_node *new_r_Not (ir_graph *irg, ir_node *block,
2326 ir_node *op, ir_mode *mode);
2328 /** Constructor for a Cmp node.
2330 * @param *irg The ir graph the node belongs to.
2331 * @param *block The ir block the node belongs to.
2332 * @param *op1 The first operand.
2333 * @param *op2 The second operand.
2335 ir_node *new_r_Cmp (ir_graph *irg, ir_node *block,
2336 ir_node *op1, ir_node *op2);
2338 /** Constructor for a Shl node.
2340 * @param *irg The ir graph the node belongs to.
2341 * @param *block The ir block the node belongs to.
2342 * @param *op The operand.
2343 * @param *k The number of bits to shift the operand .
2344 * @param *mode The mode of the operand and the result.
2346 ir_node *new_r_Shl (ir_graph *irg, ir_node *block,
2347 ir_node *op, ir_node *k, ir_mode *mode);
2349 /** Constructor for a Shr node.
2351 * @param *irg The ir graph the node belongs to.
2352 * @param *block The ir block the node belongs to.
2353 * @param *op The operand.
2354 * @param *k The number of bits to shift the operand .
2355 * @param *mode The mode of the operand and the result.
2357 ir_node *new_r_Shr (ir_graph *irg, ir_node *block,
2358 ir_node *op, ir_node *k, ir_mode *mode);
2361 * Constructor for a Shrs node.
2363 * @param *irg The ir graph the node belongs to.
2364 * @param *block The ir block the node belongs to.
2365 * @param *op The operand.
2366 * @param *k The number of bits to shift the operand.
2367 * @param *mode The mode of the operand and the result.
2369 ir_node *new_r_Shrs (ir_graph *irg, ir_node *block,
2370 ir_node *op, ir_node *k, ir_mode *mode);
2372 /** Constructor for a Rot node.
2374 * @param *irg The ir graph the node belongs to.
2375 * @param *block The ir block the node belongs to.
2376 * @param *op The operand.
2377 * @param *k The number of bits to rotate the operand.
2378 * @param *mode The mode of the operand.
2380 ir_node *new_r_Rot (ir_graph *irg, ir_node *block,
2381 ir_node *op, ir_node *k, ir_mode *mode);
2383 /** Constructor for a Conv node.
2385 * @param *irg The ir graph the node belongs to.
2386 * @param *block The ir block the node belongs to.
2387 * @param *op The operand.
2388 * @param *mode The mode of this the operand muss be converted .
2390 ir_node *new_r_Conv (ir_graph *irg, ir_node *block,
2391 ir_node *op, ir_mode *mode);
2393 /** Constructor for a Cast node.
2395 * High level type cast
2397 * @param *irg The ir graph the node belongs to.
2398 * @param *block The ir block the node belongs to.
2399 * @param *op The operand.
2400 * @param *to_tp The type of this the operand muss be casted .
2402 ir_node *new_r_Cast (ir_graph *irg, ir_node *block,
2403 ir_node *op, ir_type *to_tp);
2405 /** Constructor for a Carry node.
2407 * @param *irg The ir graph the node belongs to.
2408 * @param *block The ir block the node belongs to.
2409 * @param *op1 The first operand.
2410 * @param *op2 The second operand.
2411 * @param *mode The mode of the operands and the result.
2413 ir_node *new_r_Carry (ir_graph *irg, ir_node *block,
2414 ir_node *op1, ir_node *op2, ir_mode *mode);
2417 * Constructor for a Borrow node.
2419 * @param *irg The ir graph the node belongs to.
2420 * @param *block The ir block the node belongs to.
2421 * @param *op1 The first operand.
2422 * @param *op2 The second operand.
2423 * @param *mode The mode of the operands and the results.
2425 ir_node *new_r_Borrow (ir_graph *irg, ir_node *block,
2426 ir_node *op1, ir_node *op2, ir_mode *mode);
2428 /** Constructor for a Phi node.
2430 * @param *irg The ir graph the node belongs to.
2431 * @param *block The ir block the node belongs to.
2432 * @param arity The number of predecessors
2433 * @param *in[] Array with predecessors. The constructor copies this array.
2434 * @param *mode The mode of it's inputs and output.
2436 ir_node *new_r_Phi (ir_graph *irg, ir_node *block, int arity,
2437 ir_node *in[], ir_mode *mode);
2439 /** Constructor for a Load node.
2441 * @param *irg The ir graph the node belongs to.
2442 * @param *block The ir block the node belongs to.
2443 * @param *store The current memory
2444 * @param *adr A pointer to the variable to be read in this memory.
2445 * @param *mode The mode of the value to be loaded.
2447 ir_node *new_r_Load (ir_graph *irg, ir_node *block,
2448 ir_node *store, ir_node *adr, ir_mode *mode);
2450 /** Constructor for a Store node.
2452 * @param *irg The ir graph the node belongs to.
2453 * @param *block The ir block the node belongs to.
2454 * @param *store The current memory
2455 * @param *adr A pointer to the variable to be read in this memory.
2456 * @param *val The value to write to this variable.
2458 ir_node *new_r_Store (ir_graph *irg, ir_node *block,
2459 ir_node *store, ir_node *adr, ir_node *val);
2461 /** Constructor for a Alloc node.
2463 * The Alloc node extends the memory by space for an entity of type alloc_type.
2465 * @param *irg The ir graph the node belongs to.
2466 * @param *block The ir block the node belongs to.
2467 * @param *store The memory which shall contain the new variable.
2468 * @param *size The number of bytes to allocate.
2469 * @param *alloc_type The type of the allocated variable.
2470 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
2472 ir_node *new_r_Alloc (ir_graph *irg, ir_node *block, ir_node *store,
2473 ir_node *size, ir_type *alloc_type, where_alloc where);
2475 /** Constructor for a Free node.
2477 * Frees the memory occupied by the entity pointed to by the pointer
2478 * arg. Type indicates the type of the entity the argument points to.
2480 * @param *irg The ir graph the node belongs to.
2481 * @param *block The ir block the node belongs to.
2482 * @param *store The memory which shall contain the new variable.
2483 * @param *ptr The pointer to the object to free.
2484 * @param *size The number of objects of type free_type to free in a sequence.
2485 * @param *free_type The type of the freed variable.
2486 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
2488 ir_node *new_r_Free (ir_graph *irg, ir_node *block, ir_node *store,
2489 ir_node *ptr, ir_node *size, ir_type *free_type, where_alloc where);
2491 /** Constructor for a Sync node.
2493 * Merges several memory values. The node assumes that a variable
2494 * either occurs only in one of the memories, or it contains the same
2495 * value in all memories where it occurs.
2497 * @param *irg The ir graph the node belongs to.
2498 * @param *block The ir block the node belongs to.
2499 * @param arity The number of memories to synchronize.
2500 * @param *in[] An array of pointers to nodes that produce an output of type memory.
2501 * The constructor copies this array.
2503 ir_node *new_r_Sync (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2505 /** Constructor for a Proj node.
2507 * Projects a single value out of a tuple. The parameter proj gives the
2508 * position of the value within the tuple.
2510 * @param *irg The ir graph the node belongs to.
2511 * @param *block The ir block the node belongs to.
2512 * @param arg A node producing a tuple.
2513 * @param *mode The mode of the value to project.
2514 * @param proj The position of the value in the tuple.
2516 ir_node *new_r_Proj (ir_graph *irg, ir_node *block, ir_node *arg,
2517 ir_mode *mode, long proj);
2519 /** Constructor for a defaultProj node.
2521 * Represents the default control flow of a Switch-Cond node.
2523 * @param *irg The ir graph the node belongs to.
2524 * @param *block The ir block the node belongs to.
2525 * @param arg A node producing a tuple.
2526 * @param max_proj The end position of the value in the tuple.
2528 ir_node *new_r_defaultProj (ir_graph *irg, ir_node *block, ir_node *arg, long max_proj);
2531 /** Constructor for a Tuple node.
2533 * This is an auxiliary node to replace a node that returns a tuple
2534 * without changing the corresponding Proj nodes.
2536 * @param *irg The ir graph the node belongs to.
2537 * @param *block The ir block the node belongs to.
2538 * @param arity The number of tuple elements.
2539 * @param *in[] An array containing pointers to the nodes producing the tuple elements.
2540 * The constructor copies this array.
2542 ir_node *new_r_Tuple (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2544 /** Constructor for a Id node.
2546 * This is an auxiliary node to replace a node that returns a single
2549 * @param *irg The ir graph the node belongs to.
2550 * @param *block The ir block the node belongs to.
2551 * @param *val The operand to Id.
2552 * @param *mode The mode of *val.
2554 ir_node *new_r_Id (ir_graph *irg, ir_node *block,
2555 ir_node *val, ir_mode *mode);
2557 /** Constructor for a Bad node.
2559 * Returns the unique Bad node of the graph. The same as
2562 * @param *irg The ir graph the node belongs to.
2565 ir_node *new_r_Bad (ir_graph *irg);
2567 /** Constructor for a Confirm node.
2569 * Specifies constraints for a value. To support dataflow analyses.
2571 * Example: If the value never exceeds '100' this is expressed by placing a
2572 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
2574 * @param *irg The ir graph the node belong to.
2575 * @param *block The ir block the node belong to.
2576 * @param *val The value we express a constraint for
2577 * @param *bound The value to compare against. Must be a firm node, typically a constant.
2578 * @param cmp The compare operation.
2580 ir_node *new_r_Confirm (ir_graph *irg, ir_node *block,
2581 ir_node *val, ir_node *bound, pn_Cmp cmp);
2583 /** Constructor for a Unknown node.
2585 * Represents an arbitrary value. Places the node in
2588 * @param *irg The ir graph the node belongs to.
2589 * @param *m The mode of the unknown value.
2591 ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2593 /** Constructor for a CallBegin node.
2595 * CallBegin represents control flow depending of the pointer value
2596 * representing the called method to the called methods. The
2597 * constructor copies the method pointer input from the passed Call
2600 * @param *irg The ir graph the node belong to.
2601 * @param *block The block the node belong to.
2602 * @param *callee The call node visible in the intra procedural view.
2604 ir_node *new_r_CallBegin(ir_graph *irg, ir_node *block, ir_node *callee);
2606 /** Constructor for a EndReg node.
2608 * Used to represent regular procedure end in interprocedual view.
2610 * @param *irg The ir graph the node belong to.
2611 * @param *block The block the node belong to.
2613 ir_node *new_r_EndReg (ir_graph *irg, ir_node *block);
2615 /** Constructor for a EndExcept node.
2617 * Used to represent exceptional procedure end in interprocedural view.
2619 * @param *irg The ir graph the node belong to.
2620 * @param *block The block the node belong to.
2622 ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
2624 /** Constructor for a Break node.
2626 * Break represents control flow to a single control successor just as Jmp.
2627 * The blocks separated by a break may not be concatenated by an optimization.
2628 * It is used for the interprocedural representation where blocks are parted
2629 * behind Call nodes to represent the control flow to called procedures.
2631 * @param *irg The ir graph the node belong to.
2632 * @param *block The block the node belong to.
2634 ir_node *new_r_Break (ir_graph *irg, ir_node *block);
2636 /** Constructor for a Filter node.
2638 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
2639 * Filter is a node with two views used to construct the interprocedural view.
2640 * In intraprocedural view its semantics are identical to the Proj node.
2641 * In interprocedural view the Filter performs the Phi operation on method
2642 * parameters or results. Other than a Phi a Filter node may not be removed
2643 * if it has only a single input.
2645 * The constructor builds the Filter in intraprocedural view.
2647 * @param *irg The ir graph the node belong to.
2648 * @param *block The block the node belong to.
2649 * @param *arg The tuple value to project from.
2650 * @param *mode The mode of the projected value.
2651 * @param proj The position in the tuple to project from.
2653 ir_node *new_r_Filter (ir_graph *irg, ir_node *block, ir_node *arg,
2654 ir_mode *mode, long proj);
2656 /** Constructor for a NoMem node.
2658 * Returns the unique NoMem node of the graph. The same as
2661 * @param *irg The ir graph the node belongs to.
2663 ir_node *new_r_NoMem (ir_graph *irg);
2665 /** Constructor for a Mux node.
2667 * @param *irg The ir graph the node belong to.
2668 * @param *block The block the node belong to.
2669 * @param *sel The ir_node that calculates the boolean select.
2670 * @param *ir_true The ir_node that calculates the true result.
2671 * @param *ir_false The ir_node that calculates the false result.
2672 * @param *mode The mode of the node (and it_true and ir_false).
2674 ir_node *new_r_Mux (ir_graph *irg, ir_node *block,
2675 ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2677 /** Constructor for a Psi node.
2679 * @param *irg The ir graph the node belong to.
2680 * @param *block The block the node belong to.
2681 * @param *arity The arity of the conditions
2682 * @param *conds The array of mode_b conditions, length must be equal arity
2683 * @param *vals The array of mode values, length must be equal arity + 1
2684 * @param *mode The mode of the node (must be the mode of all vals).
2686 ir_node *new_r_Psi (ir_graph *irg, ir_node *block,
2687 int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
2689 /** Constructor for a CopyB node.
2691 * @param *irg The ir graph the node belong to.
2692 * @param *block The block the node belong to.
2693 * @param *store The current memory
2694 * @param *dst The ir_node that represents the destination address.
2695 * @param *src The ir_node that represents the source address.
2696 * @param *data_type The type of the copied data
2698 ir_node *new_r_CopyB(ir_graph *irg, ir_node *block,
2699 ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
2701 /** Constructor for a InstOf node.
2703 * A High-Level Type check.
2705 * @param *irg The ir graph the node belongs to.
2706 * @param *block The ir block the node belongs to.
2707 * @param *store The memory in which the object the entity should be selected
2708 * from is allocated.
2709 * @param *objptr A pointer to a object of a class type.
2710 * @param *type The type of which objptr must be.
2712 ir_node *new_r_InstOf (ir_graph *irg, ir_node *block, ir_node *store,
2713 ir_node *objptr, ir_type *type);
2715 /** Constructor for a Raise node.
2717 * A High-Level Exception throw.
2719 * @param *irg The ir graph the node belongs to.
2720 * @param *block The ir block the node belongs to.
2721 * @param *store The current memory.
2722 * @param *obj A pointer to the Except variable.
2724 ir_node *new_r_Raise (ir_graph *irg, ir_node *block,
2725 ir_node *store, ir_node *obj);
2727 /** Constructor for a Bound node.
2729 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2731 * @param *irg The ir graph the node belong to.
2732 * @param *block The block the node belong to.
2733 * @param *store The current memory.
2734 * @param *idx The ir_node that represents an index.
2735 * @param *lower The ir_node that represents the lower bound for the index.
2736 * @param *upper The ir_node that represents the upper bound for the index.
2738 ir_node *new_r_Bound(ir_graph *irg, ir_node *block,
2739 ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
2741 /** Constructor for a Pin node.
2743 * @param *irg The ir graph the node belong to.
2744 * @param *block The block the node belong to.
2745 * @param *node The node which value should be pinned.
2747 ir_node *new_r_Pin(ir_graph *irg, ir_node *block, ir_node *node);
2749 /*-----------------------------------------------------------------------*/
2750 /* The block oriented interface */
2751 /*-----------------------------------------------------------------------*/
2753 /** Sets the current block in which the following constructors place the
2754 * nodes they construct.
2756 * @param target The new current block.
2758 void set_cur_block (ir_node *target);
2760 /** Returns the current block of the current graph. */
2761 ir_node *get_cur_block(void);
2763 /** Returns the fixed nodes of the current graph. */
2764 #define get_cur_end_block() get_irg_end_block(current_ir_graph)
2765 #define get_cur_end() get_irg_end(current_ir_graph)
2766 #define get_cur_start_block() get_irg_start_block(current_ir_graph)
2767 #define get_cur_start() get_irg_start(current_ir_graph)
2769 /** Constructor for a Block node.
2771 * Adds the block to the graph in current_ir_graph. Constructs a Block
2772 * with a fixed number of predecessors. Does set current_block. Can
2773 * be used with automatic Phi node construction.
2775 * @param *db A Pointer for debug information.
2776 * @param arity The number of control predecessors.
2777 * @param in[] An array of control predecessors. The length of
2778 * the array must be 'arity'.
2780 ir_node *new_d_Block(dbg_info *db, int arity, ir_node *in[]);
2782 /** Constructor for a Start node.
2784 * Adds the node to the block in current_ir_block.
2786 * @param *db A pointer for debug information.
2788 ir_node *new_d_Start (dbg_info *db);
2790 /** Constructor for a End node.
2792 * Adds the node to the block in current_ir_block.
2794 * @param *db A pointer for debug information.
2796 ir_node *new_d_End (dbg_info *db);
2798 /** Constructor for a Jmp node.
2800 * Adds the node to the block in current_ir_block.
2802 * Jmp represents control flow to a single control successor.
2804 * @param *db A pointer for debug information.
2806 ir_node *new_d_Jmp (dbg_info *db);
2808 /** Constructor for an IJmp node.
2810 * IJmp represents control flow to a single control successor not
2811 * statically known i.e. an indirect Jmp.
2813 * @param *db A pointer for debug information.
2814 * @param *tgt The ir node representing the target address.
2816 ir_node *new_d_IJmp (dbg_info *db, ir_node *tgt);
2818 /** Constructor for a Cond node.
2820 * Adds the node to the block in current_ir_block.
2822 * If c is mode_b represents a conditional branch (if/else). If c is
2823 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2824 * node, default Proj is 0.)
2826 * This is not consistent: Input to Cond is Is, Proj has as proj number
2829 * @param *db A pointer for debug information.
2830 * @param *c The conditions parameter.Can be of mode b or I_u.
2832 ir_node *new_d_Cond (dbg_info *db, ir_node *c);
2834 /** Constructor for a Return node.
2836 * Adds the node to the block in current_ir_block.
2838 * Returns the memory an zero or more return values. Only node that
2839 * can end regular control flow.
2841 * @param *db A pointer for debug information.
2842 * @param *store The state of memory.
2843 * @param arity Number of array indices.
2844 * @param *in Array with index inputs to the node.
2846 ir_node *new_d_Return (dbg_info *db, ir_node *store, int arity, ir_node *in[]);
2848 /** Constructor for a Const_type node.
2850 * Adds the node to the block in current_ir_block.
2852 * The constant represents a target value. This constructor sets high
2853 * level type information for the constant value.
2855 * @param *db A pointer for debug information.
2856 * @param *mode The mode of the operands and results.
2857 * @param *con Points to an entry in the constant table. This pointer is
2858 added to the attributes of the node.
2859 * @param *tp The type of the constant.
2861 ir_node *new_d_Const_type (dbg_info *db, ir_mode *mode, tarval *con, ir_type *tp);
2863 /** Constructor for a Const node.
2865 * Adds the node to the block in current_ir_block.
2867 * Constructor for a Const node. The constant represents a target
2868 * value. Sets the type information to type_unknown. (No more
2869 * supported: If tv is entity derives a somehow useful type.)
2871 * @param *db A pointer for debug information.
2872 * @param *mode The mode of the operands and results.
2873 * @param *con Points to an entry in the constant table. This pointer is added
2874 * to the attributes of the node.
2876 ir_node *new_d_Const (dbg_info *db, ir_mode *mode, tarval *con);
2878 /** Constructor for a SymConst_type node.
2880 * Adds the node to the block in current_ir_block.
2881 * This is the constructor for a symbolic constant.
2882 * There are four kinds of symbolic constants:
2883 * - type_tag The symbolic constant represents a type tag. The type the
2884 * tag stands for is given explicitly.
2885 * - size The symbolic constant represents the size of a type. The
2886 * type of which the constant represents the size is given
2888 * - addr_name The symbolic constant represents the address of an entity
2889 * (variable or method). The variable is indicated by a name
2890 * that is valid for linking.
2891 * - addr_ent The symbolic constant represents the address of an entity
2892 * (variable or method). The variable is given explicitly by
2895 * Inputs to the node:
2896 * No inputs except the block it belongs to.
2897 * Outputs of the node.
2898 * An unsigned integer (I_u) or a pointer (P).
2900 * @param *db A pointer for debug information.
2901 * @param value A type, entity or ident depending on the SymConst kind.
2902 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size,
2903 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
2904 * @param tp The source type of the constant.
2906 ir_node *new_d_SymConst_type (dbg_info *db, union symconst_symbol value, symconst_kind kind, ir_type *tp);
2908 /** Constructor for a SymConst node.
2910 * Same as new_d_SymConst_type, except that it sets the type to type_unknown. */
2911 ir_node *new_d_SymConst (dbg_info *db, union symconst_symbol value, symconst_kind kind);
2913 /** Constructor for a simpleSel node.
2915 * This is a shortcut for the new_d_Sel() constructor. To be used for
2916 * Sel nodes that do not select from an array, i.e., have no index
2917 * inputs. It adds the two parameters 0, NULL.
2919 * @param *db A pointer for debug information.
2920 * @param *store The memory in which the object the entity should be
2921 * selected from is allocated.
2922 * @param *objptr The object from that the Sel operation selects a
2923 * single attribute out.
2924 * @param *ent The entity to select.
2926 ir_node *new_d_simpleSel(dbg_info *db, ir_node *store, ir_node *objptr, ir_entity *ent);
2928 /** Constructor for a Sel node.
2930 * The select node selects an entity (field or method) from an entity
2931 * with a compound type. It explicitly specifies the entity selected.
2932 * Dynamically the node may select entities that overwrite the given
2933 * entity. If the selected entity is an array element entity the Sel
2934 * node takes the required array indices as inputs.
2935 * Adds the node to the block in current_ir_block.
2937 * @param *db A pointer for debug information.
2938 * @param *store The memory in which the object the entity should be selected
2939 * from is allocated.
2940 * @param *objptr A pointer to a compound entity the Sel operation selects a
2941 * single attribute from.
2942 * @param arity The number of array indices needed to select an array element entity.
2943 * @param *in[] If the compound entity is an array the indices of the selected
2944 * element entity. The constructor copies this array.
2945 * @param *ent The entity to select.
2947 ir_node *new_d_Sel (dbg_info *db, ir_node *store, ir_node *objptr, int arity, ir_node *in[],
2950 /** Constructor for a Call node.
2952 * Represents all kinds of method and function calls.
2953 * Adds the node to the block in current_ir_block.
2955 * @param *db A pointer for debug information.
2956 * @param *store The actual store.
2957 * @param *callee A pointer to the called procedure.
2958 * @param arity The number of procedure parameters.
2959 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2960 * @param *tp Type information of the procedure called.
2962 ir_node *new_d_Call (dbg_info *db, ir_node *store, ir_node *callee, int arity, ir_node *in[],
2965 /** Constructor for a Add 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_Add (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2976 /** Constructor for a Sub node.
2978 * Adds the node to the block in current_ir_block.
2980 * @param *db A pointer for debug information.
2981 * @param *op1 The first operand.
2982 * @param *op2 The second operand.
2983 * @param *mode The mode of the operands and the result.
2985 ir_node *new_d_Sub (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2987 /** Constructor for a Minus node.
2989 * Adds the node to the block in current_ir_block.
2991 * @param *db A pointer for debug information.
2992 * @param *op The operand .
2993 * @param *mode The mode of the operand and the result.
2995 ir_node *new_d_Minus (dbg_info *db, ir_node *op, ir_mode *mode);
2997 /** Constructor for a Mul node.
2999 * Adds the node to the block in current_ir_block.
3001 * @param *db A pointer for debug information.
3002 * @param *op1 The first operand.
3003 * @param *op2 The second operand.
3004 * @param *mode The mode of the operands and the result.
3006 ir_node *new_d_Mul (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3008 /** Constructor for a Quot node.
3010 * Adds the node to the block in current_ir_block.
3012 * @param *db A pointer for debug information.
3013 * @param *memop The store needed to model exceptions
3014 * @param *op1 The first operand.
3015 * @param *op2 The second operand.
3017 ir_node *new_d_Quot (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
3019 /** Constructor for a DivMod node.
3021 * Adds the node to the block in current_ir_block.
3023 * @param *db A pointer for debug information.
3024 * @param *memop The store needed to model exceptions
3025 * @param *op1 The first operand.
3026 * @param *op2 The second operand.
3028 ir_node *new_d_DivMod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
3030 /** Constructor for a Div node.
3032 * Adds the node to the block in current_ir_block.
3034 * @param *db A pointer for debug information.
3035 * @param *memop The store needed to model exceptions
3036 * @param *op1 The first operand.
3037 * @param *op2 The second operand.
3039 ir_node *new_d_Div (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
3041 /** Constructor for a Mod node.
3043 * Adds the node to the block in current_ir_block.
3045 * @param *db A pointer for debug information.
3046 * @param *memop The store needed to model exceptions
3047 * @param *op1 The first operand.
3048 * @param *op2 The second operand.
3050 ir_node *new_d_Mod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
3052 /** Constructor for a Abs node.
3054 * Adds the node to the block in current_ir_block.
3056 * @param *db A pointer for debug information.
3057 * @param *op The operand
3058 * @param *mode The mode of the operands and the result.
3060 ir_node *new_d_Abs (dbg_info *db, ir_node *op, ir_mode *mode);
3062 /** Constructor for a And node.
3064 * Adds the node to the block in current_ir_block.
3066 * @param *db A pointer for debug information.
3067 * @param *op1 The first operand.
3068 * @param *op2 The second operand.
3069 * @param *mode The mode of the operands and the result.
3071 ir_node *new_d_And (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3073 /** Constructor for a Or node.
3075 * Adds the node to the block in current_ir_block.
3077 * @param *db A pointer for debug information.
3078 * @param *op1 The first operand.
3079 * @param *op2 The second operand.
3080 * @param *mode The mode of the operands and the result.
3082 ir_node *new_d_Or (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3084 /** Constructor for a Eor node.
3086 * Adds the node to the block in current_ir_block.
3088 * @param *db A pointer for debug information.
3089 * @param *op1 The first operand.
3090 * @param *op2 The second operand.
3091 * @param *mode The mode of the operands and the results.
3093 ir_node *new_d_Eor (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3095 /** Constructor for a Not 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 *mode The mode of the operand and the result.
3103 ir_node *new_d_Not (dbg_info *db, ir_node *op, ir_mode *mode);
3105 /** Constructor for a Shl node.
3107 * Adds the node to the block in current_ir_block.
3109 * @param *db A pointer for debug information.
3110 * @param *op The operand.
3111 * @param *k The number of bits to shift the operand .
3112 * @param *mode The mode of the operand and the result.
3114 ir_node *new_d_Shl (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3116 /** Constructor for a Shr node.
3118 * Adds the node to the block in current_ir_block.
3120 * @param *db A pointer for debug information.
3121 * @param *op The operand.
3122 * @param *k The number of bits to shift the operand .
3123 * @param *mode The mode of the operand and the result.
3125 ir_node *new_d_Shr (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3127 /** Constructor for a Shrs 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 *k The number of bits to shift the operand .
3134 * @param *mode The mode of the operand and the result.
3136 ir_node *new_d_Shrs (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3138 /** Constructor for a Rot node.
3140 * Adds the node to the block in current_ir_block.
3142 * @param *db A pointer for debug information.
3143 * @param *op The operand.
3144 * @param *k The number of bits to rotate the operand.
3145 * @param *mode The mode of the operand.
3147 ir_node *new_d_Rot (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3149 /** Constructor for a Cmp node.
3151 * Adds the node to the block in current_ir_block.
3153 * @param *db A pointer for debug information.
3154 * @param *op1 The first operand.
3155 * @param *op2 The second operand.
3157 ir_node *new_d_Cmp (dbg_info *db, ir_node *op1, ir_node *op2);
3159 /** Constructor for a Conv node.
3161 * Adds the node to the block in current_ir_block.
3163 * @param *db A pointer for debug information.
3164 * @param *op The operand.
3165 * @param *mode The mode of this the operand muss be converted .
3167 ir_node *new_d_Conv (dbg_info *db, ir_node *op, ir_mode *mode);
3169 /** Constructor for a strict Conv node.
3171 * Adds the node to the block in current_ir_block.
3173 * @param *db A pointer for debug information.
3174 * @param *op The operand.
3175 * @param *mode The mode of this the operand muss be converted .
3177 ir_node *new_d_strictConv (dbg_info *db, ir_node *op, ir_mode *mode);
3179 /** Constructor for a Cast node.
3181 * High level type cast
3182 * Adds the node to the block in current_ir_block.
3184 * @param *db A pointer for debug information.
3185 * @param *op The operand.
3186 * @param *to_tp The type of this the operand muss be casted .
3188 ir_node *new_d_Cast (dbg_info *db, ir_node *op, ir_type *to_tp);
3190 /** Constructor for a Carry node.
3192 * Adds the node to the block in current_ir_block.
3194 * @param *db A pointer for debug information.
3195 * @param *op1 The first operand.
3196 * @param *op2 The second operand.
3197 * @param *mode The mode of the operands and the result.
3199 ir_node *new_d_Carry (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3201 /** Constructor for a Borrow node.
3203 * Adds the node to the block in current_ir_block.
3205 * @param *db A pointer for debug information.
3206 * @param *op1 The first operand.
3207 * @param *op2 The second operand.
3208 * @param *mode The mode of the operands and the result.
3210 ir_node *new_d_Borrow (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3212 /** Constructor for a Phi node.
3214 * Adds the node to the block in current_ir_block.
3216 * @param *db A pointer for debug information.
3217 * @param arity The number of predecessors
3218 * @param *in Array with predecessors
3219 * @param *mode The mode of it's inputs and output.
3221 ir_node *new_d_Phi (dbg_info *db, int arity, ir_node *in[], ir_mode *mode);
3223 /** Constructor for a Load node.
3225 * Adds the node to the block in current_ir_block.
3227 * @param *db A pointer for debug information.
3228 * @param *store The current memory
3229 * @param *addr A pointer to the variable to be read in this memory.
3230 * @param *mode The mode of the value to be loaded.
3232 ir_node *new_d_Load (dbg_info *db, ir_node *store, ir_node *addr, ir_mode *mode);
3234 /** Constructor for a Store node.
3236 * Adds the node to the block in current_ir_block.
3238 * @param *db A pointer for debug information.
3239 * @param *store The current memory
3240 * @param *addr A pointer to the variable to be read in this memory.
3241 * @param *val The value to write to this variable.
3243 ir_node *new_d_Store (dbg_info *db, ir_node *store, ir_node *addr, ir_node *val);
3245 /** Constructor for a Alloc node.
3247 * The Alloc node extends the memory by space for an entity of type alloc_type.
3248 * Adds the node to the block in current_ir_block.
3250 * @param *db A pointer for debug information.
3251 * @param *store The memory which shall contain the new variable.
3252 * @param *size The number of bytes to allocate.
3253 * @param *alloc_type The type of the allocated variable.
3254 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3256 ir_node *new_d_Alloc (dbg_info *db, ir_node *store, ir_node *size, ir_type *alloc_type,
3259 /** Constructor for a Free node.
3261 * Frees the memory occupied by the entity pointed to by the pointer
3262 * arg. Type indicates the type of the entity the argument points to.
3263 * Adds the node to the block in current_ir_block.
3265 * @param *db A pointer for debug information.
3266 * @param *store The memory which shall contain the new variable.
3267 * @param *ptr The pointer to the object to free.
3268 * @param *size The number of objects of type free_type to free in a sequence.
3269 * @param *free_type The type of the freed variable.
3270 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
3272 ir_node *new_d_Free (dbg_info *db, ir_node *store, ir_node *ptr, ir_node *size,
3273 ir_type *free_type, where_alloc where);
3275 /** Constructor for a Sync node.
3277 * Merges several memory values. The node assumes that a variable
3278 * either occurs only in one of the memories, or it contains the same
3279 * value in all memories where it occurs.
3280 * Adds the node to the block in current_ir_block.
3282 * @param *db A pointer for debug information.
3283 * @param arity The number of memories to synchronize.
3284 * @param **in An array of pointers to nodes that produce an output of type
3285 * memory. The constructor copies this array.
3287 ir_node *new_d_Sync (dbg_info *db, int arity, ir_node *in[]);
3289 /** Constructor for a Proj node.
3291 * Projects a single value out of a tuple. The parameter proj gives the
3292 * position of the value within the tuple.
3293 * Adds the node to the block in current_ir_block.
3295 * @param *db A pointer for deubug information.
3296 * @param arg A node producing a tuple.
3297 * @param *mode The mode of the value to project.
3298 * @param proj The position of the value in the tuple.
3300 ir_node *new_d_Proj (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3302 /** Constructor for a defaultProj node.
3304 * Represents the default control flow of a Switch-Cond node.
3305 * Adds the node to the block in current_ir_block.
3307 * @param *db A pointer for debug information.
3308 * @param arg A node producing a tuple.
3309 * @param max_proj The end position of the value in the tuple.
3311 ir_node *new_d_defaultProj (dbg_info *db, ir_node *arg, long max_proj);
3313 /** Constructor for a Tuple node.
3315 * This is an auxiliary node to replace a node that returns a tuple
3316 * without changing the corresponding Proj nodes.
3317 * Adds the node to the block in current_ir_block.
3319 * @param *db A pointer for debug information.
3320 * @param arity The number of tuple elements.
3321 * @param **in An array containing pointers to the nodes producing the tuple elements.
3323 ir_node *new_d_Tuple (dbg_info *db, int arity, ir_node *in[]);
3325 /** Constructor for a Id node.
3327 * This is an auxiliary node to replace a node that returns a single
3328 * value. Adds the node to the block in current_ir_block.
3330 * @param *db A pointer for debug information.
3331 * @param *val The operand to Id.
3332 * @param *mode The mode of *val.
3334 ir_node *new_d_Id (dbg_info *db, ir_node *val, ir_mode *mode);
3336 /** Constructor for a Bad node.
3338 * Returns the unique Bad node of the graph. The same as
3341 ir_node *new_d_Bad (void);
3343 /** Constructor for a Confirm node.
3345 * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3346 * Specifies constraints for a value. To support dataflow analyses.
3348 * Example: If the value never exceeds '100' this is expressed by placing a
3349 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
3351 * @param *db A pointer for debug information.
3352 * @param *val The value we express a constraint for
3353 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3354 * @param cmp The compare operation.
3356 ir_node *new_d_Confirm (dbg_info *db, ir_node *val, ir_node *bound, pn_Cmp cmp);
3358 /** Constructor for an Unknown node.
3360 * Represents an arbitrary value. Places the node in
3363 * @param *m The mode of the unknown value.
3365 ir_node *new_d_Unknown(ir_mode *m);
3367 /** Constructor for a CallBegin node.
3369 * CallBegin represents control flow depending of the pointer value
3370 * representing the called method to the called methods. The
3371 * constructor copies the method pointer input from the passed Call
3372 * node.Adds the node to the block in current_ir_block.
3374 * @param *db A pointer for debug information.
3375 * @param *callee The call node visible in the intra procedural view.
3377 ir_node *new_d_CallBegin(dbg_info *db, ir_node *callee);
3379 /** Constructor for an EndReg node.
3381 *Adds the node to the block in current_ir_block.
3383 * @param *db A pointer for debug information.
3385 ir_node *new_d_EndReg (dbg_info *db);
3387 /** Constructor for an EndExcept node.
3389 * Used to represent regular procedure end in interprocedual view.
3390 * Adds the node to the block in current_ir_block.
3392 * @param *db A pointer for debug information.
3394 ir_node *new_d_EndExcept(dbg_info *db);
3396 /** Constructor for a Break node.
3398 * Used to represent exceptional procedure end in interprocedural view.
3399 * Adds the node to the block in current_ir_block.
3401 * Break represents control flow to a single control successor just as Jmp.
3402 * The blocks separated by a break may not be concatenated by an optimization.
3403 * It is used for the interprocedural representation where blocks are parted
3404 * behind Call nodes to represent the control flow to called procedures.
3406 * @param *db A pointer for debug information.
3408 ir_node *new_d_Break (dbg_info *db);
3410 /** Constructor for a Filter node.
3412 * Constructor for a Filter node. Adds the node to the block in
3413 * current_ir_block. Filter is a node with two views used to
3414 * construct the interprocedural view. In intraprocedural view its
3415 * semantics are identical to the Proj node. In interprocedural view
3416 * the Filter performs the Phi operation on method parameters or
3417 * results. Other than a Phi a Filter node may not be removed if it
3418 * has only a single input.
3420 * The constructor builds the Filter in intraprocedural view.
3422 * @param *db A pointer for debug information.
3423 * @param *arg The tuple value to project from.
3424 * @param *mode The mode of the projected value.
3425 * @param proj The position in the tuple to project from.
3427 ir_node *new_d_Filter (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3430 /** Constructor for a NoMem node.
3432 * Returns the unique NoMem node of the graph. The same as
3435 ir_node *new_d_NoMem (void);
3437 /** Constructor for a Mux node.
3439 * @param *db A pointer for debug information.
3440 * @param *sel The ir_node that calculates the boolean select.
3441 * @param *ir_true The ir_node that calculates the true result.
3442 * @param *ir_false The ir_node that calculates the false result.
3443 * @param *mode The mode of the node (and it_true and ir_false).
3445 ir_node *new_d_Mux (dbg_info *db, ir_node *sel,
3446 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
3448 /** Constructor for a Psi node.
3450 * @param *db A pointer for debug information.
3451 * @param *arity The arity of the conditions
3452 * @param *conds The array of mode_b conditions, length must be equal arity
3453 * @param *vals The array of mode values, length must be equal arity + 1
3454 * @param *mode The mode of the node (must be the mode of all vals).
3456 ir_node *new_d_Psi (dbg_info *db,
3457 int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
3459 /** Constructor for a CopyB node.
3461 * @param *db A pointer for debug information.
3462 * @param *store The current memory
3463 * @param *dst The ir_node that represents the destination address.
3464 * @param *src The ir_node that represents the source address.
3465 * @param *data_type The type of the copied data
3467 ir_node *new_d_CopyB(dbg_info *db, ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
3469 /** Constructor for a InstOf node.
3471 * A High-Level Type check.
3473 * @param *db A pointer for debug information.
3474 * @param *store The memory in which the object the entity should be selected
3475 * from is allocated.
3476 * @param *objptr A pointer to a object of a class type.
3477 * @param *type The type of which objptr must be.
3479 ir_node *new_d_InstOf (dbg_info *db, ir_node *store, ir_node *objptr, ir_type *type);
3481 /** Constructor for a Raise node.
3483 * A High-Level Exception throw.
3485 * @param *db A pointer for debug information.
3486 * @param *store The current memory.
3487 * @param *obj A pointer to the Except variable.
3489 ir_node *new_d_Raise (dbg_info *db, ir_node *store, ir_node *obj);
3491 /** Constructor for a Bound node.
3493 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
3495 * @param *db A pointer for debug information.
3496 * @param *store The current memory
3497 * @param *idx The ir_node that represents an index.
3498 * @param *lower The ir_node that represents the lower bound for the index.
3499 * @param *upper The ir_node that represents the upper bound for the index.
3501 ir_node *new_d_Bound(dbg_info *db, ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
3503 /** Constructor for a Pin node.
3505 * @param *db A pointer for debug information.
3506 * @param *node The node which value should be pinned.
3508 ir_node *new_d_Pin(dbg_info *db, ir_node *node);
3510 /*-----------------------------------------------------------------------*/
3511 /* The block oriented interface without debug support */
3512 /*-----------------------------------------------------------------------*/
3514 /* Needed from the interface with debug support:
3515 void set_cur_block (ir_node *target); */
3517 /** Constructor for a Block node.
3519 * Constructor for a Block node. Adds the block to the graph in
3520 * current_ir_graph. Constructs a Block with a fixed number of
3521 * predecessors. Does set current_block. Can be used with automatic
3522 * Phi node construction.
3524 * @param arity The number of control predecessors.
3525 * @param in An array of control predecessors. The length of
3526 * the array must be 'arity'.
3528 ir_node *new_Block(int arity, ir_node *in[]);
3530 /** Constructor for a Start node.
3532 * Adds the node to the block in current_ir_block.
3535 ir_node *new_Start (void);
3537 /** Constructor for an End node.
3539 * Adds the node to the block in current_ir_block.
3541 ir_node *new_End (void);
3543 /** Constructor for an EndReg node.
3545 * Used to represent regular procedure end in interprocedual view.
3546 * Adds the node to the block in current_ir_block.
3548 ir_node *new_EndReg (void);
3550 /** Constructor for an EndExpcept node.
3552 * Used to represent exceptional procedure end in interprocedural view.
3553 * Adds the node to the block in current_ir_block.
3555 ir_node *new_EndExcept(void);
3557 /** Constructor for a Jump node.
3559 * Adds the node to the block in current_ir_block.
3561 * Jmp represents control flow to a single control successor.
3563 ir_node *new_Jmp (void);
3565 /** Constructor for an IJmp node.
3567 * IJmp represents control flow to a single control successor not
3568 * statically known i.e. an indirect Jmp.
3570 * @param *tgt The ir node representing the target address.
3572 ir_node *new_IJmp (ir_node *tgt);
3574 /** Constructor for a Break node.
3575 * Break represents control flow to a single control successor just as Jmp.
3576 * The blocks separated by a break may not be concatenated by an optimization.
3577 * It is used for the interprocedural representation where blocks are parted
3578 * behind Call nodes to represent the control flow to called procedures.
3579 * Adds the node to the block in current_ir_block.
3581 ir_node *new_Break (void);
3583 /** Constructor for a Cond node.
3585 * If c is mode_b represents a conditional branch (if/else). If c is
3586 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
3587 * node, default Proj is 0.). Adds the node to the block in current_ir_block.
3589 * This is not consistent: Input to Cond is Is, Proj has as proj number
3593 * @param *c The conditions parameter.Can be of mode b or I_u.
3595 ir_node *new_Cond (ir_node *c);
3597 /** Constructor for a Return node.
3599 * Returns the memory an zero or more return values. Only node that
3600 * can end regular control flow. Adds the node to the block in current_ir_block.
3602 * @param *store The state of memory.
3603 * @param arity Number of array indices.
3604 * @param *in Array with index inputs to the node.
3606 ir_node *new_Return (ir_node *store, int arity, ir_node *in[]);
3608 /** Constructor for a Const node.
3610 * Constructor for a Const node. The constant represents a target
3611 * value. Sets the type information to type_unknown. (No more
3612 * supported: If tv is entity derives a somehow useful type.)
3613 * Adds the node to the block in current_ir_block.
3615 * @param *mode The mode of the operands and results.
3616 * @param *con Points to an entry in the constant table. This pointer is
3617 * added to the attributes of the node.
3619 ir_node *new_Const (ir_mode *mode, tarval *con);
3622 * Make a const from a long.
3623 * This is just convenience for the usual
3625 * new_Const(mode, tarval_from_long(mode, ...))
3628 * @param mode The mode for the const.
3629 * @param value The value of the constant.
3630 * @return A new const node.
3632 ir_node *new_Const_long(ir_mode *mode, long value);
3634 /** Constructor for a Const node.
3636 * Derives mode from passed type. */
3637 ir_node *new_Const_type(tarval *con, ir_type *tp);
3639 /** Constructor for a SymConst node.
3641 * Adds the node to the block in current_ir_block.
3642 * This is the constructor for a symbolic constant.
3643 * There are four kinds of symbolic constants:
3644 * -# type_tag The symbolic constant represents a type tag. The type the
3645 * tag stands for is given explicitly.
3646 * -# size The symbolic constant represents the size of a type. The
3647 * type of which the constant represents the size is given
3649 * -# align The symbolic constant represents the alignment of a type. The
3650 * type of which the constant represents the size is given
3652 * -# addr_name The symbolic constant represents the address of an entity
3653 * (variable or method). The variable is indicated by a name
3654 * that is valid for linking.
3655 * -# addr_ent The symbolic constant represents the address of an entity
3656 * (variable or method). The variable is given explicitly by
3659 * Inputs to the node:
3660 * No inputs except the block it belongs to.
3661 * Outputs of the node.
3662 * An unsigned integer (I_u) or a pointer (P).
3664 * @param value A type or a ident depending on the SymConst kind.
3665 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3666 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
3667 * @param tp The source type of the constant.
3669 ir_node *new_SymConst_type (union symconst_symbol value, symconst_kind kind, ir_type *tp);
3671 /** Constructor for a SymConst node.
3673 * Adds the node to the block in current_ir_block.
3674 * This is the constructor for a symbolic constant.
3675 * There are four kinds of symbolic constants:
3676 * -# type_tag The symbolic constant represents a type tag. The type the
3677 * tag stands for is given explicitly.
3678 * -# size The symbolic constant represents the size of a type. The
3679 * type of which the constant represents the size is given
3681 * -# align The symbolic constant represents the alignment of a type. The
3682 * type of which the constant represents the size is given
3684 * -# addr_name The symbolic constant represents the address of an entity
3685 * (variable or method). The variable is indicated by a name
3686 * that is valid for linking.
3687 * -# addr_ent The symbolic constant represents the address of an entity
3688 * (variable or method). The variable is given explicitly by
3691 * Inputs to the node:
3692 * No inputs except the block it belongs to.
3693 * Outputs of the node.
3694 * An unsigned integer (I_u) or a pointer (P).
3696 * @param value A type or a ident depending on the SymConst kind.
3697 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3698 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
3700 ir_node *new_SymConst (union symconst_symbol value, symconst_kind kind);
3702 /** Constructor for a simpelSel node.
3704 * This is a shortcut for the new_Sel() constructor. To be used for
3705 * Sel nodes that do not select from an array, i.e., have no index
3706 * inputs. It adds the two parameters 0, NULL.
3708 * @param *store The memory in which the object the entity should be selected from is allocated.
3709 * @param *objptr The object from that the Sel operation selects a single attribute out.
3710 * @param *ent The entity to select.
3712 ir_node *new_simpleSel(ir_node *store, ir_node *objptr, ir_entity *ent);
3714 /** Constructor for a Sel node.
3716 * The select node selects an entity (field or method) from an entity
3717 * with a compound type. It explicitly specifies the entity selected.
3718 * Dynamically the node may select entities that overwrite the given
3719 * entity. If the selected entity is an array element entity the Sel
3720 * node takes the required array indices as inputs.
3721 * Adds the node to the block in current_ir_block.
3723 * @param *store The memory in which the object the entity should be selected
3724 * from is allocated.
3725 * @param *objptr A pointer to a compound entity the Sel operation selects a
3726 * single attribute from.
3727 * @param arity The number of array indices needed to select an array element entity.
3728 * @param *in[] If the compound entity is an array the indices of the selected
3729 * element entity. The constructor copies this array.
3730 * @param *ent The entity to select.
3732 ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3735 /** Constructor for a Call node.
3737 * Adds the node to the block in current_ir_block.
3738 * Represents all kinds of method and function calls.
3740 * @param *store The actual store.
3741 * @param *callee A pointer to the called procedure.
3742 * @param arity The number of procedure parameters.
3743 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3744 * @param *tp Type information of the procedure called.
3746 ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node *in[],
3749 /** Constructor for a CallBegin node.
3751 * CallBegin represents control flow depending of the pointer value
3752 * representing the called method to the called methods. The
3753 * constructor copies the method pointer input from the passed Call
3754 * node. Adds the node to the block in current_ir_block.
3756 * @param *callee A pointer to the called procedure.
3758 ir_node *new_CallBegin(ir_node *callee);
3760 /** Constructor for a Add node.
3762 * Adds the node to the block in current_ir_block.
3764 * @param *op1 The first operand.
3765 * @param *op2 The second operand.
3766 * @param *mode The mode of the operands and the result.
3768 ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
3770 /** Constructor for a Sub node.
3772 * Adds the node to the block in current_ir_block.
3774 * @param *op1 The first operand.
3775 * @param *op2 The second operand.
3776 * @param *mode The mode of the operands and the result.
3778 ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
3780 /** Constructor for a Minus node.
3782 * Adds the node to the block in current_ir_block.
3784 * @param *op The operand .
3785 * @param *mode The mode of the operand and the result.
3787 ir_node *new_Minus (ir_node *op, ir_mode *mode);
3790 * Constructor for a Mul node. Adds the node to the block in current_ir_block.
3792 * @param *op1 The first operand.
3793 * @param *op2 The second operand.
3794 * @param *mode The mode of the operands and the result.
3796 ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
3798 /** Constructor for a Quot node.
3800 * Adds the node to the block in current_ir_block.
3802 * @param *memop The store needed to model exceptions
3803 * @param *op1 The first operand.
3804 * @param *op2 The second operand.
3806 ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2);
3808 /** Constructor for a DivMod node.
3810 * Adds the node to the block in current_ir_block.
3812 * @param *memop The store needed to model exceptions
3813 * @param *op1 The first operand.
3814 * @param *op2 The second operand.
3816 ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
3818 /** Constructor for a Div node.
3820 * Adds the node to the block in current_ir_block.
3822 * @param *memop The store needed to model exceptions
3823 * @param *op1 The first operand.
3824 * @param *op2 The second operand.
3826 ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2);
3828 /** Constructor for a Mod node.
3830 * Adds the node to the block in current_ir_block.
3832 * @param *memop The store needed to model exceptions
3833 * @param *op1 The first operand.
3834 * @param *op2 The second operand.
3836 ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2);
3838 /** Constructor for a Abs node.
3840 * Adds the node to the block in current_ir_block.
3842 * @param *op The operand
3843 * @param *mode The mode of the operands and the result.
3845 ir_node *new_Abs (ir_node *op, ir_mode *mode);
3847 /** Constructor for a And node.
3849 * Adds the node to the block in current_ir_block.
3851 * @param *op1 The first operand.
3852 * @param *op2 The second operand.
3853 * @param *mode The mode of the operands and the result.
3855 ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
3858 * Constructor for a Or node. Adds the node to the block in current_ir_block.
3860 * @param *op1 The first operand.
3861 * @param *op2 The second operand.
3862 * @param *mode The mode of the operands and the result.
3864 ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
3867 * Constructor for a Eor node. Adds the node to the block in current_ir_block.
3869 * @param *op1 The first operand.
3870 * @param *op2 The second operand.
3871 * @param *mode The mode of the operands and the results.
3873 ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
3875 /** Constructor for a Not node.
3877 * Adds the node to the block in current_ir_block.
3879 * @param *op The operand.
3880 * @param *mode The mode of the operand and the result.
3882 ir_node *new_Not (ir_node *op, ir_mode *mode);
3884 /** Constructor for a Shl node.
3886 * Adds the node to the block in current_ir_block.
3888 * @param *op The operand.
3889 * @param *k The number of bits to shift the operand .
3890 * @param *mode The mode of the operand and the result.
3892 ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
3895 * Constructor for a Shr node. Adds the node to the block in current_ir_block.
3897 * @param *op The operand.
3898 * @param *k The number of bits to shift the operand .
3899 * @param *mode The mode of the operand and the result.
3901 ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
3903 /** Constructor for a Shrs node.
3905 * Adds the node to the block in current_ir_block.
3907 * @param *op The operand.
3908 * @param *k The number of bits to shift the operand .
3909 * @param *mode The mode of the operand and the result.
3911 ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
3913 /** Constructor for a Rot node.
3915 * Adds the node to the block in current_ir_block.
3917 * @param *op The operand.
3918 * @param *k The number of bits to rotate the operand.
3919 * @param *mode The mode of the operand.
3921 ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode);
3923 /** Constructor for a Cmp node.
3925 * Adds the node to the block in current_ir_block.
3927 * @param *op1 The first operand.
3928 * @param *op2 The second operand.
3930 ir_node *new_Cmp (ir_node *op1, ir_node *op2);
3932 /** Constructor for a Conv node.
3934 * Adds the node to the block in current_ir_block.
3936 * @param *op The operand.
3937 * @param *mode The mode of this the operand muss be converted.
3939 ir_node *new_Conv (ir_node *op, ir_mode *mode);
3941 /** Constructor for a strict Conv node.
3943 * Adds the node to the block in current_ir_block.
3945 * @param *op The operand.
3946 * @param *mode The mode of this the operand muss be converted.
3948 ir_node *new_strictConv (ir_node *op, ir_mode *mode);
3950 /** Constructor for a Cast node.
3952 * Adds the node to the block in current_ir_block.
3953 * High level type cast
3955 * @param *op The operand.
3956 * @param *to_tp The type of this the operand muss be casted .
3958 ir_node *new_Cast (ir_node *op, ir_type *to_tp);
3960 /** Constructor for a Carry node.
3962 * Adds the node to the block in current_ir_block.
3964 * @param *op1 The first operand.
3965 * @param *op2 The second operand.
3966 * @param *mode The mode of the operands and the result.
3968 ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode);
3970 /** Constructor for a Borrow node.
3972 * Adds the node to the block in current_ir_block.
3974 * @param *op1 The first operand.
3975 * @param *op2 The second operand.
3976 * @param *mode The mode of the operands and the result.
3978 ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode);
3980 /** Constructor for a Phi node.
3982 * Adds the node to the block in current_ir_block.
3984 * @param arity The number of predecessors.
3985 * @param *in Array with predecessors.
3986 * @param *mode The mode of it's inputs and output.
3988 ir_node *new_Phi (int arity, ir_node *in[], ir_mode *mode);
3990 /** Constructor for a Load node.
3992 * @param *store The current memory.
3993 * @param *addr A pointer to the variable to be read in this memory.
3994 * @param *mode The mode of the value to be loaded.
3996 ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode);
3998 /** Constructor for a Store node.
4000 * @param *store The current memory.
4001 * @param *addr A pointer to the variable to be read in this memory.
4002 * @param *val The value to write to this variable.
4004 ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
4006 /** Constructor for a Alloc node.
4008 * The Alloc node extends the memory by space for an entity of type alloc_type.
4009 * Adds the node to the block in current_ir_block.
4011 * @param *store The memory which shall contain the new variable.
4012 * @param *size The number of bytes to allocate.
4013 * @param *alloc_type The type of the allocated variable.
4014 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
4016 ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
4019 /** Constructor for a Free node.
4021 * Frees the memory occupied by the entity pointed to by the pointer
4022 * arg. Type indicates the type of the entity the argument points to.
4023 * Adds the node to the block in current_ir_block.
4025 * @param *store The memory which shall contain the new variable.
4026 * @param *ptr The pointer to the object to free.
4027 * @param *size The number of objects of type free_type to free in a sequence.
4028 * @param *free_type The type of the freed variable.
4029 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
4031 ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
4032 ir_type *free_type, where_alloc where);
4034 /** Constructor for a Sync node.
4036 * Merges several memory values. The node assumes that a variable
4037 * either occurs only in one of the memories, or it contains the same
4038 * value in all memories where it occurs.
4039 * Adds the node to the block in current_ir_block.
4041 * @param arity The number of memories to synchronize.
4042 * @param **in An array of pointers to nodes that produce an output of type
4043 * memory. The constructor copies this array.
4045 ir_node *new_Sync (int arity, ir_node *in[]);
4047 /** Constructor for a Proj node.
4049 * Projects a single value out of a tuple. The parameter proj gives the
4050 * position of the value within the tuple.
4051 * Adds the node to the block in current_ir_block.
4053 * @param arg A node producing a tuple.
4054 * @param *mode The mode of the value to project.
4055 * @param proj The position of the value in the tuple.
4057 ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
4059 /** Constructor for a Filter node.
4061 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
4062 * Filter is a node with two views used to construct the interprocedural view.
4063 * In intraprocedural view its semantics are identical to the Proj node.
4064 * In interprocedural view the Filter performs the Phi operation on method
4065 * parameters or results. Other than a Phi a Filter node may not be removed
4066 * if it has only a single input.
4068 * The constructor builds the Filter in intraprocedural view.
4070 * @param *arg The tuple value to project from.
4071 * @param *mode The mode of the projected value.
4072 * @param proj The position in the tuple to project from.
4074 ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj);
4076 /** Constructor for a defaultProj node.
4078 * Represents the default control flow of a Switch-Cond node.
4079 * Adds the node to the block in current_ir_block.
4081 * @param arg A node producing a tuple.
4082 * @param max_proj The end position of the value in the tuple.
4084 ir_node *new_defaultProj (ir_node *arg, long max_proj);
4086 /** Constructor for a Tuple node.
4088 * This is an auxiliary node to replace a node that returns a tuple
4089 * without changing the corresponding Proj nodes.
4090 * Adds the node to the block in current_ir_block.
4092 * @param arity The number of tuple elements.
4093 * @param **in An array containing pointers to the nodes producing the tuple elements.
4095 ir_node *new_Tuple (int arity, ir_node *in[]);
4097 /** Constructor for an Id node.
4099 * This is an auxiliary node to replace a node that returns a single
4100 * value. Adds the node to the block in current_ir_block.
4102 * @param *val The operand to Id.
4103 * @param *mode The mode of *val.
4105 ir_node *new_Id (ir_node *val, ir_mode *mode);
4107 /** Constructor for a Bad node.
4109 * Returns the unique Bad node of the graph. The same as
4112 ir_node *new_Bad (void);
4114 /** Constructor for a Confirm node.
4116 * Specifies constraints for a value. To support dataflow analyses.
4117 * Adds the node to the block in current_ir_block.
4119 * Example: If the value never exceeds '100' this is expressed by placing a
4120 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
4122 * @param *val The value we express a constraint for
4123 * @param *bound The value to compare against. Must be a firm node, typically a constant.
4124 * @param cmp The compare operation.
4126 ir_node *new_Confirm (ir_node *val, ir_node *bound, pn_Cmp cmp);
4128 /** Constructor for an Unknown node.
4130 * Represents an arbitrary value. Places the node in
4133 * @param *m The mode of the unknown value.
4135 ir_node *new_Unknown(ir_mode *m);
4137 /** Constructor for a NoMem node.
4139 * Returns the unique NoMem node of the graph. The same as
4142 ir_node *new_NoMem (void);
4144 /** Constructor for a Mux node.
4146 * Adds the node to the block in current_ir_block.
4148 * @param *sel The ir_node that calculates the boolean select.
4149 * @param *ir_true The ir_node that calculates the true result.
4150 * @param *ir_false The ir_node that calculates the false result.
4151 * @param *mode The mode of the node (and it_true and ir_false).
4153 ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
4155 /** Constructor for a Psi node.
4157 * @param *arity The arity of the conditions
4158 * @param *conds The array of mode_b conditions, length must be equal arity
4159 * @param *vals The array of mode values, length must be equal arity + 1
4160 * @param *mode The mode of the node (must be the mode of all vals).
4162 ir_node *new_Psi (int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
4164 /** Constructor for a CopyB node.
4166 * Adds the node to the block in current_ir_block.
4168 * @param *store The current memory
4169 * @param *dst The ir_node that represents the destination address.
4170 * @param *src The ir_node that represents the source address.
4171 * @param *data_type The type of the copied data
4173 ir_node *new_CopyB(ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
4175 /** Constructor for a InstOf node.
4177 * A High-Level Type check.
4179 * @param *store The memory in which the object the entity should be selected
4180 * from is allocated.
4181 * @param *objptr A pointer to a object of a class type.
4182 * @param *type The type of which objptr must be.
4184 ir_node *new_InstOf (ir_node *store, ir_node *objptr, ir_type *type);
4186 /**Constructor for a Raise node.
4188 * A High-Level Exception throw.
4190 * @param *store The current memory.
4191 * @param *obj A pointer to the Except variable.
4193 ir_node *new_Raise (ir_node *store, ir_node *obj);
4195 /** Constructor for a Bound node.
4197 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
4199 * Adds the node to the block in current_ir_block.
4201 * @param *store The current memory
4202 * @param *idx The ir_node that represents an index.
4203 * @param *lower The ir_node that represents the lower bound for the index.
4204 * @param *upper The ir_node that represents the upper bound for the index.
4206 ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
4208 /** Constructor for a Pin node.
4210 * @param *node The node which value should be pinned.
4212 ir_node *new_Pin (ir_node *node);
4214 /*---------------------------------------------------------------------*/
4215 /* The comfortable interface. */
4216 /* Supports automatic Phi node construction. */
4217 /* All routines of the block oriented interface except new_Block are */
4219 /*---------------------------------------------------------------------*/
4221 /** Create an immature block.
4223 * An immature block has an unknown number of predecessors. Predecessors
4224 * can be added with add_immBlock_pred(). Once all predecessors are
4225 * added the block must be matured.
4227 * Adds the block to the graph in current_ir_graph. Does set
4228 * current_block. Can be used with automatic Phi node construction.
4229 * This constructor can only be used if the graph is in
4232 ir_node *new_d_immBlock(dbg_info *db);
4233 ir_node *new_immBlock(void);
4235 /** Add a control flow edge to an immature block. */
4236 void add_immBlock_pred(ir_node *immblock, ir_node *jmp);
4238 /** Finalize a Block node, when all control flows are known. */
4239 void mature_immBlock(ir_node *block);
4240 #define mature_cur_block() mature_immBlock(get_cur_block());
4243 /** Get the current value of a local variable.
4245 * Use this function to obtain the last definition of the local variable
4246 * associated with pos. Pos may not exceed the value passed as n_loc
4247 * to new_ir_graph. This call automatically inserts Phi nodes.
4249 * @param *db A pointer for debug information.
4250 * @param pos The position/id of the local variable.
4251 * @param *mode The mode of the value to get.
4253 ir_node *get_d_value(dbg_info *db, int pos, ir_mode *mode);
4254 ir_node *get_value(int pos, ir_mode *mode);
4256 /** Remark a new definition of a variable.
4258 * Use this function to remember a new definition of the value
4259 * associated with pos. Pos may not exceed the value passed as n_loc
4260 * to new_ir_graph. This call is needed to automatically inserts Phi
4263 * @param pos The position/id of the local variable.
4264 * @param *value The new value written to the local variable.
4266 void set_value(int pos, ir_node *value);
4268 /** Find the value number for a node in the current block.
4270 * This function searches all values in the current block for
4271 * a given value and returns its value number if it was found, else
4273 * Note that this does not mean that the value does not exists,
4274 * it's just not equal the node (for instance behind a Phi/Confirm ...)
4276 * @param *value The value to find.
4278 int find_value(ir_node *value);
4280 /** Get the current memory state.
4282 * Use this function to obtain the last definition of the memory
4283 * state. This call automatically inserts Phi nodes for the memory
4286 ir_node *get_store(void);
4288 /** Remark a new definition of the memory state.
4290 * Use this function to remember a new definition of the memory state.
4291 * This call is needed to automatically inserts Phi nodes.
4293 * @param *store The new memory state.
4295 void set_store(ir_node *store);
4297 /** keep this node alive even if End is not control-reachable from it
4299 * @param ka The node to keep alive.
4301 void keep_alive(ir_node *ka);
4303 /** Returns the frame type of the current graph */
4304 ir_type *get_cur_frame_type(void);
4307 /* --- initialize and finalize ir construction --- */
4309 /** Puts the graph into state "phase_high" */
4310 #define irg_finalize_cons(irg) set_irg_phase_state(irg, phase_high)
4312 /** Puts the program and all graphs into state phase_high.
4314 * This also remarks, the construction of types is finished,
4315 * e.g., that no more subtypes will be added. */
4316 void irp_finalize_cons(void);
4318 /* --- Initialization --- */
4321 * This function is called, whenever a local variable is used before definition
4323 * @param irg the IR graph on which this happens
4324 * @param mode the mode of the local var
4325 * @param pos position chosen be the frontend for this variable (n_loc)
4327 * @return a firm node of mode @p mode that initializes the var at position pos
4330 * Do not return NULL!
4331 * If this function is not set, FIRM will create a const node with tarval BAD.
4332 * Use set_irg_loc_description()/get_irg_loc_description() to assign additional
4333 * informations to local variables.
4335 typedef ir_node *uninitialized_local_variable_func_t(ir_graph *irg, ir_mode *mode, int pos);
4337 #endif /* _FIRM_IR_IRCONS_H_ */