3 * File name: ir/ir/ircons.h
4 * Purpose: Various irnode constructors. Automatic construction
5 * of SSA representation.
6 * Author: Martin Trapp, Christian Schaefer
7 * Modified by: Goetz Lindenmaier, Boris Boesler
10 * Copyright: (c) 1998-2003 Universität Karlsruhe
11 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
17 -# Handle construction of exceptions more comfortable:
18 Add new constructors that pass the exception region (or better the
19 Phi for the memories, the ex. region can be found from there) as parameter,
20 constructor then adds all Proj nodes and returns the pointer
21 to the Proj node that selects the result of the arithmetic operation.
22 -# Maybe hide the exception region in a global variable, especially if
23 it is always unambiguous.
29 * documentation no more supported since 2001
31 * ir node construction.
33 * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier
35 * This file documents all datatypes and constructors needed to
36 * build a FIRM representation of a procedure. The constructors are
37 * also implemented in this file.
39 * The documentation also gives a short manual how to use the library.
41 * For extensive documentation of FIRM see UKA Techreport 1999-14.
44 * Three kinds of nodes
45 * --------------------
47 * There are three kinds of nodes known to the ir: entities,
50 * + ir_nodes are the actual nodes of the FIRM intermediate representation.
51 * They represent operations on the data of the program and control flow
54 * + entity ==> implemented in entity.h
55 * Refers to a single entity of the compiled program, e.g. a field of a
56 * class or a method. If a method or variable can not be assigned to
57 * a method or class or the like, it is a global object.
59 * + types ==> implemented in type.h
60 * With types type information is represented. There are several type
63 * Implementation of the FIRM operations: ir_node
64 * ----------------------------------------------
66 * Ir_nodes represent operations on the data of the program and control flow
67 * operations. Examples of ir_nodes: Add, Jmp, Cmp
69 * FIRM is a dataflow graph. A dataflow graph is a directed graph,
70 * so that every node has incoming and outgoing edges. A node is
71 * executable if every input at it's incoming edges is available.
72 * Execution of the dataflow graph is started at the Start node which
73 * has no incoming edges and ends when the End node executes, even if
74 * there are still executable or not executed nodes. (Is this true,
75 * or must all executable nodes be executed?) (There are exceptions
76 * to the dataflow paradigma that all inputs have to be available
77 * before a node can execute: Phi, Block. See UKA Techreport
80 * The implementation of FIRM differs from the view as a dataflow
81 * graph. To allow fast traversion of the graph edges are
82 * implemented as C-pointers. Inputs to nodes are not ambiguous, the
83 * results can be used by several other nodes. Each input can be
84 * implemented as a single pointer to a predecessor node, outputs
85 * need to be lists of pointers to successors. Therefore a node
86 * contains pointers to it's predecessor so that the implementation is a
87 * dataflow graph with reversed edges. It has to be traversed bottom
90 * All nodes of the ir have the same basic structure. They are
91 * distinguished by a field containing the opcode.
93 * The fields of an ir_node:
95 * kind A firm_kind tag containing k_ir_node. This is useful for
96 * dynamically checking the type of a node.
98 * *op This ir_op gives the opcode as a tag and a string
99 * and the number of attributes of an ir_node. There is
100 * one statically allocated struct ir_op for each opcode.
102 * *mode The ir_mode of the operation represented by this firm
103 * node. The mode of the operation is the mode of it's
104 * result. A Firm mode is a datatype as known to the target,
105 * not a type of the source language.
107 * visit A flag for traversing the ir.
109 * **in An array with pointers to the node's predecessors.
111 * *link A pointer to an ir_node. With this pointer all Phi nodes
112 * are attached to a Block, i.e., a Block points to it's
113 * first Phi node, this node points to the second Phi node
114 * in the Block and so fourth. Used in mature_immBlock
115 * to find all Phi nodes to be matured. It's also used to
116 * annotate a node with a better, optimized version of it.
118 * attr An attr struct containing the attributes of the nodes. The
119 * attributes depend on the opcode of the node. The number
120 * of these attributes is given in op.
124 * Not yet documented. See irop.h.
128 * Not yet documented. See irmode.h.
130 * GLOBAL VARIABLES -- now also fields of ir_graph.
133 * current_ir_graph Points to the current ir_graph. All constructors for
134 * nodes add nodes to this graph.
136 * ir_visited An int used as flag to traverse the ir_graph.
138 * block_visited An int used as a flag to traverse block nodes in the
141 * Others not yet documented.
145 * CONSTRUCTOR FOR IR_GRAPH --> see irgraph.h
146 * ========================
149 * PROCEDURE TO CONSTRUCT AN IR GRAPH --> see also Firm tutorial
150 * ==================================
152 * This library supplies several interfaces to construct a FIRM graph for
154 * - A "comfortable" interface generating SSA automatically. Automatically
155 * computed predecessors of nodes need not be specified in the constructors.
156 * (new_<Node> constructurs and a set of additional routines.)
157 * - A less comfortable interface where all predecessors except the block
158 * an operation belongs to need to be specified. SSA must be constructed
159 * by hand. (new_<Node> constructors and set_cur_block()). This interface
160 * is called "block oriented". It automatically calles the local optimizations
162 * - An even less comfortable interface where the block needs to be specified
163 * explicitly. This is called the "raw" interface. (new_r_<Node>
164 * constructors). These nodes are not optimized.
166 * To use the functionality of the comfortable interface correctly the Front
167 * End needs to follow certain protocols. This is explained in the following.
168 * To build a correct IR with the other interfaces study the semantics of
169 * the firm node (See tech-reprot UKA 1999-14). For the construction of
170 * types and entities see the documentation in those modules.
172 * First the Frontend needs to decide which variables and values used in
173 * a procedure can be represented by dataflow edges. These are variables
174 * that need not be saved to memory as they cause no side effects visible
175 * out of the procedure. Often these are all compiler generated
176 * variables and simple local variables of the procedure as integers,
177 * reals and pointers. The frontend has to count and number these variables.
179 * First an ir_graph needs to be constructed with new_ir_graph. The
180 * constructor gets the number of local variables. The graph is hold in the
181 * global variable irg.
183 * Now the construction of the procedure can start. Several basic blocks can
184 * be constructed in parallel, but the code within each block needs to
185 * be constructed (almost) in program order.
187 * A global variable holds the current basic block. All (non block) nodes
188 * generated are added to this block. The current block can be set with
189 * set_cur_block(block). If several blocks are constructed in parallel block
190 * switches need to be performed constantly.
192 * To generate a Block node (with the comfortable interface) it's predecessor
193 * control flow nodes need not be known. In case of cyclic control flow these
194 * can not be known when the block is constructed. With add_immBlock_pred(block,
195 * cfnode) predecessors can be added to the block. If all predecessors are
196 * added to the block mature_immBlock(b) needs to be called. Calling mature_immBlock
197 * early improves the efficiency of the Phi node construction algorithm.
198 * But if several blocks are constructed at once, mature_immBlock must only
199 * be called after performing all set_values and set_stores in the block!
200 * (See documentation of new_immBlock constructor.)
202 * The constructors of arithmetic nodes require that their predecessors
203 * are mentioned. Sometimes these are available in the Frontend as the
204 * predecessors have just been generated by the frontend. If they are local
205 * values the predecessors can be obtained from the library with a call to
206 * get_value(local_val_nr). (local_val_nr needs to be administered by
207 * the Frontend.) A call to get_value triggers the generation of Phi nodes.
208 * If an arithmetic operation produces a local value this value needs to be
209 * passed to the library by set_value(node, local_val_nr).
210 * In straight line code these two operations just remember and return the
211 * pointer to nodes producing the value. If the value passes block boundaries
212 * Phi nodes can be inserted.
213 * Similar routines exist to manage the Memory operands: set_store and
216 * Several nodes produce more than one result. An example is the Div node.
217 * Such nodes return tuples of values. From these individual values can be
218 * extracted by proj nodes.
220 * The following example illustrates the construction of a simple basic block
221 * with two predecessors stored in variables cf_pred1 and cf_pred2, containing
224 * and finally jumping to an other block. The variable a got the local_val_nr
225 * 42 by the frontend.
227 * ir_node *this_block, *cf_pred1, *cf_pred2, *a_val, *mem, *div, *res, *cf_op;
229 * this_block = new_immBlock();
230 * add_immBlock_pred(this_block, cf_pred1);
231 * add_immBlock_pred(this_block, cf_pred2);
232 * mature_immBlock(this_block);
233 * a_val = get_value(42, mode_Iu);
235 * div = new_Div(mem, a_val, a_val);
236 * mem = new_Proj(div, mode_M, 0); * for the numbers for Proj see docu *
237 * res = new_Proj(div, mode_Iu, 2);
239 * set_value(res, 42);
242 * For further information look at the documentation of the nodes and
243 * constructors and at the paragraph COPING WITH DATA OBJECTS at the
244 * end of this documentation.
246 * The comfortable interface contains the following routines further explained
249 * ir_node *new_immBlock (void);
250 * ir_node *new_Start (void);
251 * ir_node *new_End (void);
252 * ir_node *new_Jmp (void);
253 * ir_node *new_IJmp (ir_node *tgt);
254 * ir_node *new_Cond (ir_node *c);
255 * ir_node *new_Return (ir_node *store, int arity, ir_node **in);
256 * ir_node *new_Const (ir_mode *mode, tarval *con);
257 * ir_node *new_SymConst (symconst_symbol value, symconst_kind kind);
258 * ir_node *new_simpleSel (ir_node *store, ir_node *objptr, entity *ent);
259 * ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity,
260 * ir_node **in, entity *ent);
261 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity,
262 * ir_node **in, type_method *type);
263 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
264 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
265 * ir_node *new_Minus (ir_node *op, ir_mode *mode);
266 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
267 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2);
268 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
269 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2);
270 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2);
271 * ir_node *new_Abs (ir_node *op, ir_mode *mode);
272 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
273 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
274 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
275 * ir_node *new_Not (ir_node *op, ir_mode *mode);
276 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
277 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
278 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
279 * ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode);
280 * ir_node *new_Cmp (ir_node *op1, ir_node *op2);
281 * ir_node *new_Conv (ir_node *op, ir_mode *mode);
282 * ir_node *new_Cast (ir_node *op, ir_type *to_tp);
283 * ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode);
284 * ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode);
285 * ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode);
286 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
287 * ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
288 * where_alloc where);
289 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
290 * ir_type *free_type, where_alloc where);
291 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
292 * ir_node *new_NoMem (void);
293 * ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
294 * ir_node *new_Psi (int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
295 * ir_node *new_CopyB (ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
296 * ir_node *new_InstOf (ir_node *store, ir_node obj, ir_type *ent);
297 * ir_node *new_Raise (ir_node *store, ir_node *obj);
298 * ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
300 * void add_immBlock_pred (ir_node *block, ir_node *jmp);
301 * void mature_immBlock (ir_node *block);
302 * void set_cur_block (ir_node *target);
303 * ir_node *get_value (int pos, ir_mode *mode);
304 * void set_value (int pos, ir_node *value);
305 * ir_node *get_store (void);
306 * void set_store (ir_node *store);
307 * keep_alive (ir_node ka)
309 * IR_NODES AND CONSTRUCTORS FOR IR_NODES
310 * =======================================
312 * All ir_nodes are defined by a common data structure. They are distinguished
313 * by their opcode and differ in the number of their attributes.
315 * The constructor for the block node sets current_block to itself.
316 * Const nodes are always added to the start block.
317 * All other constructors add the created node to the current_block.
318 * swich_block(block) allows to set the current block to block.
320 * Watch for my inconsistent use of input and predecessor (dataflow view)
321 * and `the node points to' (implementation view).
323 * The following description of the nodes lists four properties them if these
325 * - the parameters to the constructor
326 * - the inputs of the Firm node
327 * - the outputs of the Firm node
328 * - attributes to the node
332 * ir_node *new_immBlock (void)
333 * ----------------------------
335 * Creates a new block. Sets current_block to itself. When a new block is
336 * created it cannot be known how many predecessors this block will have in the
337 * control flow graph. Therefore the list of inputs can not be fixed at
338 * creation. Predecessors can be added with add_immBlock_pred (block, control flow
339 * operation). With every added predecessor the number of inputs to Phi nodes
342 * The block can be completed by mature_immBlock(block) if all predecessors are
343 * known. If several blocks are built at once, mature_immBlock can only be called
344 * after set_value has been called for all values that are life at the end
345 * of the block. This is necessary so that Phi nodes created mature_immBlock
346 * get the right predecessors in case of cyclic dependencies. If all set_values
347 * of this block are called after maturing it and before calling get_value
348 * in some block that is control flow dependent on this block, the construction
351 * Example for faulty ir construction: (draw the graph on a paper and you'll
354 * block_before_loop = new_block();
356 * mature_immBlock(block_before_loop);
357 * before2header = new_Jmp;
359 * loop_header = new_block ();
360 * header2body - new_Jmp();
362 * loop_body = new_block ();
363 * body2header = new_Jmp();
365 * add_immBlock_pred(loop_header, before2header);
366 * add_immBlock_pred(loop_header, body2header);
367 * add_immBlock_pred(loop_body, header2body);
369 * mature_immBlock(loop_header);
370 * mature_immBlock(loop_body);
372 * get_value(loop_body, x); // gets the Phi in loop_header
373 * set_value(loop_header, x); // sets the value the above get_value should
374 * // have returned!!!
376 * Mature_immBlock also fixes the number of inputs to the Phi nodes. Mature_immBlock
377 * should be called as early as possible, as afterwards the generation of Phi
378 * nodes is more efficient.
381 * There is an input for each control flow predecessor of the block.
382 * The input points to an instruction producing an output of type X.
383 * Possible predecessors: Start, Jmp, Cond, Raise or Return or any node
384 * possibly causing an exception. (Often the real predecessors are Projs.)
386 * Mode BB (R), all nodes belonging to this block should consume this output.
387 * As they are strict (except Block and Phi node) it is a necessary condition
388 * that the block node executed before any other node in this block executes.
390 * block.matured Indicates whether the block is mature.
392 * This attribute contains all local values valid in this
393 * block. This is needed to build the Phi nodes and removed
394 * if the graph is complete. This field is used by the
395 * internal construction algorithm and should not be accessed
399 * ir_node *new_Block (int arity, ir_node **in)
400 * --------------------------------------------
402 * Creates a new Block with the given list of predecessors. This block
403 * is mature. As other constructors calls optimization and vrfy for the
404 * block. If one of the predecessors is Unknown (as it has to be filled in
405 * later) optimizations are skipped. This is necessary to
406 * construct Blocks in loops. Leaving Unknown in the Block after finishing
407 * the construction may have strange effects, especially for interprocedural
408 * representation and analysis.
411 * CONTROL FLOW OPERATIONS
412 * -----------------------
414 * In each block there must be exactly one of the control flow
415 * operations Start, End, Jmp, Cond, Return or Raise. The output of a
416 * control flow operation points to the block to be executed next.
418 * ir_node *new_Start (void)
419 * -------------------------
421 * Creates a start node. Not actually needed public. There is only one such
422 * node in each procedure which is automatically created by new_ir_graph.
425 * No inputs except the block it belogns to.
427 * A tuple of 4 (5, 6) distinct values. These are labeled by the following
428 * projection numbers (pn_Start):
429 * * pn_Start_X_initial_exec mode X, points to the first block to be exe * cuted.
430 * * pn_Start_M mode M, the global store
431 * * pn_Start_P_frame_base mode P, a pointer to the base of the proce * dures stack frame.
432 * * pn_Start_P_globals mode P, a pointer to the part of the memory * containing_all_ global things.
433 * * pn_Start_T_args mode T, a tuple containing all arguments of * the procedure.
436 * ir_node *new_End (void)
437 * -----------------------
439 * Creates an end node. Not actually needed public. There is only one such
440 * node in each procedure which is automatically created by new_ir_graph.
443 * No inputs except the block it belongs to.
447 * ir_node *new_Jmp (void)
448 * -----------------------
450 * Creates a Jmp node.
453 * The block the node belongs to
455 * Control flow to the next block.
457 * ir_node *new_IJmp (ir_node *tgt)
458 * -----------------------
460 * Creates an IJmp node.
463 * The node that represents the target jump address
465 * Control flow to an unknown target, must be pinned by
468 * ir_node *new_Cond (ir_node *c)
469 * ------------------------------
471 * Creates a Cond node. There are two versions of this node.
477 * A tuple of two control flows. The first is taken if the input is
478 * false, the second if it is true.
482 * A value of mode I_u. (i)
484 * A tuple of n control flows. If the Cond's input is i, control
485 * flow will procede along output i. If the input is >= n control
486 * flow proceeds along output n.
488 * ir_node *new_Return (ir_node *store, int arity, ir_node **in)
489 * -------------------------------------------------------------
491 * The return node has as inputs the results of the procedure. It
492 * passes the control flow to the end_block.
498 * Control flow to the end block.
502 * ir_node *new_Const (ir_mode *mode, tarval *con)
503 * -----------------------------------------------
505 * Creates a constant in the constant table and adds a Const node
506 * returning this value to the start block.
509 * *mode The mode of the constant.
510 * *con Points to an entry in the constant table.
511 * This pointer is added to the attributes of
512 * the node (self->attr.con)
514 * No inputs except the block it belogns to.
516 * The constant value.
518 * attr.con A tarval* pointer to the proper entry in the constant
521 * ir_node *new_SymConst (union symconst_symbol value, symconst_addr_ent kind)
522 * ---------------------------------------------------------------------------
524 * There are three kinds of symbolic constants:
525 * symconst_type_tag The symbolic constant represents a type tag.
526 * symconst_size The symbolic constant represents the size of a class.
527 * symconst_addr_name Information for the linker, e.g. the name of a global
529 * To represent a pointer to an entity that is represented by an entity
530 * datastructure don't use
531 * new_SymConst((type_or_id*)get_entity_ld_ident(ent), symconst_addr_name);.
532 * Use a real const instead:
533 * new_SymConst(mode_P_mach, tarval_p_from_entity(ent));
534 * This makes the Constant independent of name changes of the entity due to
538 * kind The kind of the symbolic constant: type_tag, size or link_info.
539 * *type_or_id Points to the type the tag stands for or to the type
540 * whose size is represented by the constant or to an ident
541 * representing the linkage info.
544 * No inputs except the block it belogns to.
546 * An unsigned integer (I_u) or a pointer (P).
549 * attr.i.num The symconst_addr_ent, i.e. one of
552 * - symconst_addr_name
553 * If the attr.i.num is symconst_type_tag or symconst_size, the node contains an attribute
554 * attr.i.*type, a pointer to a type_class. The mode of the node is mode_Is.
555 * if it is linkage_ptr_info it contains
556 * attr.i.*ptrinfo, an ident holding information for the linker. The mode
557 * of the node is mode_P_mach.
561 * ir_node *new_simpleSel (ir_node *store, ir_node *frame, entity *sel)
562 * --------------------------------------------------------------------
565 * Selects an entity from a compound type. This entity can be a field or
569 * *store The memory in which the object the entity should be selected
571 * *frame The pointer to the object.
572 * *sel The entity to select.
575 * The memory containing the object.
576 * A pointer to the object.
577 * An unsigned integer.
579 * A pointer to the selected entity.
581 * attr.sel Pointer to the entity
584 * ir_node *new_Sel (ir_node *store, ir_node *frame, int arity, ir_node **in,
585 * --------------------------------------------------------------------------
589 * Selects a field from an array type. The entity has as owner the array, as
590 * type the arrays element type. The indices to access an array element are
594 * *store The memory in which the object the entity should be selected from
596 * *frame The pointer to the object.
597 * *arity number of array indices.
598 * *in array with index inputs to the node.
599 * *sel The entity to select.
602 * The memory containing the object.
603 * A pointer to the object.
604 * As much unsigned integer as there are array expressions.
606 * A pointer to the selected entity.
608 * attr.sel Pointer to the entity
610 * The constructors new_Sel and new_simpleSel generate the same ir nodes.
611 * simpleSel just sets the arity of the index inputs to zero.
614 * ARITHMETIC OPERATIONS
615 * ---------------------
617 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node **in,
618 * ----------------------------------------------------------------------------
622 * Creates a procedure call.
625 * *store The actual store.
626 * *callee A pointer to the called procedure.
627 * arity The number of procedure parameters.
628 * **in An array with the pointers to the parameters.
629 * The constructor copies this array.
630 * *type Type information of the procedure called.
633 * The store, the callee and the parameters.
635 * A tuple containing the eventually changed store and the procedure
638 * attr.call Contains the type information for the procedure.
641 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode)
642 * ------------------------------------------------------------
646 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode)
647 * ------------------------------------------------------------
651 * ir_node *new_Minus (ir_node *op, ir_mode *mode)
652 * -----------------------------------------------
654 * Unary Minus operations on integer and floating point values.
656 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode)
657 * ------------------------------------------------------------
661 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2)
662 * --------------------------------------------------------------
664 * Quot performs exact division of floating point numbers. It's mode
665 * is Tuple, the mode of the result must be annotated to the Proj
666 * that extracts the result of the arithmetic operations.
669 * The store needed to model exceptions and the two operands.
671 * A tuple contaning a memory and a execution for modeling exceptions
672 * and the result of the arithmetic operation.
674 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2)
675 * ----------------------------------------------------------------
677 * Performs Div and Mod on interger values.
680 * A tuple contaning a memory and a execution for modeling exceptions
681 * and the two result of the arithmetic operations.
683 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2)
684 * -------------------------------------------------------------
688 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2)
689 * -------------------------------------------------------------
693 * ir_node *new_Abs (ir_node *op, ir_mode *mode)
694 * ---------------------------------------------
698 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode)
699 * ------------------------------------------------------------
703 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode)
704 * -----------------------------------------------------------
708 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode)
709 * ------------------------------------------------------------
713 * ir_node *new_Not (ir_node *op, ir_mode *mode)
714 * ---------------------------------------------
716 * This node constructs a constant where all bits are set to one
717 * and a Eor of this constant and the operator. This simulates a
720 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode)
721 * ---------------------------------------------------------
725 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode)
726 * ---------------------------------------------------------
728 * Logic shift right, i.e., zero extended.
731 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode)
732 * ----------------------------------------------------------
734 * Arithmetic shift right, i.e., sign extended.
736 * ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode)
737 * ---------------------------------------------------------
739 * Rotates the operand to the (right??) by k bits.
741 * ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode)
742 * ------------------------------------------------------------
744 * Calculates the Carry value for integer addition. Used only
747 * ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode)
748 * ------------------------------------------------------------
750 * Calculates the Borrow value for integer substraction. Used only
753 * ir_node *new_Conv (ir_node *op, ir_mode *mode)
754 * ---------------------------------------------
756 * Mode conversion. For allowed conversions see UKA Tech Report
759 * ir_node *new_Cmp (ir_node *op1, ir_node *op2)
760 * ---------------------------------------------
763 * The two values to be compared.
765 * A 16-tuple containing the results of the 16 different comparisons.
766 * The following is a list giving the comparisons and a projection
767 * number (pn_Cmp) to use in Proj nodes to extract the proper result.
771 * pn_Cmp_Le less or equal
773 * pn_Cmp_Ge greater of equal
774 * pn_Cmp_Lg less or greater
775 * pn_Cmp_Leg less, equal or greater = ordered
776 * pn_Cmp_Uo unordered
777 * pn_Cmp_Ue unordered or equal
778 * pn_Cmp_Ul unordered or less
779 * pn_Cmp_Ule unordered, less or equal
780 * pn_Cmp_Ug unordered or greater
781 * pn_Cmp_Uge unordered, greater or equal
782 * pn_Cmp_Ne unordered, less or greater = not equal
789 * In general, Phi nodes are automaitcally inserted. In some cases, if
790 * all predecessors of a block are known, an explicit Phi node constructor
791 * is needed. E.g., to construct a FIRM graph for a statement as
792 * a = (b==c) ? 2 : 5;
794 * ir_node *new_Phi (int arity, ir_node **in, ir_mode *mode)
795 * ---------------------------------------------------------
797 * Creates a Phi node. The in's order has to correspond to the order
798 * of in's of current_block. This is not checked by the library!
799 * If one of the predecessors is Unknown (as it has to be filled in
800 * later) optimizations are skipped. This is necessary to
801 * construct Phi nodes in loops. Leaving Unknown in the Phi after finishing
802 * the construction may have strange effects, especially for interprocedural
803 * representation and analysis.
806 * arity number of predecessors
807 * **in array with predecessors
808 * *mode The mode of it's inputs and output.
810 * A Phi node has as many inputs as the block it belongs to.
811 * Each input points to a definition of the same value on a
812 * different path in the control flow.
814 * The definition valid in this block.
816 * ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode)
817 * -----------------------------------------------------------------------------
819 * Creates a Mux node. This node implements the following semantic:
820 * If the sel node (which must be of mode_b) evaluates to true, its value is
821 * ir_true, else ir_false;
824 * ir_node *new_Psi (int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode)
825 * -----------------------------------------------------------------------------
827 * Creates a Psi node. This node implements the following semantic:
831 * OPERATIONS TO MANAGE MEMORY EXPLICITLY
832 * --------------------------------------
834 * ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode)
835 * ----------------------------------------------------------------
837 * The Load operation reads a value from memory.
840 * *store The current memory.
841 * *addr A pointer to the variable to be read in this memory.
842 * *mode The mode of the value to be loaded.
845 * The memory and a pointer to a variable in this memory.
847 * A tuple of the memory, a control flow to be taken in case of
848 * an exception and the loaded value.
850 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val)
851 * ----------------------------------------------------------------
853 * The Store operation writes a value to a variable in memory.
856 * The memory, a pointer to a variable in this memory and the value
857 * to write to this variable.
859 * A tuple of the changed memory and a control flow to be taken in
860 * case of an exception.
862 * ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
863 * -----------------------------------------------------------------------
867 * The Alloc node allocates a new variable. It can be specified whether the
868 * variable should be allocated to the stack or to the heap.
871 * *store The memory which shall contain the new variable.
872 * ** *size The number of bytes to allocate. Old. **
873 * *size We decided that the size easily can be derived from the type.
874 * This field is for allocating arrays, i.e., it gives the multiple
875 * of the size of alloc_type to allocate memory for.
876 * *alloc_type The type of the allocated variable.
877 * where Where to allocate the variable, either heap_alloc or stack_alloc.
880 * A memory and an unsigned integer.
882 * A tuple of the changed memory, a control flow to be taken in
883 * case of an exception and the pointer to the new variable.
885 * a.where Indicates where the variable is allocated.
886 * a.*type A pointer to the class the allocated data object
889 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size, ir_type *free_type,
890 * -----------------------------------------------------------------------------------
894 * The Free node frees memory of the given variable.
897 * *store The memory which shall contain the new variable.
898 * *ptr The pointer to the object to free.
899 * *size The number of objects of type free_type to free in a sequence.
900 * *free_type The type of the freed variable.
901 * where Where the variable was allocated, either heap_alloc or stack_alloc.
904 * A memory, a pointer and an unsigned integer.
906 * The changed memory.
908 * f.*type A pointer to the type information of the freed data object.
912 * ir_node *new_Sync (int arity, ir_node **in)
913 * -------------------------------------------
915 * The Sync operation unifies several partial memory blocks. These blocks
916 * have to be pairwise disjunct or the values in common locations have to
917 * be identical. This operation allows to specify all operations that eventually
918 * need several partial memory blocks as input with a single entrance by
919 * unifying the memories with a preceding Sync operation.
922 * arity The number of memories to synchronize.
923 * **in An array of pointers to nodes that produce an output of
928 * The unified memory.
934 * ir_node *new_Bad (void)
935 * -----------------------
937 * Returns the unique Bad node current_ir_graph->bad.
938 * This node is used to express results of dead code elimination.
940 * ir_node *new_NoMem (void)
941 * -----------------------------------------------------------------------------------
943 * Returns the unique NoMem node current_ir_graph->no_mem.
944 * This node is used as input for operations that need a Memory, but do not
945 * change it like Div by const != 0, analyzed calls etc.
947 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj)
948 * ----------------------------------------------------------
950 * Selects one entry of a tuple. This is a hidden edge with attributes.
953 * *arg A node producing a tuple.
954 * *mode The mode of the value to project.
955 * proj The position of the value in the tuple.
961 * ir_node *new_Tuple (int arity, ir_node **in)
962 * --------------------------------------------
964 * Builds a Tuple from single values. This is needed to implement
965 * optimizations that remove a node that produced a tuple. The node can be
966 * replaced by the Tuple operation so that the following Proj nodes have not to
967 * be changed. (They are hard to find due to the implementation with pointers
968 * in only one direction.) The Tuple node is smaller than any other
969 * node, so that a node can be changed into a Tuple by just changing it's
970 * opcode and giving it a new in array.
973 * arity The number of tuple elements.
974 * **in An array containing pointers to the nodes producing the
977 * ir_node *new_Id (ir_node *val, ir_mode *mode)
978 * ---------------------------------------------
980 * The single output of the Id operation is it's input. Also needed
984 * HIGH LEVEL OPERATIONS
985 * ---------------------
987 * ir_node *new_CopyB (ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type)
988 * -----------------------------------------------------------------------------------
990 * Describes a high level block copy of a compound type from address src to
991 * address dst. Must be lowered to a Call to a runtime memory copy function.
994 * HIGH LEVEL OPERATIONS: Exception Support
995 * ----------------------------------------
996 * See TechReport 1999-14, chapter Exceptions.
998 * ir_node *new_InstOf(ir_node *store, ir_node *ptr, ir_type *type);
999 * -----------------------------------------------------------------------------------
1001 * Describes a high level type check. Must be lowered to a Call to a runtime check
1004 * ir_node *new_Raise (ir_node *store, ir_node *obj)
1005 * -------------------------------------------------
1007 * Raises an exception. Unconditional change of control flow. Writes
1008 * an explicit Except variable to memory to pass it to the exception
1009 * handler. Must be lowered to a Call to a runtime check
1014 * A pointer to the Except variable.
1016 * A tuple of control flow and the changed memory state. The control flow
1017 * points to the exception handler if it is definied in this procedure,
1018 * else it points to the end_block.
1020 * ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
1021 * -----------------------------------------------------------------------------------
1023 * Describes a high level bounds check. Must be lowered to a Call to a runtime check
1027 * COPING WITH DATA OBJECTS
1028 * ========================
1030 * Two kinds of data objects have to be distinguished for generating
1031 * FIRM. First there are local variables other than arrays that are
1032 * known to be alias free. Second there are all other data objects.
1033 * For the first a common SSA representation is built, the second
1034 * are modeled by saving them to memory. The memory is treated as
1035 * a single local variable, the alias problem is hidden in the
1036 * content of this variable.
1038 * All values known in a Block are listed in the block's attribute,
1039 * block.**graph_arr which is used to automatically insert Phi nodes.
1040 * The following two funcions can be used to add a newly computed value
1041 * to the array, or to get the producer of a value, i.e., the current
1044 * inline void set_value (int pos, ir_node *value)
1045 * -----------------------------------------------
1047 * Has to be called for every assignment to a local variable. It
1048 * adds the value to the array of used values at position pos. Pos
1049 * has to be a unique identifier for an entry in the procedure's
1050 * definition table. It can be used to access the value again.
1051 * Requires current_block to be set correctly.
1053 * ir_node *get_value (int pos, ir_mode *mode)
1054 * -------------------------------------------
1056 * Returns the node defining the value referred to by pos. If the
1057 * value is not defined in this block a Phi node is generated and
1058 * all definitions reaching this Phi node are collected. It can
1059 * happen that the algorithm allocates an unnecessary Phi node,
1060 * e.g. if there is only one definition of this value, but this
1061 * definition reaches the currend block on several different
1062 * paths. This Phi node will be eliminated if optimizations are
1063 * turned on right after it's creation.
1064 * Requires current_block to be set correctly.
1066 * There are two special routines for the global store:
1068 * void set_store (ir_node *store)
1069 * -------------------------------
1071 * Adds the store to the array of known values at a reserved
1073 * Requires current_block to be set correctly.
1075 * ir_node *get_store (void)
1076 * -------------------------
1078 * Returns the node defining the actual store.
1079 * Requires current_block to be set correctly.
1082 * inline void keep_alive (ir_node *ka)
1083 * ------------------------------------
1085 * Keep this node alive because it is (might be) not in the control
1086 * flow from Start to End. Adds the node to the list in the end
1093 #include "firm_common.h"
1095 #include "dbginfo.h"
1097 /*-------------------------------------------------------------------------*/
1098 /* The raw interface */
1099 /*-------------------------------------------------------------------------*/
1101 /** Constructor for a Block node.
1103 * Constructs a mature block with the given predecessors. Use Unknown
1104 * nodes as predecessors to construct a block if the number of
1105 * predecessors is known, but not the predecessors themselves. This
1106 * constructor does not set current_block. It not be used with
1107 * automatic Phi node construction.
1109 * @param *db A Pointer for debug information.
1110 * @param irg The ir graph the block belongs to.
1111 * @param arity The number of control predecessors.
1112 * @param in[] An array of control predecessors. The length of
1113 * the array must be 'arity'. The constructor copies this array.
1115 ir_node *new_rd_Block (dbg_info *db, ir_graph *irg, int arity, ir_node *in[]);
1117 /** Constructor for a Start node.
1119 * @param *db A pointer for debug information.
1120 * @param *irg The ir graph the node belongs to.
1121 * @param *block The ir block the node belongs to.
1123 ir_node *new_rd_Start (dbg_info *db, ir_graph *irg, ir_node *block);
1125 /** Constructor for a End node.
1127 * @param *db A pointer for debug information.
1128 * @param *irg The ir graph the node belongs to.
1129 * @param *block The ir block the node belongs to.
1131 ir_node *new_rd_End (dbg_info *db, ir_graph *irg, ir_node *block);
1133 /** Constructor for a Jmp node.
1135 * Jmp represents control flow to a single control successor.
1137 * @param *db A pointer for debug information.
1138 * @param *irg The ir graph the node belongs to.
1139 * @param *block The ir block the node belongs to.
1141 ir_node *new_rd_Jmp (dbg_info *db, ir_graph *irg, ir_node *block);
1143 /** Constructor for an IJmp node.
1145 * IJmp represents control flow to a single control successor not
1146 * statically known i.e. an indirect Jmp.
1148 * @param *db A pointer for debug information.
1149 * @param *irg The ir graph the node belongs to.
1150 * @param *block The ir block the node belongs to.
1151 * @param *tgt The ir node representing the target address.
1153 ir_node *new_rd_IJmp (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *tgt);
1155 /** Constructor for a Break node.
1157 * Break represents control flow to a single control successor just as Jmp.
1158 * The blocks separated by a break may not be concatenated by an optimization.
1159 * It is used for the interprocedural representation where blocks are parted
1160 * behind Call nodes to represent the control flow to called procedures.
1162 * @param *db A pointer for debug information.
1163 * @param *irg The ir graph the node belong to.
1164 * @param *block The block the node belong to.
1166 ir_node *new_rd_Break (dbg_info *db, ir_graph *irg, ir_node *block);
1168 /** Constructor for a Cond node.
1170 * If c is mode_b represents a conditional branch (if/else). If c is
1171 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
1172 * node, default Proj is 0.)
1174 * This is not consistent: Input to Cond is Is, Proj has as proj number
1177 * @param *db A pointer for debug information.
1178 * @param *irg The ir graph the node belongs to.
1179 * @param *block The ir block the node belongs to.
1180 * @param *c The conditions parameter. Can be of mode b or I_u.
1182 ir_node *new_rd_Cond (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *c);
1184 /** Constructor for a Return node.
1186 * Returns the memory an zero or more return values. Only node that
1187 * can end regular control flow.
1189 * @param *db A pointer for debug information.
1190 * @param *irg The ir graph the node belongs to.
1191 * @param *block The ir block the node belongs to.
1192 * @param *store The state of memory.
1193 * @param arity Number of return values.
1194 * @param *in Array of length arity with return values. The constructor copies this array.
1196 ir_node *new_rd_Return (dbg_info *db, ir_graph *irg, ir_node *block,
1197 ir_node *store, int arity, ir_node *in[]);
1199 /** Constructor for a Const_type node.
1201 * The constant represents a target value. This constructor sets high
1202 * level type information for the constant value.
1204 * @param *db A pointer for debug information.
1205 * @param *irg The ir graph the node belongs to.
1206 * @param *block The ir block the node belongs to.
1207 * @param *mode The mode of the operands and results.
1208 * @param *con Points to an entry in the constant table.
1209 * @param *tp The type of the constant.
1211 ir_node *new_rd_Const_type (dbg_info *db, ir_graph *irg, ir_node *block,
1212 ir_mode *mode, tarval *con, ir_type *tp);
1214 /** Constructor for a Const node.
1216 * Constructor for a Const node. The constant represents a target
1217 * value. Sets the type information to type_unknown. (No more
1218 * supported: If tv is entity derives a somehow useful type.)
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.
1226 ir_node *new_rd_Const (dbg_info *db, ir_graph *irg, ir_node *block,
1227 ir_mode *mode, tarval *con);
1229 /** Constructor for a SymConst_type node.
1231 * This is the constructor for a symbolic constant.
1232 * There are four kinds of symbolic constants:
1233 * - type_tag The symbolic constant represents a type tag. The type the
1234 * tag stands for is given explicitly.
1235 * - size The symbolic constant represents the size of a type. The
1236 * type of which the constant represents the size is given
1238 * - addr_name The symbolic constant represents the address of an entity
1239 * (variable or method). The variable is indicated by a name
1240 * that is valid for linking.
1241 * - addr_ent The symbolic constant represents the address of an entity
1242 * (variable or method). The variable is given explicitly by
1245 * Inputs to the node:
1246 * No inputs except the block it belongs to.
1247 * Outputs of the node.
1248 * An unsigned integer (I_u) or a pointer (P).
1250 * Mention union in declaration so that the firmjni generator recognizes that
1251 * it can not cast the argument to an int.
1253 * @param *db A pointer for debug information.
1254 * @param *irg The ir graph the node belongs to.
1255 * @param *block The ir block the node belongs to.
1256 * @param symkind The kind of the symbolic constant: type_tag, size, addr_name or addr_ent.
1257 * @param value A type, entity or a ident depending on the SymConst kind.
1258 * @param tp The source type of the constant.
1260 ir_node *new_rd_SymConst_type (dbg_info *db, ir_graph *irg, ir_node *block, union symconst_symbol value,
1261 symconst_kind symkind, ir_type *tp);
1263 /** Constructor for a SymConst node.
1265 * Same as new_rd_SymConst_type, except that it sets the type to type_unknown. */
1266 ir_node *new_rd_SymConst (dbg_info *db, ir_graph *irg, ir_node *block,
1267 union symconst_symbol value, symconst_kind symkind);
1269 /** Constructor for a SymConst addr_ent node.
1271 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1272 * symconst_addr_ent.
1273 * Adds the SymConst to the start block of irg. */
1274 ir_node *new_rd_SymConst_addr_ent (dbg_info *db, ir_graph *irg, entity *symbol, ir_type *tp);
1276 /** Constructor for a SymConst addr_name node.
1278 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1279 * symconst_addr_ent.
1280 * Adds the SymConst to the start block of irg. */
1281 ir_node *new_rd_SymConst_addr_name (dbg_info *db, ir_graph *irg, ident *symbol, ir_type *tp);
1283 /** Constructor for a SymConst type_tag node.
1285 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1286 * symconst_addr_ent.
1287 * Adds the SymConst to the start block of irg. */
1288 ir_node *new_rd_SymConst_type_tag (dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp);
1290 /** Constructor for a SymConst size node.
1292 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1293 * symconst_addr_ent.
1294 * Adds the SymConst to the start block of irg. */
1295 ir_node *new_rd_SymConst_size (dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp);
1297 /** Constructor for a simpleSel node.
1299 * This is a shortcut for the new_rd_Sel() constructor. To be used for
1300 * Sel nodes that do not select from an array, i.e., have no index
1301 * inputs. It adds the two parameters 0, NULL.
1303 * @param *db A pointer for debug information.
1304 * @param *irg The ir graph the node belongs to.
1305 * @param *block The ir block the node belongs to.
1306 * @param *store The memory in which the object the entity should be
1307 * selected from is allocated.
1308 * @param *objptr The object from that the Sel operation selects a
1309 * single attribute out.
1310 * @param *ent The entity to select.
1312 ir_node *new_rd_simpleSel (dbg_info *db, ir_graph *irg, ir_node *block,
1313 ir_node *store, ir_node *objptr, entity *ent);
1315 /** Constructor for a Sel node.
1317 * The select node selects an entity (field or method) from an entity
1318 * with a compound type. It explicitly specifies the entity selected.
1319 * Dynamically the node may select entities that overwrite the given
1320 * entity. If the selected entity is an array element entity the Sel
1321 * node takes the required array indices as inputs.
1323 * @param *db A pointer for debug information.
1324 * @param *irg The ir graph the node belongs to.
1325 * @param *block The ir block the node belongs to.
1326 * @param *store The memory in which the object the entity should be selected
1327 * from is allocated.
1328 * @param *objptr A pointer to a compound entity the Sel operation selects a
1329 * single attribute from.
1330 * @param *n_index The number of array indices needed to select an array element entity.
1331 * @param *index[] If the compound entity is an array the indices of the selected
1332 * element entity. The constructor copies this array.
1333 * @param *ent The entity to select.
1335 ir_node *new_rd_Sel (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1336 ir_node *objptr, int n_index, ir_node *index[], entity *ent);
1338 /** Constructor for a Call node.
1340 * Represents all kinds of method and function calls.
1342 * @param *db A pointer for debug information.
1343 * @param *irg The ir graph the node belongs to.
1344 * @param *block The ir block the node belongs to.
1345 * @param *store The current memory state.
1346 * @param *callee A pointer to the called procedure.
1347 * @param arity The number of procedure parameters.
1348 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1349 * @param *tp Type information of the procedure called.
1351 ir_node *new_rd_Call (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1352 ir_node *callee, int arity, ir_node *in[], ir_type *tp);
1354 /** Constructor for a Add node.
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 *op1 The first operand.
1360 * @param *op2 The second operand.
1361 * @param *mode The mode of the operands and the result.
1363 ir_node *new_rd_Add (dbg_info *db, ir_graph *irg, ir_node *block,
1364 ir_node *op1, ir_node *op2, ir_mode *mode);
1366 /** Constructor for a Sub node.
1368 * @param *db A pointer for debug information.
1369 * @param *irg The ir graph the node belongs to.
1370 * @param *block The ir block the node belongs to.
1371 * @param *op1 The first operand.
1372 * @param *op2 The second operand.
1373 * @param *mode The mode of the operands and the result.
1375 ir_node *new_rd_Sub (dbg_info *db, ir_graph *irg, ir_node *block,
1376 ir_node *op1, ir_node *op2, ir_mode *mode);
1378 /** Constructor for a Minus node.
1380 * @param *db A pointer for debug information.
1381 * @param *irg The ir graph the node belongs to.
1382 * @param *block The ir block the node belongs to.
1383 * @param *op The operand .
1384 * @param *mode The mode of the operand and the result.
1386 ir_node *new_rd_Minus (dbg_info *db, ir_graph *irg, ir_node *block,
1387 ir_node *op, ir_mode *mode);
1389 /** Constructor for a Mul node.
1391 * @param *db A pointer for debug information.
1392 * @param *irg The ir graph the node belongs to.
1393 * @param *block The ir block the node belongs to.
1394 * @param *op1 The first operand.
1395 * @param *op2 The second operand.
1396 * @param *mode The mode of the operands and the result.
1398 ir_node *new_rd_Mul (dbg_info *db, ir_graph *irg, ir_node *block,
1399 ir_node *op1, ir_node *op2, ir_mode *mode);
1401 /** Constructor for a Quot node.
1403 * @param *db A pointer for debug information.
1404 * @param *irg The ir graph the node belongs to.
1405 * @param *block The ir block the node belongs to.
1406 * @param *memop The store needed to model exceptions
1407 * @param *op1 The first operand.
1408 * @param *op2 The second operand.
1410 ir_node *new_rd_Quot (dbg_info *db, ir_graph *irg, ir_node *block,
1411 ir_node *memop, ir_node *op1, ir_node *op2);
1413 /** Constructor for a DivMod node.
1415 * @param *db A pointer for debug information.
1416 * @param *irg The ir graph the node belongs to.
1417 * @param *block The ir block the node belongs to.
1418 * @param *memop The store needed to model exceptions
1419 * @param *op1 The first operand.
1420 * @param *op2 The second operand.
1422 ir_node *new_rd_DivMod (dbg_info *db, ir_graph *irg, ir_node *block,
1423 ir_node *memop, ir_node *op1, ir_node *op2);
1425 /** Constructor for a Div node.
1427 * @param *db A pointer for debug information.
1428 * @param *irg The ir graph the node belongs to.
1429 * @param *block The ir block the node belongs to.
1430 * @param *memop The store needed to model exceptions
1431 * @param *op1 The first operand.
1432 * @param *op2 The second operand.
1434 ir_node *new_rd_Div (dbg_info *db, ir_graph *irg, ir_node *block,
1435 ir_node *memop, ir_node *op1, ir_node *op2);
1437 /** Constructor for a Mod node.
1439 * @param *db A pointer for debug information.
1440 * @param *irg The ir graph the node belongs to.
1441 * @param *block The ir block the node belongs to.
1442 * @param *memop The store needed to model exceptions
1443 * @param *op1 The first operand.
1444 * @param *op2 The second operand.
1446 ir_node *new_rd_Mod (dbg_info *db, ir_graph *irg, ir_node *block,
1447 ir_node *memop, ir_node *op1, ir_node *op2);
1449 /** Constructor for a Abs node.
1451 * @param *db A pointer for debug information.
1452 * @param *irg The ir graph the node belongs to.
1453 * @param *block The ir block the node belongs to.
1454 * @param *op The operand
1455 * @param *mode The mode of the operands and the result.
1457 ir_node *new_rd_Abs (dbg_info *db, ir_graph *irg, ir_node *block,
1458 ir_node *op, ir_mode *mode);
1460 /** Constructor for a And node.
1462 * @param *db A pointer for debug information.
1463 * @param *irg The ir graph the node belongs to.
1464 * @param *block The ir block the node belongs to.
1465 * @param *op1 The first operand.
1466 * @param *op2 The second operand.
1467 * @param *mode The mode of the operands and the result.
1469 ir_node *new_rd_And (dbg_info *db, ir_graph *irg, ir_node *block,
1470 ir_node *op1, ir_node *op2, ir_mode *mode);
1472 /** Constructor for a Or node.
1474 * @param *db A pointer for debug information.
1475 * @param *irg The ir graph the node belongs to.
1476 * @param *block The ir block the node belongs to.
1477 * @param *op1 The first operand.
1478 * @param *op2 The second operand.
1479 * @param *mode The mode of the operands and the result.
1481 ir_node *new_rd_Or (dbg_info *db, ir_graph *irg, ir_node *block,
1482 ir_node *op1, ir_node *op2, ir_mode *mode);
1484 /** Constructor for a Eor node.
1486 * @param *db A pointer for debug information.
1487 * @param *irg The ir graph the node belongs to.
1488 * @param *block The ir block the node belongs to.
1489 * @param *op1 The first operand.
1490 * @param *op2 The second operand.
1491 * @param *mode The mode of the operands and the results.
1493 ir_node *new_rd_Eor (dbg_info *db, ir_graph *irg, ir_node *block,
1494 ir_node *op1, ir_node *op2, ir_mode *mode);
1496 /** Constructor for a Not node.
1498 * @param *db A pointer for debug information.
1499 * @param *irg The ir graph the node belongs to.
1500 * @param *block The ir block the node belongs to.
1501 * @param *op The operand.
1502 * @param *mode The mode of the operand and the result.
1504 ir_node *new_rd_Not (dbg_info *db, ir_graph *irg, ir_node *block,
1505 ir_node *op, ir_mode *mode);
1507 /** Constructor for a Cmp node.
1509 * @param *db A pointer for debug information.
1510 * @param *irg The ir graph the node belongs to.
1511 * @param *block The ir block the node belongs to.
1512 * @param *op1 The first operand.
1513 * @param *op2 The second operand.
1515 ir_node *new_rd_Cmp (dbg_info *db, ir_graph *irg, ir_node *block,
1516 ir_node *op1, ir_node *op2);
1518 /** Constructor for a Shl node.
1520 * @param *db A pointer for debug information.
1521 * @param *irg The ir graph the node belongs to.
1522 * @param *block The ir block the node belongs to.
1523 * @param *op The operand.
1524 * @param *k The number of bits to shift the operand .
1525 * @param *mode The mode of the operand and the result.
1527 ir_node *new_rd_Shl (dbg_info *db, ir_graph *irg, ir_node *block,
1528 ir_node *op, ir_node *k, ir_mode *mode);
1530 /** Constructor for a Shr node.
1532 * @param *db A pointer for debug information.
1533 * @param *irg The ir graph the node belongs to.
1534 * @param *block The ir block the node belongs to.
1535 * @param *op The operand.
1536 * @param *k The number of bits to shift the operand .
1537 * @param *mode The mode of the operand and the result.
1539 ir_node *new_rd_Shr (dbg_info *db, ir_graph *irg, ir_node *block,
1540 ir_node *op, ir_node *k, ir_mode *mode);
1542 /** Constructor for a Shrs node.
1544 * @param *db A pointer for debug information.
1545 * @param *irg The ir graph the node belongs to.
1546 * @param *block The ir block the node belongs to.
1547 * @param *op The operand.
1548 * @param *k The number of bits to shift the operand.
1549 * @param *mode The mode of the operand and the result.
1551 ir_node *new_rd_Shrs (dbg_info *db, ir_graph *irg, ir_node *block,
1552 ir_node *op, ir_node *k, ir_mode *mode);
1554 /** Constructor for a Rot node.
1556 * @param *db A pointer for debug information.
1557 * @param *irg The ir graph the node belongs to.
1558 * @param *block The ir block the node belongs to.
1559 * @param *op The operand.
1560 * @param *k The number of bits to rotate the operand.
1561 * @param *mode The mode of the operand.
1563 ir_node *new_rd_Rot (dbg_info *db, ir_graph *irg, ir_node *block,
1564 ir_node *op, ir_node *k, ir_mode *mode);
1567 /** Constructor for a Conv node.
1569 * @param *db A pointer for debug information.
1570 * @param *irg The ir graph the node belongs to.
1571 * @param *block The ir block the node belongs to.
1572 * @param *op The operand.
1573 * @param *mode The mode of this the operand muss be converted .
1575 ir_node *new_rd_Conv (dbg_info *db, ir_graph *irg, ir_node *block,
1576 ir_node *op, ir_mode *mode);
1578 /** Constructor for a Cast node.
1580 * High level type cast.
1582 * @param *db A pointer for debug information.
1583 * @param *irg The ir graph the node belongs to.
1584 * @param *block The ir block the node belongs to.
1585 * @param *op The operand.
1586 * @param *to_tp The type of this the operand muss be casted .
1588 ir_node *new_rd_Cast (dbg_info *db, ir_graph *irg, ir_node *block,
1589 ir_node *op, ir_type *to_tp);
1591 /** Constructor for a Carry node.
1593 * @param *db A pointer for debug information.
1594 * @param *irg The ir graph the node belongs to.
1595 * @param *block The ir block the node belongs to.
1596 * @param *op1 The first operand.
1597 * @param *op2 The second operand.
1598 * @param *mode The mode of the operands and the result.
1600 ir_node *new_rd_Carry (dbg_info *db, ir_graph *irg, ir_node *block,
1601 ir_node *op1, ir_node *op2, ir_mode *mode);
1603 /** Constructor for a Borrow node.
1605 * @param *db A pointer for debug information.
1606 * @param *irg The ir graph the node belongs to.
1607 * @param *block The ir block the node belongs to.
1608 * @param *op1 The first operand.
1609 * @param *op2 The second operand.
1610 * @param *mode The mode of the operands and the result.
1612 ir_node *new_rd_Borrow (dbg_info *db, ir_graph *irg, ir_node *block,
1613 ir_node *op1, ir_node *op2, ir_mode *mode);
1615 /** Constructor for a Phi node.
1617 * @param *db A pointer for debug information.
1618 * @param *irg The ir graph the node belongs to.
1619 * @param *block The ir block the node belongs to.
1620 * @param arity The number of predecessors
1621 * @param *in[] Array with predecessors. The constructor copies this array.
1622 * @param *mode The mode of it's inputs and output.
1624 ir_node *new_rd_Phi (dbg_info *db, ir_graph *irg, ir_node *block, int arity,
1625 ir_node *in[], ir_mode *mode);
1627 /** Constructor for a Load node.
1629 * @param *db A pointer for debug information.
1630 * @param *irg The ir graph the node belongs to.
1631 * @param *block The ir block the node belongs to.
1632 * @param *store The current memory
1633 * @param *adr A pointer to the variable to be read in this memory.
1634 * @param *mode The mode of the value to be loaded.
1636 ir_node *new_rd_Load (dbg_info *db, ir_graph *irg, ir_node *block,
1637 ir_node *store, ir_node *adr, ir_mode *mode);
1639 /** Constructor for a Store node.
1641 * @param *db A pointer for debug information.
1642 * @param *irg The ir graph the node belongs to.
1643 * @param *block The ir block the node belongs to.
1644 * @param *store The current memory
1645 * @param *adr A pointer to the variable to be read in this memory.
1646 * @param *val The value to write to this variable.
1648 ir_node *new_rd_Store (dbg_info *db, ir_graph *irg, ir_node *block,
1649 ir_node *store, ir_node *adr, ir_node *val);
1651 /** Constructor for a Alloc node.
1653 * The Alloc node extends the memory by space for an entity of type alloc_type.
1655 * @param *db A pointer for debug information.
1656 * @param *irg The ir graph the node belongs to.
1657 * @param *block The ir block the node belongs to.
1658 * @param *store The memory which shall contain the new variable.
1659 * @param *size The number of bytes to allocate.
1660 * @param *alloc_type The type of the allocated variable.
1661 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
1663 ir_node *new_rd_Alloc (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1664 ir_node *size, ir_type *alloc_type, where_alloc where);
1666 /** Constructor for a Free node.
1668 * Frees the memory occupied by the entity pointed to by the pointer
1669 * arg. Type indicates the type of the entity the argument points to.
1671 * @param *db A pointer for debug information.
1672 * @param *irg The ir graph the node belongs to.
1673 * @param *block The ir block the node belongs to.
1674 * @param *store The memory which shall contain the new variable.
1675 * @param *ptr The pointer to the object to free.
1676 * @param *size The number of objects of type free_type to free in a sequence.
1677 * @param *free_type The type of the freed variable.
1678 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
1680 ir_node *new_rd_Free (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1681 ir_node *ptr, ir_node *size, ir_type *free_type, where_alloc where);
1683 /** Constructor for a Sync node.
1685 * Merges several memory values. The node assumes that a variable
1686 * either occurs only in one of the memories, or it contains the same
1687 * value in all memories where it occurs.
1689 * @param *db A pointer for debug information.
1690 * @param *irg The ir graph the node belongs to.
1691 * @param *block The ir block the node belongs to.
1692 * @param arity The number of memories to synchronize.
1693 * @param *in[] An array of pointers to nodes that produce an output of type
1694 * memory. The constructor copies this array.
1696 ir_node *new_rd_Sync (dbg_info *db, ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
1698 /** Constructor for a Proj node.
1700 * Projects a single value out of a tuple. The parameter proj gives the
1701 * position of the value within the tuple.
1703 * @param *db A pointer for debug information.
1704 * @param *irg The ir graph the node belongs to.
1705 * @param *block The ir block the node belongs to.
1706 * @param arg A node producing a tuple. The node must have mode_T.
1707 * @param *mode The mode of the value to project.
1708 * @param proj The position of the value in the tuple.
1710 ir_node *new_rd_Proj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1711 ir_mode *mode, long proj);
1713 /** Constructor for a defaultProj node.
1715 * Represents the default control flow of a Switch-Cond node.
1717 * @param *db A pointer for debug information.
1718 * @param *irg The ir graph the node belongs to.
1719 * @param *block The ir block the node belongs to.
1720 * @param arg A node producing a tuple.
1721 * @param max_proj The end position of the value in the tuple.
1723 ir_node *new_rd_defaultProj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1726 /** Constructor for a Tuple node.
1728 * This is an auxiliary node to replace a node that returns a tuple
1729 * without changing the corresponding Proj nodes.
1731 * @param *db A pointer for debug information.
1732 * @param *irg The ir graph the node belongs to.
1733 * @param *block The ir block the node belongs to.
1734 * @param arity The number of tuple elements.
1735 * @param *in[] An array containing pointers to the nodes producing the tuple
1736 * elements. The constructor copies this array.
1738 ir_node *new_rd_Tuple (dbg_info *db, ir_graph *irg, ir_node *block,
1739 int arity, ir_node *in[]);
1741 /** Constructor for a Id node.
1743 * This is an auxiliary node to replace a node that returns a single
1746 * @param *db A pointer for debug information.
1747 * @param *irg The ir graph the node belongs to.
1748 * @param *block The ir block the node belongs to.
1749 * @param *val The value
1750 * @param *mode The mode of *val.
1752 ir_node *new_rd_Id (dbg_info *db, ir_graph *irg, ir_node *block,
1753 ir_node *val, ir_mode *mode);
1755 /** Constructor for a Bad node.
1757 * Returns the unique Bad node of the graph. The same as
1760 * @param *irg The ir graph the node belongs to.
1762 ir_node *new_rd_Bad (ir_graph *irg);
1764 /** Constructor for a Confirm node.
1766 * Specifies constraints for a value. To support dataflow analyses.
1768 * Example: If the value never exceeds '100' this is expressed by placing a
1769 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
1771 * @param *irg The ir graph the node belong to.
1772 * @param *block The ir block the node belong to.
1773 * @param *db A pointer for debug information.
1774 * @param *val The value we express a constraint for
1775 * @param *bound The value to compare against. Must be a firm node, typically a constant.
1776 * @param cmp The compare operation.
1778 ir_node *new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block,
1779 ir_node *val, ir_node *bound, pn_Cmp cmp);
1781 /** Constructor for an Unknown node.
1783 * Represents an arbitrary value. Places the node in the start block.
1785 * @param *irg The ir graph the node belongs to.
1786 * @param *m The mode of the unknown value.
1788 ir_node *new_rd_Unknown(ir_graph *irg, ir_mode *m);
1790 /** Constructor for a CallBegin node.
1792 * CallBegin represents control flow depending of the pointer value
1793 * representing the called method to the called methods. The
1794 * constructor copies the method pointer input from the passed Call
1797 * @param *db A pointer for debug information.
1798 * @param *irg The ir graph the node belong to.
1799 * @param *block The block the node belong to.
1800 * @param *callee The call node visible in the intra procedural view.
1802 ir_node *new_rd_CallBegin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *callee);
1804 /** Constructor for a EndReg node.
1806 * Used to represent regular procedure end in interprocedual view.
1808 * @param *db A pointer for debug information.
1809 * @param *irg The ir graph the node belong to.
1810 * @param *block The block the node belong to.
1812 ir_node *new_rd_EndReg (dbg_info *db, ir_graph *irg, ir_node *block);
1814 /** Constructor for a EndExcept node.
1816 * Used to represent exceptional procedure end in interprocedural view.
1818 * @param *db A pointer for debug information.
1819 * @param *irg The ir graph the node belong to.
1820 * @param *block The block the node belong to.
1822 ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
1824 /** Constructor for a Filter node.
1826 * Adds the node to the block in current_ir_block. Filter is a node
1827 * with two views used to construct the interprocedural view. In
1828 * intraprocedural view its semantics are identical to the Proj node.
1829 * In interprocedural view the Filter performs the Phi operation on
1830 * method parameters or results. Other than a Phi a Filter node may
1831 * not be removed if it has only a single input.
1833 * The constructor builds the Filter in intraprocedural view.
1835 * @param *db A pointer for debug information.
1836 * @param *irg The ir graph the node belong to.
1837 * @param *block The block the node belong to.
1838 * @param *arg The tuple value to project from.
1839 * @param *mode The mode of the projected value.
1840 * @param proj The position in the tuple to project from.
1842 ir_node *new_rd_Filter (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1843 ir_mode *mode, long proj);
1845 /** Constructor for a NoMem node.
1847 * Returns the unique NoMem node of the graph. The same as
1850 * @param *irg The ir graph the node belongs to.
1852 ir_node *new_rd_NoMem (ir_graph *irg);
1854 /** Constructor for a Mux node.
1856 * @param *db A pointer for debug information.
1857 * @param *irg The ir graph the node belong to.
1858 * @param *block The block the node belong to.
1859 * @param *sel The ir_node that calculates the boolean select.
1860 * @param *ir_true The ir_node that calculates the true result.
1861 * @param *ir_false The ir_node that calculates the false result.
1862 * @param *mode The mode of the node (and it_true and ir_false).
1864 ir_node *new_rd_Mux (dbg_info *db, ir_graph *irg, ir_node *block,
1865 ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
1867 /** Constructor for a Psi node.
1869 * @param *db A pointer for debug information.
1870 * @param *irg The ir graph the node belong to.
1871 * @param *block The block the node belong to.
1872 * @param *arity The arity of the conditions
1873 * @param *conds The array of mode_b conditions, length must be equal arity
1874 * @param *vals The array of mode values, length must be equal arity + 1
1875 * @param *mode The mode of the node (must be the mode of all vals).
1877 ir_node *new_rd_Psi (dbg_info *db, ir_graph *irg, ir_node *block,
1878 int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
1880 /** Constructor for a CopyB node.
1882 * @param *db A pointer for debug information.
1883 * @param *irg The ir graph the node belong to.
1884 * @param *block The block the node belong to.
1885 * @param *store The current memory
1886 * @param *dst The ir_node that represents the destination address.
1887 * @param *src The ir_node that represents the source address.
1888 * @param *data_type The type of the copied data
1890 ir_node *new_rd_CopyB(dbg_info *db, ir_graph *irg, ir_node *block,
1891 ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
1893 /** Constructor for a InstOf node.
1895 * A High-Level Type check.
1897 * @param *db A pointer for debug information.
1898 * @param *irg The ir graph the node belongs to.
1899 * @param *block The ir block the node belongs to.
1900 * @param *store The memory in which the object the entity should be selected
1901 * from is allocated.
1902 * @param *objptr A pointer to a object of a class type.
1903 * @param *type The type of which objptr must be.
1905 ir_node *new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1906 ir_node *objptr, ir_type *type);
1908 /** Constructor for a Raise node.
1910 * A High-Level Exception throw.
1912 * @param *db A pointer for debug information.
1913 * @param *irg The ir graph the node belongs to.
1914 * @param *block The ir block the node belongs to.
1915 * @param *store The current memory.
1916 * @param *obj A pointer to the Except variable.
1918 ir_node *new_rd_Raise (dbg_info *db, ir_graph *irg, ir_node *block,
1919 ir_node *store, ir_node *obj);
1921 /** Constructor for a Bound node.
1923 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
1925 * @param *db A pointer for debug information.
1926 * @param *irg The ir graph the node belong to.
1927 * @param *block The block the node belong to.
1928 * @param *store The current memory
1929 * @param *idx The ir_node that represents an index.
1930 * @param *lower The ir_node that represents the lower bound for the index.
1931 * @param *upper The ir_node that represents the upper bound for the index.
1933 ir_node *new_rd_Bound(dbg_info *db, ir_graph *irg, ir_node *block,
1934 ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
1936 /*-------------------------------------------------------------------------*/
1937 /* The raw interface without debug support */
1938 /*-------------------------------------------------------------------------*/
1940 /** Constructor for a Block node.
1942 * Constructs a mature block with the given predecessors. Use Unknown
1943 * nodes as predecessors to construct a block if the number of
1944 * predecessors is known, but not the predecessors themselves. This
1945 * constructor does not set current_block. It not be used with
1946 * automatic Phi node construction.
1949 * @param irg The ir graph the block belongs to.
1950 * @param arity The number of control predecessors.
1951 * @param in[] An array of control predecessors. The length of
1952 * the array must be 'arity'. The constructor copies this array.
1954 ir_node *new_r_Block (ir_graph *irg, int arity, ir_node *in[]);
1956 /** Constructor for a Start node.
1958 * @param *irg The ir graph the node belongs to.
1959 * @param *block The ir block the node belongs to.
1961 ir_node *new_r_Start (ir_graph *irg, ir_node *block);
1963 /** Constructor for a End node.
1965 * @param *irg The ir graph the node belongs to.
1966 * @param *block The ir block the node belongs to.
1968 ir_node *new_r_End (ir_graph *irg, ir_node *block);
1970 /** Constructor for a Jmp node.
1972 * Jmp represents control flow to a single control successor.
1974 * @param *irg The ir graph the node belongs to.
1975 * @param *block The ir block the node belongs to.
1977 ir_node *new_r_Jmp (ir_graph *irg, ir_node *block);
1979 /** Constructor for an IJmp node.
1981 * IJmp represents control flow to a single control successor not
1982 * statically known i.e. an indirect Jmp.
1984 * @param *irg The ir graph the node belongs to.
1985 * @param *block The ir block the node belongs to.
1986 * @param *tgt The ir node representing the target address.
1988 ir_node *new_r_IJmp (ir_graph *irg, ir_node *block, ir_node *tgt);
1990 /** Constructor for a Cond node.
1992 * If c is mode_b represents a conditional branch (if/else). If c is
1993 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
1994 * node, default Proj is 0.)
1996 * This is not consistent: Input to Cond is Is, Proj has as proj number
1999 * @param *irg The ir graph the node belongs to.
2000 * @param *block The ir block the node belongs to.
2001 * @param *c The conditions parameter.Can be of mode b or I_u.
2003 ir_node *new_r_Cond (ir_graph *irg, ir_node *block, ir_node *c);
2005 /** Constructor for a Return node.
2007 * Returns the memory an zero or more return values. Only node that
2008 * can end regular control flow.
2010 * @param *irg The ir graph the node belongs to.
2011 * @param *block The ir block the node belongs to.
2012 * @param *store The state of memory.
2013 * @param arity Number of array indices.
2014 * @param *in[] Array with index inputs to the node. The constructor copies this array.
2016 ir_node *new_r_Return (ir_graph *irg, ir_node *block,
2017 ir_node *store, int arity, ir_node *in[]);
2019 /** Constructor for a Const node.
2021 * Constructor for a Const node. The constant represents a target
2022 * value. Sets the type information to type_unknown. (No more
2023 * supported: If tv is entity derives a somehow useful type.)
2025 * @param *irg The ir graph the node belongs to.
2026 * @param *block The ir block the node belongs to.
2027 * @param *mode The mode of the operands and the results.
2028 * @param *con Points to an entry in the constant table.
2030 ir_node *new_r_Const (ir_graph *irg, ir_node *block,
2031 ir_mode *mode, tarval *con);
2033 /** Constructor for a Const node.
2035 * Constructor for a Const node. The constant represents a target
2036 * value. Sets the type information to type_unknown. (No more
2037 * supported: If tv is entity derives a somehow useful type.)
2039 * @param *irg The ir graph the node belongs to.
2040 * @param *block The ir block the node belongs to.
2041 * @param *mode The mode of the operands and the results.
2042 * @param value A value from which the tarval is made.
2044 ir_node *new_r_Const_long(ir_graph *irg, ir_node *block,
2045 ir_mode *mode, long value);
2047 /** Constructor for a Const_type node.
2049 * The constant represents a target value. This constructor sets high
2050 * level type information for the constant value.
2052 * @param *irg The ir graph the node belongs to.
2053 * @param *block The ir block the node belongs to.
2054 * @param *mode The mode of the operands and results.
2055 * @param *con Points to an entry in the constant table.
2056 * @param *tp The type of the constant.
2058 ir_node *new_r_Const_type(ir_graph *irg, ir_node *block,
2059 ir_mode *mode, tarval *con, ir_type *tp);
2061 /** Constructor for a SymConst node.
2063 * This is the constructor for a symbolic constant.
2064 * There are four kinds of symbolic constants:
2065 * - type_tag The symbolic constant represents a type tag. The type the
2066 * tag stands for is given explicitly.
2067 * - size The symbolic constant represents the size of a type. The
2068 * type of which the constant represents the size is given
2070 * - addr_name The symbolic constant represents the address of an entity
2071 * (variable or method). The variable is indicated by a name
2072 * that is valid for linking.
2073 * - addr_ent The symbolic constant represents the address of an entity
2074 * (variable or method). The variable is given explicitly by
2077 * Inputs to the node:
2078 * No inputs except the block it belongs to.
2079 * Outputs of the node.
2080 * An unsigned integer (I_u) or a pointer (P).
2082 * @param *irg The ir graph the node belongs to.
2083 * @param *block The ir block the node belongs to.
2084 * @param value A type, entity or a ident depending on the SymConst kind.
2085 * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
2087 ir_node *new_r_SymConst (ir_graph *irg, ir_node *block,
2088 union symconst_symbol value, symconst_kind symkind);
2090 /** Constructor for a simpleSel node.
2092 * This is a shortcut for the new_d_Sel() constructor. To be used for
2093 * Sel nodes that do not select from an array, i.e., have no index
2094 * inputs. It adds the two parameters 0, NULL.
2096 * @param *irg The ir graph the node belongs to.
2097 * @param *block The ir block the node belongs to.
2098 * @param *store The memory in which the object the entity should be selected
2099 * from is allocated.
2100 * @param *objptr The object from that the Sel operation selects a
2101 * single attribute out.
2102 * @param *ent The entity to select.
2104 ir_node *new_r_simpleSel(ir_graph *irg, ir_node *block, ir_node *store,
2105 ir_node *objptr, entity *ent);
2107 /** Constructor for a Sel node.
2109 * The select node selects an entity (field or method) from an entity
2110 * with a compound type. It explicitly specifies the entity selected.
2111 * Dynamically the node may select entities that overwrite the given
2112 * entity. If the selected entity is an array element entity the Sel
2113 * node takes the required array indices as inputs.
2115 * @param *irg The ir graph the node belongs to.
2116 * @param *block The ir block the node belongs to.
2117 * @param *store The memory in which the object the entity should be selected
2118 * from is allocated.
2119 * @param *objptr A pointer to a compound entity the Sel operation selects a
2120 * single attribute from.
2121 * @param *n_index The number of array indices needed to select an array element entity.
2122 * @param *index[] If the compound entity is an array the indices of the selected
2123 * element entity. The constructor copies this array.
2124 * @param *ent The entity to select.
2126 ir_node *new_r_Sel (ir_graph *irg, ir_node *block, ir_node *store,
2127 ir_node *objptr, int n_index, ir_node *index[],
2130 /** Constructor for a Call node.
2132 * Represents all kinds of method and function calls.
2134 * @param *irg The ir graph the node belongs to.
2135 * @param *block The ir block the node belongs to.
2136 * @param *store The actual store.
2137 * @param *callee A pointer to the called procedure.
2138 * @param arity The number of procedure parameters.
2139 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2140 * @param *tp Type information of the procedure called.
2142 ir_node *new_r_Call (ir_graph *irg, ir_node *block, ir_node *store,
2143 ir_node *callee, int arity, ir_node *in[],
2146 /** Constructor for a Add node.
2148 * @param *irg The ir graph the node belongs to.
2149 * @param *block The ir block the node belongs to.
2150 * @param *op1 The first operand.
2151 * @param *op2 The second operand.
2152 * @param *mode The mode of the operands and the result.
2154 ir_node *new_r_Add (ir_graph *irg, ir_node *block,
2155 ir_node *op1, ir_node *op2, ir_mode *mode);
2158 * Constructor for a Sub node.
2160 * @param *irg The ir graph the node belongs to.
2161 * @param *block The ir block the node belongs to.
2162 * @param *op1 The first operand.
2163 * @param *op2 The second operand.
2164 * @param *mode The mode of the operands and the results.
2166 ir_node *new_r_Sub (ir_graph *irg, ir_node *block,
2167 ir_node *op1, ir_node *op2, ir_mode *mode);
2169 /** Constructor for a Minus node.
2171 * @param *irg The ir graph the node belongs to.
2172 * @param *block The ir block the node belongs to.
2173 * @param *op The operand.
2174 * @param *mode The mode of the operand and the result.
2176 ir_node *new_r_Minus (ir_graph *irg, ir_node *block,
2177 ir_node *op, ir_mode *mode);
2178 /** Constructor for a Mul node.
2180 * @param *irg The ir graph the node belongs to.
2181 * @param *block The ir block the node belongs to.
2182 * @param *op1 The first operand.
2183 * @param *op2 The second operand.
2184 * @param *mode The mode of the operands and the result.
2186 ir_node *new_r_Mul (ir_graph *irg, ir_node *block,
2187 ir_node *op1, ir_node *op2, ir_mode *mode);
2189 /** Constructor for a Quot node.
2191 * @param *irg The ir graph the node belongs to.
2192 * @param *block The ir block the node belongs to.
2193 * @param *memop The store needed to model exceptions
2194 * @param *op1 The first operand.
2195 * @param *op2 The second operand.
2197 ir_node *new_r_Quot (ir_graph *irg, ir_node *block,
2198 ir_node *memop, ir_node *op1, ir_node *op2);
2200 /** Constructor for a DivMod node.
2202 * @param *irg The ir graph the node belongs to.
2203 * @param *block The ir block the node belongs to.
2204 * @param *memop The store needed to model exceptions
2205 * @param *op1 The first operand.
2206 * @param *op2 The second operand.
2208 ir_node *new_r_DivMod (ir_graph *irg, ir_node *block,
2209 ir_node *memop, ir_node *op1, ir_node *op2);
2211 /** Constructor for a Div node.
2213 * @param *irg The ir graph the node belongs to.
2214 * @param *block The ir block the node belongs to.
2215 * @param *memop The store needed to model exceptions
2216 * @param *op1 The first operand.
2217 * @param *op2 The second operand.
2219 ir_node *new_r_Div (ir_graph *irg, ir_node *block,
2220 ir_node *memop, ir_node *op1, ir_node *op2);
2222 /** Constructor for a Mod node.
2224 * @param *irg The ir graph the node belongs to.
2225 * @param *block The ir block the node belongs to.
2226 * @param *memop The store needed to model exceptions
2227 * @param *op1 The first operand.
2228 * @param *op2 The second operand.
2230 ir_node *new_r_Mod (ir_graph *irg, ir_node *block,
2231 ir_node *memop, ir_node *op1, ir_node *op2);
2233 /** Constructor for a Abs node.
2235 * @param *irg The ir graph the node belongs to.
2236 * @param *block The ir block the node belongs to.
2237 * @param *op The operand
2238 * @param *mode The mode of the operands and the result.
2240 ir_node *new_r_Abs (ir_graph *irg, ir_node *block,
2241 ir_node *op, ir_mode *mode);
2243 /** Constructor for a And node.
2245 * @param *irg The ir graph the node belongs to.
2246 * @param *block The ir block the node belongs to.
2247 * @param *op1 The first operand.
2248 * @param *op2 The second operand.
2249 * @param *mode The mode of the operands and the result.
2251 ir_node *new_r_And (ir_graph *irg, ir_node *block,
2252 ir_node *op1, ir_node *op2, ir_mode *mode);
2254 /** Constructor for a Or node.
2256 * @param *irg The ir graph the node belongs to.
2257 * @param *block The ir block the node belongs to.
2258 * @param *op1 The first operand.
2259 * @param *op2 The second operand.
2260 * @param *mode The mode of the operands and the result.
2262 ir_node *new_r_Or (ir_graph *irg, ir_node *block,
2263 ir_node *op1, ir_node *op2, ir_mode *mode);
2265 /** Constructor for a Eor node.
2267 * @param *irg The ir graph the node belongs to.
2268 * @param *block The ir block the node belongs to.
2269 * @param *op1 The first operand.
2270 * @param *op2 The second operand.
2271 * @param *mode The mode of the operands and the results.
2273 ir_node *new_r_Eor (ir_graph *irg, ir_node *block,
2274 ir_node *op1, ir_node *op2, ir_mode *mode);
2276 /** Constructor for a Not node.
2278 * @param *irg The ir graph the node belongs to.
2279 * @param *block The ir block the node belongs to.
2280 * @param *op The operand.
2281 * @param *mode The mode of the operand and the result.
2283 ir_node *new_r_Not (ir_graph *irg, ir_node *block,
2284 ir_node *op, ir_mode *mode);
2286 /** Constructor for a Cmp node.
2288 * @param *irg The ir graph the node belongs to.
2289 * @param *block The ir block the node belongs to.
2290 * @param *op1 The first operand.
2291 * @param *op2 The second operand.
2293 ir_node *new_r_Cmp (ir_graph *irg, ir_node *block,
2294 ir_node *op1, ir_node *op2);
2296 /** Constructor for a Shl node.
2298 * @param *irg The ir graph the node belongs to.
2299 * @param *block The ir block the node belongs to.
2300 * @param *op The operand.
2301 * @param *k The number of bits to shift the operand .
2302 * @param *mode The mode of the operand and the result.
2304 ir_node *new_r_Shl (ir_graph *irg, ir_node *block,
2305 ir_node *op, ir_node *k, ir_mode *mode);
2307 /** Constructor for a Shr node.
2309 * @param *irg The ir graph the node belongs to.
2310 * @param *block The ir block the node belongs to.
2311 * @param *op The operand.
2312 * @param *k The number of bits to shift the operand .
2313 * @param *mode The mode of the operand and the result.
2315 ir_node *new_r_Shr (ir_graph *irg, ir_node *block,
2316 ir_node *op, ir_node *k, ir_mode *mode);
2319 * Constructor for a Shrs node.
2321 * @param *irg The ir graph the node belongs to.
2322 * @param *block The ir block the node belongs to.
2323 * @param *op The operand.
2324 * @param *k The number of bits to shift the operand.
2325 * @param *mode The mode of the operand and the result.
2327 ir_node *new_r_Shrs (ir_graph *irg, ir_node *block,
2328 ir_node *op, ir_node *k, ir_mode *mode);
2330 /** Constructor for a Rot node.
2332 * @param *irg The ir graph the node belongs to.
2333 * @param *block The ir block the node belongs to.
2334 * @param *op The operand.
2335 * @param *k The number of bits to rotate the operand.
2336 * @param *mode The mode of the operand.
2338 ir_node *new_r_Rot (ir_graph *irg, ir_node *block,
2339 ir_node *op, ir_node *k, ir_mode *mode);
2341 /** Constructor for a Conv node.
2343 * @param *irg The ir graph the node belongs to.
2344 * @param *block The ir block the node belongs to.
2345 * @param *op The operand.
2346 * @param *mode The mode of this the operand muss be converted .
2348 ir_node *new_r_Conv (ir_graph *irg, ir_node *block,
2349 ir_node *op, ir_mode *mode);
2351 /** Constructor for a Cast node.
2353 * High level type cast
2355 * @param *irg The ir graph the node belongs to.
2356 * @param *block The ir block the node belongs to.
2357 * @param *op The operand.
2358 * @param *to_tp The type of this the operand muss be casted .
2360 ir_node *new_r_Cast (ir_graph *irg, ir_node *block,
2361 ir_node *op, ir_type *to_tp);
2363 /** Constructor for a Carry node.
2365 * @param *irg The ir graph the node belongs to.
2366 * @param *block The ir block the node belongs to.
2367 * @param *op1 The first operand.
2368 * @param *op2 The second operand.
2369 * @param *mode The mode of the operands and the result.
2371 ir_node *new_r_Carry (ir_graph *irg, ir_node *block,
2372 ir_node *op1, ir_node *op2, ir_mode *mode);
2375 * Constructor for a Borrow node.
2377 * @param *irg The ir graph the node belongs to.
2378 * @param *block The ir block the node belongs to.
2379 * @param *op1 The first operand.
2380 * @param *op2 The second operand.
2381 * @param *mode The mode of the operands and the results.
2383 ir_node *new_r_Borrow (ir_graph *irg, ir_node *block,
2384 ir_node *op1, ir_node *op2, ir_mode *mode);
2386 /** Constructor for a Phi node.
2388 * @param *irg The ir graph the node belongs to.
2389 * @param *block The ir block the node belongs to.
2390 * @param arity The number of predecessors
2391 * @param *in[] Array with predecessors. The constructor copies this array.
2392 * @param *mode The mode of it's inputs and output.
2394 ir_node *new_r_Phi (ir_graph *irg, ir_node *block, int arity,
2395 ir_node *in[], ir_mode *mode);
2397 /** Constructor for a Load node.
2399 * @param *irg The ir graph the node belongs to.
2400 * @param *block The ir block the node belongs to.
2401 * @param *store The current memory
2402 * @param *adr A pointer to the variable to be read in this memory.
2403 * @param *mode The mode of the value to be loaded.
2405 ir_node *new_r_Load (ir_graph *irg, ir_node *block,
2406 ir_node *store, ir_node *adr, ir_mode *mode);
2408 /** Constructor for a Store node.
2410 * @param *irg The ir graph the node belongs to.
2411 * @param *block The ir block the node belongs to.
2412 * @param *store The current memory
2413 * @param *adr A pointer to the variable to be read in this memory.
2414 * @param *val The value to write to this variable.
2416 ir_node *new_r_Store (ir_graph *irg, ir_node *block,
2417 ir_node *store, ir_node *adr, ir_node *val);
2419 /** Constructor for a Alloc node.
2421 * The Alloc node extends the memory by space for an entity of type alloc_type.
2423 * @param *irg The ir graph the node belongs to.
2424 * @param *block The ir block the node belongs to.
2425 * @param *store The memory which shall contain the new variable.
2426 * @param *size The number of bytes to allocate.
2427 * @param *alloc_type The type of the allocated variable.
2428 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
2430 ir_node *new_r_Alloc (ir_graph *irg, ir_node *block, ir_node *store,
2431 ir_node *size, ir_type *alloc_type, where_alloc where);
2433 /** Constructor for a Free node.
2435 * Frees the memory occupied by the entity pointed to by the pointer
2436 * arg. Type indicates the type of the entity the argument points to.
2438 * @param *irg The ir graph the node belongs to.
2439 * @param *block The ir block the node belongs to.
2440 * @param *store The memory which shall contain the new variable.
2441 * @param *ptr The pointer to the object to free.
2442 * @param *size The number of objects of type free_type to free in a sequence.
2443 * @param *free_type The type of the freed variable.
2444 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
2446 ir_node *new_r_Free (ir_graph *irg, ir_node *block, ir_node *store,
2447 ir_node *ptr, ir_node *size, ir_type *free_type, where_alloc where);
2449 /** Constructor for a Sync node.
2451 * Merges several memory values. The node assumes that a variable
2452 * either occurs only in one of the memories, or it contains the same
2453 * value in all memories where it occurs.
2455 * @param *irg The ir graph the node belongs to.
2456 * @param *block The ir block the node belongs to.
2457 * @param arity The number of memories to synchronize.
2458 * @param *in[] An array of pointers to nodes that produce an output of type memory.
2459 * The constructor copies this array.
2461 ir_node *new_r_Sync (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2463 /** Constructor for a Proj node.
2465 * Projects a single value out of a tuple. The parameter proj gives the
2466 * position of the value within the tuple.
2468 * @param *irg The ir graph the node belongs to.
2469 * @param *block The ir block the node belongs to.
2470 * @param arg A node producing a tuple.
2471 * @param *mode The mode of the value to project.
2472 * @param proj The position of the value in the tuple.
2474 ir_node *new_r_Proj (ir_graph *irg, ir_node *block, ir_node *arg,
2475 ir_mode *mode, long proj);
2477 /** Constructor for a defaultProj node.
2479 * Represents the default control flow of a Switch-Cond node.
2481 * @param *irg The ir graph the node belongs to.
2482 * @param *block The ir block the node belongs to.
2483 * @param arg A node producing a tuple.
2484 * @param max_proj The end position of the value in the tuple.
2486 ir_node *new_r_defaultProj (ir_graph *irg, ir_node *block, ir_node *arg, long max_proj);
2489 /** Constructor for a Tuple node.
2491 * This is an auxiliary node to replace a node that returns a tuple
2492 * without changing the corresponding Proj nodes.
2494 * @param *irg The ir graph the node belongs to.
2495 * @param *block The ir block the node belongs to.
2496 * @param arity The number of tuple elements.
2497 * @param *in[] An array containing pointers to the nodes producing the tuple elements.
2498 * The constructor copies this array.
2500 ir_node *new_r_Tuple (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2502 /** Constructor for a Id node.
2504 * This is an auxiliary node to replace a node that returns a single
2507 * @param *irg The ir graph the node belongs to.
2508 * @param *block The ir block the node belongs to.
2509 * @param *val The operand to Id.
2510 * @param *mode The mode of *val.
2512 ir_node *new_r_Id (ir_graph *irg, ir_node *block,
2513 ir_node *val, ir_mode *mode);
2515 /** Constructor for a Bad node.
2517 * Returns the unique Bad node of the graph. The same as
2520 * @param *irg The ir graph the node belongs to.
2523 ir_node *new_r_Bad (ir_graph *irg);
2525 /** Constructor for a Confirm node.
2527 * Specifies constraints for a value. To support dataflow analyses.
2529 * Example: If the value never exceeds '100' this is expressed by placing a
2530 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
2532 * @param *irg The ir graph the node belong to.
2533 * @param *block The ir block the node belong to.
2534 * @param *val The value we express a constraint for
2535 * @param *bound The value to compare against. Must be a firm node, typically a constant.
2536 * @param cmp The compare operation.
2538 ir_node *new_r_Confirm (ir_graph *irg, ir_node *block,
2539 ir_node *val, ir_node *bound, pn_Cmp cmp);
2541 /** Constructor for a Unknown node.
2543 * Represents an arbitrary value. Places the node in
2546 * @param *irg The ir graph the node belongs to.
2547 * @param *m The mode of the unknown value.
2549 ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2551 /** Constructor for a CallBegin node.
2553 * CallBegin represents control flow depending of the pointer value
2554 * representing the called method to the called methods. The
2555 * constructor copies the method pointer input from the passed Call
2558 * @param *irg The ir graph the node belong to.
2559 * @param *block The block the node belong to.
2560 * @param *callee The call node visible in the intra procedural view.
2562 ir_node *new_r_CallBegin(ir_graph *irg, ir_node *block, ir_node *callee);
2564 /** Constructor for a EndReg node.
2566 * Used to represent regular procedure end in interprocedual view.
2568 * @param *irg The ir graph the node belong to.
2569 * @param *block The block the node belong to.
2571 ir_node *new_r_EndReg (ir_graph *irg, ir_node *block);
2573 /** Constructor for a EndExcept node.
2575 * Used to represent exceptional procedure end in interprocedural view.
2577 * @param *irg The ir graph the node belong to.
2578 * @param *block The block the node belong to.
2580 ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
2582 /** Constructor for a Break node.
2584 * Break represents control flow to a single control successor just as Jmp.
2585 * The blocks separated by a break may not be concatenated by an optimization.
2586 * It is used for the interprocedural representation where blocks are parted
2587 * behind Call nodes to represent the control flow to called procedures.
2589 * @param *irg The ir graph the node belong to.
2590 * @param *block The block the node belong to.
2592 ir_node *new_r_Break (ir_graph *irg, ir_node *block);
2594 /** Constructor for a Filter node.
2596 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
2597 * Filter is a node with two views used to construct the interprocedural view.
2598 * In intraprocedural view its semantics are identical to the Proj node.
2599 * In interprocedural view the Filter performs the Phi operation on method
2600 * parameters or results. Other than a Phi a Filter node may not be removed
2601 * if it has only a single input.
2603 * The constructor builds the Filter in intraprocedural view.
2605 * @param *irg The ir graph the node belong to.
2606 * @param *block The block the node belong to.
2607 * @param *arg The tuple value to project from.
2608 * @param *mode The mode of the projected value.
2609 * @param proj The position in the tuple to project from.
2611 ir_node *new_r_Filter (ir_graph *irg, ir_node *block, ir_node *arg,
2612 ir_mode *mode, long proj);
2614 /** Constructor for a NoMem node.
2616 * Returns the unique NoMem node of the graph. The same as
2619 * @param *irg The ir graph the node belongs to.
2621 ir_node *new_r_NoMem (ir_graph *irg);
2623 /** Constructor for a Mux node.
2625 * @param *irg The ir graph the node belong to.
2626 * @param *block The block the node belong to.
2627 * @param *sel The ir_node that calculates the boolean select.
2628 * @param *ir_true The ir_node that calculates the true result.
2629 * @param *ir_false The ir_node that calculates the false result.
2630 * @param *mode The mode of the node (and it_true and ir_false).
2632 ir_node *new_r_Mux (ir_graph *irg, ir_node *block,
2633 ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2635 /** Constructor for a Psi node.
2637 * @param *irg The ir graph the node belong to.
2638 * @param *block The block the node belong to.
2639 * @param *arity The arity of the conditions
2640 * @param *conds The array of mode_b conditions, length must be equal arity
2641 * @param *vals The array of mode values, length must be equal arity + 1
2642 * @param *mode The mode of the node (must be the mode of all vals).
2644 ir_node *new_r_Psi (ir_graph *irg, ir_node *block,
2645 int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
2647 /** Constructor for a CopyB node.
2649 * @param *irg The ir graph the node belong to.
2650 * @param *block The block the node belong to.
2651 * @param *store The current memory
2652 * @param *dst The ir_node that represents the destination address.
2653 * @param *src The ir_node that represents the source address.
2654 * @param *data_type The type of the copied data
2656 ir_node *new_r_CopyB(ir_graph *irg, ir_node *block,
2657 ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
2659 /** Constructor for a InstOf node.
2661 * A High-Level Type check.
2663 * @param *irg The ir graph the node belongs to.
2664 * @param *block The ir block the node belongs to.
2665 * @param *store The memory in which the object the entity should be selected
2666 * from is allocated.
2667 * @param *objptr A pointer to a object of a class type.
2668 * @param *type The type of which objptr must be.
2670 ir_node *new_r_InstOf (ir_graph *irg, ir_node *block, ir_node *store,
2671 ir_node *objptr, ir_type *type);
2673 /** Constructor for a Raise node.
2675 * A High-Level Exception throw.
2677 * @param *irg The ir graph the node belongs to.
2678 * @param *block The ir block the node belongs to.
2679 * @param *store The current memory.
2680 * @param *obj A pointer to the Except variable.
2682 ir_node *new_r_Raise (ir_graph *irg, ir_node *block,
2683 ir_node *store, ir_node *obj);
2685 /** Constructor for a Bound node.
2687 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2689 * @param *irg The ir graph the node belong to.
2690 * @param *block The block the node belong to.
2691 * @param *store The current memory
2692 * @param *idx The ir_node that represents an index.
2693 * @param *lower The ir_node that represents the lower bound for the index.
2694 * @param *upper The ir_node that represents the upper bound for the index.
2696 ir_node *new_r_Bound(ir_graph *irg, ir_node *block,
2697 ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
2699 /*-----------------------------------------------------------------------*/
2700 /* The block oriented interface */
2701 /*-----------------------------------------------------------------------*/
2703 /** Sets the current block in which the following constructors place the
2704 * nodes they construct.
2706 * @param target The new current block.
2708 void set_cur_block (ir_node *target);
2710 /** Returns the current block of the current graph. */
2711 ir_node *get_cur_block(void);
2713 /** Returns the fixed nodes of the current graph. */
2714 #define get_cur_end_block() get_irg_end_block(current_ir_graph)
2715 #define get_cur_end() get_irg_end(current_ir_graph)
2716 #define get_cur_start_block() get_irg_start_block(current_ir_graph)
2717 #define get_cur_start() get_irg_start(current_ir_graph)
2719 /** Constructor for a Block node.
2721 * Adds the block to the graph in current_ir_graph. Constructs a Block
2722 * with a fixed number of predecessors. Does set current_block. Can
2723 * be used with automatic Phi node construction.
2725 * @param *db A Pointer for debug information.
2726 * @param arity The number of control predecessors.
2727 * @param in[] An array of control predecessors. The length of
2728 * the array must be 'arity'.
2730 ir_node *new_d_Block(dbg_info *db, int arity, ir_node *in[]);
2732 /** Constructor for a Start node.
2734 * Adds the node to the block in current_ir_block.
2736 * @param *db A pointer for debug information.
2738 ir_node *new_d_Start (dbg_info *db);
2740 /** Constructor for a End node.
2742 * Adds the node to the block in current_ir_block.
2744 * @param *db A pointer for debug information.
2746 ir_node *new_d_End (dbg_info *db);
2748 /** Constructor for a Jmp node.
2750 * Adds the node to the block in current_ir_block.
2752 * Jmp represents control flow to a single control successor.
2754 * @param *db A pointer for debug information.
2756 ir_node *new_d_Jmp (dbg_info *db);
2758 /** Constructor for an IJmp node.
2760 * IJmp represents control flow to a single control successor not
2761 * statically known i.e. an indirect Jmp.
2763 * @param *db A pointer for debug information.
2764 * @param *tgt The ir node representing the target address.
2766 ir_node *new_d_IJmp (dbg_info *db, ir_node *tgt);
2768 /** Constructor for a Cond node.
2770 * Adds the node to the block in current_ir_block.
2772 * If c is mode_b represents a conditional branch (if/else). If c is
2773 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2774 * node, default Proj is 0.)
2776 * This is not consistent: Input to Cond is Is, Proj has as proj number
2779 * @param *db A pointer for debug information.
2780 * @param *c The conditions parameter.Can be of mode b or I_u.
2782 ir_node *new_d_Cond (dbg_info *db, ir_node *c);
2784 /** Constructor for a Return node.
2786 * Adds the node to the block in current_ir_block.
2788 * Returns the memory an zero or more return values. Only node that
2789 * can end regular control flow.
2791 * @param *db A pointer for debug information.
2792 * @param *store The state of memory.
2793 * @param arity Number of array indices.
2794 * @param *in Array with index inputs to the node.
2796 ir_node *new_d_Return (dbg_info *db, ir_node *store, int arity, ir_node *in[]);
2798 /** Constructor for a Const_type node.
2800 * Adds the node to the block in current_ir_block.
2802 * The constant represents a target value. This constructor sets high
2803 * level type information for the constant value.
2805 * @param *db A pointer for debug information.
2806 * @param *mode The mode of the operands and results.
2807 * @param *con Points to an entry in the constant table. This pointer is
2808 added to the attributes of the node.
2809 * @param *tp The type of the constant.
2811 ir_node *new_d_Const_type (dbg_info *db, ir_mode *mode, tarval *con, ir_type *tp);
2813 /** Constructor for a Const node.
2815 * Adds the node to the block in current_ir_block.
2817 * Constructor for a Const node. The constant represents a target
2818 * value. Sets the type information to type_unknown. (No more
2819 * supported: If tv is entity derives a somehow useful type.)
2821 * @param *db A pointer for debug information.
2822 * @param *mode The mode of the operands and results.
2823 * @param *con Points to an entry in the constant table. This pointer is added
2824 * to the attributes of the node.
2826 ir_node *new_d_Const (dbg_info *db, ir_mode *mode, tarval *con);
2828 /** Constructor for a SymConst_type node.
2830 * Adds the node to the block in current_ir_block.
2831 * This is the constructor for a symbolic constant.
2832 * There are four kinds of symbolic constants:
2833 * - type_tag The symbolic constant represents a type tag. The type the
2834 * tag stands for is given explicitly.
2835 * - size The symbolic constant represents the size of a type. The
2836 * type of which the constant represents the size is given
2838 * - addr_name The symbolic constant represents the address of an entity
2839 * (variable or method). The variable is indicated by a name
2840 * that is valid for linking.
2841 * - addr_ent The symbolic constant represents the address of an entity
2842 * (variable or method). The variable is given explicitly by
2845 * Inputs to the node:
2846 * No inputs except the block it belongs to.
2847 * Outputs of the node.
2848 * An unsigned integer (I_u) or a pointer (P).
2850 * @param *db A pointer for debug information.
2851 * @param value A type, entity or ident depending on the SymConst kind.
2852 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_size
2853 * or symconst_addr_name.
2854 * @param tp The source type of the constant.
2856 ir_node *new_d_SymConst_type (dbg_info *db, union symconst_symbol value, symconst_kind kind, ir_type *tp);
2858 /** Constructor for a SymConst node.
2860 * Same as new_d_SymConst_type, except that it sets the type to type_unknown. */
2861 ir_node *new_d_SymConst (dbg_info *db, union symconst_symbol value, symconst_kind kind);
2863 /** Constructor for a simpleSel node.
2865 * This is a shortcut for the new_d_Sel() constructor. To be used for
2866 * Sel nodes that do not select from an array, i.e., have no index
2867 * inputs. It adds the two parameters 0, NULL.
2869 * @param *db A pointer for debug information.
2870 * @param *store The memory in which the object the entity should be
2871 * selected from is allocated.
2872 * @param *objptr The object from that the Sel operation selects a
2873 * single attribute out.
2874 * @param *ent The entity to select.
2876 ir_node *new_d_simpleSel(dbg_info *db, ir_node *store, ir_node *objptr, entity *ent);
2878 /** Constructor for a Sel node.
2880 * The select node selects an entity (field or method) from an entity
2881 * with a compound type. It explicitly specifies the entity selected.
2882 * Dynamically the node may select entities that overwrite the given
2883 * entity. If the selected entity is an array element entity the Sel
2884 * node takes the required array indices as inputs.
2885 * Adds the node to the block in current_ir_block.
2887 * @param *db A pointer for debug information.
2888 * @param *store The memory in which the object the entity should be selected
2889 * from is allocated.
2890 * @param *objptr A pointer to a compound entity the Sel operation selects a
2891 * single attribute from.
2892 * @param arity The number of array indices needed to select an array element entity.
2893 * @param *in[] If the compound entity is an array the indices of the selected
2894 * element entity. The constructor copies this array.
2895 * @param *ent The entity to select.
2897 ir_node *new_d_Sel (dbg_info *db, ir_node *store, ir_node *objptr, int arity, ir_node *in[],
2900 /** Constructor for a Call node.
2902 * Represents all kinds of method and function calls.
2903 * Adds the node to the block in current_ir_block.
2905 * @param *db A pointer for debug information.
2906 * @param *store The actual store.
2907 * @param *callee A pointer to the called procedure.
2908 * @param arity The number of procedure parameters.
2909 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2910 * @param *tp Type information of the procedure called.
2912 ir_node *new_d_Call (dbg_info *db, ir_node *store, ir_node *callee, int arity, ir_node *in[],
2915 /** Constructor for a Add node.
2917 * Adds the node to the block in current_ir_block.
2919 * @param *db A pointer for debug information.
2920 * @param *op1 The first operand.
2921 * @param *op2 The second operand.
2922 * @param *mode The mode of the operands and the result.
2924 ir_node *new_d_Add (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2926 /** Constructor for a Sub node.
2928 * Adds the node to the block in current_ir_block.
2930 * @param *db A pointer for debug information.
2931 * @param *op1 The first operand.
2932 * @param *op2 The second operand.
2933 * @param *mode The mode of the operands and the result.
2935 ir_node *new_d_Sub (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2937 /** Constructor for a Minus node.
2939 * Adds the node to the block in current_ir_block.
2941 * @param *db A pointer for debug information.
2942 * @param *op The operand .
2943 * @param *mode The mode of the operand and the result.
2945 ir_node *new_d_Minus (dbg_info *db, ir_node *op, ir_mode *mode);
2947 /** Constructor for a Mul node.
2949 * Adds the node to the block in current_ir_block.
2951 * @param *db A pointer for debug information.
2952 * @param *op1 The first operand.
2953 * @param *op2 The second operand.
2954 * @param *mode The mode of the operands and the result.
2956 ir_node *new_d_Mul (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2958 /** Constructor for a Quot node.
2960 * Adds the node to the block in current_ir_block.
2962 * @param *db A pointer for debug information.
2963 * @param *memop The store needed to model exceptions
2964 * @param *op1 The first operand.
2965 * @param *op2 The second operand.
2967 ir_node *new_d_Quot (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
2969 /** Constructor for a DivMod node.
2971 * Adds the node to the block in current_ir_block.
2973 * @param *db A pointer for debug information.
2974 * @param *memop The store needed to model exceptions
2975 * @param *op1 The first operand.
2976 * @param *op2 The second operand.
2978 ir_node *new_d_DivMod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
2980 /** Constructor for a Div node.
2982 * Adds the node to the block in current_ir_block.
2984 * @param *db A pointer for debug information.
2985 * @param *memop The store needed to model exceptions
2986 * @param *op1 The first operand.
2987 * @param *op2 The second operand.
2989 ir_node *new_d_Div (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
2991 /** Constructor for a Mod node.
2993 * Adds the node to the block in current_ir_block.
2995 * @param *db A pointer for debug information.
2996 * @param *memop The store needed to model exceptions
2997 * @param *op1 The first operand.
2998 * @param *op2 The second operand.
3000 ir_node *new_d_Mod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
3002 /** Constructor for a Abs node.
3004 * Adds the node to the block in current_ir_block.
3006 * @param *db A pointer for debug information.
3007 * @param *op The operand
3008 * @param *mode The mode of the operands and the result.
3010 ir_node *new_d_Abs (dbg_info *db, ir_node *op, ir_mode *mode);
3012 /** Constructor for a And node.
3014 * Adds the node to the block in current_ir_block.
3016 * @param *db A pointer for debug information.
3017 * @param *op1 The first operand.
3018 * @param *op2 The second operand.
3019 * @param *mode The mode of the operands and the result.
3021 ir_node *new_d_And (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3023 /** Constructor for a Or node.
3025 * Adds the node to the block in current_ir_block.
3027 * @param *db A pointer for debug information.
3028 * @param *op1 The first operand.
3029 * @param *op2 The second operand.
3030 * @param *mode The mode of the operands and the result.
3032 ir_node *new_d_Or (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3034 /** Constructor for a Eor node.
3036 * Adds the node to the block in current_ir_block.
3038 * @param *db A pointer for debug information.
3039 * @param *op1 The first operand.
3040 * @param *op2 The second operand.
3041 * @param *mode The mode of the operands and the results.
3043 ir_node *new_d_Eor (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3045 /** Constructor for a Not node.
3047 * Adds the node to the block in current_ir_block.
3049 * @param *db A pointer for debug information.
3050 * @param *op The operand.
3051 * @param *mode The mode of the operand and the result.
3053 ir_node *new_d_Not (dbg_info *db, ir_node *op, ir_mode *mode);
3055 /** Constructor for a Shl node.
3057 * Adds the node to the block in current_ir_block.
3059 * @param *db A pointer for debug information.
3060 * @param *op The operand.
3061 * @param *k The number of bits to shift the operand .
3062 * @param *mode The mode of the operand and the result.
3064 ir_node *new_d_Shl (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3066 /** Constructor for a Shr node.
3068 * Adds the node to the block in current_ir_block.
3070 * @param *db A pointer for debug information.
3071 * @param *op The operand.
3072 * @param *k The number of bits to shift the operand .
3073 * @param *mode The mode of the operand and the result.
3075 ir_node *new_d_Shr (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3077 /** Constructor for a Shrs node.
3079 * Adds the node to the block in current_ir_block.
3081 * @param *db A pointer for debug information.
3082 * @param *op The operand.
3083 * @param *k The number of bits to shift the operand .
3084 * @param *mode The mode of the operand and the result.
3086 ir_node *new_d_Shrs (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3088 /** Constructor for a Rot node.
3090 * Adds the node to the block in current_ir_block.
3092 * @param *db A pointer for debug information.
3093 * @param *op The operand.
3094 * @param *k The number of bits to rotate the operand.
3095 * @param *mode The mode of the operand.
3097 ir_node *new_d_Rot (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3099 /** Constructor for a Cmp node.
3101 * Adds the node to the block in current_ir_block.
3103 * @param *db A pointer for debug information.
3104 * @param *op1 The first operand.
3105 * @param *op2 The second operand.
3107 ir_node *new_d_Cmp (dbg_info *db, ir_node *op1, ir_node *op2);
3109 /** Constructor for a Conv node.
3111 * Adds the node to the block in current_ir_block.
3113 * @param *db A pointer for debug information.
3114 * @param *op The operand.
3115 * @param *mode The mode of this the operand muss be converted .
3117 ir_node *new_d_Conv (dbg_info *db, ir_node *op, ir_mode *mode);
3119 /** Constructor for a Cast node.
3121 * High level type cast
3122 * Adds the node to the block in current_ir_block.
3124 * @param *db A pointer for debug information.
3125 * @param *op The operand.
3126 * @param *to_tp The type of this the operand muss be casted .
3128 ir_node *new_d_Cast (dbg_info *db, ir_node *op, ir_type *to_tp);
3130 /** Constructor for a Carry node.
3132 * Adds the node to the block in current_ir_block.
3134 * @param *db A pointer for debug information.
3135 * @param *op1 The first operand.
3136 * @param *op2 The second operand.
3137 * @param *mode The mode of the operands and the result.
3139 ir_node *new_d_Carry (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3141 /** Constructor for a Borrow node.
3143 * Adds the node to the block in current_ir_block.
3145 * @param *db A pointer for debug information.
3146 * @param *op1 The first operand.
3147 * @param *op2 The second operand.
3148 * @param *mode The mode of the operands and the result.
3150 ir_node *new_d_Borrow (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3152 /** Constructor for a Phi node.
3154 * Adds the node to the block in current_ir_block.
3156 * @param *db A pointer for debug information.
3157 * @param arity The number of predecessors
3158 * @param *in Array with predecessors
3159 * @param *mode The mode of it's inputs and output.
3161 ir_node *new_d_Phi (dbg_info *db, int arity, ir_node *in[], ir_mode *mode);
3163 /** Constructor for a Load node.
3165 * Adds the node to the block in current_ir_block.
3167 * @param *db A pointer for debug information.
3168 * @param *store The current memory
3169 * @param *addr A pointer to the variable to be read in this memory.
3170 * @param *mode The mode of the value to be loaded.
3172 ir_node *new_d_Load (dbg_info *db, ir_node *store, ir_node *addr, ir_mode *mode);
3174 /** Constructor for a Store node.
3176 * Adds the node to the block in current_ir_block.
3178 * @param *db A pointer for debug information.
3179 * @param *store The current memory
3180 * @param *addr A pointer to the variable to be read in this memory.
3181 * @param *val The value to write to this variable.
3183 ir_node *new_d_Store (dbg_info *db, ir_node *store, ir_node *addr, ir_node *val);
3185 /** Constructor for a Alloc node.
3187 * The Alloc node extends the memory by space for an entity of type alloc_type.
3188 * Adds the node to the block in current_ir_block.
3190 * @param *db A pointer for debug information.
3191 * @param *store The memory which shall contain the new variable.
3192 * @param *size The number of bytes to allocate.
3193 * @param *alloc_type The type of the allocated variable.
3194 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3196 ir_node *new_d_Alloc (dbg_info *db, ir_node *store, ir_node *size, ir_type *alloc_type,
3199 /** Constructor for a Free node.
3201 * Frees the memory occupied by the entity pointed to by the pointer
3202 * arg. Type indicates the type of the entity the argument points to.
3203 * Adds the node to the block in current_ir_block.
3205 * @param *db A pointer for debug information.
3206 * @param *store The memory which shall contain the new variable.
3207 * @param *ptr The pointer to the object to free.
3208 * @param *size The number of objects of type free_type to free in a sequence.
3209 * @param *free_type The type of the freed variable.
3210 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
3212 ir_node *new_d_Free (dbg_info *db, ir_node *store, ir_node *ptr, ir_node *size,
3213 ir_type *free_type, where_alloc where);
3215 /** Constructor for a Sync node.
3217 * Merges several memory values. The node assumes that a variable
3218 * either occurs only in one of the memories, or it contains the same
3219 * value in all memories where it occurs.
3220 * Adds the node to the block in current_ir_block.
3222 * @param *db A pointer for debug information.
3223 * @param arity The number of memories to synchronize.
3224 * @param **in An array of pointers to nodes that produce an output of type
3225 * memory. The constructor copies this array.
3227 ir_node *new_d_Sync (dbg_info *db, int arity, ir_node *in[]);
3229 /** Constructor for a Proj node.
3231 * Projects a single value out of a tuple. The parameter proj gives the
3232 * position of the value within the tuple.
3233 * Adds the node to the block in current_ir_block.
3235 * @param *db A pointer for deubug information.
3236 * @param arg A node producing a tuple.
3237 * @param *mode The mode of the value to project.
3238 * @param proj The position of the value in the tuple.
3240 ir_node *new_d_Proj (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3242 /** Constructor for a defaultProj node.
3244 * Represents the default control flow of a Switch-Cond node.
3245 * Adds the node to the block in current_ir_block.
3247 * @param *db A pointer for debug information.
3248 * @param arg A node producing a tuple.
3249 * @param max_proj The end position of the value in the tuple.
3251 ir_node *new_d_defaultProj (dbg_info *db, ir_node *arg, long max_proj);
3253 /** Constructor for a Tuple node.
3255 * This is an auxiliary node to replace a node that returns a tuple
3256 * without changing the corresponding Proj nodes.
3257 * Adds the node to the block in current_ir_block.
3259 * @param *db A pointer for debug information.
3260 * @param arity The number of tuple elements.
3261 * @param **in An array containing pointers to the nodes producing the tuple elements.
3263 ir_node *new_d_Tuple (dbg_info *db, int arity, ir_node *in[]);
3265 /** Constructor for a Id node.
3267 * This is an auxiliary node to replace a node that returns a single
3268 * value. Adds the node to the block in current_ir_block.
3270 * @param *db A pointer for debug information.
3271 * @param *val The operand to Id.
3272 * @param *mode The mode of *val.
3274 ir_node *new_d_Id (dbg_info *db, ir_node *val, ir_mode *mode);
3276 /** Constructor for a Bad node.
3278 * Returns the unique Bad node of the graph. The same as
3281 ir_node *new_d_Bad (void);
3283 /** Constructor for a Confirm node.
3285 * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3286 * Specifies constraints for a value. To support dataflow analyses.
3288 * Example: If the value never exceeds '100' this is expressed by placing a
3289 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
3291 * @param *db A pointer for debug information.
3292 * @param *val The value we express a constraint for
3293 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3294 * @param cmp The compare operation.
3296 ir_node *new_d_Confirm (dbg_info *db, ir_node *val, ir_node *bound, pn_Cmp cmp);
3298 /** Constructor for an Unknown node.
3300 * Represents an arbitrary value. Places the node in
3303 * @param *m The mode of the unknown value.
3305 ir_node *new_d_Unknown(ir_mode *m);
3307 /** Constructor for a CallBegin node.
3309 * CallBegin represents control flow depending of the pointer value
3310 * representing the called method to the called methods. The
3311 * constructor copies the method pointer input from the passed Call
3312 * node.Adds the node to the block in current_ir_block.
3314 * @param *db A pointer for debug information.
3315 * @param *callee The call node visible in the intra procedural view.
3317 ir_node *new_d_CallBegin(dbg_info *db, ir_node *callee);
3319 /** Constructor for an EndReg node.
3321 *Adds the node to the block in current_ir_block.
3323 * @param *db A pointer for debug information.
3325 ir_node *new_d_EndReg (dbg_info *db);
3327 /** Constructor for an EndExcept node.
3329 * Used to represent regular procedure end in interprocedual view.
3330 * Adds the node to the block in current_ir_block.
3332 * @param *db A pointer for debug information.
3334 ir_node *new_d_EndExcept(dbg_info *db);
3336 /** Constructor for a Break node.
3338 * Used to represent exceptional procedure end in interprocedural view.
3339 * Adds the node to the block in current_ir_block.
3341 * Break represents control flow to a single control successor just as Jmp.
3342 * The blocks separated by a break may not be concatenated by an optimization.
3343 * It is used for the interprocedural representation where blocks are parted
3344 * behind Call nodes to represent the control flow to called procedures.
3346 * @param *db A pointer for debug information.
3348 ir_node *new_d_Break (dbg_info *db);
3350 /** Constructor for a Filter node.
3352 * Constructor for a Filter node. Adds the node to the block in
3353 * current_ir_block. Filter is a node with two views used to
3354 * construct the interprocedural view. In intraprocedural view its
3355 * semantics are identical to the Proj node. In interprocedural view
3356 * the Filter performs the Phi operation on method parameters or
3357 * results. Other than a Phi a Filter node may not be removed if it
3358 * has only a single input.
3360 * The constructor builds the Filter in intraprocedural view.
3362 * @param *db A pointer for debug information.
3363 * @param *arg The tuple value to project from.
3364 * @param *mode The mode of the projected value.
3365 * @param proj The position in the tuple to project from.
3367 ir_node *new_d_Filter (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3370 /** Constructor for a NoMem node.
3372 * Returns the unique NoMem node of the graph. The same as
3375 ir_node *new_d_NoMem (void);
3377 /** Constructor for a Mux node.
3379 * @param *db A pointer for debug information.
3380 * @param *sel The ir_node that calculates the boolean select.
3381 * @param *ir_true The ir_node that calculates the true result.
3382 * @param *ir_false The ir_node that calculates the false result.
3383 * @param *mode The mode of the node (and it_true and ir_false).
3385 ir_node *new_d_Mux (dbg_info *db, ir_node *sel,
3386 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
3388 /** Constructor for a Psi node.
3390 * @param *db A pointer for debug information.
3391 * @param *arity The arity of the conditions
3392 * @param *conds The array of mode_b conditions, length must be equal arity
3393 * @param *vals The array of mode values, length must be equal arity + 1
3394 * @param *mode The mode of the node (must be the mode of all vals).
3396 ir_node *new_d_Psi (dbg_info *db,
3397 int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
3399 /** Constructor for a CopyB node.
3401 * @param *db A pointer for debug information.
3402 * @param *store The current memory
3403 * @param *dst The ir_node that represents the destination address.
3404 * @param *src The ir_node that represents the source address.
3405 * @param *data_type The type of the copied data
3407 ir_node *new_d_CopyB(dbg_info *db, ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
3409 /** Constructor for a InstOf node.
3411 * A High-Level Type check.
3413 * @param *db A pointer for debug information.
3414 * @param *store The memory in which the object the entity should be selected
3415 * from is allocated.
3416 * @param *objptr A pointer to a object of a class type.
3417 * @param *type The type of which objptr must be.
3419 ir_node *new_d_InstOf (dbg_info *db, ir_node *store, ir_node *objptr, ir_type *type);
3421 /** Constructor for a Raise node.
3423 * A High-Level Exception throw.
3425 * @param *db A pointer for debug information.
3426 * @param *store The current memory.
3427 * @param *obj A pointer to the Except variable.
3429 ir_node *new_d_Raise (dbg_info *db, ir_node *store, ir_node *obj);
3431 /** Constructor for a Bound node.
3433 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
3435 * @param *db A pointer for debug information.
3436 * @param *store The current memory
3437 * @param *idx The ir_node that represents an index.
3438 * @param *lower The ir_node that represents the lower bound for the index.
3439 * @param *upper The ir_node that represents the upper bound for the index.
3441 ir_node *new_d_Bound(dbg_info *db, ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
3443 /*-----------------------------------------------------------------------*/
3444 /* The block oriented interface without debug support */
3445 /*-----------------------------------------------------------------------*/
3447 /* Needed from the interface with debug support:
3448 void set_cur_block (ir_node *target); */
3450 /** Constructor for a Block node.
3452 * Constructor for a Block node. Adds the block to the graph in
3453 * current_ir_graph. Constructs a Block with a fixed number of
3454 * predecessors. Does set current_block. Can be used with automatic
3455 * Phi node construction.
3457 * @param arity The number of control predecessors.
3458 * @param in An array of control predecessors. The length of
3459 * the array must be 'arity'.
3461 ir_node *new_Block(int arity, ir_node *in[]);
3463 /** Constructor for a Start node.
3465 * Adds the node to the block in current_ir_block.
3468 ir_node *new_Start (void);
3470 /** Constructor for an End node.
3472 * Adds the node to the block in current_ir_block.
3474 ir_node *new_End (void);
3476 /** Constructor for an EndReg node.
3478 * Used to represent regular procedure end in interprocedual view.
3479 * Adds the node to the block in current_ir_block.
3481 ir_node *new_EndReg (void);
3483 /** Constructor for an EndExpcept node.
3485 * Used to represent exceptional procedure end in interprocedural view.
3486 * Adds the node to the block in current_ir_block.
3488 ir_node *new_EndExcept(void);
3490 /** Constructor for a Jump node.
3492 * Adds the node to the block in current_ir_block.
3494 * Jmp represents control flow to a single control successor.
3496 ir_node *new_Jmp (void);
3498 /** Constructor for an IJmp node.
3500 * IJmp represents control flow to a single control successor not
3501 * statically known i.e. an indirect Jmp.
3503 * @param *tgt The ir node representing the target address.
3505 ir_node *new_IJmp (ir_node *tgt);
3507 /** Constructor for a Break node.
3508 * Break represents control flow to a single control successor just as Jmp.
3509 * The blocks separated by a break may not be concatenated by an optimization.
3510 * It is used for the interprocedural representation where blocks are parted
3511 * behind Call nodes to represent the control flow to called procedures.
3512 * Adds the node to the block in current_ir_block.
3514 ir_node *new_Break (void);
3516 /** Constructor for a Cond node.
3518 * If c is mode_b represents a conditional branch (if/else). If c is
3519 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
3520 * node, default Proj is 0.). Adds the node to the block in current_ir_block.
3522 * This is not consistent: Input to Cond is Is, Proj has as proj number
3526 * @param *c The conditions parameter.Can be of mode b or I_u.
3528 ir_node *new_Cond (ir_node *c);
3530 /** Constructor for a Return node.
3532 * Returns the memory an zero or more return values. Only node that
3533 * can end regular control flow. Adds the node to the block in current_ir_block.
3535 * @param *store The state of memory.
3536 * @param arity Number of array indices.
3537 * @param *in Array with index inputs to the node.
3539 ir_node *new_Return (ir_node *store, int arity, ir_node *in[]);
3541 /** Constructor for a Const node.
3543 * Constructor for a Const node. The constant represents a target
3544 * value. Sets the type information to type_unknown. (No more
3545 * supported: If tv is entity derives a somehow useful type.)
3546 * Adds the node to the block in current_ir_block.
3548 * @param *mode The mode of the operands and results.
3549 * @param *con Points to an entry in the constant table. This pointer is
3550 * added to the attributes of the node.
3552 ir_node *new_Const (ir_mode *mode, tarval *con);
3555 * Make a const from a long.
3556 * This is just convenience for the usual
3558 * new_Const(mode, tarval_from_long(mode, ...))
3561 * @param mode The mode for the const.
3562 * @param value The value of the constant.
3563 * @return A new const node.
3565 ir_node *new_Const_long(ir_mode *mode, long value);
3567 /** Constructor for a Const node.
3569 * Derives mode from passed type. */
3570 ir_node *new_Const_type(tarval *con, ir_type *tp);
3572 /** Constructor for a SymConst node.
3574 * Adds the node to the block in current_ir_block.
3575 * This is the constructor for a symbolic constant.
3576 * There are four kinds of symbolic constants:
3577 * -# type_tag The symbolic constant represents a type tag. The type the
3578 * tag stands for is given explicitly.
3579 * -# size The symbolic constant represents the size of a type. The
3580 * type of which the constant represents the size is given
3582 * -# addr_name The symbolic constant represents the address of an entity
3583 * (variable or method). The variable is indicated by a name
3584 * that is valid for linking.
3585 * -# addr_ent The symbolic constant represents the address of an entity
3586 * (variable or method). The variable is given explicitly by
3589 * Inputs to the node:
3590 * No inputs except the block it belongs to.
3591 * Outputs of the node.
3592 * An unsigned integer (I_u) or a pointer (P).
3594 * @param value A type or a ident depending on the SymConst kind.
3595 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_size or symconst_addr_name.
3597 ir_node *new_SymConst (union symconst_symbol value, symconst_kind kind);
3599 /** Constructor for a simpelSel node.
3601 * This is a shortcut for the new_Sel() constructor. To be used for
3602 * Sel nodes that do not select from an array, i.e., have no index
3603 * inputs. It adds the two parameters 0, NULL.
3605 * @param *store The memory in which the object the entity should be selected from is allocated.
3606 * @param *objptr The object from that the Sel operation selects a single attribute out.
3607 * @param *ent The entity to select.
3609 ir_node *new_simpleSel(ir_node *store, ir_node *objptr, entity *ent);
3611 /** Constructor for a Sel node.
3613 * The select node selects an entity (field or method) from an entity
3614 * with a compound type. It explicitly specifies the entity selected.
3615 * Dynamically the node may select entities that overwrite the given
3616 * entity. If the selected entity is an array element entity the Sel
3617 * node takes the required array indices as inputs.
3618 * Adds the node to the block in current_ir_block.
3620 * @param *store The memory in which the object the entity should be selected
3621 * from is allocated.
3622 * @param *objptr A pointer to a compound entity the Sel operation selects a
3623 * single attribute from.
3624 * @param arity The number of array indices needed to select an array element entity.
3625 * @param *in[] If the compound entity is an array the indices of the selected
3626 * element entity. The constructor copies this array.
3627 * @param *ent The entity to select.
3629 ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3632 /** Constructor for a Call node.
3634 * Adds the node to the block in current_ir_block.
3635 * Represents all kinds of method and function calls.
3637 * @param *store The actual store.
3638 * @param *callee A pointer to the called procedure.
3639 * @param arity The number of procedure parameters.
3640 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3641 * @param *tp Type information of the procedure called.
3643 ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node *in[],
3646 /** Constructor for a CallBegin node.
3648 * CallBegin represents control flow depending of the pointer value
3649 * representing the called method to the called methods. The
3650 * constructor copies the method pointer input from the passed Call
3651 * node. Adds the node to the block in current_ir_block.
3653 * @param *callee A pointer to the called procedure.
3655 ir_node *new_CallBegin(ir_node *callee);
3657 /** Constructor for a Add node.
3659 * Adds the node to the block in current_ir_block.
3661 * @param *op1 The first operand.
3662 * @param *op2 The second operand.
3663 * @param *mode The mode of the operands and the result.
3665 ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
3667 /** Constructor for a Sub node.
3669 * Adds the node to the block in current_ir_block.
3671 * @param *op1 The first operand.
3672 * @param *op2 The second operand.
3673 * @param *mode The mode of the operands and the result.
3675 ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
3677 /** Constructor for a Minus node.
3679 * Adds the node to the block in current_ir_block.
3681 * @param *op The operand .
3682 * @param *mode The mode of the operand and the result.
3684 ir_node *new_Minus (ir_node *op, ir_mode *mode);
3687 * Constructor for a Mul node. Adds the node to the block in current_ir_block.
3689 * @param *op1 The first operand.
3690 * @param *op2 The second operand.
3691 * @param *mode The mode of the operands and the result.
3693 ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
3695 /** Constructor for a Quot node.
3697 * Adds the node to the block in current_ir_block.
3699 * @param *memop The store needed to model exceptions
3700 * @param *op1 The first operand.
3701 * @param *op2 The second operand.
3703 ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2);
3705 /** Constructor for a DivMod node.
3707 * Adds the node to the block in current_ir_block.
3709 * @param *memop The store needed to model exceptions
3710 * @param *op1 The first operand.
3711 * @param *op2 The second operand.
3713 ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
3715 /** Constructor for a Div node.
3717 * Adds the node to the block in current_ir_block.
3719 * @param *memop The store needed to model exceptions
3720 * @param *op1 The first operand.
3721 * @param *op2 The second operand.
3723 ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2);
3725 /** Constructor for a Mod node.
3727 * Adds the node to the block in current_ir_block.
3729 * @param *memop The store needed to model exceptions
3730 * @param *op1 The first operand.
3731 * @param *op2 The second operand.
3733 ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2);
3735 /** Constructor for a Abs node.
3737 * Adds the node to the block in current_ir_block.
3739 * @param *op The operand
3740 * @param *mode The mode of the operands and the result.
3742 ir_node *new_Abs (ir_node *op, ir_mode *mode);
3744 /** Constructor for a And node.
3746 * Adds the node to the block in current_ir_block.
3748 * @param *op1 The first operand.
3749 * @param *op2 The second operand.
3750 * @param *mode The mode of the operands and the result.
3752 ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
3755 * Constructor for a Or node. Adds the node to the block in current_ir_block.
3757 * @param *op1 The first operand.
3758 * @param *op2 The second operand.
3759 * @param *mode The mode of the operands and the result.
3761 ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
3764 * Constructor for a Eor node. Adds the node to the block in current_ir_block.
3766 * @param *op1 The first operand.
3767 * @param *op2 The second operand.
3768 * @param *mode The mode of the operands and the results.
3770 ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
3772 /** Constructor for a Not node.
3774 * Adds the node to the block in current_ir_block.
3776 * @param *op The operand.
3777 * @param *mode The mode of the operand and the result.
3779 ir_node *new_Not (ir_node *op, ir_mode *mode);
3781 /** Constructor for a Shl node.
3783 * Adds the node to the block in current_ir_block.
3785 * @param *op The operand.
3786 * @param *k The number of bits to shift the operand .
3787 * @param *mode The mode of the operand and the result.
3789 ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
3792 * Constructor for a Shr node. Adds the node to the block in current_ir_block.
3794 * @param *op The operand.
3795 * @param *k The number of bits to shift the operand .
3796 * @param *mode The mode of the operand and the result.
3798 ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
3800 /** Constructor for a Shrs node.
3802 * Adds the node to the block in current_ir_block.
3804 * @param *op The operand.
3805 * @param *k The number of bits to shift the operand .
3806 * @param *mode The mode of the operand and the result.
3808 ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
3810 /** Constructor for a Rot node.
3812 * Adds the node to the block in current_ir_block.
3814 * @param *op The operand.
3815 * @param *k The number of bits to rotate the operand.
3816 * @param *mode The mode of the operand.
3818 ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode);
3820 /** Constructor for a Cmp node.
3822 * Adds the node to the block in current_ir_block.
3824 * @param *op1 The first operand.
3825 * @param *op2 The second operand.
3827 ir_node *new_Cmp (ir_node *op1, ir_node *op2);
3829 /** Constructor for a Conv node.
3831 * Adds the node to the block in current_ir_block.
3833 * @param *op The operand.
3834 * @param *mode The mode of this the operand muss be converted .
3836 ir_node *new_Conv (ir_node *op, ir_mode *mode);
3838 /** Constructor for a Cast node.
3840 * Adds the node to the block in current_ir_block.
3841 * High level type cast
3843 * @param *op The operand.
3844 * @param *to_tp The type of this the operand muss be casted .
3846 ir_node *new_Cast (ir_node *op, ir_type *to_tp);
3848 /** Constructor for a Carry node.
3850 * Adds the node to the block in current_ir_block.
3852 * @param *op1 The first operand.
3853 * @param *op2 The second operand.
3854 * @param *mode The mode of the operands and the result.
3856 ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode);
3858 /** Constructor for a Borrow node.
3860 * Adds the node to the block in current_ir_block.
3862 * @param *op1 The first operand.
3863 * @param *op2 The second operand.
3864 * @param *mode The mode of the operands and the result.
3866 ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode);
3868 /** Constructor for a Phi node.
3870 * Adds the node to the block in current_ir_block.
3872 * @param arity The number of predecessors.
3873 * @param *in Array with predecessors.
3874 * @param *mode The mode of it's inputs and output.
3876 ir_node *new_Phi (int arity, ir_node *in[], ir_mode *mode);
3878 /** Constructor for a Load node.
3880 * @param *store The current memory.
3881 * @param *addr A pointer to the variable to be read in this memory.
3882 * @param *mode The mode of the value to be loaded.
3884 ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode);
3886 /** Constructor for a Store node.
3888 * @param *store The current memory.
3889 * @param *addr A pointer to the variable to be read in this memory.
3890 * @param *val The value to write to this variable.
3892 ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
3894 /** Constructor for a Alloc node.
3896 * The Alloc node extends the memory by space for an entity of type alloc_type.
3897 * Adds the node to the block in current_ir_block.
3899 * @param *store The memory which shall contain the new variable.
3900 * @param *size The number of bytes to allocate.
3901 * @param *alloc_type The type of the allocated variable.
3902 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3904 ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
3907 /** Constructor for a Free node.
3909 * Frees the memory occupied by the entity pointed to by the pointer
3910 * arg. Type indicates the type of the entity the argument points to.
3911 * Adds the node to the block in current_ir_block.
3913 * @param *store The memory which shall contain the new variable.
3914 * @param *ptr The pointer to the object to free.
3915 * @param *size The number of objects of type free_type to free in a sequence.
3916 * @param *free_type The type of the freed variable.
3917 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
3919 ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
3920 ir_type *free_type, where_alloc where);
3922 /** Constructor for a Sync node.
3924 * Merges several memory values. The node assumes that a variable
3925 * either occurs only in one of the memories, or it contains the same
3926 * value in all memories where it occurs.
3927 * Adds the node to the block in current_ir_block.
3929 * @param arity The number of memories to synchronize.
3930 * @param **in An array of pointers to nodes that produce an output of type
3931 * memory. The constructor copies this array.
3933 ir_node *new_Sync (int arity, ir_node *in[]);
3935 /** Constructor for a Proj node.
3937 * Projects a single value out of a tuple. The parameter proj gives the
3938 * position of the value within the tuple.
3939 * Adds the node to the block in current_ir_block.
3941 * @param arg A node producing a tuple.
3942 * @param *mode The mode of the value to project.
3943 * @param proj The position of the value in the tuple.
3945 ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
3947 /** Constructor for a Filter node.
3949 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
3950 * Filter is a node with two views used to construct the interprocedural view.
3951 * In intraprocedural view its semantics are identical to the Proj node.
3952 * In interprocedural view the Filter performs the Phi operation on method
3953 * parameters or results. Other than a Phi a Filter node may not be removed
3954 * if it has only a single input.
3956 * The constructor builds the Filter in intraprocedural view.
3958 * @param *arg The tuple value to project from.
3959 * @param *mode The mode of the projected value.
3960 * @param proj The position in the tuple to project from.
3962 ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj);
3964 /** Constructor for a defaultProj node.
3966 * Represents the default control flow of a Switch-Cond node.
3967 * Adds the node to the block in current_ir_block.
3969 * @param arg A node producing a tuple.
3970 * @param max_proj The end position of the value in the tuple.
3972 ir_node *new_defaultProj (ir_node *arg, long max_proj);
3974 /** Constructor for a Tuple node.
3976 * This is an auxiliary node to replace a node that returns a tuple
3977 * without changing the corresponding Proj nodes.
3978 * Adds the node to the block in current_ir_block.
3980 * @param arity The number of tuple elements.
3981 * @param **in An array containing pointers to the nodes producing the tuple elements.
3983 ir_node *new_Tuple (int arity, ir_node *in[]);
3985 /** Constructor for an Id node.
3987 * This is an auxiliary node to replace a node that returns a single
3988 * value. Adds the node to the block in current_ir_block.
3990 * @param *val The operand to Id.
3991 * @param *mode The mode of *val.
3993 ir_node *new_Id (ir_node *val, ir_mode *mode);
3995 /** Constructor for a Bad node.
3997 * Returns the unique Bad node of the graph. The same as
4000 ir_node *new_Bad (void);
4002 /** Constructor for a Confirm node.
4004 * Specifies constraints for a value. To support dataflow analyses.
4005 * Adds the node to the block in current_ir_block.
4007 * Example: If the value never exceeds '100' this is expressed by placing a
4008 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
4010 * @param *val The value we express a constraint for
4011 * @param *bound The value to compare against. Must be a firm node, typically a constant.
4012 * @param cmp The compare operation.
4014 ir_node *new_Confirm (ir_node *val, ir_node *bound, pn_Cmp cmp);
4016 /** Constructor for an Unknown node.
4018 * Represents an arbitrary value. Places the node in
4021 * @param *m The mode of the unknown value.
4023 ir_node *new_Unknown(ir_mode *m);
4025 /** Constructor for a NoMem node.
4027 * Returns the unique NoMem node of the graph. The same as
4030 ir_node *new_NoMem (void);
4032 /** Constructor for a Mux node.
4034 * Adds the node to the block in current_ir_block.
4036 * @param *sel The ir_node that calculates the boolean select.
4037 * @param *ir_true The ir_node that calculates the true result.
4038 * @param *ir_false The ir_node that calculates the false result.
4039 * @param *mode The mode of the node (and it_true and ir_false).
4041 ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
4043 /** Constructor for a Psi node.
4045 * @param *arity The arity of the conditions
4046 * @param *conds The array of mode_b conditions, length must be equal arity
4047 * @param *vals The array of mode values, length must be equal arity + 1
4048 * @param *mode The mode of the node (must be the mode of all vals).
4050 ir_node *new_Psi (int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
4052 /** Constructor for a CopyB node.
4054 * Adds the node to the block in current_ir_block.
4056 * @param *store The current memory
4057 * @param *dst The ir_node that represents the destination address.
4058 * @param *src The ir_node that represents the source address.
4059 * @param *data_type The type of the copied data
4061 ir_node *new_CopyB(ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
4063 /** Constructor for a InstOf node.
4065 * A High-Level Type check.
4067 * @param *store The memory in which the object the entity should be selected
4068 * from is allocated.
4069 * @param *objptr A pointer to a object of a class type.
4070 * @param *type The type of which objptr must be.
4072 ir_node *new_InstOf (ir_node *store, ir_node *objptr, ir_type *type);
4074 /**Constructor for a Raise node.
4076 * A High-Level Exception throw.
4078 * @param *store The current memory.
4079 * @param *obj A pointer to the Except variable.
4081 ir_node *new_Raise (ir_node *store, ir_node *obj);
4083 /** Constructor for a Bound node.
4085 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
4087 * Adds the node to the block in current_ir_block.
4089 * @param *store The current memory
4090 * @param *idx The ir_node that represents an index.
4091 * @param *lower The ir_node that represents the lower bound for the index.
4092 * @param *upper The ir_node that represents the upper bound for the index.
4094 ir_node *new_Bound(ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
4096 /*---------------------------------------------------------------------*/
4097 /* The comfortable interface. */
4098 /* Supports automatic Phi node construction. */
4099 /* All routines of the block oriented interface except new_Block are */
4101 /*---------------------------------------------------------------------*/
4103 /** Create an immature block.
4105 * An immature block has an unknown number of predecessors. Predecessors
4106 * can be added with add_immBlock_pred(). Once all predecessors are
4107 * added the block must be matured.
4109 * Adds the block to the graph in current_ir_graph. Does set
4110 * current_block. Can be used with automatic Phi node construction.
4111 * This constructor can only be used if the graph is in
4114 ir_node *new_d_immBlock (dbg_info *db);
4115 ir_node *new_immBlock (void);
4117 /** Add a control flow edge to an immature block. */
4118 void add_immBlock_pred (ir_node *immblock, ir_node *jmp);
4120 /** Finalize a Block node, when all control flows are known. */
4121 void mature_immBlock (ir_node *block);
4122 #define mature_cur_block() mature_immBlock(get_cur_block());
4125 /** Get the current value of a local variable.
4127 * Use this function to obtain the last definition of the local variable
4128 * associated with pos. Pos may not exceed the value passed as n_loc
4129 * to new_ir_graph. This call automatically inserts Phi nodes.
4131 * @param *db A pointer for debug information.
4132 * @param pos The position/id of the local variable.
4133 * @param *mode The mode of the value to get.
4135 ir_node *get_d_value (dbg_info *db, int pos, ir_mode *mode);
4136 ir_node *get_value (int pos, ir_mode *mode);
4138 /** Remark a new definition of a variable.
4140 * Use this function to remember a new definition of the value
4141 * associated with pos. Pos may not exceed the value passed as n_loc
4142 * to new_ir_graph. This call is needed to automatically inserts Phi
4145 * @param pos The position/id of the local variable.
4146 * @param *value The new value written to the local variable.
4148 void set_value (int pos, ir_node *value);
4150 /** Get the current memory state.
4152 * Use this function to obtain the last definition of the memory
4153 * state. This call automatically inserts Phi nodes for the memory
4156 ir_node *get_store (void);
4158 /** Remark a new definition of the memory state.
4160 * Use this function to remember a new definition of the memory state.
4161 * This call is needed to automatically inserts Phi nodes.
4163 * @param *store The new memory state.
4165 void set_store (ir_node *store);
4167 /** keep this node alive even if End is not control-reachable from it
4169 * @param ka The node to keep alive.
4171 void keep_alive (ir_node *ka);
4173 /** Returns the frame type of the current graph */
4174 ir_type *get_cur_frame_type(void);
4177 /* --- initialize and finalize ir construction --- */
4179 /** Puts the graph into state "phase_high" */
4180 void irg_finalize_cons (ir_graph *irg);
4182 /** Puts the program and all graphs into state phase_high.
4184 * This also remarks, the construction of types is finished,
4185 * e.g., that no more subtypes will be added. */
4186 void irp_finalize_cons(void);
4188 /* --- Initialization --- */
4191 * This function is called, whenever a local variable is used before definition
4193 * @param irg the IR graph on which this happens
4194 * @param mode the mode of the local var
4195 * @param pos position chosen be the frontend for this variable (n_loc)
4197 * @return a firm node of mode @p mode that initializes the var at position pos
4200 * Do not return NULL!
4201 * If this function is not set, FIRM will create a const node with tarval BAD.
4202 * Use set_irg_loc_description()/get_irg_loc_description() to assign additional
4203 * informations to local variables.
4205 typedef ir_node *uninitialized_local_variable_func_t(ir_graph *irg, ir_mode *mode, int pos);
4207 #endif /* _IRCONS_H_ */