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_Cond (ir_node *c);
254 * ir_node *new_Return (ir_node *store, int arity, ir_node **in);
255 * ir_node *new_Raise (ir_node *store, ir_node *obj);
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_InstOf (ir_node *store, ir_node obj, type *ent);
262 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity,
263 * ir_node **in, type_method *type);
264 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
265 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
266 * ir_node *new_Minus (ir_node *op, ir_mode *mode);
267 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
268 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2);
269 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
270 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2);
271 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2);
272 * ir_node *new_Abs (ir_node *op, ir_mode *mode);
273 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
274 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
275 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
276 * ir_node *new_Not (ir_node *op, ir_mode *mode);
277 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
278 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
279 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
280 * ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode);
281 * ir_node *new_Cmp (ir_node *op1, ir_node *op2);
282 * ir_node *new_Conv (ir_node *op, ir_mode *mode);
283 * ir_node *new_Cast (ir_node *op, type *to_tp);
284 * ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode);
285 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
286 * ir_node *new_Alloc (ir_node *store, ir_node *size, type *alloc_type,
287 * where_alloc where);
288 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
290 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
291 * ir_node *new_NoMem (void);
292 * ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
294 * void add_immBlock_pred (ir_node *block, ir_node *jmp);
295 * void mature_immBlock (ir_node *block);
296 * void set_cur_block (ir_node *target);
297 * ir_node *get_value (int pos, ir_mode *mode);
298 * void set_value (int pos, ir_node *value);
299 * ir_node *get_store (void);
300 * void set_store (ir_node *store);
301 * keep_alive (ir_node ka)
303 * IR_NODES AND CONSTRUCTORS FOR IR_NODES
304 * =======================================
306 * All ir_nodes are defined by a common data structure. They are distinguished
307 * by their opcode and differ in the number of their attributes.
309 * The constructor for the block node sets current_block to itself.
310 * Const nodes are always added to the start block.
311 * All other constructors add the created node to the current_block.
312 * swich_block(block) allows to set the current block to block.
314 * Watch for my inconsistent use of input and predecessor (dataflow view)
315 * and `the node points to' (implementation view).
317 * The following description of the nodes lists four properties them if these
319 * - the parameters to the constructor
320 * - the inputs of the Firm node
321 * - the outputs of the Firm node
322 * - attributes to the node
326 * ir_node *new_immBlock (void)
327 * ----------------------------
329 * Creates a new block. Sets current_block to itself. When a new block is
330 * created it cannot be known how many predecessors this block will have in the
331 * control flow graph. Therefore the list of inputs can not be fixed at
332 * creation. Predecessors can be added with add_immBlock_pred (block, control flow
333 * operation). With every added predecessor the number of inputs to Phi nodes
336 * The block can be completed by mature_immBlock(block) if all predecessors are
337 * known. If several blocks are built at once, mature_immBlock can only be called
338 * after set_value has been called for all values that are life at the end
339 * of the block. This is necessary so that Phi nodes created mature_immBlock * get the right predecessors in case of cyclic dependencies. If all set_values
340 * of this block are called after maturing it and before calling get_value
341 * in some block that is control flow dependent on this block, the construction
344 * Example for faulty ir construction: (draw the graph on a paper and you'll
347 * block_before_loop = new_block();
349 * mature_immBlock(block_before_loop);
350 * before2header = new_Jmp;
352 * loop_header = new_block ();
353 * header2body - new_Jmp();
355 * loop_body = new_block ();
356 * body2header = new_Jmp();
358 * add_immBlock_pred(loop_header, before2header);
359 * add_immBlock_pred(loop_header, body2header);
360 * add_immBlock_pred(loop_body, header2body);
362 * mature_immBlock(loop_header);
363 * mature_immBlock(loop_body);
365 * get_value(loop_body, x); // gets the Phi in loop_header
366 * set_value(loop_header, x); // sets the value the above get_value should
367 * // have returned!!!
369 * Mature_immBlock also fixes the number of inputs to the Phi nodes. Mature_immBlock
370 * should be called as early as possible, as afterwards the generation of Phi
371 * nodes is more efficient.
374 * There is an input for each control flow predecessor of the block.
375 * The input points to an instruction producing an output of type X.
376 * Possible predecessors: Start, Jmp, Cond, Raise or Return or any node
377 * possibly causing an exception. (Often the real predecessors are Projs.)
379 * Mode BB (R), all nodes belonging to this block should consume this output.
380 * As they are strict (except Block and Phi node) it is a necessary condition
381 * that the block node executed before any other node in this block executes.
383 * block.matured Indicates whether the block is mature.
385 * This attribute contains all local values valid in this
386 * block. This is needed to build the Phi nodes and removed
387 * if the graph is complete. This field is used by the
388 * internal construction algorithm and should not be accessed
392 * ir_node *new_Block (int arity, ir_node **in)
393 * --------------------------------------------
395 * Creates a new Block with the given list of predecessors. This block
396 * is mature. As other constructors calls optimization and vrfy for the
397 * block. If one of the predecessors is Unknown (as it has to be filled in
398 * later) optimizations are skipped. This is necessary to
399 * construct Blocks in loops. Leaving Unknown in the Block after finishing
400 * the construction may have strange effects, especially for interprocedural
401 * representation and analyses.
404 * CONTROL FLOW OPERATIONS
405 * -----------------------
407 * In each block there must be exactly one of the control flow
408 * operations Start, End, Jmp, Cond, Return or Raise. The output of a
409 * control flow operation points to the block to be executed next.
411 * ir_node *new_Start (void)
412 * -------------------------
414 * Creates a start node. Not actually needed public. There is only one such
415 * node in each procedure which is automatically created by new_ir_graph.
418 * No inputs except the block it belogns to.
420 * A tuple of 4 (5, 6) distinct values. These are labeled by the following
421 * projection numbers (pn_Start):
422 * * pn_Start_X_initial_exec mode X, points to the first block to be exe * cuted.
423 * * pn_Start_M mode M, the global store
424 * * pn_Start_P_frame_base mode P, a pointer to the base of the proce * dures stack frame.
425 * * pn_Start_P_globals mode P, a pointer to the part of the memory * containing_all_ global things.
426 * * pn_Start_T_args mode T, a tuple containing all arguments of * the procedure.
429 * ir_node *new_End (void)
430 * -----------------------
432 * Creates an end node. Not actually needed public. There is only one such
433 * node in each procedure which is automatically created by new_ir_graph.
436 * No inputs except the block it belongs to.
440 * ir_node *new_Jmp (void)
441 * -----------------------
443 * Creates a Jmp node.
446 * The block the node belongs to
448 * Control flow to the next block.
450 * ir_node *new_Cond (ir_node *c)
451 * ------------------------------
453 * Creates a Cond node. There are two versions of this node.
459 * A tuple of two control flows. The first is taken if the input is
460 * false, the second if it is true.
464 * A value of mode I_u. (i)
466 * A tuple of n control flows. If the Cond's input is i, control
467 * flow will procede along output i. If the input is >= n control
468 * flow proceeds along output n.
470 * ir_node *new_Return (ir_node *store, int arity, ir_node **in)
471 * -------------------------------------------------------------
473 * The return node has as inputs the results of the procedure. It
474 * passes the control flow to the end_block.
480 * Control flow to the end block.
482 * ir_node *new_Raise (ir_node *store, ir_node *obj)
483 * -------------------------------------------------
485 * Raises an exception. Unconditional change of control flow. Writes
486 * an explicit Except variable to memory to pass it to the exception
487 * handler. See TechReport 1999-14, chapter Exceptions.
491 * A pointer to the Except variable.
493 * A tuple of control flow and the changed memory state. The control flow
494 * points to the exception handler if it is definied in this procedure,
495 * else it points to the end_block.
500 * ir_node *new_Const (ir_mode *mode, tarval *con)
501 * -----------------------------------------------
503 * Creates a constant in the constant table and adds a Const node
504 * returning this value to the start block.
507 * *mode The mode of the constant.
508 * *con Points to an entry in the constant table.
509 * This pointer is added to the attributes of
510 * the node (self->attr.con)
512 * No inputs except the block it belogns to.
514 * The constant value.
516 * attr.con A tarval* pointer to the proper entry in the constant
519 * ir_node *new_SymConst (union symconst_symbol value, symconst_addr_ent kind)
520 * ---------------------------------------------------------------------------
522 * There are three kinds of symbolic constants:
523 * symconst_type_tag The symbolic constant represents a type tag.
524 * symconst_size The symbolic constant represents the size of a class.
525 * symconst_addr_name Information for the linker, e.g. the name of a global
527 * To represent a pointer to an entity that is represented by an entity
528 * datastructure don't use
529 * new_SymConst((type_or_id*)get_entity_ld_ident(ent), symconst_addr_name);.
530 * Use a real const instead:
531 * new_SymConst(mode_P_mach, tarval_p_from_entity(ent));
532 * This makes the Constant independent of name changes of the entity due to
536 * kind The kind of the symbolic constant: type_tag, size or link_info.
537 * *type_or_id Points to the type the tag stands for or to the type
538 * whose size is represented by the constant or to an ident
539 * representing the linkage info.
542 * No inputs except the block it belogns to.
544 * An unsigned integer (I_u) or a pointer (P).
547 * attr.i.num The symconst_addr_ent, i.e. one of
550 * - symconst_addr_name
551 * If the attr.i.num is symconst_type_tag or symconst_size, the node contains an attribute
552 * attr.i.*type, a pointer to a type_class. The mode of the node is mode_Is.
553 * if it is linkage_ptr_info it contains
554 * attr.i.*ptrinfo, an ident holding information for the linker. The mode
555 * of the node is mode_P_mach.
559 * ir_node *new_simpleSel (ir_node *store, ir_node *frame, entity *sel)
560 * --------------------------------------------------------------------
563 * Selects an entity from a compound type. This entity can be a field or
567 * *store The memory in which the object the entity should be selected
569 * *frame The pointer to the object.
570 * *sel The entity to select.
573 * The memory containing the object.
574 * A pointer to the object.
575 * An unsigned integer.
577 * A pointer to the selected entity.
579 * attr.sel Pointer to the entity
582 * ir_node *new_Sel (ir_node *store, ir_node *frame, int arity, ir_node **in,
583 * --------------------------------------------------------------------------
587 * Selects a field from an array type. The entity has as owner the array, as
588 * type the arrays element type. The indexes to access an array element are
592 * *store The memory in which the object the entity should be selected from
594 * *frame The pointer to the object.
595 * *arity number of array indexes.
596 * *in array with index inputs to the node.
597 * *sel The entity to select.
600 * The memory containing the object.
601 * A pointer to the object.
602 * As much unsigned integer as there are array expressions.
604 * A pointer to the selected entity.
606 * attr.sel Pointer to the entity
608 * The constructors new_Sel and new_simpleSel generate the same ir nodes.
609 * simpleSel just sets the arity of the index inputs to zero.
612 * ARITHMETIC OPERATIONS
613 * ---------------------
615 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node **in,
616 * ----------------------------------------------------------------------------
620 * Creates a procedure call.
623 * *store The actual store.
624 * *callee A pointer to the called procedure.
625 * arity The number of procedure parameters.
626 * **in An array with the pointers to the parameters.
627 * The constructor copies this array.
628 * *type Type information of the procedure called.
631 * The store, the callee and the parameters.
633 * A tuple containing the eventually changed store and the procedure
636 * attr.call Contains the type information for the procedure.
639 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode)
640 * ------------------------------------------------------------
644 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode)
645 * ------------------------------------------------------------
649 * ir_node *new_Minus (ir_node *op, ir_mode *mode)
650 * -----------------------------------------------
652 * Unary Minus operations on floating point values.
654 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode)
655 * ------------------------------------------------------------
659 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2)
660 * --------------------------------------------------------------
662 * Quot performs exact division of floating point numbers. It's mode
663 * is Tuple, the mode of the result must be annotated to the Proj
664 * that extracts the result of the arithmetic operations.
667 * The store needed to model exceptions and the two operands.
669 * A tuple contaning a memory and a execution for modeling exceptions
670 * and the result of the arithmetic operation.
672 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2)
673 * ----------------------------------------------------------------
675 * Performs Div and Mod on interger values.
678 * A tuple contaning a memory and a execution for modeling exceptions
679 * and the two result of the arithmetic operations.
681 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2)
682 * -------------------------------------------------------------
686 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2)
687 * -------------------------------------------------------------
691 * ir_node *new_Abs (ir_node *op, ir_mode *mode)
692 * ---------------------------------------------
696 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode)
697 * ------------------------------------------------------------
701 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode)
702 * -----------------------------------------------------------
706 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode)
707 * ------------------------------------------------------------
711 * ir_node *new_Not (ir_node *op, ir_mode *mode)
712 * ---------------------------------------------
714 * This node constructs a constant where all bits are set to one
715 * and a Eor of this constant and the operator. This simulates a
718 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode)
719 * ---------------------------------------------------------
723 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode)
724 * ---------------------------------------------------------
726 * Logic shift right, i.e., zero extended.
729 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode)
730 * ----------------------------------------------------------
732 * Arithmetic shift right, i.e., sign extended.
734 * ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode)
735 * ---------------------------------------------------------
737 * Rotates the operand to the (right??) by k bits.
739 * ir_node *new_Conv (ir_node *op, ir_mode *mode)
740 * ---------------------------------------------
742 * Mode conversion. For allowed conversions see UKA Tech Report
745 * ir_node *new_Cmp (ir_node *op1, ir_node *op2)
746 * ---------------------------------------------
749 * The two values to be compared.
751 * A 16-tuple containing the results of the 16 different comparisons.
752 * The following is a list giving the comparisons and a projection
753 * number (pnc_number) to use in Proj nodes to extract the proper result.
759 * Ge greater of equal
761 * Leg less, equal or greater = ordered
763 * Ue unordered or equal
764 * Ul unordered or less
765 * Ule unordered, less or equal
766 * Ug unordered or greater
767 * Uge unordered, greater or equal
768 * Ne unordered, less or greater = not equal
775 * In general, Phi nodes are automaitcally inserted. In some cases, if
776 * all predecessors of a block are known, an explicit Phi node constructor
777 * is needed. E.g., to construct a FIRM graph for a statement as
778 * a = (b==c) ? 2 : 5;
780 * ir_node *new_Phi (int arity, ir_node **in, ir_mode *mode)
781 * ---------------------------------------------------------
783 * Creates a Phi node. The in's order has to correspond to the order
784 * of in's of current_block. This is not checked by the library!
785 * If one of the predecessors is Unknown (as it has to be filled in
786 * later) optimizations are skipped. This is necessary to
787 * construct Phi nodes in loops. Leaving Unknown in the Phi after finishing
788 * the construction may have strange effects, especially for interprocedural
789 * representation and analyses.
792 * arity number of predecessors
793 * **in array with predecessors
794 * *mode The mode of it's inputs and output.
796 * A Phi node has as many inputs as the block it belongs to.
797 * Each input points to a definition of the same value on a
798 * different path in the control flow.
800 * The definition valid in this block.
802 * ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode)
803 * -----------------------------------------------------------------------------
805 * Creates a Mux node. This node implements the following semantic:
806 * If the sel node (which must be of mode_b) evaluates to true, its value is
807 * ir_true, else ir_false;
810 * OPERATIONS TO MANAGE MEMORY EXPLICITLY
811 * --------------------------------------
813 * ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode)
814 * ----------------------------------------------------------------
816 * The Load operation reads a value from memory.
819 * *store The current memory.
820 * *addr A pointer to the variable to be read in this memory.
821 * *mode The mode of the value to be loaded.
824 * The memory and a pointer to a variable in this memory.
826 * A tuple of the memory, a control flow to be taken in case of
827 * an exception and the loaded value.
829 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val)
830 * ----------------------------------------------------------------
832 * The Store operation writes a value to a variable in memory.
835 * The memory, a pointer to a variable in this memory and the value
836 * to write to this variable.
838 * A tuple of the changed memory and a control flow to be taken in
839 * case of an exception.
841 * ir_node *new_Alloc (ir_node *store, ir_node *size, type *alloc_type,
842 * --------------------------------------------------------------------
846 * The Alloc node allocates a new variable. It can be specified whether the
847 * variable should be allocated to the stack or to the heap.
850 * *store The memory which shall contain the new variable.
851 * ** *size The number of bytes to allocate. Old. **
852 * *size We decided that the size easily can be derived from the type.
853 * This field is for allocating arrays, i.e., it gives the multiple
854 * of the size of alloc_type to allocate memory for.
855 * *alloc_type The type of the allocated variable.
856 * where Where to allocate the variable, either heap_alloc or stack_alloc.
859 * A memory and an unsigned integer.
861 * A tuple of the changed memory, a control flow to be taken in
862 * case of an exception and the pointer to the new variable.
864 * a.where Indicates where the variable is allocated.
865 * a.*type A pointer to the class the allocated data object
868 * ir_node *new_Free (ir_node *store, ir_node *ptr, type *free_type)
869 * ------------------------------------------------------------------
871 * The Free node frees memory of the given variable.
874 * *store The memory which shall contain the new variable.
875 * *ptr The pointer to the object to free.
876 * *size The number of objects of type free_type to free in a sequence.
877 * *free_type The type of the freed variable.
880 * A memory, a pointer and an unsigned integer.
882 * The changed memory.
884 * f.*type A pointer to the type information of the freed data object.
888 * ir_node *new_Sync (int arity, ir_node **in)
889 * -------------------------------------------
891 * The Sync operation unifies several partial memory blocks. These blocks
892 * have to be pairwise disjunct or the values in common locations have to
893 * be identical. This operation allows to specify all operations that eventually
894 * need several partial memory blocks as input with a single entrance by
895 * unifying the memories with a preceding Sync operation.
898 * arity The number of memories to syncronize.
899 * **in An array of pointers to nodes that produce an output of
904 * The unified memory.
910 * ir_node *new_Bad (void)
911 * -----------------------
913 * Returns the unique Bad node current_ir_graph->bad.
914 * This node is used to express results of dead code elimination.
916 * ir_node *new_NoMem (void)
917 * -----------------------------------------------------------------------------------
919 * Returns the unique NoMem node current_ir_graph->no_mem.
920 * This node is used as input for operations that need a Memory, but do not
921 * change it like Div by const != 0, analyzed calls etc.
923 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj)
924 * ----------------------------------------------------------
926 * Selects one entry of a tuple. This is a hidden `fat edge'.
929 * *arg A node producing a tuple.
930 * *mode The mode of the value to project.
931 * proj The position of the value in the tuple.
937 * ir_node *new_Tuple (int arity, ir_node **in)
938 * --------------------------------------------
940 * Builds a Tuple from single values. This is needed to implement
941 * optimizations that remove a node that produced a tuple. The node can be
942 * replaced by the Tuple operation so that the following Proj nodes have not to
943 * be changed. (They are hard to find due to the implementation with pointers
944 * in only one direction.) The Tuple node is smaller than any other
945 * node, so that a node can be changed into a Tuple by just changing it's
946 * opcode and giving it a new in array.
949 * arity The number of tuple elements.
950 * **in An array containing pointers to the nodes producing the
953 * ir_node *new_Id (ir_node *val, ir_mode *mode)
954 * ---------------------------------------------
956 * The single output of the Id operation is it's input. Also needed
960 * COPING WITH DATA OBJECTS
961 * ========================
963 * Two kinds of data objects have to be distinguished for generating
964 * FIRM. First there are local variables other than arrays that are
965 * known to be alias free. Second there are all other data objects.
966 * For the first a common SSA representation is built, the second
967 * are modeled by saving them to memory. The memory is treated as
968 * a single local variable, the alias problem is hidden in the
969 * content of this variable.
971 * All values known in a Block are listed in the block's attribute,
972 * block.**graph_arr which is used to automatically insert Phi nodes.
973 * The following two funcions can be used to add a newly computed value
974 * to the array, or to get the producer of a value, i.e., the current
977 * inline void set_value (int pos, ir_node *value)
978 * -----------------------------------------------
980 * Has to be called for every assignment to a local variable. It
981 * adds the value to the array of used values at position pos. Pos
982 * has to be a unique identifier for an entry in the procedure's
983 * definition table. It can be used to access the value again.
984 * Requires current_block to be set correctly.
986 * ir_node *get_value (int pos, ir_mode *mode)
987 * -------------------------------------------
989 * Returns the node defining the value referred to by pos. If the
990 * value is not defined in this block a Phi node is generated and
991 * all definitions reaching this Phi node are collected. It can
992 * happen that the algorithm allocates an unnecessary Phi node,
993 * e.g. if there is only one definition of this value, but this
994 * definition reaches the currend block on several different
995 * paths. This Phi node will be eliminated if optimizations are
996 * turned on right after it's creation.
997 * Requires current_block to be set correctly.
999 * There are two special routines for the global store:
1001 * void set_store (ir_node *store)
1002 * -------------------------------
1004 * Adds the store to the array of known values at a reserved
1006 * Requires current_block to be set correctly.
1008 * ir_node *get_store (void)
1009 * -------------------------
1011 * Returns the node defining the actual store.
1012 * Requires current_block to be set correctly.
1015 * inline void keep_alive (ir_node *ka)
1016 * ------------------------------------
1018 * Keep this node alive because it is (might be) not in the control
1019 * flow from Start to End. Adds the node to the list in the end
1028 # include "firm_common.h"
1029 # include "irgraph.h"
1030 # include "irnode.h"
1031 # include "irmode.h"
1032 # include "entity.h"
1035 # include "dbginfo.h"
1037 /*-------------------------------------------------------------------------*/
1038 /* The raw interface */
1039 /*-------------------------------------------------------------------------*/
1041 /** Constructor for a Block node.
1043 * Constructs a mature block with the given predecessors. Use Unknown
1044 * nodes as predecessors to construct a block if the number of
1045 * predecessors is known, but not the predecessors themselves. This
1046 * constructor does not set current_block. It not be used with
1047 * automatic Phi node construction.
1049 * @param *db A Pointer for debug information.
1050 * @param irg The ir graph the block belongs to.
1051 * @param arity The number of control predecessors.
1052 * @param in[] An array of control predecessors. The length of
1053 * the array must be 'arity'. The constructor copies this array.
1055 ir_node *new_rd_Block (dbg_info *db, ir_graph *irg, int arity, ir_node *in[]);
1057 /** Constructor for a Start node.
1059 * @param *db A pointer for debug information.
1060 * @param *irg The ir graph the node belongs to.
1061 * @param *block The ir block the node belongs to.
1063 ir_node *new_rd_Start (dbg_info *db, ir_graph *irg, ir_node *block);
1065 /** Constructor for a End node.
1067 * @param *db A pointer for debug information.
1068 * @param *irg The ir graph the node belongs to.
1069 * @param *block The ir block the node belongs to.
1071 ir_node *new_rd_End (dbg_info *db, ir_graph *irg, ir_node *block);
1073 /** Constructor for a Jmp node.
1075 * Jmp represents control flow to a single control successor.
1077 * @param *db A pointer for debug information.
1078 * @param *irg The ir graph the node belongs to.
1079 * @param *block The ir block the node belongs to.
1081 ir_node *new_rd_Jmp (dbg_info *db, ir_graph *irg, ir_node *block);
1083 /** Constructor for a Break node.
1085 * Break represents control flow to a single control successor just as Jmp.
1086 * The blocks separated by a break may not be concatenated by an optimization.
1087 * It is used for the interprocedural representation where blocks are parted
1088 * behind Call nodes to represent the control flow to called procedures.
1090 * @param *db A pointer for debug information.
1091 * @param *irg The ir graph the node belong to.
1092 * @param *block The block the node belong to.
1094 ir_node *new_rd_Break (dbg_info *db, ir_graph *irg, ir_node *block);
1096 /** Constructor for a Cond node.
1098 * If c is mode_b represents a conditional branch (if/else). If c is
1099 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
1100 * node, default Proj is 0.)
1102 * This is not consistent: Input to Cond is Is, Proj has as proj number
1105 * @param *db A pointer for debug information.
1106 * @param *irg The ir graph the node belongs to.
1107 * @param *block The ir block the node belongs to.
1108 * @param *c The conditions parameter. Can be of mode b or I_u.
1110 ir_node *new_rd_Cond (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *c);
1112 /** Constructor for a Return node.
1114 * Returns the memory an zero or more return values. Only node that
1115 * can end regular control flow.
1117 * @param *db A pointer for debug information.
1118 * @param *irg The ir graph the node belongs to.
1119 * @param *block The ir block the node belongs to.
1120 * @param *store The state of memory.
1121 * @param arity Number of return values.
1122 * @param *in Array of length arity with return values. The constructor copies this array.
1124 ir_node *new_rd_Return (dbg_info *db, ir_graph *irg, ir_node *block,
1125 ir_node *store, int arity, ir_node *in[]);
1127 /** Constructor for a Raise node.
1129 * @param *db A pointer for debug information.
1130 * @param *irg The ir graph the node belongs to.
1131 * @param *block The ir block the node belongs to.
1132 * @param *store The current memory.
1133 * @param *obj A pointer to the Except variable.
1135 ir_node *new_rd_Raise (dbg_info *db, ir_graph *irg, ir_node *block,
1136 ir_node *store, ir_node *obj);
1138 /** Constructor for a Const_type node.
1140 * The constant represents a target value. This constructor sets high
1141 * level type information for the constant value.
1143 * @param *db A pointer for debug information.
1144 * @param *irg The ir graph the node belongs to.
1145 * @param *block The ir block the node belongs to.
1146 * @param *mode The mode of the operands and redults.
1147 * @param *con Points to an entry in the constant table.
1148 * @param *tp The type of the constant.
1150 ir_node *new_rd_Const_type (dbg_info* db, ir_graph *irg, ir_node *block,
1151 ir_mode *mode, tarval *con, type *tp);
1153 /** Constructor for a Const node.
1155 * Constructor for a Const node. The constant represents a target
1156 * value. Sets the type information to type_unknown. (No more
1157 * supported: If tv is entity derives a somehow useful type.)
1159 * @param *db A pointer for debug information.
1160 * @param *irg The ir graph the node belongs to.
1161 * @param *block The ir block the node belongs to.
1162 * @param *mode The mode of the operands and redults.
1163 * @param *con Points to an entry in the constant table.
1165 ir_node *new_rd_Const (dbg_info *db, ir_graph *irg, ir_node *block,
1166 ir_mode *mode, tarval *con);
1168 /** Constructor for a SymConst_type node.
1170 * This is the constructor for a symbolic constant.
1171 * There are four kinds of symbolic constants:
1172 * - type_tag The symbolic constant represents a type tag. The type the
1173 * tag stands for is given explicitly.
1174 * - size The symbolic constant represents the size of a type. The
1175 * type of which the constant represents the size is given
1177 * - addr_name The symbolic constant represents the address of an entity
1178 * (variable or method). The variable is indicated by a name
1179 * that is valid for linking.
1180 * - addr_ent The symbolic constant represents the address of an entity
1181 * (variable or method). The variable is given explicitly by
1184 * Inputs to the node:
1185 * No inputs except the block it belongs to.
1186 * Outputs of the node.
1187 * An unsigned integer (I_u) or a pointer (P).
1189 * Mention union in declaration so that the firmjni generator recognizes that
1190 * it can not cast the argument to an int.
1192 * @param *db A pointer for debug information.
1193 * @param *irg The ir graph the node belongs to.
1194 * @param *block The ir block the node belongs to.
1195 * @param symkind The kind of the symbolic constant: type_tag, size, addr_name or addr_ent.
1196 * @param value A type, entity or a ident depending on the SymConst kind.
1197 * @param tp The source type of the constant.
1199 ir_node *new_rd_SymConst_type (dbg_info* db, ir_graph *irg, ir_node *block, union symconst_symbol value,
1200 symconst_kind symkind, type *tp);
1202 /** Constructor for a SymConst node.
1204 * Same as new_rd_SymConst_type, except that it sets the type to type_unknown. */
1205 ir_node *new_rd_SymConst (dbg_info *db, ir_graph *irg, ir_node *block,
1206 union symconst_symbol value, symconst_kind symkind);
1208 /** Constructor for a SymConst addr_ent node.
1210 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1211 * symconst_addr_ent.
1212 * Adds the symconst to the start block of irg. */
1213 ir_node *new_rd_SymConst_addr_ent (dbg_info *db, ir_graph *irg, entity *symbol, type *tp);
1215 /** Constructor for a SymConst addr_name node.
1217 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1218 * symconst_addr_ent.
1219 * Adds the symconst to the start block of irg. */
1220 ir_node *new_rd_SymConst_addr_name (dbg_info *db, ir_graph *irg, ident *symbol, type *tp);
1222 /** Constructor for a SymConst type_tag node.
1224 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1225 * symconst_addr_ent.
1226 * Adds the symconst to the start block of irg. */
1227 ir_node *new_rd_SymConst_type_tag (dbg_info *db, ir_graph *irg, type *symbol, type *tp);
1229 /** Constructor for a SymConst size node.
1231 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1232 * symconst_addr_ent.
1233 * Adds the symconst to the start block of irg. */
1234 ir_node *new_rd_SymConst_size (dbg_info *db, ir_graph *irg, type *symbol, type *tp);
1236 /** Constructor for a Sel node.
1238 * The select node selects an entity (field or method) from an entity
1239 * with a compound type. It explicitly specifies the entity selected.
1240 * Dynamically the node may select entities that overwrite the given
1241 * entity. If the selected entity is an array element entity the Sel
1242 * node takes the required array indicees as inputs.
1244 * @param *db A pointer for debug information.
1245 * @param *irg The ir graph the node belongs to.
1246 * @param *block The ir block the node belongs to.
1247 * @param *store The memory in which the object the entity should be selected
1248 * from is allocated.
1249 * @param *objptr A pointer to a compound entity the Sel operation selects a
1250 * single attribute from.
1251 * @param *n_index The number of array indicees needed to select an array element entity.
1252 * @param *index[] If the compound entity is an array the indicees of the selected
1253 * element entity. The constructor copies this array.
1254 * @param *ent The entity to select.
1256 ir_node *new_rd_Sel (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1257 ir_node *objptr, int n_index, ir_node *index[], entity *ent);
1259 /** Constructor for a InstOf node.
1261 * For translating Java. Not supported as standard firm node.
1263 * @param *db A pointer for debug information.
1264 * @param *irg The ir graph the node belongs to.
1265 * @param *block The ir block the node belongs to.
1270 ir_node *new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1271 ir_node *objptr, type *ent);
1273 /** Constructor for a Call node.
1275 * Represents all kinds of method and function calls.
1277 * @param *db A pointer for debug information.
1278 * @param *irg The ir graph the node belongs to.
1279 * @param *block The ir block the node belongs to.
1280 * @param *store The current memory state.
1281 * @param *callee A pointer to the called procedure.
1282 * @param arity The number of procedure parameters.
1283 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1284 * @param *tp Type information of the procedure called.
1286 ir_node *new_rd_Call (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1287 ir_node *callee, int arity, ir_node *in[], type *tp);
1289 /** Constructor for a Add node.
1291 * @param *db A pointer for debug information.
1292 * @param *irg The ir graph the node belongs to.
1293 * @param *block The ir block the node belongs to.
1294 * @param *op1 The operand 1.
1295 * @param *op2 The operand 2.
1296 * @param *mode The mode of the operands and the result.
1298 ir_node *new_rd_Add (dbg_info *db, ir_graph *irg, ir_node *block,
1299 ir_node *op1, ir_node *op2, ir_mode *mode);
1301 /** Constructor for a Sub node.
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 *op1 The operand 1.
1307 * @param *op2 The operand 2.
1308 * @param *mode The mode of the operands and the result.
1310 ir_node *new_rd_Sub (dbg_info *db, ir_graph *irg, ir_node *block,
1311 ir_node *op1, ir_node *op2, ir_mode *mode);
1313 /** Constructor for a Minus node.
1315 * @param *db A pointer for debug information.
1316 * @param *irg The ir graph the node belongs to.
1317 * @param *block The ir block the node belongs to.
1318 * @param *op The operand .
1319 * @param *mode The mode of the operand and the result.
1321 ir_node *new_rd_Minus (dbg_info *db, ir_graph *irg, ir_node *block,
1322 ir_node *op, ir_mode *mode);
1324 /** Constructor for a Mul node.
1326 * @param *db A pointer for debug information.
1327 * @param *irg The ir graph the node belongs to.
1328 * @param *block The ir block the node belongs to.
1329 * @param *op1 The operand 1.
1330 * @param *op2 The operand 2.
1331 * @param *mode The mode of the operands and the result.
1333 ir_node *new_rd_Mul (dbg_info *db, ir_graph *irg, ir_node *block,
1334 ir_node *op1, ir_node *op2, ir_mode *mode);
1336 /** Constructor for a Quot node.
1338 * @param *db A pointer for debug information.
1339 * @param *irg The ir graph the node belongs to.
1340 * @param *block The ir block the node belongs to.
1341 * @param *memop The store needed to model exceptions
1342 * @param *op1 The operand 1.
1343 * @param *op2 The operand 2.
1345 ir_node *new_rd_Quot (dbg_info *db, ir_graph *irg, ir_node *block,
1346 ir_node *memop, ir_node *op1, ir_node *op2);
1348 /** Constructor for a DivMod node.
1350 * @param *db A pointer for debug information.
1351 * @param *irg The ir graph the node belongs to.
1352 * @param *block The ir block the node belongs to.
1353 * @param *memop The store needed to model exceptions
1354 * @param *op1 The operand 1.
1355 * @param *op2 The operand 2.
1357 ir_node *new_rd_DivMod (dbg_info *db, ir_graph *irg, ir_node *block,
1358 ir_node *memop, ir_node *op1, ir_node *op2);
1360 /** Constructor for a Div node.
1362 * @param *db A pointer for debug information.
1363 * @param *irg The ir graph the node belongs to.
1364 * @param *block The ir block the node belongs to.
1365 * @param *memop The store needed to model exceptions
1366 * @param *op1 The operand 1.
1367 * @param *op2 The operand 2.
1369 ir_node *new_rd_Div (dbg_info *db, ir_graph *irg, ir_node *block,
1370 ir_node *memop, ir_node *op1, ir_node *op2);
1372 /** Constructor for a Mod node.
1374 * @param *db A pointer for debug information.
1375 * @param *irg The ir graph the node belongs to.
1376 * @param *block The ir block the node belongs to.
1377 * @param *memop The store needed to model exceptions
1378 * @param *op1 The operand 1.
1379 * @param *op2 The operand 2.
1381 ir_node *new_rd_Mod (dbg_info *db, ir_graph *irg, ir_node *block,
1382 ir_node *memop, ir_node *op1, ir_node *op2);
1384 /** Constructor for a Abs node.
1386 * @param *db A pointer for debug information.
1387 * @param *irg The ir graph the node belongs to.
1388 * @param *block The ir block the node belongs to.
1389 * @param *op The operand
1390 * @param *mode The mode of the operands and the result.
1392 ir_node *new_rd_Abs (dbg_info *db, ir_graph *irg, ir_node *block,
1393 ir_node *op, ir_mode *mode);
1395 /** Constructor for a And node.
1397 * @param *db A pointer for debug information.
1398 * @param *irg The ir graph the node belongs to.
1399 * @param *block The ir block the node belongs to.
1400 * @param *op1 The operand 1.
1401 * @param *op2 The operand 2.
1402 * @param *mode The mode of the operands and the result.
1404 ir_node *new_rd_And (dbg_info *db, ir_graph *irg, ir_node *block,
1405 ir_node *op1, ir_node *op2, ir_mode *mode);
1407 /** Constructor for a Or node.
1409 * @param *db A pointer for debug information.
1410 * @param *irg The ir graph the node belongs to.
1411 * @param *block The ir block the node belongs to.
1412 * @param *op1 The operand 1.
1413 * @param *op2 The operand 2.
1414 * @param *mode The mode of the operands and the result.
1416 ir_node *new_rd_Or (dbg_info *db, ir_graph *irg, ir_node *block,
1417 ir_node *op1, ir_node *op2, ir_mode *mode);
1419 /** Constructor for a Eor node.
1421 * @param *db A pointer for debug information.
1422 * @param *irg The ir graph the node belongs to.
1423 * @param *block The ir block the node belongs to.
1424 * @param *op1 The operand 1.
1425 * @param *op2 The operand 2.
1426 * @param *mode The mode of the operands and the results.
1428 ir_node *new_rd_Eor (dbg_info *db, ir_graph *irg, ir_node *block,
1429 ir_node *op1, ir_node *op2, ir_mode *mode);
1431 /** Constructor for a Not node.
1433 * @param *db A pointer for debug information.
1434 * @param *irg The ir graph the node belongs to.
1435 * @param *block The ir block the node belongs to.
1436 * @param *op The operand.
1437 * @param *mode The mode of the operand and the result.
1439 ir_node *new_rd_Not (dbg_info *db, ir_graph *irg, ir_node *block,
1440 ir_node *op, ir_mode *mode);
1442 /** Constructor for a Cmp node.
1444 * @param *db A pointer for debug information.
1445 * @param *irg The ir graph the node belongs to.
1446 * @param *block The ir block the node belongs to.
1447 * @param *op1 The operand 1.
1448 * @param *op2 The operand 2.
1450 ir_node *new_rd_Cmp (dbg_info *db, ir_graph *irg, ir_node *block,
1451 ir_node *op1, ir_node *op2);
1453 /** Constructor for a Shl node.
1455 * @param *db A pointer for debug information.
1456 * @param *irg The ir graph the node belongs to.
1457 * @param *block The ir block the node belongs to.
1458 * @param *op The operand.
1459 * @param *k The number of bits to shift the operand .
1460 * @param *mode The mode of the operand and the result.
1462 ir_node *new_rd_Shl (dbg_info *db, ir_graph *irg, ir_node *block,
1463 ir_node *op, ir_node *k, ir_mode *mode);
1465 /** Constructor for a Shr node.
1467 * @param *db A pointer for debug information.
1468 * @param *irg The ir graph the node belongs to.
1469 * @param *block The ir block the node belongs to.
1470 * @param *op The operand.
1471 * @param *k The number of bits to shift the operand .
1472 * @param *mode The mode of the operand and the result.
1474 ir_node *new_rd_Shr (dbg_info *db, ir_graph *irg, ir_node *block,
1475 ir_node *op, ir_node *k, ir_mode *mode);
1477 /** Constructor for a Shrs node.
1479 * @param *db A pointer for debug information.
1480 * @param *irg The ir graph the node belongs to.
1481 * @param *block The ir block the node belongs to.
1482 * @param *op The operand.
1483 * @param *k The number of bits to shift the operand.
1484 * @param *mode The mode of the operand and the result.
1486 ir_node *new_rd_Shrs (dbg_info *db, ir_graph *irg, ir_node *block,
1487 ir_node *op, ir_node *k, ir_mode *mode);
1489 /** Constructor for a Rot node.
1491 * @param *db A pointer for debug information.
1492 * @param *irg The ir graph the node belongs to.
1493 * @param *block The ir block the node belongs to.
1494 * @param *op The operand.
1495 * @param *k The number of bits to rotate the operand.
1496 * @param *mode The mode of the operand.
1498 ir_node *new_rd_Rot (dbg_info *db, ir_graph *irg, ir_node *block,
1499 ir_node *op, ir_node *k, ir_mode *mode);
1502 /** Constructor for a Conv node.
1504 * @param *db A pointer for debug information.
1505 * @param *irg The ir graph the node belongs to.
1506 * @param *block The ir block the node belongs to.
1507 * @param *op The operand.
1508 * @param *mode The mode of this the operand muss be converted .
1510 ir_node *new_rd_Conv (dbg_info *db, ir_graph *irg, ir_node *block,
1511 ir_node *op, ir_mode *mode);
1513 /** Constructor for a Cast node.
1515 * High level type cast.
1517 * @param *db A pointer for debug information.
1518 * @param *irg The ir graph the node belongs to.
1519 * @param *block The ir block the node belongs to.
1520 * @param *op The operand.
1521 * @param *to_tp The type of this the operand muss be casted .
1523 ir_node *new_rd_Cast (dbg_info* db, ir_graph *irg, ir_node *block,
1524 ir_node *op, type *to_tp);
1526 /** Constructor for a Phi node.
1528 * @param *db A pointer for debug information.
1529 * @param *irg The ir graph the node belongs to.
1530 * @param *block The ir block the node belongs to.
1531 * @param arity The number of predecessors
1532 * @param *in[] Array with predecessors. The constructor copies this array.
1533 * @param *mode The mode of it's inputs and output.
1535 ir_node *new_rd_Phi (dbg_info *db, ir_graph *irg, ir_node *block, int arity,
1536 ir_node *in[], ir_mode *mode);
1538 /** Constructor for a Load node.
1540 * @param *db A pointer for debug information.
1541 * @param *irg The ir graph the node belongs to.
1542 * @param *block The ir block the node belongs to.
1543 * @param *store The current memory
1544 * @param *adr A pointer to the variable to be read in this memory.
1545 * @param *mode The mode of the value to be loaded.
1547 ir_node *new_rd_Load (dbg_info *db, ir_graph *irg, ir_node *block,
1548 ir_node *store, ir_node *adr, ir_mode *mode);
1550 /** Constructor for a Store node.
1552 * @param *db A pointer for debug information.
1553 * @param *irg The ir graph the node belongs to.
1554 * @param *block The ir block the node belongs to.
1555 * @param *store The current memory
1556 * @param *adr A pointer to the variable to be read in this memory.
1557 * @param *val The value to write to this variable.
1559 ir_node *new_rd_Store (dbg_info *db, ir_graph *irg, ir_node *block,
1560 ir_node *store, ir_node *adr, ir_node *val);
1562 /** Constructor for a Alloc node.
1564 * The Alloc node extends the memory by space for an entity of type alloc_type.
1566 * @param *db A pointer for debug information.
1567 * @param *irg The ir graph the node belongs to.
1568 * @param *block The ir block the node belongs to.
1569 * @param *store The memory which shall contain the new variable.
1570 * @param *size The number of bytes to allocate.
1571 * @param *alloc_type The type of the allocated variable.
1572 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
1574 ir_node *new_rd_Alloc (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1575 ir_node *size, type *alloc_type, where_alloc where);
1577 /** Constructor for a Free node.
1579 * Frees the memory occupied by the entity pointed to by the pointer
1580 * arg. Type indicates the type of the entity the argument points to.
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 *store The memory which shall contain the new variable.
1586 * @param *ptr The pointer to the object to free.
1587 * @param *size The number of objects of type free_type to free in a sequence.
1588 * @param *free_type The type of the freed variable.
1590 ir_node *new_rd_Free (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1591 ir_node *ptr, ir_node *size, type *free_type);
1593 /** Constructor for a Sync node.
1595 * Merges several memory values. The node assumes that a variable
1596 * either occurs only in one of the memories, or it contains the same
1597 * value in all memories where it occurs.
1599 * @param *db A pointer for debug information.
1600 * @param *irg The ir graph the node belongs to.
1601 * @param *block The ir block the node belongs to.
1602 * @param arity The number of memories to syncronize.
1603 * @param *in[] An array of pointers to nodes that produce an output of type
1604 * memory. The constructor copies this array.
1606 ir_node *new_rd_Sync (dbg_info *db, ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
1608 /** Constructor for a Proj node.
1610 * Projects a single value out of a tuple. The parameter proj gives the
1611 * position of the value within the tuple.
1613 * @param *db A pointer for deubugginformation.
1614 * @param *irg The ir graph the node belongs to.
1615 * @param *block The ir block the node belongs to.
1616 * @param arg A node producing a tuple. The node must have mode_T.
1617 * @param *mode The mode of the value to project.
1618 * @param proj The position of the value in the tuple.
1620 ir_node *new_rd_Proj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1621 ir_mode *mode, long proj);
1623 /** Constructor for a defaultProj node.
1625 * Represents the default control flow of a Switch-Cond node.
1627 * @param *db A pointer for debug information.
1628 * @param *irg The ir graph the node belongs to.
1629 * @param *block The ir block the node belongs to.
1630 * @param arg A node producing a tuple.
1631 * @param max_proj The end position of the value in the tuple.
1633 ir_node *new_rd_defaultProj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1636 /** Constructor for a Tuple node.
1638 * This is an auxiliary node to replace a node that returns a tuple
1639 * without changing the corresponding Proj nodes.
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 arity The number of tuple elements.
1645 * @param *in[] An array containing pointers to the nodes producing the tuple
1646 * elements. The constructor copies this array.
1648 ir_node *new_rd_Tuple (dbg_info *db, ir_graph *irg, ir_node *block,
1649 int arity, ir_node *in[]);
1651 /** Constructor for a Id node.
1653 * This is an auxiliary node to replace a node that returns a single
1656 * @param *db A pointer for debug information.
1657 * @param *irg The ir graph the node belongs to.
1658 * @param *block The ir block the node belongs to.
1659 * @param *val The value
1660 * @param *mode The mode of *val.
1662 ir_node *new_rd_Id (dbg_info *db, ir_graph *irg, ir_node *block,
1663 ir_node *val, ir_mode *mode);
1665 /** Constructor for a Bad node.
1667 * Returns the unique Bad node of the graph. The same as
1670 * @param *irg The ir graph the node belongs to.
1672 ir_node *new_rd_Bad (ir_graph *irg);
1674 /** Constructor for a Confirm node.
1676 * Specifies constraints for a value. To support dataflow analyses.
1678 * Example: If the value never exceeds '100' this is expressed by placing a
1679 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
1681 * @param *irg The ir graph the node belong to.
1682 * @param *block The ir block the node belong to.
1683 * @param *db A pointer for debug information.
1684 * @param *val The value we express a constraint for
1685 * @param *bound The value to compare against. Must be a firm node, typically a constant.
1686 * @param cmp The compare operation.
1688 ir_node *new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block,
1689 ir_node *val, ir_node *bound, pn_Cmp cmp);
1691 /** Constructor for an Unknown node.
1693 * Represents an arbitrary value. Places the node in the start block.
1695 * @param *irg The ir graph the node belongs to.
1696 * @param *m The mode of the unknown value.
1698 ir_node *new_rd_Unknown(ir_graph *irg, ir_mode *m);
1700 /** Constructor for a CallBegin node.
1702 * CallBegin represents control flow depending of the pointer value
1703 * representing the called method to the called methods. The
1704 * constructor copies the method pointer input from the passed Call
1707 * @param *db A pointer for debug information.
1708 * @param *irg The ir graph the node belong to.
1709 * @param *block The block the node belong to.
1710 * @param *callee The call node visible in the intra procedural view.
1712 ir_node *new_rd_CallBegin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *callee);
1714 /** Constructor for a EndReg node.
1716 * Used to represent regular procedure end in interprocedual view.
1718 * @param *db A pointer for debug information.
1719 * @param *irg The ir graph the node belong to.
1720 * @param *block The block the node belong to.
1722 ir_node *new_rd_EndReg (dbg_info *db, ir_graph *irg, ir_node *block);
1724 /** Constructor for a EndExcept node.
1726 * Used to represent exceptional procedure end in interprocedural view.
1728 * @param *db A pointer for debug information.
1729 * @param *irg The ir graph the node belong to.
1730 * @param *block The block the node belong to.
1732 ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
1734 /** Constructor for a Filter node.
1736 * Adds the node to the block in current_ir_block. Filter is a node
1737 * with two views used to construct the interprocedural view. In
1738 * intraprocedural view its semantics are identical to the Proj node.
1739 * In interprocedural view the Filter performs the Phi operation on
1740 * method parameters or results. Other than a Phi a Filter node may
1741 * not be removed if it has only a single input.
1743 * The constructor builds the Filter in intraprocedural view.
1745 * @param *db A pointer for debug information.
1746 * @param *irg The ir graph the node belong to.
1747 * @param *block The block the node belong to.
1748 * @param *arg The tuple value to project from.
1749 * @param *mode The mode of the projected value.
1750 * @param proj The position in the tuple to project from.
1752 ir_node *new_rd_Filter (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1753 ir_mode *mode, long proj);
1755 /** Constructor for a NoMem node.
1757 * Returns the unique NoMem node of the graph. The same as
1760 * @param *irg The ir graph the node belongs to.
1762 ir_node *new_rd_NoMem (ir_graph *irg);
1764 /** Constructor for a Mux node.
1766 * Adds the node to the block in current_ir_block.
1768 * @param *db A pointer for debug information.
1769 * @param *irg The ir graph the node belong to.
1770 * @param *block The block the node belong to.
1771 * @param *sel The ir_node that calculates the boolean select.
1772 * @param *ir_true The ir_node that calculates the true result.
1773 * @param *ir_false The ir_node that calculates the false result.
1774 * @param *mode The mode of the node (and it_true and ir_false).
1776 ir_node *new_rd_Mux (dbg_info *db, ir_graph *irg, ir_node *block,
1777 ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
1779 /*-------------------------------------------------------------------------*/
1780 /* The raw interface without debug support */
1781 /*-------------------------------------------------------------------------*/
1783 /** Constructor for a Block node.
1785 * Constructs a mature block with the given predecessors. Use Unknown
1786 * nodes as predecessors to construct a block if the number of
1787 * predecessors is known, but not the predecessors themselves. This
1788 * constructor does not set current_block. It not be used with
1789 * automatic Phi node construction.
1792 * @param irg The ir graph the block belongs to.
1793 * @param arity The number of control predecessors.
1794 * @param in[] An array of control predecessors. The length of
1795 * the array must be 'arity'. The constructor copies this array.
1797 ir_node *new_r_Block (ir_graph *irg, int arity, ir_node *in[]);
1799 /** Constructor for a Start node.
1801 * @param *irg The ir graph the node belongs to.
1802 * @param *block The ir block the node belongs to.
1804 ir_node *new_r_Start (ir_graph *irg, ir_node *block);
1806 /** Constructor for a End node.
1808 * @param *irg The ir graph the node belongs to.
1809 * @param *block The ir block the node belongs to.
1811 ir_node *new_r_End (ir_graph *irg, ir_node *block);
1813 /** Constructor for a Jmp node.
1815 * Jmp represents control flow to a single control successor.
1817 * @param *irg The ir graph the node belongs to.
1818 * @param *block The ir block the node belongs to.
1820 ir_node *new_r_Jmp (ir_graph *irg, ir_node *block);
1822 /** Constructor for a Cond node.
1824 * If c is mode_b represents a conditional branch (if/else). If c is
1825 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
1826 * node, default Proj is 0.)
1828 * This is not consistent: Input to Cond is Is, Proj has as proj number
1831 * @param *irg The ir graph the node belongs to.
1832 * @param *block The ir block the node belongs to.
1833 * @param *c The conditions parameter.Can be of mode b or I_u.
1835 ir_node *new_r_Cond (ir_graph *irg, ir_node *block, ir_node *c);
1837 /** Constructor for a Return node.
1839 * Returns the memory an zero or more return values. Only node that
1840 * can end regular control flow.
1842 * @param *irg The ir graph the node belongs to.
1843 * @param *block The ir block the node belongs to.
1844 * @param *store The state of memory.
1845 * @param arity Number of array indexes.
1846 * @param *in[] Array with index inputs to the node. The constructor copies this array.
1848 ir_node *new_r_Return (ir_graph *irg, ir_node *block,
1849 ir_node *store, int arity, ir_node *in[]);
1851 /** Constructor for a Raise node.
1853 * @param *irg The ir graph the node belongs to.
1854 * @param *block The ir block the node belongs to.
1855 * @param *store The current memory.
1856 * @param *obj A pointer to the Except variable.
1858 ir_node *new_r_Raise (ir_graph *irg, ir_node *block,
1859 ir_node *store, ir_node *obj);
1861 /** Constructor for a Const node.
1863 * Constructor for a Const node. The constant represents a target
1864 * value. Sets the type information to type_unknown. (No more
1865 * supported: If tv is entity derives a somehow useful type.)
1867 * @param *irg The ir graph the node belongs to.
1868 * @param *block The ir block the node belongs to.
1869 * @param *mode The mode of the operands and the results.
1870 * @param *con Points to an entry in the constant table.
1872 ir_node *new_r_Const (ir_graph *irg, ir_node *block,
1873 ir_mode *mode, tarval *con);
1875 /** Constructor for a SymConst node.
1877 * This is the constructor for a symbolic constant.
1878 * There are four kinds of symbolic constants:
1879 * - type_tag The symbolic constant represents a type tag. The type the
1880 * tag stands for is given explicitly.
1881 * - size The symbolic constant represents the size of a type. The
1882 * type of which the constant represents the size is given
1884 * - addr_name The symbolic constant represents the address of an entity
1885 * (variable or method). The variable is indicated by a name
1886 * that is valid for linking.
1887 * - addr_ent The symbolic constant represents the address of an entity
1888 * (variable or method). The variable is given explicitly by
1891 * Inputs to the node:
1892 * No inputs except the block it belongs to.
1893 * Outputs of the node.
1894 * An unsigned integer (I_u) or a pointer (P).
1896 * @param *irg The ir graph the node belongs to.
1897 * @param *block The ir block the node belongs to.
1898 * @param volue A type, entity or a ident depending on the SymConst kind.
1899 * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
1901 ir_node *new_r_SymConst (ir_graph *irg, ir_node *block,
1902 union symconst_symbol value, symconst_kind symkind);
1904 /** Constructor for a Sel node.
1906 * The select node selects an entity (field or method) from an entity
1907 * with a compound type. It explicitly specifies the entity selected.
1908 * Dynamically the node may select entities that overwrite the given
1909 * entity. If the selected entity is an array element entity the Sel
1910 * node takes the required array indicees as inputs.
1912 * @param *irg The ir graph the node belongs to.
1913 * @param *block The ir block the node belongs to.
1914 * @param *store The memory in which the object the entity should be selected
1915 * from is allocated.
1916 * @param *objptr A pointer to a compound entity the Sel operation selects a
1917 * single attribute from.
1918 * @param *n_index The number of array indicees needed to select an array element entity.
1919 * @param *index[] If the compound entity is an array the indicees of the selected
1920 * element entity. The constructor copies this array.
1921 * @param *ent The entity to select.
1923 ir_node *new_r_Sel (ir_graph *irg, ir_node *block, ir_node *store,
1924 ir_node *objptr, int n_index, ir_node *index[],
1927 /** Constructor for a InstOf node.
1929 * For translating Java. Not supported as standard firm node.
1931 * @param *irg The ir graph the node belongs to.
1932 * @param *block The ir block the node belongs to.
1937 ir_node *new_r_InstOf (ir_graph *irg, ir_node *block, ir_node *x, ir_node *y, type *z);
1939 /** Constructor for a Call node.
1941 * Represents all kinds of method and function calls.
1943 * @param *irg The ir graph the node belongs to.
1944 * @param *block The ir block the node belongs to.
1945 * @param * store The actual store.
1946 * @param *callee A pointer to the called procedure.
1947 * @param arity The number of procedure parameters.
1948 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
1949 * @param *tp Type information of the procedure called.
1951 ir_node *new_r_Call (ir_graph *irg, ir_node *block, ir_node *store,
1952 ir_node *callee, int arity, ir_node *in[],
1955 /** Constructor for a Add node.
1957 * @param *irg The ir graph the node belongs to.
1958 * @param *block The ir block the node belongs to.
1959 * @param *op1 The operand 1.
1960 * @param *op2 The operand 2.
1961 * @param *mode The mode of the operands and the result.
1963 ir_node *new_r_Add (ir_graph *irg, ir_node *block,
1964 ir_node *op1, ir_node *op2, ir_mode *mode);
1967 * Constructor for a Sub node.
1969 * @param *irg The ir graph the node belongs to.
1970 * @param *block The ir block the node belongs to.
1971 * @param *op1 The operand 1.
1972 * @param *op2 The operand 2.
1973 * @param *mode The mode of the operands and the results.
1975 ir_node *new_r_Sub (ir_graph *irg, ir_node *block,
1976 ir_node *op1, ir_node *op2, ir_mode *mode);
1978 /** Constructor for a Minus node.
1980 * @param *irg The ir graph the node belongs to.
1981 * @param *block The ir block the node belongs to.
1982 * @param *op The operand.
1983 * @param *mode The mode of the operand and the result.
1985 ir_node *new_r_Minus (ir_graph *irg, ir_node *block,
1986 ir_node *op, ir_mode *mode);
1987 /** Constructor for a Mul node.
1989 * @param *irg The ir graph the node belongs to.
1990 * @param *block The ir block the node belongs to.
1991 * @param *op1 The operand 1.
1992 * @param *op2 The operand 2.
1993 * @param *mode The mode of the operands and the result.
1995 ir_node *new_r_Mul (ir_graph *irg, ir_node *block,
1996 ir_node *op1, ir_node *op2, ir_mode *mode);
1998 /** Constructor for a Quot node.
2000 * @param *irg The ir graph the node belongs to.
2001 * @param *block The ir block the node belongs to.
2002 * @param *memop The store needed to model exceptions
2003 * @param *op1 The operand 1.
2004 * @param *op2 The operand 2.
2006 ir_node *new_r_Quot (ir_graph *irg, ir_node *block,
2007 ir_node *memop, ir_node *op1, ir_node *op2);
2009 /** Constructor for a DivMod node.
2011 * @param *irg The ir graph the node belongs to.
2012 * @param *block The ir block the node belongs to.
2013 * @param *memop The store needed to model exceptions
2014 * @param *op1 The operand 1.
2015 * @param *op2 The operand 2.
2017 ir_node *new_r_DivMod (ir_graph *irg, ir_node *block,
2018 ir_node *memop, ir_node *op1, ir_node *op2);
2020 /** Constructor for a Div node.
2022 * @param *irg The ir graph the node belongs to.
2023 * @param *block The ir block the node belongs to.
2024 * @param *memop The store needed to model exceptions
2025 * @param *op1 The operand 1.
2026 * @param *op2 The operand 2.
2028 ir_node *new_r_Div (ir_graph *irg, ir_node *block,
2029 ir_node *memop, ir_node *op1, ir_node *op2);
2031 /** Constructor for a Mod node.
2033 * @param *irg The ir graph the node belongs to.
2034 * @param *block The ir block the node belongs to.
2035 * @param *memop The store needed to model exceptions
2036 * @param *op1 The operand 1.
2037 * @param *op2 The operand 2.
2039 ir_node *new_r_Mod (ir_graph *irg, ir_node *block,
2040 ir_node *memop, ir_node *op1, ir_node *op2);
2042 /** Constructor for a Abs node.
2044 * @param *irg The ir graph the node belongs to.
2045 * @param *block The ir block the node belongs to.
2046 * @param *op The operand
2047 * @param *mode The mode of the operands and the result.
2049 ir_node *new_r_Abs (ir_graph *irg, ir_node *block,
2050 ir_node *op, ir_mode *mode);
2052 /** Constructor for a And node.
2054 * @param *irg The ir graph the node belongs to.
2055 * @param *block The ir block the node belongs to.
2056 * @param *op1 The operand 1.
2057 * @param *op2 The operand 2.
2058 * @param *mode The mode of the operands and the result.
2060 ir_node *new_r_And (ir_graph *irg, ir_node *block,
2061 ir_node *op1, ir_node *op2, ir_mode *mode);
2063 /** Constructor for a Or node.
2065 * @param *irg The ir graph the node belongs to.
2066 * @param *block The ir block the node belongs to.
2067 * @param *op1 The operand 1.
2068 * @param *op2 The operand 2.
2069 * @param *mode The mode of the operands and the result.
2071 ir_node *new_r_Or (ir_graph *irg, ir_node *block,
2072 ir_node *op1, ir_node *op2, ir_mode *mode);
2074 /** Constructor for a Eor node.
2076 * @param *irg The ir graph the node belongs to.
2077 * @param *block The ir block the node belongs to.
2078 * @param *op1 The operand 1.
2079 * @param *op2 The operand 2.
2080 * @param *mode The mode of the operands and the results.
2082 ir_node *new_r_Eor (ir_graph *irg, ir_node *block,
2083 ir_node *op1, ir_node *op2, ir_mode *mode);
2085 /** Constructor for a Not node.
2087 * @param *irg The ir graph the node belongs to.
2088 * @param *block The ir block the node belongs to.
2089 * @param *op The operand.
2090 * @param *mode The mode of the operand and the result.
2092 ir_node *new_r_Not (ir_graph *irg, ir_node *block,
2093 ir_node *op, ir_mode *mode);
2095 /** Constructor for a Cmp node.
2097 * @param *irg The ir graph the node belongs to.
2098 * @param *block The ir block the node belongs to.
2099 * @param *op1 The operand 1.
2100 * @param *op2 The operand 2.
2102 ir_node *new_r_Cmp (ir_graph *irg, ir_node *block,
2103 ir_node *op1, ir_node *op2);
2105 /** Constructor for a Shl node.
2107 * @param *irg The ir graph the node belongs to.
2108 * @param *block The ir block the node belongs to.
2109 * @param *op The operand.
2110 * @param *k The number of bits to shift the operand .
2111 * @param *mode The mode of the operand and the result.
2113 ir_node *new_r_Shl (ir_graph *irg, ir_node *block,
2114 ir_node *op, ir_node *k, ir_mode *mode);
2116 /** Constructor for a Shr node.
2118 * @param *irg The ir graph the node belongs to.
2119 * @param *block The ir block the node belongs to.
2120 * @param *op The operand.
2121 * @param *k The number of bits to shift the operand .
2122 * @param *mode The mode of the operand and the result.
2124 ir_node *new_r_Shr (ir_graph *irg, ir_node *block,
2125 ir_node *op, ir_node *k, ir_mode *mode);
2128 * Constructor for a Shrs node.
2130 * @param *irg The ir graph the node belongs to.
2131 * @param *block The ir block the node belongs to.
2132 * @param *op The operand.
2133 * @param *k The number of bits to shift the operand.
2134 * @param *mode The mode of the operand and the result.
2136 ir_node *new_r_Shrs (ir_graph *irg, ir_node *block,
2137 ir_node *op, ir_node *k, ir_mode *mode);
2139 /** Constructor for a Rot node.
2141 * @param *irg The ir graph the node belongs to.
2142 * @param *block The ir block the node belongs to.
2143 * @param *op The operand.
2144 * @param *k The number of bits to rotate the operand.
2145 * @param *mode The mode of the operand.
2147 ir_node *new_r_Rot (ir_graph *irg, ir_node *block,
2148 ir_node *op, ir_node *k, ir_mode *mode);
2150 /** Constructor for a Conv node.
2152 * @param *irg The ir graph the node belongs to.
2153 * @param *block The ir block the node belongs to.
2154 * @param *op The operand.
2155 * @param *mode The mode of this the operand muss be converted .
2157 ir_node *new_r_Conv (ir_graph *irg, ir_node *block,
2158 ir_node *op, ir_mode *mode);
2160 /** Constructor for a Cast node.
2162 * High level type cast
2164 * @param *irg The ir graph the node belongs to.
2165 * @param *block The ir block the node belongs to.
2166 * @param *op The operand.
2167 * @param *to_tp The type of this the operand muss be casted .
2169 ir_node *new_r_Cast (ir_graph *irg, ir_node *block,
2170 ir_node *op, type *to_tp);
2172 /** Constructor for a Phi node.
2174 * @param *irg The ir graph the node belongs to.
2175 * @param *block The ir block the node belongs to.
2176 * @param arity The number of predecessors
2177 * @param *in[] Array with predecessors. The constructor copies this array.
2178 * @param *mode The mode of it's inputs and output.
2180 ir_node *new_r_Phi (ir_graph *irg, ir_node *block, int arity,
2181 ir_node *in[], ir_mode *mode);
2183 /** Constructor for a Load node.
2185 * @param *irg The ir graph the node belongs to.
2186 * @param *block The ir block the node belongs to.
2187 * @param *store The current memory
2188 * @param *adr A pointer to the variable to be read in this memory.
2189 * @param *mode The mode of the value to be loaded.
2191 ir_node *new_r_Load (ir_graph *irg, ir_node *block,
2192 ir_node *store, ir_node *adr, ir_mode *mode);
2194 /** Constructor for a Store node.
2196 * @param *irg The ir graph the node belongs to.
2197 * @param *block The ir block the node belongs to.
2198 * @param *store The current memory
2199 * @param *adr A pointer to the variable to be read in this memory.
2200 * @param *val The value to write to this variable.
2202 ir_node *new_r_Store (ir_graph *irg, ir_node *block,
2203 ir_node *store, ir_node *adr, ir_node *val);
2205 /** Constructor for a Alloc node.
2207 * The Alloc node extends the memory by space for an entity of type alloc_type.
2209 * @param *irg The ir graph the node belongs to.
2210 * @param *block The ir block the node belongs to.
2211 * @param *store The memory which shall contain the new variable.
2212 * @param *size The number of bytes to allocate.
2213 * @param *alloc_type The type of the allocated variable.
2214 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
2216 ir_node *new_r_Alloc (ir_graph *irg, ir_node *block, ir_node *store,
2217 ir_node *size, type *alloc_type, where_alloc where);
2219 /** Constructor for a Free node.
2221 * Frees the memory occupied by the entity pointed to by the pointer
2222 * arg. Type indicates the type of the entity the argument points to.
2224 * @param *irg The ir graph the node belongs to.
2225 * @param *block The ir block the node belongs to.
2226 * @param *store The memory which shall contain the new variable.
2227 * @param *ptr The pointer to the object to free.
2228 * @param *size The number of objects of type free_type to free in a sequence.
2229 * @param *free_type The type of the freed variable.
2231 ir_node *new_r_Free (ir_graph *irg, ir_node *block, ir_node *store,
2232 ir_node *ptr, ir_node *size, type *free_type);
2234 /** Constructor for a Sync node.
2236 * Merges several memory values. The node assumes that a variable
2237 * either occurs only in one of the memories, or it contains the same
2238 * value in all memories where it occurs.
2240 * @param *irg The ir graph the node belongs to.
2241 * @param *block The ir block the node belongs to.
2242 * @param arity The number of memories to syncronize.
2243 * @param *in[] An array of pointers to nodes that produce an output of type memory.
2244 * The constructor copies this array.
2246 ir_node *new_r_Sync (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2248 /** Constructor for a Proj node.
2250 * Projects a single value out of a tuple. The parameter proj gives the
2251 * position of the value within the tuple.
2253 * @param *irg The ir graph the node belongs to.
2254 * @param *block The ir block the node belongs to.
2255 * @param arg A node producing a tuple.
2256 * @param *mode The mode of the value to project.
2257 * @param proj The position of the value in the tuple.
2259 ir_node *new_r_Proj (ir_graph *irg, ir_node *block, ir_node *arg,
2260 ir_mode *mode, long proj);
2262 /** Constructor for a defaultProj node.
2264 * Represents the default control flow of a Switch-Cond node.
2266 * @param *irg The ir graph the node belongs to.
2267 * @param *block The ir block the node belongs to.
2268 * @param arg A node producing a tuple.
2269 * @param max_ proj The end position of the value in the tuple.
2271 ir_node *new_r_defaultProj (ir_graph *irg, ir_node *block, ir_node *arg, long max_proj);
2274 /** Constructor for a Tuple node.
2276 * This is an auxiliary node to replace a node that returns a tuple
2277 * without changing the corresponding Proj nodes.
2279 * @param *irg The ir graph the node belongs to.
2280 * @param *block The ir block the node belongs to.
2281 * @param arity The number of tuple elements.
2282 * @param *in[] An array containing pointers to the nodes producing the tuple elements.
2283 * The constructor copies this array.
2285 ir_node *new_r_Tuple (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2287 /** Constructor for a Id node.
2289 * This is an auxiliary node to replace a node that returns a single
2292 * @param *irg The ir graph the node belongs to.
2293 * @param *block The ir block the node belongs to.
2294 * @param *val The operand to Id.
2295 * @param *mode The mode of *val.
2297 ir_node *new_r_Id (ir_graph *irg, ir_node *block,
2298 ir_node *val, ir_mode *mode);
2300 /** Constructor for a Bad node.
2302 * Returns the unique Bad node of the graph. The same as
2305 * @param *irg The ir graph the node belongs to.
2309 ir_node *new_r_Bad (ir_graph *irg);
2311 /** Constructor for a Confirm node.
2313 * Specifies constraints for a value. To support dataflow analyses.
2315 * Example: If the value never exceeds '100' this is expressed by placing a
2316 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
2318 * @param *irg The ir graph the node belong to.
2319 * @param *block The ir block the node belong to.
2320 * @param *db A pointer for debug information.
2321 * @param *val The value we express a constraint for
2322 * @param *bound The value to compare against. Must be a firm node, typically a constant.
2323 * @param cmp The compare operation.
2326 ir_node *new_r_Confirm (ir_graph *irg, ir_node *block,
2327 ir_node *val, ir_node *bound, pn_Cmp cmp);
2329 /** Constructor for a Unknown node.
2331 * Represents an arbtrary valus. Places the node in
2334 * @param *irg The ir graph the node belongs to.
2335 * @param *m The mode of the unknown value.
2337 ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2339 /** Constructor for a CallBegin node.
2341 * CallBegin represents control flow depending of the pointer value
2342 * representing the called method to the called methods. The
2343 * constructor copies the method pointer input from the passed Call
2346 * @param *irg The ir graph the node belong to.
2347 * @param *block The block the node belong to.
2348 * @param *callee The call node bisible in the intra procedural view.
2350 ir_node *new_r_CallBegin(ir_graph *irg, ir_node *block, ir_node *callee);
2352 /** Constructor for a EndReg node.
2354 * Used to represent regular procedure end in interprocedual view.
2356 * @param *irg The ir graph the node belong to.
2357 * @param *block The block the node belong to.
2359 ir_node *new_r_EndReg (ir_graph *irg, ir_node *block);
2361 /** Constructor for a EndExcept node.
2363 * Used to represent exceptional procedure end in interprocedural view.
2365 * @param *irg The ir graph the node belong to.
2366 * @param *block The block the node belong to.
2368 ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
2370 /** Constructor for a Break node.
2372 * Break represents control flow to a single control successor just as Jmp.
2373 * The blocks separated by a break may not be concatenated by an optimization.
2374 * It is used for the interprocedural representation where blocks are parted
2375 * behind Call nodes to represent the control flow to called procedures.
2377 * @param *irg The ir graph the node belong to.
2378 * @param *block The block the node belong to.
2380 ir_node *new_r_Break (ir_graph *irg, ir_node *block);
2382 /** Constructor for a Filter node.
2384 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
2385 * Filter is a node with two views used to construct the interprocedural view.
2386 * In intraprocedural view its semantics are identical to the Proj node.
2387 * In interprocedural view the Filter performs the Phi operation on method
2388 * parameters or results. Other than a Phi a Filter node may not be removed
2389 * if it has only a single input.
2391 * The constructor builds the Filter in intraprocedural view.
2393 * @param *irg The ir graph the node belong to.
2394 * @param *block The block the node belong to.
2395 * @param *arg The tuple value to project from.
2396 * @param *mode The mode of the projected value.
2397 * @param proj The position in the tuple to project from.
2399 ir_node *new_r_Filter (ir_graph *irg, ir_node *block, ir_node *arg,
2400 ir_mode *mode, long proj);
2402 /** Constructor for a NoMem node.
2404 * Returns the unique NoMem node of the graph. The same as
2407 * @param *irg The ir graph the node belongs to.
2409 ir_node *new_r_NoMem (ir_graph *irg);
2411 /** Constructor for a Mux node.
2413 * Adds the node to the block in current_ir_block.
2415 * @param *irg The ir graph the node belong to.
2416 * @param *block The block the node belong to.
2417 * @param *sel The ir_node that calculates the boolean select.
2418 * @param *ir_true The ir_node that calculates the true result.
2419 * @param *ir_false The ir_node that calculates the false result.
2420 * @param *mode The mode of the node (and it_true and ir_false).
2422 ir_node *new_r_Mux (ir_graph *irg, ir_node *block,
2423 ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2425 /*-----------------------------------------------------------------------*/
2426 /* The block oriented interface */
2427 /*-----------------------------------------------------------------------*/
2429 /** Sets the current block in which the following constructors place the
2430 * nodes they construct.
2432 * @param target The new current block.
2434 void set_cur_block (ir_node *target);
2436 /** Returns the current block of the current graph. */
2437 ir_node *get_cur_block(void);
2439 /** Returns the fixed nodes of the current graph. */
2440 #define get_cur_end_block() get_irg_end_block(current_ir_graph)
2441 #define get_cur_end() get_irg_end(current_ir_graph)
2442 #define get_cur_start_block() get_irg_start_block(current_ir_graph)
2443 #define get_cur_start() get_irg_start(current_ir_graph)
2445 /** Constructor for a Block node.
2447 * Adds the block to the graph in current_ir_graph. Constructs a Block
2448 * with a fixed number of predecessors. Does set current_block. Can
2449 * be used with automatic Phi node construction.
2451 * @param *db A Pointer for debugginfomation.
2452 * @param arity The number of control predecessors.
2453 * @param in[] An array of control predecessors. The length of
2454 * the array must be 'arity'.
2456 ir_node *new_d_Block(dbg_info* db, int arity, ir_node *in[]);
2458 /** Constructor for a Start node.
2460 * Adds the node to the block in current_ir_block.
2462 * @param *db A pointer for debug information.
2464 ir_node *new_d_Start (dbg_info* db);
2466 /** Constructor for a End node.
2468 * Adds the node to the block in current_ir_block.
2470 * @param *db A pointer for debug information.
2472 ir_node *new_d_End (dbg_info* db);
2474 /** Constructor for a Jmp node.
2476 * Adds the node to the block in current_ir_block.
2478 * Jmp represents control flow to a single control successor.
2480 * @param *db A pointer for debug information.
2483 ir_node *new_d_Jmp (dbg_info* db);
2485 /** Constructor for a Cond node.
2487 * Adds the node to the block in current_ir_block.
2489 * If c is mode_b represents a conditional branch (if/else). If c is
2490 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2491 * node, default Proj is 0.)
2493 * This is not consistent: Input to Cond is Is, Proj has as proj number
2496 * @param *db A pointer for debug information.
2497 * @param *c The conditions parameter.Can be of mode b or I_u.
2500 ir_node *new_d_Cond (dbg_info* db, ir_node *c);
2502 /** Constructor for a Return node.
2504 * Adds the node to the block in current_ir_block.
2506 * Returns the memory an zero or more return values. Only node that
2507 * can end regular control flow.
2509 * @param *db A pointer for debug information.
2510 * @param *store The state of memory.
2511 * @param arity Number of array indexes.
2512 * @param *in Array with index inputs to the node.
2515 ir_node *new_d_Return (dbg_info* db, ir_node *store, int arity, ir_node *in[]);
2517 /** Constructor for a Raise node.
2519 * Adds the node to the block in current_ir_block.
2521 * @param *db A pointer for debug information.
2522 * @param *store The current memory.
2523 * @param *obj A pointer to the Except variable.
2526 ir_node *new_d_Raise (dbg_info* db, ir_node *store, ir_node *obj);
2528 /** Constructor for a Const_type node.
2530 * Adds the node to the block in current_ir_block.
2532 * The constant represents a target value. This constructor sets high
2533 * level type information for the constant value.
2535 * @param *db A pointer for debug information.
2536 * @param *mode The mode of the operands and redults.
2537 * @param *con Points to an entry in the constant table. This pointer is
2538 added to the attributes of the node.
2539 * @param *tp The type of the constante.
2542 ir_node *new_d_Const_type (dbg_info* db, ir_mode *mode, tarval *con, type *tp);
2544 /** Constructor for a Const node.
2546 * Adds the node to the block in current_ir_block.
2548 * Constructor for a Const node. The constant represents a target
2549 * value. Sets the type information to type_unknown. (No more
2550 * supported: If tv is entity derives a somehow useful type.)
2552 * @param *db A pointer for debug information.
2553 * @param *mode The mode of the operands and redults.
2554 * @param *con Points to an entry in the constant table. This pointer is added
2555 * to the attributes of the node.
2557 ir_node *new_d_Const (dbg_info* db, ir_mode *mode, tarval *con);
2559 /** Constructor for a SymConst_type node.
2561 * Adds the node to the block in current_ir_block.
2562 * This is the constructor for a symbolic constant.
2563 * There are four kinds of symbolic constants:
2564 * - type_tag The symbolic constant represents a type tag. The type the
2565 * tag stands for is given explicitly.
2566 * - size The symbolic constant represents the size of a type. The
2567 * type of which the constant represents the size is given
2569 * - addr_name The symbolic constant represents the address of an entity
2570 * (variable or method). The variable is indicated by a name
2571 * that is valid for linking.
2572 * - addr_ent The symbolic constant represents the address of an entity
2573 * (variable or method). The variable is given explicitly by
2576 * Inputs to the node:
2577 * No inputs except the block it belongs to.
2578 * Outputs of the node.
2579 * An unsigned integer (I_u) or a pointer (P).
2581 * @param *db A pointer for debug information.
2582 * @param value A type, entity or ident depending on the SymConst kind.
2583 * @param symkind The kind of the symbolic constant: symconst_type_tag, symconst_size
2584 * or symconst_addr_name.
2585 * @param tp The source type of the constant.
2588 ir_node *new_d_SymConst_type (dbg_info* db, union symconst_symbol value, symconst_kind kind, type* tp);
2590 /** Constructor for a SymConst node.
2592 * Same as new_d_SymConst_type, except that it sets the type to type_unknown. */
2593 ir_node *new_d_SymConst (dbg_info* db, union symconst_symbol value, symconst_kind kind);
2595 /** Constructor for a simpleSel node.
2597 * This is a shortcut for the new_d_Sel() constructor. To be used for
2598 * Sel nodes that do not select from an array, i.e., have no index
2599 * inputs. It adds the two parameters 0, NULL.
2601 * @param *db A pointer for debug information.
2602 * @param *store The memory in which the object the entity should be
2603 * selected from is allocated.
2604 * @param *objptr The object from that the Sel operation selects a
2605 * single attribute out.
2606 * @param *ent The entity to select.
2608 ir_node *new_d_simpleSel(dbg_info* db, ir_node *store, ir_node *objptr, entity *ent);
2610 /** Constructor for a Sel node.
2612 * The select node selects an entity (field or method) from an entity
2613 * with a compound type. It explicitly specifies the entity selected.
2614 * Dynamically the node may select entities that overwrite the given
2615 * entity. If the selected entity is an array element entity the Sel
2616 * node takes the required array indicees as inputs.
2617 * Adds the node to the block in current_ir_block.
2619 * @param *db A pointer for debug information.
2620 * @param *store The memory in which the object the entity should be selected
2621 * from is allocated.
2622 * @param *objptr A pointer to a compound entity the Sel operation selects a
2623 * single attribute from.
2624 * @param *n_index The number of array indicees needed to select an array element entity.
2625 * @param *index[] If the compound entity is an array the indicees of the selected
2626 * element entity. The constructor copies this array.
2627 * @param *ent The entity to select.
2629 ir_node *new_d_Sel (dbg_info* db, ir_node *store, ir_node *objptr, int arity, ir_node *in[],
2632 /** Constructor for a InstOf node.
2634 * Adds the node to the block in current_ir_block.
2636 * For translating Java. Not supported as standard firm node.
2638 * @param *db A pointer for debug information.
2643 ir_node *new_d_InstOf (dbg_info* db, ir_node *store, ir_node *objptr, type *ent);
2645 /** Constructor for a Call node.
2647 * Represents all kinds of method and function calls.
2648 * Adds the node to the block in current_ir_block.
2650 * @param *db A pointer for debug information.
2651 * @param *store The actual store.
2652 * @param *callee A pointer to the called procedure.
2653 * @param arity The number of procedure parameters.
2654 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2655 * @param *tp Type information of the procedure called.
2658 ir_node *new_d_Call (dbg_info* db, ir_node *store, ir_node *callee, int arity, ir_node *in[],
2661 /** Constructor for a Add node.
2663 * Adds the node to the block in current_ir_block.
2665 * @param *db A pointer for debug information.
2666 * @param *op1 The operand 1.
2667 * @param *op2 The operand 2.
2668 * @param *mode The mode of the operands and the result.
2670 ir_node *new_d_Add (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2672 /** Constructor for a Sub node.
2674 * Adds the node to the block in current_ir_block.
2676 * @param *db A pointer for debug information.
2677 * @param *op1 The operand 1.
2678 * @param *op2 The operand 2.
2679 * @param *mode The mode of the operands and the result.
2682 ir_node *new_d_Sub (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2684 /** Constructor for a Minus node.
2686 * Adds the node to the block in current_ir_block.
2688 * @param *db A pointer for debug information.
2689 * @param *op The operand .
2690 * @param *mode The mode of the operand and the result.
2692 ir_node *new_d_Minus (dbg_info* db, ir_node *op, ir_mode *mode);
2694 /** Constructor for a Mul node.
2696 * Adds the node to the block in current_ir_block.
2698 * @param *db A pointer for debug information.
2699 * @param *op1 The operand 1.
2700 * @param *op2 The operand 2.
2701 * @param *mode The mode of the operands and the result.
2703 ir_node *new_d_Mul (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2705 /** Constructor for a Quot node.
2707 * Adds the node to the block in current_ir_block.
2709 * @param *db A pointer for debug information.
2710 * @param *memop The store needed to model exceptions
2711 * @param *op1 The operand 1.
2712 * @param *op2 The operand 2.
2714 ir_node *new_d_Quot (dbg_info* db, ir_node *memop, ir_node *op1, ir_node *op2);
2716 /** Constructor for a DivMod node.
2718 * Adds the node to the block in current_ir_block.
2720 * @param *db A pointer for debug information.
2721 * @param *memop The store needed to model exceptions
2722 * @param *op1 The operand 1.
2723 * @param *op2 The operand 2.
2725 ir_node *new_d_DivMod (dbg_info* db, ir_node *memop, ir_node *op1, ir_node *op2);
2727 /** Constructor for a Div node.
2729 * Adds the node to the block in current_ir_block.
2731 * @param *db A pointer for debug information.
2732 * @param *memop The store needed to model exceptions
2733 * @param *op1 The operand 1.
2734 * @param *op2 The operand 2.
2736 ir_node *new_d_Div (dbg_info* db, ir_node *memop, ir_node *op1, ir_node *op2);
2738 /** Constructor for a Mod node.
2740 * Adds the node to the block in current_ir_block.
2742 * @param *db A pointer for debug information.
2743 * @param *memop The store needed to model exceptions
2744 * @param *op1 The operand 1.
2745 * @param *op2 The operand 2.
2747 ir_node *new_d_Mod (dbg_info* db, ir_node *memop, ir_node *op1, ir_node *op2);
2749 /** Constructor for a Abs node.
2751 * Adds the node to the block in current_ir_block.
2753 * @param *db A pointer for debug information.
2754 * @param *op The operand
2755 * @param *mode The mode of the operands and the result.
2757 ir_node *new_d_Abs (dbg_info* db, ir_node *op, ir_mode *mode);
2759 /** Constructor for a And node.
2761 * Adds the node to the block in current_ir_block.
2763 * @param *db A pointer for debug information.
2764 * @param *irg The ir graph the node belongs to.
2765 * @param *block The ir block the node belongs to.
2766 * @param *op1 The operand 1.
2767 * @param *op2 The operand 2.
2768 * @param *mode The mode of the operands and the result.
2770 ir_node *new_d_And (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2772 /** Constructor for a Or node.
2774 * Adds the node to the block in current_ir_block.
2776 * @param *db A pointer for debug information.
2777 * @param *op1 The operand 1.
2778 * @param *op2 The operand 2.
2779 * @param *mode The mode of the operands and the result.
2781 ir_node *new_d_Or (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2783 /** Constructor for a Eor node.
2785 * Adds the node to the block in current_ir_block.
2787 * @param *db A pointer for debug information.
2788 * @param *op1 The operand 1.
2789 * @param *op2 The operand 2.
2790 * @param *mode The mode of the operands and the results.
2792 ir_node *new_d_Eor (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2794 /** Constructor for a Not node.
2796 * Adds the node to the block in current_ir_block.
2798 * @param *db A pointer for debug information.
2799 * @param *op The operand.
2800 * @param *mode The mode of the operand and the result.
2802 ir_node *new_d_Not (dbg_info* db, ir_node *op, ir_mode *mode);
2804 /** Constructor for a Shl node.
2806 * Adds the node to the block in current_ir_block.
2808 * @param *db A pointer for debug information.
2809 * @param *op The operand.
2810 * @param *k The number of bits to shift the operand .
2811 * @param *mode The mode of the operand and the result.
2813 ir_node *new_d_Shl (dbg_info* db, ir_node *op, ir_node *k, ir_mode *mode);
2815 /** Constructor for a Shr node.
2817 * Adds the node to the block in current_ir_block.
2819 * @param *db A pointer for debug information.
2820 * @param *op The operand.
2821 * @param *k The number of bits to shift the operand .
2822 * @param *mode The mode of the operand and the result.
2824 ir_node *new_d_Shr (dbg_info* db, ir_node *op, ir_node *k, ir_mode *mode);
2826 /** Constructor for a Shrs node.
2828 * Adds the node to the block in current_ir_block.
2830 * @param *db A pointer for debug information.
2831 * @param *op The operand.
2832 * @param *k The number of bits to shift the operand .
2833 * @param *mode The mode of the operand and the result.
2835 ir_node *new_d_Shrs (dbg_info* db, ir_node *op, ir_node *k, ir_mode *mode);
2837 /** Constructor for a Rot node.
2839 * Adds the node to the block in current_ir_block.
2841 * @param *db A pointer for debug information.
2842 * @param *op The operand.
2843 * @param *k The number of bits to rotate the operand.
2844 * @param *mode The mode of the operand.
2846 ir_node *new_d_Rot (dbg_info* db, ir_node *op, ir_node *k, ir_mode *mode);
2848 /** Constructor for a Cmp node.
2850 * Adds the node to the block in current_ir_block.
2852 * @param *db A pointer for debug information.
2853 * @param *op1 The operand 1.
2854 * @param *op2 The operand 2.
2856 ir_node *new_d_Cmp (dbg_info* db, ir_node *op1, ir_node *op2);
2858 /** Constructor for a Conv node.
2860 * Adds the node to the block in current_ir_block.
2862 * @param *db A pointer for debug information.
2863 * @param *op The operand.
2864 * @param *mode The mode of this the operand muss be converted .
2866 ir_node *new_d_Conv (dbg_info* db, ir_node *op, ir_mode *mode);
2868 /**Constructor for a Cast node.
2870 * High level type cast
2871 * Adds the node to the block in current_ir_block.
2873 * @param *db A pointer for debug information.
2874 * @param *op The operand.
2875 * @param *to_tp The type of this the operand muss be casted .
2877 ir_node *new_d_Cast (dbg_info* db, ir_node *op, type *to_tp);
2879 /**Constructor for a Phi node.
2881 * Adds the node to the block in current_ir_block.
2883 * @param *db A pointer for debugginaromation.
2884 * @param arity The number of predecessors
2885 * @param *in Array with predecessors
2886 * @param *mode The mode of it's inputs and output.
2888 ir_node *new_d_Phi (dbg_info* db, int arity, ir_node *in[], ir_mode *mode);
2890 /** Constructor for a Load node.
2892 * Adds the node to the block in current_ir_block.
2894 * @param *db A pointer for debug information.
2895 * @param *store The current memory
2896 * @param *adr A pointer to the variable to be read in this memory.
2897 * @param *mode The mode of the value to be loaded.
2899 ir_node *new_d_Load (dbg_info* db, ir_node *store, ir_node *addr, ir_mode *mode);
2901 /** Constructor for a Store node.
2903 * Adds the node to the block in current_ir_block.
2905 * @param *db A pointer for debug information.
2906 * @param *store The current memory
2907 * @param *adr A pointer to the variable to be read in this memory.
2908 * @param *val The value to write to this variable.
2910 ir_node *new_d_Store (dbg_info* db, ir_node *store, ir_node *addr, ir_node *val);
2912 /** Constructor for a Alloc node.
2914 * The Alloc node extends the memory by space for an entity of type alloc_type.
2915 * Adds the node to the block in current_ir_block.
2917 * @param *db A pointer for debug information.
2918 * @param *store The memory which shall contain the new variable.
2919 * @param *size The number of bytes to allocate.
2920 * @param *alloc_type The type of the allocated variable.
2921 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
2923 ir_node *new_d_Alloc (dbg_info* db, ir_node *store, ir_node *size, type *alloc_type,
2926 /** Constructor for a Free node.
2928 * Frees the memory occupied by the entity pointed to by the pointer
2929 * arg. Type indicates the type of the entity the argument points to.
2930 * Adds the node to the block in current_ir_block.
2932 * @param *db A pointer for debug information.
2933 * @param *store The memory which shall contain the new variable.
2934 * @param *ptr The pointer to the object to free.
2935 * @param *size The number of objects of type free_type to free in a sequence.
2936 * @param *free_type The type of the freed variable.
2938 ir_node *new_d_Free (dbg_info* db, ir_node *store, ir_node *ptr, ir_node *size,
2941 /** Constructor for a Sync node.
2943 * Merges several memory values. The node assumes that a variable
2944 * either occurs only in one of the memories, or it contains the same
2945 * value in all memories where it occurs.
2946 * Adds the node to the block in current_ir_block.
2948 * @param *db A pointer for debug information.
2949 * @param arity The number of memories to syncronize.
2950 * @param **in An array of pointers to nodes that produce an output of type
2951 * memory. The constructor copies this array.
2953 ir_node *new_d_Sync (dbg_info* db, int arity, ir_node *in[]);
2956 /** Constructor for a Proj node.
2958 * Projects a single value out of a tuple. The parameter proj gives the
2959 * position of the value within the tuple.
2960 * Adds the node to the block in current_ir_block.
2962 * @param *db A pointer for deubugginformation.
2963 * @param arg A node producing a tuple.
2964 * @param *mode The mode of the value to project.
2965 * @param proj The position of the value in the tuple.
2967 ir_node *new_d_Proj (dbg_info* db, ir_node *arg, ir_mode *mode, long proj);
2970 /** Constructor for a defaultProj node.
2972 * Represents the default control flow of a Switch-Cond node.
2973 * Adds the node to the block in current_ir_block.
2975 * @param *db A pointer for debug information.
2976 * @param arg A node producing a tuple.
2977 * @param max_ proj The end position of the value in the tuple.
2979 ir_node *new_d_defaultProj (dbg_info* db, ir_node *arg, long max_proj);
2981 /** Constructor for a Tuple node.
2983 * This is an auxiliary node to replace a node that returns a tuple
2984 * without changing the corresponding Proj nodes.
2985 * Adds the node to the block in current_ir_block.
2987 * @param *db A pointer for debug information.
2988 * @param arity The number of tuple elements.
2989 * @param **in An array containing pointers to the nodes producing the tuple elements.
2991 ir_node *new_d_Tuple (dbg_info* db, int arity, ir_node *in[]);
2994 /** Constructor for a Id node.
2996 * This is an auxiliary node to replace a node that returns a single
2997 * value. Adds the node to the block in current_ir_block.
2999 * @param *db A pointer for debug information.
3000 * @param *val The operand to Id.
3001 * @param *mode The mode of *val.
3003 ir_node *new_d_Id (dbg_info* db, ir_node *val, ir_mode *mode);
3005 /** Costructor for a Bad node.
3007 * Returns the unique Bad node of the graph. The same as
3010 ir_node *new_d_Bad (void);
3012 /** Constructor for a Confirm node.
3014 * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3015 * Specifies constraints for a value. To support dataflow analyses.
3017 * Example: If the value never exceeds '100' this is expressed by placing a
3018 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
3020 * @param *db A pointer for debug information.
3021 * @param *val The value we express a constraint for
3022 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3023 * @param cmp The compare operation.
3025 ir_node *new_d_Confirm (dbg_info* db, ir_node *val, ir_node *bound, pn_Cmp cmp);
3028 /** Constructor for an Unknown node.
3030 * Represents an arbtrary valus. Places the node in
3033 * @param *m The mode of the unknown value.
3035 ir_node *new_d_Unknown(ir_mode *m);
3037 /** Constructor for a CallBegin node.
3039 * CallBegin represents control flow depending of the pointer value
3040 * representing the called method to the called methods. The
3041 * constructor copies the method pointer input from the passed Call
3042 * node.Adds the node to the block in current_ir_block.
3044 * @param *db A pointer for debug information.
3045 * @param *callee The call node bisible in the intra procedural view.
3047 ir_node *new_d_CallBegin(dbg_info *db, ir_node *callee);
3049 /** Constructor for an EndReg node.
3051 *Adds the node to the block in current_ir_block.
3053 * @param *db A pointer for debug information.
3055 ir_node *new_d_EndReg (dbg_info *db);
3057 /** Constructor for an Endexcept node.
3059 * Used to represent regular procedure end in interprocedual view.
3060 * Adds the node to the block in current_ir_block.
3062 * @param *db A pointer for debug information.
3064 ir_node *new_d_EndExcept(dbg_info *db);
3066 /** Constructor for a Break node.
3068 * Used to represent exceptional procedure end in interprocedural view.
3069 * Adds the node to the block in current_ir_block.
3071 * Break represents control flow to a single control successor just as Jmp.
3072 * The blocks separated by a break may not be concatenated by an optimization.
3073 * It is used for the interprocedural representation where blocks are parted
3074 * behind Call nodes to represent the control flow to called procedures.
3076 * @param *db A pointer for debug information.
3078 ir_node *new_d_Break (dbg_info *db);
3080 /** Constructor for a Filter node.
3082 * Constructor for a Filter node. Adds the node to the block in
3083 * current_ir_block. Filter is a node with two views used to
3084 * construct the interprocedural view. In intraprocedural view its
3085 * semantics are identical to the Proj node. In interprocedural view
3086 * the Filter performs the Phi operation on method parameters or
3087 * results. Other than a Phi a Filter node may not be removed if it
3088 * has only a single input.
3090 * The constructor builds the Filter in intraprocedural view.
3092 * @param *db A pointer for debug information.
3093 * @param *arg The tuple value to project from.
3094 * @param *mode The mode of the projected value.
3095 * @param proj The position in the tuple to project from.
3097 ir_node *new_d_Filter (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3100 /** Constructor for a NoMem node.
3102 * Returns the unique NoMem node of the graph. The same as
3105 ir_node *new_d_NoMem (void);
3107 /** Constructor for a Mux node.
3109 * Adds the node to the block in current_ir_block.
3111 * @param *db A pointer for debug information.
3112 * @param *sel The ir_node that calculates the boolean select.
3113 * @param *ir_true The ir_node that calculates the true result.
3114 * @param *ir_false The ir_node that calculates the false result.
3115 * @param *mode The mode of the node (and it_true and ir_false).
3117 ir_node *new_d_Mux (dbg_info *db, ir_node *sel,
3118 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
3120 /*-----------------------------------------------------------------------*/
3121 /* The block oriented interface without debug support */
3122 /*-----------------------------------------------------------------------*/
3124 /* Needed from the interfase with debug support:
3125 void set_cur_block (ir_node *target); */
3127 /** Constructor for a Block node.
3129 * Constructor for a Block node. Adds the block to the graph in
3130 * current_ir_graph. Constructs a Block with a fixed number of
3131 * predecessors. Does set current_block. Can be used with automatic
3132 * Phi node construction.
3134 * @param arity The number of control predecessors.
3135 * @param in An array of control predecessors. The length of
3136 * the array must be 'arity'.
3138 ir_node *new_Block(int arity, ir_node *in[]);
3140 /** Constructor for a Start node.
3142 * Adds the node to the block in current_ir_block.
3145 ir_node *new_Start (void);
3147 /** Constructor for an End node.
3149 * Adds the node to the block in current_ir_block.
3151 ir_node *new_End (void);
3153 /** Constructor for an EndReg node.
3155 * Used to represent regular procedure end in interprocedual view.
3156 * Adds the node to the block in current_ir_block.
3158 ir_node *new_EndReg (void);
3160 /** Constructor for an EndExpcept node.
3162 * Used to represent exceptional procedure end in interprocedural view.
3163 * Adds the node to the block in current_ir_block.
3165 ir_node *new_EndExcept(void);
3167 /** Constructor for a Jump node.
3169 * Adds the node to the block in current_ir_block.
3171 * Jmp represents control flow to a single control successor.
3173 ir_node *new_Jmp (void);
3175 /** Constructor for a Break node.
3176 * Break represents control flow to a single control successor just as Jmp.
3177 * The blocks separated by a break may not be concatenated by an optimization.
3178 * It is used for the interprocedural representation where blocks are parted
3179 * behind Call nodes to represent the control flow to called procedures.
3180 * Adds the node to the block in current_ir_block.
3182 ir_node *new_Break (void);
3184 /** Constructor for a Cond node.
3186 * If c is mode_b represents a conditional branch (if/else). If c is
3187 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
3188 * node, default Proj is 0.). Adds the node to the block in current_ir_block.
3190 * This is not consistent: Input to Cond is Is, Proj has as proj number
3194 * @param *c The conditions parameter.Can be of mode b or I_u.
3196 ir_node *new_Cond (ir_node *c);
3198 /** Constructor for a Return node.
3200 * Returns the memory an zero or more return values. Only node that
3201 * can end regular control flow. Adds the node to the block in current_ir_block.
3203 * @param *store The state of memory.
3204 * @param arity Number of array indexes.
3205 * @param *in Array with index inputs to the node.
3207 ir_node *new_Return (ir_node *store, int arity, ir_node *in[]);
3209 /**Constructor for a Raise node.
3211 * Adds the node to the block in current_ir_block.
3213 * @param *store The current memory.
3214 * @param *obj A pointer to the Except variable.
3216 ir_node *new_Raise (ir_node *store, ir_node *obj);
3218 /** Constructor for a Const node.
3220 * Constructor for a Const node. The constant represents a target
3221 * value. Sets the type information to type_unknown. (No more
3222 * supported: If tv is entity derives a somehow useful type.)
3223 * Adds the node to the block in current_ir_block.
3225 * @param *mode The mode of the operands and redults.
3226 * @param *con Points to an entry in the constant table. This pointer is
3227 * added to the attributes of the node.
3229 ir_node *new_Const (ir_mode *mode, tarval *con);
3231 /** Constructor for a Const node.
3233 * Derives mode from passed type. */
3234 ir_node *new_Const_type(tarval *con, type *tp);
3236 /** Constructor for a SymConst node.
3238 * Adds the node to the block in current_ir_block.
3239 * This is the constructor for a symbolic constant.
3240 * There are four kinds of symbolic constants:
3241 * - type_tag The symbolic constant represents a type tag. The type the
3242 * tag stands for is given explicitly.
3243 * - size The symbolic constant represents the size of a type. The
3244 * type of which the constant represents the size is given
3246 * - addr_name The symbolic constant represents the address of an entity
3247 * (variable or method). The variable is indicated by a name
3248 * that is valid for linking.
3249 * - addr_ent The symbolic constant represents the address of an entity
3250 * (variable or method). The variable is given explicitly by
3253 * Inputs to the node:
3254 * No inputs except the block it belongs to.
3255 * Outputs of the node.
3256 * An unsigned integer (I_u) or a pointer (P).
3258 * @param value A type or a ident depending on the SymConst kind.
3259 * @param symkind The kind of the symbolic constant: symconst_type_tag, symconst_size or symconst_addr_name.
3261 ir_node *new_SymConst (union symconst_symbol value, symconst_kind kind);
3263 /** Constructor for a simpelSel node.
3265 * This is a shortcut for the new_Sel() constructor. To be used for
3266 * Sel nodes that do not select from an array, i.e., have no index
3267 * inputs. It adds the two parameters 0, NULL.
3269 * @param *store The memory in which the object the entity should be selected from is allocated.
3270 * @param *objptr The object from that the Sel operation selects a single attribute out.
3271 * @param *ent The entity to select.
3273 ir_node *new_simpleSel(ir_node *store, ir_node *objptr, entity *ent);
3275 /** Constructor for a Sel node.
3277 * The select node selects an entity (field or method) from an entity
3278 * with a compound type. It explicitly specifies the entity selected.
3279 * Dynamically the node may select entities that overwrite the given
3280 * entity. If the selected entity is an array element entity the Sel
3281 * node takes the required array indicees as inputs.
3282 * Adds the node to the block in current_ir_block.
3284 * @param *store The memory in which the object the entity should be selected
3285 * from is allocated.
3286 * @param *objptr A pointer to a compound entity the Sel operation selects a
3287 * single attribute from.
3288 * @param *n_index The number of array indicees needed to select an array element entity.
3289 * @param *index[] If the compound entity is an array the indicees of the selected
3290 * element entity. The constructor copies this array.
3291 * @param *ent The entity to select.
3293 ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3296 /** Constructor for an InstOf node.
3298 * Adds the node to the block in current_ir_block.
3299 * For translating Java. Not supported as standard firm node.
3305 ir_node *new_InstOf (ir_node *store, ir_node *obj, type *ent);
3307 /** Constructor for a Call node.
3309 * Adds the node to the block in current_ir_block.
3310 * Represents all kinds of method and function calls.
3312 * @param *store The actual store.
3313 * @param *callee A pointer to the called procedure.
3314 * @param arity The number of procedure parameters.
3315 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3316 * @param *tp Type information of the procedure called.
3318 ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node *in[],
3321 /** Constructor for a CallBegin node.
3323 * Adds the node to the block in current_ir_block.
3325 * @param *callee A pointer to the called procedure.
3327 ir_node *new_CallBegin(ir_node *callee);
3329 /**Constructor for a Add node.
3331 * CallBegin represents control flow depending of the pointer value
3332 * representing the called method to the called methods. The
3333 * constructor copies the method pointer input from the passed Call
3334 * node.Adds the node to the block in current_ir_block.
3336 * @param *op1 The operand 1.
3337 * @param *op2 The operand 2.
3338 * @param *mode The mode of the operands and the result.
3340 ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
3342 /** Constructor for a Sub node.
3344 * Adds the node to the block in current_ir_block.
3346 * @param *op1 The operand 1.
3347 * @param *op2 The operand 2.
3348 * @param *mode The mode of the operands and the result.
3350 ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
3352 /** Constructor for a Minus node.
3354 * Adds the node to the block in current_ir_block.
3356 * @param *op The operand .
3357 * @param *mode The mode of the operand and the result.
3359 ir_node *new_Minus (ir_node *op, ir_mode *mode);
3362 * Constructor for a Mul node. Adds the node to the block in current_ir_block.
3364 * @param *op1 The operand 1.
3365 * @param *op2 The operand 2.
3366 * @param *mode The mode of the operands and the result.
3368 ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
3370 /** Constructor for a Quot node.
3372 * Adds the node to the block in current_ir_block.
3374 * @param *memop The store needed to model exceptions
3375 * @param *op1 The operand 1.
3376 * @param *op2 The operand 2.
3378 ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2);
3380 /** Constructor for a DivMod node.
3382 * Adds the node to the block in current_ir_block.
3384 * @param *memop The store needed to model exceptions
3385 * @param *op1 The operand 1.
3386 * @param *op2 The operand 2.
3388 ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
3390 /** Constructor for a Div node.
3392 * Adds the node to the block in current_ir_block.
3394 * @param *memop The store needed to model exceptions
3395 * @param *op1 The operand 1.
3396 * @param *op2 The operand 2.
3398 ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2);
3400 /** Constructor for a Mod node.
3402 * Adds the node to the block in current_ir_block.
3404 * @param *memop The store needed to model exceptions
3405 * @param *op1 The operand 1.
3406 * @param *op2 The operand 2.
3408 ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2);
3410 /** Constructor for a Abs node.
3412 * Adds the node to the block in current_ir_block.
3414 * @param *op The operand
3415 * @param *mode The mode of the operands and the result.
3417 ir_node *new_Abs (ir_node *op, ir_mode *mode);
3419 /** Constructor for a And node.
3421 * Adds the node to the block in current_ir_block.
3423 * @param *op1 The operand 1.
3424 * @param *op2 The operand 2.
3425 * @param *mode The mode of the operands and the result.
3427 ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
3430 * Constructor for a Or node. Adds the node to the block in current_ir_block.
3432 * @param *op1 The operand 1.
3433 * @param *op2 The operand 2.
3434 * @param *mode The mode of the operands and the result.
3436 ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
3439 * Constructor for a Eor node. Adds the node to the block in current_ir_block.
3441 * @param *op1 The operand 1.
3442 * @param *op2 The operand 2.
3443 * @param *mode The mode of the operands and the results.
3445 ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
3447 /** Constructor for a Not node.
3449 * Adds the node to the block in current_ir_block.
3451 * @param *op The operand.
3452 * @param *mode The mode of the operand and the result.
3454 ir_node *new_Not (ir_node *op, ir_mode *mode);
3456 /** Constructor for a Shl node.
3458 * Adds the node to the block in current_ir_block.
3460 * @param *op The operand.
3461 * @param *k The number of bits to shift the operand .
3462 * @param *mode The mode of the operand and the result.
3464 ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
3467 * Constructor for a Shr node. Adds the node to the block in current_ir_block.
3469 * @param *op The operand.
3470 * @param *k The number of bits to shift the operand .
3471 * @param *mode The mode of the operand and the result.
3473 ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
3475 /** Constructor for a Shrs node.
3477 * Adds the node to the block in current_ir_block.
3479 * @param *op The operand.
3480 * @param *k The number of bits to shift the operand .
3481 * @param *mode The mode of the operand and the result.
3483 ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
3485 /** Constructor for a Rot node.
3487 * Adds the node to the block in current_ir_block.
3489 * @param *op The operand.
3490 * @param *k The number of bits to rotate the operand.
3491 * @param *mode The mode of the operand.
3493 ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode);
3495 /** Constructor for a Cmp node.
3497 * Adds the node to the block in current_ir_block.
3499 * @param *op1 The operand 1.
3500 * @param *op2 The operand 2.
3502 ir_node *new_Cmp (ir_node *op1, ir_node *op2);
3504 /** Constructor for a Conv node.
3506 * Adds the node to the block in current_ir_block.
3508 * @param *op The operand.
3509 * @param *mode The mode of this the operand muss be converted .
3511 ir_node *new_Conv (ir_node *op, ir_mode *mode);
3513 /**Constructor for a Cast node.
3515 * Adds the node to the block in current_ir_block.
3516 * High level type cast
3518 * @param *op The operand.
3519 * @param *to_tp The type of this the operand muss be casted .
3521 ir_node *new_Cast (ir_node *op, type *to_tp);
3523 /** Constructor for a Phi node.
3525 * Adds the node to the block in current_ir_block.
3527 * @param arity The number of predecessors.
3528 * @param *in Array with predecessors.
3529 * @param *mode The mode of it's inputs and output.
3531 ir_node *new_Phi (int arity, ir_node *in[], ir_mode *mode);
3533 /** Constructor for a Load node.
3535 * @param *store The current memory.
3536 * @param *addr A pointer to the variable to be read in this memory.
3537 * @param *mode The mode of the value to be loaded.
3539 ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode);
3541 /** Constructor for a Store node.
3543 * @param *store The current memory.
3544 * @param *addr A pointer to the variable to be read in this memory.
3545 * @param *val The value to write to this variable.
3547 ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
3549 /**Constructor for a Alloc node.
3551 * The Alloc node extends the memory by space for an entity of type alloc_type.
3552 * Adds the node to the block in current_ir_block.
3554 * @param *store The memory which shall contain the new variable.
3555 * @param *size The number of bytes to allocate.
3556 * @param *alloc_type The type of the allocated variable.
3557 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3559 ir_node *new_Alloc (ir_node *store, ir_node *size, type *alloc_type,
3563 /**Constructor for a Free node.
3565 * Frees the memory occupied by the entity pointed to by the pointer
3566 * arg. Type indicates the type of the entity the argument points to.
3567 * Adds the node to the block in current_ir_block.
3569 * @param *store The memory which shall contain the new variable.
3570 * @param *ptr The pointer to the object to free.
3571 * @param *size The number of objects of type free_type to free in a sequence.
3572 * @param *free_type The type of the freed variable.
3574 ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
3577 /** Constructor for a Sync node.
3579 * Merges several memory values. The node assumes that a variable
3580 * either occurs only in one of the memories, or it contains the same
3581 * value in all memories where it occurs.
3582 * Adds the node to the block in current_ir_block.
3584 * @param arity The number of memories to syncronize.
3585 * @param **in An array of pointers to nodes that produce an output of type
3586 * memory. The constructor copies this array.
3588 ir_node *new_Sync (int arity, ir_node *in[]);
3590 /** Constructor for a Proj node.
3592 * Projects a single value out of a tuple. The parameter proj gives the
3593 * position of the value within the tuple.
3594 * Adds the node to the block in current_ir_block.
3596 * @param arg A node producing a tuple.
3597 * @param *mode The mode of the value to project.
3598 * @param proj The position of the value in the tuple.
3600 ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
3602 /** Costructor for a Filter node.
3604 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
3605 * Filter is a node with two views used to construct the interprocedural view.
3606 * In intraprocedural view its semantics are identical to the Proj node.
3607 * In interprocedural view the Filter performs the Phi operation on method
3608 * parameters or results. Other than a Phi a Filter node may not be removed
3609 * if it has only a single input.
3611 * The constructor builds the Filter in intraprocedural view.
3613 * @param *arg The tuple value to project from.
3614 * @param *mode The mode of the projected value.
3615 * @param proj The position in the tuple to project from.
3617 ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj);
3619 /** Constructor for a defaultProj node.
3621 * Represents the default control flow of a Switch-Cond node.
3622 * Adds the node to the block in current_ir_block.
3624 * @param arg A node producing a tuple.
3625 * @param max_ proj The end position of the value in the tuple.
3627 ir_node *new_defaultProj (ir_node *arg, long max_proj);
3629 /** Constructor for a Tuple node.
3631 * This is an auxiliary node to replace a node that returns a tuple
3632 * without changing the corresponding Proj nodes.
3633 * Adds the node to the block in current_ir_block.
3635 * @param arity The number of tuple elements.
3636 * @param **in An array containing pointers to the nodes producing the tuple elements.
3638 ir_node *new_Tuple (int arity, ir_node *in[]);
3640 /** Constructor for an Id node.
3642 * This is an auxiliary node to replace a node that returns a single
3643 * value. Adds the node to the block in current_ir_block.
3645 * @param *val The operand to Id.
3646 * @param *mode The mode of *val.
3648 ir_node *new_Id (ir_node *val, ir_mode *mode);
3650 /** Constructor for a Bad node.
3652 * Returns the unique Bad node of the graph. The same as
3655 ir_node *new_Bad (void);
3657 /** Constructor for a Confirm node.
3659 * Specifies constraints for a value. To support dataflow analyses.
3660 * Adds the node to the block in current_ir_block.
3662 * Example: If the value never exceeds '100' this is expressed by placing a
3663 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
3665 * @param *val The value we express a constraint for
3666 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3667 * @param cmp The compare operation.
3669 ir_node *new_Confirm (ir_node *val, ir_node *bound, pn_Cmp cmp);
3671 /** Constructor for an Unknown node.
3673 * Represents an arbitrary value. Places the node in
3676 * @param *m The mode of the unknown value.
3678 ir_node *new_Unknown(ir_mode *m);
3680 /** Constructor for a NoMem node.
3682 * Returns the unique NoMem node of the graph. The same as
3685 ir_node *new_NoMem (void);
3687 /** Constructor for a Mux node.
3689 * Adds the node to the block in current_ir_block.
3691 * @param *sel The ir_node that calculates the boolean select.
3692 * @param *ir_true The ir_node that calculates the true result.
3693 * @param *ir_false The ir_node that calculates the false result.
3694 * @param *mode The mode of the node (and it_true and ir_false).
3696 ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
3698 /*---------------------------------------------------------------------*/
3699 /* The comfortable interface. */
3700 /* Supports automatic Phi node construction. */
3701 /* All routines of the block oriented interface except new_Block are */
3703 /*---------------------------------------------------------------------*/
3705 /** Create an immature block.
3707 * An immature block has an unknown number of predecessors. Predecessors
3708 * can be added with add_immBlock_pred(). Once all predecessors are
3709 * added the block must be matured.
3711 * Adds the block to the graph in current_ir_graph. Does set
3712 * current_block. Can be used with automatic Phi node construction.
3713 * This constructor can only be used if the graph is in
3716 ir_node *new_d_immBlock (dbg_info* db);
3717 ir_node *new_immBlock (void);
3719 /** Add a control flow edge to an immature block. */
3720 void add_immBlock_pred (ir_node *immblock, ir_node *jmp);
3722 /** Fix the number of predecessors of an immature block. */
3723 void mature_immBlock (ir_node *block);
3724 #define mature_cur_block() mature_immBlock(get_cur_block());
3727 /** Get the current value of a local variable.
3729 * Use this function to obtain the last definition of the local variable
3730 * associated with pos. Pos may not exceed the value passed as n_loc
3731 * to new_ir_graph. This call automatically inserts Phi nodes.
3733 * @param *db A pointer for debug information.
3734 * @param pos The position/id of the local variable.
3735 * @param *mode The mode of the value to get.
3737 ir_node *get_d_value (dbg_info* db, int pos, ir_mode *mode);
3738 ir_node *get_value (int pos, ir_mode *mode);
3740 /** Remark a new definition of a variable.
3742 * Use this function to remember a new definition of the value
3743 * associated with pos. Pos may not exceed the value passed as n_loc
3744 * to new_ir_graph. This call is needed to automatically inserts Phi
3747 * @param pos The position/id of the local variable.
3748 * @param *value The new value written to the local variable.
3750 void set_value (int pos, ir_node *value);
3752 /** Get the current memory state.
3754 * Use this function to obtain the last definition of the memory
3755 * state. This call automatically inserts Phi nodes for the memory
3758 ir_node *get_store (void);
3760 /** Remark a new definition of the memory state.
3762 * Use this function to remember a new definition of the memory state.
3763 * This call is needed to automatically inserts Phi nodes.
3765 * @param *store The new memory state.
3767 void set_store (ir_node *store);
3769 /** keep this node alive even if End is not control-reachable from it
3771 * @param ka The node to keep alive.
3773 void keep_alive (ir_node *ka);
3775 /** Returns the frame type of the current graph */
3776 type *get_cur_frame_type(void);
3779 /* --- initialize and finalize ir construction --- */
3781 /** Puts the graph into state "phase_high" */
3782 void finalize_cons (ir_graph *irg);
3784 /* --- Initialization --- */
3787 * This function is called, whenever a local variable is used before definition
3789 * @parameter mode the mode of the local var
3790 * @pos position choosen be the frontend for this var
3792 * @return a firm node of mode @p mode that initialises the var at position pos
3795 * Do not return NULL
3796 * If this function is not set, FIRM will create a const node with tarval BAD
3798 typedef ir_node *default_initialize_local_variable_func_t(ir_mode *mode, int pos);
3801 # endif /* _IRCONS_H_ */