3 * File name: ir/ir/ircons.h
4 * Purpose: Various irnode constructors. Automatic construction
5 * of SSA representation.
6 * Author: Martin Trapp, Christian Schaefer
7 * Modified by: Goetz Lindenmaier, Boris Boesler
10 * Copyright: (c) 1998-2003 Universität Karlsruhe
11 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
17 -# Handle construction of exceptions more comfortable:
18 Add new constructors that pass the exception region (or better the
19 Phi for the memories, the ex. region can be found from there) as parameter,
20 constructor then adds all Proj nodes and returns the pointer
21 to the Proj node that selects the result of the arithmetic operation.
22 -# Maybe hide the exception region in a global variable, especially if
23 it is always unambiguous.
29 * documentation no more supported since 2001
31 * ir node construction.
33 * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier
35 * This file documents all datatypes and constructors needed to
36 * build a FIRM representation of a procedure. The constructors are
37 * also implemented in this file.
39 * The documentation also gives a short manual how to use the library.
41 * For extensive documentation of FIRM see UKA Techreport 1999-14.
44 * Three kinds of nodes
45 * --------------------
47 * There are three kinds of nodes known to the ir: entities,
50 * + ir_nodes are the actual nodes of the FIRM intermediate representation.
51 * They represent operations on the data of the program and control flow
54 * + entity ==> implemented in entity.h
55 * Refers to a single entity of the compiled program, e.g. a field of a
56 * class or a method. If a method or variable can not be assigned to
57 * a method or class or the like, it is a global object.
59 * + types ==> implemented in type.h
60 * With types type information is represented. There are several type
63 * Implementation of the FIRM operations: ir_node
64 * ----------------------------------------------
66 * Ir_nodes represent operations on the data of the program and control flow
67 * operations. Examples of ir_nodes: Add, Jmp, Cmp
69 * FIRM is a dataflow graph. A dataflow graph is a directed graph,
70 * so that every node has incoming and outgoing edges. A node is
71 * executable if every input at it's incoming edges is available.
72 * Execution of the dataflow graph is started at the Start node which
73 * has no incoming edges and ends when the End node executes, even if
74 * there are still executable or not executed nodes. (Is this true,
75 * or must all executable nodes be executed?) (There are exceptions
76 * to the dataflow paradigma that all inputs have to be available
77 * before a node can execute: Phi, Block. See UKA Techreport
80 * The implementation of FIRM differs from the view as a dataflow
81 * graph. To allow fast traversion of the graph edges are
82 * implemented as C-pointers. Inputs to nodes are not ambiguous, the
83 * results can be used by several other nodes. Each input can be
84 * implemented as a single pointer to a predecessor node, outputs
85 * need to be lists of pointers to successors. Therefore a node
86 * contains pointers to it's predecessor so that the implementation is a
87 * dataflow graph with reversed edges. It has to be traversed bottom
90 * All nodes of the ir have the same basic structure. They are
91 * distinguished by a field containing the opcode.
93 * The fields of an ir_node:
95 * kind A firm_kind tag containing k_ir_node. This is useful for
96 * dynamically checking the type of a node.
98 * *op This ir_op gives the opcode as a tag and a string
99 * and the number of attributes of an ir_node. There is
100 * one statically allocated struct ir_op for each opcode.
102 * *mode The ir_mode of the operation represented by this firm
103 * node. The mode of the operation is the mode of it's
104 * result. A Firm mode is a datatype as known to the target,
105 * not a type of the source language.
107 * visit A flag for traversing the ir.
109 * **in An array with pointers to the node's predecessors.
111 * *link A pointer to an ir_node. With this pointer all Phi nodes
112 * are attached to a Block, i.e., a Block points to it's
113 * first Phi node, this node points to the second Phi node
114 * in the Block and so fourth. Used in mature_immBlock
115 * to find all Phi nodes to be matured. It's also used to
116 * annotate a node with a better, optimized version of it.
118 * attr An attr struct containing the attributes of the nodes. The
119 * attributes depend on the opcode of the node. The number
120 * of these attributes is given in op.
124 * Not yet documented. See irop.h.
128 * Not yet documented. See irmode.h.
130 * GLOBAL VARIABLES -- now also fields of ir_graph.
133 * current_ir_graph Points to the current ir_graph. All constructors for
134 * nodes add nodes to this graph.
136 * ir_visited An int used as flag to traverse the ir_graph.
138 * block_visited An int used as a flag to traverse block nodes in the
141 * Others not yet documented.
145 * CONSTRUCTOR FOR IR_GRAPH --> see irgraph.h
146 * ========================
149 * PROCEDURE TO CONSTRUCT AN IR GRAPH --> see also Firm tutorial
150 * ==================================
152 * This library supplies several interfaces to construct a FIRM graph for
154 * - A "comfortable" interface generating SSA automatically. Automatically
155 * computed predecessors of nodes need not be specified in the constructors.
156 * (new_<Node> constructurs and a set of additional routines.)
157 * - A less comfortable interface where all predecessors except the block
158 * an operation belongs to need to be specified. SSA must be constructed
159 * by hand. (new_<Node> constructors and set_cur_block()). This interface
160 * is called "block oriented". It automatically calles the local optimizations
162 * - An even less comfortable interface where the block needs to be specified
163 * explicitly. This is called the "raw" interface. (new_r_<Node>
164 * constructors). These nodes are not optimized.
166 * To use the functionality of the comfortable interface correctly the Front
167 * End needs to follow certain protocols. This is explained in the following.
168 * To build a correct IR with the other interfaces study the semantics of
169 * the firm node (See tech-reprot UKA 1999-14). For the construction of
170 * types and entities see the documentation in those modules.
172 * First the Frontend needs to decide which variables and values used in
173 * a procedure can be represented by dataflow edges. These are variables
174 * that need not be saved to memory as they cause no side effects visible
175 * out of the procedure. Often these are all compiler generated
176 * variables and simple local variables of the procedure as integers,
177 * reals and pointers. The frontend has to count and number these variables.
179 * First an ir_graph needs to be constructed with new_ir_graph. The
180 * constructor gets the number of local variables. The graph is hold in the
181 * global variable irg.
183 * Now the construction of the procedure can start. Several basic blocks can
184 * be constructed in parallel, but the code within each block needs to
185 * be constructed (almost) in program order.
187 * A global variable holds the current basic block. All (non block) nodes
188 * generated are added to this block. The current block can be set with
189 * set_cur_block(block). If several blocks are constructed in parallel block
190 * switches need to be performed constantly.
192 * To generate a Block node (with the comfortable interface) it's predecessor
193 * control flow nodes need not be known. In case of cyclic control flow these
194 * can not be known when the block is constructed. With add_immBlock_pred(block,
195 * cfnode) predecessors can be added to the block. If all predecessors are
196 * added to the block mature_immBlock(b) needs to be called. Calling mature_immBlock
197 * early improves the efficiency of the Phi node construction algorithm.
198 * But if several blocks are constructed at once, mature_immBlock must only
199 * be called after performing all set_values and set_stores in the block!
200 * (See documentation of new_immBlock constructor.)
202 * The constructors of arithmetic nodes require that their predecessors
203 * are mentioned. Sometimes these are available in the Frontend as the
204 * predecessors have just been generated by the frontend. If they are local
205 * values the predecessors can be obtained from the library with a call to
206 * get_value(local_val_nr). (local_val_nr needs to be administered by
207 * the Frontend.) A call to get_value triggers the generation of Phi nodes.
208 * If an arithmetic operation produces a local value this value needs to be
209 * passed to the library by set_value(node, local_val_nr).
210 * In straight line code these two operations just remember and return the
211 * pointer to nodes producing the value. If the value passes block boundaries
212 * Phi nodes can be inserted.
213 * Similar routines exist to manage the Memory operands: set_store and
216 * Several nodes produce more than one result. An example is the Div node.
217 * Such nodes return tuples of values. From these individual values can be
218 * extracted by proj nodes.
220 * The following example illustrates the construction of a simple basic block
221 * with two predecessors stored in variables cf_pred1 and cf_pred2, containing
224 * and finally jumping to an other block. The variable a got the local_val_nr
225 * 42 by the frontend.
227 * ir_node *this_block, *cf_pred1, *cf_pred2, *a_val, *mem, *div, *res, *cf_op;
229 * this_block = new_immBlock();
230 * add_immBlock_pred(this_block, cf_pred1);
231 * add_immBlock_pred(this_block, cf_pred2);
232 * mature_immBlock(this_block);
233 * a_val = get_value(42, mode_Iu);
235 * div = new_Div(mem, a_val, a_val);
236 * mem = new_Proj(div, mode_M, 0); * for the numbers for Proj see docu *
237 * res = new_Proj(div, mode_Iu, 2);
239 * set_value(res, 42);
242 * For further information look at the documentation of the nodes and
243 * constructors and at the paragraph COPING WITH DATA OBJECTS at the
244 * end of this documentation.
246 * The comfortable interface contains the following routines further explained
249 * ir_node *new_immBlock (void);
250 * ir_node *new_Start (void);
251 * ir_node *new_End (void);
252 * ir_node *new_Jmp (void);
253 * ir_node *new_IJmp (ir_node *tgt);
254 * ir_node *new_Cond (ir_node *c);
255 * ir_node *new_Return (ir_node *store, int arity, ir_node **in);
256 * ir_node *new_Raise (ir_node *store, ir_node *obj);
257 * ir_node *new_Const (ir_mode *mode, tarval *con);
258 * ir_node *new_SymConst (symconst_symbol value, symconst_kind kind);
259 * ir_node *new_simpleSel (ir_node *store, ir_node *objptr, entity *ent);
260 * ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity,
261 * ir_node **in, entity *ent);
262 * ir_node *new_InstOf (ir_node *store, ir_node obj, ir_type *ent);
263 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity,
264 * ir_node **in, type_method *type);
265 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
266 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
267 * ir_node *new_Minus (ir_node *op, ir_mode *mode);
268 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
269 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2);
270 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
271 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2);
272 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2);
273 * ir_node *new_Abs (ir_node *op, ir_mode *mode);
274 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
275 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
276 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
277 * ir_node *new_Not (ir_node *op, ir_mode *mode);
278 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
279 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
280 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
281 * ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode);
282 * ir_node *new_Cmp (ir_node *op1, ir_node *op2);
283 * ir_node *new_Conv (ir_node *op, ir_mode *mode);
284 * ir_node *new_Cast (ir_node *op, ir_type *to_tp);
285 * ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode);
286 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
287 * ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
288 * where_alloc where);
289 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
290 * ir_type *free_type, where_alloc where);
291 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
292 * ir_node *new_NoMem (void);
293 * ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
294 * ir_node *new_CopyB (ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
295 * ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
297 * void add_immBlock_pred (ir_node *block, ir_node *jmp);
298 * void mature_immBlock (ir_node *block);
299 * void set_cur_block (ir_node *target);
300 * ir_node *get_value (int pos, ir_mode *mode);
301 * void set_value (int pos, ir_node *value);
302 * ir_node *get_store (void);
303 * void set_store (ir_node *store);
304 * keep_alive (ir_node ka)
306 * IR_NODES AND CONSTRUCTORS FOR IR_NODES
307 * =======================================
309 * All ir_nodes are defined by a common data structure. They are distinguished
310 * by their opcode and differ in the number of their attributes.
312 * The constructor for the block node sets current_block to itself.
313 * Const nodes are always added to the start block.
314 * All other constructors add the created node to the current_block.
315 * swich_block(block) allows to set the current block to block.
317 * Watch for my inconsistent use of input and predecessor (dataflow view)
318 * and `the node points to' (implementation view).
320 * The following description of the nodes lists four properties them if these
322 * - the parameters to the constructor
323 * - the inputs of the Firm node
324 * - the outputs of the Firm node
325 * - attributes to the node
329 * ir_node *new_immBlock (void)
330 * ----------------------------
332 * Creates a new block. Sets current_block to itself. When a new block is
333 * created it cannot be known how many predecessors this block will have in the
334 * control flow graph. Therefore the list of inputs can not be fixed at
335 * creation. Predecessors can be added with add_immBlock_pred (block, control flow
336 * operation). With every added predecessor the number of inputs to Phi nodes
339 * The block can be completed by mature_immBlock(block) if all predecessors are
340 * known. If several blocks are built at once, mature_immBlock can only be called
341 * after set_value has been called for all values that are life at the end
342 * of the block. This is necessary so that Phi nodes created mature_immBlock
343 * get the right predecessors in case of cyclic dependencies. If all set_values
344 * of this block are called after maturing it and before calling get_value
345 * in some block that is control flow dependent on this block, the construction
348 * Example for faulty ir construction: (draw the graph on a paper and you'll
351 * block_before_loop = new_block();
353 * mature_immBlock(block_before_loop);
354 * before2header = new_Jmp;
356 * loop_header = new_block ();
357 * header2body - new_Jmp();
359 * loop_body = new_block ();
360 * body2header = new_Jmp();
362 * add_immBlock_pred(loop_header, before2header);
363 * add_immBlock_pred(loop_header, body2header);
364 * add_immBlock_pred(loop_body, header2body);
366 * mature_immBlock(loop_header);
367 * mature_immBlock(loop_body);
369 * get_value(loop_body, x); // gets the Phi in loop_header
370 * set_value(loop_header, x); // sets the value the above get_value should
371 * // have returned!!!
373 * Mature_immBlock also fixes the number of inputs to the Phi nodes. Mature_immBlock
374 * should be called as early as possible, as afterwards the generation of Phi
375 * nodes is more efficient.
378 * There is an input for each control flow predecessor of the block.
379 * The input points to an instruction producing an output of type X.
380 * Possible predecessors: Start, Jmp, Cond, Raise or Return or any node
381 * possibly causing an exception. (Often the real predecessors are Projs.)
383 * Mode BB (R), all nodes belonging to this block should consume this output.
384 * As they are strict (except Block and Phi node) it is a necessary condition
385 * that the block node executed before any other node in this block executes.
387 * block.matured Indicates whether the block is mature.
389 * This attribute contains all local values valid in this
390 * block. This is needed to build the Phi nodes and removed
391 * if the graph is complete. This field is used by the
392 * internal construction algorithm and should not be accessed
396 * ir_node *new_Block (int arity, ir_node **in)
397 * --------------------------------------------
399 * Creates a new Block with the given list of predecessors. This block
400 * is mature. As other constructors calls optimization and vrfy for the
401 * block. If one of the predecessors is Unknown (as it has to be filled in
402 * later) optimizations are skipped. This is necessary to
403 * construct Blocks in loops. Leaving Unknown in the Block after finishing
404 * the construction may have strange effects, especially for interprocedural
405 * representation and analysis.
408 * CONTROL FLOW OPERATIONS
409 * -----------------------
411 * In each block there must be exactly one of the control flow
412 * operations Start, End, Jmp, Cond, Return or Raise. The output of a
413 * control flow operation points to the block to be executed next.
415 * ir_node *new_Start (void)
416 * -------------------------
418 * Creates a start node. Not actually needed public. There is only one such
419 * node in each procedure which is automatically created by new_ir_graph.
422 * No inputs except the block it belogns to.
424 * A tuple of 4 (5, 6) distinct values. These are labeled by the following
425 * projection numbers (pn_Start):
426 * * pn_Start_X_initial_exec mode X, points to the first block to be exe * cuted.
427 * * pn_Start_M mode M, the global store
428 * * pn_Start_P_frame_base mode P, a pointer to the base of the proce * dures stack frame.
429 * * pn_Start_P_globals mode P, a pointer to the part of the memory * containing_all_ global things.
430 * * pn_Start_T_args mode T, a tuple containing all arguments of * the procedure.
433 * ir_node *new_End (void)
434 * -----------------------
436 * Creates an end node. Not actually needed public. There is only one such
437 * node in each procedure which is automatically created by new_ir_graph.
440 * No inputs except the block it belongs to.
444 * ir_node *new_Jmp (void)
445 * -----------------------
447 * Creates a Jmp node.
450 * The block the node belongs to
452 * Control flow to the next block.
454 * ir_node *new_IJmp (ir_node *tgt)
455 * -----------------------
457 * Creates an IJmp node.
460 * The node that represents the target jump address
462 * Control flow to an unknown target, must be pinned by
465 * ir_node *new_Cond (ir_node *c)
466 * ------------------------------
468 * Creates a Cond node. There are two versions of this node.
474 * A tuple of two control flows. The first is taken if the input is
475 * false, the second if it is true.
479 * A value of mode I_u. (i)
481 * A tuple of n control flows. If the Cond's input is i, control
482 * flow will procede along output i. If the input is >= n control
483 * flow proceeds along output n.
485 * ir_node *new_Return (ir_node *store, int arity, ir_node **in)
486 * -------------------------------------------------------------
488 * The return node has as inputs the results of the procedure. It
489 * passes the control flow to the end_block.
495 * Control flow to the end block.
497 * ir_node *new_Raise (ir_node *store, ir_node *obj)
498 * -------------------------------------------------
500 * Raises an exception. Unconditional change of control flow. Writes
501 * an explicit Except variable to memory to pass it to the exception
502 * handler. See TechReport 1999-14, chapter Exceptions.
506 * A pointer to the Except variable.
508 * A tuple of control flow and the changed memory state. The control flow
509 * points to the exception handler if it is definied in this procedure,
510 * else it points to the end_block.
515 * ir_node *new_Const (ir_mode *mode, tarval *con)
516 * -----------------------------------------------
518 * Creates a constant in the constant table and adds a Const node
519 * returning this value to the start block.
522 * *mode The mode of the constant.
523 * *con Points to an entry in the constant table.
524 * This pointer is added to the attributes of
525 * the node (self->attr.con)
527 * No inputs except the block it belogns to.
529 * The constant value.
531 * attr.con A tarval* pointer to the proper entry in the constant
534 * ir_node *new_SymConst (union symconst_symbol value, symconst_addr_ent kind)
535 * ---------------------------------------------------------------------------
537 * There are three kinds of symbolic constants:
538 * symconst_type_tag The symbolic constant represents a type tag.
539 * symconst_size The symbolic constant represents the size of a class.
540 * symconst_addr_name Information for the linker, e.g. the name of a global
542 * To represent a pointer to an entity that is represented by an entity
543 * datastructure don't use
544 * new_SymConst((type_or_id*)get_entity_ld_ident(ent), symconst_addr_name);.
545 * Use a real const instead:
546 * new_SymConst(mode_P_mach, tarval_p_from_entity(ent));
547 * This makes the Constant independent of name changes of the entity due to
551 * kind The kind of the symbolic constant: type_tag, size or link_info.
552 * *type_or_id Points to the type the tag stands for or to the type
553 * whose size is represented by the constant or to an ident
554 * representing the linkage info.
557 * No inputs except the block it belogns to.
559 * An unsigned integer (I_u) or a pointer (P).
562 * attr.i.num The symconst_addr_ent, i.e. one of
565 * - symconst_addr_name
566 * If the attr.i.num is symconst_type_tag or symconst_size, the node contains an attribute
567 * attr.i.*type, a pointer to a type_class. The mode of the node is mode_Is.
568 * if it is linkage_ptr_info it contains
569 * attr.i.*ptrinfo, an ident holding information for the linker. The mode
570 * of the node is mode_P_mach.
574 * ir_node *new_simpleSel (ir_node *store, ir_node *frame, entity *sel)
575 * --------------------------------------------------------------------
578 * Selects an entity from a compound type. This entity can be a field or
582 * *store The memory in which the object the entity should be selected
584 * *frame The pointer to the object.
585 * *sel The entity to select.
588 * The memory containing the object.
589 * A pointer to the object.
590 * An unsigned integer.
592 * A pointer to the selected entity.
594 * attr.sel Pointer to the entity
597 * ir_node *new_Sel (ir_node *store, ir_node *frame, int arity, ir_node **in,
598 * --------------------------------------------------------------------------
602 * Selects a field from an array type. The entity has as owner the array, as
603 * type the arrays element type. The indices to access an array element are
607 * *store The memory in which the object the entity should be selected from
609 * *frame The pointer to the object.
610 * *arity number of array indices.
611 * *in array with index inputs to the node.
612 * *sel The entity to select.
615 * The memory containing the object.
616 * A pointer to the object.
617 * As much unsigned integer as there are array expressions.
619 * A pointer to the selected entity.
621 * attr.sel Pointer to the entity
623 * The constructors new_Sel and new_simpleSel generate the same ir nodes.
624 * simpleSel just sets the arity of the index inputs to zero.
627 * ARITHMETIC OPERATIONS
628 * ---------------------
630 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node **in,
631 * ----------------------------------------------------------------------------
635 * Creates a procedure call.
638 * *store The actual store.
639 * *callee A pointer to the called procedure.
640 * arity The number of procedure parameters.
641 * **in An array with the pointers to the parameters.
642 * The constructor copies this array.
643 * *type Type information of the procedure called.
646 * The store, the callee and the parameters.
648 * A tuple containing the eventually changed store and the procedure
651 * attr.call Contains the type information for the procedure.
654 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode)
655 * ------------------------------------------------------------
659 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode)
660 * ------------------------------------------------------------
664 * ir_node *new_Minus (ir_node *op, ir_mode *mode)
665 * -----------------------------------------------
667 * Unary Minus operations on integer and floating point values.
669 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode)
670 * ------------------------------------------------------------
674 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2)
675 * --------------------------------------------------------------
677 * Quot performs exact division of floating point numbers. It's mode
678 * is Tuple, the mode of the result must be annotated to the Proj
679 * that extracts the result of the arithmetic operations.
682 * The store needed to model exceptions and the two operands.
684 * A tuple contaning a memory and a execution for modeling exceptions
685 * and the result of the arithmetic operation.
687 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2)
688 * ----------------------------------------------------------------
690 * Performs Div and Mod on interger values.
693 * A tuple contaning a memory and a execution for modeling exceptions
694 * and the two result of the arithmetic operations.
696 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2)
697 * -------------------------------------------------------------
701 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2)
702 * -------------------------------------------------------------
706 * ir_node *new_Abs (ir_node *op, ir_mode *mode)
707 * ---------------------------------------------
711 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode)
712 * ------------------------------------------------------------
716 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode)
717 * -----------------------------------------------------------
721 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode)
722 * ------------------------------------------------------------
726 * ir_node *new_Not (ir_node *op, ir_mode *mode)
727 * ---------------------------------------------
729 * This node constructs a constant where all bits are set to one
730 * and a Eor of this constant and the operator. This simulates a
733 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode)
734 * ---------------------------------------------------------
738 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode)
739 * ---------------------------------------------------------
741 * Logic shift right, i.e., zero extended.
744 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode)
745 * ----------------------------------------------------------
747 * Arithmetic shift right, i.e., sign extended.
749 * ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode)
750 * ---------------------------------------------------------
752 * Rotates the operand to the (right??) by k bits.
754 * ir_node *new_Conv (ir_node *op, ir_mode *mode)
755 * ---------------------------------------------
757 * Mode conversion. For allowed conversions see UKA Tech Report
760 * ir_node *new_Cmp (ir_node *op1, ir_node *op2)
761 * ---------------------------------------------
764 * The two values to be compared.
766 * A 16-tuple containing the results of the 16 different comparisons.
767 * The following is a list giving the comparisons and a projection
768 * number (pn_Cmp) to use in Proj nodes to extract the proper result.
772 * pn_Cmp_Le less or equal
774 * pn_Cmp_Ge greater of equal
775 * pn_Cmp_Lg less or greater
776 * pn_Cmp_Leg less, equal or greater = ordered
777 * pn_Cmp_Uo unordered
778 * pn_Cmp_Ue unordered or equal
779 * pn_Cmp_Ul unordered or less
780 * pn_Cmp_Ule unordered, less or equal
781 * pn_Cmp_Ug unordered or greater
782 * pn_Cmp_Uge unordered, greater or equal
783 * pn_Cmp_Ne unordered, less or greater = not equal
790 * In general, Phi nodes are automaitcally inserted. In some cases, if
791 * all predecessors of a block are known, an explicit Phi node constructor
792 * is needed. E.g., to construct a FIRM graph for a statement as
793 * a = (b==c) ? 2 : 5;
795 * ir_node *new_Phi (int arity, ir_node **in, ir_mode *mode)
796 * ---------------------------------------------------------
798 * Creates a Phi node. The in's order has to correspond to the order
799 * of in's of current_block. This is not checked by the library!
800 * If one of the predecessors is Unknown (as it has to be filled in
801 * later) optimizations are skipped. This is necessary to
802 * construct Phi nodes in loops. Leaving Unknown in the Phi after finishing
803 * the construction may have strange effects, especially for interprocedural
804 * representation and analysis.
807 * arity number of predecessors
808 * **in array with predecessors
809 * *mode The mode of it's inputs and output.
811 * A Phi node has as many inputs as the block it belongs to.
812 * Each input points to a definition of the same value on a
813 * different path in the control flow.
815 * The definition valid in this block.
817 * ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode)
818 * -----------------------------------------------------------------------------
820 * Creates a Mux node. This node implements the following semantic:
821 * If the sel node (which must be of mode_b) evaluates to true, its value is
822 * ir_true, else ir_false;
825 * OPERATIONS TO MANAGE MEMORY EXPLICITLY
826 * --------------------------------------
828 * ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode)
829 * ----------------------------------------------------------------
831 * The Load operation reads a value from memory.
834 * *store The current memory.
835 * *addr A pointer to the variable to be read in this memory.
836 * *mode The mode of the value to be loaded.
839 * The memory and a pointer to a variable in this memory.
841 * A tuple of the memory, a control flow to be taken in case of
842 * an exception and the loaded value.
844 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val)
845 * ----------------------------------------------------------------
847 * The Store operation writes a value to a variable in memory.
850 * The memory, a pointer to a variable in this memory and the value
851 * to write to this variable.
853 * A tuple of the changed memory and a control flow to be taken in
854 * case of an exception.
856 * ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
857 * -----------------------------------------------------------------------
861 * The Alloc node allocates a new variable. It can be specified whether the
862 * variable should be allocated to the stack or to the heap.
865 * *store The memory which shall contain the new variable.
866 * ** *size The number of bytes to allocate. Old. **
867 * *size We decided that the size easily can be derived from the type.
868 * This field is for allocating arrays, i.e., it gives the multiple
869 * of the size of alloc_type to allocate memory for.
870 * *alloc_type The type of the allocated variable.
871 * where Where to allocate the variable, either heap_alloc or stack_alloc.
874 * A memory and an unsigned integer.
876 * A tuple of the changed memory, a control flow to be taken in
877 * case of an exception and the pointer to the new variable.
879 * a.where Indicates where the variable is allocated.
880 * a.*type A pointer to the class the allocated data object
883 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size, ir_type *free_type,
884 * -----------------------------------------------------------------------------------
888 * The Free node frees memory of the given variable.
891 * *store The memory which shall contain the new variable.
892 * *ptr The pointer to the object to free.
893 * *size The number of objects of type free_type to free in a sequence.
894 * *free_type The type of the freed variable.
895 * where Where the variable was allocated, either heap_alloc or stack_alloc.
898 * A memory, a pointer and an unsigned integer.
900 * The changed memory.
902 * f.*type A pointer to the type information of the freed data object.
906 * ir_node *new_Sync (int arity, ir_node **in)
907 * -------------------------------------------
909 * The Sync operation unifies several partial memory blocks. These blocks
910 * have to be pairwise disjunct or the values in common locations have to
911 * be identical. This operation allows to specify all operations that eventually
912 * need several partial memory blocks as input with a single entrance by
913 * unifying the memories with a preceding Sync operation.
916 * arity The number of memories to synchronize.
917 * **in An array of pointers to nodes that produce an output of
922 * The unified memory.
928 * ir_node *new_Bad (void)
929 * -----------------------
931 * Returns the unique Bad node current_ir_graph->bad.
932 * This node is used to express results of dead code elimination.
934 * ir_node *new_NoMem (void)
935 * -----------------------------------------------------------------------------------
937 * Returns the unique NoMem node current_ir_graph->no_mem.
938 * This node is used as input for operations that need a Memory, but do not
939 * change it like Div by const != 0, analyzed calls etc.
941 * ir_node *new_CopyB (ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type)
942 * -----------------------------------------------------------------------------------
944 * Describes a high level block copy of a compound type form address src to
945 * address dst. Must be lowered to a Call to a runtime memory copy function.
947 * ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
948 * -----------------------------------------------------------------------------------
950 * Describes a high level bounds check. Must be lowered to a Call to a runtime check
953 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj)
954 * ----------------------------------------------------------
956 * Selects one entry of a tuple. This is a hidden `fat edge'.
959 * *arg A node producing a tuple.
960 * *mode The mode of the value to project.
961 * proj The position of the value in the tuple.
967 * ir_node *new_Tuple (int arity, ir_node **in)
968 * --------------------------------------------
970 * Builds a Tuple from single values. This is needed to implement
971 * optimizations that remove a node that produced a tuple. The node can be
972 * replaced by the Tuple operation so that the following Proj nodes have not to
973 * be changed. (They are hard to find due to the implementation with pointers
974 * in only one direction.) The Tuple node is smaller than any other
975 * node, so that a node can be changed into a Tuple by just changing it's
976 * opcode and giving it a new in array.
979 * arity The number of tuple elements.
980 * **in An array containing pointers to the nodes producing the
983 * ir_node *new_Id (ir_node *val, ir_mode *mode)
984 * ---------------------------------------------
986 * The single output of the Id operation is it's input. Also needed
990 * COPING WITH DATA OBJECTS
991 * ========================
993 * Two kinds of data objects have to be distinguished for generating
994 * FIRM. First there are local variables other than arrays that are
995 * known to be alias free. Second there are all other data objects.
996 * For the first a common SSA representation is built, the second
997 * are modeled by saving them to memory. The memory is treated as
998 * a single local variable, the alias problem is hidden in the
999 * content of this variable.
1001 * All values known in a Block are listed in the block's attribute,
1002 * block.**graph_arr which is used to automatically insert Phi nodes.
1003 * The following two funcions can be used to add a newly computed value
1004 * to the array, or to get the producer of a value, i.e., the current
1007 * inline void set_value (int pos, ir_node *value)
1008 * -----------------------------------------------
1010 * Has to be called for every assignment to a local variable. It
1011 * adds the value to the array of used values at position pos. Pos
1012 * has to be a unique identifier for an entry in the procedure's
1013 * definition table. It can be used to access the value again.
1014 * Requires current_block to be set correctly.
1016 * ir_node *get_value (int pos, ir_mode *mode)
1017 * -------------------------------------------
1019 * Returns the node defining the value referred to by pos. If the
1020 * value is not defined in this block a Phi node is generated and
1021 * all definitions reaching this Phi node are collected. It can
1022 * happen that the algorithm allocates an unnecessary Phi node,
1023 * e.g. if there is only one definition of this value, but this
1024 * definition reaches the currend block on several different
1025 * paths. This Phi node will be eliminated if optimizations are
1026 * turned on right after it's creation.
1027 * Requires current_block to be set correctly.
1029 * There are two special routines for the global store:
1031 * void set_store (ir_node *store)
1032 * -------------------------------
1034 * Adds the store to the array of known values at a reserved
1036 * Requires current_block to be set correctly.
1038 * ir_node *get_store (void)
1039 * -------------------------
1041 * Returns the node defining the actual store.
1042 * Requires current_block to be set correctly.
1045 * inline void keep_alive (ir_node *ka)
1046 * ------------------------------------
1048 * Keep this node alive because it is (might be) not in the control
1049 * flow from Start to End. Adds the node to the list in the end
1056 #include "firm_common.h"
1058 #include "dbginfo.h"
1060 /*-------------------------------------------------------------------------*/
1061 /* The raw interface */
1062 /*-------------------------------------------------------------------------*/
1064 /** Constructor for a Block node.
1066 * Constructs a mature block with the given predecessors. Use Unknown
1067 * nodes as predecessors to construct a block if the number of
1068 * predecessors is known, but not the predecessors themselves. This
1069 * constructor does not set current_block. It not be used with
1070 * automatic Phi node construction.
1072 * @param *db A Pointer for debug information.
1073 * @param irg The ir graph the block belongs to.
1074 * @param arity The number of control predecessors.
1075 * @param in[] An array of control predecessors. The length of
1076 * the array must be 'arity'. The constructor copies this array.
1078 ir_node *new_rd_Block (dbg_info *db, ir_graph *irg, int arity, ir_node *in[]);
1080 /** Constructor for a Start node.
1082 * @param *db A pointer for debug information.
1083 * @param *irg The ir graph the node belongs to.
1084 * @param *block The ir block the node belongs to.
1086 ir_node *new_rd_Start (dbg_info *db, ir_graph *irg, ir_node *block);
1088 /** Constructor for a End node.
1090 * @param *db A pointer for debug information.
1091 * @param *irg The ir graph the node belongs to.
1092 * @param *block The ir block the node belongs to.
1094 ir_node *new_rd_End (dbg_info *db, ir_graph *irg, ir_node *block);
1096 /** Constructor for a Jmp node.
1098 * Jmp represents control flow to a single control successor.
1100 * @param *db A pointer for debug information.
1101 * @param *irg The ir graph the node belongs to.
1102 * @param *block The ir block the node belongs to.
1104 ir_node *new_rd_Jmp (dbg_info *db, ir_graph *irg, ir_node *block);
1106 /** Constructor for an IJmp node.
1108 * IJmp represents control flow to a single control successor not
1109 * statically known i.e. an indirect Jmp.
1111 * @param *db A pointer for debug information.
1112 * @param *irg The ir graph the node belongs to.
1113 * @param *block The ir block the node belongs to.
1114 * @param *tgt The ir node representing the target address.
1116 ir_node *new_rd_IJmp (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *tgt);
1118 /** Constructor for a Break node.
1120 * Break represents control flow to a single control successor just as Jmp.
1121 * The blocks separated by a break may not be concatenated by an optimization.
1122 * It is used for the interprocedural representation where blocks are parted
1123 * behind Call nodes to represent the control flow to called procedures.
1125 * @param *db A pointer for debug information.
1126 * @param *irg The ir graph the node belong to.
1127 * @param *block The block the node belong to.
1129 ir_node *new_rd_Break (dbg_info *db, ir_graph *irg, ir_node *block);
1131 /** Constructor for a Cond node.
1133 * If c is mode_b represents a conditional branch (if/else). If c is
1134 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
1135 * node, default Proj is 0.)
1137 * This is not consistent: Input to Cond is Is, Proj has as proj number
1140 * @param *db A pointer for debug information.
1141 * @param *irg The ir graph the node belongs to.
1142 * @param *block The ir block the node belongs to.
1143 * @param *c The conditions parameter. Can be of mode b or I_u.
1145 ir_node *new_rd_Cond (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *c);
1147 /** Constructor for a Return node.
1149 * Returns the memory an zero or more return values. Only node that
1150 * can end regular control flow.
1152 * @param *db A pointer for debug information.
1153 * @param *irg The ir graph the node belongs to.
1154 * @param *block The ir block the node belongs to.
1155 * @param *store The state of memory.
1156 * @param arity Number of return values.
1157 * @param *in Array of length arity with return values. The constructor copies this array.
1159 ir_node *new_rd_Return (dbg_info *db, ir_graph *irg, ir_node *block,
1160 ir_node *store, int arity, ir_node *in[]);
1162 /** Constructor for a Raise node.
1164 * @param *db A pointer for debug information.
1165 * @param *irg The ir graph the node belongs to.
1166 * @param *block The ir block the node belongs to.
1167 * @param *store The current memory.
1168 * @param *obj A pointer to the Except variable.
1170 ir_node *new_rd_Raise (dbg_info *db, ir_graph *irg, ir_node *block,
1171 ir_node *store, ir_node *obj);
1173 /** Constructor for a Const_type node.
1175 * The constant represents a target value. This constructor sets high
1176 * level type information for the constant value.
1178 * @param *db A pointer for debug information.
1179 * @param *irg The ir graph the node belongs to.
1180 * @param *block The ir block the node belongs to.
1181 * @param *mode The mode of the operands and results.
1182 * @param *con Points to an entry in the constant table.
1183 * @param *tp The type of the constant.
1185 ir_node *new_rd_Const_type (dbg_info *db, ir_graph *irg, ir_node *block,
1186 ir_mode *mode, tarval *con, ir_type *tp);
1188 /** Constructor for a Const node.
1190 * Constructor for a Const node. The constant represents a target
1191 * value. Sets the type information to type_unknown. (No more
1192 * supported: If tv is entity derives a somehow useful type.)
1194 * @param *db A pointer for debug information.
1195 * @param *irg The ir graph the node belongs to.
1196 * @param *block The ir block the node belongs to.
1197 * @param *mode The mode of the operands and results.
1198 * @param *con Points to an entry in the constant table.
1200 ir_node *new_rd_Const (dbg_info *db, ir_graph *irg, ir_node *block,
1201 ir_mode *mode, tarval *con);
1203 /** Constructor for a SymConst_type node.
1205 * This is the constructor for a symbolic constant.
1206 * There are four kinds of symbolic constants:
1207 * - type_tag The symbolic constant represents a type tag. The type the
1208 * tag stands for is given explicitly.
1209 * - size The symbolic constant represents the size of a type. The
1210 * type of which the constant represents the size is given
1212 * - addr_name The symbolic constant represents the address of an entity
1213 * (variable or method). The variable is indicated by a name
1214 * that is valid for linking.
1215 * - addr_ent The symbolic constant represents the address of an entity
1216 * (variable or method). The variable is given explicitly by
1219 * Inputs to the node:
1220 * No inputs except the block it belongs to.
1221 * Outputs of the node.
1222 * An unsigned integer (I_u) or a pointer (P).
1224 * Mention union in declaration so that the firmjni generator recognizes that
1225 * it can not cast the argument to an int.
1227 * @param *db A pointer for debug information.
1228 * @param *irg The ir graph the node belongs to.
1229 * @param *block The ir block the node belongs to.
1230 * @param symkind The kind of the symbolic constant: type_tag, size, addr_name or addr_ent.
1231 * @param value A type, entity or a ident depending on the SymConst kind.
1232 * @param tp The source type of the constant.
1234 ir_node *new_rd_SymConst_type (dbg_info *db, ir_graph *irg, ir_node *block, union symconst_symbol value,
1235 symconst_kind symkind, ir_type *tp);
1237 /** Constructor for a SymConst node.
1239 * Same as new_rd_SymConst_type, except that it sets the type to type_unknown. */
1240 ir_node *new_rd_SymConst (dbg_info *db, ir_graph *irg, ir_node *block,
1241 union symconst_symbol value, symconst_kind symkind);
1243 /** Constructor for a SymConst addr_ent node.
1245 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1246 * symconst_addr_ent.
1247 * Adds the SymConst to the start block of irg. */
1248 ir_node *new_rd_SymConst_addr_ent (dbg_info *db, ir_graph *irg, entity *symbol, ir_type *tp);
1250 /** Constructor for a SymConst addr_name node.
1252 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1253 * symconst_addr_ent.
1254 * Adds the SymConst to the start block of irg. */
1255 ir_node *new_rd_SymConst_addr_name (dbg_info *db, ir_graph *irg, ident *symbol, ir_type *tp);
1257 /** Constructor for a SymConst type_tag node.
1259 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1260 * symconst_addr_ent.
1261 * Adds the SymConst to the start block of irg. */
1262 ir_node *new_rd_SymConst_type_tag (dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp);
1264 /** Constructor for a SymConst size node.
1266 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1267 * symconst_addr_ent.
1268 * Adds the SymConst to the start block of irg. */
1269 ir_node *new_rd_SymConst_size (dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp);
1271 /** Constructor for a simpleSel node.
1273 * This is a shortcut for the new_rd_Sel() constructor. To be used for
1274 * Sel nodes that do not select from an array, i.e., have no index
1275 * inputs. It adds the two parameters 0, NULL.
1277 * @param *db A pointer for debug information.
1278 * @param *irg The ir graph the node belongs to.
1279 * @param *block The ir block the node belongs to.
1280 * @param *store The memory in which the object the entity should be
1281 * selected from is allocated.
1282 * @param *objptr The object from that the Sel operation selects a
1283 * single attribute out.
1284 * @param *ent The entity to select.
1286 ir_node *new_rd_simpleSel (dbg_info *db, ir_graph *irg, ir_node *block,
1287 ir_node *store, ir_node *objptr, entity *ent);
1289 /** Constructor for a Sel node.
1291 * The select node selects an entity (field or method) from an entity
1292 * with a compound type. It explicitly specifies the entity selected.
1293 * Dynamically the node may select entities that overwrite the given
1294 * entity. If the selected entity is an array element entity the Sel
1295 * node takes the required array indices as inputs.
1297 * @param *db A pointer for debug information.
1298 * @param *irg The ir graph the node belongs to.
1299 * @param *block The ir block the node belongs to.
1300 * @param *store The memory in which the object the entity should be selected
1301 * from is allocated.
1302 * @param *objptr A pointer to a compound entity the Sel operation selects a
1303 * single attribute from.
1304 * @param *n_index The number of array indices needed to select an array element entity.
1305 * @param *index[] If the compound entity is an array the indices of the selected
1306 * element entity. The constructor copies this array.
1307 * @param *ent The entity to select.
1309 ir_node *new_rd_Sel (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1310 ir_node *objptr, int n_index, ir_node *index[], entity *ent);
1312 /** Constructor for a InstOf node.
1314 * For translating Java. Not supported as standard firm node.
1316 * @param *db A pointer for debug information.
1317 * @param *irg The ir graph the node belongs to.
1318 * @param *block The ir block the node belongs to.
1323 ir_node *new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1324 ir_node *objptr, ir_type *ent);
1326 /** Constructor for a Call node.
1328 * Represents all kinds of method and function calls.
1330 * @param *db A pointer for debug information.
1331 * @param *irg The ir graph the node belongs to.
1332 * @param *block The ir block the node belongs to.
1333 * @param *store The current memory state.
1334 * @param *callee A pointer to the called procedure.
1335 * @param arity The number of procedure parameters.
1336 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1337 * @param *tp Type information of the procedure called.
1339 ir_node *new_rd_Call (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1340 ir_node *callee, int arity, ir_node *in[], ir_type *tp);
1342 /** Constructor for a Add node.
1344 * @param *db A pointer for debug information.
1345 * @param *irg The ir graph the node belongs to.
1346 * @param *block The ir block the node belongs to.
1347 * @param *op1 The first operand.
1348 * @param *op2 The second operand.
1349 * @param *mode The mode of the operands and the result.
1351 ir_node *new_rd_Add (dbg_info *db, ir_graph *irg, ir_node *block,
1352 ir_node *op1, ir_node *op2, ir_mode *mode);
1354 /** Constructor for a Sub node.
1356 * @param *db A pointer for debug information.
1357 * @param *irg The ir graph the node belongs to.
1358 * @param *block The ir block the node belongs to.
1359 * @param *op1 The first operand.
1360 * @param *op2 The second operand.
1361 * @param *mode The mode of the operands and the result.
1363 ir_node *new_rd_Sub (dbg_info *db, ir_graph *irg, ir_node *block,
1364 ir_node *op1, ir_node *op2, ir_mode *mode);
1366 /** Constructor for a Minus node.
1368 * @param *db A pointer for debug information.
1369 * @param *irg The ir graph the node belongs to.
1370 * @param *block The ir block the node belongs to.
1371 * @param *op The operand .
1372 * @param *mode The mode of the operand and the result.
1374 ir_node *new_rd_Minus (dbg_info *db, ir_graph *irg, ir_node *block,
1375 ir_node *op, ir_mode *mode);
1377 /** Constructor for a Mul node.
1379 * @param *db A pointer for debug information.
1380 * @param *irg The ir graph the node belongs to.
1381 * @param *block The ir block the node belongs to.
1382 * @param *op1 The first operand.
1383 * @param *op2 The second operand.
1384 * @param *mode The mode of the operands and the result.
1386 ir_node *new_rd_Mul (dbg_info *db, ir_graph *irg, ir_node *block,
1387 ir_node *op1, ir_node *op2, ir_mode *mode);
1389 /** Constructor for a Quot node.
1391 * @param *db A pointer for debug information.
1392 * @param *irg The ir graph the node belongs to.
1393 * @param *block The ir block the node belongs to.
1394 * @param *memop The store needed to model exceptions
1395 * @param *op1 The first operand.
1396 * @param *op2 The second operand.
1398 ir_node *new_rd_Quot (dbg_info *db, ir_graph *irg, ir_node *block,
1399 ir_node *memop, ir_node *op1, ir_node *op2);
1401 /** Constructor for a DivMod node.
1403 * @param *db A pointer for debug information.
1404 * @param *irg The ir graph the node belongs to.
1405 * @param *block The ir block the node belongs to.
1406 * @param *memop The store needed to model exceptions
1407 * @param *op1 The first operand.
1408 * @param *op2 The second operand.
1410 ir_node *new_rd_DivMod (dbg_info *db, ir_graph *irg, ir_node *block,
1411 ir_node *memop, ir_node *op1, ir_node *op2);
1413 /** Constructor for a Div node.
1415 * @param *db A pointer for debug information.
1416 * @param *irg The ir graph the node belongs to.
1417 * @param *block The ir block the node belongs to.
1418 * @param *memop The store needed to model exceptions
1419 * @param *op1 The first operand.
1420 * @param *op2 The second operand.
1422 ir_node *new_rd_Div (dbg_info *db, ir_graph *irg, ir_node *block,
1423 ir_node *memop, ir_node *op1, ir_node *op2);
1425 /** Constructor for a Mod node.
1427 * @param *db A pointer for debug information.
1428 * @param *irg The ir graph the node belongs to.
1429 * @param *block The ir block the node belongs to.
1430 * @param *memop The store needed to model exceptions
1431 * @param *op1 The first operand.
1432 * @param *op2 The second operand.
1434 ir_node *new_rd_Mod (dbg_info *db, ir_graph *irg, ir_node *block,
1435 ir_node *memop, ir_node *op1, ir_node *op2);
1437 /** Constructor for a Abs node.
1439 * @param *db A pointer for debug information.
1440 * @param *irg The ir graph the node belongs to.
1441 * @param *block The ir block the node belongs to.
1442 * @param *op The operand
1443 * @param *mode The mode of the operands and the result.
1445 ir_node *new_rd_Abs (dbg_info *db, ir_graph *irg, ir_node *block,
1446 ir_node *op, ir_mode *mode);
1448 /** Constructor for a And node.
1450 * @param *db A pointer for debug information.
1451 * @param *irg The ir graph the node belongs to.
1452 * @param *block The ir block the node belongs to.
1453 * @param *op1 The first operand.
1454 * @param *op2 The second operand.
1455 * @param *mode The mode of the operands and the result.
1457 ir_node *new_rd_And (dbg_info *db, ir_graph *irg, ir_node *block,
1458 ir_node *op1, ir_node *op2, ir_mode *mode);
1460 /** Constructor for a Or node.
1462 * @param *db A pointer for debug information.
1463 * @param *irg The ir graph the node belongs to.
1464 * @param *block The ir block the node belongs to.
1465 * @param *op1 The first operand.
1466 * @param *op2 The second operand.
1467 * @param *mode The mode of the operands and the result.
1469 ir_node *new_rd_Or (dbg_info *db, ir_graph *irg, ir_node *block,
1470 ir_node *op1, ir_node *op2, ir_mode *mode);
1472 /** Constructor for a Eor node.
1474 * @param *db A pointer for debug information.
1475 * @param *irg The ir graph the node belongs to.
1476 * @param *block The ir block the node belongs to.
1477 * @param *op1 The first operand.
1478 * @param *op2 The second operand.
1479 * @param *mode The mode of the operands and the results.
1481 ir_node *new_rd_Eor (dbg_info *db, ir_graph *irg, ir_node *block,
1482 ir_node *op1, ir_node *op2, ir_mode *mode);
1484 /** Constructor for a Not node.
1486 * @param *db A pointer for debug information.
1487 * @param *irg The ir graph the node belongs to.
1488 * @param *block The ir block the node belongs to.
1489 * @param *op The operand.
1490 * @param *mode The mode of the operand and the result.
1492 ir_node *new_rd_Not (dbg_info *db, ir_graph *irg, ir_node *block,
1493 ir_node *op, ir_mode *mode);
1495 /** Constructor for a Cmp node.
1497 * @param *db A pointer for debug information.
1498 * @param *irg The ir graph the node belongs to.
1499 * @param *block The ir block the node belongs to.
1500 * @param *op1 The first operand.
1501 * @param *op2 The second operand.
1503 ir_node *new_rd_Cmp (dbg_info *db, ir_graph *irg, ir_node *block,
1504 ir_node *op1, ir_node *op2);
1506 /** Constructor for a Shl node.
1508 * @param *db A pointer for debug information.
1509 * @param *irg The ir graph the node belongs to.
1510 * @param *block The ir block the node belongs to.
1511 * @param *op The operand.
1512 * @param *k The number of bits to shift the operand .
1513 * @param *mode The mode of the operand and the result.
1515 ir_node *new_rd_Shl (dbg_info *db, ir_graph *irg, ir_node *block,
1516 ir_node *op, ir_node *k, ir_mode *mode);
1518 /** Constructor for a Shr node.
1520 * @param *db A pointer for debug information.
1521 * @param *irg The ir graph the node belongs to.
1522 * @param *block The ir block the node belongs to.
1523 * @param *op The operand.
1524 * @param *k The number of bits to shift the operand .
1525 * @param *mode The mode of the operand and the result.
1527 ir_node *new_rd_Shr (dbg_info *db, ir_graph *irg, ir_node *block,
1528 ir_node *op, ir_node *k, ir_mode *mode);
1530 /** Constructor for a Shrs node.
1532 * @param *db A pointer for debug information.
1533 * @param *irg The ir graph the node belongs to.
1534 * @param *block The ir block the node belongs to.
1535 * @param *op The operand.
1536 * @param *k The number of bits to shift the operand.
1537 * @param *mode The mode of the operand and the result.
1539 ir_node *new_rd_Shrs (dbg_info *db, ir_graph *irg, ir_node *block,
1540 ir_node *op, ir_node *k, ir_mode *mode);
1542 /** Constructor for a Rot node.
1544 * @param *db A pointer for debug information.
1545 * @param *irg The ir graph the node belongs to.
1546 * @param *block The ir block the node belongs to.
1547 * @param *op The operand.
1548 * @param *k The number of bits to rotate the operand.
1549 * @param *mode The mode of the operand.
1551 ir_node *new_rd_Rot (dbg_info *db, ir_graph *irg, ir_node *block,
1552 ir_node *op, ir_node *k, ir_mode *mode);
1555 /** Constructor for a Conv node.
1557 * @param *db A pointer for debug information.
1558 * @param *irg The ir graph the node belongs to.
1559 * @param *block The ir block the node belongs to.
1560 * @param *op The operand.
1561 * @param *mode The mode of this the operand muss be converted .
1563 ir_node *new_rd_Conv (dbg_info *db, ir_graph *irg, ir_node *block,
1564 ir_node *op, ir_mode *mode);
1566 /** Constructor for a Cast node.
1568 * High level type cast.
1570 * @param *db A pointer for debug information.
1571 * @param *irg The ir graph the node belongs to.
1572 * @param *block The ir block the node belongs to.
1573 * @param *op The operand.
1574 * @param *to_tp The type of this the operand muss be casted .
1576 ir_node *new_rd_Cast (dbg_info *db, ir_graph *irg, ir_node *block,
1577 ir_node *op, ir_type *to_tp);
1579 /** Constructor for a Phi node.
1581 * @param *db A pointer for debug information.
1582 * @param *irg The ir graph the node belongs to.
1583 * @param *block The ir block the node belongs to.
1584 * @param arity The number of predecessors
1585 * @param *in[] Array with predecessors. The constructor copies this array.
1586 * @param *mode The mode of it's inputs and output.
1588 ir_node *new_rd_Phi (dbg_info *db, ir_graph *irg, ir_node *block, int arity,
1589 ir_node *in[], ir_mode *mode);
1591 /** Constructor for a Load node.
1593 * @param *db A pointer for debug information.
1594 * @param *irg The ir graph the node belongs to.
1595 * @param *block The ir block the node belongs to.
1596 * @param *store The current memory
1597 * @param *adr A pointer to the variable to be read in this memory.
1598 * @param *mode The mode of the value to be loaded.
1600 ir_node *new_rd_Load (dbg_info *db, ir_graph *irg, ir_node *block,
1601 ir_node *store, ir_node *adr, ir_mode *mode);
1603 /** Constructor for a Store node.
1605 * @param *db A pointer for debug information.
1606 * @param *irg The ir graph the node belongs to.
1607 * @param *block The ir block the node belongs to.
1608 * @param *store The current memory
1609 * @param *adr A pointer to the variable to be read in this memory.
1610 * @param *val The value to write to this variable.
1612 ir_node *new_rd_Store (dbg_info *db, ir_graph *irg, ir_node *block,
1613 ir_node *store, ir_node *adr, ir_node *val);
1615 /** Constructor for a Alloc node.
1617 * The Alloc node extends the memory by space for an entity of type alloc_type.
1619 * @param *db A pointer for debug information.
1620 * @param *irg The ir graph the node belongs to.
1621 * @param *block The ir block the node belongs to.
1622 * @param *store The memory which shall contain the new variable.
1623 * @param *size The number of bytes to allocate.
1624 * @param *alloc_type The type of the allocated variable.
1625 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
1627 ir_node *new_rd_Alloc (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1628 ir_node *size, ir_type *alloc_type, where_alloc where);
1630 /** Constructor for a Free node.
1632 * Frees the memory occupied by the entity pointed to by the pointer
1633 * arg. Type indicates the type of the entity the argument points to.
1635 * @param *db A pointer for debug information.
1636 * @param *irg The ir graph the node belongs to.
1637 * @param *block The ir block the node belongs to.
1638 * @param *store The memory which shall contain the new variable.
1639 * @param *ptr The pointer to the object to free.
1640 * @param *size The number of objects of type free_type to free in a sequence.
1641 * @param *free_type The type of the freed variable.
1642 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
1644 ir_node *new_rd_Free (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1645 ir_node *ptr, ir_node *size, ir_type *free_type, where_alloc where);
1647 /** Constructor for a Sync node.
1649 * Merges several memory values. The node assumes that a variable
1650 * either occurs only in one of the memories, or it contains the same
1651 * value in all memories where it occurs.
1653 * @param *db A pointer for debug information.
1654 * @param *irg The ir graph the node belongs to.
1655 * @param *block The ir block the node belongs to.
1656 * @param arity The number of memories to synchronize.
1657 * @param *in[] An array of pointers to nodes that produce an output of type
1658 * memory. The constructor copies this array.
1660 ir_node *new_rd_Sync (dbg_info *db, ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
1662 /** Constructor for a Proj node.
1664 * Projects a single value out of a tuple. The parameter proj gives the
1665 * position of the value within the tuple.
1667 * @param *db A pointer for debug information.
1668 * @param *irg The ir graph the node belongs to.
1669 * @param *block The ir block the node belongs to.
1670 * @param arg A node producing a tuple. The node must have mode_T.
1671 * @param *mode The mode of the value to project.
1672 * @param proj The position of the value in the tuple.
1674 ir_node *new_rd_Proj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1675 ir_mode *mode, long proj);
1677 /** Constructor for a defaultProj node.
1679 * Represents the default control flow of a Switch-Cond node.
1681 * @param *db A pointer for debug information.
1682 * @param *irg The ir graph the node belongs to.
1683 * @param *block The ir block the node belongs to.
1684 * @param arg A node producing a tuple.
1685 * @param max_proj The end position of the value in the tuple.
1687 ir_node *new_rd_defaultProj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1690 /** Constructor for a Tuple node.
1692 * This is an auxiliary node to replace a node that returns a tuple
1693 * without changing the corresponding Proj nodes.
1695 * @param *db A pointer for debug information.
1696 * @param *irg The ir graph the node belongs to.
1697 * @param *block The ir block the node belongs to.
1698 * @param arity The number of tuple elements.
1699 * @param *in[] An array containing pointers to the nodes producing the tuple
1700 * elements. The constructor copies this array.
1702 ir_node *new_rd_Tuple (dbg_info *db, ir_graph *irg, ir_node *block,
1703 int arity, ir_node *in[]);
1705 /** Constructor for a Id node.
1707 * This is an auxiliary node to replace a node that returns a single
1710 * @param *db A pointer for debug information.
1711 * @param *irg The ir graph the node belongs to.
1712 * @param *block The ir block the node belongs to.
1713 * @param *val The value
1714 * @param *mode The mode of *val.
1716 ir_node *new_rd_Id (dbg_info *db, ir_graph *irg, ir_node *block,
1717 ir_node *val, ir_mode *mode);
1719 /** Constructor for a Bad node.
1721 * Returns the unique Bad node of the graph. The same as
1724 * @param *irg The ir graph the node belongs to.
1726 ir_node *new_rd_Bad (ir_graph *irg);
1728 /** Constructor for a Confirm node.
1730 * Specifies constraints for a value. To support dataflow analyses.
1732 * Example: If the value never exceeds '100' this is expressed by placing a
1733 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
1735 * @param *irg The ir graph the node belong to.
1736 * @param *block The ir block the node belong to.
1737 * @param *db A pointer for debug information.
1738 * @param *val The value we express a constraint for
1739 * @param *bound The value to compare against. Must be a firm node, typically a constant.
1740 * @param cmp The compare operation.
1742 ir_node *new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block,
1743 ir_node *val, ir_node *bound, pn_Cmp cmp);
1745 /** Constructor for an Unknown node.
1747 * Represents an arbitrary value. Places the node in the start block.
1749 * @param *irg The ir graph the node belongs to.
1750 * @param *m The mode of the unknown value.
1752 ir_node *new_rd_Unknown(ir_graph *irg, ir_mode *m);
1754 /** Constructor for a CallBegin node.
1756 * CallBegin represents control flow depending of the pointer value
1757 * representing the called method to the called methods. The
1758 * constructor copies the method pointer input from the passed Call
1761 * @param *db A pointer for debug information.
1762 * @param *irg The ir graph the node belong to.
1763 * @param *block The block the node belong to.
1764 * @param *callee The call node visible in the intra procedural view.
1766 ir_node *new_rd_CallBegin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *callee);
1768 /** Constructor for a EndReg node.
1770 * Used to represent regular procedure end in interprocedual view.
1772 * @param *db A pointer for debug information.
1773 * @param *irg The ir graph the node belong to.
1774 * @param *block The block the node belong to.
1776 ir_node *new_rd_EndReg (dbg_info *db, ir_graph *irg, ir_node *block);
1778 /** Constructor for a EndExcept node.
1780 * Used to represent exceptional procedure end in interprocedural view.
1782 * @param *db A pointer for debug information.
1783 * @param *irg The ir graph the node belong to.
1784 * @param *block The block the node belong to.
1786 ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
1788 /** Constructor for a Filter node.
1790 * Adds the node to the block in current_ir_block. Filter is a node
1791 * with two views used to construct the interprocedural view. In
1792 * intraprocedural view its semantics are identical to the Proj node.
1793 * In interprocedural view the Filter performs the Phi operation on
1794 * method parameters or results. Other than a Phi a Filter node may
1795 * not be removed if it has only a single input.
1797 * The constructor builds the Filter in intraprocedural view.
1799 * @param *db A pointer for debug information.
1800 * @param *irg The ir graph the node belong to.
1801 * @param *block The block the node belong to.
1802 * @param *arg The tuple value to project from.
1803 * @param *mode The mode of the projected value.
1804 * @param proj The position in the tuple to project from.
1806 ir_node *new_rd_Filter (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1807 ir_mode *mode, long proj);
1809 /** Constructor for a NoMem node.
1811 * Returns the unique NoMem node of the graph. The same as
1814 * @param *irg The ir graph the node belongs to.
1816 ir_node *new_rd_NoMem (ir_graph *irg);
1818 /** Constructor for a Mux node.
1820 * @param *db A pointer for debug information.
1821 * @param *irg The ir graph the node belong to.
1822 * @param *block The block the node belong to.
1823 * @param *sel The ir_node that calculates the boolean select.
1824 * @param *ir_true The ir_node that calculates the true result.
1825 * @param *ir_false The ir_node that calculates the false result.
1826 * @param *mode The mode of the node (and it_true and ir_false).
1828 ir_node *new_rd_Mux (dbg_info *db, ir_graph *irg, ir_node *block,
1829 ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
1831 /** Constructor for a CopyB node.
1833 * @param *db A pointer for debug information.
1834 * @param *irg The ir graph the node belong to.
1835 * @param *block The block the node belong to.
1836 * @param *store The current memory
1837 * @param *dst The ir_node that represents the destination address.
1838 * @param *src The ir_node that represents the source address.
1839 * @param *data_type The type of the copied data
1841 ir_node *new_rd_CopyB(dbg_info *db, ir_graph *irg, ir_node *block,
1842 ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
1844 /** Constructor for a Bound node.
1845 * Checks whether lower <= idx && idx < upper.
1847 * @param *db A pointer for debug information.
1848 * @param *irg The ir graph the node belong to.
1849 * @param *block The block the node belong to.
1850 * @param *store The current memory
1851 * @param *idx The ir_node that represents an index.
1852 * @param *lower The ir_node that represents the lower bound for the index.
1853 * @param *upper The ir_node that represents the upper bound for the index.
1855 ir_node *new_rd_Bound(dbg_info *db, ir_graph *irg, ir_node *block,
1856 ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
1858 /*-------------------------------------------------------------------------*/
1859 /* The raw interface without debug support */
1860 /*-------------------------------------------------------------------------*/
1862 /** Constructor for a Block node.
1864 * Constructs a mature block with the given predecessors. Use Unknown
1865 * nodes as predecessors to construct a block if the number of
1866 * predecessors is known, but not the predecessors themselves. This
1867 * constructor does not set current_block. It not be used with
1868 * automatic Phi node construction.
1871 * @param irg The ir graph the block belongs to.
1872 * @param arity The number of control predecessors.
1873 * @param in[] An array of control predecessors. The length of
1874 * the array must be 'arity'. The constructor copies this array.
1876 ir_node *new_r_Block (ir_graph *irg, int arity, ir_node *in[]);
1878 /** Constructor for a Start node.
1880 * @param *irg The ir graph the node belongs to.
1881 * @param *block The ir block the node belongs to.
1883 ir_node *new_r_Start (ir_graph *irg, ir_node *block);
1885 /** Constructor for a End node.
1887 * @param *irg The ir graph the node belongs to.
1888 * @param *block The ir block the node belongs to.
1890 ir_node *new_r_End (ir_graph *irg, ir_node *block);
1892 /** Constructor for a Jmp node.
1894 * Jmp represents control flow to a single control successor.
1896 * @param *irg The ir graph the node belongs to.
1897 * @param *block The ir block the node belongs to.
1899 ir_node *new_r_Jmp (ir_graph *irg, ir_node *block);
1901 /** Constructor for an IJmp node.
1903 * IJmp represents control flow to a single control successor not
1904 * statically known i.e. an indirect Jmp.
1906 * @param *irg The ir graph the node belongs to.
1907 * @param *block The ir block the node belongs to.
1908 * @param *tgt The ir node representing the target address.
1910 ir_node *new_r_IJmp (ir_graph *irg, ir_node *block, ir_node *tgt);
1912 /** Constructor for a Cond node.
1914 * If c is mode_b represents a conditional branch (if/else). If c is
1915 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
1916 * node, default Proj is 0.)
1918 * This is not consistent: Input to Cond is Is, Proj has as proj number
1921 * @param *irg The ir graph the node belongs to.
1922 * @param *block The ir block the node belongs to.
1923 * @param *c The conditions parameter.Can be of mode b or I_u.
1925 ir_node *new_r_Cond (ir_graph *irg, ir_node *block, ir_node *c);
1927 /** Constructor for a Return node.
1929 * Returns the memory an zero or more return values. Only node that
1930 * can end regular control flow.
1932 * @param *irg The ir graph the node belongs to.
1933 * @param *block The ir block the node belongs to.
1934 * @param *store The state of memory.
1935 * @param arity Number of array indices.
1936 * @param *in[] Array with index inputs to the node. The constructor copies this array.
1938 ir_node *new_r_Return (ir_graph *irg, ir_node *block,
1939 ir_node *store, int arity, ir_node *in[]);
1941 /** Constructor for a Raise node.
1943 * @param *irg The ir graph the node belongs to.
1944 * @param *block The ir block the node belongs to.
1945 * @param *store The current memory.
1946 * @param *obj A pointer to the Except variable.
1948 ir_node *new_r_Raise (ir_graph *irg, ir_node *block,
1949 ir_node *store, ir_node *obj);
1951 /** Constructor for a Const node.
1953 * Constructor for a Const node. The constant represents a target
1954 * value. Sets the type information to type_unknown. (No more
1955 * supported: If tv is entity derives a somehow useful type.)
1957 * @param *irg The ir graph the node belongs to.
1958 * @param *block The ir block the node belongs to.
1959 * @param *mode The mode of the operands and the results.
1960 * @param *con Points to an entry in the constant table.
1962 ir_node *new_r_Const (ir_graph *irg, ir_node *block,
1963 ir_mode *mode, tarval *con);
1965 /** Constructor for a Const node.
1967 * Constructor for a Const node. The constant represents a target
1968 * value. Sets the type information to type_unknown. (No more
1969 * supported: If tv is entity derives a somehow useful type.)
1971 * @param *irg The ir graph the node belongs to.
1972 * @param *block The ir block the node belongs to.
1973 * @param *mode The mode of the operands and the results.
1974 * @param value A value from which the tarval is made.
1976 ir_node *new_r_Const_long(ir_graph *irg, ir_node *block,
1977 ir_mode *mode, long value);
1979 /** Constructor for a Const_type node.
1981 * The constant represents a target value. This constructor sets high
1982 * level type information for the constant value.
1984 * @param *irg The ir graph the node belongs to.
1985 * @param *block The ir block the node belongs to.
1986 * @param *mode The mode of the operands and results.
1987 * @param *con Points to an entry in the constant table.
1988 * @param *tp The type of the constant.
1990 ir_node *new_r_Const_type(ir_graph *irg, ir_node *block,
1991 ir_mode *mode, tarval *con, ir_type *tp);
1993 /** Constructor for a SymConst node.
1995 * This is the constructor for a symbolic constant.
1996 * There are four kinds of symbolic constants:
1997 * - type_tag The symbolic constant represents a type tag. The type the
1998 * tag stands for is given explicitly.
1999 * - size The symbolic constant represents the size of a type. The
2000 * type of which the constant represents the size is given
2002 * - addr_name The symbolic constant represents the address of an entity
2003 * (variable or method). The variable is indicated by a name
2004 * that is valid for linking.
2005 * - addr_ent The symbolic constant represents the address of an entity
2006 * (variable or method). The variable is given explicitly by
2009 * Inputs to the node:
2010 * No inputs except the block it belongs to.
2011 * Outputs of the node.
2012 * An unsigned integer (I_u) or a pointer (P).
2014 * @param *irg The ir graph the node belongs to.
2015 * @param *block The ir block the node belongs to.
2016 * @param value A type, entity or a ident depending on the SymConst kind.
2017 * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
2019 ir_node *new_r_SymConst (ir_graph *irg, ir_node *block,
2020 union symconst_symbol value, symconst_kind symkind);
2022 /** Constructor for a Sel node.
2024 * The select node selects an entity (field or method) from an entity
2025 * with a compound type. It explicitly specifies the entity selected.
2026 * Dynamically the node may select entities that overwrite the given
2027 * entity. If the selected entity is an array element entity the Sel
2028 * node takes the required array indices as inputs.
2030 * @param *irg The ir graph the node belongs to.
2031 * @param *block The ir block the node belongs to.
2032 * @param *store The memory in which the object the entity should be selected
2033 * from is allocated.
2034 * @param *objptr A pointer to a compound entity the Sel operation selects a
2035 * single attribute from.
2036 * @param *n_index The number of array indices needed to select an array element entity.
2037 * @param *index[] If the compound entity is an array the indices of the selected
2038 * element entity. The constructor copies this array.
2039 * @param *ent The entity to select.
2041 ir_node *new_r_Sel (ir_graph *irg, ir_node *block, ir_node *store,
2042 ir_node *objptr, int n_index, ir_node *index[],
2045 /** Constructor for a InstOf node.
2047 * For translating Java. Not supported as standard firm node.
2049 * @param *irg The ir graph the node belongs to.
2050 * @param *block The ir block the node belongs to.
2055 ir_node *new_r_InstOf (ir_graph *irg, ir_node *block, ir_node *x, ir_node *y, ir_type *z);
2057 /** Constructor for a Call node.
2059 * Represents all kinds of method and function calls.
2061 * @param *irg The ir graph the node belongs to.
2062 * @param *block The ir block the node belongs to.
2063 * @param *store The actual store.
2064 * @param *callee A pointer to the called procedure.
2065 * @param arity The number of procedure parameters.
2066 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2067 * @param *tp Type information of the procedure called.
2069 ir_node *new_r_Call (ir_graph *irg, ir_node *block, ir_node *store,
2070 ir_node *callee, int arity, ir_node *in[],
2073 /** Constructor for a Add node.
2075 * @param *irg The ir graph the node belongs to.
2076 * @param *block The ir block the node belongs to.
2077 * @param *op1 The first operand.
2078 * @param *op2 The second operand.
2079 * @param *mode The mode of the operands and the result.
2081 ir_node *new_r_Add (ir_graph *irg, ir_node *block,
2082 ir_node *op1, ir_node *op2, ir_mode *mode);
2085 * Constructor for a Sub node.
2087 * @param *irg The ir graph the node belongs to.
2088 * @param *block The ir block the node belongs to.
2089 * @param *op1 The first operand.
2090 * @param *op2 The second operand.
2091 * @param *mode The mode of the operands and the results.
2093 ir_node *new_r_Sub (ir_graph *irg, ir_node *block,
2094 ir_node *op1, ir_node *op2, ir_mode *mode);
2096 /** Constructor for a Minus node.
2098 * @param *irg The ir graph the node belongs to.
2099 * @param *block The ir block the node belongs to.
2100 * @param *op The operand.
2101 * @param *mode The mode of the operand and the result.
2103 ir_node *new_r_Minus (ir_graph *irg, ir_node *block,
2104 ir_node *op, ir_mode *mode);
2105 /** Constructor for a Mul node.
2107 * @param *irg The ir graph the node belongs to.
2108 * @param *block The ir block the node belongs to.
2109 * @param *op1 The first operand.
2110 * @param *op2 The second operand.
2111 * @param *mode The mode of the operands and the result.
2113 ir_node *new_r_Mul (ir_graph *irg, ir_node *block,
2114 ir_node *op1, ir_node *op2, ir_mode *mode);
2116 /** Constructor for a Quot node.
2118 * @param *irg The ir graph the node belongs to.
2119 * @param *block The ir block the node belongs to.
2120 * @param *memop The store needed to model exceptions
2121 * @param *op1 The first operand.
2122 * @param *op2 The second operand.
2124 ir_node *new_r_Quot (ir_graph *irg, ir_node *block,
2125 ir_node *memop, ir_node *op1, ir_node *op2);
2127 /** Constructor for a DivMod node.
2129 * @param *irg The ir graph the node belongs to.
2130 * @param *block The ir block the node belongs to.
2131 * @param *memop The store needed to model exceptions
2132 * @param *op1 The first operand.
2133 * @param *op2 The second operand.
2135 ir_node *new_r_DivMod (ir_graph *irg, ir_node *block,
2136 ir_node *memop, ir_node *op1, ir_node *op2);
2138 /** Constructor for a Div node.
2140 * @param *irg The ir graph the node belongs to.
2141 * @param *block The ir block the node belongs to.
2142 * @param *memop The store needed to model exceptions
2143 * @param *op1 The first operand.
2144 * @param *op2 The second operand.
2146 ir_node *new_r_Div (ir_graph *irg, ir_node *block,
2147 ir_node *memop, ir_node *op1, ir_node *op2);
2149 /** Constructor for a Mod node.
2151 * @param *irg The ir graph the node belongs to.
2152 * @param *block The ir block the node belongs to.
2153 * @param *memop The store needed to model exceptions
2154 * @param *op1 The first operand.
2155 * @param *op2 The second operand.
2157 ir_node *new_r_Mod (ir_graph *irg, ir_node *block,
2158 ir_node *memop, ir_node *op1, ir_node *op2);
2160 /** Constructor for a Abs node.
2162 * @param *irg The ir graph the node belongs to.
2163 * @param *block The ir block the node belongs to.
2164 * @param *op The operand
2165 * @param *mode The mode of the operands and the result.
2167 ir_node *new_r_Abs (ir_graph *irg, ir_node *block,
2168 ir_node *op, ir_mode *mode);
2170 /** Constructor for a And node.
2172 * @param *irg The ir graph the node belongs to.
2173 * @param *block The ir block the node belongs to.
2174 * @param *op1 The first operand.
2175 * @param *op2 The second operand.
2176 * @param *mode The mode of the operands and the result.
2178 ir_node *new_r_And (ir_graph *irg, ir_node *block,
2179 ir_node *op1, ir_node *op2, ir_mode *mode);
2181 /** Constructor for a Or node.
2183 * @param *irg The ir graph the node belongs to.
2184 * @param *block The ir block the node belongs to.
2185 * @param *op1 The first operand.
2186 * @param *op2 The second operand.
2187 * @param *mode The mode of the operands and the result.
2189 ir_node *new_r_Or (ir_graph *irg, ir_node *block,
2190 ir_node *op1, ir_node *op2, ir_mode *mode);
2192 /** Constructor for a Eor node.
2194 * @param *irg The ir graph the node belongs to.
2195 * @param *block The ir block the node belongs to.
2196 * @param *op1 The first operand.
2197 * @param *op2 The second operand.
2198 * @param *mode The mode of the operands and the results.
2200 ir_node *new_r_Eor (ir_graph *irg, ir_node *block,
2201 ir_node *op1, ir_node *op2, ir_mode *mode);
2203 /** Constructor for a Not node.
2205 * @param *irg The ir graph the node belongs to.
2206 * @param *block The ir block the node belongs to.
2207 * @param *op The operand.
2208 * @param *mode The mode of the operand and the result.
2210 ir_node *new_r_Not (ir_graph *irg, ir_node *block,
2211 ir_node *op, ir_mode *mode);
2213 /** Constructor for a Cmp node.
2215 * @param *irg The ir graph the node belongs to.
2216 * @param *block The ir block the node belongs to.
2217 * @param *op1 The first operand.
2218 * @param *op2 The second operand.
2220 ir_node *new_r_Cmp (ir_graph *irg, ir_node *block,
2221 ir_node *op1, ir_node *op2);
2223 /** Constructor for a Shl node.
2225 * @param *irg The ir graph the node belongs to.
2226 * @param *block The ir block the node belongs to.
2227 * @param *op The operand.
2228 * @param *k The number of bits to shift the operand .
2229 * @param *mode The mode of the operand and the result.
2231 ir_node *new_r_Shl (ir_graph *irg, ir_node *block,
2232 ir_node *op, ir_node *k, ir_mode *mode);
2234 /** Constructor for a Shr node.
2236 * @param *irg The ir graph the node belongs to.
2237 * @param *block The ir block the node belongs to.
2238 * @param *op The operand.
2239 * @param *k The number of bits to shift the operand .
2240 * @param *mode The mode of the operand and the result.
2242 ir_node *new_r_Shr (ir_graph *irg, ir_node *block,
2243 ir_node *op, ir_node *k, ir_mode *mode);
2246 * Constructor for a Shrs node.
2248 * @param *irg The ir graph the node belongs to.
2249 * @param *block The ir block the node belongs to.
2250 * @param *op The operand.
2251 * @param *k The number of bits to shift the operand.
2252 * @param *mode The mode of the operand and the result.
2254 ir_node *new_r_Shrs (ir_graph *irg, ir_node *block,
2255 ir_node *op, ir_node *k, ir_mode *mode);
2257 /** Constructor for a Rot node.
2259 * @param *irg The ir graph the node belongs to.
2260 * @param *block The ir block the node belongs to.
2261 * @param *op The operand.
2262 * @param *k The number of bits to rotate the operand.
2263 * @param *mode The mode of the operand.
2265 ir_node *new_r_Rot (ir_graph *irg, ir_node *block,
2266 ir_node *op, ir_node *k, ir_mode *mode);
2268 /** Constructor for a Conv node.
2270 * @param *irg The ir graph the node belongs to.
2271 * @param *block The ir block the node belongs to.
2272 * @param *op The operand.
2273 * @param *mode The mode of this the operand muss be converted .
2275 ir_node *new_r_Conv (ir_graph *irg, ir_node *block,
2276 ir_node *op, ir_mode *mode);
2278 /** Constructor for a Cast node.
2280 * High level type cast
2282 * @param *irg The ir graph the node belongs to.
2283 * @param *block The ir block the node belongs to.
2284 * @param *op The operand.
2285 * @param *to_tp The type of this the operand muss be casted .
2287 ir_node *new_r_Cast (ir_graph *irg, ir_node *block,
2288 ir_node *op, ir_type *to_tp);
2290 /** Constructor for a Phi node.
2292 * @param *irg The ir graph the node belongs to.
2293 * @param *block The ir block the node belongs to.
2294 * @param arity The number of predecessors
2295 * @param *in[] Array with predecessors. The constructor copies this array.
2296 * @param *mode The mode of it's inputs and output.
2298 ir_node *new_r_Phi (ir_graph *irg, ir_node *block, int arity,
2299 ir_node *in[], ir_mode *mode);
2301 /** Constructor for a Load node.
2303 * @param *irg The ir graph the node belongs to.
2304 * @param *block The ir block the node belongs to.
2305 * @param *store The current memory
2306 * @param *adr A pointer to the variable to be read in this memory.
2307 * @param *mode The mode of the value to be loaded.
2309 ir_node *new_r_Load (ir_graph *irg, ir_node *block,
2310 ir_node *store, ir_node *adr, ir_mode *mode);
2312 /** Constructor for a Store node.
2314 * @param *irg The ir graph the node belongs to.
2315 * @param *block The ir block the node belongs to.
2316 * @param *store The current memory
2317 * @param *adr A pointer to the variable to be read in this memory.
2318 * @param *val The value to write to this variable.
2320 ir_node *new_r_Store (ir_graph *irg, ir_node *block,
2321 ir_node *store, ir_node *adr, ir_node *val);
2323 /** Constructor for a Alloc node.
2325 * The Alloc node extends the memory by space for an entity of type alloc_type.
2327 * @param *irg The ir graph the node belongs to.
2328 * @param *block The ir block the node belongs to.
2329 * @param *store The memory which shall contain the new variable.
2330 * @param *size The number of bytes to allocate.
2331 * @param *alloc_type The type of the allocated variable.
2332 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
2334 ir_node *new_r_Alloc (ir_graph *irg, ir_node *block, ir_node *store,
2335 ir_node *size, ir_type *alloc_type, where_alloc where);
2337 /** Constructor for a Free node.
2339 * Frees the memory occupied by the entity pointed to by the pointer
2340 * arg. Type indicates the type of the entity the argument points to.
2342 * @param *irg The ir graph the node belongs to.
2343 * @param *block The ir block the node belongs to.
2344 * @param *store The memory which shall contain the new variable.
2345 * @param *ptr The pointer to the object to free.
2346 * @param *size The number of objects of type free_type to free in a sequence.
2347 * @param *free_type The type of the freed variable.
2348 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
2350 ir_node *new_r_Free (ir_graph *irg, ir_node *block, ir_node *store,
2351 ir_node *ptr, ir_node *size, ir_type *free_type, where_alloc where);
2353 /** Constructor for a Sync node.
2355 * Merges several memory values. The node assumes that a variable
2356 * either occurs only in one of the memories, or it contains the same
2357 * value in all memories where it occurs.
2359 * @param *irg The ir graph the node belongs to.
2360 * @param *block The ir block the node belongs to.
2361 * @param arity The number of memories to synchronize.
2362 * @param *in[] An array of pointers to nodes that produce an output of type memory.
2363 * The constructor copies this array.
2365 ir_node *new_r_Sync (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2367 /** Constructor for a Proj node.
2369 * Projects a single value out of a tuple. The parameter proj gives the
2370 * position of the value within the tuple.
2372 * @param *irg The ir graph the node belongs to.
2373 * @param *block The ir block the node belongs to.
2374 * @param arg A node producing a tuple.
2375 * @param *mode The mode of the value to project.
2376 * @param proj The position of the value in the tuple.
2378 ir_node *new_r_Proj (ir_graph *irg, ir_node *block, ir_node *arg,
2379 ir_mode *mode, long proj);
2381 /** Constructor for a defaultProj node.
2383 * Represents the default control flow of a Switch-Cond node.
2385 * @param *irg The ir graph the node belongs to.
2386 * @param *block The ir block the node belongs to.
2387 * @param arg A node producing a tuple.
2388 * @param max_proj The end position of the value in the tuple.
2390 ir_node *new_r_defaultProj (ir_graph *irg, ir_node *block, ir_node *arg, long max_proj);
2393 /** Constructor for a Tuple node.
2395 * This is an auxiliary node to replace a node that returns a tuple
2396 * without changing the corresponding Proj nodes.
2398 * @param *irg The ir graph the node belongs to.
2399 * @param *block The ir block the node belongs to.
2400 * @param arity The number of tuple elements.
2401 * @param *in[] An array containing pointers to the nodes producing the tuple elements.
2402 * The constructor copies this array.
2404 ir_node *new_r_Tuple (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2406 /** Constructor for a Id node.
2408 * This is an auxiliary node to replace a node that returns a single
2411 * @param *irg The ir graph the node belongs to.
2412 * @param *block The ir block the node belongs to.
2413 * @param *val The operand to Id.
2414 * @param *mode The mode of *val.
2416 ir_node *new_r_Id (ir_graph *irg, ir_node *block,
2417 ir_node *val, ir_mode *mode);
2419 /** Constructor for a Bad node.
2421 * Returns the unique Bad node of the graph. The same as
2424 * @param *irg The ir graph the node belongs to.
2428 ir_node *new_r_Bad (ir_graph *irg);
2430 /** Constructor for a Confirm node.
2432 * Specifies constraints for a value. To support dataflow analyses.
2434 * Example: If the value never exceeds '100' this is expressed by placing a
2435 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
2437 * @param *irg The ir graph the node belong to.
2438 * @param *block The ir block the node belong to.
2439 * @param *val The value we express a constraint for
2440 * @param *bound The value to compare against. Must be a firm node, typically a constant.
2441 * @param cmp The compare operation.
2444 ir_node *new_r_Confirm (ir_graph *irg, ir_node *block,
2445 ir_node *val, ir_node *bound, pn_Cmp cmp);
2447 /** Constructor for a Unknown node.
2449 * Represents an arbitrary value. Places the node in
2452 * @param *irg The ir graph the node belongs to.
2453 * @param *m The mode of the unknown value.
2455 ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2457 /** Constructor for a CallBegin node.
2459 * CallBegin represents control flow depending of the pointer value
2460 * representing the called method to the called methods. The
2461 * constructor copies the method pointer input from the passed Call
2464 * @param *irg The ir graph the node belong to.
2465 * @param *block The block the node belong to.
2466 * @param *callee The call node visible in the intra procedural view.
2468 ir_node *new_r_CallBegin(ir_graph *irg, ir_node *block, ir_node *callee);
2470 /** Constructor for a EndReg node.
2472 * Used to represent regular procedure end in interprocedual view.
2474 * @param *irg The ir graph the node belong to.
2475 * @param *block The block the node belong to.
2477 ir_node *new_r_EndReg (ir_graph *irg, ir_node *block);
2479 /** Constructor for a EndExcept node.
2481 * Used to represent exceptional procedure end in interprocedural view.
2483 * @param *irg The ir graph the node belong to.
2484 * @param *block The block the node belong to.
2486 ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
2488 /** Constructor for a Break node.
2490 * Break represents control flow to a single control successor just as Jmp.
2491 * The blocks separated by a break may not be concatenated by an optimization.
2492 * It is used for the interprocedural representation where blocks are parted
2493 * behind Call nodes to represent the control flow to called procedures.
2495 * @param *irg The ir graph the node belong to.
2496 * @param *block The block the node belong to.
2498 ir_node *new_r_Break (ir_graph *irg, ir_node *block);
2500 /** Constructor for a Filter node.
2502 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
2503 * Filter is a node with two views used to construct the interprocedural view.
2504 * In intraprocedural view its semantics are identical to the Proj node.
2505 * In interprocedural view the Filter performs the Phi operation on method
2506 * parameters or results. Other than a Phi a Filter node may not be removed
2507 * if it has only a single input.
2509 * The constructor builds the Filter in intraprocedural view.
2511 * @param *irg The ir graph the node belong to.
2512 * @param *block The block the node belong to.
2513 * @param *arg The tuple value to project from.
2514 * @param *mode The mode of the projected value.
2515 * @param proj The position in the tuple to project from.
2517 ir_node *new_r_Filter (ir_graph *irg, ir_node *block, ir_node *arg,
2518 ir_mode *mode, long proj);
2520 /** Constructor for a NoMem node.
2522 * Returns the unique NoMem node of the graph. The same as
2525 * @param *irg The ir graph the node belongs to.
2527 ir_node *new_r_NoMem (ir_graph *irg);
2529 /** Constructor for a Mux node.
2531 * @param *irg The ir graph the node belong to.
2532 * @param *block The block the node belong to.
2533 * @param *sel The ir_node that calculates the boolean select.
2534 * @param *ir_true The ir_node that calculates the true result.
2535 * @param *ir_false The ir_node that calculates the false result.
2536 * @param *mode The mode of the node (and it_true and ir_false).
2538 ir_node *new_r_Mux (ir_graph *irg, ir_node *block,
2539 ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2541 /** Constructor for a CopyB node.
2543 * @param *irg The ir graph the node belong to.
2544 * @param *block The block the node belong to.
2545 * @param *store The current memory
2546 * @param *dst The ir_node that represents the destination address.
2547 * @param *src The ir_node that represents the source address.
2548 * @param *data_type The type of the copied data
2550 ir_node *new_r_CopyB(ir_graph *irg, ir_node *block,
2551 ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
2553 /** Constructor for a Bound node.
2554 * Checks whether lower <= idx && idx < upper.
2556 * @param *irg The ir graph the node belong to.
2557 * @param *block The block the node belong to.
2558 * @param *store The current memory
2559 * @param *idx The ir_node that represents an index.
2560 * @param *lower The ir_node that represents the lower bound for the index.
2561 * @param *upper The ir_node that represents the upper bound for the index.
2563 ir_node *new_r_Bound(ir_graph *irg, ir_node *block,
2564 ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
2566 /*-----------------------------------------------------------------------*/
2567 /* The block oriented interface */
2568 /*-----------------------------------------------------------------------*/
2570 /** Sets the current block in which the following constructors place the
2571 * nodes they construct.
2573 * @param target The new current block.
2575 void set_cur_block (ir_node *target);
2577 /** Returns the current block of the current graph. */
2578 ir_node *get_cur_block(void);
2580 /** Returns the fixed nodes of the current graph. */
2581 #define get_cur_end_block() get_irg_end_block(current_ir_graph)
2582 #define get_cur_end() get_irg_end(current_ir_graph)
2583 #define get_cur_start_block() get_irg_start_block(current_ir_graph)
2584 #define get_cur_start() get_irg_start(current_ir_graph)
2586 /** Constructor for a Block node.
2588 * Adds the block to the graph in current_ir_graph. Constructs a Block
2589 * with a fixed number of predecessors. Does set current_block. Can
2590 * be used with automatic Phi node construction.
2592 * @param *db A Pointer for debug information.
2593 * @param arity The number of control predecessors.
2594 * @param in[] An array of control predecessors. The length of
2595 * the array must be 'arity'.
2597 ir_node *new_d_Block(dbg_info *db, int arity, ir_node *in[]);
2599 /** Constructor for a Start node.
2601 * Adds the node to the block in current_ir_block.
2603 * @param *db A pointer for debug information.
2605 ir_node *new_d_Start (dbg_info *db);
2607 /** Constructor for a End node.
2609 * Adds the node to the block in current_ir_block.
2611 * @param *db A pointer for debug information.
2613 ir_node *new_d_End (dbg_info *db);
2615 /** Constructor for a Jmp node.
2617 * Adds the node to the block in current_ir_block.
2619 * Jmp represents control flow to a single control successor.
2621 * @param *db A pointer for debug information.
2623 ir_node *new_d_Jmp (dbg_info *db);
2625 /** Constructor for an IJmp node.
2627 * IJmp represents control flow to a single control successor not
2628 * statically known i.e. an indirect Jmp.
2630 * @param *db A pointer for debug information.
2631 * @param *tgt The ir node representing the target address.
2633 ir_node *new_d_IJmp (dbg_info *db, ir_node *tgt);
2635 /** Constructor for a Cond node.
2637 * Adds the node to the block in current_ir_block.
2639 * If c is mode_b represents a conditional branch (if/else). If c is
2640 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2641 * node, default Proj is 0.)
2643 * This is not consistent: Input to Cond is Is, Proj has as proj number
2646 * @param *db A pointer for debug information.
2647 * @param *c The conditions parameter.Can be of mode b or I_u.
2650 ir_node *new_d_Cond (dbg_info *db, ir_node *c);
2652 /** Constructor for a Return node.
2654 * Adds the node to the block in current_ir_block.
2656 * Returns the memory an zero or more return values. Only node that
2657 * can end regular control flow.
2659 * @param *db A pointer for debug information.
2660 * @param *store The state of memory.
2661 * @param arity Number of array indices.
2662 * @param *in Array with index inputs to the node.
2665 ir_node *new_d_Return (dbg_info *db, ir_node *store, int arity, ir_node *in[]);
2667 /** Constructor for a Raise node.
2669 * Adds the node to the block in current_ir_block.
2671 * @param *db A pointer for debug information.
2672 * @param *store The current memory.
2673 * @param *obj A pointer to the Except variable.
2676 ir_node *new_d_Raise (dbg_info *db, ir_node *store, ir_node *obj);
2678 /** Constructor for a Const_type node.
2680 * Adds the node to the block in current_ir_block.
2682 * The constant represents a target value. This constructor sets high
2683 * level type information for the constant value.
2685 * @param *db A pointer for debug information.
2686 * @param *mode The mode of the operands and results.
2687 * @param *con Points to an entry in the constant table. This pointer is
2688 added to the attributes of the node.
2689 * @param *tp The type of the constant.
2691 ir_node *new_d_Const_type (dbg_info *db, ir_mode *mode, tarval *con, ir_type *tp);
2693 /** Constructor for a Const node.
2695 * Adds the node to the block in current_ir_block.
2697 * Constructor for a Const node. The constant represents a target
2698 * value. Sets the type information to type_unknown. (No more
2699 * supported: If tv is entity derives a somehow useful type.)
2701 * @param *db A pointer for debug information.
2702 * @param *mode The mode of the operands and results.
2703 * @param *con Points to an entry in the constant table. This pointer is added
2704 * to the attributes of the node.
2706 ir_node *new_d_Const (dbg_info *db, ir_mode *mode, tarval *con);
2708 /** Constructor for a SymConst_type node.
2710 * Adds the node to the block in current_ir_block.
2711 * This is the constructor for a symbolic constant.
2712 * There are four kinds of symbolic constants:
2713 * - type_tag The symbolic constant represents a type tag. The type the
2714 * tag stands for is given explicitly.
2715 * - size The symbolic constant represents the size of a type. The
2716 * type of which the constant represents the size is given
2718 * - addr_name The symbolic constant represents the address of an entity
2719 * (variable or method). The variable is indicated by a name
2720 * that is valid for linking.
2721 * - addr_ent The symbolic constant represents the address of an entity
2722 * (variable or method). The variable is given explicitly by
2725 * Inputs to the node:
2726 * No inputs except the block it belongs to.
2727 * Outputs of the node.
2728 * An unsigned integer (I_u) or a pointer (P).
2730 * @param *db A pointer for debug information.
2731 * @param value A type, entity or ident depending on the SymConst kind.
2732 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_size
2733 * or symconst_addr_name.
2734 * @param tp The source type of the constant.
2736 ir_node *new_d_SymConst_type (dbg_info *db, union symconst_symbol value, symconst_kind kind, ir_type *tp);
2738 /** Constructor for a SymConst node.
2740 * Same as new_d_SymConst_type, except that it sets the type to type_unknown. */
2741 ir_node *new_d_SymConst (dbg_info *db, union symconst_symbol value, symconst_kind kind);
2743 /** Constructor for a simpleSel node.
2745 * This is a shortcut for the new_d_Sel() constructor. To be used for
2746 * Sel nodes that do not select from an array, i.e., have no index
2747 * inputs. It adds the two parameters 0, NULL.
2749 * @param *db A pointer for debug information.
2750 * @param *store The memory in which the object the entity should be
2751 * selected from is allocated.
2752 * @param *objptr The object from that the Sel operation selects a
2753 * single attribute out.
2754 * @param *ent The entity to select.
2756 ir_node *new_d_simpleSel(dbg_info *db, ir_node *store, ir_node *objptr, entity *ent);
2758 /** Constructor for a Sel node.
2760 * The select node selects an entity (field or method) from an entity
2761 * with a compound type. It explicitly specifies the entity selected.
2762 * Dynamically the node may select entities that overwrite the given
2763 * entity. If the selected entity is an array element entity the Sel
2764 * node takes the required array indices as inputs.
2765 * Adds the node to the block in current_ir_block.
2767 * @param *db A pointer for debug information.
2768 * @param *store The memory in which the object the entity should be selected
2769 * from is allocated.
2770 * @param *objptr A pointer to a compound entity the Sel operation selects a
2771 * single attribute from.
2772 * @param arity The number of array indices needed to select an array element entity.
2773 * @param *in[] If the compound entity is an array the indices of the selected
2774 * element entity. The constructor copies this array.
2775 * @param *ent The entity to select.
2777 ir_node *new_d_Sel (dbg_info *db, ir_node *store, ir_node *objptr, int arity, ir_node *in[],
2780 /** Constructor for a InstOf node.
2782 * Adds the node to the block in current_ir_block.
2784 * For translating Java. Not supported as standard firm node.
2786 * @param *db A pointer for debug information.
2791 ir_node *new_d_InstOf (dbg_info *db, ir_node *store, ir_node *objptr, ir_type *ent);
2793 /** Constructor for a Call node.
2795 * Represents all kinds of method and function calls.
2796 * Adds the node to the block in current_ir_block.
2798 * @param *db A pointer for debug information.
2799 * @param *store The actual store.
2800 * @param *callee A pointer to the called procedure.
2801 * @param arity The number of procedure parameters.
2802 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2803 * @param *tp Type information of the procedure called.
2806 ir_node *new_d_Call (dbg_info *db, ir_node *store, ir_node *callee, int arity, ir_node *in[],
2809 /** Constructor for a Add node.
2811 * Adds the node to the block in current_ir_block.
2813 * @param *db A pointer for debug information.
2814 * @param *op1 The first operand.
2815 * @param *op2 The second operand.
2816 * @param *mode The mode of the operands and the result.
2818 ir_node *new_d_Add (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2820 /** Constructor for a Sub node.
2822 * Adds the node to the block in current_ir_block.
2824 * @param *db A pointer for debug information.
2825 * @param *op1 The first operand.
2826 * @param *op2 The second operand.
2827 * @param *mode The mode of the operands and the result.
2830 ir_node *new_d_Sub (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2832 /** Constructor for a Minus node.
2834 * Adds the node to the block in current_ir_block.
2836 * @param *db A pointer for debug information.
2837 * @param *op The operand .
2838 * @param *mode The mode of the operand and the result.
2840 ir_node *new_d_Minus (dbg_info *db, ir_node *op, ir_mode *mode);
2842 /** Constructor for a Mul node.
2844 * Adds the node to the block in current_ir_block.
2846 * @param *db A pointer for debug information.
2847 * @param *op1 The first operand.
2848 * @param *op2 The second operand.
2849 * @param *mode The mode of the operands and the result.
2851 ir_node *new_d_Mul (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2853 /** Constructor for a Quot 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 first operand.
2860 * @param *op2 The second operand.
2862 ir_node *new_d_Quot (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
2864 /** Constructor for a DivMod node.
2866 * Adds the node to the block in current_ir_block.
2868 * @param *db A pointer for debug information.
2869 * @param *memop The store needed to model exceptions
2870 * @param *op1 The first operand.
2871 * @param *op2 The second operand.
2873 ir_node *new_d_DivMod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
2875 /** Constructor for a Div node.
2877 * Adds the node to the block in current_ir_block.
2879 * @param *db A pointer for debug information.
2880 * @param *memop The store needed to model exceptions
2881 * @param *op1 The first operand.
2882 * @param *op2 The second operand.
2884 ir_node *new_d_Div (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
2886 /** Constructor for a Mod node.
2888 * Adds the node to the block in current_ir_block.
2890 * @param *db A pointer for debug information.
2891 * @param *memop The store needed to model exceptions
2892 * @param *op1 The first operand.
2893 * @param *op2 The second operand.
2895 ir_node *new_d_Mod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
2897 /** Constructor for a Abs node.
2899 * Adds the node to the block in current_ir_block.
2901 * @param *db A pointer for debug information.
2902 * @param *op The operand
2903 * @param *mode The mode of the operands and the result.
2905 ir_node *new_d_Abs (dbg_info *db, ir_node *op, ir_mode *mode);
2907 /** Constructor for a And node.
2909 * Adds the node to the block in current_ir_block.
2911 * @param *db A pointer for debug information.
2912 * @param *op1 The first operand.
2913 * @param *op2 The second operand.
2914 * @param *mode The mode of the operands and the result.
2916 ir_node *new_d_And (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2918 /** Constructor for a Or node.
2920 * Adds the node to the block in current_ir_block.
2922 * @param *db A pointer for debug information.
2923 * @param *op1 The first operand.
2924 * @param *op2 The second operand.
2925 * @param *mode The mode of the operands and the result.
2927 ir_node *new_d_Or (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2929 /** Constructor for a Eor node.
2931 * Adds the node to the block in current_ir_block.
2933 * @param *db A pointer for debug information.
2934 * @param *op1 The first operand.
2935 * @param *op2 The second operand.
2936 * @param *mode The mode of the operands and the results.
2938 ir_node *new_d_Eor (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2940 /** Constructor for a Not node.
2942 * Adds the node to the block in current_ir_block.
2944 * @param *db A pointer for debug information.
2945 * @param *op The operand.
2946 * @param *mode The mode of the operand and the result.
2948 ir_node *new_d_Not (dbg_info *db, ir_node *op, ir_mode *mode);
2950 /** Constructor for a Shl node.
2952 * Adds the node to the block in current_ir_block.
2954 * @param *db A pointer for debug information.
2955 * @param *op The operand.
2956 * @param *k The number of bits to shift the operand .
2957 * @param *mode The mode of the operand and the result.
2959 ir_node *new_d_Shl (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
2961 /** Constructor for a Shr 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 shift the operand .
2968 * @param *mode The mode of the operand and the result.
2970 ir_node *new_d_Shr (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
2972 /** Constructor for a Shrs node.
2974 * Adds the node to the block in current_ir_block.
2976 * @param *db A pointer for debug information.
2977 * @param *op The operand.
2978 * @param *k The number of bits to shift the operand .
2979 * @param *mode The mode of the operand and the result.
2981 ir_node *new_d_Shrs (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
2983 /** Constructor for a Rot node.
2985 * Adds the node to the block in current_ir_block.
2987 * @param *db A pointer for debug information.
2988 * @param *op The operand.
2989 * @param *k The number of bits to rotate the operand.
2990 * @param *mode The mode of the operand.
2992 ir_node *new_d_Rot (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
2994 /** Constructor for a Cmp node.
2996 * Adds the node to the block in current_ir_block.
2998 * @param *db A pointer for debug information.
2999 * @param *op1 The first operand.
3000 * @param *op2 The second operand.
3002 ir_node *new_d_Cmp (dbg_info *db, ir_node *op1, ir_node *op2);
3004 /** Constructor for a Conv node.
3006 * Adds the node to the block in current_ir_block.
3008 * @param *db A pointer for debug information.
3009 * @param *op The operand.
3010 * @param *mode The mode of this the operand muss be converted .
3012 ir_node *new_d_Conv (dbg_info *db, ir_node *op, ir_mode *mode);
3014 /**Constructor for a Cast node.
3016 * High level type cast
3017 * Adds the node to the block in current_ir_block.
3019 * @param *db A pointer for debug information.
3020 * @param *op The operand.
3021 * @param *to_tp The type of this the operand muss be casted .
3023 ir_node *new_d_Cast (dbg_info *db, ir_node *op, ir_type *to_tp);
3025 /**Constructor for a Phi node.
3027 * Adds the node to the block in current_ir_block.
3029 * @param *db A pointer for debug information.
3030 * @param arity The number of predecessors
3031 * @param *in Array with predecessors
3032 * @param *mode The mode of it's inputs and output.
3034 ir_node *new_d_Phi (dbg_info *db, int arity, ir_node *in[], ir_mode *mode);
3036 /** Constructor for a Load node.
3038 * Adds the node to the block in current_ir_block.
3040 * @param *db A pointer for debug information.
3041 * @param *store The current memory
3042 * @param *addr A pointer to the variable to be read in this memory.
3043 * @param *mode The mode of the value to be loaded.
3045 ir_node *new_d_Load (dbg_info *db, ir_node *store, ir_node *addr, ir_mode *mode);
3047 /** Constructor for a Store node.
3049 * Adds the node to the block in current_ir_block.
3051 * @param *db A pointer for debug information.
3052 * @param *store The current memory
3053 * @param *addr A pointer to the variable to be read in this memory.
3054 * @param *val The value to write to this variable.
3056 ir_node *new_d_Store (dbg_info *db, ir_node *store, ir_node *addr, ir_node *val);
3058 /** Constructor for a Alloc node.
3060 * The Alloc node extends the memory by space for an entity of type alloc_type.
3061 * Adds the node to the block in current_ir_block.
3063 * @param *db A pointer for debug information.
3064 * @param *store The memory which shall contain the new variable.
3065 * @param *size The number of bytes to allocate.
3066 * @param *alloc_type The type of the allocated variable.
3067 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3069 ir_node *new_d_Alloc (dbg_info *db, ir_node *store, ir_node *size, ir_type *alloc_type,
3072 /** Constructor for a Free node.
3074 * Frees the memory occupied by the entity pointed to by the pointer
3075 * arg. Type indicates the type of the entity the argument points to.
3076 * Adds the node to the block in current_ir_block.
3078 * @param *db A pointer for debug information.
3079 * @param *store The memory which shall contain the new variable.
3080 * @param *ptr The pointer to the object to free.
3081 * @param *size The number of objects of type free_type to free in a sequence.
3082 * @param *free_type The type of the freed variable.
3083 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
3085 ir_node *new_d_Free (dbg_info *db, ir_node *store, ir_node *ptr, ir_node *size,
3086 ir_type *free_type, where_alloc where);
3088 /** Constructor for a Sync node.
3090 * Merges several memory values. The node assumes that a variable
3091 * either occurs only in one of the memories, or it contains the same
3092 * value in all memories where it occurs.
3093 * Adds the node to the block in current_ir_block.
3095 * @param *db A pointer for debug information.
3096 * @param arity The number of memories to synchronize.
3097 * @param **in An array of pointers to nodes that produce an output of type
3098 * memory. The constructor copies this array.
3100 ir_node *new_d_Sync (dbg_info *db, int arity, ir_node *in[]);
3103 /** Constructor for a Proj node.
3105 * Projects a single value out of a tuple. The parameter proj gives the
3106 * position of the value within the tuple.
3107 * Adds the node to the block in current_ir_block.
3109 * @param *db A pointer for deubug information.
3110 * @param arg A node producing a tuple.
3111 * @param *mode The mode of the value to project.
3112 * @param proj The position of the value in the tuple.
3114 ir_node *new_d_Proj (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3117 /** Constructor for a defaultProj node.
3119 * Represents the default control flow of a Switch-Cond node.
3120 * Adds the node to the block in current_ir_block.
3122 * @param *db A pointer for debug information.
3123 * @param arg A node producing a tuple.
3124 * @param max_proj The end position of the value in the tuple.
3126 ir_node *new_d_defaultProj (dbg_info *db, ir_node *arg, long max_proj);
3128 /** Constructor for a Tuple node.
3130 * This is an auxiliary node to replace a node that returns a tuple
3131 * without changing the corresponding Proj nodes.
3132 * Adds the node to the block in current_ir_block.
3134 * @param *db A pointer for debug information.
3135 * @param arity The number of tuple elements.
3136 * @param **in An array containing pointers to the nodes producing the tuple elements.
3138 ir_node *new_d_Tuple (dbg_info *db, int arity, ir_node *in[]);
3141 /** Constructor for a Id node.
3143 * This is an auxiliary node to replace a node that returns a single
3144 * value. Adds the node to the block in current_ir_block.
3146 * @param *db A pointer for debug information.
3147 * @param *val The operand to Id.
3148 * @param *mode The mode of *val.
3150 ir_node *new_d_Id (dbg_info *db, ir_node *val, ir_mode *mode);
3152 /** Constructor for a Bad node.
3154 * Returns the unique Bad node of the graph. The same as
3157 ir_node *new_d_Bad (void);
3159 /** Constructor for a Confirm node.
3161 * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3162 * Specifies constraints for a value. To support dataflow analyses.
3164 * Example: If the value never exceeds '100' this is expressed by placing a
3165 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
3167 * @param *db A pointer for debug information.
3168 * @param *val The value we express a constraint for
3169 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3170 * @param cmp The compare operation.
3172 ir_node *new_d_Confirm (dbg_info *db, ir_node *val, ir_node *bound, pn_Cmp cmp);
3175 /** Constructor for an Unknown node.
3177 * Represents an arbitrary value. Places the node in
3180 * @param *m The mode of the unknown value.
3182 ir_node *new_d_Unknown(ir_mode *m);
3184 /** Constructor for a CallBegin node.
3186 * CallBegin represents control flow depending of the pointer value
3187 * representing the called method to the called methods. The
3188 * constructor copies the method pointer input from the passed Call
3189 * node.Adds the node to the block in current_ir_block.
3191 * @param *db A pointer for debug information.
3192 * @param *callee The call node visible in the intra procedural view.
3194 ir_node *new_d_CallBegin(dbg_info *db, ir_node *callee);
3196 /** Constructor for an EndReg node.
3198 *Adds the node to the block in current_ir_block.
3200 * @param *db A pointer for debug information.
3202 ir_node *new_d_EndReg (dbg_info *db);
3204 /** Constructor for an EndExcept node.
3206 * Used to represent regular procedure end in interprocedual view.
3207 * Adds the node to the block in current_ir_block.
3209 * @param *db A pointer for debug information.
3211 ir_node *new_d_EndExcept(dbg_info *db);
3213 /** Constructor for a Break node.
3215 * Used to represent exceptional procedure end in interprocedural view.
3216 * Adds the node to the block in current_ir_block.
3218 * Break represents control flow to a single control successor just as Jmp.
3219 * The blocks separated by a break may not be concatenated by an optimization.
3220 * It is used for the interprocedural representation where blocks are parted
3221 * behind Call nodes to represent the control flow to called procedures.
3223 * @param *db A pointer for debug information.
3225 ir_node *new_d_Break (dbg_info *db);
3227 /** Constructor for a Filter node.
3229 * Constructor for a Filter node. Adds the node to the block in
3230 * current_ir_block. Filter is a node with two views used to
3231 * construct the interprocedural view. In intraprocedural view its
3232 * semantics are identical to the Proj node. In interprocedural view
3233 * the Filter performs the Phi operation on method parameters or
3234 * results. Other than a Phi a Filter node may not be removed if it
3235 * has only a single input.
3237 * The constructor builds the Filter in intraprocedural view.
3239 * @param *db A pointer for debug information.
3240 * @param *arg The tuple value to project from.
3241 * @param *mode The mode of the projected value.
3242 * @param proj The position in the tuple to project from.
3244 ir_node *new_d_Filter (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3247 /** Constructor for a NoMem node.
3249 * Returns the unique NoMem node of the graph. The same as
3252 ir_node *new_d_NoMem (void);
3254 /** Constructor for a Mux node.
3256 * @param *db A pointer for debug information.
3257 * @param *sel The ir_node that calculates the boolean select.
3258 * @param *ir_true The ir_node that calculates the true result.
3259 * @param *ir_false The ir_node that calculates the false result.
3260 * @param *mode The mode of the node (and it_true and ir_false).
3262 ir_node *new_d_Mux (dbg_info *db, ir_node *sel,
3263 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
3265 /** Constructor for a CopyB node.
3267 * @param *db A pointer for debug information.
3268 * @param *store The current memory
3269 * @param *dst The ir_node that represents the destination address.
3270 * @param *src The ir_node that represents the source address.
3271 * @param *data_type The type of the copied data
3273 ir_node *new_d_CopyB(dbg_info *db, ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
3275 /** Constructor for a Bound node.
3276 * Checks whether lower <= idx && idx < upper.
3278 * @param *db A pointer for debug information.
3279 * @param *store The current memory
3280 * @param *idx The ir_node that represents an index.
3281 * @param *lower The ir_node that represents the lower bound for the index.
3282 * @param *upper The ir_node that represents the upper bound for the index.
3284 ir_node *new_d_Bound(dbg_info *db, ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
3286 /*-----------------------------------------------------------------------*/
3287 /* The block oriented interface without debug support */
3288 /*-----------------------------------------------------------------------*/
3290 /* Needed from the interface with debug support:
3291 void set_cur_block (ir_node *target); */
3293 /** Constructor for a Block node.
3295 * Constructor for a Block node. Adds the block to the graph in
3296 * current_ir_graph. Constructs a Block with a fixed number of
3297 * predecessors. Does set current_block. Can be used with automatic
3298 * Phi node construction.
3300 * @param arity The number of control predecessors.
3301 * @param in An array of control predecessors. The length of
3302 * the array must be 'arity'.
3304 ir_node *new_Block(int arity, ir_node *in[]);
3306 /** Constructor for a Start node.
3308 * Adds the node to the block in current_ir_block.
3311 ir_node *new_Start (void);
3313 /** Constructor for an End node.
3315 * Adds the node to the block in current_ir_block.
3317 ir_node *new_End (void);
3319 /** Constructor for an EndReg node.
3321 * Used to represent regular procedure end in interprocedual view.
3322 * Adds the node to the block in current_ir_block.
3324 ir_node *new_EndReg (void);
3326 /** Constructor for an EndExpcept node.
3328 * Used to represent exceptional procedure end in interprocedural view.
3329 * Adds the node to the block in current_ir_block.
3331 ir_node *new_EndExcept(void);
3333 /** Constructor for a Jump node.
3335 * Adds the node to the block in current_ir_block.
3337 * Jmp represents control flow to a single control successor.
3339 ir_node *new_Jmp (void);
3341 /** Constructor for an IJmp node.
3343 * IJmp represents control flow to a single control successor not
3344 * statically known i.e. an indirect Jmp.
3346 * @param *tgt The ir node representing the target address.
3348 ir_node *new_IJmp (ir_node *tgt);
3350 /** Constructor for a Break node.
3351 * Break represents control flow to a single control successor just as Jmp.
3352 * The blocks separated by a break may not be concatenated by an optimization.
3353 * It is used for the interprocedural representation where blocks are parted
3354 * behind Call nodes to represent the control flow to called procedures.
3355 * Adds the node to the block in current_ir_block.
3357 ir_node *new_Break (void);
3359 /** Constructor for a Cond node.
3361 * If c is mode_b represents a conditional branch (if/else). If c is
3362 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
3363 * node, default Proj is 0.). Adds the node to the block in current_ir_block.
3365 * This is not consistent: Input to Cond is Is, Proj has as proj number
3369 * @param *c The conditions parameter.Can be of mode b or I_u.
3371 ir_node *new_Cond (ir_node *c);
3373 /** Constructor for a Return node.
3375 * Returns the memory an zero or more return values. Only node that
3376 * can end regular control flow. Adds the node to the block in current_ir_block.
3378 * @param *store The state of memory.
3379 * @param arity Number of array indices.
3380 * @param *in Array with index inputs to the node.
3382 ir_node *new_Return (ir_node *store, int arity, ir_node *in[]);
3384 /**Constructor for a Raise node.
3386 * Adds the node to the block in current_ir_block.
3388 * @param *store The current memory.
3389 * @param *obj A pointer to the Except variable.
3391 ir_node *new_Raise (ir_node *store, ir_node *obj);
3393 /** Constructor for a Const node.
3395 * Constructor for a Const node. The constant represents a target
3396 * value. Sets the type information to type_unknown. (No more
3397 * supported: If tv is entity derives a somehow useful type.)
3398 * Adds the node to the block in current_ir_block.
3400 * @param *mode The mode of the operands and results.
3401 * @param *con Points to an entry in the constant table. This pointer is
3402 * added to the attributes of the node.
3404 ir_node *new_Const (ir_mode *mode, tarval *con);
3407 * Make a const from a long.
3408 * This is just convenience for the usual
3410 * new_Const(mode, tarval_from_long(mode, ...))
3413 * @param mode The mode for the const.
3414 * @param value The value of the constant.
3415 * @return A new const node.
3417 ir_node *new_Const_long(ir_mode *mode, long value);
3419 /** Constructor for a Const node.
3421 * Derives mode from passed type. */
3422 ir_node *new_Const_type(tarval *con, ir_type *tp);
3424 /** Constructor for a SymConst node.
3426 * Adds the node to the block in current_ir_block.
3427 * This is the constructor for a symbolic constant.
3428 * There are four kinds of symbolic constants:
3429 * -# type_tag The symbolic constant represents a type tag. The type the
3430 * tag stands for is given explicitly.
3431 * -# size The symbolic constant represents the size of a type. The
3432 * type of which the constant represents the size is given
3434 * -# addr_name The symbolic constant represents the address of an entity
3435 * (variable or method). The variable is indicated by a name
3436 * that is valid for linking.
3437 * -# addr_ent The symbolic constant represents the address of an entity
3438 * (variable or method). The variable is given explicitly by
3441 * Inputs to the node:
3442 * No inputs except the block it belongs to.
3443 * Outputs of the node.
3444 * An unsigned integer (I_u) or a pointer (P).
3446 * @param value A type or a ident depending on the SymConst kind.
3447 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_size or symconst_addr_name.
3449 ir_node *new_SymConst (union symconst_symbol value, symconst_kind kind);
3451 /** Constructor for a simpelSel node.
3453 * This is a shortcut for the new_Sel() constructor. To be used for
3454 * Sel nodes that do not select from an array, i.e., have no index
3455 * inputs. It adds the two parameters 0, NULL.
3457 * @param *store The memory in which the object the entity should be selected from is allocated.
3458 * @param *objptr The object from that the Sel operation selects a single attribute out.
3459 * @param *ent The entity to select.
3461 ir_node *new_simpleSel(ir_node *store, ir_node *objptr, entity *ent);
3463 /** Constructor for a Sel node.
3465 * The select node selects an entity (field or method) from an entity
3466 * with a compound type. It explicitly specifies the entity selected.
3467 * Dynamically the node may select entities that overwrite the given
3468 * entity. If the selected entity is an array element entity the Sel
3469 * node takes the required array indices as inputs.
3470 * Adds the node to the block in current_ir_block.
3472 * @param *store The memory in which the object the entity should be selected
3473 * from is allocated.
3474 * @param *objptr A pointer to a compound entity the Sel operation selects a
3475 * single attribute from.
3476 * @param arity The number of array indices needed to select an array element entity.
3477 * @param *in[] If the compound entity is an array the indices of the selected
3478 * element entity. The constructor copies this array.
3479 * @param *ent The entity to select.
3481 ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3484 /** Constructor for an InstOf node.
3486 * Adds the node to the block in current_ir_block.
3487 * For translating Java. Not supported as standard firm node.
3489 * @param *store The actual store.
3493 ir_node *new_InstOf (ir_node *store, ir_node *obj, ir_type *ent);
3495 /** Constructor for a Call node.
3497 * Adds the node to the block in current_ir_block.
3498 * Represents all kinds of method and function calls.
3500 * @param *store The actual store.
3501 * @param *callee A pointer to the called procedure.
3502 * @param arity The number of procedure parameters.
3503 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3504 * @param *tp Type information of the procedure called.
3506 ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node *in[],
3509 /** Constructor for a CallBegin node.
3511 * Adds the node to the block in current_ir_block.
3513 * @param *callee A pointer to the called procedure.
3515 ir_node *new_CallBegin(ir_node *callee);
3517 /**Constructor for a Add node.
3519 * CallBegin represents control flow depending of the pointer value
3520 * representing the called method to the called methods. The
3521 * constructor copies the method pointer input from the passed Call
3522 * node.Adds the node to the block in current_ir_block.
3524 * @param *op1 The first operand.
3525 * @param *op2 The second operand.
3526 * @param *mode The mode of the operands and the result.
3528 ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
3530 /** Constructor for a Sub node.
3532 * Adds the node to the block in current_ir_block.
3534 * @param *op1 The first operand.
3535 * @param *op2 The second operand.
3536 * @param *mode The mode of the operands and the result.
3538 ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
3540 /** Constructor for a Minus node.
3542 * Adds the node to the block in current_ir_block.
3544 * @param *op The operand .
3545 * @param *mode The mode of the operand and the result.
3547 ir_node *new_Minus (ir_node *op, ir_mode *mode);
3550 * Constructor for a Mul node. Adds the node to the block in current_ir_block.
3552 * @param *op1 The first operand.
3553 * @param *op2 The second operand.
3554 * @param *mode The mode of the operands and the result.
3556 ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
3558 /** Constructor for a Quot 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 first operand.
3564 * @param *op2 The second operand.
3566 ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2);
3568 /** Constructor for a DivMod node.
3570 * Adds the node to the block in current_ir_block.
3572 * @param *memop The store needed to model exceptions
3573 * @param *op1 The first operand.
3574 * @param *op2 The second operand.
3576 ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
3578 /** Constructor for a Div node.
3580 * Adds the node to the block in current_ir_block.
3582 * @param *memop The store needed to model exceptions
3583 * @param *op1 The first operand.
3584 * @param *op2 The second operand.
3586 ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2);
3588 /** Constructor for a Mod node.
3590 * Adds the node to the block in current_ir_block.
3592 * @param *memop The store needed to model exceptions
3593 * @param *op1 The first operand.
3594 * @param *op2 The second operand.
3596 ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2);
3598 /** Constructor for a Abs node.
3600 * Adds the node to the block in current_ir_block.
3602 * @param *op The operand
3603 * @param *mode The mode of the operands and the result.
3605 ir_node *new_Abs (ir_node *op, ir_mode *mode);
3607 /** Constructor for a And node.
3609 * Adds the node to the block in current_ir_block.
3611 * @param *op1 The first operand.
3612 * @param *op2 The second operand.
3613 * @param *mode The mode of the operands and the result.
3615 ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
3618 * Constructor for a Or node. Adds the node to the block in current_ir_block.
3620 * @param *op1 The first operand.
3621 * @param *op2 The second operand.
3622 * @param *mode The mode of the operands and the result.
3624 ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
3627 * Constructor for a Eor node. Adds the node to the block in current_ir_block.
3629 * @param *op1 The first operand.
3630 * @param *op2 The second operand.
3631 * @param *mode The mode of the operands and the results.
3633 ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
3635 /** Constructor for a Not node.
3637 * Adds the node to the block in current_ir_block.
3639 * @param *op The operand.
3640 * @param *mode The mode of the operand and the result.
3642 ir_node *new_Not (ir_node *op, ir_mode *mode);
3644 /** Constructor for a Shl node.
3646 * Adds the node to the block in current_ir_block.
3648 * @param *op The operand.
3649 * @param *k The number of bits to shift the operand .
3650 * @param *mode The mode of the operand and the result.
3652 ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
3655 * Constructor for a Shr node. Adds the node to the block in current_ir_block.
3657 * @param *op The operand.
3658 * @param *k The number of bits to shift the operand .
3659 * @param *mode The mode of the operand and the result.
3661 ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
3663 /** Constructor for a Shrs node.
3665 * Adds the node to the block in current_ir_block.
3667 * @param *op The operand.
3668 * @param *k The number of bits to shift the operand .
3669 * @param *mode The mode of the operand and the result.
3671 ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
3673 /** Constructor for a Rot node.
3675 * Adds the node to the block in current_ir_block.
3677 * @param *op The operand.
3678 * @param *k The number of bits to rotate the operand.
3679 * @param *mode The mode of the operand.
3681 ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode);
3683 /** Constructor for a Cmp node.
3685 * Adds the node to the block in current_ir_block.
3687 * @param *op1 The first operand.
3688 * @param *op2 The second operand.
3690 ir_node *new_Cmp (ir_node *op1, ir_node *op2);
3692 /** Constructor for a Conv node.
3694 * Adds the node to the block in current_ir_block.
3696 * @param *op The operand.
3697 * @param *mode The mode of this the operand muss be converted .
3699 ir_node *new_Conv (ir_node *op, ir_mode *mode);
3701 /**Constructor for a Cast node.
3703 * Adds the node to the block in current_ir_block.
3704 * High level type cast
3706 * @param *op The operand.
3707 * @param *to_tp The type of this the operand muss be casted .
3709 ir_node *new_Cast (ir_node *op, ir_type *to_tp);
3711 /** Constructor for a Phi node.
3713 * Adds the node to the block in current_ir_block.
3715 * @param arity The number of predecessors.
3716 * @param *in Array with predecessors.
3717 * @param *mode The mode of it's inputs and output.
3719 ir_node *new_Phi (int arity, ir_node *in[], ir_mode *mode);
3721 /** Constructor for a Load node.
3723 * @param *store The current memory.
3724 * @param *addr A pointer to the variable to be read in this memory.
3725 * @param *mode The mode of the value to be loaded.
3727 ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode);
3729 /** Constructor for a Store node.
3731 * @param *store The current memory.
3732 * @param *addr A pointer to the variable to be read in this memory.
3733 * @param *val The value to write to this variable.
3735 ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
3737 /**Constructor for a Alloc node.
3739 * The Alloc node extends the memory by space for an entity of type alloc_type.
3740 * Adds the node to the block in current_ir_block.
3742 * @param *store The memory which shall contain the new variable.
3743 * @param *size The number of bytes to allocate.
3744 * @param *alloc_type The type of the allocated variable.
3745 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3747 ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
3751 /**Constructor for a Free node.
3753 * Frees the memory occupied by the entity pointed to by the pointer
3754 * arg. Type indicates the type of the entity the argument points to.
3755 * Adds the node to the block in current_ir_block.
3757 * @param *store The memory which shall contain the new variable.
3758 * @param *ptr The pointer to the object to free.
3759 * @param *size The number of objects of type free_type to free in a sequence.
3760 * @param *free_type The type of the freed variable.
3761 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
3763 ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
3764 ir_type *free_type, where_alloc where);
3766 /** Constructor for a Sync node.
3768 * Merges several memory values. The node assumes that a variable
3769 * either occurs only in one of the memories, or it contains the same
3770 * value in all memories where it occurs.
3771 * Adds the node to the block in current_ir_block.
3773 * @param arity The number of memories to synchronize.
3774 * @param **in An array of pointers to nodes that produce an output of type
3775 * memory. The constructor copies this array.
3777 ir_node *new_Sync (int arity, ir_node *in[]);
3779 /** Constructor for a Proj node.
3781 * Projects a single value out of a tuple. The parameter proj gives the
3782 * position of the value within the tuple.
3783 * Adds the node to the block in current_ir_block.
3785 * @param arg A node producing a tuple.
3786 * @param *mode The mode of the value to project.
3787 * @param proj The position of the value in the tuple.
3789 ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
3791 /** Costructor for a Filter node.
3793 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
3794 * Filter is a node with two views used to construct the interprocedural view.
3795 * In intraprocedural view its semantics are identical to the Proj node.
3796 * In interprocedural view the Filter performs the Phi operation on method
3797 * parameters or results. Other than a Phi a Filter node may not be removed
3798 * if it has only a single input.
3800 * The constructor builds the Filter in intraprocedural view.
3802 * @param *arg The tuple value to project from.
3803 * @param *mode The mode of the projected value.
3804 * @param proj The position in the tuple to project from.
3806 ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj);
3808 /** Constructor for a defaultProj node.
3810 * Represents the default control flow of a Switch-Cond node.
3811 * Adds the node to the block in current_ir_block.
3813 * @param arg A node producing a tuple.
3814 * @param max_proj The end position of the value in the tuple.
3816 ir_node *new_defaultProj (ir_node *arg, long max_proj);
3818 /** Constructor for a Tuple node.
3820 * This is an auxiliary node to replace a node that returns a tuple
3821 * without changing the corresponding Proj nodes.
3822 * Adds the node to the block in current_ir_block.
3824 * @param arity The number of tuple elements.
3825 * @param **in An array containing pointers to the nodes producing the tuple elements.
3827 ir_node *new_Tuple (int arity, ir_node *in[]);
3829 /** Constructor for an Id node.
3831 * This is an auxiliary node to replace a node that returns a single
3832 * value. Adds the node to the block in current_ir_block.
3834 * @param *val The operand to Id.
3835 * @param *mode The mode of *val.
3837 ir_node *new_Id (ir_node *val, ir_mode *mode);
3839 /** Constructor for a Bad node.
3841 * Returns the unique Bad node of the graph. The same as
3844 ir_node *new_Bad (void);
3846 /** Constructor for a Confirm node.
3848 * Specifies constraints for a value. To support dataflow analyses.
3849 * Adds the node to the block in current_ir_block.
3851 * Example: If the value never exceeds '100' this is expressed by placing a
3852 * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
3854 * @param *val The value we express a constraint for
3855 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3856 * @param cmp The compare operation.
3858 ir_node *new_Confirm (ir_node *val, ir_node *bound, pn_Cmp cmp);
3860 /** Constructor for an Unknown node.
3862 * Represents an arbitrary value. Places the node in
3865 * @param *m The mode of the unknown value.
3867 ir_node *new_Unknown(ir_mode *m);
3869 /** Constructor for a NoMem node.
3871 * Returns the unique NoMem node of the graph. The same as
3874 ir_node *new_NoMem (void);
3876 /** Constructor for a Mux node.
3878 * Adds the node to the block in current_ir_block.
3880 * @param *sel The ir_node that calculates the boolean select.
3881 * @param *ir_true The ir_node that calculates the true result.
3882 * @param *ir_false The ir_node that calculates the false result.
3883 * @param *mode The mode of the node (and it_true and ir_false).
3885 ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
3887 /** Constructor for a CopyB node.
3889 * Adds the node to the block in current_ir_block.
3891 * @param *store The current memory
3892 * @param *dst The ir_node that represents the destination address.
3893 * @param *src The ir_node that represents the source address.
3894 * @param *data_type The type of the copied data
3896 ir_node *new_CopyB(ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
3898 /** Constructor for a Bound node.
3899 * Checks whether lower <= idx && idx < upper.
3901 * Adds the node to the block in current_ir_block.
3903 * @param *store The current memory
3904 * @param *idx The ir_node that represents an index.
3905 * @param *lower The ir_node that represents the lower bound for the index.
3906 * @param *upper The ir_node that represents the upper bound for the index.
3908 ir_node *new_Bound(ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
3910 /*---------------------------------------------------------------------*/
3911 /* The comfortable interface. */
3912 /* Supports automatic Phi node construction. */
3913 /* All routines of the block oriented interface except new_Block are */
3915 /*---------------------------------------------------------------------*/
3917 /** Create an immature block.
3919 * An immature block has an unknown number of predecessors. Predecessors
3920 * can be added with add_immBlock_pred(). Once all predecessors are
3921 * added the block must be matured.
3923 * Adds the block to the graph in current_ir_graph. Does set
3924 * current_block. Can be used with automatic Phi node construction.
3925 * This constructor can only be used if the graph is in
3928 ir_node *new_d_immBlock (dbg_info *db);
3929 ir_node *new_immBlock (void);
3931 /** Add a control flow edge to an immature block. */
3932 void add_immBlock_pred (ir_node *immblock, ir_node *jmp);
3934 /** Finalize a Block node, when all control flows are known. */
3935 void mature_immBlock (ir_node *block);
3936 #define mature_cur_block() mature_immBlock(get_cur_block());
3939 /** Get the current value of a local variable.
3941 * Use this function to obtain the last definition of the local variable
3942 * associated with pos. Pos may not exceed the value passed as n_loc
3943 * to new_ir_graph. This call automatically inserts Phi nodes.
3945 * @param *db A pointer for debug information.
3946 * @param pos The position/id of the local variable.
3947 * @param *mode The mode of the value to get.
3949 ir_node *get_d_value (dbg_info *db, int pos, ir_mode *mode);
3950 ir_node *get_value (int pos, ir_mode *mode);
3952 /** Remark a new definition of a variable.
3954 * Use this function to remember a new definition of the value
3955 * associated with pos. Pos may not exceed the value passed as n_loc
3956 * to new_ir_graph. This call is needed to automatically inserts Phi
3959 * @param pos The position/id of the local variable.
3960 * @param *value The new value written to the local variable.
3962 void set_value (int pos, ir_node *value);
3964 /** Get the current memory state.
3966 * Use this function to obtain the last definition of the memory
3967 * state. This call automatically inserts Phi nodes for the memory
3970 ir_node *get_store (void);
3972 /** Remark a new definition of the memory state.
3974 * Use this function to remember a new definition of the memory state.
3975 * This call is needed to automatically inserts Phi nodes.
3977 * @param *store The new memory state.
3979 void set_store (ir_node *store);
3981 /** keep this node alive even if End is not control-reachable from it
3983 * @param ka The node to keep alive.
3985 void keep_alive (ir_node *ka);
3987 /** Returns the frame type of the current graph */
3988 ir_type *get_cur_frame_type(void);
3991 /* --- initialize and finalize ir construction --- */
3993 /** Puts the graph into state "phase_high" */
3994 void irg_finalize_cons (ir_graph *irg);
3996 /** Puts the program and all graphs into state phase_high.
3998 * This also remarks, the construction of types is finished,
3999 * e.g., that no more subtypes will be added. */
4000 void irp_finalize_cons(void);
4002 /* --- Initialization --- */
4005 * This function is called, whenever a local variable is used before definition
4007 * @param irg the IR graph on which this happens
4008 * @param mode the mode of the local var
4009 * @param pos position chosen be the frontend for this variable (n_loc)
4011 * @return a firm node of mode @p mode that initializes the var at position pos
4014 * Do not return NULL!
4015 * If this function is not set, FIRM will create a const node with tarval BAD.
4016 * Use set_irg_loc_description()/get_irg_loc_description() to assign additional
4017 * informations to local variables.
4019 typedef ir_node *uninitialized_local_variable_func_t(ir_graph *irg, ir_mode *mode, int pos);
4021 #endif /* _IRCONS_H_ */