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);
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_FuncCall (ir_node *store, ir_node *callee, int arity,
363 * ir_node **in, type_method *type);
365 * void add_immBlock_pred (ir_node *block, ir_node *jmp);
366 * void mature_immBlock (ir_node *block);
367 * void set_cur_block (ir_node *target);
368 * ir_node *get_value (int pos, ir_mode *mode);
369 * void set_value (int pos, ir_node *value);
370 * ir_node *get_store (void);
371 * void set_store (ir_node *store);
372 * keep_alive (ir_node ka)
374 * IR_NODES AND CONSTRUCTORS FOR IR_NODES
375 * =======================================
377 * All ir_nodes are defined by a common data structure. They are distinguished
378 * by their opcode and differ in the number of their attributes.
380 * The constructor for the block node sets current_block to itself.
381 * Const nodes are always added to the start block.
382 * All other constructors add the created node to the current_block.
383 * swich_block(block) allows to set the current block to block.
385 * Watch for my inconsistent use of input and predecessor (dataflow view)
386 * and `the node points to' (implementation view).
388 * The following description of the nodes lists four properties them if these
390 * - the parameters to the constructor
391 * - the inputs of the Firm node
392 * - the outputs of the Firm node
393 * - attributes to the node
397 * ir_node *new_immBlock (void)
398 * ----------------------------
400 * Creates a new block. Sets current_block to itself. When a new block is
401 * created it cannot be known how many predecessors this block will have in the
402 * control flow graph. Therefore the list of inputs can not be fixed at
403 * creation. Predecessors can be added with add_immBlock_pred (block, control flow
404 * operation). With every added predecessor the number of inputs to Phi nodes
407 * The block can be completed by mature_immBlock(block) if all predecessors are
408 * known. If several blocks are built at once, mature_immBlock can only be called
409 * after set_value has been called for all values that are life at the end
410 * 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
411 * of this block are called after maturing it and before calling get_value
412 * in some block that is control flow dependent on this block, the construction
415 * Example for faulty ir construction: (draw the graph on a paper and you'll
418 * block_before_loop = new_block();
420 * mature_immBlock(block_before_loop);
421 * before2header = new_Jmp;
423 * loop_header = new_block ();
424 * header2body - new_Jmp();
426 * loop_body = new_block ();
427 * body2header = new_Jmp();
429 * add_immBlock_pred(loop_header, before2header);
430 * add_immBlock_pred(loop_header, body2header);
431 * add_immBlock_pred(loop_body, header2body);
433 * mature_immBlock(loop_header);
434 * mature_immBlock(loop_body);
436 * get_value(loop_body, x); // gets the Phi in loop_header
437 * set_value(loop_header, x); // sets the value the above get_value should
438 * // have returned!!!
440 * Mature_immBlock also fixes the number of inputs to the Phi nodes. Mature_immBlock
441 * should be called as early as possible, as afterwards the generation of Phi
442 * nodes is more efficient.
445 * There is an input for each control flow predecessor of the block.
446 * The input points to an instruction producing an output of type X.
447 * Possible predecessors: Start, Jmp, Cond, Raise or Return or any node
448 * possibly causing an exception. (Often the real predecessors are Projs.)
450 * Mode BB (R), all nodes belonging to this block should consume this output.
451 * As they are strict (except Block and Phi node) it is a necessary condition
452 * that the block node executed before any other node in this block executes.
454 * block.matured Indicates whether the block is mature.
456 * This attribute contains all local values valid in this
457 * block. This is needed to build the Phi nodes and removed
458 * if the graph is complete. This field is used by the
459 * internal construction algorithm and should not be accessed
463 * ir_node *new_Block (int arity, ir_node **in)
464 * --------------------------------------------
466 * Creates a new Block with the given list of predecessors. This block
467 * is mature. As other constructors calls optimization and vrfy for the
468 * block. If one of the predecessors is Unknown (as it has to be filled in
469 * later) optimizations are skipped. This is necessary to
470 * construct Blocks in loops. Leaving Unknown in the Block after finishing
471 * the construction may have strange effects, especially for interprocedural
472 * representation and analyses.
475 * CONTROL FLOW OPERATIONS
476 * -----------------------
478 * In each block there must be exactly one of the control flow
479 * operations Start, End, Jmp, Cond, Return or Raise. The output of a
480 * control flow operation points to the block to be executed next.
482 * ir_node *new_Start (void)
483 * -------------------------
485 * Creates a start node. Not actually needed public. There is only one such
486 * node in each procedure which is automatically created by new_ir_graph.
489 * No inputs except the block it belogns to.
491 * A tuple of 4 (5, 6) distinct values. These are labeled by the following
492 * projection numbers (pn_Start):
493 * * pn_Start_X_initial_exec mode X, points to the first block to be exe * cuted.
494 * * pn_Start_M mode M, the global store
495 * * pn_Start_P_frame_base mode P, a pointer to the base of the proce * dures stack frame.
496 * * pn_Start_P_globals mode P, a pointer to the part of the memory * containing_all_ global things.
497 * * pn_Start_T_args mode T, a tuple containing all arguments of * the procedure.
500 * ir_node *new_End (void)
501 * -----------------------
503 * Creates an end node. Not actually needed public. There is only one such
504 * node in each procedure which is automatically created by new_ir_graph.
507 * No inputs except the block it belongs to.
511 * ir_node *new_Jmp (void)
512 * -----------------------
514 * Creates a Jmp node.
517 * The block the node belongs to
519 * Control flow to the next block.
521 * ir_node *new_Cond (ir_node *c)
522 * ------------------------------
524 * Creates a Cond node. There are two versions of this node.
530 * A tuple of two control flows. The first is taken if the input is
531 * false, the second if it is true.
535 * A value of mode I_u. (i)
537 * A tuple of n control flows. If the Cond's input is i, control
538 * flow will procede along output i. If the input is >= n control
539 * flow proceeds along output n.
541 * ir_node *new_Return (ir_node *store, int arity, ir_node **in)
542 * -------------------------------------------------------------
544 * The return node has as inputs the results of the procedure. It
545 * passes the control flow to the end_block.
551 * Control flow to the end block.
553 * ir_node *new_Raise (ir_node *store, ir_node *obj)
554 * -------------------------------------------------
556 * Raises an exception. Unconditional change of control flow. Writes
557 * an explicit Except variable to memory to pass it to the exception
558 * handler. See TechReport 1999-14, chapter Exceptions.
562 * A pointer to the Except variable.
564 * A tuple of control flow and the changed memory state. The control flow
565 * points to the exception handler if it is definied in this procedure,
566 * else it points to the end_block.
571 * ir_node *new_Const (ir_mode *mode, tarval *con)
572 * -----------------------------------------------
574 * Creates a constant in the constant table and adds a Const node
575 * returning this value to the start block.
578 * *mode The mode of the constant.
579 * *con Points to an entry in the constant table.
580 * This pointer is added to the attributes of
581 * the node (self->attr.con)
583 * No inputs except the block it belogns to.
585 * The constant value.
587 * attr.con A tarval* pointer to the proper entry in the constant
590 * ir_node *new_SymConst (type *tp, symconst_addr_ent kind)
591 * ------------------------------------------------------------
593 * There are three kinds of symbolic constants:
594 * symconst_type_tag The symbolic constant represents a type tag.
595 * symconst_size The symbolic constant represents the size of a class.
596 * symconst_addr_name Information for the linker, e.g. the name of a global
598 * To represent a pointer to an entity that is represented by an entity
599 * datastructure don't use
600 * new_SymConst((type_or_id*)get_entity_ld_ident(ent), linkage_ptr_info);.
601 * Use a real const instead:
602 * new_Const(mode_P_mach, tarval_p_from_entity(ent));
603 * This makes the Constant independent of name changes of the entity due to
607 * kind The kind of the symbolic constant: type_tag, size or link_info.
608 * *type_or_id Points to the type the tag stands for or to the type
609 * whose size is represented by the constant or to an ident
610 * representing the linkage info.
613 * No inputs except the block it belogns to.
615 * An unsigned integer (I_u) or a pointer (P).
618 * attr.i.num The symconst_addr_ent, i.e. one of
621 * - symconst_addr_name
622 * If the attr.i.num is symconst_type_tag or symconst_size, the node contains an attribute
623 * attr.i.*type, a pointer to a type_class. The mode of the node is mode_Is.
624 * if it is linkage_ptr_info it contains
625 * attr.i.*ptrinfo, an ident holding information for the linker. The mode
626 * of the node is mode_P_mach.
630 * ir_node *new_simpleSel (ir_node *store, ir_node *frame, entity *sel)
631 * --------------------------------------------------------------------
634 * Selects an entity from a compound type. This entity can be a field or
638 * *store The memory in which the object the entity should be selected
640 * *frame The pointer to the object.
641 * *sel The entity to select.
644 * The memory containing the object.
645 * A pointer to the object.
646 * An unsigned integer.
648 * A pointer to the selected entity.
650 * attr.sel Pointer to the entity
653 * ir_node *new_Sel (ir_node *store, ir_node *frame, int arity, ir_node **in,
654 * --------------------------------------------------------------------------
658 * Selects a field from an array type. The entity has as owner the array, as
659 * type the arrays element type. The indexes to access an array element are
663 * *store The memory in which the object the entity should be selected from
665 * *frame The pointer to the object.
666 * *arity number of array indexes.
667 * *in array with index inputs to the node.
668 * *sel The entity to select.
671 * The memory containing the object.
672 * A pointer to the object.
673 * As much unsigned integer as there are array expressions.
675 * A pointer to the selected entity.
677 * attr.sel Pointer to the entity
679 * The constructors new_Sel and new_simpleSel generate the same ir nodes.
680 * simpleSel just sets the arity of the index inputs to zero.
683 * ARITHMETIC OPERATIONS
684 * ---------------------
686 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node **in,
687 * ----------------------------------------------------------------------------
691 * Creates a procedure call.
694 * *store The actual store.
695 * *callee A pointer to the called procedure.
696 * arity The number of procedure parameters.
697 * **in An array with the pointers to the parameters.
698 * The constructor copies this array.
699 * *type Type information of the procedure called.
702 * The store, the callee and the parameters.
704 * A tuple containing the eventually changed store and the procedure
707 * attr.call Contains the type information for the procedure.
709 * ir_node *new_FuncCall (ir_node *callee, int arity, ir_node **in, type_method *type)
710 * -----------------------------------------------------------------------------------
712 * Creates a procedure call to a function WITHOUT memory side effects.
713 * nodes of this kind are floating in contrast to Call nodes.
714 * Further, a procedure call with FuncCall cannot raise an exception!
717 * *callee A pointer to the called procedure.
718 * arity The number of procedure parameters.
719 * **in An array with the pointers to the parameters.
720 * The constructor copies this array.
721 * *type Type information of the procedure called.
724 * The callee and the parameters.
726 * A tuple containing the procedure results.
728 * attr.call Contains the type information for the procedure.
730 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode)
731 * ------------------------------------------------------------
735 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode)
736 * ------------------------------------------------------------
740 * ir_node *new_Minus (ir_node *op, ir_mode *mode)
741 * -----------------------------------------------
743 * Unary Minus operations on floating point values.
745 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode)
746 * ------------------------------------------------------------
750 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2)
751 * --------------------------------------------------------------
753 * Quot performs exact division of floating point numbers. It's mode
754 * is Tuple, the mode of the result must be annotated to the Proj
755 * that extracts the result of the arithmetic operations.
758 * The store needed to model exceptions and the two operands.
760 * A tuple contaning a memory and a execution for modeling exceptions
761 * and the result of the arithmetic operation.
763 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2)
764 * ----------------------------------------------------------------
766 * Performs Div and Mod on interger values.
769 * A tuple contaning a memory and a execution for modeling exceptions
770 * and the two result of the arithmetic operations.
772 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2)
773 * -------------------------------------------------------------
777 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2)
778 * -------------------------------------------------------------
782 * ir_node *new_Abs (ir_node *op, ir_mode *mode)
783 * ---------------------------------------------
787 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode)
788 * ------------------------------------------------------------
792 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode)
793 * -----------------------------------------------------------
797 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode)
798 * ------------------------------------------------------------
802 * ir_node *new_Not (ir_node *op, ir_mode *mode)
803 * ---------------------------------------------
805 * This node constructs a constant where all bits are set to one
806 * and a Eor of this constant and the operator. This simulates a
809 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode)
810 * ---------------------------------------------------------
814 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode)
815 * ---------------------------------------------------------
817 * Logic shift right, i.e., zero extended.
820 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode)
821 * ----------------------------------------------------------
823 * Arithmetic shift right, i.e., sign extended.
825 * ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode)
826 * ---------------------------------------------------------
828 * Rotates the operand to the (right??) by k bits.
830 * ir_node *new_Conv (ir_node *op, ir_mode *mode)
831 * ---------------------------------------------
833 * Mode conversion. For allowed conversions see UKA Tech Report
836 * ir_node *new_Cmp (ir_node *op1, ir_node *op2)
837 * ---------------------------------------------
840 * The two values to be compared.
842 * A 16-tuple containing the results of the 16 different comparisons.
843 * The following is a list giving the comparisons and a projection
844 * number (pnc_number) to use in Proj nodes to extract the proper result.
850 * Ge greater of equal
852 * Leg less, equal or greater = ordered
854 * Ue unordered or equal
855 * Ul unordered or less
856 * Ule unordered, less or equal
857 * Ug unordered or greater
858 * Uge unordered, greater or equal
859 * Ne unordered, less or greater = not equal
866 * In general, Phi nodes are automaitcally inserted. In some cases, if
867 * all predecessors of a block are known, an explicit Phi node constructor
868 * is needed. E.g., to construct a FIRM graph for a statement as
869 * a = (b==c) ? 2 : 5;
871 * ir_node *new_Phi (int arity, ir_node **in, ir_mode *mode)
872 * ---------------------------------------------------------
874 * Creates a Phi node. The in's order has to correspond to the order
875 * of in's of current_block. This is not checked by the library!
876 * If one of the predecessors is Unknown (as it has to be filled in
877 * later) optimizations are skipped. This is necessary to
878 * construct Phi nodes in loops. Leaving Unknown in the Phi after finishing
879 * the construction may have strange effects, especially for interprocedural
880 * representation and analyses.
883 * arity number of predecessors
884 * **in array with predecessors
885 * *mode The mode of it's inputs and output.
887 * A Phi node has as many inputs as the block it belongs to.
888 * Each input points to a definition of the same value on a
889 * different path in the control flow.
891 * The definition valid in this block.
894 * OPERATIONS TO MANAGE MEMORY EXPLICITLY
895 * --------------------------------------
897 * ir_node *new_Load (ir_node *store, ir_node *addr)
898 * ----------------------------------------------------------------
900 * The Load operation reads a value from memory.
903 * *store The current memory.
904 * *addr A pointer to the variable to be read in this memory.
907 * The memory and a pointer to a variable in this memory.
909 * A tuple of the memory, a control flow to be taken in case of
910 * an exception and the loaded value.
912 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val)
913 * ----------------------------------------------------------------
915 * The Store operation writes a value to a variable in memory.
918 * The memory, a pointer to a variable in this memory and the value
919 * to write to this variable.
921 * A tuple of the changed memory and a control flow to be taken in
922 * case of an exception.
924 * ir_node *new_Alloc (ir_node *store, ir_node *size, type *alloc_type,
925 * --------------------------------------------------------------------
929 * The Alloc node allocates a new variable. It can be specified whether the
930 * variable should be allocated to the stack or to the heap.
933 * *store The memory which shall contain the new variable.
934 * ** *size The number of bytes to allocate. Old. **
935 * *size We decided that the size easily can be derived from the type.
936 * This field is for allocating arrays, i.e., it gives the multiple
937 * of the size of alloc_type to allocate memory for.
938 * *alloc_type The type of the allocated variable.
939 * where Where to allocate the variable, either heap_alloc or stack_alloc.
942 * A memory and an unsigned integer.
944 * A tuple of the changed memory, a control flow to be taken in
945 * case of an exception and the pointer to the new variable.
947 * a.where Indicates where the variable is allocated.
948 * a.*type A pointer to the class the allocated data object
951 * ir_node *new_Free (ir_node *store, ir_node *ptr, type *free_type)
952 * ------------------------------------------------------------------
954 * The Free node frees memory of the given variable.
957 * *store The memory which shall contain the new variable.
958 * *ptr The pointer to the object to free.
959 * *size The number of objects of type free_type to free in a sequence.
960 * *free_type The type of the freed variable.
963 * A memory, a pointer and an unsigned integer.
965 * The changed memory.
967 * f.*type A pointer to the type information of the freed data object.
971 * ir_node *new_Sync (int arity, ir_node **in)
972 * -------------------------------------------
974 * The Sync operation unifies several partial memory blocks. These blocks
975 * have to be pairwise disjunct or the values in common locations have to
976 * be identical. This operation allows to specify all operations that eventually
977 * need several partial memory blocks as input with a single entrance by
978 * unifying the memories with a preceding Sync operation.
981 * arity The number of memories to syncronize.
982 * **in An array of pointers to nodes that produce an output of
987 * The unified memory.
993 * ir_node *new_Bad (void)
994 * -----------------------
996 * Returns the unique Bad node current_ir_graph->bad.
997 * This node is used to express results of dead code elimination.
999 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj)
1000 * ----------------------------------------------------------
1002 * Selects one entry of a tuple. This is a hidden `fat edge'.
1005 * *arg A node producing a tuple.
1006 * *mode The mode of the value to project.
1007 * proj The position of the value in the tuple.
1013 * ir_node *new_Tuple (int arity, ir_node **in)
1014 * --------------------------------------------
1016 * Builds a Tuple from single values. This is needed to implement
1017 * optimizations that remove a node that produced a tuple. The node can be
1018 * replaced by the Tuple operation so that the following Proj nodes have not to
1019 * be changed. (They are hard to find due to the implementation with pointers
1020 * in only one direction.) The Tuple node is smaller than any other
1021 * node, so that a node can be changed into a Tuple by just changing it's
1022 * opcode and giving it a new in array.
1025 * arity The number of tuple elements.
1026 * **in An array containing pointers to the nodes producing the
1029 * ir_node *new_Id (ir_node *val, ir_mode *mode)
1030 * ---------------------------------------------
1032 * The single output of the Id operation is it's input. Also needed
1033 * for optimizations.
1036 * COPING WITH DATA OBJECTS
1037 * ========================
1039 * Two kinds of data objects have to be distinguished for generating
1040 * FIRM. First there are local variables other than arrays that are
1041 * known to be alias free. Second there are all other data objects.
1042 * For the first a common SSA representation is built, the second
1043 * are modeled by saving them to memory. The memory is treated as
1044 * a single local variable, the alias problem is hidden in the
1045 * content of this variable.
1047 * All values known in a Block are listed in the block's attribute,
1048 * block.**graph_arr which is used to automatically insert Phi nodes.
1049 * The following two funcions can be used to add a newly computed value
1050 * to the array, or to get the producer of a value, i.e., the current
1053 * inline void set_value (int pos, ir_node *value)
1054 * -----------------------------------------------
1056 * Has to be called for every assignment to a local variable. It
1057 * adds the value to the array of used values at position pos. Pos
1058 * has to be a unique identifier for an entry in the procedure's
1059 * definition table. It can be used to access the value again.
1060 * Requires current_block to be set correctly.
1062 * ir_node *get_value (int pos, ir_mode *mode)
1063 * -------------------------------------------
1065 * Returns the node defining the value referred to by pos. If the
1066 * value is not defined in this block a Phi node is generated and
1067 * all definitions reaching this Phi node are collected. It can
1068 * happen that the algorithm allocates an unnecessary Phi node,
1069 * e.g. if there is only one definition of this value, but this
1070 * definition reaches the currend block on several different
1071 * paths. This Phi node will be eliminated if optimizations are
1072 * turned on right after it's creation.
1073 * Requires current_block to be set correctly.
1075 * There are two special routines for the global store:
1077 * inline void set_store (ir_node *store)
1078 * --------------------------------------
1080 * Adds the store to the array of known values at a reserved
1082 * Requires current_block to be set correctly.
1084 * inline ir_node *get_store (void)
1085 * --------------------------------
1087 * Returns the node defining the actual store.
1088 * Requires current_block to be set correctly.
1091 * inline void keep_alive (ir_node *ka)
1092 * ------------------------------------
1094 * Keep this node alive because it is (might be) not in the control
1095 * flow from Start to End. Adds the node to the list in the end
1104 # include "firm_common.h"
1105 # include "irgraph.h"
1106 # include "irnode.h"
1107 # include "irmode.h"
1108 # include "entity.h"
1111 # include "dbginfo.h"
1113 /*-------------------------------------------------------------------------*/
1114 /* The raw interface */
1115 /*-------------------------------------------------------------------------*/
1117 /** Constructor for a Block node.
1119 * Constructs a mature block with the given predecessors. Use Unknown
1120 * nodes as predecessors to construct a block if the number of
1121 * predecessors is known, but not the predecessors themselves. This
1122 * constructor does not set current_block. It not be used with
1123 * automatic Phi node construction.
1125 * @param *db A Pointer for debug information.
1126 * @param irg The ir graph the block belongs to.
1127 * @param arity The number of control predecessors.
1128 * @param in[] An array of control predecessors. The length of
1129 * the array must be 'arity'. The constructor copies this array.
1131 ir_node *new_rd_Block (dbg_info *db, ir_graph *irg, int arity, ir_node *in[]);
1133 /** Constructor for a Start node.
1135 * @param *db A pointer for debug information.
1136 * @param *irg The ir graph the node belongs to.
1137 * @param *block The ir block the node belongs to.
1139 ir_node *new_rd_Start (dbg_info *db, ir_graph *irg, ir_node *block);
1141 /** Constructor for a End node.
1143 * @param *db A pointer for debug information.
1144 * @param *irg The ir graph the node belongs to.
1145 * @param *block The ir block the node belongs to.
1147 ir_node *new_rd_End (dbg_info *db, ir_graph *irg, ir_node *block);
1149 /** Constructor for a Jmp node.
1151 * Jmp represents control flow to a single control successor.
1153 * @param *db A pointer for debug information.
1154 * @param *irg The ir graph the node belongs to.
1155 * @param *block The ir block the node belongs to.
1157 ir_node *new_rd_Jmp (dbg_info *db, ir_graph *irg, ir_node *block);
1159 /** Constructor for a Break node.
1161 * Break represents control flow to a single control successor just as Jmp.
1162 * The blocks separated by a break may not be concatenated by an optimization.
1163 * It is used for the interprocedural representation where blocks are parted
1164 * behind Call nodes to represent the control flow to called procedures.
1166 * @param *db A pointer for debug information.
1167 * @param *irg The ir graph the node belong to.
1168 * @param *block The block the node belong to.
1170 ir_node *new_rd_Break (dbg_info *db, ir_graph *irg, ir_node *block);
1172 /** Constructor for a Cond node.
1174 * If c is mode_b represents a conditional branch (if/else). If c is
1175 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
1176 * node, default Proj is 0.)
1178 * This is not consistent: Input to Cond is Is, Proj has as proj number
1181 * @param *db A pointer for debug information.
1182 * @param *irg The ir graph the node belongs to.
1183 * @param *block The ir block the node belongs to.
1184 * @param *c The conditions parameter. Can be of mode b or I_u.
1186 ir_node *new_rd_Cond (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *c);
1188 /** Constructor for a Return node.
1190 * Returns the memory an zero or more return values. Only node that
1191 * can end regular control flow.
1193 * @param *db A pointer for debug information.
1194 * @param *irg The ir graph the node belongs to.
1195 * @param *block The ir block the node belongs to.
1196 * @param *store The state of memory.
1197 * @param arity Number of return values.
1198 * @param *in Array of length arity with return values. The constructor copies this array.
1200 ir_node *new_rd_Return (dbg_info *db, ir_graph *irg, ir_node *block,
1201 ir_node *store, int arity, ir_node *in[]);
1203 /** Constructor for a Raise node.
1205 * @param *db A pointer for debug information.
1206 * @param *irg The ir graph the node belongs to.
1207 * @param *block The ir block the node belongs to.
1208 * @param *store The current memory.
1209 * @param *obj A pointer to the Except variable.
1211 ir_node *new_rd_Raise (dbg_info *db, ir_graph *irg, ir_node *block,
1212 ir_node *store, ir_node *obj);
1214 /** Constructor for a Const_type node.
1216 * The constant represents a target value. This constructor sets high
1217 * level type information for the constant value.
1219 * @param *db A pointer for debug information.
1220 * @param *irg The ir graph the node belongs to.
1221 * @param *block The ir block the node belongs to.
1222 * @param *mode The mode of the operands and redults.
1223 * @param *con Points to an entry in the constant table.
1224 * @param *tp The type of the constant.
1226 ir_node *new_rd_Const_type (dbg_info* db, ir_graph *irg, ir_node *block,
1227 ir_mode *mode, tarval *con, type *tp);
1229 /** Constructor for a Const node.
1231 * Constructor for a Const node. The constant represents a target
1232 * value. Sets the type information to type_unknown. (No more
1233 * supported: If tv is entity derives a somehow useful type.)
1235 * @param *db A pointer for debug information.
1236 * @param *irg The ir graph the node belongs to.
1237 * @param *block The ir block the node belongs to.
1238 * @param *mode The mode of the operands and redults.
1239 * @param *con Points to an entry in the constant table.
1241 ir_node *new_rd_Const (dbg_info *db, ir_graph *irg, ir_node *block,
1242 ir_mode *mode, tarval *con);
1244 /** Constructor for a SymConst_type node.
1246 * This is the constructor for a symbolic constant.
1247 * There are four kinds of symbolic constants:
1248 * - type_tag The symbolic constant represents a type tag. The type the
1249 * tag stands for is given explicitly.
1250 * - size The symbolic constant represents the size of a type. The
1251 * type of which the constant represents the size is given
1253 * - addr_name The symbolic constant represents the address of an entity
1254 * (variable or method). The variable is indicated by a name
1255 * that is valid for linking.
1256 * - addr_ent The symbolic constant represents the address of an entity
1257 * (variable or method). The variable is given explicitly by
1260 * Inputs to the node:
1261 * No inputs except the block it belongs to.
1262 * Outputs of the node.
1263 * An unsigned integer (I_u) or a pointer (P).
1265 * Mention union in declaration so that the firmjni generator recognizes that
1266 * it can not cast the argument to an int.
1268 * @param *db A pointer for debug information.
1269 * @param *irg The ir graph the node belongs to.
1270 * @param *block The ir block the node belongs to.
1271 * @param symkind The kind of the symbolic constant: type_tag, size, addr_name or addr_ent.
1272 * @param value A type, entity or a ident depending on the SymConst kind.
1273 * @param tp The source type of the constant.
1275 ir_node *new_rd_SymConst_type (dbg_info* db, ir_graph *irg, ir_node *block, union symconst_symbol value,
1276 symconst_kind symkind, type *tp);
1278 /** Constructor for a SymConst node.
1280 * Same as new_rd_SymConst_type, except that it sets the type to type_unknown. */
1281 ir_node *new_rd_SymConst (dbg_info *db, ir_graph *irg, ir_node *block,
1282 union symconst_symbol value, symconst_kind symkind);
1284 /** Constructor for a SymConst addr_ent node.
1286 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1287 * symconst_addr_ent.
1288 * Adds the symconst to the start block of irg. */
1289 ir_node *new_rd_SymConst_addr_ent (dbg_info *db, ir_graph *irg, entity *symbol, type *tp);
1291 /** Constructor for a SymConst addr_name node.
1293 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1294 * symconst_addr_ent.
1295 * Adds the symconst to the start block of irg. */
1296 ir_node *new_rd_SymConst_addr_name (dbg_info *db, ir_graph *irg, ident *symbol, type *tp);
1298 /** Constructor for a SymConst type_tag node.
1300 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1301 * symconst_addr_ent.
1302 * Adds the symconst to the start block of irg. */
1303 ir_node *new_rd_SymConst_type_tag (dbg_info *db, ir_graph *irg, type *symbol, type *tp);
1305 /** Constructor for a SymConst size node.
1307 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1308 * symconst_addr_ent.
1309 * Adds the symconst to the start block of irg. */
1310 ir_node *new_rd_SymConst_size (dbg_info *db, ir_graph *irg, type *symbol, type *tp);
1312 /** Constructor for a Sel node.
1314 * The select node selects an entity (field or method) from an entity
1315 * with a compound type. It explicitly specifies the entity selected.
1316 * Dynamically the node may select entities that overwrite the given
1317 * entity. If the selected entity is an array element entity the Sel
1318 * node takes the required array indicees as inputs.
1320 * @param *db A pointer for debug information.
1321 * @param *irg The ir graph the node belongs to.
1322 * @param *block The ir block the node belongs to.
1323 * @param *store The memory in which the object the entity should be selected
1324 * from is allocated.
1325 * @param *objptr A pointer to a compound entity the Sel operation selects a
1326 * single attribute from.
1327 * @param *n_index The number of array indicees needed to select an array element entity.
1328 * @param *index[] If the compound entity is an array the indicees of the selected
1329 * element entity. The constructor copies this array.
1330 * @param *ent The entity to select.
1332 ir_node *new_rd_Sel (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1333 ir_node *objptr, int n_index, ir_node *index[], entity *ent);
1335 /** Constructor for a InstOf node.
1337 * For translating Java. Not supported as standard firm node.
1339 * @param *db A pointer for debug information.
1340 * @param *irg The ir graph the node belongs to.
1341 * @param *block The ir block the node belongs to.
1346 ir_node *new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1347 ir_node *objptr, type *ent);
1349 /** Constructor for a Call node.
1351 * Represents all kinds of method and function calls.
1353 * @param *db A pointer for debug information.
1354 * @param *irg The ir graph the node belongs to.
1355 * @param *block The ir block the node belongs to.
1356 * @param *store The current memory state.
1357 * @param *callee A pointer to the called procedure.
1358 * @param arity The number of procedure parameters.
1359 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1360 * @param *tp Type information of the procedure called.
1362 ir_node *new_rd_Call (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1363 ir_node *callee, int arity, ir_node *in[], type *tp);
1365 /** Constructor for a FuncCall node.
1367 * FuncCall is a function Call that has no side effects. Therefore there
1368 * is not memory operand or result.
1370 * @param *db A pointer for debug information.
1371 * @param *irg The ir graph the node belong to.
1372 * @param *block The block the node belong to.
1373 * @param *callee A pointer to the called procedure.
1374 * @param arity The number of procedure parameters.
1375 * @param *in[] An array with the pointers to the parameters. The constructor
1376 * copies this array.
1377 * @param *tp Type information of the procedure called.
1379 ir_node *new_rd_FuncCall (dbg_info *db, ir_graph *irg, ir_node *block,
1380 ir_node *callee, int arity, ir_node *in[],
1383 /** Constructor for a Add node.
1385 * @param *db A pointer for debug information.
1386 * @param *irg The ir graph the node belongs to.
1387 * @param *block The ir block the node belongs to.
1388 * @param *op1 The operand 1.
1389 * @param *op2 The operand 2.
1390 * @param *mode The mode of the operands and the result.
1392 ir_node *new_rd_Add (dbg_info *db, ir_graph *irg, ir_node *block,
1393 ir_node *op1, ir_node *op2, ir_mode *mode);
1395 /** Constructor for a Sub node.
1397 * @param *db A pointer for debug information.
1398 * @param *irg The ir graph the node belongs to.
1399 * @param *block The ir block the node belongs to.
1400 * @param *op1 The operand 1.
1401 * @param *op2 The operand 2.
1402 * @param *mode The mode of the operands and the result.
1404 ir_node *new_rd_Sub (dbg_info *db, ir_graph *irg, ir_node *block,
1405 ir_node *op1, ir_node *op2, ir_mode *mode);
1407 /** Constructor for a Minus node.
1409 * @param *db A pointer for debug information.
1410 * @param *irg The ir graph the node belongs to.
1411 * @param *block The ir block the node belongs to.
1412 * @param *op The operand .
1413 * @param *mode The mode of the operand and the result.
1415 ir_node *new_rd_Minus (dbg_info *db, ir_graph *irg, ir_node *block,
1416 ir_node *op, ir_mode *mode);
1418 /** Constructor for a Mul node.
1420 * @param *db A pointer for debug information.
1421 * @param *irg The ir graph the node belongs to.
1422 * @param *block The ir block the node belongs to.
1423 * @param *op1 The operand 1.
1424 * @param *op2 The operand 2.
1425 * @param *mode The mode of the operands and the result.
1427 ir_node *new_rd_Mul (dbg_info *db, ir_graph *irg, ir_node *block,
1428 ir_node *op1, ir_node *op2, ir_mode *mode);
1430 /** Constructor for a Quot node.
1432 * @param *db A pointer for debug information.
1433 * @param *irg The ir graph the node belongs to.
1434 * @param *block The ir block the node belongs to.
1435 * @param *memop The store needed to model exceptions
1436 * @param *op1 The operand 1.
1437 * @param *op2 The operand 2.
1439 ir_node *new_rd_Quot (dbg_info *db, ir_graph *irg, ir_node *block,
1440 ir_node *memop, ir_node *op1, ir_node *op2);
1442 /** Constructor for a DivMod node.
1444 * @param *db A pointer for debug information.
1445 * @param *irg The ir graph the node belongs to.
1446 * @param *block The ir block the node belongs to.
1447 * @param *memop The store needed to model exceptions
1448 * @param *op1 The operand 1.
1449 * @param *op2 The operand 2.
1451 ir_node *new_rd_DivMod (dbg_info *db, ir_graph *irg, ir_node *block,
1452 ir_node *memop, ir_node *op1, ir_node *op2);
1454 /** Constructor for a Div node.
1456 * @param *db A pointer for debug information.
1457 * @param *irg The ir graph the node belongs to.
1458 * @param *block The ir block the node belongs to.
1459 * @param *memop The store needed to model exceptions
1460 * @param *op1 The operand 1.
1461 * @param *op2 The operand 2.
1463 ir_node *new_rd_Div (dbg_info *db, ir_graph *irg, ir_node *block,
1464 ir_node *memop, ir_node *op1, ir_node *op2);
1466 /** Constructor for a Mod node.
1468 * @param *db A pointer for debug information.
1469 * @param *irg The ir graph the node belongs to.
1470 * @param *block The ir block the node belongs to.
1471 * @param *memop The store needed to model exceptions
1472 * @param *op1 The operand 1.
1473 * @param *op2 The operand 2.
1475 ir_node *new_rd_Mod (dbg_info *db, ir_graph *irg, ir_node *block,
1476 ir_node *memop, ir_node *op1, ir_node *op2);
1478 /** Constructor for a Abs node.
1480 * @param *db A pointer for debug information.
1481 * @param *irg The ir graph the node belongs to.
1482 * @param *block The ir block the node belongs to.
1483 * @param *op The operand
1484 * @param *mode The mode of the operands and the result.
1486 ir_node *new_rd_Abs (dbg_info *db, ir_graph *irg, ir_node *block,
1487 ir_node *op, ir_mode *mode);
1489 /** Constructor for a And node.
1491 * @param *db A pointer for debug information.
1492 * @param *irg The ir graph the node belongs to.
1493 * @param *block The ir block the node belongs to.
1494 * @param *op1 The operand 1.
1495 * @param *op2 The operand 2.
1496 * @param *mode The mode of the operands and the result.
1498 ir_node *new_rd_And (dbg_info *db, ir_graph *irg, ir_node *block,
1499 ir_node *op1, ir_node *op2, ir_mode *mode);
1501 /** Constructor for a Or node.
1503 * @param *db A pointer for debug information.
1504 * @param *irg The ir graph the node belongs to.
1505 * @param *block The ir block the node belongs to.
1506 * @param *op1 The operand 1.
1507 * @param *op2 The operand 2.
1508 * @param *mode The mode of the operands and the result.
1510 ir_node *new_rd_Or (dbg_info *db, ir_graph *irg, ir_node *block,
1511 ir_node *op1, ir_node *op2, ir_mode *mode);
1513 /** Constructor for a Eor node.
1515 * @param *db A pointer for debug information.
1516 * @param *irg The ir graph the node belongs to.
1517 * @param *block The ir block the node belongs to.
1518 * @param *op1 The operand 1.
1519 * @param *op2 The operand 2.
1520 * @param *mode The mode of the operands and the results.
1522 ir_node *new_rd_Eor (dbg_info *db, ir_graph *irg, ir_node *block,
1523 ir_node *op1, ir_node *op2, ir_mode *mode);
1525 /** Constructor for a Not node.
1527 * @param *db A pointer for debug information.
1528 * @param *irg The ir graph the node belongs to.
1529 * @param *block The ir block the node belongs to.
1530 * @param *op The operand.
1531 * @param *mode The mode of the operand and the result.
1533 ir_node *new_rd_Not (dbg_info *db, ir_graph *irg, ir_node *block,
1534 ir_node *op, ir_mode *mode);
1536 /** Constructor for a Cmp node.
1538 * @param *db A pointer for debug information.
1539 * @param *irg The ir graph the node belongs to.
1540 * @param *block The ir block the node belongs to.
1541 * @param *op1 The operand 1.
1542 * @param *op2 The operand 2.
1544 ir_node *new_rd_Cmp (dbg_info *db, ir_graph *irg, ir_node *block,
1545 ir_node *op1, ir_node *op2);
1547 /** Constructor for a Shl node.
1549 * @param *db A pointer for debug information.
1550 * @param *irg The ir graph the node belongs to.
1551 * @param *block The ir block the node belongs to.
1552 * @param *op The operand.
1553 * @param *k The number of bits to shift the operand .
1554 * @param *mode The mode of the operand and the result.
1556 ir_node *new_rd_Shl (dbg_info *db, ir_graph *irg, ir_node *block,
1557 ir_node *op, ir_node *k, ir_mode *mode);
1559 /** Constructor for a Shr node.
1561 * @param *db A pointer for debug information.
1562 * @param *irg The ir graph the node belongs to.
1563 * @param *block The ir block the node belongs to.
1564 * @param *op The operand.
1565 * @param *k The number of bits to shift the operand .
1566 * @param *mode The mode of the operand and the result.
1568 ir_node *new_rd_Shr (dbg_info *db, ir_graph *irg, ir_node *block,
1569 ir_node *op, ir_node *k, ir_mode *mode);
1571 /** Constructor for a Shrs node.
1573 * @param *db A pointer for debug information.
1574 * @param *irg The ir graph the node belongs to.
1575 * @param *block The ir block the node belongs to.
1576 * @param *op The operand.
1577 * @param *k The number of bits to shift the operand.
1578 * @param *mode The mode of the operand and the result.
1580 ir_node *new_rd_Shrs (dbg_info *db, ir_graph *irg, ir_node *block,
1581 ir_node *op, ir_node *k, ir_mode *mode);
1583 /** Constructor for a Rot node.
1585 * @param *db A pointer for debug information.
1586 * @param *irg The ir graph the node belongs to.
1587 * @param *block The ir block the node belongs to.
1588 * @param *op The operand.
1589 * @param *k The number of bits to rotate the operand.
1590 * @param *mode The mode of the operand.
1592 ir_node *new_rd_Rot (dbg_info *db, ir_graph *irg, ir_node *block,
1593 ir_node *op, ir_node *k, ir_mode *mode);
1596 /** Constructor for a Conv node.
1598 * @param *db A pointer for debug information.
1599 * @param *irg The ir graph the node belongs to.
1600 * @param *block The ir block the node belongs to.
1601 * @param *op The operand.
1602 * @param *mode The mode of this the operand muss be converted .
1604 ir_node *new_rd_Conv (dbg_info *db, ir_graph *irg, ir_node *block,
1605 ir_node *op, ir_mode *mode);
1607 /** Constructor for a Cast node.
1609 * High level type cast.
1611 * @param *db A pointer for debug information.
1612 * @param *irg The ir graph the node belongs to.
1613 * @param *block The ir block the node belongs to.
1614 * @param *op The operand.
1615 * @param *to_tp The type of this the operand muss be casted .
1617 ir_node *new_rd_Cast (dbg_info* db, ir_graph *irg, ir_node *block,
1618 ir_node *op, type *to_tp);
1620 /** Constructor for a Phi node.
1622 * @param *db A pointer for debug information.
1623 * @param *irg The ir graph the node belongs to.
1624 * @param *block The ir block the node belongs to.
1625 * @param arity The number of predecessors
1626 * @param *in[] Array with predecessors. The constructor copies this array.
1627 * @param *mode The mode of it's inputs and output.
1629 ir_node *new_rd_Phi (dbg_info *db, ir_graph *irg, ir_node *block, int arity,
1630 ir_node *in[], ir_mode *mode);
1632 /** Constructor for a Load node.
1634 * @param *db A pointer for debug information.
1635 * @param *irg The ir graph the node belongs to.
1636 * @param *block The ir block the node belongs to.
1637 * @param *store The current memory
1638 * @param *adr A pointer to the variable to be read in this memory.
1640 ir_node *new_rd_Load (dbg_info *db, ir_graph *irg, ir_node *block,
1641 ir_node *store, ir_node *adr);
1643 /** Constructor for a Store node.
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 current memory
1649 * @param *adr A pointer to the variable to be read in this memory.
1650 * @param *val The value to write to this variable.
1652 ir_node *new_rd_Store (dbg_info *db, ir_graph *irg, ir_node *block,
1653 ir_node *store, ir_node *adr, ir_node *val);
1655 /** Constructor for a Alloc node.
1657 * The Alloc node extends the memory by space for an entity of type alloc_type.
1659 * @param *db A pointer for debug information.
1660 * @param *irg The ir graph the node belongs to.
1661 * @param *block The ir block the node belongs to.
1662 * @param *store The memory which shall contain the new variable.
1663 * @param *size The number of bytes to allocate.
1664 * @param *alloc_type The type of the allocated variable.
1665 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
1667 ir_node *new_rd_Alloc (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1668 ir_node *size, type *alloc_type, where_alloc where);
1670 /** Constructor for a Free node.
1672 * Frees the memory occupied by the entity pointed to by the pointer
1673 * arg. Type indicates the type of the entity the argument points to.
1675 * @param *db A pointer for debug information.
1676 * @param *irg The ir graph the node belongs to.
1677 * @param *block The ir block the node belongs to.
1678 * @param *store The memory which shall contain the new variable.
1679 * @param *ptr The pointer to the object to free.
1680 * @param *size The number of objects of type free_type to free in a sequence.
1681 * @param *free_type The type of the freed variable.
1683 ir_node *new_rd_Free (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1684 ir_node *ptr, ir_node *size, type *free_type);
1686 /** Constructor for a Sync node.
1688 * Merges several memory values. The node assumes that a variable
1689 * either occurs only in one of the memories, or it contains the same
1690 * value in all memories where it occurs.
1692 * @param *db A pointer for debug information.
1693 * @param *irg The ir graph the node belongs to.
1694 * @param *block The ir block the node belongs to.
1695 * @param arity The number of memories to syncronize.
1696 * @param *in[] An array of pointers to nodes that produce an output of type
1697 * memory. The constructor copies this array.
1699 ir_node *new_rd_Sync (dbg_info *db, ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
1701 /** Constructor for a Proj node.
1703 * Projects a single value out of a tuple. The parameter proj gives the
1704 * position of the value within the tuple.
1706 * @param *db A pointer for deubugginformation.
1707 * @param *irg The ir graph the node belongs to.
1708 * @param *block The ir block the node belongs to.
1709 * @param arg A node producing a tuple. The node must have mode_T.
1710 * @param *mode The mode of the value to project.
1711 * @param proj The position of the value in the tuple.
1713 ir_node *new_rd_Proj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1714 ir_mode *mode, long proj);
1716 /** Constructor for a defaultProj node.
1718 * Represents the default control flow of a Switch-Cond node.
1720 * @param *db A pointer for debug information.
1721 * @param *irg The ir graph the node belongs to.
1722 * @param *block The ir block the node belongs to.
1723 * @param arg A node producing a tuple.
1724 * @param max_proj The end position of the value in the tuple.
1726 ir_node *new_rd_defaultProj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1729 /** Constructor for a Tuple node.
1731 * This is an auxiliary node to replace a node that returns a tuple
1732 * without changing the corresponding Proj nodes.
1734 * @param *db A pointer for debug information.
1735 * @param *irg The ir graph the node belongs to.
1736 * @param *block The ir block the node belongs to.
1737 * @param arity The number of tuple elements.
1738 * @param *in[] An array containing pointers to the nodes producing the tuple
1739 * elements. The constructor copies this array.
1741 ir_node *new_rd_Tuple (dbg_info *db, ir_graph *irg, ir_node *block,
1742 int arity, ir_node *in[]);
1744 /** Constructor for a Id node.
1746 * This is an auxiliary node to replace a node that returns a single
1749 * @param *db A pointer for debug information.
1750 * @param *irg The ir graph the node belongs to.
1751 * @param *block The ir block the node belongs to.
1752 * @param *val The value
1753 * @param *mode The mode of *val.
1755 ir_node *new_rd_Id (dbg_info *db, ir_graph *irg, ir_node *block,
1756 ir_node *val, ir_mode *mode);
1758 /** Constructor for a Bad node.
1760 * Returns the unique Bad node of the graph. The same as
1763 * @param *irg The ir graph the node belongs to.
1765 ir_node *new_rd_Bad (ir_graph *irg);
1767 /** Constructor for a Confirm node.
1769 * Specifies constraints for a value. To support dataflow analyses.
1771 * Example: If the value never exceeds '100' this is expressed by placing a
1772 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
1774 * @param *irg The ir graph the node belong to.
1775 * @param *block The ir block the node belong to.
1776 * @param *db A pointer for debug information.
1777 * @param *val The value we express a constraint for
1778 * @param *bound The value to compare against. Must be a firm node, typically a constant.
1779 * @param cmp The compare operation.
1781 ir_node *new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block,
1782 ir_node *val, ir_node *bound, pn_Cmp cmp);
1784 /** Constructor for an Unknown node.
1786 * Represents an arbitrary value. Places the node in the start block.
1788 * @param *irg The ir graph the node belongs to.
1789 * @param *m The mode of the unknown value.
1791 ir_node *new_rd_Unknown(ir_graph *irg, ir_mode *m);
1793 /** Constructor for a CallBegin node.
1795 * CallBegin represents control flow depending of the pointer value
1796 * representing the called method to the called methods. The
1797 * constructor copies the method pointer input from the passed Call
1800 * @param *db A pointer for debug information.
1801 * @param *irg The ir graph the node belong to.
1802 * @param *block The block the node belong to.
1803 * @param *callee The call node visible in the intra procedural view.
1805 ir_node *new_rd_CallBegin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *callee);
1807 /** Constructor for a EndReg node.
1809 * Used to represent regular procedure end in interprocedual view.
1811 * @param *db A pointer for debug information.
1812 * @param *irg The ir graph the node belong to.
1813 * @param *block The block the node belong to.
1815 ir_node *new_rd_EndReg (dbg_info *db, ir_graph *irg, ir_node *block);
1817 /** Constructor for a EndExcept node.
1819 * Used to represent exceptional procedure end in interprocedural view.
1821 * @param *db A pointer for debug information.
1822 * @param *irg The ir graph the node belong to.
1823 * @param *block The block the node belong to.
1825 ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
1827 /** Constructor for a Filter node.
1829 * Adds the node to the block in current_ir_block. Filter is a node
1830 * with two views used to construct the interprocedural view. In
1831 * intraprocedural view its semantics are identical to the Proj node.
1832 * In interprocedural view the Filter performs the Phi operation on
1833 * method parameters or results. Other than a Phi a Filter node may
1834 * not be removed if it has only a single input.
1836 * The constructor builds the Filter in intraprocedural view.
1838 * @param *irg The ir graph the node belong to.
1839 * @param *block The block the node belong to.
1840 * @param *arg The tuple value to project from.
1841 * @param *mode The mode of the projected value.
1842 * @param proj The position in the tuple to project from.
1844 ir_node *new_rd_Filter (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1845 ir_mode *mode, long proj);
1848 /*-------------------------------------------------------------------------*/
1849 /* The raw interface without debug support */
1850 /*-------------------------------------------------------------------------*/
1852 /** Constructor for a Block node.
1854 * Constructs a mature block with the given predecessors. Use Unknown
1855 * nodes as predecessors to construct a block if the number of
1856 * predecessors is known, but not the predecessors themselves. This
1857 * constructor does not set current_block. It not be used with
1858 * automatic Phi node construction.
1861 * @param irg The ir graph the block belongs to.
1862 * @param arity The number of control predecessors.
1863 * @param in[] An array of control predecessors. The length of
1864 * the array must be 'arity'. The constructor copies this array.
1866 ir_node *new_r_Block (ir_graph *irg, int arity, ir_node *in[]);
1868 /** Constructor for a Start node.
1870 * @param *irg The ir graph the node belongs to.
1871 * @param *block The ir block the node belongs to.
1873 ir_node *new_r_Start (ir_graph *irg, ir_node *block);
1875 /** Constructor for a End node.
1877 * @param *irg The ir graph the node belongs to.
1878 * @param *block The ir block the node belongs to.
1880 ir_node *new_r_End (ir_graph *irg, ir_node *block);
1882 /** Constructor for a Jmp node.
1884 * Jmp represents control flow to a single control successor.
1886 * @param *irg The ir graph the node belongs to.
1887 * @param *block The ir block the node belongs to.
1889 ir_node *new_r_Jmp (ir_graph *irg, ir_node *block);
1891 /** Constructor for a Cond node.
1893 * If c is mode_b represents a conditional branch (if/else). If c is
1894 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
1895 * node, default Proj is 0.)
1897 * This is not consistent: Input to Cond is Is, Proj has as proj number
1900 * @param *irg The ir graph the node belongs to.
1901 * @param *block The ir block the node belongs to.
1902 * @param *c The conditions parameter.Can be of mode b or I_u.
1904 ir_node *new_r_Cond (ir_graph *irg, ir_node *block, ir_node *c);
1906 /** Constructor for a Return node.
1908 * Returns the memory an zero or more return values. Only node that
1909 * can end regular control flow.
1911 * @param *irg The ir graph the node belongs to.
1912 * @param *block The ir block the node belongs to.
1913 * @param *store The state of memory.
1914 * @param arity Number of array indexes.
1915 * @param *in[] Array with index inputs to the node. The constructor copies this array.
1917 ir_node *new_r_Return (ir_graph *irg, ir_node *block,
1918 ir_node *store, int arity, ir_node *in[]);
1920 /** Constructor for a Raise node.
1922 * @param *irg The ir graph the node belongs to.
1923 * @param *block The ir block the node belongs to.
1924 * @param *store The current memory.
1925 * @param *obj A pointer to the Except variable.
1927 ir_node *new_r_Raise (ir_graph *irg, ir_node *block,
1928 ir_node *store, ir_node *obj);
1930 /** Constructor for a Const node.
1932 * Constructor for a Const node. The constant represents a target
1933 * value. Sets the type information to type_unknown. (No more
1934 * supported: If tv is entity derives a somehow useful type.)
1936 * @param *irg The ir graph the node belongs to.
1937 * @param *block The ir block the node belongs to.
1938 * @param *mode The mode of the operands and the results.
1939 * @param *con Points to an entry in the constant table.
1941 ir_node *new_r_Const (ir_graph *irg, ir_node *block,
1942 ir_mode *mode, tarval *con);
1944 /** Constructor for a SymConst node.
1946 * This is the constructor for a symbolic constant.
1947 * There are four kinds of symbolic constants:
1948 * - type_tag The symbolic constant represents a type tag. The type the
1949 * tag stands for is given explicitly.
1950 * - size The symbolic constant represents the size of a type. The
1951 * type of which the constant represents the size is given
1953 * - addr_name The symbolic constant represents the address of an entity
1954 * (variable or method). The variable is indicated by a name
1955 * that is valid for linking.
1956 * - addr_ent The symbolic constant represents the address of an entity
1957 * (variable or method). The variable is given explicitly by
1960 * Inputs to the node:
1961 * No inputs except the block it belongs to.
1962 * Outputs of the node.
1963 * An unsigned integer (I_u) or a pointer (P).
1965 * @param *irg The ir graph the node belongs to.
1966 * @param *block The ir block the node belongs to.
1967 * @param volue A type, entity or a ident depending on the SymConst kind.
1968 * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
1970 ir_node *new_r_SymConst (ir_graph *irg, ir_node *block,
1971 union symconst_symbol value, symconst_kind symkind);
1973 /** Constructor for a Sel node.
1975 * The select node selects an entity (field or method) from an entity
1976 * with a compound type. It explicitly specifies the entity selected.
1977 * Dynamically the node may select entities that overwrite the given
1978 * entity. If the selected entity is an array element entity the Sel
1979 * node takes the required array indicees as inputs.
1981 * @param *irg The ir graph the node belongs to.
1982 * @param *block The ir block the node belongs to.
1983 * @param *store The memory in which the object the entity should be selected
1984 * from is allocated.
1985 * @param *objptr A pointer to a compound entity the Sel operation selects a
1986 * single attribute from.
1987 * @param *n_index The number of array indicees needed to select an array element entity.
1988 * @param *index[] If the compound entity is an array the indicees of the selected
1989 * element entity. The constructor copies this array.
1990 * @param *ent The entity to select.
1992 ir_node *new_r_Sel (ir_graph *irg, ir_node *block, ir_node *store,
1993 ir_node *objptr, int n_index, ir_node *index[],
1996 /** Constructor for a InstOf node.
1998 * For translating Java. Not supported as standard firm node.
2000 * @param *irg The ir graph the node belongs to.
2001 * @param *block The ir block the node belongs to.
2007 ir_node *new_r_InstOf (ir_graph *irg, ir_node *block, ir_node *x, ir_node *y, type *z);
2009 /** Constructor for a Call node.
2011 * Represents all kinds of method and function calls.
2013 * @param *irg The ir graph the node belongs to.
2014 * @param *block The ir block the node belongs to.
2015 * @param * store The actual store.
2016 * @param *callee A pointer to the called procedure.
2017 * @param arity The number of procedure parameters.
2018 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2019 * @param *tp Type information of the procedure called.
2022 ir_node *new_r_Call (ir_graph *irg, ir_node *block, ir_node *store,
2023 ir_node *callee, int arity, ir_node *in[],
2026 /** Constructor for a Add node.
2028 * @param *irg The ir graph the node belongs to.
2029 * @param *block The ir block the node belongs to.
2030 * @param *op1 The operand 1.
2031 * @param *op2 The operand 2.
2032 * @param *mode The mode of the operands and the result.
2035 ir_node *new_r_Add (ir_graph *irg, ir_node *block,
2036 ir_node *op1, ir_node *op2, ir_mode *mode);
2039 * Constructor for a Sub node.
2041 * @param *irg The ir graph the node belongs to.
2042 * @param *block The ir block the node belongs to.
2043 * @param *op1 The operand 1.
2044 * @param *op2 The operand 2.
2045 * @param *mode The mode of the operands and the results.
2048 ir_node *new_r_Sub (ir_graph *irg, ir_node *block,
2049 ir_node *op1, ir_node *op2, ir_mode *mode);
2051 /** Constructor for a Minus node.
2053 * @param *irg The ir graph the node belongs to.
2054 * @param *block The ir block the node belongs to.
2055 * @param *op The operand.
2056 * @param *mode The mode of the operand and the result.
2059 ir_node *new_r_Minus (ir_graph *irg, ir_node *block,
2060 ir_node *op, ir_mode *mode);
2061 /** Constructor for a Mul node.
2063 * @param *irg The ir graph the node belongs to.
2064 * @param *block The ir block the node belongs to.
2065 * @param *op1 The operand 1.
2066 * @param *op2 The operand 2.
2067 * @param *mode The mode of the operands and the result.
2070 ir_node *new_r_Mul (ir_graph *irg, ir_node *block,
2071 ir_node *op1, ir_node *op2, ir_mode *mode);
2073 /** Constructor for a Quot node.
2075 * @param *irg The ir graph the node belongs to.
2076 * @param *block The ir block the node belongs to.
2077 * @param *memop The store needed to model exceptions
2078 * @param *op1 The operand 1.
2079 * @param *op2 The operand 2.
2082 ir_node *new_r_Quot (ir_graph *irg, ir_node *block,
2083 ir_node *memop, ir_node *op1, ir_node *op2);
2085 /** Constructor for a DivMod node.
2087 * @param *irg The ir graph the node belongs to.
2088 * @param *block The ir block the node belongs to.
2089 * @param *memop The store needed to model exceptions
2090 * @param *op1 The operand 1.
2091 * @param *op2 The operand 2.
2094 ir_node *new_r_DivMod (ir_graph *irg, ir_node *block,
2095 ir_node *memop, ir_node *op1, ir_node *op2);
2097 /** Constructor for a Div node.
2099 * @param *irg The ir graph the node belongs to.
2100 * @param *block The ir block the node belongs to.
2101 * @param *memop The store needed to model exceptions
2102 * @param *op1 The operand 1.
2103 * @param *op2 The operand 2.
2106 ir_node *new_r_Div (ir_graph *irg, ir_node *block,
2107 ir_node *memop, ir_node *op1, ir_node *op2);
2109 /** Constructor for a Mod node.
2111 * @param *irg The ir graph the node belongs to.
2112 * @param *block The ir block the node belongs to.
2113 * @param *memop The store needed to model exceptions
2114 * @param *op1 The operand 1.
2115 * @param *op2 The operand 2.
2118 ir_node *new_r_Mod (ir_graph *irg, ir_node *block,
2119 ir_node *memop, ir_node *op1, ir_node *op2);
2121 /** Constructor for a Abs node.
2123 * @param *irg The ir graph the node belongs to.
2124 * @param *block The ir block the node belongs to.
2125 * @param *op The operand
2126 * @param *mode The mode of the operands and the result.
2129 ir_node *new_r_Abs (ir_graph *irg, ir_node *block,
2130 ir_node *op, ir_mode *mode);
2132 /** Constructor for a And node.
2134 * @param *irg The ir graph the node belongs to.
2135 * @param *block The ir block the node belongs to.
2136 * @param *op1 The operand 1.
2137 * @param *op2 The operand 2.
2138 * @param *mode The mode of the operands and the result.
2141 ir_node *new_r_And (ir_graph *irg, ir_node *block,
2142 ir_node *op1, ir_node *op2, ir_mode *mode);
2144 /** Constructor for a Or node.
2146 * @param *irg The ir graph the node belongs to.
2147 * @param *block The ir block the node belongs to.
2148 * @param *op1 The operand 1.
2149 * @param *op2 The operand 2.
2150 * @param *mode The mode of the operands and the result.
2153 ir_node *new_r_Or (ir_graph *irg, ir_node *block,
2154 ir_node *op1, ir_node *op2, ir_mode *mode);
2156 /** Constructor for a Eor node.
2158 * @param *irg The ir graph the node belongs to.
2159 * @param *block The ir block the node belongs to.
2160 * @param *op1 The operand 1.
2161 * @param *op2 The operand 2.
2162 * @param *mode The mode of the operands and the results.
2165 ir_node *new_r_Eor (ir_graph *irg, ir_node *block,
2166 ir_node *op1, ir_node *op2, ir_mode *mode);
2168 /** Constructor for a Not node.
2170 * @param *irg The ir graph the node belongs to.
2171 * @param *block The ir block the node belongs to.
2172 * @param *op The operand.
2173 * @param *mode The mode of the operand and the result.
2176 ir_node *new_r_Not (ir_graph *irg, ir_node *block,
2177 ir_node *op, ir_mode *mode);
2179 /** Constructor for a Cmp node.
2181 * @param *irg The ir graph the node belongs to.
2182 * @param *block The ir block the node belongs to.
2183 * @param *op1 The operand 1.
2184 * @param *op2 The operand 2.
2187 ir_node *new_r_Cmp (ir_graph *irg, ir_node *block,
2188 ir_node *op1, ir_node *op2);
2190 /** Constructor for a Shl node.
2192 * @param *irg The ir graph the node belongs to.
2193 * @param *block The ir block the node belongs to.
2194 * @param *op The operand.
2195 * @param *k The number of bits to shift the operand .
2196 * @param *mode The mode of the operand and the result.
2199 ir_node *new_r_Shl (ir_graph *irg, ir_node *block,
2200 ir_node *op, ir_node *k, ir_mode *mode);
2202 /** Constructor for a Shr node.
2204 * @param *irg The ir graph the node belongs to.
2205 * @param *block The ir block the node belongs to.
2206 * @param *op The operand.
2207 * @param *k The number of bits to shift the operand .
2208 * @param *mode The mode of the operand and the result.
2211 ir_node *new_r_Shr (ir_graph *irg, ir_node *block,
2212 ir_node *op, ir_node *k, ir_mode *mode);
2215 * Constructor for a Shrs node.
2217 * @param *irg The ir graph the node belongs to.
2218 * @param *block The ir block the node belongs to.
2219 * @param *op The operand.
2220 * @param *k The number of bits to shift the operand.
2221 * @param *mode The mode of the operand and the result.
2224 ir_node *new_r_Shrs (ir_graph *irg, ir_node *block,
2225 ir_node *op, ir_node *k, ir_mode *mode);
2227 /** Constructor for a Rot node.
2229 * @param *irg The ir graph the node belongs to.
2230 * @param *block The ir block the node belongs to.
2231 * @param *op The operand.
2232 * @param *k The number of bits to rotate the operand.
2233 * @param *mode The mode of the operand.
2236 ir_node *new_r_Rot (ir_graph *irg, ir_node *block,
2237 ir_node *op, ir_node *k, ir_mode *mode);
2239 /** Constructor for a Conv node.
2241 * @param *irg The ir graph the node belongs to.
2242 * @param *block The ir block the node belongs to.
2243 * @param *op The operand.
2244 * @param *mode The mode of this the operand muss be converted .
2247 ir_node *new_r_Conv (ir_graph *irg, ir_node *block,
2248 ir_node *op, ir_mode *mode);
2250 /** Constructor for a Cast node.
2252 * High level type cast
2254 * @param *irg The ir graph the node belongs to.
2255 * @param *block The ir block the node belongs to.
2256 * @param *op The operand.
2257 * @param *to_tp The type of this the operand muss be casted .
2260 ir_node *new_r_Cast (ir_graph *irg, ir_node *block,
2261 ir_node *op, type *to_tp);
2263 /** Constructor for a Phi node.
2265 * @param *irg The ir graph the node belongs to.
2266 * @param *block The ir block the node belongs to.
2267 * @param arity The number of predecessors
2268 * @param *in[] Array with predecessors. The constructor copies this array.
2269 * @param *mode The mode of it's inputs and output.
2272 ir_node *new_r_Phi (ir_graph *irg, ir_node *block, int arity,
2273 ir_node *in[], ir_mode *mode);
2275 /** Constructor for a Load node.
2277 * @param *irg The ir graph the node belongs to.
2278 * @param *block The ir block the node belongs to.
2279 * @param *store The current memory
2280 * @param *adr A pointer to the variable to be read in this memory.
2283 ir_node *new_r_Load (ir_graph *irg, ir_node *block,
2284 ir_node *store, ir_node *adr);
2285 /** Constructor for a Store node.
2287 * @param *irg The ir graph the node belongs to.
2288 * @param *block The ir block the node belongs to.
2289 * @param *store The current memory
2290 * @param *adr A pointer to the variable to be read in this memory.
2291 * @param *val The value to write to this variable.
2293 ir_node *new_r_Store (ir_graph *irg, ir_node *block,
2294 ir_node *store, ir_node *adr, ir_node *val);
2296 /** Constructor for a Alloc node.
2298 * The Alloc node extends the memory by space for an entity of type alloc_type.
2300 * @param *irg The ir graph the node belongs to.
2301 * @param *block The ir block the node belongs to.
2302 * @param *store The memory which shall contain the new variable.
2303 * @param *size The number of bytes to allocate.
2304 * @param *alloc_type The type of the allocated variable.
2305 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
2308 ir_node *new_r_Alloc (ir_graph *irg, ir_node *block, ir_node *store,
2309 ir_node *size, type *alloc_type, where_alloc where);
2311 /** Constructor for a Free node.
2313 * Frees the memory occupied by the entity pointed to by the pointer
2314 * arg. Type indicates the type of the entity the argument points to.
2316 * @param *irg The ir graph the node belongs to.
2317 * @param *block The ir block the node belongs to.
2318 * @param *store The memory which shall contain the new variable.
2319 * @param *ptr The pointer to the object to free.
2320 * @param *size The number of objects of type free_type to free in a sequence.
2321 * @param *free_type The type of the freed variable.
2324 ir_node *new_r_Free (ir_graph *irg, ir_node *block, ir_node *store,
2325 ir_node *ptr, ir_node *size, type *free_type);
2327 /** Constructor for a Sync node.
2329 * Merges several memory values. The node assumes that a variable
2330 * either occurs only in one of the memories, or it contains the same
2331 * value in all memories where it occurs.
2333 * @param *irg The ir graph the node belongs to.
2334 * @param *block The ir block the node belongs to.
2335 * @param arity The number of memories to syncronize.
2336 * @param *in[] An array of pointers to nodes that produce an output of type memory.
2337 * The constructor copies this array.
2340 ir_node *new_r_Sync (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2342 /** Constructor for a Proj node.
2344 * Projects a single value out of a tuple. The parameter proj gives the
2345 * position of the value within the tuple.
2347 * @param *irg The ir graph the node belongs to.
2348 * @param *block The ir block the node belongs to.
2349 * @param arg A node producing a tuple.
2350 * @param *mode The mode of the value to project.
2351 * @param proj The position of the value in the tuple.
2354 ir_node *new_r_Proj (ir_graph *irg, ir_node *block, ir_node *arg,
2355 ir_mode *mode, long proj);
2357 /** Constructor for a defaultProj node.
2359 * Represents the default control flow of a Switch-Cond node.
2361 * @param *irg The ir graph the node belongs to.
2362 * @param *block The ir block the node belongs to.
2363 * @param arg A node producing a tuple.
2364 * @param max_ proj The end position of the value in the tuple.
2367 ir_node *new_r_defaultProj (ir_graph *irg, ir_node *block, ir_node *arg, long max_proj);
2370 /** Constructor for a Tuple node.
2372 * This is an auxiliary node to replace a node that returns a tuple
2373 * without changing the corresponding Proj nodes.
2375 * @param *irg The ir graph the node belongs to.
2376 * @param *block The ir block the node belongs to.
2377 * @param arity The number of tuple elements.
2378 * @param *in[] An array containing pointers to the nodes producing the tuple elements.
2379 * The constructor copies this array.
2381 ir_node *new_r_Tuple (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2383 /** Constructor for a Id node.
2385 * This is an auxiliary node to replace a node that returns a single
2388 * @param *irg The ir graph the node belongs to.
2389 * @param *block The ir block the node belongs to.
2390 * @param *val The operand to Id.
2391 * @param *mode The mode of *val.
2394 ir_node *new_r_Id (ir_graph *irg, ir_node *block,
2395 ir_node *val, ir_mode *mode);
2397 /** Constructor for a Bad node.
2399 * Returns the unique Bad node of the graph. The same as
2402 * @param *irg The ir graph the node belongs to.
2406 ir_node *new_r_Bad (ir_graph *irg);
2408 /** Constructor for a Confirm node.
2410 * Specifies constraints for a value. To support dataflow analyses.
2412 * Example: If the value never exceeds '100' this is expressed by placing a
2413 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
2415 * @param *irg The ir graph the node belong to.
2416 * @param *block The ir block the node belong to.
2417 * @param *db A pointer for debug information.
2418 * @param *val The value we express a constraint for
2419 * @param *bound The value to compare against. Must be a firm node, typically a constant.
2420 * @param cmp The compare operation.
2423 ir_node *new_r_Confirm (ir_graph *irg, ir_node *block,
2424 ir_node *val, ir_node *bound, pn_Cmp cmp);
2426 /** Constructor for a Unknown node.
2428 * Represents an arbtrary valus. Places the node in
2431 * @param *irg The ir graph the node belongs to.
2432 * @param *m The mode of the unknown value.
2434 ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2436 /** Constructor for a CallBegin node.
2438 * CallBegin represents control flow depending of the pointer value
2439 * representing the called method to the called methods. The
2440 * constructor copies the method pointer input from the passed Call
2443 * @param *irg The ir graph the node belong to.
2444 * @param *block The block the node belong to.
2445 * @param *callee The call node bisible in the intra procedural view.
2448 ir_node *new_r_CallBegin(ir_graph *irg, ir_node *block, ir_node *callee);
2450 /** Constructor for a EndReg node.
2452 * Used to represent regular procedure end in interprocedual view.
2454 * @param *irg The ir graph the node belong to.
2455 * @param *block The block the node belong to.
2458 ir_node *new_r_EndReg (ir_graph *irg, ir_node *block);
2460 /** Constructor for a EndExcept node.
2462 * Used to represent exceptional procedure end in interprocedural view.
2464 * @param *irg The ir graph the node belong to.
2465 * @param *block The block the node belong to.
2468 ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
2470 /** Constructor for a Break node.
2472 * Break represents control flow to a single control successor just as Jmp.
2473 * The blocks separated by a break may not be concatenated by an optimization.
2474 * It is used for the interprocedural representation where blocks are parted
2475 * behind Call nodes to represent the control flow to called procedures.
2477 * @param *irg The ir graph the node belong to.
2478 * @param *block The block the node belong to.
2481 ir_node *new_r_Break (ir_graph *irg, ir_node *block);
2483 /** Constructor for a Filter node.
2485 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
2486 * Filter is a node with two views used to construct the interprocedural view.
2487 * In intraprocedural view its semantics are identical to the Proj node.
2488 * In interprocedural view the Filter performs the Phi operation on method
2489 * parameters or results. Other than a Phi a Filter node may not be removed
2490 * if it has only a single input.
2492 * The constructor builds the Filter in intraprocedural view.
2494 * @param *irg The ir graph the node belong to.
2495 * @param *block The block the node belong to.
2496 * @param *arg The tuple value to project from.
2497 * @param *mode The mode of the projected value.
2498 * @param proj The position in the tuple to project from.
2501 ir_node *new_r_Filter (ir_graph *irg, ir_node *block, ir_node *arg,
2502 ir_mode *mode, long proj);
2504 /** Constructor for a FuncCall node.
2506 * FuncCall is a function Call that has no side effects. Therefore there
2507 * is not memory operand or result.
2509 * @param *irg The ir graph the node belong to.
2510 * @param *block The block the node belong to.
2511 * @param *callee A pointer to the called procedure.
2512 * @param arity The number of procedure parameters.
2513 * @param *in[] An array with the pointers to the parameters.
2514 * The constructor copies this array.
2515 * @param *type Type information of the procedure called.
2518 ir_node *new_r_FuncCall (ir_graph *irg, ir_node *block,
2519 ir_node *callee, int arity, ir_node *in[],
2522 /*-----------------------------------------------------------------------*/
2523 /* The block oriented interface */
2524 /*-----------------------------------------------------------------------*/
2526 /** Sets the current block in which the following constructors place the
2527 * nodes they construct.
2529 * @param target The new current block.
2531 void set_cur_block (ir_node *target);
2533 /** Returns the current block of the current graph. */
2534 ir_node *get_cur_block(void);
2536 /** Returns the fixed nodes of the current graph. */
2537 #define get_cur_end_block() get_irg_end_block(current_ir_graph)
2538 #define get_cur_end() get_irg_end(current_ir_graph)
2539 #define get_cur_start_block() get_irg_start_block(current_ir_graph)
2540 #define get_cur_start() get_irg_start(current_ir_graph)
2542 /** Constructor for a Block node.
2544 * Adds the block to the graph in current_ir_graph. Constructs a Block
2545 * with a fixed number of predecessors. Does set current_block. Can
2546 * be used with automatic Phi node construction.
2548 * @param *db A Pointer for debugginfomation.
2549 * @param arity The number of control predecessors.
2550 * @param in[] An array of control predecessors. The length of
2551 * the array must be 'arity'.
2553 ir_node *new_d_Block(dbg_info* db, int arity, ir_node *in[]);
2555 /** Constructor for a Start node.
2557 * Adds the node to the block in current_ir_block.
2559 * @param *db A pointer for debug information.
2562 ir_node *new_d_Start (dbg_info* db);
2564 /** Constructor for a End node.
2566 * Adds the node to the block in current_ir_block.
2568 * @param *db A pointer for debug information.
2571 ir_node *new_d_End (dbg_info* db);
2573 /** Constructor for a Jmp node.
2575 * Adds the node to the block in current_ir_block.
2577 * Jmp represents control flow to a single control successor.
2579 * @param *db A pointer for debug information.
2583 ir_node *new_d_Jmp (dbg_info* db);
2585 /** Constructor for a Cond node.
2587 * Adds the node to the block in current_ir_block.
2589 * If c is mode_b represents a conditional branch (if/else). If c is
2590 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2591 * node, default Proj is 0.)
2593 * This is not consistent: Input to Cond is Is, Proj has as proj number
2596 * @param *db A pointer for debug information.
2597 * @param *c The conditions parameter.Can be of mode b or I_u.
2601 ir_node *new_d_Cond (dbg_info* db, ir_node *c);
2603 /** Constructor for a Return node.
2605 * Adds the node to the block in current_ir_block.
2607 * Returns the memory an zero or more return values. Only node that
2608 * can end regular control flow.
2610 * @param *db A pointer for debug information.
2611 * @param *store The state of memory.
2612 * @param arity Number of array indexes.
2613 * @param *in Array with index inputs to the node.
2617 ir_node *new_d_Return (dbg_info* db, ir_node *store, int arity, ir_node *in[]);
2619 /** Constructor for a Raise node.
2621 * Adds the node to the block in current_ir_block.
2623 * @param *db A pointer for debug information.
2624 * @param *store The current memory.
2625 * @param *obj A pointer to the Except variable.
2629 ir_node *new_d_Raise (dbg_info* db, ir_node *store, ir_node *obj);
2631 /** Constructor for a Const_type node.
2633 * Adds the node to the block in current_ir_block.
2635 * The constant represents a target value. This constructor sets high
2636 * level type information for the constant value.
2638 * @param *db A pointer for debug information.
2639 * @param *mode The mode of the operands and redults.
2640 * @param *con Points to an entry in the constant table. This pointer is
2641 added to the attributes of the node.
2642 * @param *tp The type of the constante.
2646 ir_node *new_d_Const_type (dbg_info* db, ir_mode *mode, tarval *con, type *tp);
2648 /** Constructor for a Const node.
2650 * Adds the node to the block in current_ir_block.
2652 * Constructor for a Const node. The constant represents a target
2653 * value. Sets the type information to type_unknown. (No more
2654 * supported: If tv is entity derives a somehow useful type.)
2656 * @param *db A pointer for debug information.
2657 * @param *mode The mode of the operands and redults.
2658 * @param *con Points to an entry in the constant table. This pointer is added
2659 * to the attributes of the node.
2662 ir_node *new_d_Const (dbg_info* db, ir_mode *mode, tarval *con);
2664 /** Constructor for a SymConst_type node.
2666 * Adds the node to the block in current_ir_block.
2667 * This is the constructor for a symbolic constant.
2668 * There are four kinds of symbolic constants:
2669 * - type_tag The symbolic constant represents a type tag. The type the
2670 * tag stands for is given explicitly.
2671 * - size The symbolic constant represents the size of a type. The
2672 * type of which the constant represents the size is given
2674 * - addr_name The symbolic constant represents the address of an entity
2675 * (variable or method). The variable is indicated by a name
2676 * that is valid for linking.
2677 * - addr_ent The symbolic constant represents the address of an entity
2678 * (variable or method). The variable is given explicitly by
2681 * Inputs to the node:
2682 * No inputs except the block it belongs to.
2683 * Outputs of the node.
2684 * An unsigned integer (I_u) or a pointer (P).
2686 * @param *db A pointer for debug information.
2687 * @param value A type, entity or ident depending on the SymConst kind.
2688 * @param symkind The kind of the symbolic constant: symconst_type_tag, symconst_size
2689 * or symconst_addr_name.
2690 * @param tp The source type of the constant.
2693 ir_node *new_d_SymConst_type (dbg_info* db, union symconst_symbol value, symconst_kind kind, type* tp);
2695 /** Constructor for a SymConst node.
2697 * Same as new_d_SymConst_type, except that it sets the type to type_unknown. */
2698 ir_node *new_d_SymConst (dbg_info* db, union symconst_symbol value, symconst_kind kind);
2700 /** Constructor for a simpleSel node.
2702 * This is a shortcut for the new_d_Sel() constructor. To be used for
2703 * Sel nodes that do not select from an array, i.e., have no index
2704 * inputs. It adds the two parameters 0, NULL.
2706 * @param *db A pointer for debug information.
2707 * @param *store The memory in which the object the entity should be
2708 * selected from is allocated.
2709 * @param *objptr The object from that the Sel operation selects a
2710 * single attribute out.
2711 * @param *ent The entity to select.
2714 ir_node *new_d_simpleSel(dbg_info* db, ir_node *store, ir_node *objptr, entity *ent);
2716 /** Constructor for a Sel node.
2718 * The select node selects an entity (field or method) from an entity
2719 * with a compound type. It explicitly specifies the entity selected.
2720 * Dynamically the node may select entities that overwrite the given
2721 * entity. If the selected entity is an array element entity the Sel
2722 * node takes the required array indicees as inputs.
2723 * Adds the node to the block in current_ir_block.
2725 * @param *db A pointer for debug information.
2726 * @param *store The memory in which the object the entity should be selected
2727 * from is allocated.
2728 * @param *objptr A pointer to a compound entity the Sel operation selects a
2729 * single attribute from.
2730 * @param *n_index The number of array indicees needed to select an array element entity.
2731 * @param *index[] If the compound entity is an array the indicees of the selected
2732 * element entity. The constructor copies this array.
2733 * @param *ent The entity to select.
2735 ir_node *new_d_Sel (dbg_info* db, ir_node *store, ir_node *objptr, int arity, ir_node *in[],
2738 /** Constructor for a InstOf node.
2740 * Adds the node to the block in current_ir_block.
2742 * For translating Java. Not supported as standard firm node.
2744 * @param *db A pointer for debug information.
2750 ir_node *new_d_InstOf (dbg_info* db, ir_node *store, ir_node *objptr, type *ent);
2752 /** Constructor for a Call node.
2754 * Represents all kinds of method and function calls.
2755 * Adds the node to the block in current_ir_block.
2757 * @param *db A pointer for debug information.
2758 * @param *store The actual store.
2759 * @param *callee A pointer to the called procedure.
2760 * @param arity The number of procedure parameters.
2761 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2762 * @param *tp Type information of the procedure called.
2766 ir_node *new_d_Call (dbg_info* db, ir_node *store, ir_node *callee, int arity, ir_node *in[],
2769 /** Constructor for a Add node.
2771 * Adds the node to the block in current_ir_block.
2773 * @param *db A pointer for debug information.
2774 * @param *op1 The operand 1.
2775 * @param *op2 The operand 2.
2776 * @param *mode The mode of the operands and the result.
2779 ir_node *new_d_Add (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2781 /** Constructor for a Sub node.
2783 * Adds the node to the block in current_ir_block.
2785 * @param *db A pointer for debug information.
2786 * @param *op1 The operand 1.
2787 * @param *op2 The operand 2.
2788 * @param *mode The mode of the operands and the result.
2792 ir_node *new_d_Sub (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2794 /** Constructor for a Minus node.
2796 * Adds the node to the block in current_ir_block.
2798 * @param *db A pointer for debug information.
2799 * @param *op The operand .
2800 * @param *mode The mode of the operand and the result.
2803 ir_node *new_d_Minus (dbg_info* db, ir_node *op, ir_mode *mode);
2805 /** Constructor for a Mul 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.
2815 ir_node *new_d_Mul (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2817 /** Constructor for a Quot node.
2819 * Adds the node to the block in current_ir_block.
2821 * @param *db A pointer for debug information.
2822 * @param *memop The store needed to model exceptions
2823 * @param *op1 The operand 1.
2824 * @param *op2 The operand 2.
2827 ir_node *new_d_Quot (dbg_info* db, ir_node *memop, ir_node *op1, ir_node *op2);
2829 /** Constructor for a DivMod node.
2831 * Adds the node to the block in current_ir_block.
2833 * @param *db A pointer for debug information.
2834 * @param *memop The store needed to model exceptions
2835 * @param *op1 The operand 1.
2836 * @param *op2 The operand 2.
2839 ir_node *new_d_DivMod (dbg_info* db, ir_node *memop, ir_node *op1, ir_node *op2);
2841 /** Constructor for a Div node.
2843 * Adds the node to the block in current_ir_block.
2845 * @param *db A pointer for debug information.
2846 * @param *memop The store needed to model exceptions
2847 * @param *op1 The operand 1.
2848 * @param *op2 The operand 2.
2851 ir_node *new_d_Div (dbg_info* db, ir_node *memop, ir_node *op1, ir_node *op2);
2853 /** Constructor for a Mod node.
2855 * Adds the node to the block in current_ir_block.
2857 * @param *db A pointer for debug information.
2858 * @param *memop The store needed to model exceptions
2859 * @param *op1 The operand 1.
2860 * @param *op2 The operand 2.
2863 ir_node *new_d_Mod (dbg_info* db, ir_node *memop, ir_node *op1, ir_node *op2);
2865 /** Constructor for a Abs node.
2867 * Adds the node to the block in current_ir_block.
2869 * @param *db A pointer for debug information.
2870 * @param *op The operand
2871 * @param *mode The mode of the operands and the result.
2874 ir_node *new_d_Abs (dbg_info* db, ir_node *op, ir_mode *mode);
2876 /** Constructor for a And node.
2878 * Adds the node to the block in current_ir_block.
2880 * @param *db A pointer for debug information.
2881 * @param *irg The ir graph the node belongs to.
2882 * @param *block The ir block the node belongs to.
2883 * @param *op1 The operand 1.
2884 * @param *op2 The operand 2.
2885 * @param *mode The mode of the operands and the result.
2888 ir_node *new_d_And (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2890 /** Constructor for a Or node.
2892 * Adds the node to the block in current_ir_block.
2894 * @param *db A pointer for debug information.
2895 * @param *op1 The operand 1.
2896 * @param *op2 The operand 2.
2897 * @param *mode The mode of the operands and the result.
2900 ir_node *new_d_Or (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2902 /** Constructor for a Eor node.
2904 * Adds the node to the block in current_ir_block.
2906 * @param *db A pointer for debug information.
2907 * @param *op1 The operand 1.
2908 * @param *op2 The operand 2.
2909 * @param *mode The mode of the operands and the results.
2912 ir_node *new_d_Eor (dbg_info* db, ir_node *op1, ir_node *op2, ir_mode *mode);
2914 /** Constructor for a Not node.
2916 * Adds the node to the block in current_ir_block.
2918 * @param *db A pointer for debug information.
2919 * @param *op The operand.
2920 * @param *mode The mode of the operand and the result.
2923 ir_node *new_d_Not (dbg_info* db, ir_node *op, ir_mode *mode);
2925 /** Constructor for a Shl node.
2927 * Adds the node to the block in current_ir_block.
2929 * @param *db A pointer for debug information.
2930 * @param *op The operand.
2931 * @param *k The number of bits to shift the operand .
2932 * @param *mode The mode of the operand and the result.
2935 ir_node *new_d_Shl (dbg_info* db, ir_node *op, ir_node *k, ir_mode *mode);
2937 /** Constructor for a Shr node.
2939 * Adds the node to the block in current_ir_block.
2941 * @param *db A pointer for debug information.
2942 * @param *op The operand.
2943 * @param *k The number of bits to shift the operand .
2944 * @param *mode The mode of the operand and the result.
2947 ir_node *new_d_Shr (dbg_info* db, ir_node *op, ir_node *k, ir_mode *mode);
2949 /** Constructor for a Shrs node.
2951 * Adds the node to the block in current_ir_block.
2953 * @param *db A pointer for debug information.
2954 * @param *op The operand.
2955 * @param *k The number of bits to shift the operand .
2956 * @param *mode The mode of the operand and the result.
2959 ir_node *new_d_Shrs (dbg_info* db, ir_node *op, ir_node *k, ir_mode *mode);
2961 /** Constructor for a Rot node.
2963 * Adds the node to the block in current_ir_block.
2965 * @param *db A pointer for debug information.
2966 * @param *op The operand.
2967 * @param *k The number of bits to rotate the operand.
2968 * @param *mode The mode of the operand.
2971 ir_node *new_d_Rot (dbg_info* db, ir_node *op, ir_node *k, ir_mode *mode);
2973 /** Constructor for a Cmp node.
2975 * Adds the node to the block in current_ir_block.
2977 * @param *db A pointer for debug information.
2978 * @param *op1 The operand 1.
2979 * @param *op2 The operand 2.
2982 ir_node *new_d_Cmp (dbg_info* db, ir_node *op1, ir_node *op2);
2984 /** Constructor for a Conv node.
2986 * Adds the node to the block in current_ir_block.
2988 * @param *db A pointer for debug information.
2989 * @param *op The operand.
2990 * @param *mode The mode of this the operand muss be converted .
2993 ir_node *new_d_Conv (dbg_info* db, ir_node *op, ir_mode *mode);
2995 /**Constructor for a Cast node.
2997 * High level type cast
2998 * Adds the node to the block in current_ir_block.
3000 * @param *db A pointer for debug information.
3001 * @param *op The operand.
3002 * @param *to_tp The type of this the operand muss be casted .
3005 ir_node *new_d_Cast (dbg_info* db, ir_node *op, type *to_tp);
3007 /**Constructor for a Phi node.
3009 * Adds the node to the block in current_ir_block.
3011 * @param *db A pointer for debugginaromation.
3012 * @param arity The number of predecessors
3013 * @param *in Array with predecessors
3014 * @param *mode The mode of it's inputs and output.
3017 ir_node *new_d_Phi (dbg_info* db, int arity, ir_node *in[], ir_mode *mode);
3019 /** Constructor for a Load node.
3021 * Adds the node to the block in current_ir_block.
3023 * @param *db A pointer for debug information.
3024 * @param *store The current memory
3025 * @param *adr A pointer to the variable to be read in this memory.
3028 ir_node *new_d_Load (dbg_info* db, ir_node *store, ir_node *addr);
3030 /** Constructor for a Store node.
3032 * Adds the node to the block in current_ir_block.
3034 * @param *db A pointer for debug information.
3035 * @param *store The current memory
3036 * @param *adr A pointer to the variable to be read in this memory.
3037 * @param *val The value to write to this variable.
3039 ir_node *new_d_Store (dbg_info* db, ir_node *store, ir_node *addr, ir_node *val);
3041 /** Constructor for a Alloc node.
3043 * The Alloc node extends the memory by space for an entity of type alloc_type.
3044 * Adds the node to the block in current_ir_block.
3046 * @param *db A pointer for debug information.
3047 * @param *store The memory which shall contain the new variable.
3048 * @param *size The number of bytes to allocate.
3049 * @param *alloc_type The type of the allocated variable.
3050 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3053 ir_node *new_d_Alloc (dbg_info* db, ir_node *store, ir_node *size, type *alloc_type,
3056 /** Constructor for a Free node.
3058 * Frees the memory occupied by the entity pointed to by the pointer
3059 * arg. Type indicates the type of the entity the argument points to.
3060 * Adds the node to the block in current_ir_block.
3062 * @param *db A pointer for debug information.
3063 * @param *store The memory which shall contain the new variable.
3064 * @param *ptr The pointer to the object to free.
3065 * @param *size The number of objects of type free_type to free in a sequence.
3066 * @param *free_type The type of the freed variable.
3069 ir_node *new_d_Free (dbg_info* db, ir_node *store, ir_node *ptr, ir_node *size,
3072 /** Constructor for a Sync node.
3074 * Merges several memory values. The node assumes that a variable
3075 * either occurs only in one of the memories, or it contains the same
3076 * value in all memories where it occurs.
3077 * Adds the node to the block in current_ir_block.
3079 * @param *db A pointer for debug information.
3080 * @param arity The number of memories to syncronize.
3081 * @param **in An array of pointers to nodes that produce an output of type
3082 * memory. The constructor copies this array.
3085 ir_node *new_d_Sync (dbg_info* db, int arity, ir_node *in[]);
3088 /** Constructor for a Proj node.
3090 * Projects a single value out of a tuple. The parameter proj gives the
3091 * position of the value within the tuple.
3092 * Adds the node to the block in current_ir_block.
3094 * @param *db A pointer for deubugginformation.
3095 * @param arg A node producing a tuple.
3096 * @param *mode The mode of the value to project.
3097 * @param proj The position of the value in the tuple.
3100 ir_node *new_d_Proj (dbg_info* db, ir_node *arg, ir_mode *mode, long proj);
3103 /** Constructor for a defaultProj node.
3105 * Represents the default control flow of a Switch-Cond node.
3106 * Adds the node to the block in current_ir_block.
3108 * @param *db A pointer for debug information.
3109 * @param arg A node producing a tuple.
3110 * @param max_ proj The end position of the value in the tuple.
3113 ir_node *new_d_defaultProj (dbg_info* db, ir_node *arg, long max_proj);
3115 /** Constructor for a Tuple node.
3117 * This is an auxiliary node to replace a node that returns a tuple
3118 * without changing the corresponding Proj nodes.
3119 * Adds the node to the block in current_ir_block.
3121 * @param *db A pointer for debug information.
3122 * @param arity The number of tuple elements.
3123 * @param **in An array containing pointers to the nodes producing the tuple elements.
3126 ir_node *new_d_Tuple (dbg_info* db, int arity, ir_node *in[]);
3129 /** Constructor for a Id node.
3131 * This is an auxiliary node to replace a node that returns a single
3132 * value. Adds the node to the block in current_ir_block.
3134 * @param *db A pointer for debug information.
3135 * @param *val The operand to Id.
3136 * @param *mode The mode of *val.
3139 ir_node *new_d_Id (dbg_info* db, ir_node *val, ir_mode *mode);
3141 /** Costructor for a Bad node.
3143 * Returns the unique Bad node of the graph. The same as
3147 ir_node *new_d_Bad (void);
3149 /** Constructor for a Confirm node.
3151 * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3152 * Specifies constraints for a value. To support dataflow analyses.
3154 * Example: If the value never exceeds '100' this is expressed by placing a
3155 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
3157 * @param *db A pointer for debug information.
3158 * @param *val The value we express a constraint for
3159 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3160 * @param cmp The compare operation.
3163 ir_node *new_d_Confirm (dbg_info* db, ir_node *val, ir_node *bound, pn_Cmp cmp);
3166 /** Constructor for an Unknown node.
3168 * Represents an arbtrary valus. Places the node in
3171 * @param *m The mode of the unknown value.
3174 ir_node *new_d_Unknown(ir_mode *m);
3176 /** Constructor for a CallBegin node.
3178 * CallBegin represents control flow depending of the pointer value
3179 * representing the called method to the called methods. The
3180 * constructor copies the method pointer input from the passed Call
3181 * node.Adds the node to the block in current_ir_block.
3183 * @param *db A pointer for debug information.
3184 * @param *callee The call node bisible in the intra procedural view.
3187 ir_node *new_d_CallBegin(dbg_info *db, ir_node *callee);
3189 /** Constructor for an EndReg node.
3191 *Adds the node to the block in current_ir_block.
3193 * @param *db A pointer for debug information.
3196 ir_node *new_d_EndReg (dbg_info *db);
3198 /** Constructor for an Endexcept node.
3200 * Used to represent regular procedure end in interprocedual view.
3201 * Adds the node to the block in current_ir_block.
3203 * @param *db A pointer for debug information.
3206 ir_node *new_d_EndExcept(dbg_info *db);
3208 /** Constructor for a Break node.
3210 * Used to represent exceptional procedure end in interprocedural view.
3211 * Adds the node to the block in current_ir_block.
3213 * Break represents control flow to a single control successor just as Jmp.
3214 * The blocks separated by a break may not be concatenated by an optimization.
3215 * It is used for the interprocedural representation where blocks are parted
3216 * behind Call nodes to represent the control flow to called procedures.
3218 * @param *db A pointer for debug information.
3221 ir_node *new_d_Break (dbg_info *db);
3223 /** Constructor for a Filter node.
3225 * Constructor for a Filter node. Adds the node to the block in
3226 * current_ir_block. Filter is a node with two views used to
3227 * construct the interprocedural view. In intraprocedural view its
3228 * semantics are identical to the Proj node. In interprocedural view
3229 * the Filter performs the Phi operation on method parameters or
3230 * results. Other than a Phi a Filter node may not be removed if it
3231 * has only a single input.
3233 * The constructor builds the Filter in intraprocedural view.
3235 * @param *db A pointer for debug information.
3236 * @param *arg The tuple value to project from.
3237 * @param *mode The mode of the projected value.
3238 * @param proj The position in the tuple to project from.
3241 ir_node *new_d_Filter (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3244 /** Constructor for a FuncCall node.
3246 * FuncCall is a function Call that has no side effects. Therefore there
3247 * is not memory operand or result. Adds the node to the block in current_ir_block.
3249 * @param *db A pointer for debug information.
3250 * @param *callee A pointer to the called procedure.
3251 * @param arity The number of procedure parameters.
3252 * @param **in An array with the pointers to the parameters.
3253 * The constructor copies this array.
3254 * @param *tp Type information of the procedure called.
3257 ir_node *new_d_FuncCall (dbg_info* db, ir_node *callee, int arity, ir_node *in[],
3260 /*-----------------------------------------------------------------------*/
3261 /* The block oriented interface without debug support */
3262 /*-----------------------------------------------------------------------*/
3264 /* Needed from the interfase with debug support:
3265 void set_cur_block (ir_node *target); */
3267 /** Constructor for a Block node.
3269 * Constructor for a Block node. Adds the block to the graph in
3270 * current_ir_graph. Constructs a Block with a fixed number of
3271 * predecessors. Does set current_block. Can be used with automatic
3272 * Phi node construction.
3274 * @param arity The number of control predecessors.
3275 * @param in An array of control predecessors. The length of
3276 * the array must be 'arity'.
3278 ir_node *new_Block(int arity, ir_node *in[]);
3280 /** Constructor for a Start node.
3282 * Adds the node to the block in current_ir_block.
3285 ir_node *new_Start (void);
3287 /** Constructor for an End node.
3289 * Adds the node to the block in current_ir_block.
3292 ir_node *new_End (void);
3294 /** Constructor for an EndReg node.
3296 * Used to represent regular procedure end in interprocedual view.
3297 * Adds the node to the block in current_ir_block.
3300 ir_node *new_EndReg (void);
3302 /** Constructor for an EndExpcept node.
3304 * Used to represent exceptional procedure end in interprocedural view.
3305 * Adds the node to the block in current_ir_block.
3310 ir_node *new_EndExcept(void);
3314 * Constructor for a Jump node. Adds the node to the block in current_ir_block.
3316 * Jmp represents control flow to a single control successor.
3319 ir_node *new_Jmp (void);
3321 /** Constructor for a Break node.
3322 * Break represents control flow to a single control successor just as Jmp.
3323 * The blocks separated by a break may not be concatenated by an optimization.
3324 * It is used for the interprocedural representation where blocks are parted
3325 * behind Call nodes to represent the control flow to called procedures.
3326 *Adds the node to the block in current_ir_block.
3329 ir_node *new_Break (void);
3331 /** Constructor for a Cond node.
3333 * If c is mode_b represents a conditional branch (if/else). If c is
3334 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
3335 * node, default Proj is 0.). Adds the node to the block in current_ir_block.
3337 * This is not consistent: Input to Cond is Is, Proj has as proj number
3341 * @param *c The conditions parameter.Can be of mode b or I_u.
3344 ir_node *new_Cond (ir_node *c);
3346 /** Constructor for a Return node.
3348 * Returns the memory an zero or more return values. Only node that
3349 * can end regular control flow. Adds the node to the block in current_ir_block.
3351 * @param *store The state of memory.
3352 * @param arity Number of array indexes.
3353 * @param *in Array with index inputs to the node.
3356 ir_node *new_Return (ir_node *store, int arity, ir_node *in[]);
3358 /**Constructor for a Raise node.
3360 * Adds the node to the block in current_ir_block.
3362 * @param *store The current memory.
3363 * @param *obj A pointer to the Except variable.
3366 ir_node *new_Raise (ir_node *store, ir_node *obj);
3368 /** Constructor for a Const node.
3370 * Constructor for a Const node. The constant represents a target
3371 * value. Sets the type information to type_unknown. (No more
3372 * supported: If tv is entity derives a somehow useful type.)
3373 * Adds the node to the block in current_ir_block.
3375 * @param *mode The mode of the operands and redults.
3376 * @param *con Points to an entry in the constant table. This pointer is
3377 * added to the attributes of the node.
3380 ir_node *new_Const (ir_mode *mode, tarval *con);
3382 /** Constructor for a SymConst node.
3384 * Adds the node to the block in current_ir_block.
3385 * This is the constructor for a symbolic constant.
3386 * There are four kinds of symbolic constants:
3387 * - type_tag The symbolic constant represents a type tag. The type the
3388 * tag stands for is given explicitly.
3389 * - size The symbolic constant represents the size of a type. The
3390 * type of which the constant represents the size is given
3392 * - addr_name The symbolic constant represents the address of an entity
3393 * (variable or method). The variable is indicated by a name
3394 * that is valid for linking.
3395 * - addr_ent The symbolic constant represents the address of an entity
3396 * (variable or method). The variable is given explicitly by
3399 * Inputs to the node:
3400 * No inputs except the block it belongs to.
3401 * Outputs of the node.
3402 * An unsigned integer (I_u) or a pointer (P).
3404 * @param value A type or a ident depending on the SymConst kind.
3405 * @param symkind The kind of the symbolic constant: symconst_type_tag, symconst_size or symconst_addr_name.
3408 ir_node *new_SymConst (union symconst_symbol value, symconst_kind kind);
3410 /** Constructor for a simpelSel node.
3412 * This is a shortcut for the new_Sel() constructor. To be used for
3413 * Sel nodes that do not select from an array, i.e., have no index
3414 * inputs. It adds the two parameters 0, NULL.
3416 * @param *store The memory in which the object the entity should be selected from is allocated.
3417 * @param *objptr The object from that the Sel operation selects a single attribute out.
3418 * @param *ent The entity to select.
3421 ir_node *new_simpleSel(ir_node *store, ir_node *objptr, entity *ent);
3423 /** Constructor for a Sel node.
3425 * The select node selects an entity (field or method) from an entity
3426 * with a compound type. It explicitly specifies the entity selected.
3427 * Dynamically the node may select entities that overwrite the given
3428 * entity. If the selected entity is an array element entity the Sel
3429 * node takes the required array indicees as inputs.
3430 * Adds the node to the block in current_ir_block.
3432 * @param *store The memory in which the object the entity should be selected
3433 * from is allocated.
3434 * @param *objptr A pointer to a compound entity the Sel operation selects a
3435 * single attribute from.
3436 * @param *n_index The number of array indicees needed to select an array element entity.
3437 * @param *index[] If the compound entity is an array the indicees of the selected
3438 * element entity. The constructor copies this array.
3439 * @param *ent The entity to select.
3441 ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3444 /** Constructor for an InstOf node.
3446 * Adds the node to the block in current_ir_block.
3447 * For translating Java. Not supported as standard firm node.
3454 ir_node *new_InstOf (ir_node *store, ir_node *obj, type *ent);
3456 /** Constructor for a Call node.
3458 * Adds the node to the block in current_ir_block.
3459 * Represents all kinds of method and function calls.
3461 * @param *store The actual store.
3462 * @param *callee A pointer to the called procedure.
3463 * @param arity The number of procedure parameters.
3464 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3465 * @param *tp Type information of the procedure called.
3468 ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node *in[],
3471 /** Constructor for a CallBegin node.
3473 * Adds the node to the block in current_ir_block.
3475 * @param *callee A pointer to the called procedure.
3478 ir_node *new_CallBegin(ir_node *callee);
3480 /**Constructor for a Add node.
3482 * CallBegin represents control flow depending of the pointer value
3483 * representing the called method to the called methods. The
3484 * constructor copies the method pointer input from the passed Call
3485 * node.Adds the node to the block in current_ir_block.
3487 * @param *op1 The operand 1.
3488 * @param *op2 The operand 2.
3489 * @param *mode The mode of the operands and the result.
3492 ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
3494 /** Constructor for a Sub node.
3496 * Adds the node to the block in current_ir_block.
3498 * @param *op1 The operand 1.
3499 * @param *op2 The operand 2.
3500 * @param *mode The mode of the operands and the result.
3503 ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
3505 /** Constructor for a Minus node.
3507 * Adds the node to the block in current_ir_block.
3509 * @param *op The operand .
3510 * @param *mode The mode of the operand and the result.
3513 ir_node *new_Minus (ir_node *op, ir_mode *mode);
3516 * Constructor for a Mul node. Adds the node to the block in current_ir_block.
3518 * @param *op1 The operand 1.
3519 * @param *op2 The operand 2.
3520 * @param *mode The mode of the operands and the result.
3523 ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
3525 /** Constructor for a Quot node.
3527 * Adds the node to the block in current_ir_block.
3529 * @param *memop The store needed to model exceptions
3530 * @param *op1 The operand 1.
3531 * @param *op2 The operand 2.
3534 ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2);
3536 /** Constructor for a DivMod node.
3538 * Adds the node to the block in current_ir_block.
3540 * @param *memop The store needed to model exceptions
3541 * @param *op1 The operand 1.
3542 * @param *op2 The operand 2.
3545 ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
3547 /** Constructor for a Div node.
3549 * Adds the node to the block in current_ir_block.
3551 * @param *memop The store needed to model exceptions
3552 * @param *op1 The operand 1.
3553 * @param *op2 The operand 2.
3556 ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2);
3558 /** Constructor for a Mod node.
3560 * Adds the node to the block in current_ir_block.
3562 * @param *memop The store needed to model exceptions
3563 * @param *op1 The operand 1.
3564 * @param *op2 The operand 2.
3567 ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2);
3569 /** Constructor for a Abs node.
3571 * Adds the node to the block in current_ir_block.
3573 * @param *op The operand
3574 * @param *mode The mode of the operands and the result.
3577 ir_node *new_Abs (ir_node *op, ir_mode *mode);
3579 /** Constructor for a And node.
3581 * Adds the node to the block in current_ir_block.
3583 * @param *op1 The operand 1.
3584 * @param *op2 The operand 2.
3585 * @param *mode The mode of the operands and the result.
3588 ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
3591 * Constructor for a Or node. Adds the node to the block in current_ir_block.
3593 * @param *op1 The operand 1.
3594 * @param *op2 The operand 2.
3595 * @param *mode The mode of the operands and the result.
3598 ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
3601 * Constructor for a Eor node. Adds the node to the block in current_ir_block.
3603 * @param *op1 The operand 1.
3604 * @param *op2 The operand 2.
3605 * @param *mode The mode of the operands and the results.
3608 ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
3610 /** Constructor for a Not node.
3612 * Adds the node to the block in current_ir_block.
3614 * @param *op The operand.
3615 * @param *mode The mode of the operand and the result.
3618 ir_node *new_Not (ir_node *op, ir_mode *mode);
3620 /** Constructor for a Shl node.
3622 * Adds the node to the block in current_ir_block.
3624 * @param *op The operand.
3625 * @param *k The number of bits to shift the operand .
3626 * @param *mode The mode of the operand and the result.
3629 ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
3632 * Constructor for a Shr node. Adds the node to the block in current_ir_block.
3634 * @param *op The operand.
3635 * @param *k The number of bits to shift the operand .
3636 * @param *mode The mode of the operand and the result.
3639 ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
3641 /** Constructor for a Shrs node.
3643 * Adds the node to the block in current_ir_block.
3645 * @param *op The operand.
3646 * @param *k The number of bits to shift the operand .
3647 * @param *mode The mode of the operand and the result.
3650 ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
3652 /** Constructor for a Rot node.
3654 * Adds the node to the block in current_ir_block.
3656 * @param *op The operand.
3657 * @param *k The number of bits to rotate the operand.
3658 * @param *mode The mode of the operand.
3661 ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode);
3663 /** Constructor for a Cmp node.
3665 * Adds the node to the block in current_ir_block.
3667 * @param *op1 The operand 1.
3668 * @param *op2 The operand 2.
3671 ir_node *new_Cmp (ir_node *op1, ir_node *op2);
3673 /** Constructor for a Conv node.
3675 * Adds the node to the block in current_ir_block.
3677 * @param *op The operand.
3678 * @param *mode The mode of this the operand muss be converted .
3681 ir_node *new_Conv (ir_node *op, ir_mode *mode);
3683 /**Constructor for a Cast node.
3685 * Adds the node to the block in current_ir_block.
3686 * High level type cast
3688 * @param *op The operand.
3689 * @param *to_tp The type of this the operand muss be casted .
3692 ir_node *new_Cast (ir_node *op, type *to_tp);
3694 /** Constructor for a Phi node.
3696 * Adds the node to the block in current_ir_block.
3698 * @param arity The number of predecessors
3699 * @param *in Array with predecessors
3700 * @param *mode The mode of it's inputs and output.
3703 ir_node *new_Phi (int arity, ir_node *in[], ir_mode *mode);
3705 /** Constructor for a Load node.
3707 * @param *store The current memory
3708 * @param *addr A pointer to the variable to be read in this memory.
3711 ir_node *new_Load (ir_node *store, ir_node *addr);
3713 /** Constructor for a Store node.
3715 * @param *store The current memory
3716 * @param *addr A pointer to the variable to be read in this memory.
3717 * @param *val The value to write to this variable.
3719 ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
3721 /**Constructor for a Alloc node.
3723 * The Alloc node extends the memory by space for an entity of type alloc_type.
3724 * Adds the node to the block in current_ir_block.
3726 * @param *store The memory which shall contain the new variable.
3727 * @param *size The number of bytes to allocate.
3728 * @param *alloc_type The type of the allocated variable.
3729 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3732 ir_node *new_Alloc (ir_node *store, ir_node *size, type *alloc_type,
3736 /**Constructor for a Free node.
3738 * Frees the memory occupied by the entity pointed to by the pointer
3739 * arg. Type indicates the type of the entity the argument points to.
3740 * Adds the node to the block in current_ir_block.
3742 * @param *store The memory which shall contain the new variable.
3743 * @param *ptr The pointer to the object to free.
3744 * @param *size The number of objects of type free_type to free in a sequence.
3745 * @param *free_type The type of the freed variable.
3748 ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
3751 /** Constructor for a Sync node.
3753 * Merges several memory values. The node assumes that a variable
3754 * either occurs only in one of the memories, or it contains the same
3755 * value in all memories where it occurs.
3756 * Adds the node to the block in current_ir_block.
3758 * @param arity The number of memories to syncronize.
3759 * @param **in An array of pointers to nodes that produce an output of type
3760 * memory. The constructor copies this array.
3763 ir_node *new_Sync (int arity, ir_node *in[]);
3765 /** Constructor for a Proj node.
3767 * Projects a single value out of a tuple. The parameter proj gives the
3768 * position of the value within the tuple.
3769 * Adds the node to the block in current_ir_block.
3771 * @param arg A node producing a tuple.
3772 * @param *mode The mode of the value to project.
3773 * @param proj The position of the value in the tuple.
3776 ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
3778 /** Costructor for a Filter node.
3780 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
3781 * Filter is a node with two views used to construct the interprocedural view.
3782 * In intraprocedural view its semantics are identical to the Proj node.
3783 * In interprocedural view the Filter performs the Phi operation on method
3784 * parameters or results. Other than a Phi a Filter node may not be removed
3785 * if it has only a single input.
3787 * The constructor builds the Filter in intraprocedural view.
3789 * @param *arg The tuple value to project from.
3790 * @param *mode The mode of the projected value.
3791 * @param proj The position in the tuple to project from.
3794 ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj);
3796 /** Constructor for a defaultProj node.
3798 * Represents the default control flow of a Switch-Cond node.
3799 * Adds the node to the block in current_ir_block.
3801 * @param arg A node producing a tuple.
3802 * @param max_ proj The end position of the value in the tuple.
3805 ir_node *new_defaultProj (ir_node *arg, long max_proj);
3807 /** Constructor for a Tuple node.
3809 * This is an auxiliary node to replace a node that returns a tuple
3810 * without changing the corresponding Proj nodes.
3811 * Adds the node to the block in current_ir_block.
3813 * @param arity The number of tuple elements.
3814 * @param **in An array containing pointers to the nodes producing the tuple elements.
3817 ir_node *new_Tuple (int arity, ir_node *in[]);
3819 /** Constructor for an Id node.
3821 * This is an auxiliary node to replace a node that returns a single
3822 * value. Adds the node to the block in current_ir_block.
3824 * @param *val The operand to Id.
3825 * @param *mode The mode of *val.
3828 ir_node *new_Id (ir_node *val, ir_mode *mode);
3830 /** Constructor for a Bad node.
3832 * Returns the unique Bad node of the graph. The same as
3837 ir_node *new_Bad (void);
3839 /** Constructor for a Confirm node.
3841 * Specifies constraints for a value. To support dataflow analyses.
3842 * Adds the node to the block in current_ir_block.
3844 * Example: If the value never exceeds '100' this is expressed by placing a
3845 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
3847 * @param *val The value we express a constraint for
3848 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3849 * @param cmp The compare operation.
3852 ir_node *new_Confirm (ir_node *val, ir_node *bound, pn_Cmp cmp);
3854 /** Constructor for an Unknown node.
3856 * Represents an arbitrary value. Places the node in
3859 * @param *m The mode of the unknown value.
3862 ir_node *new_Unknown(ir_mode *m);
3864 /** Constructor for a FuncCall node.
3866 * FuncCall is a function Call that has no side effects. Therefore there
3867 * is not memory operand or result.Adds the node to the block in current_ir_block.
3869 * @param *callee A pointer to the called procedure.
3870 * @param arity The number of procedure parameters.
3871 * @param **in An array with the pointers to the parameters.
3872 * The constructor copies this array.
3873 * @param *tp Type information of the procedure called.
3876 ir_node *new_FuncCall (ir_node *callee, int arity, ir_node *in[],
3879 /*---------------------------------------------------------------------*/
3880 /* The comfortable interface. */
3881 /* Supports automatic Phi node construction. */
3882 /* All routines of the block oriented interface except new_Block are */
3884 /*---------------------------------------------------------------------*/
3886 /** Create an immature block.
3888 * An immature block has an unknown number of predecessors. Predecessors
3889 * can be added with add_immBlock_pred(). Once all predecessors are
3890 * added the block must be matured.
3892 * Adds the block to the graph in current_ir_graph. Does set
3893 * current_block. Can be used with automatic Phi node construction.
3894 * This constructor can only be used if the graph is in
3897 ir_node *new_d_immBlock (dbg_info* db);
3898 ir_node *new_immBlock (void);
3900 /** Add a control flow edge to an immature block. */
3901 void add_immBlock_pred (ir_node *immblock, ir_node *jmp);
3903 /** Fix the number of predecessors of an immature block. */
3904 void mature_immBlock (ir_node *block);
3905 #define mature_cur_block() mature_immBlock(get_cur_block());
3908 /** Get the current value of a local variable.
3910 * Use this function to obtain the last definition of the local variable
3911 * associated with pos. Pos may not exceed the value passed as n_loc
3912 * to new_ir_graph. This call automatically inserts Phi nodes.
3914 * @param *db A pointer for debug information.
3915 * @param pos The position/id of the local variable.
3916 * @param *mode The mode of the value to get.
3918 ir_node *get_d_value (dbg_info* db, int pos, ir_mode *mode);
3919 ir_node *get_value (int pos, ir_mode *mode);
3921 /** Remark a new definition of a variable.
3923 * Use this function to remember a new definition of the value
3924 * associated with pos. Pos may not exceed the value passed as n_loc
3925 * to new_ir_graph. This call is needed to automatically inserts Phi
3928 * @param pos The position/id of the local variable.
3929 * @param *value The new value written to the local variable.
3931 void set_value (int pos, ir_node *value);
3933 /** Get the current memory state.
3935 * Use this function to obtain the last definition of the memory
3936 * state. This call automatically inserts Phi nodes for the memory
3940 ir_node *get_store (void);
3942 /** Remark a new definition of the memory state.
3944 * Use this function to remember a new definition of the memory state.
3945 * This call is needed to automatically inserts Phi nodes.
3947 * @param *store The new memory state.
3949 void set_store (ir_node *store);
3951 /** keep this node alive even if End is not control-reachable from it
3953 * @param ka The node to keep alive.
3955 void keep_alive (ir_node *ka);
3957 /** Returns the frame type of the current graph */
3958 type *get_cur_frame_type(void);
3961 /* --- initialize and finalize ir construction --- */
3963 /** Puts the graph into state "phase_high" */
3964 void finalize_cons (ir_graph *irg);
3966 /* --- Initialization --- */
3969 * This function is called, whenever a local variable is used before definition
3971 * @parameter mode the mode of the local var
3972 * @pos position choosen be the frontend for this var
3974 * @return a firm node of mode @p mode that initialises the var at position pos
3977 * Do not return NULL
3978 * If this function is not set, FIRM will create a const node with tarval BAD
3980 typedef ir_node *default_initialize_local_variable_func_t(ir_mode *mode, int pos);
3983 # endif /* _IRCONS_H_ */