2 * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * @brief Various irnode constructors. Automatic construction of SSA
24 * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Boris Boesler,
30 Ideas for improvement:
31 -# Handle construction of exceptions more comfortable:
32 Add new constructors that pass the exception region (or better the
33 Phi for the memories, the ex. region can be found from there) as parameter,
34 constructor then adds all Proj nodes and returns the pointer
35 to the Proj node that selects the result of the arithmetic operation.
36 -# Maybe hide the exception region in a global variable, especially if
37 it is always unambiguous.
43 * documentation no more supported since 2001
45 * IR node construction.
47 * This file documents all datatypes and constructors needed to
48 * build a FIRM representation of a procedure. The constructors are
49 * also implemented in this file.
51 * The documentation also gives a short manual how to use the library.
53 * For extensive documentation of FIRM see UKA Techreport 1999-14.
56 * Three kinds of nodes
57 * --------------------
59 * There are three kinds of nodes known to the IR: entities,
62 * + ir_nodes are the actual nodes of the FIRM intermediate representation.
63 * They represent operations on the data of the program and control flow
66 * + entity ==> implemented in entity.h
67 * Refers to a single entity of the compiled program, e.g. a field of a
68 * class or a method. If a method or variable can not be assigned to
69 * a method or class or the like, it is a global object.
71 * + types ==> implemented in type.h
72 * With types type information is represented. There are several type
75 * Implementation of the FIRM operations: ir_node
76 * ----------------------------------------------
78 * Ir_nodes represent operations on the data of the program and control flow
79 * operations. Examples of ir_nodes: Add, Jmp, Cmp
81 * FIRM is a dataflow graph. A dataflow graph is a directed graph,
82 * so that every node has incoming and outgoing edges. A node is
83 * executable if every input at it's incoming edges is available.
84 * Execution of the dataflow graph is started at the Start node which
85 * has no incoming edges and ends when the End node executes, even if
86 * there are still executable or not executed nodes. (Is this true,
87 * or must all executable nodes be executed?) (There are exceptions
88 * to the dataflow paradigma that all inputs have to be available
89 * before a node can execute: Phi, Block. See UKA Techreport
92 * The implementation of FIRM differs from the view as a dataflow
93 * graph. To allow fast traversion of the graph edges are
94 * implemented as C-pointers. Inputs to nodes are not ambiguous, the
95 * results can be used by several other nodes. Each input can be
96 * implemented as a single pointer to a predecessor node, outputs
97 * need to be lists of pointers to successors. Therefore a node
98 * contains pointers to it's predecessor so that the implementation is a
99 * dataflow graph with reversed edges. It has to be traversed bottom
102 * All nodes of the IR have the same basic structure. They are
103 * distinguished by a field containing the opcode.
105 * The fields of an ir_node:
107 * kind A firm_kind tag containing k_ir_node. This is useful for
108 * dynamically checking the type of a node.
110 * *op This ir_op gives the opcode as a tag and a string
111 * and the number of attributes of an ir_node. There is
112 * one statically allocated struct ir_op for each opcode.
114 * *mode The ir_mode of the operation represented by this firm
115 * node. The mode of the operation is the mode of it's
116 * result. A Firm mode is a datatype as known to the target,
117 * not a type of the source language.
119 * visit A flag for traversing the IR.
121 * **in An array with pointers to the node's predecessors.
123 * *link A pointer to an ir_node. With this pointer all Phi nodes
124 * are attached to a Block, i.e., a Block points to it's
125 * first Phi node, this node points to the second Phi node
126 * in the Block and so fourth. Used in mature_immBlock
127 * to find all Phi nodes to be matured. It's also used to
128 * annotate a node with a better, optimized version of it.
130 * attr An attr struct containing the attributes of the nodes. The
131 * attributes depend on the opcode of the node. The number
132 * of these attributes is given in op.
136 * Not yet documented. See irop.h.
140 * Not yet documented. See irmode.h.
142 * GLOBAL VARIABLES -- now also fields of ir_graph.
145 * current_ir_graph Points to the current ir_graph. All constructors for
146 * nodes add nodes to this graph.
148 * ir_visited An int used as flag to traverse the ir_graph.
150 * block_visited An int used as a flag to traverse block nodes in the
153 * Others not yet documented.
157 * CONSTRUCTOR FOR IR_GRAPH --> see irgraph.h
158 * ========================
161 * PROCEDURE TO CONSTRUCT AN IR GRAPH --> see also Firm tutorial
162 * ==================================
164 * This library supplies several interfaces to construct a FIRM graph for
166 * - A "comfortable" interface generating SSA automatically. Automatically
167 * computed predecessors of nodes need not be specified in the constructors.
168 * (new_<Node> constructurs and a set of additional routines.)
169 * - A less comfortable interface where all predecessors except the block
170 * an operation belongs to need to be specified. SSA must be constructed
171 * by hand. (new_<Node> constructors and set_cur_block()). This interface
172 * is called "block oriented". It automatically calles the local optimizations
174 * - An even less comfortable interface where the block needs to be specified
175 * explicitly. This is called the "raw" interface. (new_r_<Node>
176 * constructors). These nodes are not optimized.
178 * To use the functionality of the comfortable interface correctly the Front
179 * End needs to follow certain protocols. This is explained in the following.
180 * To build a correct IR with the other interfaces study the semantics of
181 * the firm node (See tech-reprot UKA 1999-14). For the construction of
182 * types and entities see the documentation in those modules.
184 * First the Frontend needs to decide which variables and values used in
185 * a procedure can be represented by dataflow edges. These are variables
186 * that need not be saved to memory as they cause no side effects visible
187 * out of the procedure. Often these are all compiler generated
188 * variables and simple local variables of the procedure as integers,
189 * reals and pointers. The frontend has to count and number these variables.
191 * First an ir_graph needs to be constructed with new_ir_graph. The
192 * constructor gets the number of local variables. The graph is hold in the
193 * global variable irg.
195 * Now the construction of the procedure can start. Several basic blocks can
196 * be constructed in parallel, but the code within each block needs to
197 * be constructed (almost) in program order.
199 * A global variable holds the current basic block. All (non block) nodes
200 * generated are added to this block. The current block can be set with
201 * set_cur_block(block). If several blocks are constructed in parallel block
202 * switches need to be performed constantly.
204 * To generate a Block node (with the comfortable interface), its predecessor
205 * control flow nodes need not be known. In case of cyclic control flow these
206 * can not be known when the block is constructed. With add_immBlock_pred(block,
207 * cfnode) predecessors can be added to the block. If all predecessors are
208 * added to the block mature_immBlock(b) needs to be called. Calling mature_immBlock
209 * early improves the efficiency of the Phi node construction algorithm.
210 * But if several blocks are constructed at once, mature_immBlock must only
211 * be called after performing all set_values and set_stores in the block!
212 * (See documentation of new_immBlock constructor.)
214 * The constructors of arithmetic nodes require that their predecessors
215 * are mentioned. Sometimes these are available in the Frontend as the
216 * predecessors have just been generated by the frontend. If they are local
217 * values the predecessors can be obtained from the library with a call to
218 * get_value(local_val_nr). (local_val_nr needs to be administered by
219 * the Frontend.) A call to get_value triggers the generation of Phi nodes.
220 * If an arithmetic operation produces a local value this value needs to be
221 * passed to the library by set_value(node, local_val_nr).
222 * In straight line code these two operations just remember and return the
223 * pointer to nodes producing the value. If the value passes block boundaries
224 * Phi nodes can be inserted.
225 * Similar routines exist to manage the Memory operands: set_store and
228 * Several nodes produce more than one result. An example is the Div node.
229 * Such nodes return tuples of values. From these individual values can be
230 * extracted by proj nodes.
232 * The following example illustrates the construction of a simple basic block
233 * with two predecessors stored in variables cf_pred1 and cf_pred2, containing
236 * and finally jumping to an other block. The variable a got the local_val_nr
237 * 42 by the frontend.
239 * ir_node *this_block, *cf_pred1, *cf_pred2, *a_val, *mem, *div, *res, *cf_op;
241 * this_block = new_immBlock();
242 * add_immBlock_pred(this_block, cf_pred1);
243 * add_immBlock_pred(this_block, cf_pred2);
244 * mature_immBlock(this_block);
245 * a_val = get_value(42, mode_Iu);
247 * div = new_Div(mem, a_val, a_val, mode_Iu);
248 * mem = new_Proj(div, mode_M, pn_Div_M); * for the numbers for Proj see docu *
249 * res = new_Proj(div, mode_Iu, pn_Div_res);
251 * set_value(res, 42);
254 * For further information look at the documentation of the nodes and
255 * constructors and at the paragraph COPING WITH DATA OBJECTS at the
256 * end of this documentation.
258 * The comfortable interface contains the following routines further explained
261 * ir_node *new_immBlock (void);
262 * ir_node *new_Start (void);
263 * ir_node *new_End (void);
264 * ir_node *new_Jmp (void);
265 * ir_node *new_IJmp (ir_node *tgt);
266 * ir_node *new_Cond (ir_node *c);
267 * ir_node *new_Return (ir_node *store, int arity, ir_node **in);
268 * ir_node *new_Const (tarval *con);
269 * ir_node *new_SymConst (ir_mode *mode, symconst_symbol value, symconst_kind kind);
270 * ir_node *new_simpleSel (ir_node *store, ir_node *objptr, ir_entity *ent);
271 * ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity,
272 * ir_node **in, ir_entity *ent);
273 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity,
274 * ir_node **in, type_method *type);
275 * ir_node *new_Builtin(ir_node *store, ir_builtin_kind kind, int arity,
276 * ir_node **in, type_method *type);
277 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
278 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
279 * ir_node *new_Minus (ir_node *op, ir_mode *mode);
280 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
281 * ir_node *new_Mulh (ir_node *op1, ir_node *op2, ir_mode *mode);
282 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
283 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
284 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
285 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state;
286 * ir_node *new_Abs (ir_node *op, ir_mode *mode);
287 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
288 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
289 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
290 * ir_node *new_Not (ir_node *op, ir_mode *mode);
291 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
292 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
293 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
294 * ir_node *new_Rotl (ir_node *op, ir_node *k, ir_mode *mode);
295 * ir_node *new_Cmp (ir_node *op1, ir_node *op2);
296 * ir_node *new_Conv (ir_node *op, ir_mode *mode);
297 * ir_node *new_Cast (ir_node *op, ir_type *to_tp);
298 * ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode);
299 * ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode);
300 * ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode, ir_cons_flags flags);
301 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val, ir_cons_flags flags);
302 * ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
303 * where_alloc where);
304 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
305 * ir_type *free_type, where_alloc where);
306 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
307 * ir_node *new_NoMem (void);
308 * ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
309 * ir_node *new_CopyB (ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
310 * ir_node *new_InstOf (ir_node *store, ir_node obj, ir_type *ent);
311 * ir_node *new_Raise (ir_node *store, ir_node *obj);
312 * ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
313 * ir_node *new_Pin (ir_node *node);
315 * void add_immBlock_pred (ir_node *block, ir_node *jmp);
316 * void mature_immBlock (ir_node *block);
317 * void set_cur_block (ir_node *target);
318 * ir_node *get_value (int pos, ir_mode *mode);
319 * void set_value (int pos, ir_node *value);
320 * ir_node *get_store (void);
321 * void set_store (ir_node *store);
322 * keep_alive (ir_node ka)
324 * IR_NODES AND CONSTRUCTORS FOR IR_NODES
325 * =======================================
327 * All ir_nodes are defined by a common data structure. They are distinguished
328 * by their opcode and differ in the number of their attributes.
330 * The constructor for the block node sets current_block to itself.
331 * Const nodes are always added to the start block.
332 * All other constructors add the created node to the current_block.
333 * swich_block(block) allows to set the current block to block.
335 * Watch for my inconsistent use of input and predecessor (dataflow view)
336 * and `the node points to' (implementation view).
338 * The following description of the nodes lists four properties them if these
340 * - the parameters to the constructor
341 * - the inputs of the Firm node
342 * - the outputs of the Firm node
343 * - attributes to the node
347 * ir_node *new_immBlock (void)
348 * ----------------------------
350 * Creates a new block. When a new block is created it cannot be known how
351 * many predecessors this block will have in the control flow graph.
352 * Therefore the list of inputs can not be fixed at creation. Predecessors
353 * can be added with add_immBlock_pred (block, control flow operation).
354 * With every added predecessor the number of inputs to Phi nodes also
357 * The block can be completed by mature_immBlock(block) if all predecessors are
358 * known. If several blocks are built at once, mature_immBlock can only be called
359 * after set_value has been called for all values that are life at the end
360 * of the block. This is necessary so that Phi nodes created mature_immBlock
361 * get the right predecessors in case of cyclic dependencies. If all set_values
362 * of this block are called after maturing it and before calling get_value
363 * in some block that is control flow dependent on this block, the construction
366 * Example for faulty IR construction: (draw the graph on a paper and you'll
369 * block_before_loop = new_immBlock();
370 * set_cur_block(block_before_loop);
372 * mature_immBlock(block_before_loop);
373 * before2header = new_Jmp;
375 * loop_header = new_immBlock ();
376 * set_cur_block(loop_header);
377 * header2body - new_Jmp();
379 * loop_body = new_immBlock ();
380 * set_cur_block(loop_body);
381 * body2header = new_Jmp();
383 * add_immBlock_pred(loop_header, before2header);
384 * add_immBlock_pred(loop_header, body2header);
385 * add_immBlock_pred(loop_body, header2body);
387 * mature_immBlock(loop_header);
388 * mature_immBlock(loop_body);
390 * get_value(loop_body, x); // gets the Phi in loop_header
391 * set_value(loop_header, x); // sets the value the above get_value should
392 * // have returned!!!
394 * Mature_immBlock also fixes the number of inputs to the Phi nodes. Mature_immBlock
395 * should be called as early as possible, as afterwards the generation of Phi
396 * nodes is more efficient.
399 * There is an input for each control flow predecessor of the block.
400 * The input points to an instruction producing an output of type X.
401 * Possible predecessors: Start, Jmp, Cond, Raise or Return or any node
402 * possibly causing an exception. (Often the real predecessors are Projs.)
404 * Mode BB (R), all nodes belonging to this block should consume this output.
405 * As they are strict (except Block and Phi node) it is a necessary condition
406 * that the block node executed before any other node in this block executes.
408 * block.matured Indicates whether the block is mature.
410 * This attribute contains all local values valid in this
411 * block. This is needed to build the Phi nodes and removed
412 * if the graph is complete. This field is used by the
413 * internal construction algorithm and should not be accessed
417 * ir_node *new_Block (int arity, ir_node **in)
418 * --------------------------------------------
420 * Creates a new Block with the given list of predecessors. This block
421 * is mature. As other constructors calls optimization and vrfy for the
422 * block. If one of the predecessors is Unknown (as it has to be filled in
423 * later) optimizations are skipped. This is necessary to
424 * construct Blocks in loops. Leaving Unknown in the Block after finishing
425 * the construction may have strange effects, especially for interprocedural
426 * representation and analysis.
429 * CONTROL FLOW OPERATIONS
430 * -----------------------
432 * In each block there must be exactly one of the control flow
433 * operations Start, End, Jmp, Cond, Return or Raise. The output of a
434 * control flow operation points to the block to be executed next.
436 * ir_node *new_Start (void)
437 * -------------------------
439 * Creates a start node. Not actually needed public. There is only one such
440 * node in each procedure which is automatically created by new_ir_graph.
443 * No inputs except the block it belogns to.
445 * A tuple of 4 (5, 6) distinct values. These are labeled by the following
446 * projection numbers (pn_Start):
447 * * pn_Start_X_initial_exec mode X, points to the first block to be exe * cuted.
448 * * pn_Start_M mode M, the global store
449 * * pn_Start_P_frame_base mode P, a pointer to the base of the proce * dures stack frame.
450 * * pn_Start_P_globals mode P, a pointer to the part of the memory * containing_all_ global things.
451 * * pn_Start_T_args mode T, a tuple containing all arguments of * the procedure.
454 * ir_node *new_End (void)
455 * -----------------------
457 * Creates an end node. Not actually needed public. There is only one such
458 * node in each procedure which is automatically created by new_ir_graph.
461 * No inputs except the block it belongs to.
465 * ir_node *new_Jmp (void)
466 * -----------------------
468 * Creates a Jmp node.
471 * The block the node belongs to
473 * Control flow to the next block.
475 * ir_node *new_IJmp (ir_node *tgt)
476 * -----------------------
478 * Creates an IJmp node.
481 * The node that represents the target jump address
483 * Control flow to an unknown target, must be pinned by
486 * ir_node *new_Cond (ir_node *c)
487 * ------------------------------
489 * Creates a Cond node. There are two versions of this node.
495 * A tuple of two control flows. The first is taken if the input is
496 * false, the second if it is true.
500 * A value of mode I_u. (i)
502 * A tuple of n control flows. If the Cond's input is i, control
503 * flow will procede along output i. If the input is >= n control
504 * flow proceeds along output n.
506 * ir_node *new_Return (ir_node *store, int arity, ir_node **in)
507 * -------------------------------------------------------------
509 * The return node has as inputs the results of the procedure. It
510 * passes the control flow to the end_block.
516 * Control flow to the end block.
520 * ir_node *new_Const (tarval *con)
521 * -----------------------------------------------
523 * Creates a constant in the constant table and adds a Const node
524 * returning this value to the start block. The mode is derived
528 * *con Points to an entry in the constant table.
529 * This pointer is added to the attributes of
530 * the node (self->attr.con)
532 * No inputs except the block it belogns to.
534 * The constant value.
536 * attr.con A tarval* pointer to the proper entry in the constant
539 * ir_node *new_SymConst (ir_mode *mode,union symconst_symbol value, symconst_addr_ent kind)
540 * -----------------------------------------------------------------------------------------
542 * There are three five of symbolic constants:
543 * symconst_type_tag The symbolic constant represents a type tag.
544 * symconst_type_size The symbolic constant represents the size of a type.
545 * symconst_type_align The symbolic constant represents the alignment of a type.
546 * symconst_addr_name Information for the linker, e.g. the name of a global
548 * symconst_addr_ent The symbolic constant represents the address of an entity.
550 * To represent a pointer to an entity that is represented by an entity
551 * datastructure don't use
552 * new_SymConst((type_or_id*)get_entity_ld_ident(ent), symconst_addr_name);.
553 * Use a real const instead:
554 * new_SymConst(ent, symconst_addr_ent);
555 * This makes the Constant independent of name changes of the entity due to
559 * kind The kind of the symbolic constant: type_tag, size or link_info.
560 * *type_or_id Points to the type the tag stands for or to the type
561 * whose size is represented by the constant or to an ident
562 * representing the linkage info.
565 * No inputs except the block it belongs to.
567 * A symbolic constant.
570 * attr.i.num The symconst_addr_ent, i.e. one of
572 * -symconst_type_size
573 * -symconst_type_align
574 * -symconst_addr_name
577 * If the attr.i.num is symconst_type_tag, symconst_type_size or symconst_type_align,
578 * the node contains an attribute:
580 * attr.i.*type, a pointer to a type_class.
581 * if it is linkage_ptr_info it contains
582 * attr.i.*ptrinfo, an ident holding information for the linker.
586 * ir_node *new_simpleSel (ir_node *store, ir_node *frame, ir_entity *sel)
587 * -----------------------------------------------------------------------
590 * Selects an entity from a compound type. This entity can be a field or
594 * *store The memory in which the object the entity should be selected
596 * *frame The pointer to the object.
597 * *sel The entity to select.
600 * The memory containing the object.
601 * A pointer to the object.
602 * An unsigned integer.
604 * A pointer to the selected entity.
606 * attr.sel Pointer to the entity
609 * ir_node *new_Sel (ir_node *store, ir_node *frame, int arity, ir_node **in,
610 * --------------------------------------------------------------------------
614 * Selects a field from an array type. The entity has as owner the array, as
615 * type the arrays element type. The indices to access an array element are
619 * *store The memory in which the object the entity should be selected from
621 * *frame The pointer to the object.
622 * *arity number of array indices.
623 * *in array with index inputs to the node.
624 * *sel The entity to select.
627 * The memory containing the object.
628 * A pointer to the object.
629 * As much unsigned integer as there are array expressions.
631 * A pointer to the selected entity.
633 * attr.sel Pointer to the entity
635 * The constructors new_Sel and new_simpleSel generate the same IR nodes.
636 * simpleSel just sets the arity of the index inputs to zero.
639 * ARITHMETIC OPERATIONS
640 * ---------------------
642 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node **in,
643 * ----------------------------------------------------------------------------
647 * Creates a procedure call.
650 * *store The actual store.
651 * *callee A pointer to the called procedure.
652 * arity The number of procedure parameters.
653 * **in An array with the pointers to the parameters.
654 * The constructor copies this array.
655 * *type Type information of the procedure called.
658 * The store, the callee and the parameters.
660 * A tuple containing the eventually changed store and the procedure
663 * attr.call Contains the attributes for the procedure.
665 * ir_node *new_Builtin(ir_node *store, ir_builtin_kind kind, int arity, ir_node **in,
666 * -----------------------------------------------------------------------------------
670 * Creates a builtin call.
673 * *store The actual store.
674 * kind Describes the called builtin.
675 * arity The number of procedure parameters.
676 * **in An array with the pointers to the parameters.
677 * The constructor copies this array.
678 * *type Type information of the procedure called.
681 * The store, the kind and the parameters.
683 * A tuple containing the eventually changed store and the procedure
686 * attr.builtin Contains the attributes for the called builtin.
688 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode)
689 * ------------------------------------------------------------
693 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode)
694 * ------------------------------------------------------------
698 * ir_node *new_Minus (ir_node *op, ir_mode *mode)
699 * -----------------------------------------------
701 * Unary Minus operations on integer and floating point values.
703 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode)
704 * ------------------------------------------------------------
708 * ir_node *new_Mulh (ir_node *op1, ir_node *op2, ir_mode *mode)
709 * ------------------------------------------------------------
711 * Returns the high order bits of a n*n=2n multiplication.
713 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state)
714 * -------------------------------------------------------------------------------------------------
716 * Quot performs exact division of floating point numbers. It's mode
717 * is Tuple, the mode of the result must match the Proj mode
718 * that extracts the result of the arithmetic operations.
721 * The store needed to model exceptions and the two operands.
723 * A tuple containing a memory and a execution for modeling exceptions
724 * and the result of the arithmetic operation.
726 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state)
727 * ---------------------------------------------------------------------------------------------------
729 * Performs Div and Mod on integer values.
732 * A tuple containing a memory and a execution for modeling exceptions
733 * and the two result of the arithmetic operations.
735 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state)
736 * ------------------------------------------------------------------------------------------------
740 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state)
741 * ------------------------------------------------------------------------------------------------
745 * ir_node *new_Abs (ir_node *op, ir_mode *mode)
746 * ---------------------------------------------
750 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode)
751 * ------------------------------------------------------------
755 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode)
756 * -----------------------------------------------------------
760 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode)
761 * ------------------------------------------------------------
765 * ir_node *new_Not (ir_node *op, ir_mode *mode)
766 * ---------------------------------------------
768 * This node constructs a constant where all bits are set to one
769 * and a Eor of this constant and the operator. This simulates a
772 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode)
773 * ---------------------------------------------------------
777 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode)
778 * ---------------------------------------------------------
780 * Logic shift right, i.e., zero extended.
783 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode)
784 * ----------------------------------------------------------
786 * Arithmetic shift right, i.e., sign extended.
788 * ir_node *new_Rotl (ir_node *op, ir_node *k, ir_mode *mode)
789 * ---------------------------------------------------------
791 * Rotates the operand to the left by k bits.
793 * ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode)
794 * ------------------------------------------------------------
796 * Calculates the Carry value for integer addition. Used only
799 * ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode)
800 * ------------------------------------------------------------
802 * Calculates the Borrow value for integer substraction. Used only
805 * ir_node *new_Conv (ir_node *op, ir_mode *mode)
806 * ---------------------------------------------
808 * Mode conversion. For allowed conversions see UKA Tech Report
811 * ir_node *new_Cmp (ir_node *op1, ir_node *op2)
812 * ---------------------------------------------
815 * The two values to be compared.
817 * A 16-tuple containing the results of the 16 different comparisons.
818 * The following is a list giving the comparisons and a projection
819 * number (pn_Cmp) to use in Proj nodes to extract the proper result.
823 * pn_Cmp_Le less or equal
825 * pn_Cmp_Ge greater of equal
826 * pn_Cmp_Lg less or greater
827 * pn_Cmp_Leg less, equal or greater = ordered
828 * pn_Cmp_Uo unordered
829 * pn_Cmp_Ue unordered or equal
830 * pn_Cmp_Ul unordered or less
831 * pn_Cmp_Ule unordered, less or equal
832 * pn_Cmp_Ug unordered or greater
833 * pn_Cmp_Uge unordered, greater or equal
834 * pn_Cmp_Ne unordered, less or greater = not equal
841 * In general, Phi nodes are automaitcally inserted. In some cases, if
842 * all predecessors of a block are known, an explicit Phi node constructor
843 * is needed. E.g., to construct a FIRM graph for a statement as
844 * a = (b==c) ? 2 : 5;
846 * ir_node *new_Phi (int arity, ir_node **in, ir_mode *mode)
847 * ---------------------------------------------------------
849 * Creates a Phi node. The in's order has to correspond to the order
850 * of in's of current_block. This is not checked by the library!
851 * If one of the predecessors is Unknown (as it has to be filled in
852 * later) optimizations are skipped. This is necessary to
853 * construct Phi nodes in loops. Leaving Unknown in the Phi after finishing
854 * the construction may have strange effects, especially for interprocedural
855 * representation and analysis.
858 * arity number of predecessors
859 * **in array with predecessors
860 * *mode The mode of it's inputs and output.
862 * A Phi node has as many inputs as the block it belongs to.
863 * Each input points to a definition of the same value on a
864 * different path in the control flow.
866 * The definition valid in this block.
868 * ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode)
869 * -----------------------------------------------------------------------------------
871 * Creates a Mux node. This node implements the following semantic:
872 * If the sel node (which must be of mode_b) evaluates to true, its value is
873 * ir_true, else ir_false;
877 * OPERATIONS TO MANAGE MEMORY EXPLICITLY
878 * --------------------------------------
880 * ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode, ir_cons_flags flags)
881 * -------------------------------------------------------------------------------------
883 * The Load operation reads a value from memory.
886 * *store The current memory.
887 * *addr A pointer to the variable to be read in this memory.
888 * *mode The mode of the value to be loaded.
889 * flags Additional flags for alignment, volatility and pin state.
892 * The memory and a pointer to a variable in this memory.
894 * A tuple of the memory, a control flow to be taken in case of
895 * an exception and the loaded value.
897 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val, ir_cons_flags flags)
898 * -------------------------------------------------------------------------------------
900 * The Store operation writes a value to a variable in memory.
903 * The memory, a pointer to a variable in this memory and the value
904 * to write to this variable.
906 * A tuple of the changed memory and a control flow to be taken in
907 * case of an exception.
909 * ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
910 * -----------------------------------------------------------------------
914 * The Alloc node allocates a new variable. It can be specified whether the
915 * variable should be allocated to the stack or to the heap.
918 * *store The memory which shall contain the new variable.
919 * ** *size The number of bytes to allocate. Old. **
920 * *size We decided that the size easily can be derived from the type.
921 * This field is for allocating arrays, i.e., it gives the multiple
922 * of the size of alloc_type to allocate memory for.
923 * *alloc_type The type of the allocated variable.
924 * where Where to allocate the variable, either heap_alloc or stack_alloc.
927 * A memory and an unsigned integer.
929 * A tuple of the changed memory, a control flow to be taken in
930 * case of an exception and the pointer to the new variable.
932 * a.where Indicates where the variable is allocated.
933 * a.*type A pointer to the class the allocated data object
936 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size, ir_type *free_type,
937 * -----------------------------------------------------------------------------------
941 * The Free node frees memory of the given variable.
944 * *store The memory which shall contain the new variable.
945 * *ptr The pointer to the object to free.
946 * *size The number of objects of type free_type to free in a sequence.
947 * *free_type The type of the freed variable.
948 * where Where the variable was allocated, either heap_alloc or stack_alloc.
951 * A memory, a pointer and an unsigned integer.
953 * The changed memory.
955 * f.*type A pointer to the type information of the freed data object.
959 * ir_node *new_Sync (int arity, ir_node **in)
960 * -------------------------------------------
962 * The Sync operation unifies several partial memory blocks. These blocks
963 * have to be pairwise disjunct or the values in common locations have to
964 * be identical. This operation allows to specify all operations that eventually
965 * need several partial memory blocks as input with a single entrance by
966 * unifying the memories with a preceding Sync operation.
969 * arity The number of memories to synchronize.
970 * **in An array of pointers to nodes that produce an output of
975 * The unified memory.
981 * ir_node *new_Bad (void)
982 * -----------------------
984 * Returns the unique Bad node current_ir_graph->bad.
985 * This node is used to express results of dead code elimination.
987 * ir_node *new_NoMem (void)
988 * -----------------------------------------------------------------------------------
990 * Returns the unique NoMem node current_ir_graph->no_mem.
991 * This node is used as input for operations that need a Memory, but do not
992 * change it like Div by const != 0, analyzed calls etc.
994 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj)
995 * ----------------------------------------------------------
997 * Selects one entry of a tuple. This is a hidden edge with attributes.
1000 * *arg A node producing a tuple.
1001 * *mode The mode of the value to project.
1002 * proj The position of the value in the tuple.
1008 * ir_node *new_Tuple (int arity, ir_node **in)
1009 * --------------------------------------------
1011 * Builds a Tuple from single values. This is needed to implement
1012 * optimizations that remove a node that produced a tuple. The node can be
1013 * replaced by the Tuple operation so that the following Proj nodes have not to
1014 * be changed. (They are hard to find due to the implementation with pointers
1015 * in only one direction.) The Tuple node is smaller than any other
1016 * node, so that a node can be changed into a Tuple by just changing it's
1017 * opcode and giving it a new in array.
1020 * arity The number of tuple elements.
1021 * **in An array containing pointers to the nodes producing the
1024 * ir_node *new_Id (ir_node *val, ir_mode *mode)
1025 * ---------------------------------------------
1027 * The single output of the Id operation is it's input. Also needed
1028 * for optimizations.
1031 * HIGH LEVEL OPERATIONS
1032 * ---------------------
1034 * ir_node *new_CopyB (ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type)
1035 * -----------------------------------------------------------------------------------
1037 * Describes a high level block copy of a compound type from address src to
1038 * address dst. Must be lowered to a Call to a runtime memory copy function.
1041 * HIGH LEVEL OPERATIONS: Exception Support
1042 * ----------------------------------------
1043 * See TechReport 1999-14, chapter Exceptions.
1045 * ir_node *new_InstOf(ir_node *store, ir_node *ptr, ir_type *type);
1046 * -----------------------------------------------------------------------------------
1048 * Describes a high level type check. Must be lowered to a Call to a runtime check
1051 * ir_node *new_Raise (ir_node *store, ir_node *obj)
1052 * -------------------------------------------------
1054 * Raises an exception. Unconditional change of control flow. Writes
1055 * an explicit Except variable to memory to pass it to the exception
1056 * handler. Must be lowered to a Call to a runtime check
1061 * A pointer to the Except variable.
1063 * A tuple of control flow and the changed memory state. The control flow
1064 * points to the exception handler if it is definied in this procedure,
1065 * else it points to the end_block.
1067 * ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
1068 * -----------------------------------------------------------------------------------
1070 * Describes a high level bounds check. Must be lowered to a Call to a runtime check
1073 * ir_node *new_Pin (ir_node *node);
1074 * -----------------------------------------------------------------------------------
1076 * Pin the value of the node node in the current block No users of the Pin node can
1077 * float above the Block of the Pin. The node cannot float behind this block. Often
1078 * used to Pin the NoMem node.
1081 * COPING WITH DATA OBJECTS
1082 * ========================
1084 * Two kinds of data objects have to be distinguished for generating
1085 * FIRM. First there are local variables other than arrays that are
1086 * known to be alias free. Second there are all other data objects.
1087 * For the first a common SSA representation is built, the second
1088 * are modeled by saving them to memory. The memory is treated as
1089 * a single local variable, the alias problem is hidden in the
1090 * content of this variable.
1092 * All values known in a Block are listed in the block's attribute,
1093 * block.**graph_arr which is used to automatically insert Phi nodes.
1094 * The following two functions can be used to add a newly computed value
1095 * to the array, or to get the producer of a value, i.e., the current
1098 * inline void set_value (int pos, ir_node *value)
1099 * -----------------------------------------------
1101 * Has to be called for every assignment to a local variable. It
1102 * adds the value to the array of used values at position pos. Pos
1103 * has to be a unique identifier for an entry in the procedure's
1104 * definition table. It can be used to access the value again.
1105 * Requires current_block to be set correctly.
1107 * ir_node *get_value (int pos, ir_mode *mode)
1108 * -------------------------------------------
1110 * Returns the node defining the value referred to by pos. If the
1111 * value is not defined in this block a Phi node is generated and
1112 * all definitions reaching this Phi node are collected. It can
1113 * happen that the algorithm allocates an unnecessary Phi node,
1114 * e.g. if there is only one definition of this value, but this
1115 * definition reaches the currend block on several different
1116 * paths. This Phi node will be eliminated if optimizations are
1117 * turned on right after it's creation.
1118 * Requires current_block to be set correctly.
1120 * There are two special routines for the global store:
1122 * void set_store (ir_node *store)
1123 * -------------------------------
1125 * Adds the store to the array of known values at a reserved
1127 * Requires current_block to be set correctly.
1129 * ir_node *get_store (void)
1130 * -------------------------
1132 * Returns the node defining the actual store.
1133 * Requires current_block to be set correctly.
1136 * inline void keep_alive (ir_node *ka)
1137 * ------------------------------------
1139 * Keep this node alive because it is (might be) not in the control
1140 * flow from Start to End. Adds the node to the list in the end
1144 #ifndef FIRM_IR_IRCONS_H
1145 #define FIRM_IR_IRCONS_H
1147 #include "firm_types.h"
1150 * constrained flags for memory operations.
1152 typedef enum ir_cons_flags {
1153 cons_none = 0, /**< No constrains. */
1154 cons_volatile = 1U << 0, /**< Memory operation is volatile. */
1155 cons_unaligned = 1U << 1, /**< Memory operation is unaligned. */
1156 cons_floats = 1U << 2 /**< Memory operation can float. */
1159 /*-------------------------------------------------------------------------*/
1160 /* The raw interface */
1161 /*-------------------------------------------------------------------------*/
1163 /** Constructor for a Block node.
1165 * Constructs a mature block with the given predecessors. Use Unknown
1166 * nodes as predecessors to construct a block if the number of
1167 * predecessors is known, but not the predecessors themselves. This
1168 * constructor does not set current_block. It not be used with
1169 * automatic Phi node construction.
1171 * @param *db A Pointer for debug information.
1172 * @param irg The IR graph the block belongs to.
1173 * @param arity The number of control predecessors.
1174 * @param in[] An array of control predecessors. The length of
1175 * the array must be 'arity'. The constructor copies this array.
1177 ir_node *new_rd_Block (dbg_info *db, ir_graph *irg, int arity, ir_node *in[]);
1179 /** Constructor for a Start node.
1181 * @param *db A pointer for debug information.
1182 * @param *irg The IR graph the node belongs to.
1183 * @param *block The IR block the node belongs to.
1185 ir_node *new_rd_Start (dbg_info *db, ir_graph *irg, ir_node *block);
1187 /** Constructor for a End node.
1189 * @param *db A pointer for debug information.
1190 * @param *irg The IR graph the node belongs to.
1191 * @param *block The IR block the node belongs to.
1193 ir_node *new_rd_End (dbg_info *db, ir_graph *irg, ir_node *block);
1195 /** Constructor for a Jmp node.
1197 * Jmp represents control flow to a single control successor.
1199 * @param *db A pointer for debug information.
1200 * @param *irg The IR graph the node belongs to.
1201 * @param *block The IR block the node belongs to.
1203 ir_node *new_rd_Jmp (dbg_info *db, ir_graph *irg, ir_node *block);
1205 /** Constructor for an IJmp node.
1207 * IJmp represents control flow to a single control successor not
1208 * statically known i.e. an indirect Jmp.
1210 * @param *db A pointer for debug information.
1211 * @param *irg The IR graph the node belongs to.
1212 * @param *block The IR block the node belongs to.
1213 * @param *tgt The IR node representing the target address.
1215 ir_node *new_rd_IJmp (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *tgt);
1217 /** Constructor for a Break node.
1219 * Break represents control flow to a single control successor just as Jmp.
1220 * The blocks separated by a break may not be concatenated by an optimization.
1221 * It is used for the interprocedural representation where blocks are parted
1222 * behind Call nodes to represent the control flow to called procedures.
1224 * @param *db A pointer for debug information.
1225 * @param *irg The IR graph the node belong to.
1226 * @param *block The block the node belong to.
1228 ir_node *new_rd_Break (dbg_info *db, ir_graph *irg, ir_node *block);
1230 /** Constructor for a Cond node.
1232 * If c is mode_b represents a conditional branch (if/else). If c is
1233 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
1234 * node, default Proj is 0.)
1236 * This is not consistent: Input to Cond is Is, Proj has as proj number
1239 * @param *db A pointer for debug information.
1240 * @param *irg The IR graph the node belongs to.
1241 * @param *block The IR block the node belongs to.
1242 * @param *c The conditions parameter. Can be of mode b or I_u.
1244 ir_node *new_rd_Cond (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *c);
1246 /** Constructor for a Return node.
1248 * Returns the memory and zero or more return values. Only node that
1249 * can end regular control flow.
1251 * @param *db A pointer for debug information.
1252 * @param *irg The IR graph the node belongs to.
1253 * @param *block The IR block the node belongs to.
1254 * @param *store The state of memory.
1255 * @param arity Number of return values.
1256 * @param *in Array of length arity with return values. The constructor copies this array.
1258 ir_node *new_rd_Return (dbg_info *db, ir_graph *irg, ir_node *block,
1259 ir_node *store, int arity, ir_node *in[]);
1261 /** Constructor for a Const_type node.
1263 * Adds the node to the start block.
1265 * The constant represents a target value. This constructor sets high
1266 * level type information for the constant value.
1267 * Derives mode from passed tarval.
1269 * @param *db A pointer for debug information.
1270 * @param *irg The IR graph the node belongs to.
1271 * @param *con Points to an entry in the constant table.
1272 * @param *tp The type of the constant.
1274 ir_node *new_rd_Const_type (dbg_info *db, ir_graph *irg,
1275 tarval *con, ir_type *tp);
1277 /** Constructor for a Const node.
1279 * Adds the node to the start block.
1281 * Constructor for a Const node. The constant represents a target
1282 * value. Sets the type information to type_unknown. (No more
1283 * supported: If tv is entity derives a somehow useful type.)
1284 * Derives mode from passed tarval.
1286 * @param *db A pointer for debug information.
1287 * @param *irg The IR graph the node belongs to.
1288 * @param *con Points to an entry in the constant table.
1290 ir_node *new_rd_Const (dbg_info *db, ir_graph *irg, tarval *con);
1292 /** Constructor for a Const node.
1294 * Adds the node to the start block.
1296 * Constructor for a Const node. The constant represents a target
1297 * value. Sets the type information to type_unknown. (No more
1298 * supported: If tv is entity derives a somehow useful type.)
1300 * @param *db A pointer for debug information.
1301 * @param *irg The IR graph the node belongs to.
1302 * @param *mode The mode of the operands and results.
1303 * @param value A value from which the tarval is made.
1305 ir_node *new_rd_Const_long (dbg_info *db, ir_graph *irg,
1306 ir_mode *mode, long value);
1308 /** Constructor for a SymConst_type node.
1310 * This is the constructor for a symbolic constant.
1311 * There are four kinds of symbolic constants:
1312 * - type_tag The symbolic constant represents a type tag. The type the
1313 * tag stands for is given explicitly.
1314 * - type_size The symbolic constant represents the size of a type. The
1315 * type of which the constant represents the size is given
1317 * - type_align The symbolic constant represents the alignment of a type. The
1318 * type of which the constant represents the size is given
1320 * - addr_name The symbolic constant represents the address of an entity
1321 * (variable or method). The variable is indicated by a name
1322 * that is valid for linking.
1323 * - addr_ent The symbolic constant represents the address of an entity
1324 * (variable or method). The variable is given explicitly by
1327 * Inputs to the node:
1328 * No inputs except the block it belongs to.
1329 * Outputs of the node.
1330 * An unsigned integer (I_u) or a pointer (P).
1332 * Mention union in declaration so that the firmjni generator recognizes that
1333 * it can not cast the argument to an int.
1335 * @param *db A pointer for debug information.
1336 * @param *irg The IR graph the node belongs to.
1337 * @param *block The IR block the node belongs to.
1338 * @param mode The mode for the SymConst.
1339 * @param symkind The kind of the symbolic constant: type_tag, size, addr_name or addr_ent.
1340 * @param value A type, entity or a ident depending on the SymConst kind.
1341 * @param tp The source type of the constant.
1343 ir_node *new_rd_SymConst_type(dbg_info *db, ir_graph *irg, ir_node *block, ir_mode *mode,
1344 union symconst_symbol value,
1345 symconst_kind symkind, ir_type *tp);
1347 /** Constructor for a SymConst node.
1349 * Same as new_rd_SymConst_type, except that it sets the type to type_unknown.
1351 ir_node *new_rd_SymConst(dbg_info *db, ir_graph *irg, ir_node *block, ir_mode *mode,
1352 union symconst_symbol value, symconst_kind symkind);
1354 /** Constructor for a SymConst addr_ent node.
1356 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1357 * symconst_addr_ent.
1358 * Adds the SymConst to the start block of irg. */
1359 ir_node *new_rd_SymConst_addr_ent(dbg_info *db, ir_graph *irg, ir_mode *mode,
1360 ir_entity *symbol, ir_type *tp);
1362 /** Constructor for a SymConst ofs_ent node.
1364 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1366 * Adds the SymConst to the start block of irg.
1368 ir_node *new_rd_SymConst_ofs_ent(dbg_info *db, ir_graph *irg, ir_mode *mode,
1369 ir_entity *symbol, ir_type *tp);
1371 /** Constructor for a SymConst addr_name node.
1373 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1374 * symconst_addr_ent.
1375 * Adds the SymConst to the start block of irg.
1377 ir_node *new_rd_SymConst_addr_name(dbg_info *db, ir_graph *irg, ir_mode *mode,
1378 ident *symbol, ir_type *tp);
1380 /** Constructor for a SymConst type_tag node.
1382 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1383 * symconst_addr_ent.
1384 * Adds the SymConst to the start block of irg.
1386 ir_node *new_rd_SymConst_type_tag(dbg_info *db, ir_graph *irg, ir_mode *mode,
1387 ir_type *symbol, ir_type *tp);
1389 /** Constructor for a SymConst size node.
1391 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1392 * symconst_type_size.
1393 * Adds the SymConst to the start block of irg. */
1394 ir_node *new_rd_SymConst_size(dbg_info *db, ir_graph *irg, ir_mode *mode,
1395 ir_type *symbol, ir_type *tp);
1397 /** Constructor for a SymConst size node.
1399 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1400 * symconst_type_align.
1401 * Adds the SymConst to the start block of irg.
1403 ir_node *new_rd_SymConst_align(dbg_info *db, ir_graph *irg, ir_mode *mode,
1404 ir_type *symbol, ir_type *tp);
1406 /** Constructor for a simpleSel node.
1408 * This is a shortcut for the new_rd_Sel() constructor. To be used for
1409 * Sel nodes that do not select from an array, i.e., have no index
1410 * inputs. It adds the two parameters 0, NULL.
1412 * @param *db A pointer for debug information.
1413 * @param *irg The IR graph the node belongs to.
1414 * @param *block The IR block the node belongs to.
1415 * @param *store The memory in which the object the entity should be
1416 * selected from is allocated.
1417 * @param *objptr The object from that the Sel operation selects a
1418 * single attribute out.
1419 * @param *ent The entity to select.
1421 ir_node *new_rd_simpleSel (dbg_info *db, ir_graph *irg, ir_node *block,
1422 ir_node *store, ir_node *objptr, ir_entity *ent);
1424 /** Constructor for a Sel node.
1426 * The select node selects an entity (field or method) from an entity
1427 * with a compound type. It explicitly specifies the entity selected.
1428 * Dynamically the node may select entities that overwrite the given
1429 * entity. If the selected entity is an array element entity the Sel
1430 * node takes the required array indices as inputs.
1432 * @param *db A pointer for debug information.
1433 * @param *irg The IR graph the node belongs to.
1434 * @param *block The IR block the node belongs to.
1435 * @param *store The memory in which the object the entity should be selected
1436 * from is allocated.
1437 * @param *objptr A pointer to a compound entity the Sel operation selects a
1438 * single attribute from.
1439 * @param *n_index The number of array indices needed to select an array element entity.
1440 * @param *index[] If the compound entity is an array the indices of the selected
1441 * element entity. The constructor copies this array.
1442 * @param *ent The entity to select.
1444 ir_node *new_rd_Sel (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1445 ir_node *objptr, int n_index, ir_node *index[], ir_entity *ent);
1447 /** Constructor for a Call node.
1449 * Represents all kinds of method and function calls.
1451 * @param *db A pointer for debug information.
1452 * @param *irg The IR graph the node belongs to.
1453 * @param *block The IR block the node belongs to.
1454 * @param *store The current memory state.
1455 * @param *callee A pointer to the called procedure.
1456 * @param arity The number of procedure parameters.
1457 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1458 * @param *tp Type information of the procedure called.
1460 ir_node *new_rd_Call (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1461 ir_node *callee, int arity, ir_node *in[], ir_type *tp);
1463 /** Constructor for a ´Builtin node.
1465 * Represents a call of a backend-specific builtin..
1467 * @param *db A pointer for debug information.
1468 * @param *irg The IR graph the node belongs to.
1469 * @param *block The IR block the node belongs to.
1470 * @param *store The current memory state.
1471 * @param arity The number of procedure parameters.
1472 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1473 * @param kind The kind of the called builtin.
1474 * @param *tp Type information of the procedure called.
1476 ir_node *new_rd_Builtin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1477 int arity, ir_node *in[], ir_builtin_kind kind, ir_type *tp);
1479 /** Constructor for a Add node.
1481 * @param *db A pointer for debug information.
1482 * @param *irg The IR graph the node belongs to.
1483 * @param *block The IR block the node belongs to.
1484 * @param *op1 The first operand.
1485 * @param *op2 The second operand.
1486 * @param *mode The mode of the operands and the result.
1488 ir_node *new_rd_Add (dbg_info *db, ir_graph *irg, ir_node *block,
1489 ir_node *op1, ir_node *op2, ir_mode *mode);
1491 /** Constructor for a Sub node.
1493 * @param *db A pointer for debug information.
1494 * @param *irg The IR graph the node belongs to.
1495 * @param *block The IR block the node belongs to.
1496 * @param *op1 The first operand.
1497 * @param *op2 The second operand.
1498 * @param *mode The mode of the operands and the result.
1500 ir_node *new_rd_Sub (dbg_info *db, ir_graph *irg, ir_node *block,
1501 ir_node *op1, ir_node *op2, ir_mode *mode);
1503 /** Constructor for a Minus node.
1505 * @param *db A pointer for debug information.
1506 * @param *irg The IR graph the node belongs to.
1507 * @param *block The IR block the node belongs to.
1508 * @param *op The operand .
1509 * @param *mode The mode of the operand and the result.
1511 ir_node *new_rd_Minus (dbg_info *db, ir_graph *irg, ir_node *block,
1512 ir_node *op, ir_mode *mode);
1514 /** Constructor for a Mul node.
1516 * @param *db A pointer for debug information.
1517 * @param *irg The IR graph the node belongs to.
1518 * @param *block The IR block the node belongs to.
1519 * @param *op1 The first operand.
1520 * @param *op2 The second operand.
1521 * @param *mode The mode of the operands and the result.
1523 ir_node *new_rd_Mul (dbg_info *db, ir_graph *irg, ir_node *block,
1524 ir_node *op1, ir_node *op2, ir_mode *mode);
1526 /** Constructor for a Mulh node.
1528 * @param *db A pointer for debug information.
1529 * @param *irg The IR graph the node belongs to.
1530 * @param *block The IR block the node belongs to.
1531 * @param *op1 The first operand.
1532 * @param *op2 The second operand.
1533 * @param *mode The mode of the operands and the result.
1535 ir_node *new_rd_Mulh (dbg_info *db, ir_graph *irg, ir_node *block,
1536 ir_node *op1, ir_node *op2, ir_mode *mode);
1538 /** Constructor for a Quot node.
1540 * @param *db A pointer for debug information.
1541 * @param *irg The IR graph the node belongs to.
1542 * @param *block The IR block the node belongs to.
1543 * @param *memop The store needed to model exceptions
1544 * @param *op1 The first operand.
1545 * @param *op2 The second operand.
1546 * @param *mode The mode of the result.
1547 * @param state The pinned state.
1549 ir_node *new_rd_Quot (dbg_info *db, ir_graph *irg, ir_node *block,
1550 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1552 /** Constructor for a DivMod node.
1554 * @param *db A pointer for debug information.
1555 * @param *irg The IR graph the node belongs to.
1556 * @param *block The IR block the node belongs to.
1557 * @param *memop The store needed to model exceptions
1558 * @param *op1 The first operand.
1559 * @param *op2 The second operand.
1560 * @param *mode The mode of the results.
1561 * @param state The pinned state.
1563 ir_node *new_rd_DivMod (dbg_info *db, ir_graph *irg, ir_node *block,
1564 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1566 /** Constructor for a Div node.
1568 * @param *db A pointer for debug information.
1569 * @param *irg The IR graph the node belongs to.
1570 * @param *block The IR block the node belongs to.
1571 * @param *memop The store needed to model exceptions
1572 * @param *op1 The first operand.
1573 * @param *op2 The second operand.
1574 * @param *mode The mode of the result.
1575 * @param state The pinned state.
1577 ir_node *new_rd_Div (dbg_info *db, ir_graph *irg, ir_node *block,
1578 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1580 /** Constructor for a remainderless Div node.
1582 * @param *db A pointer for debug information.
1583 * @param *irg The IR graph the node belongs to.
1584 * @param *block The IR block the node belongs to.
1585 * @param *memop The store needed to model exceptions
1586 * @param *op1 The first operand.
1587 * @param *op2 The second operand.
1588 * @param *mode The mode of the result.
1589 * @param state The pinned state.
1591 ir_node *new_rd_DivRL (dbg_info *db, ir_graph *irg, ir_node *block,
1592 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1594 /** Constructor for a Mod node.
1596 * @param *db A pointer for debug information.
1597 * @param *irg The IR graph the node belongs to.
1598 * @param *block The IR block the node belongs to.
1599 * @param *memop The store needed to model exceptions
1600 * @param *op1 The first operand.
1601 * @param *op2 The second operand.
1602 * @param *mode The mode of the result.
1603 * @param state The pinned state.
1605 ir_node *new_rd_Mod (dbg_info *db, ir_graph *irg, ir_node *block,
1606 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1608 /** Constructor for a Abs node.
1610 * @param *db A pointer for debug information.
1611 * @param *irg The IR graph the node belongs to.
1612 * @param *block The IR block the node belongs to.
1613 * @param *op The operand
1614 * @param *mode The mode of the operands and the result.
1616 ir_node *new_rd_Abs (dbg_info *db, ir_graph *irg, ir_node *block,
1617 ir_node *op, ir_mode *mode);
1619 /** Constructor for a And node.
1621 * @param *db A pointer for debug information.
1622 * @param *irg The IR graph the node belongs to.
1623 * @param *block The IR block the node belongs to.
1624 * @param *op1 The first operand.
1625 * @param *op2 The second operand.
1626 * @param *mode The mode of the operands and the result.
1628 ir_node *new_rd_And (dbg_info *db, ir_graph *irg, ir_node *block,
1629 ir_node *op1, ir_node *op2, ir_mode *mode);
1631 /** Constructor for a Or node.
1633 * @param *db A pointer for debug information.
1634 * @param *irg The IR graph the node belongs to.
1635 * @param *block The IR block the node belongs to.
1636 * @param *op1 The first operand.
1637 * @param *op2 The second operand.
1638 * @param *mode The mode of the operands and the result.
1640 ir_node *new_rd_Or (dbg_info *db, ir_graph *irg, ir_node *block,
1641 ir_node *op1, ir_node *op2, ir_mode *mode);
1643 /** Constructor for a Eor node.
1645 * @param *db A pointer for debug information.
1646 * @param *irg The IR graph the node belongs to.
1647 * @param *block The IR block the node belongs to.
1648 * @param *op1 The first operand.
1649 * @param *op2 The second operand.
1650 * @param *mode The mode of the operands and the results.
1652 ir_node *new_rd_Eor (dbg_info *db, ir_graph *irg, ir_node *block,
1653 ir_node *op1, ir_node *op2, ir_mode *mode);
1655 /** Constructor for a Not node.
1657 * @param *db A pointer for debug information.
1658 * @param *irg The IR graph the node belongs to.
1659 * @param *block The IR block the node belongs to.
1660 * @param *op The operand.
1661 * @param *mode The mode of the operand and the result.
1663 ir_node *new_rd_Not (dbg_info *db, ir_graph *irg, ir_node *block,
1664 ir_node *op, ir_mode *mode);
1666 /** Constructor for a Cmp node.
1668 * @param *db A pointer for debug information.
1669 * @param *irg The IR graph the node belongs to.
1670 * @param *block The IR block the node belongs to.
1671 * @param *op1 The first operand.
1672 * @param *op2 The second operand.
1674 ir_node *new_rd_Cmp (dbg_info *db, ir_graph *irg, ir_node *block,
1675 ir_node *op1, ir_node *op2);
1677 /** Constructor for a Shl node.
1679 * @param *db A pointer for debug information.
1680 * @param *irg The IR graph the node belongs to.
1681 * @param *block The IR block the node belongs to.
1682 * @param *op The operand.
1683 * @param *k The number of bits to shift the operand .
1684 * @param *mode The mode of the operand and the result.
1686 ir_node *new_rd_Shl (dbg_info *db, ir_graph *irg, ir_node *block,
1687 ir_node *op, ir_node *k, ir_mode *mode);
1689 /** Constructor for a Shr node.
1691 * @param *db A pointer for debug information.
1692 * @param *irg The IR graph the node belongs to.
1693 * @param *block The IR block the node belongs to.
1694 * @param *op The operand.
1695 * @param *k The number of bits to shift the operand .
1696 * @param *mode The mode of the operand and the result.
1698 ir_node *new_rd_Shr (dbg_info *db, ir_graph *irg, ir_node *block,
1699 ir_node *op, ir_node *k, ir_mode *mode);
1701 /** Constructor for a Shrs node.
1703 * @param *db A pointer for debug information.
1704 * @param *irg The IR graph the node belongs to.
1705 * @param *block The IR block the node belongs to.
1706 * @param *op The operand.
1707 * @param *k The number of bits to shift the operand.
1708 * @param *mode The mode of the operand and the result.
1710 ir_node *new_rd_Shrs (dbg_info *db, ir_graph *irg, ir_node *block,
1711 ir_node *op, ir_node *k, ir_mode *mode);
1713 /** Constructor for a Rotl node.
1715 * @param *db A pointer for debug information.
1716 * @param *irg The IR graph the node belongs to.
1717 * @param *block The IR block the node belongs to.
1718 * @param *op The operand.
1719 * @param *k The number of bits to rotate the operand.
1720 * @param *mode The mode of the operand.
1722 ir_node *new_rd_Rotl (dbg_info *db, ir_graph *irg, ir_node *block,
1723 ir_node *op, ir_node *k, ir_mode *mode);
1726 /** Constructor for a Conv node.
1728 * @param *db A pointer for debug information.
1729 * @param *irg The IR graph the node belongs to.
1730 * @param *block The IR block the node belongs to.
1731 * @param *op The operand.
1732 * @param *mode The mode of this the operand muss be converted .
1734 ir_node *new_rd_Conv (dbg_info *db, ir_graph *irg, ir_node *block,
1735 ir_node *op, ir_mode *mode);
1737 /** Constructor for a strictConv node.
1739 * @param *db A pointer for debug information.
1740 * @param *irg The IR graph the node belongs to.
1741 * @param *block The IR block the node belongs to.
1742 * @param *op The operand.
1743 * @param *mode The mode of this the operand muss be converted .
1745 ir_node *new_rd_strictConv (dbg_info *db, ir_graph *irg, ir_node *block,
1746 ir_node *op, ir_mode *mode);
1748 /** Constructor for a Cast node.
1750 * High level type cast.
1752 * @param *db A pointer for debug information.
1753 * @param *irg The IR graph the node belongs to.
1754 * @param *block The IR block the node belongs to.
1755 * @param *op The operand.
1756 * @param *to_tp The type of this the operand muss be casted .
1758 ir_node *new_rd_Cast (dbg_info *db, ir_graph *irg, ir_node *block,
1759 ir_node *op, ir_type *to_tp);
1761 /** Constructor for a Carry node.
1763 * @param *db A pointer for debug information.
1764 * @param *irg The IR graph the node belongs to.
1765 * @param *block The IR block the node belongs to.
1766 * @param *op1 The first operand.
1767 * @param *op2 The second operand.
1768 * @param *mode The mode of the operands and the result.
1770 ir_node *new_rd_Carry (dbg_info *db, ir_graph *irg, ir_node *block,
1771 ir_node *op1, ir_node *op2, ir_mode *mode);
1773 /** Constructor for a Borrow node.
1775 * @param *db A pointer for debug information.
1776 * @param *irg The IR graph the node belongs to.
1777 * @param *block The IR block the node belongs to.
1778 * @param *op1 The first operand.
1779 * @param *op2 The second operand.
1780 * @param *mode The mode of the operands and the result.
1782 ir_node *new_rd_Borrow (dbg_info *db, ir_graph *irg, ir_node *block,
1783 ir_node *op1, ir_node *op2, ir_mode *mode);
1785 /** Constructor for a Phi node.
1787 * @param *db A pointer for debug information.
1788 * @param *irg The IR graph the node belongs to.
1789 * @param *block The IR block the node belongs to.
1790 * @param arity The number of predecessors
1791 * @param *in[] Array with predecessors. The constructor copies this array.
1792 * @param *mode The mode of it's inputs and output.
1794 ir_node *new_rd_Phi (dbg_info *db, ir_graph *irg, ir_node *block, int arity,
1795 ir_node *in[], ir_mode *mode);
1797 /** Constructor for a Load node.
1799 * @param *db A pointer for debug information.
1800 * @param *irg The IR graph the node belongs to.
1801 * @param *block The IR block the node belongs to.
1802 * @param *store The current memory
1803 * @param *adr A pointer to the variable to be read in this memory.
1804 * @param *mode The mode of the value to be loaded.
1805 * @param flags Additional flags for alignment, volatility and pin state.
1807 ir_node *new_rd_Load (dbg_info *db, ir_graph *irg, ir_node *block,
1808 ir_node *store, ir_node *adr, ir_mode *mode, ir_cons_flags flags);
1810 /** Constructor for a Store node.
1812 * @param *db A pointer for debug information.
1813 * @param *irg The IR graph the node belongs to.
1814 * @param *block The IR block the node belongs to.
1815 * @param *store The current memory
1816 * @param *adr A pointer to the variable to be read in this memory.
1817 * @param *val The value to write to this variable.
1818 * @param flags Additional flags for alignment, volatility and pin state.
1820 ir_node *new_rd_Store (dbg_info *db, ir_graph *irg, ir_node *block,
1821 ir_node *store, ir_node *adr, ir_node *val, ir_cons_flags flags);
1823 /** Constructor for a Alloc node.
1825 * The Alloc node extends the memory by space for an entity of type alloc_type.
1827 * @param *db A pointer for debug information.
1828 * @param *irg The IR graph the node belongs to.
1829 * @param *block The IR block the node belongs to.
1830 * @param *store The memory which shall contain the new variable.
1831 * @param *size The number of bytes to allocate.
1832 * @param *alloc_type The type of the allocated variable.
1833 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
1835 ir_node *new_rd_Alloc (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1836 ir_node *size, ir_type *alloc_type, ir_where_alloc where);
1838 /** Constructor for a Free node.
1840 * Frees the memory occupied by the entity pointed to by the pointer
1841 * arg. Type indicates the type of the entity the argument points to.
1843 * @param *db A pointer for debug information.
1844 * @param *irg The IR graph the node belongs to.
1845 * @param *block The IR block the node belongs to.
1846 * @param *store The memory which shall contain the new variable.
1847 * @param *ptr The pointer to the object to free.
1848 * @param *size The number of objects of type free_type to free in a sequence.
1849 * @param *free_type The type of the freed variable.
1850 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
1852 ir_node *new_rd_Free (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1853 ir_node *ptr, ir_node *size, ir_type *free_type, ir_where_alloc where);
1855 /** Constructor for a Sync node.
1857 * Merges several memory values. The node assumes that a variable
1858 * either occurs only in one of the memories, or it contains the same
1859 * value in all memories where it occurs.
1861 * @param *db A pointer for debug information.
1862 * @param *irg The IR graph the node belongs to.
1863 * @param *block The IR block the node belongs to.
1864 * @param arity The number of memories to synchronize.
1865 * @param *in[] An array of pointers to nodes that produce an output of type
1866 * memory. The constructor copies this array.
1868 ir_node *new_rd_Sync (dbg_info *db, ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
1870 /** Constructor for a Proj node.
1872 * Projects a single value out of a tuple. The parameter proj gives the
1873 * position of the value within the tuple.
1875 * @param *db A pointer for debug information.
1876 * @param *irg The IR graph the node belongs to.
1877 * @param *block The IR block the node belongs to.
1878 * @param arg A node producing a tuple. The node must have mode_T.
1879 * @param *mode The mode of the value to project.
1880 * @param proj The position of the value in the tuple.
1882 ir_node *new_rd_Proj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1883 ir_mode *mode, long proj);
1885 /** Constructor for a defaultProj node.
1887 * Represents the default control flow of a Switch-Cond node.
1889 * @param *db A pointer for debug information.
1890 * @param *irg The IR graph the node belongs to.
1891 * @param *block The IR block the node belongs to.
1892 * @param arg A node producing a tuple.
1893 * @param max_proj The end position of the value in the tuple.
1895 ir_node *new_rd_defaultProj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1898 /** Constructor for a Tuple node.
1900 * This is an auxiliary node to replace a node that returns a tuple
1901 * without changing the corresponding Proj nodes.
1903 * @param *db A pointer for debug information.
1904 * @param *irg The IR graph the node belongs to.
1905 * @param *block The IR block the node belongs to.
1906 * @param arity The number of tuple elements.
1907 * @param *in[] An array containing pointers to the nodes producing the tuple
1908 * elements. The constructor copies this array.
1910 ir_node *new_rd_Tuple (dbg_info *db, ir_graph *irg, ir_node *block,
1911 int arity, ir_node *in[]);
1913 /** Constructor for a Id node.
1915 * This is an auxiliary node to replace a node that returns a single
1918 * @param *db A pointer for debug information.
1919 * @param *irg The IR graph the node belongs to.
1920 * @param *block The IR block the node belongs to.
1921 * @param *val The value
1922 * @param *mode The mode of *val.
1924 ir_node *new_rd_Id (dbg_info *db, ir_graph *irg, ir_node *block,
1925 ir_node *val, ir_mode *mode);
1927 /** Constructor for a Confirm node.
1929 * Specifies constraints for a value. To support dataflow analyses.
1931 * Example: If the value never exceeds '100' this is expressed by placing a
1932 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
1934 * @param *irg The IR graph the node belong to.
1935 * @param *block The IR block the node belong to.
1936 * @param *db A pointer for debug information.
1937 * @param *val The value we express a constraint for
1938 * @param *bound The value to compare against. Must be a firm node, typically a constant.
1939 * @param cmp The compare operation.
1941 ir_node *new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block,
1942 ir_node *val, ir_node *bound, pn_Cmp cmp);
1944 /** Constructor for an Unknown node.
1946 * Represents an arbitrary value. Places the node in the start block.
1948 * @param *irg The IR graph the node belongs to.
1949 * @param *m The mode of the unknown value.
1951 ir_node *new_rd_Unknown(dbg_info *db, ir_graph *irg, ir_mode *m);
1953 /** Constructor for a CallBegin node.
1955 * CallBegin represents control flow depending of the pointer value
1956 * representing the called method to the called methods. The
1957 * constructor copies the method pointer input from the passed Call
1960 * @param *db A pointer for debug information.
1961 * @param *irg The IR graph the node belong to.
1962 * @param *block The block the node belong to.
1963 * @param *callee The call node visible in the intra procedural view.
1965 ir_node *new_rd_CallBegin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *ptr, ir_node *call);
1967 /** Constructor for a EndReg node.
1969 * Used to represent regular procedure end in interprocedual view.
1971 * @param *db A pointer for debug information.
1972 * @param *irg The IR graph the node belong to.
1973 * @param *block The block the node belong to.
1975 ir_node *new_rd_EndReg (dbg_info *db, ir_graph *irg, ir_node *block);
1977 /** Constructor for a EndExcept node.
1979 * Used to represent exceptional procedure end in interprocedural view.
1981 * @param *db A pointer for debug information.
1982 * @param *irg The IR graph the node belong to.
1983 * @param *block The block the node belong to.
1985 ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
1987 /** Constructor for a Filter node.
1989 * Adds the node to the block in current_ir_block. Filter is a node
1990 * with two views used to construct the interprocedural view. In
1991 * intraprocedural view its semantics are identical to the Proj node.
1992 * In interprocedural view the Filter performs the Phi operation on
1993 * method parameters or results. Other than a Phi a Filter node may
1994 * not be removed if it has only a single input.
1996 * The constructor builds the Filter in intraprocedural view.
1998 * @param *db A pointer for debug information.
1999 * @param *irg The IR graph the node belong to.
2000 * @param *block The block the node belong to.
2001 * @param *arg The tuple value to project from.
2002 * @param *mode The mode of the projected value.
2003 * @param proj The position in the tuple to project from.
2005 ir_node *new_rd_Filter (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
2006 ir_mode *mode, long proj);
2008 /** Constructor for a Mux node.
2010 * @param *db A pointer for debug information.
2011 * @param *irg The IR graph the node belong to.
2012 * @param *block The block the node belong to.
2013 * @param *sel The ir_node that calculates the boolean select.
2014 * @param *ir_true The ir_node that calculates the true result.
2015 * @param *ir_false The ir_node that calculates the false result.
2016 * @param *mode The mode of the node (and it_true and ir_false).
2018 ir_node *new_rd_Mux (dbg_info *db, ir_graph *irg, ir_node *block,
2019 ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2021 /** Constructor for a CopyB node.
2023 * @param *db A pointer for debug information.
2024 * @param *irg The IR graph the node belong to.
2025 * @param *block The block the node belong to.
2026 * @param *store The current memory
2027 * @param *dst The ir_node that represents the destination address.
2028 * @param *src The ir_node that represents the source address.
2029 * @param *data_type The type of the copied data
2031 ir_node *new_rd_CopyB(dbg_info *db, ir_graph *irg, ir_node *block,
2032 ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
2034 /** Constructor for a InstOf node.
2036 * A High-Level Type check.
2038 * @param *db A pointer for debug information.
2039 * @param *irg The IR graph the node belongs to.
2040 * @param *block The IR block the node belongs to.
2041 * @param *store The memory in which the object the entity should be selected
2042 * from is allocated.
2043 * @param *objptr A pointer to a object of a class type.
2044 * @param *type The type of which objptr must be.
2046 ir_node *new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
2047 ir_node *objptr, ir_type *type);
2049 /** Constructor for a Raise node.
2051 * A High-Level Exception throw.
2053 * @param *db A pointer for debug information.
2054 * @param *irg The IR graph the node belongs to.
2055 * @param *block The IR block the node belongs to.
2056 * @param *store The current memory.
2057 * @param *obj A pointer to the Except variable.
2059 ir_node *new_rd_Raise (dbg_info *db, ir_graph *irg, ir_node *block,
2060 ir_node *store, ir_node *obj);
2062 /** Constructor for a Bound node.
2064 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2066 * @param *db A pointer for debug information.
2067 * @param *irg The IR graph the node belong to.
2068 * @param *block The block the node belong to.
2069 * @param *store The current memory.
2070 * @param *idx The ir_node that represents an index.
2071 * @param *lower The ir_node that represents the lower bound for the index.
2072 * @param *upper The ir_node that represents the upper bound for the index.
2074 ir_node *new_rd_Bound(dbg_info *db, ir_graph *irg, ir_node *block,
2075 ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
2077 /** Constructor for a Pin node.
2079 * @param *db A pointer for debug information.
2080 * @param *irg The IR graph the node belong to.
2081 * @param *block The block the node belong to.
2082 * @param *node The node which value should be pinned.
2084 ir_node *new_rd_Pin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *node);
2086 /** Constructor for an ASM pseudo node.
2088 * @param *db A pointer for debug information.
2089 * @param *irg The IR graph the node belong to.
2090 * @param *block The block the node belong to.
2091 * @param arity The number of data inputs to the node.
2092 * @param *in The array of length arity of data inputs.
2093 * @param *inputs The array of length arity of input constraints.
2094 * @param n_outs The number of data outputs to the node.
2095 * @param *outputs The array of length n_outs of output constraints.
2096 * @param n_clobber The number of clobbered registers.
2097 * @param *clobber The array of length n_clobber of clobbered registers.
2098 * @param *asm_text The assembler text.
2100 ir_node *new_rd_ASM(dbg_info *db, ir_graph *irg, ir_node *block,
2101 int arity, ir_node *in[], ir_asm_constraint *inputs,
2102 int n_outs, ir_asm_constraint *outputs,
2103 int n_clobber, ident *clobber[], ident *asm_text);
2105 /*-------------------------------------------------------------------------*/
2106 /* The raw interface without debug support */
2107 /*-------------------------------------------------------------------------*/
2109 /** Constructor for a Block node.
2111 * Constructs a mature block with the given predecessors. Use Unknown
2112 * nodes as predecessors to construct a block if the number of
2113 * predecessors is known, but not the predecessors themselves. This
2114 * constructor does not set current_block. It not be used with
2115 * automatic Phi node construction.
2118 * @param irg The IR graph the block belongs to.
2119 * @param arity The number of control predecessors.
2120 * @param in[] An array of control predecessors. The length of
2121 * the array must be 'arity'. The constructor copies this array.
2123 ir_node *new_r_Block (ir_graph *irg, int arity, ir_node *in[]);
2125 /** Constructor for a Start node.
2127 * @param *irg The IR graph the node belongs to.
2128 * @param *block The IR block the node belongs to.
2130 ir_node *new_r_Start (ir_graph *irg, ir_node *block);
2132 /** Constructor for a End node.
2134 * @param *irg The IR graph the node belongs to.
2135 * @param *block The IR block the node belongs to.
2137 ir_node *new_r_End (ir_graph *irg, ir_node *block);
2139 /** Constructor for a Jmp node.
2141 * Jmp represents control flow to a single control successor.
2143 * @param *irg The IR graph the node belongs to.
2144 * @param *block The IR block the node belongs to.
2146 ir_node *new_r_Jmp (ir_graph *irg, ir_node *block);
2148 /** Constructor for an IJmp node.
2150 * IJmp represents control flow to a single control successor not
2151 * statically known i.e. an indirect Jmp.
2153 * @param *irg The IR graph the node belongs to.
2154 * @param *block The IR block the node belongs to.
2155 * @param *tgt The IR node representing the target address.
2157 ir_node *new_r_IJmp (ir_graph *irg, ir_node *block, ir_node *tgt);
2159 /** Constructor for a Cond node.
2161 * If c is mode_b represents a conditional branch (if/else). If c is
2162 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2163 * node, default Proj is 0.)
2165 * This is not consistent: Input to Cond is Is, Proj has as proj number
2168 * @param *irg The IR graph the node belongs to.
2169 * @param *block The IR block the node belongs to.
2170 * @param *c The conditions parameter.Can be of mode b or I_u.
2172 ir_node *new_r_Cond (ir_graph *irg, ir_node *block, ir_node *c);
2174 /** Constructor for a Return node.
2176 * Returns the memory and zero or more return values. Only node that
2177 * can end regular control flow.
2179 * @param *irg The IR graph the node belongs to.
2180 * @param *block The IR block the node belongs to.
2181 * @param *store The state of memory.
2182 * @param arity Number of array indices.
2183 * @param *in[] Array with index inputs to the node. The constructor copies this array.
2185 ir_node *new_r_Return (ir_graph *irg, ir_node *block,
2186 ir_node *store, int arity, ir_node *in[]);
2188 /** Constructor for a Const node.
2190 * Adds the node to the start block.
2192 * Constructor for a Const node. The constant represents a target
2193 * value. Sets the type information to type_unknown. (No more
2194 * supported: If tv is entity derives a somehow useful type.)
2195 * Derives mode from passed tarval.
2197 * @param *irg The IR graph the node belongs to.
2198 * @param *block The IR block the node belongs to.
2199 * @param *con Points to an entry in the constant table.
2201 ir_node *new_r_Const (ir_graph *irg, tarval *con);
2203 /** Constructor for a Const node.
2205 * Adds the node to the start block.
2207 * Constructor for a Const node. The constant represents a target
2208 * value. Sets the type information to type_unknown. (No more
2209 * supported: If tv is entity derives a somehow useful type.)
2211 * @param *irg The IR graph the node belongs to.
2212 * @param *mode The mode of the operands and the results.
2213 * @param value A value from which the tarval is made.
2215 ir_node *new_r_Const_long(ir_graph *irg,
2216 ir_mode *mode, long value);
2218 /** Constructor for a Const_type node.
2220 * Adds the node to the start block.
2222 * The constant represents a target value. This constructor sets high
2223 * level type information for the constant value.
2224 * Derives mode from passed tarval.
2226 * @param *irg The IR graph the node belongs to.
2227 * @param *con Points to an entry in the constant table.
2228 * @param *tp The type of the constant.
2230 ir_node *new_r_Const_type(ir_graph *irg, tarval *con, ir_type *tp);
2232 /** Constructor for a SymConst node.
2234 * This is the constructor for a symbolic constant.
2235 * There are four kinds of symbolic constants:
2236 * - type_tag The symbolic constant represents a type tag. The type the
2237 * tag stands for is given explicitly.
2238 * - size The symbolic constant represents the size of a type. The
2239 * type of which the constant represents the size is given
2241 * - addr_name The symbolic constant represents the address of an entity
2242 * (variable or method). The variable is indicated by a name
2243 * that is valid for linking.
2244 * - addr_ent The symbolic constant represents the address of an entity
2245 * (variable or method). The variable is given explicitly by
2248 * Inputs to the node:
2249 * No inputs except the block it belongs to.
2250 * Outputs of the node.
2251 * An unsigned integer (I_u) or a pointer (P).
2253 * @param *irg The IR graph the node belongs to.
2254 * @param *block The IR block the node belongs to.
2255 * @param mode The mode for the SymConst.
2256 * @param value A type, entity or a ident depending on the SymConst kind.
2257 * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
2259 ir_node *new_r_SymConst(ir_graph *irg, ir_node *block, ir_mode *mode,
2260 union symconst_symbol value, symconst_kind symkind);
2262 /** Constructor for a simpleSel node.
2264 * This is a shortcut for the new_d_Sel() constructor. To be used for
2265 * Sel nodes that do not select from an array, i.e., have no index
2266 * inputs. It adds the two parameters 0, NULL.
2268 * @param *irg The IR graph the node belongs to.
2269 * @param *block The IR block the node belongs to.
2270 * @param *store The memory in which the object the entity should be selected
2271 * from is allocated.
2272 * @param *objptr The object from that the Sel operation selects a
2273 * single attribute out.
2274 * @param *ent The entity to select.
2276 ir_node *new_r_simpleSel(ir_graph *irg, ir_node *block, ir_node *store,
2277 ir_node *objptr, ir_entity *ent);
2279 /** Constructor for a Sel node.
2281 * The select node selects an entity (field or method) from an entity
2282 * with a compound type. It explicitly specifies the entity selected.
2283 * Dynamically the node may select entities that overwrite the given
2284 * entity. If the selected entity is an array element entity the Sel
2285 * node takes the required array indices as inputs.
2287 * @param *irg The IR graph the node belongs to.
2288 * @param *block The IR block the node belongs to.
2289 * @param *store The memory in which the object the entity should be selected
2290 * from is allocated.
2291 * @param *objptr A pointer to a compound entity the Sel operation selects a
2292 * single attribute from.
2293 * @param *n_index The number of array indices needed to select an array element entity.
2294 * @param *index[] If the compound entity is an array the indices of the selected
2295 * element entity. The constructor copies this array.
2296 * @param *ent The entity to select.
2298 ir_node *new_r_Sel (ir_graph *irg, ir_node *block, ir_node *store,
2299 ir_node *objptr, int n_index, ir_node *index[],
2302 /** Constructor for a Call node.
2304 * Represents all kinds of method and function calls.
2306 * @param *irg The IR graph the node belongs to.
2307 * @param *block The IR block the node belongs to.
2308 * @param *store The actual store.
2309 * @param *callee A pointer to the called procedure.
2310 * @param arity The number of procedure parameters.
2311 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2312 * @param *tp Type information of the procedure called.
2314 ir_node *new_r_Call (ir_graph *irg, ir_node *block, ir_node *store,
2315 ir_node *callee, int arity, ir_node *in[], ir_type *tp);
2317 /** Constructor for a Builtin node.
2319 * Represents a call of a backend-specific builtin..
2321 * @param *irg The IR graph the node belongs to.
2322 * @param *block The IR block the node belongs to.
2323 * @param *store The actual store.
2324 * @param arity The number of procedure parameters.
2325 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2326 * @param kind The kind of the called builtin.
2327 * @param *tp Type information of the procedure called.
2329 ir_node *new_r_Builtin(ir_graph *irg, ir_node *block, ir_node *store,
2330 int arity, ir_node *in[], ir_builtin_kind kind, ir_type *tp);
2332 /** Constructor for a Add node.
2334 * @param *irg The IR graph the node belongs to.
2335 * @param *block The IR block the node belongs to.
2336 * @param *op1 The first operand.
2337 * @param *op2 The second operand.
2338 * @param *mode The mode of the operands and the result.
2340 ir_node *new_r_Add (ir_graph *irg, ir_node *block,
2341 ir_node *op1, ir_node *op2, ir_mode *mode);
2344 * Constructor for a Sub node.
2346 * @param *irg The IR graph the node belongs to.
2347 * @param *block The IR block the node belongs to.
2348 * @param *op1 The first operand.
2349 * @param *op2 The second operand.
2350 * @param *mode The mode of the operands and the results.
2352 ir_node *new_r_Sub (ir_graph *irg, ir_node *block,
2353 ir_node *op1, ir_node *op2, ir_mode *mode);
2355 /** Constructor for a Minus node.
2357 * @param *irg The IR graph the node belongs to.
2358 * @param *block The IR block the node belongs to.
2359 * @param *op The operand.
2360 * @param *mode The mode of the operand and the result.
2362 ir_node *new_r_Minus (ir_graph *irg, ir_node *block,
2363 ir_node *op, ir_mode *mode);
2365 /** Constructor for a Mul node.
2367 * @param *irg The IR graph the node belongs to.
2368 * @param *block The IR block the node belongs to.
2369 * @param *op1 The first operand.
2370 * @param *op2 The second operand.
2371 * @param *mode The mode of the operands and the result.
2373 ir_node *new_r_Mul (ir_graph *irg, ir_node *block,
2374 ir_node *op1, ir_node *op2, ir_mode *mode);
2376 /** Constructor for a Mulh node.
2378 * @param *irg The IR graph the node belongs to.
2379 * @param *block The IR block the node belongs to.
2380 * @param *op1 The first operand.
2381 * @param *op2 The second operand.
2382 * @param *mode The mode of the operands and the result.
2384 ir_node *new_r_Mulh (ir_graph *irg, ir_node *block,
2385 ir_node *op1, ir_node *op2, ir_mode *mode);
2387 /** Constructor for a Quot node.
2389 * @param *irg The IR graph the node belongs to.
2390 * @param *block The IR block the node belongs to.
2391 * @param *memop The store needed to model exceptions
2392 * @param *op1 The first operand.
2393 * @param *op2 The second operand.
2394 * @param *mode The mode of the result.
2395 * @param state The pinned state.
2397 ir_node *new_r_Quot (ir_graph *irg, ir_node *block,
2398 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2400 /** Constructor for a DivMod node.
2402 * @param *irg The IR graph the node belongs to.
2403 * @param *block The IR block the node belongs to.
2404 * @param *memop The store needed to model exceptions
2405 * @param *op1 The first operand.
2406 * @param *op2 The second operand.
2407 * @param *mode The mode of the results.
2408 * @param state The pinned state.
2410 ir_node *new_r_DivMod (ir_graph *irg, ir_node *block,
2411 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2413 /** Constructor for a Div node.
2415 * @param *irg The IR graph the node belongs to.
2416 * @param *block The IR block the node belongs to.
2417 * @param *memop The store needed to model exceptions
2418 * @param *op1 The first operand.
2419 * @param *op2 The second operand.
2420 * @param *mode The mode of the result.
2421 * @param state The pinned state.
2423 ir_node *new_r_Div (ir_graph *irg, ir_node *block,
2424 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2426 /** Constructor for a remainderless Div node.
2428 * @param *irg The IR graph the node belongs to.
2429 * @param *block The IR block the node belongs to.
2430 * @param *memop The store needed to model exceptions
2431 * @param *op1 The first operand.
2432 * @param *op2 The second operand.
2433 * @param *mode The mode of the result.
2434 * @param state The pinned state.
2436 ir_node *new_r_DivRL (ir_graph *irg, ir_node *block,
2437 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2439 /** Constructor for a Mod node.
2441 * @param *irg The IR graph the node belongs to.
2442 * @param *block The IR block the node belongs to.
2443 * @param *memop The store needed to model exceptions
2444 * @param *op1 The first operand.
2445 * @param *op2 The second operand.
2446 * @param *mode The mode of the result.
2447 * @param state The pinned state.
2449 ir_node *new_r_Mod (ir_graph *irg, ir_node *block,
2450 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2452 /** Constructor for a Abs node.
2454 * @param *irg The IR graph the node belongs to.
2455 * @param *block The IR block the node belongs to.
2456 * @param *op The operand
2457 * @param *mode The mode of the operands and the result.
2459 ir_node *new_r_Abs (ir_graph *irg, ir_node *block,
2460 ir_node *op, ir_mode *mode);
2462 /** Constructor for a And node.
2464 * @param *irg The IR graph the node belongs to.
2465 * @param *block The IR block the node belongs to.
2466 * @param *op1 The first operand.
2467 * @param *op2 The second operand.
2468 * @param *mode The mode of the operands and the result.
2470 ir_node *new_r_And (ir_graph *irg, ir_node *block,
2471 ir_node *op1, ir_node *op2, ir_mode *mode);
2473 /** Constructor for a Or node.
2475 * @param *irg The IR graph the node belongs to.
2476 * @param *block The IR block the node belongs to.
2477 * @param *op1 The first operand.
2478 * @param *op2 The second operand.
2479 * @param *mode The mode of the operands and the result.
2481 ir_node *new_r_Or (ir_graph *irg, ir_node *block,
2482 ir_node *op1, ir_node *op2, ir_mode *mode);
2484 /** Constructor for a Eor node.
2486 * @param *irg The IR graph the node belongs to.
2487 * @param *block The IR block the node belongs to.
2488 * @param *op1 The first operand.
2489 * @param *op2 The second operand.
2490 * @param *mode The mode of the operands and the results.
2492 ir_node *new_r_Eor (ir_graph *irg, ir_node *block,
2493 ir_node *op1, ir_node *op2, ir_mode *mode);
2495 /** Constructor for a Not node.
2497 * @param *irg The IR graph the node belongs to.
2498 * @param *block The IR block the node belongs to.
2499 * @param *op The operand.
2500 * @param *mode The mode of the operand and the result.
2502 ir_node *new_r_Not (ir_graph *irg, ir_node *block,
2503 ir_node *op, ir_mode *mode);
2505 /** Constructor for a Cmp node.
2507 * @param *irg The IR graph the node belongs to.
2508 * @param *block The IR block the node belongs to.
2509 * @param *op1 The first operand.
2510 * @param *op2 The second operand.
2512 ir_node *new_r_Cmp (ir_graph *irg, ir_node *block,
2513 ir_node *op1, ir_node *op2);
2515 /** Constructor for a Shl node.
2517 * @param *irg The IR graph the node belongs to.
2518 * @param *block The IR block the node belongs to.
2519 * @param *op The operand.
2520 * @param *k The number of bits to shift the operand .
2521 * @param *mode The mode of the operand and the result.
2523 ir_node *new_r_Shl (ir_graph *irg, ir_node *block,
2524 ir_node *op, ir_node *k, ir_mode *mode);
2526 /** Constructor for a Shr node.
2528 * @param *irg The IR graph the node belongs to.
2529 * @param *block The IR block the node belongs to.
2530 * @param *op The operand.
2531 * @param *k The number of bits to shift the operand .
2532 * @param *mode The mode of the operand and the result.
2534 ir_node *new_r_Shr (ir_graph *irg, ir_node *block,
2535 ir_node *op, ir_node *k, ir_mode *mode);
2538 * Constructor for a Shrs node.
2540 * @param *irg The IR graph the node belongs to.
2541 * @param *block The IR block the node belongs to.
2542 * @param *op The operand.
2543 * @param *k The number of bits to shift the operand.
2544 * @param *mode The mode of the operand and the result.
2546 ir_node *new_r_Shrs (ir_graph *irg, ir_node *block,
2547 ir_node *op, ir_node *k, ir_mode *mode);
2549 /** Constructor for a Rotl node.
2551 * @param *irg The IR graph the node belongs to.
2552 * @param *block The IR block the node belongs to.
2553 * @param *op The operand.
2554 * @param *k The number of bits to rotate the operand.
2555 * @param *mode The mode of the operand.
2557 ir_node *new_r_Rotl (ir_graph *irg, ir_node *block,
2558 ir_node *op, ir_node *k, ir_mode *mode);
2560 /** Constructor for a Conv node.
2562 * @param *irg The IR graph the node belongs to.
2563 * @param *block The IR block the node belongs to.
2564 * @param *op The operand.
2565 * @param *mode The mode of this the operand muss be converted .
2567 ir_node *new_r_Conv (ir_graph *irg, ir_node *block,
2568 ir_node *op, ir_mode *mode);
2570 /** Constructor for a strict Conv node.
2572 * @param *irg The IR graph the node belongs to.
2573 * @param *block The IR block the node belongs to.
2574 * @param *op The operand.
2575 * @param *mode The mode of this the operand muss be converted .
2577 ir_node *new_r_strictConv (ir_graph *irg, ir_node *block,
2578 ir_node *op, ir_mode *mode);
2580 /** Constructor for a Cast node.
2582 * High level type cast
2584 * @param *irg The IR graph the node belongs to.
2585 * @param *block The IR block the node belongs to.
2586 * @param *op The operand.
2587 * @param *to_tp The type of this the operand muss be casted .
2589 ir_node *new_r_Cast (ir_graph *irg, ir_node *block,
2590 ir_node *op, ir_type *to_tp);
2592 /** Constructor for a Carry node.
2594 * @param *irg The IR graph the node belongs to.
2595 * @param *block The IR block the node belongs to.
2596 * @param *op1 The first operand.
2597 * @param *op2 The second operand.
2598 * @param *mode The mode of the operands and the result.
2600 ir_node *new_r_Carry (ir_graph *irg, ir_node *block,
2601 ir_node *op1, ir_node *op2, ir_mode *mode);
2604 * Constructor for a Borrow node.
2606 * @param *irg The IR graph the node belongs to.
2607 * @param *block The IR block the node belongs to.
2608 * @param *op1 The first operand.
2609 * @param *op2 The second operand.
2610 * @param *mode The mode of the operands and the results.
2612 ir_node *new_r_Borrow (ir_graph *irg, ir_node *block,
2613 ir_node *op1, ir_node *op2, ir_mode *mode);
2615 /** Constructor for a Phi node.
2617 * @param *irg The IR graph the node belongs to.
2618 * @param *block The IR block the node belongs to.
2619 * @param arity The number of predecessors
2620 * @param *in[] Array with predecessors. The constructor copies this array.
2621 * @param *mode The mode of it's inputs and output.
2623 ir_node *new_r_Phi (ir_graph *irg, ir_node *block, int arity,
2624 ir_node *in[], ir_mode *mode);
2626 /** Constructor for a Load node.
2628 * @param *irg The IR graph the node belongs to.
2629 * @param *block The IR block the node belongs to.
2630 * @param *store The current memory
2631 * @param *adr A pointer to the variable to be read in this memory.
2632 * @param *mode The mode of the value to be loaded.
2633 * @param flags Additional flags for alignment, volatility and pin state.
2635 ir_node *new_r_Load (ir_graph *irg, ir_node *block,
2636 ir_node *store, ir_node *adr, ir_mode *mode, ir_cons_flags flags);
2638 /** Constructor for a Store node.
2640 * @param *irg The IR graph the node belongs to.
2641 * @param *block The IR block the node belongs to.
2642 * @param *store The current memory
2643 * @param *adr A pointer to the variable to be read in this memory.
2644 * @param *val The value to write to this variable.
2645 * @param flags Additional flags for alignment, volatility and pin state.
2647 ir_node *new_r_Store (ir_graph *irg, ir_node *block,
2648 ir_node *store, ir_node *adr, ir_node *val, ir_cons_flags flags);
2650 /** Constructor for a Alloc node.
2652 * The Alloc node extends the memory by space for an entity of type alloc_type.
2654 * @param *irg The IR graph the node belongs to.
2655 * @param *block The IR block the node belongs to.
2656 * @param *store The memory which shall contain the new variable.
2657 * @param *size The number of bytes to allocate.
2658 * @param *alloc_type The type of the allocated variable.
2659 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
2661 ir_node *new_r_Alloc (ir_graph *irg, ir_node *block, ir_node *store,
2662 ir_node *size, ir_type *alloc_type, ir_where_alloc where);
2664 /** Constructor for a Free node.
2666 * Frees the memory occupied by the entity pointed to by the pointer
2667 * arg. Type indicates the type of the entity the argument points to.
2669 * @param *irg The IR graph the node belongs to.
2670 * @param *block The IR block the node belongs to.
2671 * @param *store The memory which shall contain the new variable.
2672 * @param *ptr The pointer to the object to free.
2673 * @param *size The number of objects of type free_type to free in a sequence.
2674 * @param *free_type The type of the freed variable.
2675 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
2677 ir_node *new_r_Free (ir_graph *irg, ir_node *block, ir_node *store,
2678 ir_node *ptr, ir_node *size, ir_type *free_type, ir_where_alloc where);
2680 /** Constructor for a Sync node.
2682 * Merges several memory values. The node assumes that a variable
2683 * either occurs only in one of the memories, or it contains the same
2684 * value in all memories where it occurs.
2686 * @param *irg The IR graph the node belongs to.
2687 * @param *block The IR block the node belongs to.
2688 * @param arity The number of memories to synchronize.
2689 * @param *in[] An array of pointers to nodes that produce an output of type memory.
2690 * The constructor copies this array.
2692 ir_node *new_r_Sync (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2694 /** Constructor for a Proj node.
2696 * Projects a single value out of a tuple. The parameter proj gives the
2697 * position of the value within the tuple.
2699 * @param *irg The IR graph the node belongs to.
2700 * @param *block The IR block the node belongs to.
2701 * @param arg A node producing a tuple.
2702 * @param *mode The mode of the value to project.
2703 * @param proj The position of the value in the tuple.
2705 ir_node *new_r_Proj (ir_graph *irg, ir_node *block, ir_node *arg,
2706 ir_mode *mode, long proj);
2708 /** Constructor for a defaultProj node.
2710 * Represents the default control flow of a Switch-Cond node.
2712 * @param *irg The IR graph the node belongs to.
2713 * @param *block The IR block the node belongs to.
2714 * @param arg A node producing a tuple.
2715 * @param max_proj The end position of the value in the tuple.
2717 ir_node *new_r_defaultProj (ir_graph *irg, ir_node *block, ir_node *arg, long max_proj);
2720 /** Constructor for a Tuple node.
2722 * This is an auxiliary node to replace a node that returns a tuple
2723 * without changing the corresponding Proj nodes.
2725 * @param *irg The IR graph the node belongs to.
2726 * @param *block The IR block the node belongs to.
2727 * @param arity The number of tuple elements.
2728 * @param *in[] An array containing pointers to the nodes producing the tuple elements.
2729 * The constructor copies this array.
2731 ir_node *new_r_Tuple (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2733 /** Constructor for a Id node.
2735 * This is an auxiliary node to replace a node that returns a single
2738 * @param *irg The IR graph the node belongs to.
2739 * @param *block The IR block the node belongs to.
2740 * @param *val The operand to Id.
2741 * @param *mode The mode of *val.
2743 ir_node *new_r_Id (ir_graph *irg, ir_node *block,
2744 ir_node *val, ir_mode *mode);
2746 /** Constructor for a Bad node.
2748 * Returns the unique Bad node of the graph. The same as
2751 * @param *irg The IR graph the node belongs to.
2754 ir_node *new_r_Bad (ir_graph *irg);
2756 /** Constructor for a Confirm node.
2758 * Specifies constraints for a value. To support dataflow analyses.
2760 * Example: If the value never exceeds '100' this is expressed by placing a
2761 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
2763 * @param *irg The IR graph the node belong to.
2764 * @param *block The IR block the node belong to.
2765 * @param *val The value we express a constraint for
2766 * @param *bound The value to compare against. Must be a firm node, typically a constant.
2767 * @param cmp The compare operation.
2769 ir_node *new_r_Confirm(ir_graph *irg, ir_node *block,
2770 ir_node *val, ir_node *bound, pn_Cmp cmp);
2772 /** Constructor for a Unknown node.
2774 * Represents an arbitrary value. Places the node in
2777 * @param *irg The IR graph the node belongs to.
2778 * @param *m The mode of the unknown value.
2780 ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2782 /** Constructor for a CallBegin node.
2784 * CallBegin represents control flow depending of the pointer value
2785 * representing the called method to the called methods. The
2786 * constructor copies the method pointer input from the passed Call
2789 * @param *irg The IR graph the node belong to.
2790 * @param *block The block the node belong to.
2791 * @param *callee The call node visible in the intra procedural view.
2793 ir_node *new_r_CallBegin(ir_graph *irg, ir_node *block, ir_node *ptr, ir_node *call);
2795 /** Constructor for a EndReg node.
2797 * Used to represent regular procedure end in interprocedual view.
2799 * @param *irg The IR graph the node belong to.
2800 * @param *block The block the node belong to.
2802 ir_node *new_r_EndReg (ir_graph *irg, ir_node *block);
2804 /** Constructor for a EndExcept node.
2806 * Used to represent exceptional procedure end in interprocedural view.
2808 * @param *irg The IR graph the node belong to.
2809 * @param *block The block the node belong to.
2811 ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
2813 /** Constructor for a Break node.
2815 * Break represents control flow to a single control successor just as Jmp.
2816 * The blocks separated by a break may not be concatenated by an optimization.
2817 * It is used for the interprocedural representation where blocks are parted
2818 * behind Call nodes to represent the control flow to called procedures.
2820 * @param *irg The IR graph the node belong to.
2821 * @param *block The block the node belong to.
2823 ir_node *new_r_Break (ir_graph *irg, ir_node *block);
2825 /** Constructor for a Filter node.
2827 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
2828 * Filter is a node with two views used to construct the interprocedural view.
2829 * In intraprocedural view its semantics are identical to the Proj node.
2830 * In interprocedural view the Filter performs the Phi operation on method
2831 * parameters or results. Other than a Phi a Filter node may not be removed
2832 * if it has only a single input.
2834 * The constructor builds the Filter in intraprocedural view.
2836 * @param *irg The IR graph the node belong to.
2837 * @param *block The block the node belong to.
2838 * @param *arg The tuple value to project from.
2839 * @param *mode The mode of the projected value.
2840 * @param proj The position in the tuple to project from.
2842 ir_node *new_r_Filter (ir_graph *irg, ir_node *block, ir_node *arg,
2843 ir_mode *mode, long proj);
2845 /** Constructor for a NoMem node.
2847 * Returns the unique NoMem node of the graph. The same as
2850 * @param *irg The IR graph the node belongs to.
2852 ir_node *new_r_NoMem (ir_graph *irg);
2854 /** Constructor for a Mux node.
2856 * @param *irg The IR graph the node belong to.
2857 * @param *block The block the node belong to.
2858 * @param *sel The ir_node that calculates the boolean select.
2859 * @param *ir_true The ir_node that calculates the true result.
2860 * @param *ir_false The ir_node that calculates the false result.
2861 * @param *mode The mode of the node (and it_true and ir_false).
2863 ir_node *new_r_Mux (ir_graph *irg, ir_node *block,
2864 ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2866 /** Constructor for a CopyB node.
2868 * @param *irg The IR graph the node belong to.
2869 * @param *block The block the node belong to.
2870 * @param *store The current memory
2871 * @param *dst The ir_node that represents the destination address.
2872 * @param *src The ir_node that represents the source address.
2873 * @param *data_type The type of the copied data
2875 ir_node *new_r_CopyB(ir_graph *irg, ir_node *block,
2876 ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
2878 /** Constructor for a InstOf node.
2880 * A High-Level Type check.
2882 * @param *irg The IR graph the node belongs to.
2883 * @param *block The IR block the node belongs to.
2884 * @param *store The memory in which the object the entity should be selected
2885 * from is allocated.
2886 * @param *objptr A pointer to a object of a class type.
2887 * @param *type The type of which objptr must be.
2889 ir_node *new_r_InstOf(ir_graph *irg, ir_node *block, ir_node *store,
2890 ir_node *objptr, ir_type *type);
2892 /** Constructor for a Raise node.
2894 * A High-Level Exception throw.
2896 * @param *irg The IR graph the node belongs to.
2897 * @param *block The IR block the node belongs to.
2898 * @param *store The current memory.
2899 * @param *obj A pointer to the Except variable.
2901 ir_node *new_r_Raise(ir_graph *irg, ir_node *block,
2902 ir_node *store, ir_node *obj);
2904 /** Constructor for a Bound node.
2906 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2908 * @param *irg The IR graph the node belong to.
2909 * @param *block The block the node belong to.
2910 * @param *store The current memory.
2911 * @param *idx The ir_node that represents an index.
2912 * @param *lower The ir_node that represents the lower bound for the index.
2913 * @param *upper The ir_node that represents the upper bound for the index.
2915 ir_node *new_r_Bound(ir_graph *irg, ir_node *block,
2916 ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
2918 /** Constructor for a Pin node.
2920 * @param *irg The IR graph the node belong to.
2921 * @param *block The block the node belong to.
2922 * @param *node The node which value should be pinned.
2924 ir_node *new_r_Pin(ir_graph *irg, ir_node *block, ir_node *node);
2926 /** Constructor for an ASM pseudo node.
2928 * @param *irg The IR graph the node belong to.
2929 * @param *block The block the node belong to.
2930 * @param arity The number of data inputs to the node.
2931 * @param *in The array of length arity of data inputs.
2932 * @param *inputs The array of length arity of input constraints.
2933 * @param n_outs The number of data outputs to the node.
2934 * @param *outputs The array of length n_outs of output constraints.
2935 * @param n_clobber The number of clobbered registers.
2936 * @param *clobber The array of length n_clobber of clobbered registers.
2937 * @param *asm_text The assembler text.
2939 ir_node *new_r_ASM(ir_graph *irg, ir_node *block,
2940 int arity, ir_node *in[], ir_asm_constraint *inputs,
2941 int n_outs, ir_asm_constraint *outputs,
2942 int n_clobber, ident *clobber[], ident *asm_text);
2944 /*-----------------------------------------------------------------------*/
2945 /* The block oriented interface */
2946 /*-----------------------------------------------------------------------*/
2948 /** Sets the current block in which the following constructors place the
2949 * nodes they construct.
2951 * @param target The new current block.
2953 void set_cur_block (ir_node *target);
2955 /** Returns the current block of the current graph. */
2956 ir_node *get_cur_block(void);
2958 /** Returns the fixed nodes of the current graph. */
2959 #define get_cur_end_block() get_irg_end_block(current_ir_graph)
2960 #define get_cur_end() get_irg_end(current_ir_graph)
2961 #define get_cur_start_block() get_irg_start_block(current_ir_graph)
2962 #define get_cur_start() get_irg_start(current_ir_graph)
2964 /** Constructor for a Block node.
2966 * Adds the block to the graph in current_ir_graph. Constructs a Block
2967 * with a fixed number of predecessors. Does set current_block. Can
2968 * be used with automatic Phi node construction.
2970 * @param *db A Pointer for debug information.
2971 * @param arity The number of control predecessors.
2972 * @param in[] An array of control predecessors. The length of
2973 * the array must be 'arity'.
2975 ir_node *new_d_Block(dbg_info *db, int arity, ir_node *in[]);
2977 /** Constructor for a Start node.
2979 * Adds the node to the block in current_ir_block.
2981 * @param *db A pointer for debug information.
2983 ir_node *new_d_Start (dbg_info *db);
2985 /** Constructor for a End node.
2987 * Adds the node to the block in current_ir_block.
2989 * @param *db A pointer for debug information.
2991 ir_node *new_d_End (dbg_info *db);
2993 /** Constructor for a Jmp node.
2995 * Adds the node to the block in current_ir_block.
2997 * Jmp represents control flow to a single control successor.
2999 * @param *db A pointer for debug information.
3001 ir_node *new_d_Jmp (dbg_info *db);
3003 /** Constructor for an IJmp node.
3005 * IJmp represents control flow to a single control successor not
3006 * statically known i.e. an indirect Jmp.
3008 * @param *db A pointer for debug information.
3009 * @param *tgt The IR node representing the target address.
3011 ir_node *new_d_IJmp (dbg_info *db, ir_node *tgt);
3013 /** Constructor for a Cond node.
3015 * Adds the node to the block in current_ir_block.
3017 * If c is mode_b represents a conditional branch (if/else). If c is
3018 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
3019 * node, default Proj is 0.)
3021 * This is not consistent: Input to Cond is Is, Proj has as proj number
3024 * @param *db A pointer for debug information.
3025 * @param *c The conditions parameter.Can be of mode b or I_u.
3027 ir_node *new_d_Cond (dbg_info *db, ir_node *c);
3029 /** Constructor for a Return node.
3031 * Adds the node to the block in current_ir_block.
3033 * Returns the memory and zero or more return values. Only node that
3034 * can end regular control flow.
3036 * @param *db A pointer for debug information.
3037 * @param *store The state of memory.
3038 * @param arity Number of array indices.
3039 * @param *in Array with index inputs to the node.
3041 ir_node *new_d_Return (dbg_info *db, ir_node *store, int arity, ir_node *in[]);
3043 /** Constructor for a Const_type node.
3045 * Adds the node to the start block.
3047 * The constant represents a target value. This constructor sets high
3048 * level type information for the constant value.
3049 * Derives mode from passed tarval.
3051 * @param *db A pointer for debug information.
3052 * @param *con Points to an entry in the constant table. This pointer is
3053 added to the attributes of the node.
3054 * @param *tp The type of the constant.
3056 ir_node *new_d_Const_type (dbg_info *db, tarval *con, ir_type *tp);
3058 /** Constructor for a Const node.
3060 * Adds the node to the block in current_ir_block.
3062 * Constructor for a Const node. The constant represents a target
3063 * value. Sets the type information to type_unknown. (No more
3064 * supported: If tv is entity derives a somehow useful type.)
3065 * Derives mode from passed tarval.
3067 * @param *db A pointer for debug information.
3068 * @param *con Points to an entry in the constant table. This pointer is added
3069 * to the attributes of the node.
3071 ir_node *new_d_Const (dbg_info *db, tarval *con);
3073 /** Constructor for a SymConst_type node.
3075 * Adds the node to the block in current_ir_block.
3076 * This is the constructor for a symbolic constant.
3077 * There are four kinds of symbolic constants:
3078 * - type_tag The symbolic constant represents a type tag. The type the
3079 * tag stands for is given explicitly.
3080 * - size The symbolic constant represents the size of a type. The
3081 * type of which the constant represents the size is given
3083 * - addr_name The symbolic constant represents the address of an entity
3084 * (variable or method). The variable is indicated by a name
3085 * that is valid for linking.
3086 * - addr_ent The symbolic constant represents the address of an entity
3087 * (variable or method). The variable is given explicitly by
3090 * Inputs to the node:
3091 * No inputs except the block it belongs to.
3092 * Outputs of the node.
3093 * An unsigned integer (I_u) or a pointer (P).
3095 * @param *db A pointer for debug information.
3096 * @param mode The mode for the SymConst.
3097 * @param value A type, entity or ident depending on the SymConst kind.
3098 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size,
3099 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
3100 * @param tp The source type of the constant.
3102 ir_node *new_d_SymConst_type(dbg_info *db, ir_mode *mode,
3103 union symconst_symbol value, symconst_kind kind, ir_type *tp);
3105 /** Constructor for a SymConst node.
3107 * Same as new_d_SymConst_type, except that it sets the type to type_unknown.
3109 ir_node *new_d_SymConst(dbg_info *db, ir_mode *mode,
3110 union symconst_symbol value, symconst_kind kind);
3112 /** Constructor for a simpleSel node.
3114 * This is a shortcut for the new_d_Sel() constructor. To be used for
3115 * Sel nodes that do not select from an array, i.e., have no index
3116 * inputs. It adds the two parameters 0, NULL.
3118 * @param *db A pointer for debug information.
3119 * @param *store The memory in which the object the entity should be
3120 * selected from is allocated.
3121 * @param *objptr The object from that the Sel operation selects a
3122 * single attribute out.
3123 * @param *ent The entity to select.
3125 ir_node *new_d_simpleSel(dbg_info *db, ir_node *store, ir_node *objptr, ir_entity *ent);
3127 /** Constructor for a Sel node.
3129 * The select node selects an entity (field or method) from an entity
3130 * with a compound type. It explicitly specifies the entity selected.
3131 * Dynamically the node may select entities that overwrite the given
3132 * entity. If the selected entity is an array element entity the Sel
3133 * node takes the required array indices as inputs.
3134 * Adds the node to the block in current_ir_block.
3136 * @param *db A pointer for debug information.
3137 * @param *store The memory in which the object the entity should be selected
3138 * from is allocated.
3139 * @param *objptr A pointer to a compound entity the Sel operation selects a
3140 * single attribute from.
3141 * @param arity The number of array indices needed to select an array element entity.
3142 * @param *in[] If the compound entity is an array the indices of the selected
3143 * element entity. The constructor copies this array.
3144 * @param *ent The entity to select.
3146 ir_node *new_d_Sel (dbg_info *db, ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3149 /** Constructor for a Call node.
3151 * Represents all kinds of method and function calls.
3152 * Adds the node to the block in current_ir_block.
3154 * @param *db A pointer for debug information.
3155 * @param *store The actual store.
3156 * @param *callee A pointer to the called procedure.
3157 * @param arity The number of procedure parameters.
3158 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3159 * @param *tp Type information of the procedure called.
3161 ir_node *new_d_Call (dbg_info *db, ir_node *store, ir_node *callee, int arity, ir_node *in[],
3164 /** Constructor for a Builtin node.
3166 * Represents a call of a backend-specific builtin..
3167 * Adds the node to the block in current_ir_block.
3169 * @param *db A pointer for debug information.
3170 * @param *store The actual store.
3171 * @param arity The number of procedure parameters.
3172 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3173 * @param kind The kind of the called builtin.
3174 * @param *tp Type information of the procedure called.
3176 ir_node *new_d_Builtin(dbg_info *db, ir_node *store, int arity, ir_node *in[], ir_builtin_kind kind, ir_type *tp);
3178 /** Constructor for a Add node.
3180 * Adds the node to the block in current_ir_block.
3182 * @param *db A pointer for debug information.
3183 * @param *op1 The first operand.
3184 * @param *op2 The second operand.
3185 * @param *mode The mode of the operands and the result.
3187 ir_node *new_d_Add (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3189 /** Constructor for a Sub node.
3191 * Adds the node to the block in current_ir_block.
3193 * @param *db A pointer for debug information.
3194 * @param *op1 The first operand.
3195 * @param *op2 The second operand.
3196 * @param *mode The mode of the operands and the result.
3198 ir_node *new_d_Sub (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3200 /** Constructor for a Minus node.
3202 * Adds the node to the block in current_ir_block.
3204 * @param *db A pointer for debug information.
3205 * @param *op The operand .
3206 * @param *mode The mode of the operand and the result.
3208 ir_node *new_d_Minus (dbg_info *db, ir_node *op, ir_mode *mode);
3210 /** Constructor for a Mul node.
3212 * Adds the node to the block in current_ir_block.
3214 * @param *db A pointer for debug information.
3215 * @param *op1 The first operand.
3216 * @param *op2 The second operand.
3217 * @param *mode The mode of the operands and the result.
3219 ir_node *new_d_Mul (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3221 /** Constructor for a Mulh node.
3223 * Adds the node to the block in current_ir_block.
3225 * @param *db A pointer for debug information.
3226 * @param *op1 The first operand.
3227 * @param *op2 The second operand.
3228 * @param *mode The mode of the operands and the result.
3230 ir_node *new_d_Mulh (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3232 /** Constructor for a Quot node.
3234 * Adds the node to the block in current_ir_block.
3236 * @param *db A pointer for debug information.
3237 * @param *memop The store needed to model exceptions
3238 * @param *op1 The first operand.
3239 * @param *op2 The second operand.
3240 * @param *mode The mode of the result.
3241 * @param state The pinned state.
3243 ir_node *new_d_Quot (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3245 /** Constructor for a DivMod node.
3247 * Adds the node to the block in current_ir_block.
3249 * @param *db A pointer for debug information.
3250 * @param *memop The store needed to model exceptions
3251 * @param *op1 The first operand.
3252 * @param *op2 The second operand.
3253 * @param *mode The mode of the results.
3254 * @param state The pinned state.
3256 ir_node *new_d_DivMod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3258 /** Constructor for a Div node.
3260 * Adds the node to the block in current_ir_block.
3262 * @param *db A pointer for debug information.
3263 * @param *memop The store needed to model exceptions
3264 * @param *op1 The first operand.
3265 * @param *op2 The second operand.
3266 * @param *mode The mode of the result.
3267 * @param state The pinned state.
3269 ir_node *new_d_Div (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3271 /** Constructor for a remainderless Div node.
3273 * Adds the node to the block in current_ir_block.
3275 * @param *db A pointer for debug information.
3276 * @param *memop The store needed to model exceptions
3277 * @param *op1 The first operand.
3278 * @param *op2 The second operand.
3279 * @param *mode The mode of the result.
3280 * @param state The pinned state.
3282 ir_node *new_d_DivRL (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3284 /** Constructor for a Mod node.
3286 * Adds the node to the block in current_ir_block.
3288 * @param *db A pointer for debug information.
3289 * @param *memop The store needed to model exceptions
3290 * @param *op1 The first operand.
3291 * @param *op2 The second operand.
3292 * @param *mode The mode of the result.
3293 * @param state The pinned state.
3295 ir_node *new_d_Mod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3297 /** Constructor for a Abs node.
3299 * Adds the node to the block in current_ir_block.
3301 * @param *db A pointer for debug information.
3302 * @param *op The operand
3303 * @param *mode The mode of the operands and the result.
3305 ir_node *new_d_Abs (dbg_info *db, ir_node *op, ir_mode *mode);
3307 /** Constructor for a And node.
3309 * Adds the node to the block in current_ir_block.
3311 * @param *db A pointer for debug information.
3312 * @param *op1 The first operand.
3313 * @param *op2 The second operand.
3314 * @param *mode The mode of the operands and the result.
3316 ir_node *new_d_And (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3318 /** Constructor for a Or node.
3320 * Adds the node to the block in current_ir_block.
3322 * @param *db A pointer for debug information.
3323 * @param *op1 The first operand.
3324 * @param *op2 The second operand.
3325 * @param *mode The mode of the operands and the result.
3327 ir_node *new_d_Or (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3329 /** Constructor for a Eor node.
3331 * Adds the node to the block in current_ir_block.
3333 * @param *db A pointer for debug information.
3334 * @param *op1 The first operand.
3335 * @param *op2 The second operand.
3336 * @param *mode The mode of the operands and the results.
3338 ir_node *new_d_Eor (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3340 /** Constructor for a Not node.
3342 * Adds the node to the block in current_ir_block.
3344 * @param *db A pointer for debug information.
3345 * @param *op The operand.
3346 * @param *mode The mode of the operand and the result.
3348 ir_node *new_d_Not (dbg_info *db, ir_node *op, ir_mode *mode);
3350 /** Constructor for a Shl node.
3352 * Adds the node to the block in current_ir_block.
3354 * @param *db A pointer for debug information.
3355 * @param *op The operand.
3356 * @param *k The number of bits to shift the operand .
3357 * @param *mode The mode of the operand and the result.
3359 ir_node *new_d_Shl (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3361 /** Constructor for a Shr node.
3363 * Adds the node to the block in current_ir_block.
3365 * @param *db A pointer for debug information.
3366 * @param *op The operand.
3367 * @param *k The number of bits to shift the operand .
3368 * @param *mode The mode of the operand and the result.
3370 ir_node *new_d_Shr (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3372 /** Constructor for a Shrs node.
3374 * Adds the node to the block in current_ir_block.
3376 * @param *db A pointer for debug information.
3377 * @param *op The operand.
3378 * @param *k The number of bits to shift the operand .
3379 * @param *mode The mode of the operand and the result.
3381 ir_node *new_d_Shrs (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3383 /** Constructor for a Rotl node.
3385 * Adds the node to the block in current_ir_block.
3387 * @param *db A pointer for debug information.
3388 * @param *op The operand.
3389 * @param *k The number of bits to rotate the operand.
3390 * @param *mode The mode of the operand.
3392 ir_node *new_d_Rotl (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3394 /** Constructor for a Cmp node.
3396 * Adds the node to the block in current_ir_block.
3398 * @param *db A pointer for debug information.
3399 * @param *op1 The first operand.
3400 * @param *op2 The second operand.
3402 ir_node *new_d_Cmp (dbg_info *db, ir_node *op1, ir_node *op2);
3404 /** Constructor for a Conv node.
3406 * Adds the node to the block in current_ir_block.
3408 * @param *db A pointer for debug information.
3409 * @param *op The operand.
3410 * @param *mode The mode of this the operand muss be converted .
3412 ir_node *new_d_Conv (dbg_info *db, ir_node *op, ir_mode *mode);
3414 /** Constructor for a strict Conv node.
3416 * Adds the node to the block in current_ir_block.
3418 * @param *db A pointer for debug information.
3419 * @param *op The operand.
3420 * @param *mode The mode of this the operand muss be converted .
3422 ir_node *new_d_strictConv (dbg_info *db, ir_node *op, ir_mode *mode);
3424 /** Constructor for a Cast node.
3426 * High level type cast
3427 * Adds the node to the block in current_ir_block.
3429 * @param *db A pointer for debug information.
3430 * @param *op The operand.
3431 * @param *to_tp The type of this the operand muss be casted .
3433 ir_node *new_d_Cast (dbg_info *db, ir_node *op, ir_type *to_tp);
3435 /** Constructor for a Carry node.
3437 * Adds the node to the block in current_ir_block.
3439 * @param *db A pointer for debug information.
3440 * @param *op1 The first operand.
3441 * @param *op2 The second operand.
3442 * @param *mode The mode of the operands and the result.
3444 ir_node *new_d_Carry (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3446 /** Constructor for a Borrow node.
3448 * Adds the node to the block in current_ir_block.
3450 * @param *db A pointer for debug information.
3451 * @param *op1 The first operand.
3452 * @param *op2 The second operand.
3453 * @param *mode The mode of the operands and the result.
3455 ir_node *new_d_Borrow (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3457 /** Constructor for a Phi node.
3459 * Adds the node to the block in current_ir_block.
3461 * @param *db A pointer for debug information.
3462 * @param arity The number of predecessors
3463 * @param *in Array with predecessors
3464 * @param *mode The mode of it's inputs and output.
3466 ir_node *new_d_Phi (dbg_info *db, int arity, ir_node *in[], ir_mode *mode);
3468 /** Constructor for a Load node.
3470 * Adds the node to the block in current_ir_block.
3472 * @param *db A pointer for debug information.
3473 * @param *store The current memory
3474 * @param *addr A pointer to the variable to be read in this memory.
3475 * @param *mode The mode of the value to be loaded.
3476 * @param flags Additional flags for alignment, volatility and pin state.
3478 ir_node *new_d_Load(dbg_info *db, ir_node *store, ir_node *addr, ir_mode *mode, ir_cons_flags flags);
3480 /** Constructor for a Store node.
3482 * Adds the node to the block in current_ir_block.
3484 * @param *db A pointer for debug information.
3485 * @param *store The current memory
3486 * @param *addr A pointer to the variable to be read in this memory.
3487 * @param *val The value to write to this variable.
3488 * @param flags Additional flags for alignment, volatility and pin state.
3490 ir_node *new_d_Store(dbg_info *db, ir_node *store, ir_node *addr, ir_node *val, ir_cons_flags flags);
3492 /** Constructor for a Alloc node.
3494 * The Alloc node extends the memory by space for an entity of type alloc_type.
3495 * Adds the node to the block in current_ir_block.
3497 * @param *db A pointer for debug information.
3498 * @param *store The memory which shall contain the new variable.
3499 * @param *size The number of bytes to allocate.
3500 * @param *alloc_type The type of the allocated variable.
3501 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3503 ir_node *new_d_Alloc (dbg_info *db, ir_node *store, ir_node *size, ir_type *alloc_type,
3504 ir_where_alloc where);
3506 /** Constructor for a Free node.
3508 * Frees the memory occupied by the entity pointed to by the pointer
3509 * arg. Type indicates the type of the entity the argument points to.
3510 * Adds the node to the block in current_ir_block.
3512 * @param *db A pointer for debug information.
3513 * @param *store The memory which shall contain the new variable.
3514 * @param *ptr The pointer to the object to free.
3515 * @param *size The number of objects of type free_type to free in a sequence.
3516 * @param *free_type The type of the freed variable.
3517 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
3519 ir_node *new_d_Free (dbg_info *db, ir_node *store, ir_node *ptr, ir_node *size,
3520 ir_type *free_type, ir_where_alloc where);
3522 /** Constructor for a Sync node.
3524 * Merges several memory values. The node assumes that a variable
3525 * either occurs only in one of the memories, or it contains the same
3526 * value in all memories where it occurs.
3527 * Adds the node to the block in current_ir_block.
3529 * @param *db A pointer for debug information.
3530 * @param arity The number of memories to synchronize.
3531 * @param **in An array of pointers to nodes that produce an output of type
3532 * memory. The constructor copies this array.
3534 ir_node *new_d_Sync (dbg_info *db, int arity, ir_node *in[]);
3536 /** Constructor for a Proj node.
3538 * Projects a single value out of a tuple. The parameter proj gives the
3539 * position of the value within the tuple.
3540 * Adds the node to the block in current_ir_block.
3542 * @param *db A pointer for deubug information.
3543 * @param arg A node producing a tuple.
3544 * @param *mode The mode of the value to project.
3545 * @param proj The position of the value in the tuple.
3547 ir_node *new_d_Proj (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3549 /** Constructor for a defaultProj node.
3551 * Represents the default control flow of a Switch-Cond node.
3552 * Adds the node to the block in current_ir_block.
3554 * @param *db A pointer for debug information.
3555 * @param arg A node producing a tuple.
3556 * @param max_proj The end position of the value in the tuple.
3558 ir_node *new_d_defaultProj (dbg_info *db, ir_node *arg, long max_proj);
3560 /** Constructor for a Tuple node.
3562 * This is an auxiliary node to replace a node that returns a tuple
3563 * without changing the corresponding Proj nodes.
3564 * Adds the node to the block in current_ir_block.
3566 * @param *db A pointer for debug information.
3567 * @param arity The number of tuple elements.
3568 * @param **in An array containing pointers to the nodes producing the tuple elements.
3570 ir_node *new_d_Tuple (dbg_info *db, int arity, ir_node *in[]);
3572 /** Constructor for a Id node.
3574 * This is an auxiliary node to replace a node that returns a single
3575 * value. Adds the node to the block in current_ir_block.
3577 * @param *db A pointer for debug information.
3578 * @param *val The operand to Id.
3579 * @param *mode The mode of *val.
3581 ir_node *new_d_Id (dbg_info *db, ir_node *val, ir_mode *mode);
3583 /** Constructor for a Confirm node.
3585 * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3586 * Specifies constraints for a value. To support dataflow analyses.
3588 * Example: If the value never exceeds '100' this is expressed by placing a
3589 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
3591 * @param *db A pointer for debug information.
3592 * @param *val The value we express a constraint for
3593 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3594 * @param cmp The compare operation.
3596 ir_node *new_d_Confirm (dbg_info *db, ir_node *val, ir_node *bound, pn_Cmp cmp);
3598 /** Constructor for an Unknown node.
3600 * Represents an arbitrary value. Places the node in
3603 * @param *m The mode of the unknown value.
3605 ir_node *new_d_Unknown(dbg_info *db, ir_mode *m);
3607 /** Constructor for a CallBegin node.
3609 * CallBegin represents control flow depending of the pointer value
3610 * representing the called method to the called methods. The
3611 * constructor copies the method pointer input from the passed Call
3612 * node.Adds the node to the block in current_ir_block.
3614 * @param *db A pointer for debug information.
3615 * @param *callee The call node visible in the intra procedural view.
3617 ir_node *new_d_CallBegin(dbg_info *db, ir_node *ptr, ir_node *call);
3619 /** Constructor for an EndReg node.
3621 *Adds the node to the block in current_ir_block.
3623 * @param *db A pointer for debug information.
3625 ir_node *new_d_EndReg (dbg_info *db);
3627 /** Constructor for an EndExcept node.
3629 * Used to represent regular procedure end in interprocedual view.
3630 * Adds the node to the block in current_ir_block.
3632 * @param *db A pointer for debug information.
3634 ir_node *new_d_EndExcept(dbg_info *db);
3636 /** Constructor for a Break node.
3638 * Used to represent exceptional procedure end in interprocedural view.
3639 * Adds the node to the block in current_ir_block.
3641 * Break represents control flow to a single control successor just as Jmp.
3642 * The blocks separated by a break may not be concatenated by an optimization.
3643 * It is used for the interprocedural representation where blocks are parted
3644 * behind Call nodes to represent the control flow to called procedures.
3646 * @param *db A pointer for debug information.
3648 ir_node *new_d_Break (dbg_info *db);
3650 /** Constructor for a Filter node.
3652 * Constructor for a Filter node. Adds the node to the block in
3653 * current_ir_block. Filter is a node with two views used to
3654 * construct the interprocedural view. In intraprocedural view its
3655 * semantics are identical to the Proj node. In interprocedural view
3656 * the Filter performs the Phi operation on method parameters or
3657 * results. Other than a Phi a Filter node may not be removed if it
3658 * has only a single input.
3660 * The constructor builds the Filter in intraprocedural view.
3662 * @param *db A pointer for debug information.
3663 * @param *arg The tuple value to project from.
3664 * @param *mode The mode of the projected value.
3665 * @param proj The position in the tuple to project from.
3667 ir_node *new_d_Filter (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3669 /** Constructor for a Mux node.
3671 * @param *db A pointer for debug information.
3672 * @param *sel The ir_node that calculates the boolean select.
3673 * @param *ir_true The ir_node that calculates the true result.
3674 * @param *ir_false The ir_node that calculates the false result.
3675 * @param *mode The mode of the node (and it_true and ir_false).
3677 ir_node *new_d_Mux (dbg_info *db, ir_node *sel,
3678 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
3680 /** Constructor for a CopyB node.
3682 * @param *db A pointer for debug information.
3683 * @param *store The current memory
3684 * @param *dst The ir_node that represents the destination address.
3685 * @param *src The ir_node that represents the source address.
3686 * @param *data_type The type of the copied data
3688 ir_node *new_d_CopyB(dbg_info *db, ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
3690 /** Constructor for a InstOf node.
3692 * A High-Level Type check.
3694 * @param *db A pointer for debug information.
3695 * @param *store The memory in which the object the entity should be selected
3696 * from is allocated.
3697 * @param *objptr A pointer to a object of a class type.
3698 * @param *type The type of which objptr must be.
3700 ir_node *new_d_InstOf (dbg_info *db, ir_node *store, ir_node *objptr, ir_type *type);
3702 /** Constructor for a Raise node.
3704 * A High-Level Exception throw.
3706 * @param *db A pointer for debug information.
3707 * @param *store The current memory.
3708 * @param *obj A pointer to the Except variable.
3710 ir_node *new_d_Raise (dbg_info *db, ir_node *store, ir_node *obj);
3712 /** Constructor for a Bound node.
3714 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
3716 * @param *db A pointer for debug information.
3717 * @param *store The current memory
3718 * @param *idx The ir_node that represents an index.
3719 * @param *lower The ir_node that represents the lower bound for the index.
3720 * @param *upper The ir_node that represents the upper bound for the index.
3722 ir_node *new_d_Bound(dbg_info *db, ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
3724 /** Constructor for a Pin node.
3726 * @param *db A pointer for debug information.
3727 * @param *node The node which value should be pinned.
3729 ir_node *new_d_Pin(dbg_info *db, ir_node *node);
3731 /** Constructor for an ASM pseudo node.
3733 * @param *db A pointer for debug information.
3734 * @param arity The number of data inputs to the node.
3735 * @param *in The array of length arity of data inputs.
3736 * @param *inputs The array of length arity of input constraints.
3737 * @param n_outs The number of data outputs to the node.
3738 * @param *outputs The array of length n_outs of output constraints.
3739 * @param n_clobber The number of clobbered registers.
3740 * @param *clobber The array of length n_clobber of clobbered registers.
3741 * @param *asm_text The assembler text.
3743 ir_node *new_d_ASM(dbg_info *db, int arity, ir_node *in[], ir_asm_constraint *inputs,
3744 int n_outs, ir_asm_constraint *outputs,
3745 int n_clobber, ident *clobber[], ident *asm_text);
3747 /*-----------------------------------------------------------------------*/
3748 /* The block oriented interface without debug support */
3749 /*-----------------------------------------------------------------------*/
3751 /* Needed from the interface with debug support:
3752 void set_cur_block (ir_node *target); */
3754 /** Constructor for a Block node.
3756 * Constructor for a Block node. Adds the block to the graph in
3757 * current_ir_graph. Constructs a Block with a fixed number of
3758 * predecessors. Does set current_block. Can be used with automatic
3759 * Phi node construction.
3761 * @param arity The number of control predecessors.
3762 * @param in An array of control predecessors. The length of
3763 * the array must be 'arity'.
3765 ir_node *new_Block(int arity, ir_node *in[]);
3767 /** Constructor for a Start node.
3769 * Adds the node to the block in current_ir_block.
3772 ir_node *new_Start (void);
3774 /** Constructor for an End node.
3776 * Adds the node to the block in current_ir_block.
3778 ir_node *new_End (void);
3780 /** Constructor for an EndReg node.
3782 * Used to represent regular procedure end in interprocedual view.
3783 * Adds the node to the block in current_ir_block.
3785 ir_node *new_EndReg (void);
3787 /** Constructor for an EndExpcept node.
3789 * Used to represent exceptional procedure end in interprocedural view.
3790 * Adds the node to the block in current_ir_block.
3792 ir_node *new_EndExcept(void);
3794 /** Constructor for a Jump node.
3796 * Adds the node to the block in current_ir_block.
3798 * Jmp represents control flow to a single control successor.
3800 ir_node *new_Jmp (void);
3802 /** Constructor for an IJmp node.
3804 * IJmp represents control flow to a single control successor not
3805 * statically known i.e. an indirect Jmp.
3807 * @param *tgt The IR node representing the target address.
3809 ir_node *new_IJmp (ir_node *tgt);
3811 /** Constructor for a Break node.
3812 * Break represents control flow to a single control successor just as Jmp.
3813 * The blocks separated by a break may not be concatenated by an optimization.
3814 * It is used for the interprocedural representation where blocks are parted
3815 * behind Call nodes to represent the control flow to called procedures.
3816 * Adds the node to the block in current_ir_block.
3818 ir_node *new_Break (void);
3820 /** Constructor for a Cond node.
3822 * If c is mode_b represents a conditional branch (if/else). If c is
3823 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
3824 * node, default Proj is 0.). Adds the node to the block in current_ir_block.
3826 * This is not consistent: Input to Cond is Is, Proj has as proj number
3830 * @param *c The conditions parameter.Can be of mode b or I_u.
3832 ir_node *new_Cond (ir_node *c);
3834 /** Constructor for a Return node.
3836 * Returns the memory and zero or more return values. Only node that
3837 * can end regular control flow. Adds the node to the block in current_ir_block.
3839 * @param *store The state of memory.
3840 * @param arity Number of array indices.
3841 * @param *in Array with index inputs to the node.
3843 ir_node *new_Return (ir_node *store, int arity, ir_node *in[]);
3845 /** Constructor for a Const node.
3847 * Constructor for a Const node. The constant represents a target
3848 * value. Sets the type information to type_unknown. (No more
3849 * supported: If tv is entity derives a somehow useful type.)
3850 * Adds the node to the block in current_ir_block.
3851 * Derives mode from passed tarval.
3853 * @param *con Points to an entry in the constant table. This pointer is
3854 * added to the attributes of the node.
3856 ir_node *new_Const (tarval *con);
3859 * Make a const from a long.
3860 * This is just convenience for the usual
3862 * new_Const(mode, tarval_from_long(mode, ...))
3865 * @param mode The mode for the const.
3866 * @param value The value of the constant.
3867 * @return A new const node.
3869 ir_node *new_Const_long(ir_mode *mode, long value);
3871 /** Constructor for a Const node.
3873 * Derives mode from passed tarval. */
3874 ir_node *new_Const_type(tarval *con, ir_type *tp);
3876 /** Constructor for a SymConst node.
3878 * Adds the node to the block in current_ir_block.
3879 * This is the constructor for a symbolic constant.
3880 * There are four kinds of symbolic constants:
3881 * -# type_tag The symbolic constant represents a type tag. The type the
3882 * tag stands for is given explicitly.
3883 * -# size The symbolic constant represents the size of a type. The
3884 * type of which the constant represents the size is given
3886 * -# align The symbolic constant represents the alignment of a type. The
3887 * type of which the constant represents the size is given
3889 * -# addr_name The symbolic constant represents the address of an entity
3890 * (variable or method). The variable is indicated by a name
3891 * that is valid for linking.
3892 * -# addr_ent The symbolic constant represents the address of an entity
3893 * (variable or method). The variable is given explicitly by
3896 * Inputs to the node:
3897 * No inputs except the block it belongs to.
3898 * Outputs of the node.
3899 * An unsigned integer (I_u) or a pointer (P).
3901 * @param mode The mode for the SymConst.
3902 * @param value A type or a ident depending on the SymConst kind.
3903 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3904 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
3905 * @param tp The source type of the constant.
3907 ir_node *new_SymConst_type(ir_mode *mode, union symconst_symbol value, symconst_kind kind, ir_type *tp);
3909 /** Constructor for a SymConst node.
3911 * Adds the node to the block in current_ir_block.
3912 * This is the constructor for a symbolic constant.
3913 * There are four kinds of symbolic constants:
3914 * -# type_tag The symbolic constant represents a type tag. The type the
3915 * tag stands for is given explicitly.
3916 * -# size The symbolic constant represents the size of a type. The
3917 * type of which the constant represents the size is given
3919 * -# align The symbolic constant represents the alignment of a type. The
3920 * type of which the constant represents the size is given
3922 * -# addr_name The symbolic constant represents the address of an entity
3923 * (variable or method). The variable is indicated by a name
3924 * that is valid for linking.
3925 * -# addr_ent The symbolic constant represents the address of an entity
3926 * (variable or method). The variable is given explicitly by
3929 * Inputs to the node:
3930 * No inputs except the block it belongs to.
3931 * Outputs of the node.
3932 * An unsigned integer (I_u) or a pointer (P).
3934 * @param mode The mode for the SymConst.
3935 * @param value A type or a ident depending on the SymConst kind.
3936 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3937 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
3939 ir_node *new_SymConst(ir_mode *mode, union symconst_symbol value, symconst_kind kind);
3941 /** Constructor for a simpelSel node.
3943 * This is a shortcut for the new_Sel() constructor. To be used for
3944 * Sel nodes that do not select from an array, i.e., have no index
3945 * inputs. It adds the two parameters 0, NULL.
3947 * @param *store The memory in which the object the entity should be selected from is allocated.
3948 * @param *objptr The object from that the Sel operation selects a single attribute out.
3949 * @param *ent The entity to select.
3951 ir_node *new_simpleSel(ir_node *store, ir_node *objptr, ir_entity *ent);
3953 /** Constructor for a Sel node.
3955 * The select node selects an entity (field or method) from an entity
3956 * with a compound type. It explicitly specifies the entity selected.
3957 * Dynamically the node may select entities that overwrite the given
3958 * entity. If the selected entity is an array element entity the Sel
3959 * node takes the required array indices as inputs.
3960 * Adds the node to the block in current_ir_block.
3962 * @param *store The memory in which the object the entity should be selected
3963 * from is allocated.
3964 * @param *objptr A pointer to a compound entity the Sel operation selects a
3965 * single attribute from.
3966 * @param arity The number of array indices needed to select an array element entity.
3967 * @param *in[] If the compound entity is an array the indices of the selected
3968 * element entity. The constructor copies this array.
3969 * @param *ent The entity to select.
3971 ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3974 /** Constructor for a Call node.
3976 * Adds the node to the block in current_ir_block.
3977 * Represents all kinds of method and function calls.
3979 * @param *store The actual store.
3980 * @param *callee A pointer to the called procedure.
3981 * @param arity The number of procedure parameters.
3982 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3983 * @param *tp Type information of the procedure called.
3985 ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node *in[],
3988 /** Constructor for a Builtin node.
3990 * Represents a call of a backend-specific builtin..
3991 * Represents all kinds of method and function calls.
3993 * @param *store The actual store.
3994 * @param kind The kind of the called builtin.
3995 * @param arity The number of procedure parameters.
3996 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3997 * @param *tp Type information of the procedure called.
3999 ir_node *new_Builtin(ir_node *store, int arity, ir_node *in[],
4000 ir_builtin_kind kind, ir_type *tp);
4002 /** Constructor for a CallBegin node.
4004 * CallBegin represents control flow depending of the pointer value
4005 * representing the called method to the called methods. The
4006 * constructor copies the method pointer input from the passed Call
4007 * node. Adds the node to the block in current_ir_block.
4009 * @param *callee A pointer to the called procedure.
4011 ir_node *new_CallBegin(ir_node *ptr, ir_node *call);
4013 /** Constructor for a Add node.
4015 * Adds the node to the block in current_ir_block.
4017 * @param *op1 The first operand.
4018 * @param *op2 The second operand.
4019 * @param *mode The mode of the operands and the result.
4021 ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
4023 /** Constructor for a Sub node.
4025 * Adds the node to the block in current_ir_block.
4027 * @param *op1 The first operand.
4028 * @param *op2 The second operand.
4029 * @param *mode The mode of the operands and the result.
4031 ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
4033 /** Constructor for a Minus node.
4035 * Adds the node to the block in current_ir_block.
4037 * @param *op The operand .
4038 * @param *mode The mode of the operand and the result.
4040 ir_node *new_Minus (ir_node *op, ir_mode *mode);
4043 * Constructor for a Mul node. Adds the node to the block in current_ir_block.
4045 * @param *op1 The first operand.
4046 * @param *op2 The second operand.
4047 * @param *mode The mode of the operands and the result.
4049 ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
4052 * Constructor for a Mulh node. Adds the node to the block in current_ir_block.
4054 * @param *op1 The first operand.
4055 * @param *op2 The second operand.
4056 * @param *mode The mode of the operands and the result.
4058 ir_node *new_Mulh (ir_node *op1, ir_node *op2, ir_mode *mode);
4060 /** Constructor for a Quot node.
4062 * Adds the node to the block in current_ir_block.
4064 * @param *memop The store needed to model exceptions
4065 * @param *op1 The first operand.
4066 * @param *op2 The second operand.
4067 * @param *mode The mode of the result.
4068 * @param state The pinned state.
4070 ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
4072 /** Constructor for a DivMod node.
4074 * Adds the node to the block in current_ir_block.
4076 * @param *memop The store needed to model exceptions
4077 * @param *op1 The first operand.
4078 * @param *op2 The second operand.
4079 * @param *mode The mode of the results.
4080 * @param state The pinned state.
4082 ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
4084 /** Constructor for a Div node.
4086 * Adds the node to the block in current_ir_block.
4088 * @param *memop The store needed to model exceptions
4089 * @param *op1 The first operand.
4090 * @param *op2 The second operand.
4091 * @param *mode The mode of the result.
4092 * @param state The pinned state.
4094 ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
4096 /** Constructor for a remainderless Div node.
4098 * Adds the node to the block in current_ir_block.
4100 * @param *memop The store needed to model exceptions
4101 * @param *op1 The first operand.
4102 * @param *op2 The second operand.
4103 * @param *mode The mode of the result.
4104 * @param state The pinned state.
4106 ir_node *new_DivRL (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
4108 /** Constructor for a Mod node.
4110 * Adds the node to the block in current_ir_block.
4112 * @param *memop The store needed to model exceptions
4113 * @param *op1 The first operand.
4114 * @param *op2 The second operand.
4115 * @param *mode The mode of the result.
4116 * @param state The pinned state.
4118 ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
4120 /** Constructor for a Abs node.
4122 * Adds the node to the block in current_ir_block.
4124 * @param *op The operand
4125 * @param *mode The mode of the operands and the result.
4127 ir_node *new_Abs (ir_node *op, ir_mode *mode);
4129 /** Constructor for a And node.
4131 * Adds the node to the block in current_ir_block.
4133 * @param *op1 The first operand.
4134 * @param *op2 The second operand.
4135 * @param *mode The mode of the operands and the result.
4137 ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
4140 * Constructor for a Or node. Adds the node to the block in current_ir_block.
4142 * @param *op1 The first operand.
4143 * @param *op2 The second operand.
4144 * @param *mode The mode of the operands and the result.
4146 ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
4149 * Constructor for a Eor node. Adds the node to the block in current_ir_block.
4151 * @param *op1 The first operand.
4152 * @param *op2 The second operand.
4153 * @param *mode The mode of the operands and the results.
4155 ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
4157 /** Constructor for a Not node.
4159 * Adds the node to the block in current_ir_block.
4161 * @param *op The operand.
4162 * @param *mode The mode of the operand and the result.
4164 ir_node *new_Not (ir_node *op, ir_mode *mode);
4166 /** Constructor for a Shl node.
4168 * Adds the node to the block in current_ir_block.
4170 * @param *op The operand.
4171 * @param *k The number of bits to shift the operand .
4172 * @param *mode The mode of the operand and the result.
4174 ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
4177 * Constructor for a Shr node. Adds the node to the block in current_ir_block.
4179 * @param *op The operand.
4180 * @param *k The number of bits to shift the operand .
4181 * @param *mode The mode of the operand and the result.
4183 ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
4185 /** Constructor for a Shrs node.
4187 * Adds the node to the block in current_ir_block.
4189 * @param *op The operand.
4190 * @param *k The number of bits to shift the operand .
4191 * @param *mode The mode of the operand and the result.
4193 ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
4195 /** Constructor for a Rotl node.
4197 * Adds the node to the block in current_ir_block.
4199 * @param *op The operand.
4200 * @param *k The number of bits to rotate the operand.
4201 * @param *mode The mode of the operand.
4203 ir_node *new_Rotl (ir_node *op, ir_node *k, ir_mode *mode);
4205 /** Constructor for a Cmp node.
4207 * Adds the node to the block in current_ir_block.
4209 * @param *op1 The first operand.
4210 * @param *op2 The second operand.
4212 ir_node *new_Cmp (ir_node *op1, ir_node *op2);
4214 /** Constructor for a Conv node.
4216 * Adds the node to the block in current_ir_block.
4218 * @param *op The operand.
4219 * @param *mode The mode of this the operand muss be converted.
4221 ir_node *new_Conv (ir_node *op, ir_mode *mode);
4223 /** Constructor for a strict Conv node.
4225 * Adds the node to the block in current_ir_block.
4227 * @param *op The operand.
4228 * @param *mode The mode of this the operand muss be converted.
4230 ir_node *new_strictConv (ir_node *op, ir_mode *mode);
4232 /** Constructor for a Cast node.
4234 * Adds the node to the block in current_ir_block.
4235 * High level type cast
4237 * @param *op The operand.
4238 * @param *to_tp The type of this the operand muss be casted .
4240 ir_node *new_Cast (ir_node *op, ir_type *to_tp);
4242 /** Constructor for a Carry node.
4244 * Adds the node to the block in current_ir_block.
4246 * @param *op1 The first operand.
4247 * @param *op2 The second operand.
4248 * @param *mode The mode of the operands and the result.
4250 ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode);
4252 /** Constructor for a Borrow node.
4254 * Adds the node to the block in current_ir_block.
4256 * @param *op1 The first operand.
4257 * @param *op2 The second operand.
4258 * @param *mode The mode of the operands and the result.
4260 ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode);
4262 /** Constructor for a Phi node.
4264 * Adds the node to the block in current_ir_block.
4266 * @param arity The number of predecessors.
4267 * @param *in Array with predecessors.
4268 * @param *mode The mode of it's inputs and output.
4270 ir_node *new_Phi (int arity, ir_node *in[], ir_mode *mode);
4272 /** Constructor for a Load node.
4274 * @param *store The current memory.
4275 * @param *addr A pointer to the variable to be read in this memory.
4276 * @param *mode The mode of the value to be loaded.
4277 * @param flags Additional flags for alignment, volatility and pin state.
4279 ir_node *new_Load(ir_node *store, ir_node *addr, ir_mode *mode, ir_cons_flags flags);
4281 /** Constructor for a Store node.
4283 * @param *store The current memory.
4284 * @param *addr A pointer to the variable to be read in this memory.
4285 * @param *val The value to write to this variable.
4286 * @param flags Additional flags for alignment, volatility and pin state.
4288 ir_node *new_Store(ir_node *store, ir_node *addr, ir_node *val, ir_cons_flags flags);
4290 /** Constructor for a Alloc node.
4292 * The Alloc node extends the memory by space for an entity of type alloc_type.
4293 * Adds the node to the block in current_ir_block.
4295 * @param *store The memory which shall contain the new variable.
4296 * @param *size The number of bytes to allocate.
4297 * @param *alloc_type The type of the allocated variable.
4298 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
4300 ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
4301 ir_where_alloc where);
4303 /** Constructor for a Free node.
4305 * Frees the memory occupied by the entity pointed to by the pointer
4306 * arg. Type indicates the type of the entity the argument points to.
4307 * Adds the node to the block in current_ir_block.
4309 * @param *store The memory which shall contain the new variable.
4310 * @param *ptr The pointer to the object to free.
4311 * @param *size The number of objects of type free_type to free in a sequence.
4312 * @param *free_type The type of the freed variable.
4313 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
4315 ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
4316 ir_type *free_type, ir_where_alloc where);
4318 /** Constructor for a Sync node.
4320 * Merges several memory values. The node assumes that a variable
4321 * either occurs only in one of the memories, or it contains the same
4322 * value in all memories where it occurs.
4323 * Adds the node to the block in current_ir_block.
4325 * @param arity The number of memories to synchronize.
4326 * @param **in An array of pointers to nodes that produce an output of type
4327 * memory. The constructor copies this array.
4329 ir_node *new_Sync (int arity, ir_node *in[]);
4331 /** Constructor for a Proj node.
4333 * Projects a single value out of a tuple. The parameter proj gives the
4334 * position of the value within the tuple.
4335 * Adds the node to the block in current_ir_block.
4337 * @param arg A node producing a tuple.
4338 * @param *mode The mode of the value to project.
4339 * @param proj The position of the value in the tuple.
4341 ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
4343 /** Constructor for a Filter node.
4345 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
4346 * Filter is a node with two views used to construct the interprocedural view.
4347 * In intraprocedural view its semantics are identical to the Proj node.
4348 * In interprocedural view the Filter performs the Phi operation on method
4349 * parameters or results. Other than a Phi a Filter node may not be removed
4350 * if it has only a single input.
4352 * The constructor builds the Filter in intraprocedural view.
4354 * @param *arg The tuple value to project from.
4355 * @param *mode The mode of the projected value.
4356 * @param proj The position in the tuple to project from.
4358 ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj);
4360 /** Constructor for a defaultProj node.
4362 * Represents the default control flow of a Switch-Cond node.
4363 * Adds the node to the block in current_ir_block.
4365 * @param arg A node producing a tuple.
4366 * @param max_proj The end position of the value in the tuple.
4368 ir_node *new_defaultProj (ir_node *arg, long max_proj);
4370 /** Constructor for a Tuple node.
4372 * This is an auxiliary node to replace a node that returns a tuple
4373 * without changing the corresponding Proj nodes.
4374 * Adds the node to the block in current_ir_block.
4376 * @param arity The number of tuple elements.
4377 * @param **in An array containing pointers to the nodes producing the tuple elements.
4379 ir_node *new_Tuple (int arity, ir_node *in[]);
4381 /** Constructor for an Id node.
4383 * This is an auxiliary node to replace a node that returns a single
4384 * value. Adds the node to the block in current_ir_block.
4386 * @param *val The operand to Id.
4387 * @param *mode The mode of *val.
4389 ir_node *new_Id (ir_node *val, ir_mode *mode);
4391 /** Constructor for a Bad node.
4393 * Returns the unique Bad node of the graph. The same as
4396 ir_node *new_Bad (void);
4398 /** Constructor for a Confirm node.
4400 * Specifies constraints for a value. To support dataflow analyses.
4401 * Adds the node to the block in current_ir_block.
4403 * Example: If the value never exceeds '100' this is expressed by placing a
4404 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
4406 * @param *val The value we express a constraint for
4407 * @param *bound The value to compare against. Must be a firm node, typically a constant.
4408 * @param cmp The compare operation.
4410 ir_node *new_Confirm (ir_node *val, ir_node *bound, pn_Cmp cmp);
4412 /** Constructor for an Unknown node.
4414 * Represents an arbitrary value. Places the node in
4417 * @param *m The mode of the unknown value.
4419 ir_node *new_Unknown(ir_mode *m);
4421 /** Constructor for a NoMem node.
4423 * Returns the unique NoMem node of the graph. The same as
4426 ir_node *new_NoMem (void);
4428 /** Constructor for a Mux node.
4430 * Adds the node to the block in current_ir_block.
4432 * @param *sel The ir_node that calculates the boolean select.
4433 * @param *ir_true The ir_node that calculates the true result.
4434 * @param *ir_false The ir_node that calculates the false result.
4435 * @param *mode The mode of the node (and it_true and ir_false).
4437 ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
4439 /** Constructor for a CopyB node.
4441 * Adds the node to the block in current_ir_block.
4443 * @param *store The current memory
4444 * @param *dst The ir_node that represents the destination address.
4445 * @param *src The ir_node that represents the source address.
4446 * @param *data_type The type of the copied data
4448 ir_node *new_CopyB(ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
4450 /** Constructor for a InstOf node.
4452 * A High-Level Type check.
4454 * @param *store The memory in which the object the entity should be selected
4455 * from is allocated.
4456 * @param *objptr A pointer to a object of a class type.
4457 * @param *type The type of which objptr must be.
4459 ir_node *new_InstOf (ir_node *store, ir_node *objptr, ir_type *type);
4461 /**Constructor for a Raise node.
4463 * A High-Level Exception throw.
4465 * @param *store The current memory.
4466 * @param *obj A pointer to the Except variable.
4468 ir_node *new_Raise (ir_node *store, ir_node *obj);
4470 /** Constructor for a Bound node.
4472 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
4474 * Adds the node to the block in current_ir_block.
4476 * @param *store The current memory
4477 * @param *idx The ir_node that represents an index.
4478 * @param *lower The ir_node that represents the lower bound for the index.
4479 * @param *upper The ir_node that represents the upper bound for the index.
4481 ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
4483 /** Constructor for a Pin node.
4485 * @param *node The node which value should be pinned.
4487 ir_node *new_Pin (ir_node *node);
4489 /** Constructor for an ASM pseudo node.
4491 * @param arity The number of data inputs to the node.
4492 * @param *in The array of length arity of data inputs.
4493 * @param *inputs The array of length arity of input constraints.
4494 * @param n_outs The number of data outputs to the node.
4495 * @param *outputs The array of length n_outs of output constraints.
4496 * @param n_clobber The number of clobbered registers.
4497 * @param *clobber The array of length n_clobber of clobbered registers.
4498 * @param *asm_text The assembler text.
4500 ir_node *new_ASM(int arity, ir_node *in[], ir_asm_constraint *inputs,
4501 int n_outs, ir_asm_constraint *outputs,
4502 int n_clobber, ident *clobber[], ident *asm_text);
4504 /** Constructor for a Dummy node.
4506 * @param *mode The mode of the node.
4508 ir_node *new_Dummy(ir_mode *mode);
4510 ir_node *new_r_Dummy(ir_graph *irg, ir_mode *mode);
4512 ir_node *new_rd_Dummy(dbg_info *db, ir_graph *irg, ir_mode *mode);
4514 /*---------------------------------------------------------------------*/
4515 /* The comfortable interface. */
4516 /* Supports automatic Phi node construction. */
4517 /* All routines of the block oriented interface except new_Block are */
4519 /*---------------------------------------------------------------------*/
4521 /** Create an immature Block.
4523 * An immature Block has an unknown number of predecessors. Predecessors
4524 * can be added with add_immBlock_pred(). Once all predecessors are
4525 * added the block must be matured.
4527 * Adds the block to the graph in current_ir_graph. Can be used with automatic
4528 * Phi node construction.
4529 * This constructor can only be used if the graph is in state_building.
4531 ir_node *new_d_immBlock(dbg_info *db);
4532 ir_node *new_immBlock(void);
4534 /** Create an immature PartBlock.
4536 * An immature block has only one Block or PartBlock predecessor.
4537 * A PartBlock forms together with one BLock and possibly other
4538 * PartBlocks a MacroBlock.
4540 * Adds the PartBlock to the graph in current_ir_graph. Does set
4541 * current_block. Can be used with automatic Phi node construction.
4542 * This constructor can only be used if the graph is in
4545 ir_node *new_d_immPartBlock(dbg_info *db, ir_node *pred_jmp);
4546 ir_node *new_immPartBlock(ir_node *pred_jmp);
4548 /** Add a control flow edge to an immature block. */
4549 void add_immBlock_pred(ir_node *immblock, ir_node *jmp);
4551 /** Finalize a Block node, when all control flows are known. */
4552 void mature_immBlock(ir_node *block);
4553 #define mature_cur_block() mature_immBlock(get_cur_block());
4556 /** Get the current value of a local variable.
4558 * Use this function to obtain the last definition of the local variable
4559 * associated with pos. Pos may not exceed the value passed as n_loc
4560 * to new_ir_graph. This call automatically inserts Phi nodes.
4562 * @param *db A pointer for debug information.
4563 * @param pos The position/id of the local variable.
4564 * @param *mode The mode of the value to get.
4566 ir_node *get_d_value(dbg_info *db, int pos, ir_mode *mode);
4567 ir_node *get_value(int pos, ir_mode *mode);
4569 /** Remark a new definition of a variable.
4571 * Use this function to remember a new definition of the value
4572 * associated with pos. Pos may not exceed the value passed as n_loc
4573 * to new_ir_graph. This call is needed to automatically inserts Phi
4576 * @param pos The position/id of the local variable.
4577 * @param *value The new value written to the local variable.
4579 void set_value(int pos, ir_node *value);
4581 /** Find the value number for a node in the current block.
4583 * This function searches all values in the current block for
4584 * a given value and returns its value number if it was found, else
4586 * Note that this does not mean that the value does not exists,
4587 * it's just not equal the node (for instance behind a Phi/Confirm ...)
4589 * @param *value The value to find.
4591 int find_value(ir_node *value);
4593 /** Get the current memory state.
4595 * Use this function to obtain the last definition of the memory
4596 * state. This call automatically inserts Phi nodes for the memory
4599 ir_node *get_store(void);
4601 /** Remark a new definition of the memory state.
4603 * Use this function to remember a new definition of the memory state.
4604 * This call is needed to automatically inserts Phi nodes.
4606 * @param *store The new memory state.
4608 void set_store(ir_node *store);
4610 /** keep this node alive even if End is not control-reachable from it
4612 * @param ka The node to keep alive.
4614 void keep_alive(ir_node *ka);
4616 /** Returns the frame type of the current graph */
4617 ir_type *get_cur_frame_type(void);
4620 /* --- initialize and finalize IR construction --- */
4622 /** Puts the graph into state "phase_high" */
4623 #define irg_finalize_cons(irg) set_irg_phase_state(irg, phase_high)
4625 /** Puts the program and all graphs into state phase_high.
4627 * This also remarks, the construction of types is finished,
4628 * e.g., that no more subtypes will be added. */
4629 void irp_finalize_cons(void);
4631 /* --- Initialization --- */