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.
48 * This struct contains all information about a procedure.
49 * It's allocated directly to memory.
51 * The fields of ir_graph:
53 * *ent The entity describing this procedure.
55 * The beginning and end of a graph:
57 * *start_block This ir_node is the block that contains the unique
58 * start node of the procedure. With it it contains
59 * the Proj's on starts results.
60 * Further all Const nodes are placed in the start block.
61 * *start This ir_node is the unique start node of the procedure.
63 * *end_block This ir_node is the block that contains the unique
64 * end node of the procedure. This block contains no
66 * *end This ir_node is the unique end node of the procedure.
68 * The following nodes are Projs from the start node, held in ir_graph for
71 * *frame The ir_node producing the pointer to the stack frame of
72 * the procedure as output. This is the Proj node on the
73 * third output of the start node. This output of the start
74 * node is tagged as pns_frame_base. In FIRM most lokal
75 * variables are modeled as data flow edges. Static
76 * allocated arrays can not be represented as dataflow
77 * edges. Therefore FIRM has to represent them in the stack
80 * *globals This models a pointer to a space in the memory where
81 * _all_ global things are held. Select from this pointer
82 * with a Sel node the pointer to a global variable /
83 * procedure / compiler known function... .
85 * *args The ir_node that produces the arguments of the method as
86 * it's result. This is a Proj node on the fourth output of
87 * the start node. This output is tagged as pn_Start_T_args.
89 * *bad The bad node is an auxiliary node. It is needed only once,
90 * so there is this globally reachable node.
92 * Datastructures that are private to a graph:
94 * *obst An obstack that contains all nodes.
96 * *current_block A pointer to the current block. Any node created with
97 * one of the node constructors (new_<opcode>) are assigned
98 * to this block. It can be set with set_cur_block(block).
99 * Only needed for ir construction.
101 * params/n_loc An int giving the number of local variables in this
102 * procedure. This is neede for ir construction. Name will
105 * *value_table This hash table (pset) is used for global value numbering
106 * for optimizing use in iropt.c.
108 * *Phi_in_stack; a stack needed for automatic Phi construction, needed only
109 * during ir construction.
111 * visited A int used as flag to traverse the ir_graph.
113 * block_visited A int used as a flag to traverse block nodes in the graph.
115 * Three kinds of nodes
116 * --------------------
118 * There are three kinds of nodes known to the ir: entities,
119 * types, and ir_nodes
121 * + ir_nodes are the actual nodes of the FIRM intermediate representation.
122 * They represent operations on the data of the program and control flow
125 * + entity ==> implemented in entity.h
126 * Refers to a single entity of the compiled program, e.g. a field of a
127 * class or a method. If a method or variable can not be assigned to
128 * a method or class or the like, it is a global object.
130 * + types ==> implemented in type.h
131 * With types type information is represented. There are several type
134 * Implementation of the FIRM operations: ir_node
135 * ----------------------------------------------
137 * Ir_nodes represent operations on the data of the program and control flow
138 * operations. Examples of ir_nodes: Add, Jmp, Cmp
140 * FIRM is a dataflow graph. A dataflow graph is a directed graph,
141 * so that every node has incoming and outgoing edges. A node is
142 * executable if every input at it's incoming edges is available.
143 * Execution of the dataflow graph is started at the Start node which
144 * has no incoming edges and ends when the End node executes, even if
145 * there are still executable or not executed nodes. (Is this true,
146 * or must all executable nodes be executed?) (There are exceptions
147 * to the dataflow paradigma that all inputs have to be available
148 * before a node can execute: Phi, Block. See UKA Techreport
151 * The implementation of FIRM differs from the view as a dataflow
152 * graph. To allow fast traversion of the graph edges are
153 * implemented as C-pointers. Inputs to nodes are not ambiguous, the
154 * results can be used by several other nodes. Each input can be
155 * implemented as a single pointer to a predecessor node, outputs
156 * need to be lists of pointers to successors. Therefore a node
157 * contains pointers to it's predecessor so that the implementation is a
158 * dataflow graph with reversed edges. It has to be traversed bottom
161 * All nodes of the ir have the same basic structure. They are
162 * distinguished by a field containing the opcode.
164 * The fields of an ir_node:
166 * kind A firm_kind tag containing k_ir_node. This is useful for
167 * dynamically checking the type of a node.
169 * *op This ir_op gives the opcode as a tag and a string
170 * and the number of attributes of an ir_node. There is
171 * one statically allocated struct ir_op for each opcode.
173 * *mode The ir_mode of the operation represented by this firm
174 * node. The mode of the operation is the mode of it's
175 * result. A Firm mode is a datatype as known to the target,
176 * not a type of the source language.
178 * visit A flag for traversing the ir.
180 * **in An array with pointers to the node's predecessors.
182 * *link A pointer to an ir_node. With this pointer all Phi nodes
183 * are attached to a Block, i.e., a Block points to it's
184 * first Phi node, this node points to the second Phi node
185 * in the Block and so fourth. Used in mature_immBlock
186 * to find all Phi nodes to be matured. It's also used to
187 * annotate a node with a better, optimized version of it.
189 * attr An attr struct containing the attributes of the nodes. The
190 * attributes depend on the opcode of the node. The number
191 * of these attributes is given in op.
195 * Not yet documented. See irop.h.
199 * Not yet documented. See irmode.h.
201 * GLOBAL VARIABLES -- now also fields of ir_graph.
204 * current_ir_graph Points to the current ir_graph. All constructors for
205 * nodes add nodes to this graph.
207 * ir_visited An int used as flag to traverse the ir_graph.
209 * block_visited An int used as a flag to traverse block nodes in the
212 * Others not yet documented.
216 * CONSTRUCTOR FOR IR_GRAPH --> see irgraph.h
217 * ========================
220 * PROCEDURE TO CONSTRUCT AN IR GRAPH --> see also Firm tutorial
221 * ==================================
223 * This library supplies several interfaces to construct a FIRM graph for
225 * * A "comfortable" interface generating SSA automatically. Automatically
226 * computed predecessors of nodes need not be specified in the constructors.
227 * (new_<Node> constructurs and a set of additional routines.)
228 * * A less comfortable interface where all predecessors except the block
229 * an operation belongs to need to be specified. SSA must be constructed
230 * by hand. (new_<Node> constructors and set_cur_block()). This interface
231 * is called "block oriented". It automatically calles the local optimizations
233 * * An even less comfortable interface where the block needs to be specified
234 * explicitly. This is called the "raw" interface. (new_r_<Node>
235 * constructors). These nodes are not optimized.
237 * To use the functionality of the comfortable interface correctly the Front
238 * End needs to follow certain protocols. This is explained in the following.
239 * To build a correct IR with the other interfaces study the semantics of
240 * the firm node (See tech-reprot UKA 1999-14). For the construction of
241 * types and entities see the documentation in those modules.
243 * First the Frontend needs to decide which variables and values used in
244 * a procedure can be represented by dataflow edges. These are variables
245 * that need not be saved to memory as they cause no side effects visible
246 * out of the procedure. Often these are all compiler generated
247 * variables and simple local variables of the procedure as integers,
248 * reals and pointers. The frontend has to count and number these variables.
250 * First an ir_graph needs to be constructed with new_ir_graph. The
251 * constructor gets the number of local variables. The graph is hold in the
252 * global variable irg.
254 * Now the construction of the procedure can start. Several basic blocks can
255 * be constructed in parallel, but the code within each block needs to
256 * be constructed (almost) in program order.
258 * A global variable holds the current basic block. All (non block) nodes
259 * generated are added to this block. The current block can be set with
260 * set_cur_block(block). If several blocks are constructed in parallel block
261 * switches need to be performed constantly.
263 * To generate a Block node (with the comfortable interface) it's predecessor
264 * control flow nodes need not be known. In case of cyclic control flow these
265 * can not be known when the block is constructed. With add_immBlock_pred(block,
266 * cfnode) predecessors can be added to the block. If all predecessors are
267 * added to the block mature_immBlock(b) needs to be called. Calling mature_immBlock
268 * early improves the efficiency of the Phi node construction algorithm.
269 * But if several blocks are constructed at once, mature_immBlock must only
270 * be called after performing all set_values and set_stores in the block!
271 * (See documentation of new_immBlock constructor.)
273 * The constructors of arithmetic nodes require that their predecessors
274 * are mentioned. Sometimes these are available in the Frontend as the
275 * predecessors have just been generated by the frontend. If they are local
276 * values the predecessors can be obtained from the library with a call to
277 * get_value(local_val_nr). (local_val_nr needs to be administered by
278 * the Frontend.) A call to get_value triggers the generation of Phi nodes.
279 * If an arithmetic operation produces a local value this value needs to be
280 * passed to the library by set_value(node, local_val_nr).
281 * In straight line code these two operations just remember and return the
282 * pointer to nodes producing the value. If the value passes block boundaries
283 * Phi nodes can be inserted.
284 * Similar routines exist to manage the Memory operands: set_store and
287 * Several nodes produce more than one result. An example is the Div node.
288 * Such nodes return tuples of values. From these individual values can be
289 * extracted by proj nodes.
291 * The following example illustrates the construction of a simple basic block
292 * with two predecessors stored in variables cf_pred1 and cf_pred2, containing
295 * and finally jumping to an other block. The variable a got the local_val_nr
296 * 42 by the frontend.
298 * ir_node *this_block, *cf_pred1, *cf_pred2, *a_val, *mem, *div, *res, *cf_op;
300 * this_block = new_immBlock();
301 * add_immBlock_pred(this_block, cf_pred1);
302 * add_immBlock_pred(this_block, cf_pred2);
303 * mature_immBlock(this_block);
304 * a_val = get_value(42, mode_Iu);
306 * div = new_Div(mem, a_val, a_val);
307 * mem = new_Proj(div, mode_M, 0); * for the numbers for Proj see docu *
308 * res = new_Proj(div, mode_Iu, 2);
310 * set_value(res, 42);
313 * For further information look at the documentation of the nodes and
314 * constructors and at the paragraph COPING WITH DATA OBJECTS at the
315 * end of this documentation.
317 * The comfortable interface contains the following routines further explained
320 * ir_node *new_immBlock (void);
321 * ir_node *new_Start (void);
322 * ir_node *new_End (void);
323 * ir_node *new_Jmp (void);
324 * ir_node *new_Cond (ir_node *c);
325 * ir_node *new_Return (ir_node *store, int arity, ir_node **in);
326 * ir_node *new_Raise (ir_node *store, ir_node *obj);
327 * ir_node *new_Const (ir_mode *mode, tarval *con);
328 * ir_node *new_SymConst (symconst_symbol value, symconst_kind kind);
329 * ir_node *new_simpleSel (ir_node *store, ir_node *objptr, entity *ent);
330 * ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity,
331 * ir_node **in, entity *ent);
332 * ir_node *new_InstOf (ir_node *store, ir_node obj, type *ent);
333 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity,
334 * ir_node **in, type_method *type);
335 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
336 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
337 * ir_node *new_Minus (ir_node *op, ir_mode *mode);
338 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
339 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2);
340 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
341 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2);
342 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2);
343 * ir_node *new_Abs (ir_node *op, ir_mode *mode);
344 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
345 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
346 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
347 * ir_node *new_Not (ir_node *op, ir_mode *mode);
348 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
349 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
350 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
351 * ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode);
352 * ir_node *new_Cmp (ir_node *op1, ir_node *op2);
353 * ir_node *new_Conv (ir_node *op, ir_mode *mode);
354 * ir_node *new_Cast (ir_node *op, type *to_tp);
355 * ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode);
356 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
357 * ir_node *new_Alloc (ir_node *store, ir_node *size, type *alloc_type,
358 * where_alloc where);
359 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
361 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
362 * ir_node *new_NoMem (void);
364 * void add_immBlock_pred (ir_node *block, ir_node *jmp);
365 * void mature_immBlock (ir_node *block);
366 * void set_cur_block (ir_node *target);
367 * ir_node *get_value (int pos, ir_mode *mode);
368 * void set_value (int pos, ir_node *value);
369 * ir_node *get_store (void);
370 * void set_store (ir_node *store);
371 * keep_alive (ir_node ka)
373 * IR_NODES AND CONSTRUCTORS FOR IR_NODES
374 * =======================================
376 * All ir_nodes are defined by a common data structure. They are distinguished
377 * by their opcode and differ in the number of their attributes.
379 * The constructor for the block node sets current_block to itself.
380 * Const nodes are always added to the start block.
381 * All other constructors add the created node to the current_block.
382 * swich_block(block) allows to set the current block to block.
384 * Watch for my inconsistent use of input and predecessor (dataflow view)
385 * and `the node points to' (implementation view).
387 * The following description of the nodes lists four properties them if these
389 * - the parameters to the constructor
390 * - the inputs of the Firm node
391 * - the outputs of the Firm node
392 * - attributes to the node
396 * ir_node *new_immBlock (void)
397 * ----------------------------
399 * Creates a new block. Sets current_block to itself. When a new block is
400 * created it cannot be known how many predecessors this block will have in the
401 * control flow graph. Therefore the list of inputs can not be fixed at
402 * creation. Predecessors can be added with add_immBlock_pred (block, control flow
403 * operation). With every added predecessor the number of inputs to Phi nodes
406 * The block can be completed by mature_immBlock(block) if all predecessors are
407 * known. If several blocks are built at once, mature_immBlock can only be called
408 * after set_value has been called for all values that are life at the end
409 * 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
410 * of this block are called after maturing it and before calling get_value
411 * in some block that is control flow dependent on this block, the construction
414 * Example for faulty ir construction: (draw the graph on a paper and you'll
417 * block_before_loop = new_block();
419 * mature_immBlock(block_before_loop);
420 * before2header = new_Jmp;
422 * loop_header = new_block ();
423 * header2body - new_Jmp();
425 * loop_body = new_block ();
426 * body2header = new_Jmp();
428 * add_immBlock_pred(loop_header, before2header);
429 * add_immBlock_pred(loop_header, body2header);
430 * add_immBlock_pred(loop_body, header2body);
432 * mature_immBlock(loop_header);
433 * mature_immBlock(loop_body);
435 * get_value(loop_body, x); // gets the Phi in loop_header
436 * set_value(loop_header, x); // sets the value the above get_value should
437 * // have returned!!!
439 * Mature_immBlock also fixes the number of inputs to the Phi nodes. Mature_immBlock
440 * should be called as early as possible, as afterwards the generation of Phi
441 * nodes is more efficient.
444 * There is an input for each control flow predecessor of the block.
445 * The input points to an instruction producing an output of type X.
446 * Possible predecessors: Start, Jmp, Cond, Raise or Return or any node
447 * possibly causing an exception. (Often the real predecessors are Projs.)
449 * Mode BB (R), all nodes belonging to this block should consume this output.
450 * As they are strict (except Block and Phi node) it is a necessary condition
451 * that the block node executed before any other node in this block executes.
453 * block.matured Indicates whether the block is mature.
455 * This attribute contains all local values valid in this
456 * block. This is needed to build the Phi nodes and removed
457 * if the graph is complete. This field is used by the
458 * internal construction algorithm and should not be accessed
462 * ir_node *new_Block (int arity, ir_node **in)
463 * --------------------------------------------
465 * Creates a new Block with the given list of predecessors. This block
466 * is mature. As other constructors calls optimization and vrfy for the
467 * block. If one of the predecessors is Unknown (as it has to be filled in
468 * later) optimizations are skipped. This is necessary to
469 * construct Blocks in loops. Leaving Unknown in the Block after finishing
470 * the construction may have strange effects, especially for interprocedural
471 * representation and analyses.
474 * CONTROL FLOW OPERATIONS
475 * -----------------------
477 * In each block there must be exactly one of the control flow
478 * operations Start, End, Jmp, Cond, Return or Raise. The output of a
479 * control flow operation points to the block to be executed next.
481 * ir_node *new_Start (void)
482 * -------------------------
484 * Creates a start node. Not actually needed public. There is only one such
485 * node in each procedure which is automatically created by new_ir_graph.
488 * No inputs except the block it belogns to.
490 * A tuple of 4 (5, 6) distinct values. These are labeled by the following
491 * projection numbers (pn_Start):
492 * * pn_Start_X_initial_exec mode X, points to the first block to be exe * cuted.
493 * * pn_Start_M mode M, the global store
494 * * pn_Start_P_frame_base mode P, a pointer to the base of the proce * dures stack frame.
495 * * pn_Start_P_globals mode P, a pointer to the part of the memory * containing_all_ global things.
496 * * pn_Start_T_args mode T, a tuple containing all arguments of * the procedure.
499 * ir_node *new_End (void)
500 * -----------------------
502 * Creates an end node. Not actually needed public. There is only one such
503 * node in each procedure which is automatically created by new_ir_graph.
506 * No inputs except the block it belongs to.
510 * ir_node *new_Jmp (void)
511 * -----------------------
513 * Creates a Jmp node.
516 * The block the node belongs to
518 * Control flow to the next block.
520 * ir_node *new_Cond (ir_node *c)
521 * ------------------------------
523 * Creates a Cond node. There are two versions of this node.
529 * A tuple of two control flows. The first is taken if the input is
530 * false, the second if it is true.
534 * A value of mode I_u. (i)
536 * A tuple of n control flows. If the Cond's input is i, control
537 * flow will procede along output i. If the input is >= n control
538 * flow proceeds along output n.
540 * ir_node *new_Return (ir_node *store, int arity, ir_node **in)
541 * -------------------------------------------------------------
543 * The return node has as inputs the results of the procedure. It
544 * passes the control flow to the end_block.
550 * Control flow to the end block.
552 * ir_node *new_Raise (ir_node *store, ir_node *obj)
553 * -------------------------------------------------
555 * Raises an exception. Unconditional change of control flow. Writes
556 * an explicit Except variable to memory to pass it to the exception
557 * handler. See TechReport 1999-14, chapter Exceptions.
561 * A pointer to the Except variable.
563 * A tuple of control flow and the changed memory state. The control flow
564 * points to the exception handler if it is definied in this procedure,
565 * else it points to the end_block.
570 * ir_node *new_Const (ir_mode *mode, tarval *con)
571 * -----------------------------------------------
573 * Creates a constant in the constant table and adds a Const node
574 * returning this value to the start block.
577 * *mode The mode of the constant.
578 * *con Points to an entry in the constant table.
579 * This pointer is added to the attributes of
580 * the node (self->attr.con)
582 * No inputs except the block it belogns to.
584 * The constant value.
586 * attr.con A tarval* pointer to the proper entry in the constant
589 * ir_node *new_SymConst (type *tp, symconst_addr_ent kind)
590 * ------------------------------------------------------------
592 * There are three kinds of symbolic constants:
593 * symconst_type_tag The symbolic constant represents a type tag.
594 * symconst_size The symbolic constant represents the size of a class.
595 * symconst_addr_name Information for the linker, e.g. the name of a global
597 * To represent a pointer to an entity that is represented by an entity
598 * datastructure don't use
599 * new_SymConst((type_or_id*)get_entity_ld_ident(ent), linkage_ptr_info);.
600 * Use a real const instead:
601 * new_Const(mode_P_mach, tarval_p_from_entity(ent));
602 * This makes the Constant independent of name changes of the entity due to
606 * kind The kind of the symbolic constant: type_tag, size or link_info.
607 * *type_or_id Points to the type the tag stands for or to the type
608 * whose size is represented by the constant or to an ident
609 * representing the linkage info.
612 * No inputs except the block it belogns to.
614 * An unsigned integer (I_u) or a pointer (P).
617 * attr.i.num The symconst_addr_ent, i.e. one of
620 * - symconst_addr_name
621 * If the attr.i.num is symconst_type_tag or symconst_size, the node contains an attribute
622 * attr.i.*type, a pointer to a type_class. The mode of the node is mode_Is.
623 * if it is linkage_ptr_info it contains
624 * attr.i.*ptrinfo, an ident holding information for the linker. The mode
625 * of the node is mode_P_mach.
629 * ir_node *new_simpleSel (ir_node *store, ir_node *frame, entity *sel)
630 * --------------------------------------------------------------------
633 * Selects an entity from a compound type. This entity can be a field or
637 * *store The memory in which the object the entity should be selected
639 * *frame The pointer to the object.
640 * *sel The entity to select.
643 * The memory containing the object.
644 * A pointer to the object.
645 * An unsigned integer.
647 * A pointer to the selected entity.
649 * attr.sel Pointer to the entity
652 * ir_node *new_Sel (ir_node *store, ir_node *frame, int arity, ir_node **in,
653 * --------------------------------------------------------------------------
657 * Selects a field from an array type. The entity has as owner the array, as
658 * type the arrays element type. The indexes to access an array element are
662 * *store The memory in which the object the entity should be selected from
664 * *frame The pointer to the object.
665 * *arity number of array indexes.
666 * *in array with index inputs to the node.
667 * *sel The entity to select.
670 * The memory containing the object.
671 * A pointer to the object.
672 * As much unsigned integer as there are array expressions.
674 * A pointer to the selected entity.
676 * attr.sel Pointer to the entity
678 * The constructors new_Sel and new_simpleSel generate the same ir nodes.
679 * simpleSel just sets the arity of the index inputs to zero.
682 * ARITHMETIC OPERATIONS
683 * ---------------------
685 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node **in,
686 * ----------------------------------------------------------------------------
690 * Creates a procedure call.
693 * *store The actual store.
694 * *callee A pointer to the called procedure.
695 * arity The number of procedure parameters.
696 * **in An array with the pointers to the parameters.
697 * The constructor copies this array.
698 * *type Type information of the procedure called.
701 * The store, the callee and the parameters.
703 * A tuple containing the eventually changed store and the procedure
706 * attr.call Contains the type information for the procedure.
709 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode)
710 * ------------------------------------------------------------
714 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode)
715 * ------------------------------------------------------------
719 * ir_node *new_Minus (ir_node *op, ir_mode *mode)
720 * -----------------------------------------------
722 * Unary Minus operations on floating point values.
724 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode)
725 * ------------------------------------------------------------
729 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2)
730 * --------------------------------------------------------------
732 * Quot performs exact division of floating point numbers. It's mode
733 * is Tuple, the mode of the result must be annotated to the Proj
734 * that extracts the result of the arithmetic operations.
737 * The store needed to model exceptions and the two operands.
739 * A tuple contaning a memory and a execution for modeling exceptions
740 * and the result of the arithmetic operation.
742 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2)
743 * ----------------------------------------------------------------
745 * Performs Div and Mod on interger values.
748 * A tuple contaning a memory and a execution for modeling exceptions
749 * and the two result of the arithmetic operations.
751 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2)
752 * -------------------------------------------------------------
756 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2)
757 * -------------------------------------------------------------
761 * ir_node *new_Abs (ir_node *op, ir_mode *mode)
762 * ---------------------------------------------
766 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode)
767 * ------------------------------------------------------------
771 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode)
772 * -----------------------------------------------------------
776 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode)
777 * ------------------------------------------------------------
781 * ir_node *new_Not (ir_node *op, ir_mode *mode)
782 * ---------------------------------------------
784 * This node constructs a constant where all bits are set to one
785 * and a Eor of this constant and the operator. This simulates a
788 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode)
789 * ---------------------------------------------------------
793 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode)
794 * ---------------------------------------------------------
796 * Logic shift right, i.e., zero extended.
799 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode)
800 * ----------------------------------------------------------
802 * Arithmetic shift right, i.e., sign extended.
804 * ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode)
805 * ---------------------------------------------------------
807 * Rotates the operand to the (right??) by k bits.
809 * ir_node *new_Conv (ir_node *op, ir_mode *mode)
810 * ---------------------------------------------
812 * Mode conversion. For allowed conversions see UKA Tech Report
815 * ir_node *new_Cmp (ir_node *op1, ir_node *op2)
816 * ---------------------------------------------
819 * The two values to be compared.
821 * A 16-tuple containing the results of the 16 different comparisons.
822 * The following is a list giving the comparisons and a projection
823 * number (pnc_number) to use in Proj nodes to extract the proper result.
829 * Ge greater of equal
831 * Leg less, equal or greater = ordered
833 * Ue unordered or equal
834 * Ul unordered or less
835 * Ule unordered, less or equal
836 * Ug unordered or greater
837 * Uge unordered, greater or equal
838 * Ne unordered, less or greater = not equal
845 * In general, Phi nodes are automaitcally inserted. In some cases, if
846 * all predecessors of a block are known, an explicit Phi node constructor
847 * is needed. E.g., to construct a FIRM graph for a statement as
848 * a = (b==c) ? 2 : 5;
850 * ir_node *new_Phi (int arity, ir_node **in, ir_mode *mode)
851 * ---------------------------------------------------------
853 * Creates a Phi node. The in's order has to correspond to the order
854 * of in's of current_block. This is not checked by the library!
855 * If one of the predecessors is Unknown (as it has to be filled in
856 * later) optimizations are skipped. This is necessary to
857 * construct Phi nodes in loops. Leaving Unknown in the Phi after finishing
858 * the construction may have strange effects, especially for interprocedural
859 * representation and analyses.
862 * arity number of predecessors
863 * **in array with predecessors
864 * *mode The mode of it's inputs and output.
866 * A Phi node has as many inputs as the block it belongs to.
867 * Each input points to a definition of the same value on a
868 * different path in the control flow.
870 * The definition valid in this block.
873 * OPERATIONS TO MANAGE MEMORY EXPLICITLY
874 * --------------------------------------
876 * ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode)
877 * ----------------------------------------------------------------
879 * The Load operation reads a value from memory.
882 * *store The current memory.
883 * *addr A pointer to the variable to be read in this memory.
884 * *mode The mode of the value to be loaded.
887 * The memory and a pointer to a variable in this memory.
889 * A tuple of the memory, a control flow to be taken in case of
890 * an exception and the loaded value.
892 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val)
893 * ----------------------------------------------------------------
895 * The Store operation writes a value to a variable in memory.
898 * The memory, a pointer to a variable in this memory and the value
899 * to write to this variable.
901 * A tuple of the changed memory and a control flow to be taken in
902 * case of an exception.
904 * ir_node *new_Alloc (ir_node *store, ir_node *size, type *alloc_type,
905 * --------------------------------------------------------------------
909 * The Alloc node allocates a new variable. It can be specified whether the
910 * variable should be allocated to the stack or to the heap.
913 * *store The memory which shall contain the new variable.
914 * ** *size The number of bytes to allocate. Old. **
915 * *size We decided that the size easily can be derived from the type.
916 * This field is for allocating arrays, i.e., it gives the multiple
917 * of the size of alloc_type to allocate memory for.
918 * *alloc_type The type of the allocated variable.
919 * where Where to allocate the variable, either heap_alloc or stack_alloc.
922 * A memory and an unsigned integer.
924 * A tuple of the changed memory, a control flow to be taken in
925 * case of an exception and the pointer to the new variable.
927 * a.where Indicates where the variable is allocated.
928 * a.*type A pointer to the class the allocated data object
931 * ir_node *new_Free (ir_node *store, ir_node *ptr, type *free_type)
932 * ------------------------------------------------------------------
934 * The Free node frees memory of the given variable.
937 * *store The memory which shall contain the new variable.
938 * *ptr The pointer to the object to free.
939 * *size The number of objects of type free_type to free in a sequence.
940 * *free_type The type of the freed variable.
943 * A memory, a pointer and an unsigned integer.
945 * The changed memory.
947 * f.*type A pointer to the type information of the freed data object.
951 * ir_node *new_Sync (int arity, ir_node **in)
952 * -------------------------------------------
954 * The Sync operation unifies several partial memory blocks. These blocks
955 * have to be pairwise disjunct or the values in common locations have to
956 * be identical. This operation allows to specify all operations that eventually
957 * need several partial memory blocks as input with a single entrance by
958 * unifying the memories with a preceding Sync operation.
961 * arity The number of memories to syncronize.
962 * **in An array of pointers to nodes that produce an output of
967 * The unified memory.
973 * ir_node *new_Bad (void)
974 * -----------------------
976 * Returns the unique Bad node current_ir_graph->bad.
977 * This node is used to express results of dead code elimination.
979 * ir_node *new_NoMem (void)
980 * -----------------------------------------------------------------------------------
982 * Returns the unique NoMem node current_ir_graph->no_mem.
983 * This node is used as input for operations that need a Memory, but do not
984 * change it like Div by const != 0, analyzed calls etc.
986 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj)
987 * ----------------------------------------------------------
989 * Selects one entry of a tuple. This is a hidden `fat edge'.
992 * *arg A node producing a tuple.
993 * *mode The mode of the value to project.
994 * proj The position of the value in the tuple.
1000 * ir_node *new_Tuple (int arity, ir_node **in)
1001 * --------------------------------------------
1003 * Builds a Tuple from single values. This is needed to implement
1004 * optimizations that remove a node that produced a tuple. The node can be
1005 * replaced by the Tuple operation so that the following Proj nodes have not to
1006 * be changed. (They are hard to find due to the implementation with pointers
1007 * in only one direction.) The Tuple node is smaller than any other
1008 * node, so that a node can be changed into a Tuple by just changing it's
1009 * opcode and giving it a new in array.
1012 * arity The number of tuple elements.
1013 * **in An array containing pointers to the nodes producing the
1016 * ir_node *new_Id (ir_node *val, ir_mode *mode)
1017 * ---------------------------------------------
1019 * The single output of the Id operation is it's input. Also needed
1020 * for optimizations.
1023 * COPING WITH DATA OBJECTS
1024 * ========================
1026 * Two kinds of data objects have to be distinguished for generating
1027 * FIRM. First there are local variables other than arrays that are
1028 * known to be alias free. Second there are all other data objects.
1029 * For the first a common SSA representation is built, the second
1030 * are modeled by saving them to memory. The memory is treated as
1031 * a single local variable, the alias problem is hidden in the
1032 * content of this variable.
1034 * All values known in a Block are listed in the block's attribute,
1035 * block.**graph_arr which is used to automatically insert Phi nodes.
1036 * The following two funcions can be used to add a newly computed value
1037 * to the array, or to get the producer of a value, i.e., the current
1040 * inline void set_value (int pos, ir_node *value)
1041 * -----------------------------------------------
1043 * Has to be called for every assignment to a local variable. It
1044 * adds the value to the array of used values at position pos. Pos
1045 * has to be a unique identifier for an entry in the procedure's
1046 * definition table. It can be used to access the value again.
1047 * Requires current_block to be set correctly.
1049 * ir_node *get_value (int pos, ir_mode *mode)
1050 * -------------------------------------------
1052 * Returns the node defining the value referred to by pos. If the
1053 * value is not defined in this block a Phi node is generated and
1054 * all definitions reaching this Phi node are collected. It can
1055 * happen that the algorithm allocates an unnecessary Phi node,
1056 * e.g. if there is only one definition of this value, but this
1057 * definition reaches the currend block on several different
1058 * paths. This Phi node will be eliminated if optimizations are
1059 * turned on right after it's creation.
1060 * Requires current_block to be set correctly.
1062 * There are two special routines for the global store:
1064 * inline void set_store (ir_node *store)
1065 * --------------------------------------
1067 * Adds the store to the array of known values at a reserved
1069 * Requires current_block to be set correctly.
1071 * inline ir_node *get_store (void)
1072 * --------------------------------
1074 * Returns the node defining the actual store.
1075 * Requires current_block to be set correctly.
1078 * inline void keep_alive (ir_node *ka)
1079 * ------------------------------------
1081 * Keep this node alive because it is (might be) not in the control
1082 * flow from Start to End. Adds the node to the list in the end
1091 # include "firm_common.h"
1092 # include "irgraph.h"
1093 # include "irnode.h"
1094 # include "irmode.h"
1095 # include "entity.h"
1098 # include "dbginfo.h"
1100 /*-------------------------------------------------------------------------*/
1101 /* The raw interface */
1102 /*-------------------------------------------------------------------------*/
1104 /** Constructor for a Block node.
1106 * Constructs a mature block with the given predecessors. Use Unknown
1107 * nodes as predecessors to construct a block if the number of
1108 * predecessors is known, but not the predecessors themselves. This
1109 * constructor does not set current_block. It not be used with
1110 * automatic Phi node construction.
1112 * @param *db A Pointer for debug information.
1113 * @param irg The ir graph the block belongs to.
1114 * @param arity The number of control predecessors.
1115 * @param in[] An array of control predecessors. The length of
1116 * the array must be 'arity'. The constructor copies this array.
1118 ir_node *new_rd_Block (dbg_info *db, ir_graph *irg, int arity, ir_node *in[]);
1120 /** Constructor for a Start node.
1122 * @param *db A pointer for debug information.
1123 * @param *irg The ir graph the node belongs to.
1124 * @param *block The ir block the node belongs to.
1126 ir_node *new_rd_Start (dbg_info *db, ir_graph *irg, ir_node *block);
1128 /** Constructor for a End node.
1130 * @param *db A pointer for debug information.
1131 * @param *irg The ir graph the node belongs to.
1132 * @param *block The ir block the node belongs to.
1134 ir_node *new_rd_End (dbg_info *db, ir_graph *irg, ir_node *block);
1136 /** Constructor for a Jmp node.
1138 * Jmp represents control flow to a single control successor.
1140 * @param *db A pointer for debug information.
1141 * @param *irg The ir graph the node belongs to.
1142 * @param *block The ir block the node belongs to.
1144 ir_node *new_rd_Jmp (dbg_info *db, ir_graph *irg, ir_node *block);
1146 /** Constructor for a Break node.
1148 * Break represents control flow to a single control successor just as Jmp.
1149 * The blocks separated by a break may not be concatenated by an optimization.
1150 * It is used for the interprocedural representation where blocks are parted
1151 * behind Call nodes to represent the control flow to called procedures.
1153 * @param *db A pointer for debug information.
1154 * @param *irg The ir graph the node belong to.
1155 * @param *block The block the node belong to.
1157 ir_node *new_rd_Break (dbg_info *db, ir_graph *irg, ir_node *block);
1159 /** Constructor for a Cond node.
1161 * If c is mode_b represents a conditional branch (if/else). If c is
1162 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
1163 * node, default Proj is 0.)
1165 * This is not consistent: Input to Cond is Is, Proj has as proj number
1168 * @param *db A pointer for debug information.
1169 * @param *irg The ir graph the node belongs to.
1170 * @param *block The ir block the node belongs to.
1171 * @param *c The conditions parameter. Can be of mode b or I_u.
1173 ir_node *new_rd_Cond (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *c);
1175 /** Constructor for a Return node.
1177 * Returns the memory an zero or more return values. Only node that
1178 * can end regular control flow.
1180 * @param *db A pointer for debug information.
1181 * @param *irg The ir graph the node belongs to.
1182 * @param *block The ir block the node belongs to.
1183 * @param *store The state of memory.
1184 * @param arity Number of return values.
1185 * @param *in Array of length arity with return values. The constructor copies this array.
1187 ir_node *new_rd_Return (dbg_info *db, ir_graph *irg, ir_node *block,
1188 ir_node *store, int arity, ir_node *in[]);
1190 /** Constructor for a Raise node.
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 *store The current memory.
1196 * @param *obj A pointer to the Except variable.
1198 ir_node *new_rd_Raise (dbg_info *db, ir_graph *irg, ir_node *block,
1199 ir_node *store, ir_node *obj);
1201 /** Constructor for a Const_type node.
1203 * The constant represents a target value. This constructor sets high
1204 * level type information for the constant value.
1206 * @param *db A pointer for debug information.
1207 * @param *irg The ir graph the node belongs to.
1208 * @param *block The ir block the node belongs to.
1209 * @param *mode The mode of the operands and redults.
1210 * @param *con Points to an entry in the constant table.
1211 * @param *tp The type of the constant.
1213 ir_node *new_rd_Const_type (dbg_info* db, ir_graph *irg, ir_node *block,
1214 ir_mode *mode, tarval *con, type *tp);
1216 /** Constructor for a Const node.
1218 * Constructor for a Const node. The constant represents a target
1219 * value. Sets the type information to type_unknown. (No more
1220 * supported: If tv is entity derives a somehow useful type.)
1222 * @param *db A pointer for debug information.
1223 * @param *irg The ir graph the node belongs to.
1224 * @param *block The ir block the node belongs to.
1225 * @param *mode The mode of the operands and redults.
1226 * @param *con Points to an entry in the constant table.
1228 ir_node *new_rd_Const (dbg_info *db, ir_graph *irg, ir_node *block,
1229 ir_mode *mode, tarval *con);
1231 /** Constructor for a SymConst_type node.
1233 * This is the constructor for a symbolic constant.
1234 * There are four kinds of symbolic constants:
1235 * - type_tag The symbolic constant represents a type tag. The type the
1236 * tag stands for is given explicitly.
1237 * - size The symbolic constant represents the size of a type. The
1238 * type of which the constant represents the size is given
1240 * - addr_name The symbolic constant represents the address of an entity
1241 * (variable or method). The variable is indicated by a name
1242 * that is valid for linking.
1243 * - addr_ent The symbolic constant represents the address of an entity
1244 * (variable or method). The variable is given explicitly by
1247 * Inputs to the node:
1248 * No inputs except the block it belongs to.
1249 * Outputs of the node.
1250 * An unsigned integer (I_u) or a pointer (P).
1252 * Mention union in declaration so that the firmjni generator recognizes that
1253 * it can not cast the argument to an int.
1255 * @param *db A pointer for debug information.
1256 * @param *irg The ir graph the node belongs to.
1257 * @param *block The ir block the node belongs to.
1258 * @param symkind The kind of the symbolic constant: type_tag, size, addr_name or addr_ent.
1259 * @param value A type, entity or a ident depending on the SymConst kind.
1260 * @param tp The source type of the constant.
1262 ir_node *new_rd_SymConst_type (dbg_info* db, ir_graph *irg, ir_node *block, union symconst_symbol value,
1263 symconst_kind symkind, type *tp);
1265 /** Constructor for a SymConst node.
1267 * Same as new_rd_SymConst_type, except that it sets the type to type_unknown. */
1268 ir_node *new_rd_SymConst (dbg_info *db, ir_graph *irg, ir_node *block,
1269 union symconst_symbol value, symconst_kind symkind);
1271 /** Constructor for a SymConst addr_ent node.
1273 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1274 * symconst_addr_ent.
1275 * Adds the symconst to the start block of irg. */
1276 ir_node *new_rd_SymConst_addr_ent (dbg_info *db, ir_graph *irg, entity *symbol, type *tp);
1278 /** Constructor for a SymConst addr_name node.
1280 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1281 * symconst_addr_ent.
1282 * Adds the symconst to the start block of irg. */
1283 ir_node *new_rd_SymConst_addr_name (dbg_info *db, ir_graph *irg, ident *symbol, type *tp);
1285 /** Constructor for a SymConst type_tag node.
1287 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1288 * symconst_addr_ent.
1289 * Adds the symconst to the start block of irg. */
1290 ir_node *new_rd_SymConst_type_tag (dbg_info *db, ir_graph *irg, type *symbol, type *tp);
1292 /** Constructor for a SymConst size node.
1294 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1295 * symconst_addr_ent.
1296 * Adds the symconst to the start block of irg. */
1297 ir_node *new_rd_SymConst_size (dbg_info *db, ir_graph *irg, type *symbol, type *tp);
1299 /** Constructor for a Sel node.
1301 * The select node selects an entity (field or method) from an entity
1302 * with a compound type. It explicitly specifies the entity selected.
1303 * Dynamically the node may select entities that overwrite the given
1304 * entity. If the selected entity is an array element entity the Sel
1305 * node takes the required array indicees as inputs.
1307 * @param *db A pointer for debug information.
1308 * @param *irg The ir graph the node belongs to.
1309 * @param *block The ir block the node belongs to.
1310 * @param *store The memory in which the object the entity should be selected
1311 * from is allocated.
1312 * @param *objptr A pointer to a compound entity the Sel operation selects a
1313 * single attribute from.
1314 * @param *n_index The number of array indicees needed to select an array element entity.
1315 * @param *index[] If the compound entity is an array the indicees of the selected
1316 * element entity. The constructor copies this array.
1317 * @param *ent The entity to select.
1319 ir_node *new_rd_Sel (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1320 ir_node *objptr, int n_index, ir_node *index[], entity *ent);
1322 /** Constructor for a InstOf node.
1324 * For translating Java. Not supported as standard firm 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.
1333 ir_node *new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1334 ir_node *objptr, type *ent);
1336 /** Constructor for a Call node.
1338 * Represents all kinds of method and function calls.
1340 * @param *db A pointer for debug information.
1341 * @param *irg The ir graph the node belongs to.
1342 * @param *block The ir block the node belongs to.
1343 * @param *store The current memory state.
1344 * @param *callee A pointer to the called procedure.
1345 * @param arity The number of procedure parameters.
1346 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1347 * @param *tp Type information of the procedure called.
1349 ir_node *new_rd_Call (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1350 ir_node *callee, int arity, ir_node *in[], type *tp);
1352 /** Constructor for a Add node.
1354 * @param *db A pointer for debug information.
1355 * @param *irg The ir graph the node belongs to.
1356 * @param *block The ir block the node belongs to.
1357 * @param *op1 The operand 1.
1358 * @param *op2 The operand 2.
1359 * @param *mode The mode of the operands and the result.
1361 ir_node *new_rd_Add (dbg_info *db, ir_graph *irg, ir_node *block,
1362 ir_node *op1, ir_node *op2, ir_mode *mode);
1364 /** Constructor for a Sub node.
1366 * @param *db A pointer for debug information.
1367 * @param *irg The ir graph the node belongs to.
1368 * @param *block The ir block the node belongs to.
1369 * @param *op1 The operand 1.
1370 * @param *op2 The operand 2.
1371 * @param *mode The mode of the operands and the result.
1373 ir_node *new_rd_Sub (dbg_info *db, ir_graph *irg, ir_node *block,
1374 ir_node *op1, ir_node *op2, ir_mode *mode);
1376 /** Constructor for a Minus node.
1378 * @param *db A pointer for debug information.
1379 * @param *irg The ir graph the node belongs to.
1380 * @param *block The ir block the node belongs to.
1381 * @param *op The operand .
1382 * @param *mode The mode of the operand and the result.
1384 ir_node *new_rd_Minus (dbg_info *db, ir_graph *irg, ir_node *block,
1385 ir_node *op, ir_mode *mode);
1387 /** Constructor for a Mul node.
1389 * @param *db A pointer for debug information.
1390 * @param *irg The ir graph the node belongs to.
1391 * @param *block The ir block the node belongs to.
1392 * @param *op1 The operand 1.
1393 * @param *op2 The operand 2.
1394 * @param *mode The mode of the operands and the result.
1396 ir_node *new_rd_Mul (dbg_info *db, ir_graph *irg, ir_node *block,
1397 ir_node *op1, ir_node *op2, ir_mode *mode);
1399 /** Constructor for a Quot node.
1401 * @param *db A pointer for debug information.
1402 * @param *irg The ir graph the node belongs to.
1403 * @param *block The ir block the node belongs to.
1404 * @param *memop The store needed to model exceptions
1405 * @param *op1 The operand 1.
1406 * @param *op2 The operand 2.
1408 ir_node *new_rd_Quot (dbg_info *db, ir_graph *irg, ir_node *block,
1409 ir_node *memop, ir_node *op1, ir_node *op2);
1411 /** Constructor for a DivMod node.
1413 * @param *db A pointer for debug information.
1414 * @param *irg The ir graph the node belongs to.
1415 * @param *block The ir block the node belongs to.
1416 * @param *memop The store needed to model exceptions
1417 * @param *op1 The operand 1.
1418 * @param *op2 The operand 2.
1420 ir_node *new_rd_DivMod (dbg_info *db, ir_graph *irg, ir_node *block,
1421 ir_node *memop, ir_node *op1, ir_node *op2);
1423 /** Constructor for a Div node.
1425 * @param *db A pointer for debug information.
1426 * @param *irg The ir graph the node belongs to.
1427 * @param *block The ir block the node belongs to.
1428 * @param *memop The store needed to model exceptions
1429 * @param *op1 The operand 1.
1430 * @param *op2 The operand 2.
1432 ir_node *new_rd_Div (dbg_info *db, ir_graph *irg, ir_node *block,
1433 ir_node *memop, ir_node *op1, ir_node *op2);
1435 /** Constructor for a Mod node.
1437 * @param *db A pointer for debug information.
1438 * @param *irg The ir graph the node belongs to.
1439 * @param *block The ir block the node belongs to.
1440 * @param *memop The store needed to model exceptions
1441 * @param *op1 The operand 1.
1442 * @param *op2 The operand 2.
1444 ir_node *new_rd_Mod (dbg_info *db, ir_graph *irg, ir_node *block,
1445 ir_node *memop, ir_node *op1, ir_node *op2);
1447 /** Constructor for a Abs node.
1449 * @param *db A pointer for debug information.
1450 * @param *irg The ir graph the node belongs to.
1451 * @param *block The ir block the node belongs to.
1452 * @param *op The operand
1453 * @param *mode The mode of the operands and the result.
1455 ir_node *new_rd_Abs (dbg_info *db, ir_graph *irg, ir_node *block,
1456 ir_node *op, ir_mode *mode);
1458 /** Constructor for a And node.
1460 * @param *db A pointer for debug information.
1461 * @param *irg The ir graph the node belongs to.
1462 * @param *block The ir block the node belongs to.
1463 * @param *op1 The operand 1.
1464 * @param *op2 The operand 2.
1465 * @param *mode The mode of the operands and the result.
1467 ir_node *new_rd_And (dbg_info *db, ir_graph *irg, ir_node *block,
1468 ir_node *op1, ir_node *op2, ir_mode *mode);
1470 /** Constructor for a Or node.
1472 * @param *db A pointer for debug information.
1473 * @param *irg The ir graph the node belongs to.
1474 * @param *block The ir block the node belongs to.
1475 * @param *op1 The operand 1.
1476 * @param *op2 The operand 2.
1477 * @param *mode The mode of the operands and the result.
1479 ir_node *new_rd_Or (dbg_info *db, ir_graph *irg, ir_node *block,
1480 ir_node *op1, ir_node *op2, ir_mode *mode);
1482 /** Constructor for a Eor node.
1484 * @param *db A pointer for debug information.
1485 * @param *irg The ir graph the node belongs to.
1486 * @param *block The ir block the node belongs to.
1487 * @param *op1 The operand 1.
1488 * @param *op2 The operand 2.
1489 * @param *mode The mode of the operands and the results.
1491 ir_node *new_rd_Eor (dbg_info *db, ir_graph *irg, ir_node *block,
1492 ir_node *op1, ir_node *op2, ir_mode *mode);
1494 /** Constructor for a Not node.
1496 * @param *db A pointer for debug information.
1497 * @param *irg The ir graph the node belongs to.
1498 * @param *block The ir block the node belongs to.
1499 * @param *op The operand.
1500 * @param *mode The mode of the operand and the result.
1502 ir_node *new_rd_Not (dbg_info *db, ir_graph *irg, ir_node *block,
1503 ir_node *op, ir_mode *mode);
1505 /** Constructor for a Cmp node.
1507 * @param *db A pointer for debug information.
1508 * @param *irg The ir graph the node belongs to.
1509 * @param *block The ir block the node belongs to.
1510 * @param *op1 The operand 1.
1511 * @param *op2 The operand 2.
1513 ir_node *new_rd_Cmp (dbg_info *db, ir_graph *irg, ir_node *block,
1514 ir_node *op1, ir_node *op2);
1516 /** Constructor for a Shl node.
1518 * @param *db A pointer for debug information.
1519 * @param *irg The ir graph the node belongs to.
1520 * @param *block The ir block the node belongs to.
1521 * @param *op The operand.
1522 * @param *k The number of bits to shift the operand .
1523 * @param *mode The mode of the operand and the result.
1525 ir_node *new_rd_Shl (dbg_info *db, ir_graph *irg, ir_node *block,
1526 ir_node *op, ir_node *k, ir_mode *mode);
1528 /** Constructor for a Shr node.
1530 * @param *db A pointer for debug information.
1531 * @param *irg The ir graph the node belongs to.
1532 * @param *block The ir block the node belongs to.
1533 * @param *op The operand.
1534 * @param *k The number of bits to shift the operand .
1535 * @param *mode The mode of the operand and the result.
1537 ir_node *new_rd_Shr (dbg_info *db, ir_graph *irg, ir_node *block,
1538 ir_node *op, ir_node *k, ir_mode *mode);
1540 /** Constructor for a Shrs node.
1542 * @param *db A pointer for debug information.
1543 * @param *irg The ir graph the node belongs to.
1544 * @param *block The ir block the node belongs to.
1545 * @param *op The operand.
1546 * @param *k The number of bits to shift the operand.
1547 * @param *mode The mode of the operand and the result.
1549 ir_node *new_rd_Shrs (dbg_info *db, ir_graph *irg, ir_node *block,
1550 ir_node *op, ir_node *k, ir_mode *mode);
1552 /** Constructor for a Rot node.
1554 * @param *db A pointer for debug information.
1555 * @param *irg The ir graph the node belongs to.
1556 * @param *block The ir block the node belongs to.
1557 * @param *op The operand.
1558 * @param *k The number of bits to rotate the operand.
1559 * @param *mode The mode of the operand.
1561 ir_node *new_rd_Rot (dbg_info *db, ir_graph *irg, ir_node *block,
1562 ir_node *op, ir_node *k, ir_mode *mode);
1565 /** Constructor for a Conv node.
1567 * @param *db A pointer for debug information.
1568 * @param *irg The ir graph the node belongs to.
1569 * @param *block The ir block the node belongs to.
1570 * @param *op The operand.
1571 * @param *mode The mode of this the operand muss be converted .
1573 ir_node *new_rd_Conv (dbg_info *db, ir_graph *irg, ir_node *block,
1574 ir_node *op, ir_mode *mode);
1576 /** Constructor for a Cast node.
1578 * High level type cast.
1580 * @param *db A pointer for debug information.
1581 * @param *irg The ir graph the node belongs to.
1582 * @param *block The ir block the node belongs to.
1583 * @param *op The operand.
1584 * @param *to_tp The type of this the operand muss be casted .
1586 ir_node *new_rd_Cast (dbg_info* db, ir_graph *irg, ir_node *block,
1587 ir_node *op, type *to_tp);
1589 /** Constructor for a Phi node.
1591 * @param *db A pointer for debug information.
1592 * @param *irg The ir graph the node belongs to.
1593 * @param *block The ir block the node belongs to.
1594 * @param arity The number of predecessors
1595 * @param *in[] Array with predecessors. The constructor copies this array.
1596 * @param *mode The mode of it's inputs and output.
1598 ir_node *new_rd_Phi (dbg_info *db, ir_graph *irg, ir_node *block, int arity,
1599 ir_node *in[], ir_mode *mode);
1601 /** Constructor for a Load node.
1603 * @param *db A pointer for debug information.
1604 * @param *irg The ir graph the node belongs to.
1605 * @param *block The ir block the node belongs to.
1606 * @param *store The current memory
1607 * @param *adr A pointer to the variable to be read in this memory.
1608 * @param *mode The mode of the value to be loaded.
1610 ir_node *new_rd_Load (dbg_info *db, ir_graph *irg, ir_node *block,
1611 ir_node *store, ir_node *adr, ir_mode *mode);
1613 /** Constructor for a Store node.
1615 * @param *db A pointer for debug information.
1616 * @param *irg The ir graph the node belongs to.
1617 * @param *block The ir block the node belongs to.
1618 * @param *store The current memory
1619 * @param *adr A pointer to the variable to be read in this memory.
1620 * @param *val The value to write to this variable.
1622 ir_node *new_rd_Store (dbg_info *db, ir_graph *irg, ir_node *block,
1623 ir_node *store, ir_node *adr, ir_node *val);
1625 /** Constructor for a Alloc node.
1627 * The Alloc node extends the memory by space for an entity of type alloc_type.
1629 * @param *db A pointer for debug information.
1630 * @param *irg The ir graph the node belongs to.
1631 * @param *block The ir block the node belongs to.
1632 * @param *store The memory which shall contain the new variable.
1633 * @param *size The number of bytes to allocate.
1634 * @param *alloc_type The type of the allocated variable.
1635 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
1637 ir_node *new_rd_Alloc (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1638 ir_node *size, type *alloc_type, where_alloc where);
1640 /** Constructor for a Free node.
1642 * Frees the memory occupied by the entity pointed to by the pointer
1643 * arg. Type indicates the type of the entity the argument points to.
1645 * @param *db A pointer for debug information.
1646 * @param *irg The ir graph the node belongs to.
1647 * @param *block The ir block the node belongs to.
1648 * @param *store The memory which shall contain the new variable.
1649 * @param *ptr The pointer to the object to free.
1650 * @param *size The number of objects of type free_type to free in a sequence.
1651 * @param *free_type The type of the freed variable.
1653 ir_node *new_rd_Free (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1654 ir_node *ptr, ir_node *size, type *free_type);
1656 /** Constructor for a Sync node.
1658 * Merges several memory values. The node assumes that a variable
1659 * either occurs only in one of the memories, or it contains the same
1660 * value in all memories where it occurs.
1662 * @param *db A pointer for debug information.
1663 * @param *irg The ir graph the node belongs to.
1664 * @param *block The ir block the node belongs to.
1665 * @param arity The number of memories to syncronize.
1666 * @param *in[] An array of pointers to nodes that produce an output of type
1667 * memory. The constructor copies this array.
1669 ir_node *new_rd_Sync (dbg_info *db, ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
1671 /** Constructor for a Proj node.
1673 * Projects a single value out of a tuple. The parameter proj gives the
1674 * position of the value within the tuple.
1676 * @param *db A pointer for deubugginformation.
1677 * @param *irg The ir graph the node belongs to.
1678 * @param *block The ir block the node belongs to.
1679 * @param arg A node producing a tuple. The node must have mode_T.
1680 * @param *mode The mode of the value to project.
1681 * @param proj The position of the value in the tuple.
1683 ir_node *new_rd_Proj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1684 ir_mode *mode, long proj);
1686 /** Constructor for a defaultProj node.
1688 * Represents the default control flow of a Switch-Cond node.
1690 * @param *db A pointer for debug information.
1691 * @param *irg The ir graph the node belongs to.
1692 * @param *block The ir block the node belongs to.
1693 * @param arg A node producing a tuple.
1694 * @param max_proj The end position of the value in the tuple.
1696 ir_node *new_rd_defaultProj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1699 /** Constructor for a Tuple node.
1701 * This is an auxiliary node to replace a node that returns a tuple
1702 * without changing the corresponding Proj nodes.
1704 * @param *db A pointer for debug information.
1705 * @param *irg The ir graph the node belongs to.
1706 * @param *block The ir block the node belongs to.
1707 * @param arity The number of tuple elements.
1708 * @param *in[] An array containing pointers to the nodes producing the tuple
1709 * elements. The constructor copies this array.
1711 ir_node *new_rd_Tuple (dbg_info *db, ir_graph *irg, ir_node *block,
1712 int arity, ir_node *in[]);
1714 /** Constructor for a Id node.
1716 * This is an auxiliary node to replace a node that returns a single
1719 * @param *db A pointer for debug information.
1720 * @param *irg The ir graph the node belongs to.
1721 * @param *block The ir block the node belongs to.
1722 * @param *val The value
1723 * @param *mode The mode of *val.
1725 ir_node *new_rd_Id (dbg_info *db, ir_graph *irg, ir_node *block,
1726 ir_node *val, ir_mode *mode);
1728 /** Constructor for a Bad node.
1730 * Returns the unique Bad node of the graph. The same as
1733 * @param *irg The ir graph the node belongs to.
1735 ir_node *new_rd_Bad (ir_graph *irg);
1737 /** Constructor for a Confirm node.
1739 * Specifies constraints for a value. To support dataflow analyses.
1741 * Example: If the value never exceeds '100' this is expressed by placing a
1742 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
1744 * @param *irg The ir graph the node belong to.
1745 * @param *block The ir block the node belong to.
1746 * @param *db A pointer for debug information.
1747 * @param *val The value we express a constraint for
1748 * @param *bound The value to compare against. Must be a firm node, typically a constant.
1749 * @param cmp The compare operation.
1751 ir_node *new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block,
1752 ir_node *val, ir_node *bound, pn_Cmp cmp);
1754 /** Constructor for an Unknown node.
1756 * Represents an arbitrary value. Places the node in the start block.
1758 * @param *irg The ir graph the node belongs to.
1759 * @param *m The mode of the unknown value.
1761 ir_node *new_rd_Unknown(ir_graph *irg, ir_mode *m);
1763 /** Constructor for a CallBegin node.
1765 * CallBegin represents control flow depending of the pointer value
1766 * representing the called method to the called methods. The
1767 * constructor copies the method pointer input from the passed Call
1770 * @param *db A pointer for debug information.
1771 * @param *irg The ir graph the node belong to.
1772 * @param *block The block the node belong to.
1773 * @param *callee The call node visible in the intra procedural view.
1775 ir_node *new_rd_CallBegin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *callee);
1777 /** Constructor for a EndReg node.
1779 * Used to represent regular procedure end in interprocedual view.
1781 * @param *db A pointer for debug information.
1782 * @param *irg The ir graph the node belong to.
1783 * @param *block The block the node belong to.
1785 ir_node *new_rd_EndReg (dbg_info *db, ir_graph *irg, ir_node *block);
1787 /** Constructor for a EndExcept node.
1789 * Used to represent exceptional procedure end in interprocedural view.
1791 * @param *db A pointer for debug information.
1792 * @param *irg The ir graph the node belong to.
1793 * @param *block The block the node belong to.
1795 ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
1797 /** Constructor for a Filter node.
1799 * Adds the node to the block in current_ir_block. Filter is a node
1800 * with two views used to construct the interprocedural view. In
1801 * intraprocedural view its semantics are identical to the Proj node.
1802 * In interprocedural view the Filter performs the Phi operation on
1803 * method parameters or results. Other than a Phi a Filter node may
1804 * not be removed if it has only a single input.
1806 * The constructor builds the Filter in intraprocedural view.
1808 * @param *irg The ir graph the node belong to.
1809 * @param *block The block the node belong to.
1810 * @param *arg The tuple value to project from.
1811 * @param *mode The mode of the projected value.
1812 * @param proj The position in the tuple to project from.
1814 ir_node *new_rd_Filter (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1815 ir_mode *mode, long proj);
1817 /** Constructor for a NoMem node.
1819 * Returns the unique NoMem node of the graph. The same as
1822 * @param *irg The ir graph the node belongs to.
1824 ir_node *new_rd_NoMem (ir_graph *irg);
1826 /*-------------------------------------------------------------------------*/
1827 /* The raw interface without debug support */
1828 /*-------------------------------------------------------------------------*/
1830 /** Constructor for a Block node.
1832 * Constructs a mature block with the given predecessors. Use Unknown
1833 * nodes as predecessors to construct a block if the number of
1834 * predecessors is known, but not the predecessors themselves. This
1835 * constructor does not set current_block. It not be used with
1836 * automatic Phi node construction.
1839 * @param irg The ir graph the block belongs to.
1840 * @param arity The number of control predecessors.
1841 * @param in[] An array of control predecessors. The length of
1842 * the array must be 'arity'. The constructor copies this array.
1844 ir_node *new_r_Block (ir_graph *irg, int arity, ir_node *in[]);
1846 /** Constructor for a Start node.
1848 * @param *irg The ir graph the node belongs to.
1849 * @param *block The ir block the node belongs to.
1851 ir_node *new_r_Start (ir_graph *irg, ir_node *block);
1853 /** Constructor for a End node.
1855 * @param *irg The ir graph the node belongs to.
1856 * @param *block The ir block the node belongs to.
1858 ir_node *new_r_End (ir_graph *irg, ir_node *block);
1860 /** Constructor for a Jmp node.
1862 * Jmp represents control flow to a single control successor.
1864 * @param *irg The ir graph the node belongs to.
1865 * @param *block The ir block the node belongs to.
1867 ir_node *new_r_Jmp (ir_graph *irg, ir_node *block);
1869 /** Constructor for a Cond node.
1871 * If c is mode_b represents a conditional branch (if/else). If c is
1872 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
1873 * node, default Proj is 0.)
1875 * This is not consistent: Input to Cond is Is, Proj has as proj number
1878 * @param *irg The ir graph the node belongs to.
1879 * @param *block The ir block the node belongs to.
1880 * @param *c The conditions parameter.Can be of mode b or I_u.
1882 ir_node *new_r_Cond (ir_graph *irg, ir_node *block, ir_node *c);
1884 /** Constructor for a Return node.
1886 * Returns the memory an zero or more return values. Only node that
1887 * can end regular control flow.
1889 * @param *irg The ir graph the node belongs to.
1890 * @param *block The ir block the node belongs to.
1891 * @param *store The state of memory.
1892 * @param arity Number of array indexes.
1893 * @param *in[] Array with index inputs to the node. The constructor copies this array.
1895 ir_node *new_r_Return (ir_graph *irg, ir_node *block,
1896 ir_node *store, int arity, ir_node *in[]);
1898 /** Constructor for a Raise node.
1900 * @param *irg The ir graph the node belongs to.
1901 * @param *block The ir block the node belongs to.
1902 * @param *store The current memory.
1903 * @param *obj A pointer to the Except variable.
1905 ir_node *new_r_Raise (ir_graph *irg, ir_node *block,
1906 ir_node *store, ir_node *obj);
1908 /** Constructor for a Const node.
1910 * Constructor for a Const node. The constant represents a target
1911 * value. Sets the type information to type_unknown. (No more
1912 * supported: If tv is entity derives a somehow useful type.)
1914 * @param *irg The ir graph the node belongs to.
1915 * @param *block The ir block the node belongs to.
1916 * @param *mode The mode of the operands and the results.
1917 * @param *con Points to an entry in the constant table.
1919 ir_node *new_r_Const (ir_graph *irg, ir_node *block,
1920 ir_mode *mode, tarval *con);
1922 /** Constructor for a SymConst node.
1924 * This is the constructor for a symbolic constant.
1925 * There are four kinds of symbolic constants:
1926 * - type_tag The symbolic constant represents a type tag. The type the
1927 * tag stands for is given explicitly.
1928 * - size The symbolic constant represents the size of a type. The
1929 * type of which the constant represents the size is given
1931 * - addr_name The symbolic constant represents the address of an entity
1932 * (variable or method). The variable is indicated by a name
1933 * that is valid for linking.
1934 * - addr_ent The symbolic constant represents the address of an entity
1935 * (variable or method). The variable is given explicitly by
1938 * Inputs to the node:
1939 * No inputs except the block it belongs to.
1940 * Outputs of the node.
1941 * An unsigned integer (I_u) or a pointer (P).
1943 * @param *irg The ir graph the node belongs to.
1944 * @param *block The ir block the node belongs to.
1945 * @param volue A type, entity or a ident depending on the SymConst kind.
1946 * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
1948 ir_node *new_r_SymConst (ir_graph *irg, ir_node *block,
1949 union symconst_symbol value, symconst_kind symkind);
1951 /** Constructor for a Sel node.
1953 * The select node selects an entity (field or method) from an entity
1954 * with a compound type. It explicitly specifies the entity selected.
1955 * Dynamically the node may select entities that overwrite the given
1956 * entity. If the selected entity is an array element entity the Sel
1957 * node takes the required array indicees as inputs.
1959 * @param *irg The ir graph the node belongs to.
1960 * @param *block The ir block the node belongs to.
1961 * @param *store The memory in which the object the entity should be selected
1962 * from is allocated.
1963 * @param *objptr A pointer to a compound entity the Sel operation selects a
1964 * single attribute from.
1965 * @param *n_index The number of array indicees needed to select an array element entity.
1966 * @param *index[] If the compound entity is an array the indicees of the selected
1967 * element entity. The constructor copies this array.
1968 * @param *ent The entity to select.
1970 ir_node *new_r_Sel (ir_graph *irg, ir_node *block, ir_node *store,
1971 ir_node *objptr, int n_index, ir_node *index[],
1974 /** Constructor for a InstOf node.
1976 * For translating Java. Not supported as standard firm node.
1978 * @param *irg The ir graph the node belongs to.
1979 * @param *block The ir block the node belongs to.
1984 ir_node *new_r_InstOf (ir_graph *irg, ir_node *block, ir_node *x, ir_node *y, type *z);
1986 /** Constructor for a Call node.
1988 * Represents all kinds of method and function calls.
1990 * @param *irg The ir graph the node belongs to.
1991 * @param *block The ir block the node belongs to.
1992 * @param * store The actual store.
1993 * @param *callee A pointer to the called procedure.
1994 * @param arity The number of procedure parameters.
1995 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
1996 * @param *tp Type information of the procedure called.
1998 ir_node *new_r_Call (ir_graph *irg, ir_node *block, ir_node *store,
1999 ir_node *callee, int arity, ir_node *in[],
2002 /** Constructor for a Add node.
2004 * @param *irg The ir graph the node belongs to.
2005 * @param *block The ir block the node belongs to.
2006 * @param *op1 The operand 1.
2007 * @param *op2 The operand 2.
2008 * @param *mode The mode of the operands and the result.
2010 ir_node *new_r_Add (ir_graph *irg, ir_node *block,
2011 ir_node *op1, ir_node *op2, ir_mode *mode);
2014 * Constructor for a Sub node.
2016 * @param *irg The ir graph the node belongs to.
2017 * @param *block The ir block the node belongs to.
2018 * @param *op1 The operand 1.
2019 * @param *op2 The operand 2.
2020 * @param *mode The mode of the operands and the results.
2022 ir_node *new_r_Sub (ir_graph *irg, ir_node *block,
2023 ir_node *op1, ir_node *op2, ir_mode *mode);
2025 /** Constructor for a Minus node.
2027 * @param *irg The ir graph the node belongs to.
2028 * @param *block The ir block the node belongs to.
2029 * @param *op The operand.
2030 * @param *mode The mode of the operand and the result.
2032 ir_node *new_r_Minus (ir_graph *irg, ir_node *block,
2033 ir_node *op, ir_mode *mode);
2034 /** Constructor for a Mul node.
2036 * @param *irg The ir graph the node belongs to.
2037 * @param *block The ir block the node belongs to.
2038 * @param *op1 The operand 1.
2039 * @param *op2 The operand 2.
2040 * @param *mode The mode of the operands and the result.
2042 ir_node *new_r_Mul (ir_graph *irg, ir_node *block,
2043 ir_node *op1, ir_node *op2, ir_mode *mode);
2045 /** Constructor for a Quot node.
2047 * @param *irg The ir graph the node belongs to.
2048 * @param *block The ir block the node belongs to.
2049 * @param *memop The store needed to model exceptions
2050 * @param *op1 The operand 1.
2051 * @param *op2 The operand 2.
2053 ir_node *new_r_Quot (ir_graph *irg, ir_node *block,
2054 ir_node *memop, ir_node *op1, ir_node *op2);
2056 /** Constructor for a DivMod node.
2058 * @param *irg The ir graph the node belongs to.
2059 * @param *block The ir block the node belongs to.
2060 * @param *memop The store needed to model exceptions
2061 * @param *op1 The operand 1.
2062 * @param *op2 The operand 2.
2064 ir_node *new_r_DivMod (ir_graph *irg, ir_node *block,
2065 ir_node *memop, ir_node *op1, ir_node *op2);
2067 /** Constructor for a Div node.
2069 * @param *irg The ir graph the node belongs to.
2070 * @param *block The ir block the node belongs to.
2071 * @param *memop The store needed to model exceptions
2072 * @param *op1 The operand 1.
2073 * @param *op2 The operand 2.
2075 ir_node *new_r_Div (ir_graph *irg, ir_node *block,
2076 ir_node *memop, ir_node *op1, ir_node *op2);
2078 /** Constructor for a Mod node.
2080 * @param *irg The ir graph the node belongs to.
2081 * @param *block The ir block the node belongs to.
2082 * @param *memop The store needed to model exceptions
2083 * @param *op1 The operand 1.
2084 * @param *op2 The operand 2.
2086 ir_node *new_r_Mod (ir_graph *irg, ir_node *block,
2087 ir_node *memop, ir_node *op1, ir_node *op2);
2089 /** Constructor for a Abs node.
2091 * @param *irg The ir graph the node belongs to.
2092 * @param *block The ir block the node belongs to.
2093 * @param *op The operand
2094 * @param *mode The mode of the operands and the result.
2096 ir_node *new_r_Abs (ir_graph *irg, ir_node *block,
2097 ir_node *op, ir_mode *mode);
2099 /** Constructor for a And node.
2101 * @param *irg The ir graph the node belongs to.
2102 * @param *block The ir block the node belongs to.
2103 * @param *op1 The operand 1.
2104 * @param *op2 The operand 2.
2105 * @param *mode The mode of the operands and the result.
2107 ir_node *new_r_And (ir_graph *irg, ir_node *block,
2108 ir_node *op1, ir_node *op2, ir_mode *mode);
2110 /** Constructor for a Or node.
2112 * @param *irg The ir graph the node belongs to.
2113 * @param *block The ir block the node belongs to.
2114 * @param *op1 The operand 1.
2115 * @param *op2 The operand 2.
2116 * @param *mode The mode of the operands and the result.
2118 ir_node *new_r_Or (ir_graph *irg, ir_node *block,
2119 ir_node *op1, ir_node *op2, ir_mode *mode);
2121 /** Constructor for a Eor node.
2123 * @param *irg The ir graph the node belongs to.
2124 * @param *block The ir block the node belongs to.
2125 * @param *op1 The operand 1.
2126 * @param *op2 The operand 2.
2127 * @param *mode The mode of the operands and the results.
2129 ir_node *new_r_Eor (ir_graph *irg, ir_node *block,
2130 ir_node *op1, ir_node *op2, ir_mode *mode);
2132 /** Constructor for a Not node.
2134 * @param *irg The ir graph the node belongs to.
2135 * @param *block The ir block the node belongs to.
2136 * @param *op The operand.
2137 * @param *mode The mode of the operand and the result.
2139 ir_node *new_r_Not (ir_graph *irg, ir_node *block,
2140 ir_node *op, ir_mode *mode);
2142 /** Constructor for a Cmp node.
2144 * @param *irg The ir graph the node belongs to.
2145 * @param *block The ir block the node belongs to.
2146 * @param *op1 The operand 1.
2147 * @param *op2 The operand 2.
2149 ir_node *new_r_Cmp (ir_graph *irg, ir_node *block,
2150 ir_node *op1, ir_node *op2);
2152 /** Constructor for a Shl node.
2154 * @param *irg The ir graph the node belongs to.
2155 * @param *block The ir block the node belongs to.
2156 * @param *op The operand.
2157 * @param *k The number of bits to shift the operand .
2158 * @param *mode The mode of the operand and the result.
2160 ir_node *new_r_Shl (ir_graph *irg, ir_node *block,
2161 ir_node *op, ir_node *k, ir_mode *mode);
2163 /** Constructor for a Shr node.
2165 * @param *irg The ir graph the node belongs to.
2166 * @param *block The ir block the node belongs to.
2167 * @param *op The operand.
2168 * @param *k The number of bits to shift the operand .
2169 * @param *mode The mode of the operand and the result.
2171 ir_node *new_r_Shr (ir_graph *irg, ir_node *block,
2172 ir_node *op, ir_node *k, ir_mode *mode);
2175 * Constructor for a Shrs node.
2177 * @param *irg The ir graph the node belongs to.
2178 * @param *block The ir block the node belongs to.
2179 * @param *op The operand.
2180 * @param *k The number of bits to shift the operand.
2181 * @param *mode The mode of the operand and the result.
2183 ir_node *new_r_Shrs (ir_graph *irg, ir_node *block,
2184 ir_node *op, ir_node *k, ir_mode *mode);
2186 /** Constructor for a Rot node.
2188 * @param *irg The ir graph the node belongs to.
2189 * @param *block The ir block the node belongs to.
2190 * @param *op The operand.
2191 * @param *k The number of bits to rotate the operand.
2192 * @param *mode The mode of the operand.
2194 ir_node *new_r_Rot (ir_graph *irg, ir_node *block,
2195 ir_node *op, ir_node *k, ir_mode *mode);
2197 /** Constructor for a Conv node.
2199 * @param *irg The ir graph the node belongs to.
2200 * @param *block The ir block the node belongs to.
2201 * @param *op The operand.
2202 * @param *mode The mode of this the operand muss be converted .
2204 ir_node *new_r_Conv (ir_graph *irg, ir_node *block,
2205 ir_node *op, ir_mode *mode);
2207 /** Constructor for a Cast node.
2209 * High level type cast
2211 * @param *irg The ir graph the node belongs to.
2212 * @param *block The ir block the node belongs to.
2213 * @param *op The operand.
2214 * @param *to_tp The type of this the operand muss be casted .
2216 ir_node *new_r_Cast (ir_graph *irg, ir_node *block,
2217 ir_node *op, type *to_tp);
2219 /** Constructor for a Phi node.
2221 * @param *irg The ir graph the node belongs to.
2222 * @param *block The ir block the node belongs to.
2223 * @param arity The number of predecessors
2224 * @param *in[] Array with predecessors. The constructor copies this array.
2225 * @param *mode The mode of it's inputs and output.
2227 ir_node *new_r_Phi (ir_graph *irg, ir_node *block, int arity,
2228 ir_node *in[], ir_mode *mode);
2230 /** Constructor for a Load node.
2232 * @param *irg The ir graph the node belongs to.
2233 * @param *block The ir block the node belongs to.
2234 * @param *store The current memory
2235 * @param *adr A pointer to the variable to be read in this memory.
2236 * @param *mode The mode of the value to be loaded.
2238 ir_node *new_r_Load (ir_graph *irg, ir_node *block,
2239 ir_node *store, ir_node *adr, ir_mode *mode);
2241 /** Constructor for a Store node.
2243 * @param *irg The ir graph the node belongs to.
2244 * @param *block The ir block the node belongs to.
2245 * @param *store The current memory
2246 * @param *adr A pointer to the variable to be read in this memory.
2247 * @param *val The value to write to this variable.
2249 ir_node *new_r_Store (ir_graph *irg, ir_node *block,
2250 ir_node *store, ir_node *adr, ir_node *val);
2252 /** Constructor for a Alloc node.
2254 * The Alloc node extends the memory by space for an entity of type alloc_type.
2256 * @param *irg The ir graph the node belongs to.
2257 * @param *block The ir block the node belongs to.
2258 * @param *store The memory which shall contain the new variable.
2259 * @param *size The number of bytes to allocate.
2260 * @param *alloc_type The type of the allocated variable.
2261 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
2263 ir_node *new_r_Alloc (ir_graph *irg, ir_node *block, ir_node *store,
2264 ir_node *size, type *alloc_type, where_alloc where);
2266 /** Constructor for a Free node.
2268 * Frees the memory occupied by the entity pointed to by the pointer
2269 * arg. Type indicates the type of the entity the argument points to.
2271 * @param *irg The ir graph the node belongs to.
2272 * @param *block The ir block the node belongs to.
2273 * @param *store The memory which shall contain the new variable.
2274 * @param *ptr The pointer to the object to free.
2275 * @param *size The number of objects of type free_type to free in a sequence.
2276 * @param *free_type The type of the freed variable.
2278 ir_node *new_r_Free (ir_graph *irg, ir_node *block, ir_node *store,
2279 ir_node *ptr, ir_node *size, type *free_type);
2281 /** Constructor for a Sync node.
2283 * Merges several memory values. The node assumes that a variable
2284 * either occurs only in one of the memories, or it contains the same
2285 * value in all memories where it occurs.
2287 * @param *irg The ir graph the node belongs to.
2288 * @param *block The ir block the node belongs to.
2289 * @param arity The number of memories to syncronize.
2290 * @param *in[] An array of pointers to nodes that produce an output of type memory.
2291 * The constructor copies this array.
2293 ir_node *new_r_Sync (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2295 /** Constructor for a Proj node.
2297 * Projects a single value out of a tuple. The parameter proj gives the
2298 * position of the value within the tuple.
2300 * @param *irg The ir graph the node belongs to.
2301 * @param *block The ir block the node belongs to.
2302 * @param arg A node producing a tuple.
2303 * @param *mode The mode of the value to project.
2304 * @param proj The position of the value in the tuple.
2306 ir_node *new_r_Proj (ir_graph *irg, ir_node *block, ir_node *arg,
2307 ir_mode *mode, long proj);
2309 /** Constructor for a defaultProj node.
2311 * Represents the default control flow of a Switch-Cond node.
2313 * @param *irg The ir graph the node belongs to.
2314 * @param *block The ir block the node belongs to.
2315 * @param arg A node producing a tuple.
2316 * @param max_ proj The end position of the value in the tuple.
2318 ir_node *new_r_defaultProj (ir_graph *irg, ir_node *block, ir_node *arg, long max_proj);
2321 /** Constructor for a Tuple node.
2323 * This is an auxiliary node to replace a node that returns a tuple
2324 * without changing the corresponding Proj nodes.
2326 * @param *irg The ir graph the node belongs to.
2327 * @param *block The ir block the node belongs to.
2328 * @param arity The number of tuple elements.
2329 * @param *in[] An array containing pointers to the nodes producing the tuple elements.
2330 * The constructor copies this array.
2332 ir_node *new_r_Tuple (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2334 /** Constructor for a Id node.
2336 * This is an auxiliary node to replace a node that returns a single
2339 * @param *irg The ir graph the node belongs to.
2340 * @param *block The ir block the node belongs to.
2341 * @param *val The operand to Id.
2342 * @param *mode The mode of *val.
2344 ir_node *new_r_Id (ir_graph *irg, ir_node *block,
2345 ir_node *val, ir_mode *mode);
2347 /** Constructor for a Bad node.
2349 * Returns the unique Bad node of the graph. The same as
2352 * @param *irg The ir graph the node belongs to.
2356 ir_node *new_r_Bad (ir_graph *irg);
2358 /** Constructor for a Confirm node.
2360 * Specifies constraints for a value. To support dataflow analyses.
2362 * Example: If the value never exceeds '100' this is expressed by placing a
2363 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
2365 * @param *irg The ir graph the node belong to.
2366 * @param *block The ir block the node belong to.
2367 * @param *db A pointer for debug information.
2368 * @param *val The value we express a constraint for
2369 * @param *bound The value to compare against. Must be a firm node, typically a constant.
2370 * @param cmp The compare operation.
2373 ir_node *new_r_Confirm (ir_graph *irg, ir_node *block,
2374 ir_node *val, ir_node *bound, pn_Cmp cmp);
2376 /** Constructor for a Unknown node.
2378 * Represents an arbtrary valus. Places the node in
2381 * @param *irg The ir graph the node belongs to.
2382 * @param *m The mode of the unknown value.
2384 ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2386 /** Constructor for a CallBegin node.
2388 * CallBegin represents control flow depending of the pointer value
2389 * representing the called method to the called methods. The
2390 * constructor copies the method pointer input from the passed Call
2393 * @param *irg The ir graph the node belong to.
2394 * @param *block The block the node belong to.
2395 * @param *callee The call node bisible in the intra procedural view.
2397 ir_node *new_r_CallBegin(ir_graph *irg, ir_node *block, ir_node *callee);
2399 /** Constructor for a EndReg node.
2401 * Used to represent regular procedure end in interprocedual view.
2403 * @param *irg The ir graph the node belong to.
2404 * @param *block The block the node belong to.
2406 ir_node *new_r_EndReg (ir_graph *irg, ir_node *block);
2408 /** Constructor for a EndExcept node.
2410 * Used to represent exceptional procedure end in interprocedural view.
2412 * @param *irg The ir graph the node belong to.
2413 * @param *block The block the node belong to.
2415 ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
2417 /** Constructor for a Break node.
2419 * Break represents control flow to a single control successor just as Jmp.
2420 * The blocks separated by a break may not be concatenated by an optimization.
2421 * It is used for the interprocedural representation where blocks are parted
2422 * behind Call nodes to represent the control flow to called procedures.
2424 * @param *irg The ir graph the node belong to.
2425 * @param *block The block the node belong to.
2427 ir_node *new_r_Break (ir_graph *irg, ir_node *block);
2429 /** Constructor for a Filter node.
2431 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
2432 * Filter is a node with two views used to construct the interprocedural view.
2433 * In intraprocedural view its semantics are identical to the Proj node.
2434 * In interprocedural view the Filter performs the Phi operation on method
2435 * parameters or results. Other than a Phi a Filter node may not be removed
2436 * if it has only a single input.
2438 * The constructor builds the Filter in intraprocedural view.
2440 * @param *irg The ir graph the node belong to.
2441 * @param *block The block the node belong to.
2442 * @param *arg The tuple value to project from.
2443 * @param *mode The mode of the projected value.
2444 * @param proj The position in the tuple to project from.
2446 ir_node *new_r_Filter (ir_graph *irg, ir_node *block, ir_node *arg,
2447 ir_mode *mode, long proj);
2449 /** Constructor for a NoMem node.
2451 * Returns the unique NoMem node of the graph. The same as
2454 * @param *irg The ir graph the node belongs to.
2456 ir_node *new_r_NoMem (ir_graph *irg);
2458 /*-----------------------------------------------------------------------*/
2459 /* The block oriented interface */
2460 /*-----------------------------------------------------------------------*/
2462 /** Sets the current block in which the following constructors place the
2463 * nodes they construct.
2465 * @param target The new current block.
2467 void set_cur_block (ir_node *target);
2469 /** Returns the current block of the current graph. */
2470 ir_node *get_cur_block(void);
2472 /** Returns the fixed nodes of the current graph. */
2473 #define get_cur_end_block() get_irg_end_block(current_ir_graph)
2474 #define get_cur_end() get_irg_end(current_ir_graph)
2475 #define get_cur_start_block() get_irg_start_block(current_ir_graph)
2476 #define get_cur_start() get_irg_start(current_ir_graph)
2478 /** Constructor for a Block node.
2480 * Adds the block to the graph in current_ir_graph. Constructs a Block
2481 * with a fixed number of predecessors. Does set current_block. Can
2482 * be used with automatic Phi node construction.
2484 * @param *db A Pointer for debugginfomation.
2485 * @param arity The number of control predecessors.
2486 * @param in[] An array of control predecessors. The length of
2487 * the array must be 'arity'.
2489 ir_node *new_d_Block(dbg_info* db, int arity, ir_node *in[]);
2491 /** Constructor for a Start node.
2493 * Adds the node to the block in current_ir_block.
2495 * @param *db A pointer for debug information.
2497 ir_node *new_d_Start (dbg_info* db);
2499 /** Constructor for a End node.
2501 * Adds the node to the block in current_ir_block.
2503 * @param *db A pointer for debug information.
2505 ir_node *new_d_End (dbg_info* db);
2507 /** Constructor for a Jmp node.
2509 * Adds the node to the block in current_ir_block.
2511 * Jmp represents control flow to a single control successor.
2513 * @param *db A pointer for debug information.
2516 ir_node *new_d_Jmp (dbg_info* db);
2518 /** Constructor for a Cond node.
2520 * Adds the node to the block in current_ir_block.
2522 * If c is mode_b represents a conditional branch (if/else). If c is
2523 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2524 * node, default Proj is 0.)
2526 * This is not consistent: Input to Cond is Is, Proj has as proj number
2529 * @param *db A pointer for debug information.
2530 * @param *c The conditions parameter.Can be of mode b or I_u.
2533 ir_node *new_d_Cond (dbg_info* db, ir_node *c);
2535 /** Constructor for a Return node.
2537 * Adds the node to the block in current_ir_block.
2539 * Returns the memory an zero or more return values. Only node that
2540 * can end regular control flow.
2542 * @param *db A pointer for debug information.
2543 * @param *store The state of memory.
2544 * @param arity Number of array indexes.
2545 * @param *in Array with index inputs to the node.
2548 ir_node *new_d_Return (dbg_info* db, ir_node *store, int arity, ir_node *in[]);
2550 /** Constructor for a Raise node.
2552 * Adds the node to the block in current_ir_block.
2554 * @param *db A pointer for debug information.
2555 * @param *store The current memory.
2556 * @param *obj A pointer to the Except variable.
2559 ir_node *new_d_Raise (dbg_info* db, ir_node *store, ir_node *obj);
2561 /** Constructor for a Const_type node.
2563 * Adds the node to the block in current_ir_block.
2565 * The constant represents a target value. This constructor sets high
2566 * level type information for the constant value.
2568 * @param *db A pointer for debug information.
2569 * @param *mode The mode of the operands and redults.
2570 * @param *con Points to an entry in the constant table. This pointer is
2571 added to the attributes of the node.
2572 * @param *tp The type of the constante.
2575 ir_node *new_d_Const_type (dbg_info* db, ir_mode *mode, tarval *con, type *tp);
2577 /** Constructor for a Const node.
2579 * Adds the node to the block in current_ir_block.
2581 * Constructor for a Const node. The constant represents a target
2582 * value. Sets the type information to type_unknown. (No more
2583 * supported: If tv is entity derives a somehow useful type.)
2585 * @param *db A pointer for debug information.
2586 * @param *mode The mode of the operands and redults.
2587 * @param *con Points to an entry in the constant table. This pointer is added
2588 * to the attributes of the node.
2590 ir_node *new_d_Const (dbg_info* db, ir_mode *mode, tarval *con);
2592 /** Constructor for a SymConst_type node.
2594 * Adds the node to the block in current_ir_block.
2595 * This is the constructor for a symbolic constant.
2596 * There are four kinds of symbolic constants:
2597 * - type_tag The symbolic constant represents a type tag. The type the
2598 * tag stands for is given explicitly.
2599 * - size The symbolic constant represents the size of a type. The
2600 * type of which the constant represents the size is given
2602 * - addr_name The symbolic constant represents the address of an entity
2603 * (variable or method). The variable is indicated by a name
2604 * that is valid for linking.
2605 * - addr_ent The symbolic constant represents the address of an entity
2606 * (variable or method). The variable is given explicitly by
2609 * Inputs to the node:
2610 * No inputs except the block it belongs to.
2611 * Outputs of the node.
2612 * An unsigned integer (I_u) or a pointer (P).
2614 * @param *db A pointer for debug information.
2615 * @param value A type, entity or ident depending on the SymConst kind.
2616 * @param symkind The kind of the symbolic constant: symconst_type_tag, symconst_size
2617 * or symconst_addr_name.
2618 * @param tp The source type of the constant.
2621 ir_node *new_d_SymConst_type (dbg_info* db, union symconst_symbol value, symconst_kind kind, type* tp);
2623 /** Constructor for a SymConst node.
2625 * Same as new_d_SymConst_type, except that it sets the type to type_unknown. */
2626 ir_node *new_d_SymConst (dbg_info* db, union symconst_symbol value, symconst_kind kind);
2628 /** Constructor for a simpleSel node.
2630 * This is a shortcut for the new_d_Sel() constructor. To be used for
2631 * Sel nodes that do not select from an array, i.e., have no index
2632 * inputs. It adds the two parameters 0, NULL.
2634 * @param *db A pointer for debug information.
2635 * @param *store The memory in which the object the entity should be
2636 * selected from is allocated.
2637 * @param *objptr The object from that the Sel operation selects a
2638 * single attribute out.
2639 * @param *ent The entity to select.
2641 ir_node *new_d_simpleSel(dbg_info* db, ir_node *store, ir_node *objptr, entity *ent);
2643 /** Constructor for a Sel node.
2645 * The select node selects an entity (field or method) from an entity
2646 * with a compound type. It explicitly specifies the entity selected.
2647 * Dynamically the node may select entities that overwrite the given
2648 * entity. If the selected entity is an array element entity the Sel
2649 * node takes the required array indicees as inputs.
2650 * Adds the node to the block in current_ir_block.
2652 * @param *db A pointer for debug information.
2653 * @param *store The memory in which the object the entity should be selected
2654 * from is allocated.
2655 * @param *objptr A pointer to a compound entity the Sel operation selects a
2656 * single attribute from.
2657 * @param *n_index The number of array indicees needed to select an array element entity.
2658 * @param *index[] If the compound entity is an array the indicees of the selected
2659 * element entity. The constructor copies this array.
2660 * @param *ent The entity to select.
2662 ir_node *new_d_Sel (dbg_info* db, ir_node *store, ir_node *objptr, int arity, ir_node *in[],
2665 /** Constructor for a InstOf node.
2667 * Adds the node to the block in current_ir_block.
2669 * For translating Java. Not supported as standard firm node.
2671 * @param *db A pointer for debug information.
2676 ir_node *new_d_InstOf (dbg_info* db, ir_node *store, ir_node *objptr, type *ent);
2678 /** Constructor for a Call node.
2680 * Represents all kinds of method and function calls.
2681 * Adds the node to the block in current_ir_block.
2683 * @param *db A pointer for debug information.
2684 * @param *store The actual store.
2685 * @param *callee A pointer to the called procedure.
2686 * @param arity The number of procedure parameters.
2687 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2688 * @param *tp Type information of the procedure called.
2691 ir_node *new_d_Call (dbg_info* db, ir_node *store, ir_node *callee, int arity, ir_node *in[],
2694 /** Constructor for a Add 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_Add (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2705 /** Constructor for a Sub node.
2707 * Adds the node to the block in current_ir_block.
2709 * @param *db A pointer for debug information.
2710 * @param *op1 The operand 1.
2711 * @param *op2 The operand 2.
2712 * @param *mode The mode of the operands and the result.
2715 ir_node *new_d_Sub (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2717 /** Constructor for a Minus node.
2719 * Adds the node to the block in current_ir_block.
2721 * @param *db A pointer for debug information.
2722 * @param *op The operand .
2723 * @param *mode The mode of the operand and the result.
2725 ir_node *new_d_Minus (dbg_info* db, ir_node *op, ir_mode *mode);
2727 /** Constructor for a Mul node.
2729 * Adds the node to the block in current_ir_block.
2731 * @param *db A pointer for debug information.
2732 * @param *op1 The operand 1.
2733 * @param *op2 The operand 2.
2734 * @param *mode The mode of the operands and the result.
2736 ir_node *new_d_Mul (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2738 /** Constructor for a Quot 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_Quot (dbg_info* db, ir_node *memop, ir_node *op1, ir_node *op2);
2749 /** Constructor for a DivMod node.
2751 * Adds the node to the block in current_ir_block.
2753 * @param *db A pointer for debug information.
2754 * @param *memop The store needed to model exceptions
2755 * @param *op1 The operand 1.
2756 * @param *op2 The operand 2.
2758 ir_node *new_d_DivMod (dbg_info* db, ir_node *memop, ir_node *op1, ir_node *op2);
2760 /** Constructor for a Div node.
2762 * Adds the node to the block in current_ir_block.
2764 * @param *db A pointer for debug information.
2765 * @param *memop The store needed to model exceptions
2766 * @param *op1 The operand 1.
2767 * @param *op2 The operand 2.
2769 ir_node *new_d_Div (dbg_info* db, ir_node *memop, ir_node *op1, ir_node *op2);
2771 /** Constructor for a Mod node.
2773 * Adds the node to the block in current_ir_block.
2775 * @param *db A pointer for debug information.
2776 * @param *memop The store needed to model exceptions
2777 * @param *op1 The operand 1.
2778 * @param *op2 The operand 2.
2780 ir_node *new_d_Mod (dbg_info* db, ir_node *memop, ir_node *op1, ir_node *op2);
2782 /** Constructor for a Abs node.
2784 * Adds the node to the block in current_ir_block.
2786 * @param *db A pointer for debug information.
2787 * @param *op The operand
2788 * @param *mode The mode of the operands and the result.
2790 ir_node *new_d_Abs (dbg_info* db, ir_node *op, ir_mode *mode);
2792 /** Constructor for a And node.
2794 * Adds the node to the block in current_ir_block.
2796 * @param *db A pointer for debug information.
2797 * @param *irg The ir graph the node belongs to.
2798 * @param *block The ir block the node belongs to.
2799 * @param *op1 The operand 1.
2800 * @param *op2 The operand 2.
2801 * @param *mode The mode of the operands and the result.
2803 ir_node *new_d_And (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2805 /** Constructor for a Or node.
2807 * Adds the node to the block in current_ir_block.
2809 * @param *db A pointer for debug information.
2810 * @param *op1 The operand 1.
2811 * @param *op2 The operand 2.
2812 * @param *mode The mode of the operands and the result.
2814 ir_node *new_d_Or (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2816 /** Constructor for a Eor node.
2818 * Adds the node to the block in current_ir_block.
2820 * @param *db A pointer for debug information.
2821 * @param *op1 The operand 1.
2822 * @param *op2 The operand 2.
2823 * @param *mode The mode of the operands and the results.
2825 ir_node *new_d_Eor (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2827 /** Constructor for a Not node.
2829 * Adds the node to the block in current_ir_block.
2831 * @param *db A pointer for debug information.
2832 * @param *op The operand.
2833 * @param *mode The mode of the operand and the result.
2835 ir_node *new_d_Not (dbg_info* db, ir_node *op, ir_mode *mode);
2837 /** Constructor for a Shl 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 shift the operand .
2844 * @param *mode The mode of the operand and the result.
2846 ir_node *new_d_Shl (dbg_info* db, ir_node *op, ir_node *k, ir_mode *mode);
2848 /** Constructor for a Shr node.
2850 * Adds the node to the block in current_ir_block.
2852 * @param *db A pointer for debug information.
2853 * @param *op The operand.
2854 * @param *k The number of bits to shift the operand .
2855 * @param *mode The mode of the operand and the result.
2857 ir_node *new_d_Shr (dbg_info* db, ir_node *op, ir_node *k, ir_mode *mode);
2859 /** Constructor for a Shrs node.
2861 * Adds the node to the block in current_ir_block.
2863 * @param *db A pointer for debug information.
2864 * @param *op The operand.
2865 * @param *k The number of bits to shift the operand .
2866 * @param *mode The mode of the operand and the result.
2868 ir_node *new_d_Shrs (dbg_info* db, ir_node *op, ir_node *k, ir_mode *mode);
2870 /** Constructor for a Rot node.
2872 * Adds the node to the block in current_ir_block.
2874 * @param *db A pointer for debug information.
2875 * @param *op The operand.
2876 * @param *k The number of bits to rotate the operand.
2877 * @param *mode The mode of the operand.
2879 ir_node *new_d_Rot (dbg_info* db, ir_node *op, ir_node *k, ir_mode *mode);
2881 /** Constructor for a Cmp node.
2883 * Adds the node to the block in current_ir_block.
2885 * @param *db A pointer for debug information.
2886 * @param *op1 The operand 1.
2887 * @param *op2 The operand 2.
2889 ir_node *new_d_Cmp (dbg_info* db, ir_node *op1, ir_node *op2);
2891 /** Constructor for a Conv node.
2893 * Adds the node to the block in current_ir_block.
2895 * @param *db A pointer for debug information.
2896 * @param *op The operand.
2897 * @param *mode The mode of this the operand muss be converted .
2899 ir_node *new_d_Conv (dbg_info* db, ir_node *op, ir_mode *mode);
2901 /**Constructor for a Cast node.
2903 * High level type cast
2904 * Adds the node to the block in current_ir_block.
2906 * @param *db A pointer for debug information.
2907 * @param *op The operand.
2908 * @param *to_tp The type of this the operand muss be casted .
2910 ir_node *new_d_Cast (dbg_info* db, ir_node *op, type *to_tp);
2912 /**Constructor for a Phi node.
2914 * Adds the node to the block in current_ir_block.
2916 * @param *db A pointer for debugginaromation.
2917 * @param arity The number of predecessors
2918 * @param *in Array with predecessors
2919 * @param *mode The mode of it's inputs and output.
2921 ir_node *new_d_Phi (dbg_info* db, int arity, ir_node *in[], ir_mode *mode);
2923 /** Constructor for a Load node.
2925 * Adds the node to the block in current_ir_block.
2927 * @param *db A pointer for debug information.
2928 * @param *store The current memory
2929 * @param *adr A pointer to the variable to be read in this memory.
2930 * @param *mode The mode of the value to be loaded.
2932 ir_node *new_d_Load (dbg_info* db, ir_node *store, ir_node *addr, ir_mode *mode);
2934 /** Constructor for a Store node.
2936 * Adds the node to the block in current_ir_block.
2938 * @param *db A pointer for debug information.
2939 * @param *store The current memory
2940 * @param *adr A pointer to the variable to be read in this memory.
2941 * @param *val The value to write to this variable.
2943 ir_node *new_d_Store (dbg_info* db, ir_node *store, ir_node *addr, ir_node *val);
2945 /** Constructor for a Alloc node.
2947 * The Alloc node extends the memory by space for an entity of type alloc_type.
2948 * Adds the node to the block in current_ir_block.
2950 * @param *db A pointer for debug information.
2951 * @param *store The memory which shall contain the new variable.
2952 * @param *size The number of bytes to allocate.
2953 * @param *alloc_type The type of the allocated variable.
2954 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
2956 ir_node *new_d_Alloc (dbg_info* db, ir_node *store, ir_node *size, type *alloc_type,
2959 /** Constructor for a Free node.
2961 * Frees the memory occupied by the entity pointed to by the pointer
2962 * arg. Type indicates the type of the entity the argument points to.
2963 * Adds the node to the block in current_ir_block.
2965 * @param *db A pointer for debug information.
2966 * @param *store The memory which shall contain the new variable.
2967 * @param *ptr The pointer to the object to free.
2968 * @param *size The number of objects of type free_type to free in a sequence.
2969 * @param *free_type The type of the freed variable.
2971 ir_node *new_d_Free (dbg_info* db, ir_node *store, ir_node *ptr, ir_node *size,
2974 /** Constructor for a Sync node.
2976 * Merges several memory values. The node assumes that a variable
2977 * either occurs only in one of the memories, or it contains the same
2978 * value in all memories where it occurs.
2979 * Adds the node to the block in current_ir_block.
2981 * @param *db A pointer for debug information.
2982 * @param arity The number of memories to syncronize.
2983 * @param **in An array of pointers to nodes that produce an output of type
2984 * memory. The constructor copies this array.
2986 ir_node *new_d_Sync (dbg_info* db, int arity, ir_node *in[]);
2989 /** Constructor for a Proj node.
2991 * Projects a single value out of a tuple. The parameter proj gives the
2992 * position of the value within the tuple.
2993 * Adds the node to the block in current_ir_block.
2995 * @param *db A pointer for deubugginformation.
2996 * @param arg A node producing a tuple.
2997 * @param *mode The mode of the value to project.
2998 * @param proj The position of the value in the tuple.
3000 ir_node *new_d_Proj (dbg_info* db, ir_node *arg, ir_mode *mode, long proj);
3003 /** Constructor for a defaultProj node.
3005 * Represents the default control flow of a Switch-Cond node.
3006 * Adds the node to the block in current_ir_block.
3008 * @param *db A pointer for debug information.
3009 * @param arg A node producing a tuple.
3010 * @param max_ proj The end position of the value in the tuple.
3012 ir_node *new_d_defaultProj (dbg_info* db, ir_node *arg, long max_proj);
3014 /** Constructor for a Tuple node.
3016 * This is an auxiliary node to replace a node that returns a tuple
3017 * without changing the corresponding Proj nodes.
3018 * Adds the node to the block in current_ir_block.
3020 * @param *db A pointer for debug information.
3021 * @param arity The number of tuple elements.
3022 * @param **in An array containing pointers to the nodes producing the tuple elements.
3024 ir_node *new_d_Tuple (dbg_info* db, int arity, ir_node *in[]);
3027 /** Constructor for a Id node.
3029 * This is an auxiliary node to replace a node that returns a single
3030 * value. Adds the node to the block in current_ir_block.
3032 * @param *db A pointer for debug information.
3033 * @param *val The operand to Id.
3034 * @param *mode The mode of *val.
3036 ir_node *new_d_Id (dbg_info* db, ir_node *val, ir_mode *mode);
3038 /** Costructor for a Bad node.
3040 * Returns the unique Bad node of the graph. The same as
3043 ir_node *new_d_Bad (void);
3045 /** Constructor for a Confirm node.
3047 * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3048 * Specifies constraints for a value. To support dataflow analyses.
3050 * Example: If the value never exceeds '100' this is expressed by placing a
3051 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
3053 * @param *db A pointer for debug information.
3054 * @param *val The value we express a constraint for
3055 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3056 * @param cmp The compare operation.
3058 ir_node *new_d_Confirm (dbg_info* db, ir_node *val, ir_node *bound, pn_Cmp cmp);
3061 /** Constructor for an Unknown node.
3063 * Represents an arbtrary valus. Places the node in
3066 * @param *m The mode of the unknown value.
3068 ir_node *new_d_Unknown(ir_mode *m);
3070 /** Constructor for a CallBegin node.
3072 * CallBegin represents control flow depending of the pointer value
3073 * representing the called method to the called methods. The
3074 * constructor copies the method pointer input from the passed Call
3075 * node.Adds the node to the block in current_ir_block.
3077 * @param *db A pointer for debug information.
3078 * @param *callee The call node bisible in the intra procedural view.
3080 ir_node *new_d_CallBegin(dbg_info *db, ir_node *callee);
3082 /** Constructor for an EndReg node.
3084 *Adds the node to the block in current_ir_block.
3086 * @param *db A pointer for debug information.
3088 ir_node *new_d_EndReg (dbg_info *db);
3090 /** Constructor for an Endexcept node.
3092 * Used to represent regular procedure end in interprocedual view.
3093 * Adds the node to the block in current_ir_block.
3095 * @param *db A pointer for debug information.
3097 ir_node *new_d_EndExcept(dbg_info *db);
3099 /** Constructor for a Break node.
3101 * Used to represent exceptional procedure end in interprocedural view.
3102 * Adds the node to the block in current_ir_block.
3104 * Break represents control flow to a single control successor just as Jmp.
3105 * The blocks separated by a break may not be concatenated by an optimization.
3106 * It is used for the interprocedural representation where blocks are parted
3107 * behind Call nodes to represent the control flow to called procedures.
3109 * @param *db A pointer for debug information.
3111 ir_node *new_d_Break (dbg_info *db);
3113 /** Constructor for a Filter node.
3115 * Constructor for a Filter node. Adds the node to the block in
3116 * current_ir_block. Filter is a node with two views used to
3117 * construct the interprocedural view. In intraprocedural view its
3118 * semantics are identical to the Proj node. In interprocedural view
3119 * the Filter performs the Phi operation on method parameters or
3120 * results. Other than a Phi a Filter node may not be removed if it
3121 * has only a single input.
3123 * The constructor builds the Filter in intraprocedural view.
3125 * @param *db A pointer for debug information.
3126 * @param *arg The tuple value to project from.
3127 * @param *mode The mode of the projected value.
3128 * @param proj The position in the tuple to project from.
3130 ir_node *new_d_Filter (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3133 /** Constructor for a NoMem node.
3135 * Returns the unique NoMem node of the graph. The same as
3138 ir_node *new_d_NoMem (void);
3140 /*-----------------------------------------------------------------------*/
3141 /* The block oriented interface without debug support */
3142 /*-----------------------------------------------------------------------*/
3144 /* Needed from the interfase with debug support:
3145 void set_cur_block (ir_node *target); */
3147 /** Constructor for a Block node.
3149 * Constructor for a Block node. Adds the block to the graph in
3150 * current_ir_graph. Constructs a Block with a fixed number of
3151 * predecessors. Does set current_block. Can be used with automatic
3152 * Phi node construction.
3154 * @param arity The number of control predecessors.
3155 * @param in An array of control predecessors. The length of
3156 * the array must be 'arity'.
3158 ir_node *new_Block(int arity, ir_node *in[]);
3160 /** Constructor for a Start node.
3162 * Adds the node to the block in current_ir_block.
3165 ir_node *new_Start (void);
3167 /** Constructor for an End node.
3169 * Adds the node to the block in current_ir_block.
3171 ir_node *new_End (void);
3173 /** Constructor for an EndReg node.
3175 * Used to represent regular procedure end in interprocedual view.
3176 * Adds the node to the block in current_ir_block.
3178 ir_node *new_EndReg (void);
3180 /** Constructor for an EndExpcept node.
3182 * Used to represent exceptional procedure end in interprocedural view.
3183 * Adds the node to the block in current_ir_block.
3185 ir_node *new_EndExcept(void);
3187 /** Constructor for a Jump node.
3189 * Adds the node to the block in current_ir_block.
3191 * Jmp represents control flow to a single control successor.
3193 ir_node *new_Jmp (void);
3195 /** Constructor for a Break node.
3196 * Break represents control flow to a single control successor just as Jmp.
3197 * The blocks separated by a break may not be concatenated by an optimization.
3198 * It is used for the interprocedural representation where blocks are parted
3199 * behind Call nodes to represent the control flow to called procedures.
3200 * Adds the node to the block in current_ir_block.
3202 ir_node *new_Break (void);
3204 /** Constructor for a Cond node.
3206 * If c is mode_b represents a conditional branch (if/else). If c is
3207 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
3208 * node, default Proj is 0.). Adds the node to the block in current_ir_block.
3210 * This is not consistent: Input to Cond is Is, Proj has as proj number
3214 * @param *c The conditions parameter.Can be of mode b or I_u.
3216 ir_node *new_Cond (ir_node *c);
3218 /** Constructor for a Return node.
3220 * Returns the memory an zero or more return values. Only node that
3221 * can end regular control flow. Adds the node to the block in current_ir_block.
3223 * @param *store The state of memory.
3224 * @param arity Number of array indexes.
3225 * @param *in Array with index inputs to the node.
3227 ir_node *new_Return (ir_node *store, int arity, ir_node *in[]);
3229 /**Constructor for a Raise node.
3231 * Adds the node to the block in current_ir_block.
3233 * @param *store The current memory.
3234 * @param *obj A pointer to the Except variable.
3236 ir_node *new_Raise (ir_node *store, ir_node *obj);
3238 /** Constructor for a Const node.
3240 * Constructor for a Const node. The constant represents a target
3241 * value. Sets the type information to type_unknown. (No more
3242 * supported: If tv is entity derives a somehow useful type.)
3243 * Adds the node to the block in current_ir_block.
3245 * @param *mode The mode of the operands and redults.
3246 * @param *con Points to an entry in the constant table. This pointer is
3247 * added to the attributes of the node.
3249 ir_node *new_Const (ir_mode *mode, tarval *con);
3251 /** Constructor for a Const node.
3253 * Derives mode from passed type. */
3254 ir_node *new_Const_type(tarval *con, type *tp);
3256 /** Constructor for a SymConst node.
3258 * Adds the node to the block in current_ir_block.
3259 * This is the constructor for a symbolic constant.
3260 * There are four kinds of symbolic constants:
3261 * - type_tag The symbolic constant represents a type tag. The type the
3262 * tag stands for is given explicitly.
3263 * - size The symbolic constant represents the size of a type. The
3264 * type of which the constant represents the size is given
3266 * - addr_name The symbolic constant represents the address of an entity
3267 * (variable or method). The variable is indicated by a name
3268 * that is valid for linking.
3269 * - addr_ent The symbolic constant represents the address of an entity
3270 * (variable or method). The variable is given explicitly by
3273 * Inputs to the node:
3274 * No inputs except the block it belongs to.
3275 * Outputs of the node.
3276 * An unsigned integer (I_u) or a pointer (P).
3278 * @param value A type or a ident depending on the SymConst kind.
3279 * @param symkind The kind of the symbolic constant: symconst_type_tag, symconst_size or symconst_addr_name.
3281 ir_node *new_SymConst (union symconst_symbol value, symconst_kind kind);
3283 /** Constructor for a simpelSel node.
3285 * This is a shortcut for the new_Sel() constructor. To be used for
3286 * Sel nodes that do not select from an array, i.e., have no index
3287 * inputs. It adds the two parameters 0, NULL.
3289 * @param *store The memory in which the object the entity should be selected from is allocated.
3290 * @param *objptr The object from that the Sel operation selects a single attribute out.
3291 * @param *ent The entity to select.
3293 ir_node *new_simpleSel(ir_node *store, ir_node *objptr, entity *ent);
3295 /** Constructor for a Sel node.
3297 * The select node selects an entity (field or method) from an entity
3298 * with a compound type. It explicitly specifies the entity selected.
3299 * Dynamically the node may select entities that overwrite the given
3300 * entity. If the selected entity is an array element entity the Sel
3301 * node takes the required array indicees as inputs.
3302 * Adds the node to the block in current_ir_block.
3304 * @param *store The memory in which the object the entity should be selected
3305 * from is allocated.
3306 * @param *objptr A pointer to a compound entity the Sel operation selects a
3307 * single attribute from.
3308 * @param *n_index The number of array indicees needed to select an array element entity.
3309 * @param *index[] If the compound entity is an array the indicees of the selected
3310 * element entity. The constructor copies this array.
3311 * @param *ent The entity to select.
3313 ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3316 /** Constructor for an InstOf node.
3318 * Adds the node to the block in current_ir_block.
3319 * For translating Java. Not supported as standard firm node.
3325 ir_node *new_InstOf (ir_node *store, ir_node *obj, type *ent);
3327 /** Constructor for a Call node.
3329 * Adds the node to the block in current_ir_block.
3330 * Represents all kinds of method and function calls.
3332 * @param *store The actual store.
3333 * @param *callee A pointer to the called procedure.
3334 * @param arity The number of procedure parameters.
3335 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3336 * @param *tp Type information of the procedure called.
3338 ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node *in[],
3341 /** Constructor for a CallBegin node.
3343 * Adds the node to the block in current_ir_block.
3345 * @param *callee A pointer to the called procedure.
3347 ir_node *new_CallBegin(ir_node *callee);
3349 /**Constructor for a Add node.
3351 * CallBegin represents control flow depending of the pointer value
3352 * representing the called method to the called methods. The
3353 * constructor copies the method pointer input from the passed Call
3354 * node.Adds the node to the block in current_ir_block.
3356 * @param *op1 The operand 1.
3357 * @param *op2 The operand 2.
3358 * @param *mode The mode of the operands and the result.
3360 ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
3362 /** Constructor for a Sub node.
3364 * Adds the node to the block in current_ir_block.
3366 * @param *op1 The operand 1.
3367 * @param *op2 The operand 2.
3368 * @param *mode The mode of the operands and the result.
3370 ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
3372 /** Constructor for a Minus node.
3374 * Adds the node to the block in current_ir_block.
3376 * @param *op The operand .
3377 * @param *mode The mode of the operand and the result.
3379 ir_node *new_Minus (ir_node *op, ir_mode *mode);
3382 * Constructor for a Mul node. Adds the node to the block in current_ir_block.
3384 * @param *op1 The operand 1.
3385 * @param *op2 The operand 2.
3386 * @param *mode The mode of the operands and the result.
3388 ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
3390 /** Constructor for a Quot 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_Quot (ir_node *memop, ir_node *op1, ir_node *op2);
3400 /** Constructor for a DivMod 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_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
3410 /** Constructor for a Div node.
3412 * Adds the node to the block in current_ir_block.
3414 * @param *memop The store needed to model exceptions
3415 * @param *op1 The operand 1.
3416 * @param *op2 The operand 2.
3418 ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2);
3420 /** Constructor for a Mod node.
3422 * Adds the node to the block in current_ir_block.
3424 * @param *memop The store needed to model exceptions
3425 * @param *op1 The operand 1.
3426 * @param *op2 The operand 2.
3428 ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2);
3430 /** Constructor for a Abs node.
3432 * Adds the node to the block in current_ir_block.
3434 * @param *op The operand
3435 * @param *mode The mode of the operands and the result.
3437 ir_node *new_Abs (ir_node *op, ir_mode *mode);
3439 /** Constructor for a And node.
3441 * Adds the node to the block in current_ir_block.
3443 * @param *op1 The operand 1.
3444 * @param *op2 The operand 2.
3445 * @param *mode The mode of the operands and the result.
3447 ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
3450 * Constructor for a Or node. Adds the node to the block in current_ir_block.
3452 * @param *op1 The operand 1.
3453 * @param *op2 The operand 2.
3454 * @param *mode The mode of the operands and the result.
3456 ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
3459 * Constructor for a Eor node. Adds the node to the block in current_ir_block.
3461 * @param *op1 The operand 1.
3462 * @param *op2 The operand 2.
3463 * @param *mode The mode of the operands and the results.
3465 ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
3467 /** Constructor for a Not node.
3469 * Adds the node to the block in current_ir_block.
3471 * @param *op The operand.
3472 * @param *mode The mode of the operand and the result.
3474 ir_node *new_Not (ir_node *op, ir_mode *mode);
3476 /** Constructor for a Shl node.
3478 * Adds the node to the block in current_ir_block.
3480 * @param *op The operand.
3481 * @param *k The number of bits to shift the operand .
3482 * @param *mode The mode of the operand and the result.
3484 ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
3487 * Constructor for a Shr node. Adds the node to the block in current_ir_block.
3489 * @param *op The operand.
3490 * @param *k The number of bits to shift the operand .
3491 * @param *mode The mode of the operand and the result.
3493 ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
3495 /** Constructor for a Shrs node.
3497 * Adds the node to the block in current_ir_block.
3499 * @param *op The operand.
3500 * @param *k The number of bits to shift the operand .
3501 * @param *mode The mode of the operand and the result.
3503 ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
3505 /** Constructor for a Rot node.
3507 * Adds the node to the block in current_ir_block.
3509 * @param *op The operand.
3510 * @param *k The number of bits to rotate the operand.
3511 * @param *mode The mode of the operand.
3513 ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode);
3515 /** Constructor for a Cmp node.
3517 * Adds the node to the block in current_ir_block.
3519 * @param *op1 The operand 1.
3520 * @param *op2 The operand 2.
3522 ir_node *new_Cmp (ir_node *op1, ir_node *op2);
3524 /** Constructor for a Conv node.
3526 * Adds the node to the block in current_ir_block.
3528 * @param *op The operand.
3529 * @param *mode The mode of this the operand muss be converted .
3531 ir_node *new_Conv (ir_node *op, ir_mode *mode);
3533 /**Constructor for a Cast node.
3535 * Adds the node to the block in current_ir_block.
3536 * High level type cast
3538 * @param *op The operand.
3539 * @param *to_tp The type of this the operand muss be casted .
3541 ir_node *new_Cast (ir_node *op, type *to_tp);
3543 /** Constructor for a Phi node.
3545 * Adds the node to the block in current_ir_block.
3547 * @param arity The number of predecessors.
3548 * @param *in Array with predecessors.
3549 * @param *mode The mode of it's inputs and output.
3551 ir_node *new_Phi (int arity, ir_node *in[], ir_mode *mode);
3553 /** Constructor for a Load node.
3555 * @param *store The current memory.
3556 * @param *addr A pointer to the variable to be read in this memory.
3557 * @param *mode The mode of the value to be loaded.
3559 ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode);
3561 /** Constructor for a Store node.
3563 * @param *store The current memory.
3564 * @param *addr A pointer to the variable to be read in this memory.
3565 * @param *val The value to write to this variable.
3567 ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
3569 /**Constructor for a Alloc node.
3571 * The Alloc node extends the memory by space for an entity of type alloc_type.
3572 * Adds the node to the block in current_ir_block.
3574 * @param *store The memory which shall contain the new variable.
3575 * @param *size The number of bytes to allocate.
3576 * @param *alloc_type The type of the allocated variable.
3577 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3579 ir_node *new_Alloc (ir_node *store, ir_node *size, type *alloc_type,
3583 /**Constructor for a Free node.
3585 * Frees the memory occupied by the entity pointed to by the pointer
3586 * arg. Type indicates the type of the entity the argument points to.
3587 * Adds the node to the block in current_ir_block.
3589 * @param *store The memory which shall contain the new variable.
3590 * @param *ptr The pointer to the object to free.
3591 * @param *size The number of objects of type free_type to free in a sequence.
3592 * @param *free_type The type of the freed variable.
3594 ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
3597 /** Constructor for a Sync node.
3599 * Merges several memory values. The node assumes that a variable
3600 * either occurs only in one of the memories, or it contains the same
3601 * value in all memories where it occurs.
3602 * Adds the node to the block in current_ir_block.
3604 * @param arity The number of memories to syncronize.
3605 * @param **in An array of pointers to nodes that produce an output of type
3606 * memory. The constructor copies this array.
3608 ir_node *new_Sync (int arity, ir_node *in[]);
3610 /** Constructor for a Proj node.
3612 * Projects a single value out of a tuple. The parameter proj gives the
3613 * position of the value within the tuple.
3614 * Adds the node to the block in current_ir_block.
3616 * @param arg A node producing a tuple.
3617 * @param *mode The mode of the value to project.
3618 * @param proj The position of the value in the tuple.
3620 ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
3622 /** Costructor for a Filter node.
3624 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
3625 * Filter is a node with two views used to construct the interprocedural view.
3626 * In intraprocedural view its semantics are identical to the Proj node.
3627 * In interprocedural view the Filter performs the Phi operation on method
3628 * parameters or results. Other than a Phi a Filter node may not be removed
3629 * if it has only a single input.
3631 * The constructor builds the Filter in intraprocedural view.
3633 * @param *arg The tuple value to project from.
3634 * @param *mode The mode of the projected value.
3635 * @param proj The position in the tuple to project from.
3637 ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj);
3639 /** Constructor for a defaultProj node.
3641 * Represents the default control flow of a Switch-Cond node.
3642 * Adds the node to the block in current_ir_block.
3644 * @param arg A node producing a tuple.
3645 * @param max_ proj The end position of the value in the tuple.
3647 ir_node *new_defaultProj (ir_node *arg, long max_proj);
3649 /** Constructor for a Tuple node.
3651 * This is an auxiliary node to replace a node that returns a tuple
3652 * without changing the corresponding Proj nodes.
3653 * Adds the node to the block in current_ir_block.
3655 * @param arity The number of tuple elements.
3656 * @param **in An array containing pointers to the nodes producing the tuple elements.
3658 ir_node *new_Tuple (int arity, ir_node *in[]);
3660 /** Constructor for an Id node.
3662 * This is an auxiliary node to replace a node that returns a single
3663 * value. Adds the node to the block in current_ir_block.
3665 * @param *val The operand to Id.
3666 * @param *mode The mode of *val.
3668 ir_node *new_Id (ir_node *val, ir_mode *mode);
3670 /** Constructor for a Bad node.
3672 * Returns the unique Bad node of the graph. The same as
3675 ir_node *new_Bad (void);
3677 /** Constructor for a Confirm node.
3679 * Specifies constraints for a value. To support dataflow analyses.
3680 * Adds the node to the block in current_ir_block.
3682 * Example: If the value never exceeds '100' this is expressed by placing a
3683 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
3685 * @param *val The value we express a constraint for
3686 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3687 * @param cmp The compare operation.
3689 ir_node *new_Confirm (ir_node *val, ir_node *bound, pn_Cmp cmp);
3691 /** Constructor for an Unknown node.
3693 * Represents an arbitrary value. Places the node in
3696 * @param *m The mode of the unknown value.
3698 ir_node *new_Unknown(ir_mode *m);
3700 /** Constructor for a NoMem node.
3702 * Returns the unique NoMem node of the graph. The same as
3705 ir_node *new_NoMem (void);
3707 /*---------------------------------------------------------------------*/
3708 /* The comfortable interface. */
3709 /* Supports automatic Phi node construction. */
3710 /* All routines of the block oriented interface except new_Block are */
3712 /*---------------------------------------------------------------------*/
3714 /** Create an immature block.
3716 * An immature block has an unknown number of predecessors. Predecessors
3717 * can be added with add_immBlock_pred(). Once all predecessors are
3718 * added the block must be matured.
3720 * Adds the block to the graph in current_ir_graph. Does set
3721 * current_block. Can be used with automatic Phi node construction.
3722 * This constructor can only be used if the graph is in
3725 ir_node *new_d_immBlock (dbg_info* db);
3726 ir_node *new_immBlock (void);
3728 /** Add a control flow edge to an immature block. */
3729 void add_immBlock_pred (ir_node *immblock, ir_node *jmp);
3731 /** Fix the number of predecessors of an immature block. */
3732 void mature_immBlock (ir_node *block);
3733 #define mature_cur_block() mature_immBlock(get_cur_block());
3736 /** Get the current value of a local variable.
3738 * Use this function to obtain the last definition of the local variable
3739 * associated with pos. Pos may not exceed the value passed as n_loc
3740 * to new_ir_graph. This call automatically inserts Phi nodes.
3742 * @param *db A pointer for debug information.
3743 * @param pos The position/id of the local variable.
3744 * @param *mode The mode of the value to get.
3746 ir_node *get_d_value (dbg_info* db, int pos, ir_mode *mode);
3747 ir_node *get_value (int pos, ir_mode *mode);
3749 /** Remark a new definition of a variable.
3751 * Use this function to remember a new definition of the value
3752 * associated with pos. Pos may not exceed the value passed as n_loc
3753 * to new_ir_graph. This call is needed to automatically inserts Phi
3756 * @param pos The position/id of the local variable.
3757 * @param *value The new value written to the local variable.
3759 void set_value (int pos, ir_node *value);
3761 /** Get the current memory state.
3763 * Use this function to obtain the last definition of the memory
3764 * state. This call automatically inserts Phi nodes for the memory
3767 ir_node *get_store (void);
3769 /** Remark a new definition of the memory state.
3771 * Use this function to remember a new definition of the memory state.
3772 * This call is needed to automatically inserts Phi nodes.
3774 * @param *store The new memory state.
3776 void set_store (ir_node *store);
3778 /** keep this node alive even if End is not control-reachable from it
3780 * @param ka The node to keep alive.
3782 void keep_alive (ir_node *ka);
3784 /** Returns the frame type of the current graph */
3785 type *get_cur_frame_type(void);
3788 /* --- initialize and finalize ir construction --- */
3790 /** Puts the graph into state "phase_high" */
3791 void finalize_cons (ir_graph *irg);
3793 /* --- Initialization --- */
3796 * This function is called, whenever a local variable is used before definition
3798 * @parameter mode the mode of the local var
3799 * @pos position choosen be the frontend for this var
3801 * @return a firm node of mode @p mode that initialises the var at position pos
3804 * Do not return NULL
3805 * If this function is not set, FIRM will create a const node with tarval BAD
3807 typedef ir_node *default_initialize_local_variable_func_t(ir_mode *mode, int pos);
3810 # endif /* _IRCONS_H_ */