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 its 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 its predecessors 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 its
116 * result. A Firm mode is a datatype as known to the
117 * target, 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 its
125 * first Phi node, this node points to the second Phi node
126 * in the Block and so forth. 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 held 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 *block The IR block the node belongs to.
1202 ir_node *new_rd_Jmp(dbg_info *db, ir_node *block);
1204 /** Constructor for an IJmp node.
1206 * IJmp represents control flow to a single control successor not
1207 * statically known i.e. an indirect Jmp.
1209 * @param *db A pointer for debug information.
1210 * @param *block The IR block the node belongs to.
1211 * @param *tgt The IR node representing the target address.
1213 ir_node *new_rd_IJmp(dbg_info *db, ir_node *block, ir_node *tgt);
1215 /** Constructor for a Break node.
1217 * Break represents control flow to a single control successor just as Jmp.
1218 * The blocks separated by a break may not be concatenated by an optimization.
1219 * It is used for the interprocedural representation where blocks are parted
1220 * behind Call nodes to represent the control flow to called procedures.
1222 * @param *db A pointer for debug information.
1223 * @param *block The block the node belong to.
1225 ir_node *new_rd_Break(dbg_info *db, ir_node *block);
1227 /** Constructor for a Cond node.
1229 * If c is mode_b represents a conditional branch (if/else). If c is
1230 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
1231 * node, default Proj is 0.)
1233 * This is not consistent: Input to Cond is Is, Proj has as proj number
1236 * @param *db A pointer for debug information.
1237 * @param *block The IR block the node belongs to.
1238 * @param *c The conditions parameter. Can be of mode b or I_u.
1240 ir_node *new_rd_Cond(dbg_info *db, ir_node *block, ir_node *c);
1242 /** Constructor for a Return node.
1244 * Returns the memory and zero or more return values. Only node that
1245 * can end regular control flow.
1247 * @param *db A pointer for debug information.
1248 * @param *block The IR block the node belongs to.
1249 * @param *store The state of memory.
1250 * @param arity Number of return values.
1251 * @param *in Array of length arity with return values. The constructor copies this array.
1253 ir_node *new_rd_Return(dbg_info *db, ir_node *block,
1254 ir_node *store, int arity, ir_node *in[]);
1256 /** Constructor for a Const_type node.
1258 * Adds the node to the start block.
1260 * The constant represents a target value. This constructor sets high
1261 * level type information for the constant value.
1262 * Derives mode from passed tarval.
1264 * @param *db A pointer for debug information.
1265 * @param *irg The IR graph the node belongs to.
1266 * @param *con Points to an entry in the constant table.
1267 * @param *tp The type of the constant.
1269 ir_node *new_rd_Const_type(dbg_info *db, ir_graph *irg,
1270 tarval *con, ir_type *tp);
1272 /** Constructor for a Const node.
1274 * Adds the node to the start block.
1276 * Constructor for a Const node. The constant represents a target
1277 * value. Sets the type information to type_unknown. (No more
1278 * supported: If tv is entity derives a somehow useful type.)
1279 * Derives mode from passed tarval.
1281 * @param *db A pointer for debug information.
1282 * @param *irg The IR graph the node belongs to.
1283 * @param *con Points to an entry in the constant table.
1285 ir_node *new_rd_Const(dbg_info *db, ir_graph *irg, tarval *con);
1287 /** Constructor for a Const node.
1289 * Adds the node to the start block.
1291 * Constructor for a Const node. The constant represents a target
1292 * value. Sets the type information to type_unknown. (No more
1293 * supported: If tv is entity derives a somehow useful type.)
1295 * @param *db A pointer for debug information.
1296 * @param *irg The IR graph the node belongs to.
1297 * @param *mode The mode of the operands and results.
1298 * @param value A value from which the tarval is made.
1300 ir_node *new_rd_Const_long(dbg_info *db, ir_graph *irg,
1301 ir_mode *mode, long value);
1303 /** Constructor for a SymConst_type node.
1305 * This is the constructor for a symbolic constant.
1306 * There are four kinds of symbolic constants:
1307 * - type_tag The symbolic constant represents a type tag. The type the
1308 * tag stands for is given explicitly.
1309 * - type_size The symbolic constant represents the size of a type. The
1310 * type of which the constant represents the size is given
1312 * - type_align The symbolic constant represents the alignment of a type. The
1313 * type of which the constant represents the size is given
1315 * - addr_name The symbolic constant represents the address of an entity
1316 * (variable or method). The variable is indicated by a name
1317 * that is valid for linking.
1318 * - addr_ent The symbolic constant represents the address of an entity
1319 * (variable or method). The variable is given explicitly by
1322 * Inputs to the node:
1323 * No inputs except the block it belongs to.
1324 * Outputs of the node.
1325 * An unsigned integer (I_u) or a pointer (P).
1327 * Mention union in declaration so that the firmjni generator recognizes that
1328 * it can not cast the argument to an int.
1330 * @param *db A pointer for debug information.
1331 * @param *irg The IR graph the node belongs to.
1332 * @param mode The mode for the SymConst.
1333 * @param symkind The kind of the symbolic constant: type_tag, size, addr_name or addr_ent.
1334 * @param value A type, entity or a ident depending on the SymConst kind.
1335 * @param tp The source type of the constant.
1337 ir_node *new_rd_SymConst_type(dbg_info *db, ir_graph *irg, ir_mode *mode,
1338 union symconst_symbol value,
1339 symconst_kind symkind, ir_type *tp);
1341 /** Constructor for a SymConst node.
1343 * Same as new_rd_SymConst_type, except that it sets the type to type_unknown.
1345 ir_node *new_rd_SymConst(dbg_info *db, ir_graph *irg, ir_mode *mode,
1346 union symconst_symbol value, symconst_kind symkind);
1348 /** Constructor for a SymConst addr_ent node.
1350 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1351 * symconst_addr_ent.
1352 * Adds the SymConst to the start block of irg. */
1353 ir_node *new_rd_SymConst_addr_ent(dbg_info *db, ir_graph *irg, ir_mode *mode,
1354 ir_entity *symbol, ir_type *tp);
1356 /** Constructor for a SymConst ofs_ent node.
1358 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1360 * Adds the SymConst to the start block of irg.
1362 ir_node *new_rd_SymConst_ofs_ent(dbg_info *db, ir_graph *irg, ir_mode *mode,
1363 ir_entity *symbol, ir_type *tp);
1365 /** Constructor for a SymConst addr_name node.
1367 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1368 * symconst_addr_ent.
1369 * Adds the SymConst to the start block of irg.
1371 ir_node *new_rd_SymConst_addr_name(dbg_info *db, ir_graph *irg, ir_mode *mode,
1372 ident *symbol, ir_type *tp);
1374 /** Constructor for a SymConst type_tag node.
1376 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1377 * symconst_addr_ent.
1378 * Adds the SymConst to the start block of irg.
1380 ir_node *new_rd_SymConst_type_tag(dbg_info *db, ir_graph *irg, ir_mode *mode,
1381 ir_type *symbol, ir_type *tp);
1383 /** Constructor for a SymConst size node.
1385 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1386 * symconst_type_size.
1387 * Adds the SymConst to the start block of irg. */
1388 ir_node *new_rd_SymConst_size(dbg_info *db, ir_graph *irg, ir_mode *mode,
1389 ir_type *symbol, ir_type *tp);
1391 /** Constructor for a SymConst size node.
1393 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1394 * symconst_type_align.
1395 * Adds the SymConst to the start block of irg.
1397 ir_node *new_rd_SymConst_align(dbg_info *db, ir_graph *irg, ir_mode *mode,
1398 ir_type *symbol, ir_type *tp);
1400 /** Constructor for a simpleSel node.
1402 * This is a shortcut for the new_rd_Sel() constructor. To be used for
1403 * Sel nodes that do not select from an array, i.e., have no index
1404 * inputs. It adds the two parameters 0, NULL.
1406 * @param *db A pointer for debug information.
1407 * @param *block The IR block the node belongs to.
1408 * @param *store The memory in which the object the entity should be
1409 * selected from is allocated.
1410 * @param *objptr The object from that the Sel operation selects a
1411 * single attribute out.
1412 * @param *ent The entity to select.
1414 ir_node *new_rd_simpleSel(dbg_info *db, ir_node *block,
1415 ir_node *store, ir_node *objptr, ir_entity *ent);
1417 /** Constructor for a Sel node.
1419 * The select node selects an entity (field or method) from an entity
1420 * with a compound type. It explicitly specifies the entity selected.
1421 * Dynamically the node may select entities that overwrite the given
1422 * entity. If the selected entity is an array element entity the Sel
1423 * node takes the required array indices as inputs.
1425 * @param *db A pointer for debug information.
1426 * @param *block The IR block the node belongs to.
1427 * @param *store The memory in which the object the entity should be selected
1428 * from is allocated.
1429 * @param *objptr A pointer to a compound entity the Sel operation selects a
1430 * single attribute from.
1431 * @param *n_index The number of array indices needed to select an array element entity.
1432 * @param *index[] If the compound entity is an array the indices of the selected
1433 * element entity. The constructor copies this array.
1434 * @param *ent The entity to select.
1436 ir_node *new_rd_Sel(dbg_info *db, ir_node *block, ir_node *store,
1437 ir_node *objptr, int n_index, ir_node *index[], ir_entity *ent);
1439 /** Constructor for a Call node.
1441 * Represents all kinds of method and function calls.
1443 * @param *db A pointer for debug information.
1444 * @param *block The IR block the node belongs to.
1445 * @param *store The current memory state.
1446 * @param *callee A pointer to the called procedure.
1447 * @param arity The number of procedure parameters.
1448 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1449 * @param *tp Type information of the procedure called.
1451 ir_node *new_rd_Call(dbg_info *db, ir_node *block, ir_node *store,
1452 ir_node *callee, int arity, ir_node *in[], ir_type *tp);
1454 /** Constructor for a Builtin node.
1456 * Represents a call of a backend-specific builtin..
1458 * @param *db A pointer for debug information.
1459 * @param *block The IR block the node belongs to.
1460 * @param *store The current memory state.
1461 * @param arity The number of procedure parameters.
1462 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1463 * @param kind The kind of the called builtin.
1464 * @param *tp Type information of the procedure called.
1466 ir_node *new_rd_Builtin(dbg_info *db, ir_node *block, ir_node *store,
1467 int arity, ir_node *in[], ir_builtin_kind kind, ir_type *tp);
1469 /** Constructor for a Add node.
1471 * @param *db A pointer for debug information.
1472 * @param *block The IR block the node belongs to.
1473 * @param *op1 The first operand.
1474 * @param *op2 The second operand.
1475 * @param *mode The mode of the operands and the result.
1477 ir_node *new_rd_Add(dbg_info *db, ir_node *block,
1478 ir_node *op1, ir_node *op2, ir_mode *mode);
1480 /** Constructor for a Sub node.
1482 * @param *db A pointer for debug information.
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_Sub(dbg_info *db, ir_node *block,
1489 ir_node *op1, ir_node *op2, ir_mode *mode);
1491 /** Constructor for a Minus node.
1493 * @param *db A pointer for debug information.
1494 * @param *block The IR block the node belongs to.
1495 * @param *op The operand .
1496 * @param *mode The mode of the operand and the result.
1498 ir_node *new_rd_Minus(dbg_info *db, ir_node *block,
1499 ir_node *op, ir_mode *mode);
1501 /** Constructor for a Mul node.
1503 * @param *db A pointer for debug information.
1504 * @param *block The IR block the node belongs to.
1505 * @param *op1 The first operand.
1506 * @param *op2 The second operand.
1507 * @param *mode The mode of the operands and the result.
1509 ir_node *new_rd_Mul(dbg_info *db, ir_node *block,
1510 ir_node *op1, ir_node *op2, ir_mode *mode);
1512 /** Constructor for a Mulh node.
1514 * @param *db A pointer for debug information.
1515 * @param *block The IR block the node belongs to.
1516 * @param *op1 The first operand.
1517 * @param *op2 The second operand.
1518 * @param *mode The mode of the operands and the result.
1520 ir_node *new_rd_Mulh(dbg_info *db, ir_node *block,
1521 ir_node *op1, ir_node *op2, ir_mode *mode);
1523 /** Constructor for a Quot node.
1525 * @param *db A pointer for debug information.
1526 * @param *block The IR block the node belongs to.
1527 * @param *memop The store needed to model exceptions
1528 * @param *op1 The first operand.
1529 * @param *op2 The second operand.
1530 * @param *mode The mode of the result.
1531 * @param state The pinned state.
1533 ir_node *new_rd_Quot(dbg_info *db, ir_node *block, ir_node *memop,
1534 ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1536 /** Constructor for a DivMod node.
1538 * @param *db A pointer for debug information.
1539 * @param *block The IR block the node belongs to.
1540 * @param *memop The store needed to model exceptions
1541 * @param *op1 The first operand.
1542 * @param *op2 The second operand.
1543 * @param *mode The mode of the results.
1544 * @param state The pinned state.
1546 ir_node *new_rd_DivMod(dbg_info *db, ir_node *block, ir_node *memop,
1547 ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1549 /** Constructor for a Div node.
1551 * @param *db A pointer for debug information.
1552 * @param *block The IR block the node belongs to.
1553 * @param *memop The store needed to model exceptions
1554 * @param *op1 The first operand.
1555 * @param *op2 The second operand.
1556 * @param *mode The mode of the result.
1557 * @param state The pinned state.
1559 ir_node *new_rd_Div(dbg_info *db, ir_node *block, ir_node *memop,
1560 ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1562 /** Constructor for a remainderless Div node.
1564 * @param *db A pointer for debug information.
1565 * @param *block The IR block the node belongs to.
1566 * @param *memop The store needed to model exceptions
1567 * @param *op1 The first operand.
1568 * @param *op2 The second operand.
1569 * @param *mode The mode of the result.
1570 * @param state The pinned state.
1572 ir_node *new_rd_DivRL(dbg_info *db, ir_node *block, ir_node *memop,
1573 ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1575 /** Constructor for a Mod node.
1577 * @param *db A pointer for debug information.
1578 * @param *block The IR block the node belongs to.
1579 * @param *memop The store needed to model exceptions
1580 * @param *op1 The first operand.
1581 * @param *op2 The second operand.
1582 * @param *mode The mode of the result.
1583 * @param state The pinned state.
1585 ir_node *new_rd_Mod(dbg_info *db, ir_node *block, ir_node *memop,
1586 ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1588 /** Constructor for a Abs node.
1590 * @param *db A pointer for debug information.
1591 * @param *block The IR block the node belongs to.
1592 * @param *op The operand
1593 * @param *mode The mode of the operands and the result.
1595 ir_node *new_rd_Abs(dbg_info *db, ir_node *block, ir_node *op, ir_mode *mode);
1597 /** Constructor for a And node.
1599 * @param *db A pointer for debug information.
1600 * @param *block The IR block the node belongs to.
1601 * @param *op1 The first operand.
1602 * @param *op2 The second operand.
1603 * @param *mode The mode of the operands and the result.
1605 ir_node *new_rd_And(dbg_info *db, ir_node *block,
1606 ir_node *op1, ir_node *op2, ir_mode *mode);
1608 /** Constructor for a Or node.
1610 * @param *db A pointer for debug information.
1611 * @param *block The IR block the node belongs to.
1612 * @param *op1 The first operand.
1613 * @param *op2 The second operand.
1614 * @param *mode The mode of the operands and the result.
1616 ir_node *new_rd_Or(dbg_info *db, ir_node *block,
1617 ir_node *op1, ir_node *op2, ir_mode *mode);
1619 /** Constructor for a Eor node.
1621 * @param *db A pointer for debug information.
1622 * @param *block The IR block the node belongs to.
1623 * @param *op1 The first operand.
1624 * @param *op2 The second operand.
1625 * @param *mode The mode of the operands and the results.
1627 ir_node *new_rd_Eor(dbg_info *db, ir_node *block,
1628 ir_node *op1, ir_node *op2, ir_mode *mode);
1630 /** Constructor for a Not node.
1632 * @param *db A pointer for debug information.
1633 * @param *block The IR block the node belongs to.
1634 * @param *op The operand.
1635 * @param *mode The mode of the operand and the result.
1637 ir_node *new_rd_Not(dbg_info *db, ir_node *block, ir_node *op, ir_mode *mode);
1639 /** Constructor for a Cmp node.
1641 * @param *db A pointer for debug information.
1642 * @param *block The IR block the node belongs to.
1643 * @param *op1 The first operand.
1644 * @param *op2 The second operand.
1646 ir_node *new_rd_Cmp(dbg_info *db, ir_node *block, ir_node *op1, ir_node *op2);
1648 /** Constructor for a Shl node.
1650 * @param *db A pointer for debug information.
1651 * @param *block The IR block the node belongs to.
1652 * @param *op The operand.
1653 * @param *k The number of bits to shift the operand .
1654 * @param *mode The mode of the operand and the result.
1656 ir_node *new_rd_Shl(dbg_info *db, ir_node *block,
1657 ir_node *op, ir_node *k, ir_mode *mode);
1659 /** Constructor for a Shr node.
1661 * @param *db A pointer for debug information.
1662 * @param *block The IR block the node belongs to.
1663 * @param *op The operand.
1664 * @param *k The number of bits to shift the operand .
1665 * @param *mode The mode of the operand and the result.
1667 ir_node *new_rd_Shr(dbg_info *db, ir_node *block,
1668 ir_node *op, ir_node *k, ir_mode *mode);
1670 /** Constructor for a Shrs node.
1672 * @param *db A pointer for debug information.
1673 * @param *block The IR block the node belongs to.
1674 * @param *op The operand.
1675 * @param *k The number of bits to shift the operand.
1676 * @param *mode The mode of the operand and the result.
1678 ir_node *new_rd_Shrs(dbg_info *db, ir_node *block,
1679 ir_node *op, ir_node *k, ir_mode *mode);
1681 /** Constructor for a Rotl node.
1683 * @param *db A pointer for debug information.
1684 * @param *block The IR block the node belongs to.
1685 * @param *op The operand.
1686 * @param *k The number of bits to rotate the operand.
1687 * @param *mode The mode of the operand.
1689 ir_node *new_rd_Rotl(dbg_info *db, ir_node *block,
1690 ir_node *op, ir_node *k, ir_mode *mode);
1693 /** Constructor for a Conv node.
1695 * @param *db A pointer for debug information.
1696 * @param *block The IR block the node belongs to.
1697 * @param *op The operand.
1698 * @param *mode The mode of this the operand muss be converted .
1700 ir_node *new_rd_Conv(dbg_info *db, ir_node *block, ir_node *op, ir_mode *mode);
1702 /** Constructor for a strictConv node.
1704 * @param *db A pointer for debug information.
1705 * @param *block The IR block the node belongs to.
1706 * @param *op The operand.
1707 * @param *mode The mode of this the operand muss be converted .
1709 ir_node *new_rd_strictConv(dbg_info *db, ir_node *block,
1710 ir_node *op, ir_mode *mode);
1712 /** Constructor for a Cast node.
1714 * High level type cast.
1716 * @param *db A pointer for debug information.
1717 * @param *block The IR block the node belongs to.
1718 * @param *op The operand.
1719 * @param *to_tp The type of this the operand muss be casted .
1721 ir_node *new_rd_Cast(dbg_info *db, ir_node *block,
1722 ir_node *op, ir_type *to_tp);
1724 /** Constructor for a Carry node.
1726 * @param *db A pointer for debug information.
1727 * @param *block The IR block the node belongs to.
1728 * @param *op1 The first operand.
1729 * @param *op2 The second operand.
1730 * @param *mode The mode of the operands and the result.
1732 ir_node *new_rd_Carry(dbg_info *db, ir_node *block,
1733 ir_node *op1, ir_node *op2, ir_mode *mode);
1735 /** Constructor for a Borrow node.
1737 * @param *db A pointer for debug information.
1738 * @param *block The IR block the node belongs to.
1739 * @param *op1 The first operand.
1740 * @param *op2 The second operand.
1741 * @param *mode The mode of the operands and the result.
1743 ir_node *new_rd_Borrow(dbg_info *db, ir_node *block,
1744 ir_node *op1, ir_node *op2, ir_mode *mode);
1746 /** Constructor for a Phi node.
1748 * @param *db A pointer for debug information.
1749 * @param *block The IR block the node belongs to.
1750 * @param arity The number of predecessors
1751 * @param *in[] Array with predecessors. The constructor copies this array.
1752 * @param *mode The mode of it's inputs and output.
1754 ir_node *new_rd_Phi(dbg_info *db, ir_node *block, int arity,
1755 ir_node *in[], ir_mode *mode);
1757 /** Constructor for a Load node.
1759 * @param *db A pointer for debug information.
1760 * @param *block The IR block the node belongs to.
1761 * @param *store The current memory
1762 * @param *adr A pointer to the variable to be read in this memory.
1763 * @param *mode The mode of the value to be loaded.
1764 * @param flags Additional flags for alignment, volatility and pin state.
1766 ir_node *new_rd_Load(dbg_info *db, ir_node *block, ir_node *store,
1767 ir_node *adr, ir_mode *mode, ir_cons_flags flags);
1769 /** Constructor for a Store node.
1771 * @param *db A pointer for debug information.
1772 * @param *block The IR block the node belongs to.
1773 * @param *store The current memory
1774 * @param *adr A pointer to the variable to be read in this memory.
1775 * @param *val The value to write to this variable.
1776 * @param flags Additional flags for alignment, volatility and pin state.
1778 ir_node *new_rd_Store(dbg_info *db, ir_node *block, ir_node *store,
1779 ir_node *adr, ir_node *val, ir_cons_flags flags);
1781 /** Constructor for a Alloc node.
1783 * The Alloc node extends the memory by space for an entity of type alloc_type.
1785 * @param *db A pointer for debug information.
1786 * @param *block The IR block the node belongs to.
1787 * @param *store The memory which shall contain the new variable.
1788 * @param *size The number of bytes to allocate.
1789 * @param *alloc_type The type of the allocated variable.
1790 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
1792 ir_node *new_rd_Alloc(dbg_info *db, ir_node *block, ir_node *store,
1793 ir_node *size, ir_type *alloc_type, ir_where_alloc where);
1795 /** Constructor for a Free node.
1797 * Frees the memory occupied by the entity pointed to by the pointer
1798 * arg. Type indicates the type of the entity the argument points to.
1800 * @param *db A pointer for debug information.
1801 * @param *block The IR block the node belongs to.
1802 * @param *store The memory which shall contain the new variable.
1803 * @param *ptr The pointer to the object to free.
1804 * @param *size The number of objects of type free_type to free in a sequence.
1805 * @param *free_type The type of the freed variable.
1806 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
1808 ir_node *new_rd_Free(dbg_info *db, ir_node *block, ir_node *store,
1809 ir_node *ptr, ir_node *size, ir_type *free_type, ir_where_alloc where);
1811 /** Constructor for a Sync node.
1813 * Merges several memory values. The node assumes that a variable
1814 * either occurs only in one of the memories, or it contains the same
1815 * value in all memories where it occurs.
1817 * @param *db A pointer for debug information.
1818 * @param *block The IR block the node belongs to.
1819 * @param arity The number of memories to synchronize.
1820 * @param *in[] An array of pointers to nodes that produce an output of type
1821 * memory. The constructor copies this array.
1823 ir_node *new_rd_Sync(dbg_info *db, ir_node *block, int arity, ir_node *in[]);
1825 /** Constructor for a Proj node.
1827 * Projects a single value out of a tuple. The parameter proj gives the
1828 * position of the value within the tuple.
1830 * @param *db A pointer for debug information.
1831 * @param *block The IR block the node belongs to.
1832 * @param arg A node producing a tuple. The node must have mode_T.
1833 * @param *mode The mode of the value to project.
1834 * @param proj The position of the value in the tuple.
1836 ir_node *new_rd_Proj(dbg_info *db, ir_node *block, ir_node *arg,
1837 ir_mode *mode, long proj);
1839 /** Constructor for a defaultProj node.
1841 * Represents the default control flow of a Switch-Cond node.
1843 * @param *db A pointer for debug information.
1844 * @param *block The IR block the node belongs to.
1845 * @param arg A node producing a tuple.
1846 * @param max_proj The end position of the value in the tuple.
1848 ir_node *new_rd_defaultProj(dbg_info *db, ir_node *block,
1849 ir_node *arg, long max_proj);
1851 /** Constructor for a Tuple node.
1853 * This is an auxiliary node to replace a node that returns a tuple
1854 * without changing the corresponding Proj nodes.
1856 * @param *db A pointer for debug information.
1857 * @param *block The IR block the node belongs to.
1858 * @param arity The number of tuple elements.
1859 * @param *in[] An array containing pointers to the nodes producing the tuple
1860 * elements. The constructor copies this array.
1862 ir_node *new_rd_Tuple(dbg_info *db, ir_node *block,
1863 int arity, ir_node *in[]);
1865 /** Constructor for a Id node.
1867 * This is an auxiliary node to replace a node that returns a single
1870 * @param *db A pointer for debug information.
1871 * @param *block The IR block the node belongs to.
1872 * @param *val The value
1873 * @param *mode The mode of *val.
1875 ir_node *new_rd_Id(dbg_info *db, ir_node *block,
1876 ir_node *val, ir_mode *mode);
1878 /** Constructor for a Confirm node.
1880 * Specifies constraints for a value. To support dataflow analyses.
1882 * Example: If the value never exceeds '100' this is expressed by placing a
1883 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
1885 * @param *db A pointer for debug information.
1886 * @param *block The IR block the node belong to.
1887 * @param *val The value we express a constraint for
1888 * @param *bound The value to compare against. Must be a firm node, typically a constant.
1889 * @param cmp The compare operation.
1891 ir_node *new_rd_Confirm(dbg_info *db, ir_node *block,
1892 ir_node *val, ir_node *bound, pn_Cmp cmp);
1894 /** Constructor for an Unknown node.
1896 * Represents an arbitrary value. Places the node in the start block.
1898 * @param *db A pointer for debug information.
1899 * @param *irg The IR graph the node belongs to.
1900 * @param *m The mode of the unknown value.
1902 ir_node *new_rd_Unknown(dbg_info *db, ir_graph *irg, ir_mode *m);
1904 /** Constructor for a CallBegin node.
1906 * CallBegin represents control flow depending of the pointer value
1907 * representing the called method to the called methods. The
1908 * constructor copies the method pointer input from the passed Call
1911 * @param *db A pointer for debug information.
1912 * @param *block The block the node belong to.
1913 * @param *callee The call node visible in the intra procedural view.
1915 ir_node *new_rd_CallBegin(dbg_info *db, ir_node *block, ir_node *ptr, ir_node *call);
1917 /** Constructor for a EndReg node.
1919 * Used to represent regular procedure end in interprocedual view.
1921 * @param *db A pointer for debug information.
1922 * @param *irg The IR graph the node belong to.
1923 * @param *block The block the node belong to.
1925 ir_node *new_rd_EndReg(dbg_info *db, ir_graph *irg, ir_node *block);
1927 /** Constructor for a EndExcept node.
1929 * Used to represent exceptional procedure end in interprocedural view.
1931 * @param *db A pointer for debug information.
1932 * @param *irg The IR graph the node belong to.
1933 * @param *block The block the node belong to.
1935 ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
1937 /** Constructor for a Filter node.
1939 * Adds the node to the block in current_ir_block. Filter is a node
1940 * with two views used to construct the interprocedural view. In
1941 * intraprocedural view its semantics are identical to the Proj node.
1942 * In interprocedural view the Filter performs the Phi operation on
1943 * method parameters or results. Other than a Phi a Filter node may
1944 * not be removed if it has only a single input.
1946 * The constructor builds the Filter in intraprocedural view.
1948 * @param *db A pointer for debug information.
1949 * @param *block The block the node belong to.
1950 * @param *arg The tuple value to project from.
1951 * @param *mode The mode of the projected value.
1952 * @param proj The position in the tuple to project from.
1954 ir_node *new_rd_Filter(dbg_info *db,ir_node *block, ir_node *arg,
1955 ir_mode *mode, long proj);
1957 /** Constructor for a Mux node.
1959 * @param *db A pointer for debug information.
1960 * @param *block The block the node belong to.
1961 * @param *sel The ir_node that calculates the boolean select.
1962 * @param *ir_true The ir_node that calculates the true result.
1963 * @param *ir_false The ir_node that calculates the false result.
1964 * @param *mode The mode of the node (and it_true and ir_false).
1966 ir_node *new_rd_Mux(dbg_info *db, ir_node *block, ir_node *sel,
1967 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
1969 /** Constructor for a CopyB node.
1971 * @param *db A pointer for debug information.
1972 * @param *block The block the node belong to.
1973 * @param *store The current memory
1974 * @param *dst The ir_node that represents the destination address.
1975 * @param *src The ir_node that represents the source address.
1976 * @param *data_type The type of the copied data
1978 ir_node *new_rd_CopyB(dbg_info *db, ir_node *block, ir_node *store,
1979 ir_node *dst, ir_node *src, ir_type *data_type);
1981 /** Constructor for a InstOf node.
1983 * A High-Level Type check.
1985 * @param *db A pointer for debug information.
1986 * @param *block The IR block the node belongs to.
1987 * @param *store The memory in which the object the entity should be selected
1988 * from is allocated.
1989 * @param *objptr A pointer to a object of a class type.
1990 * @param *type The type of which objptr must be.
1992 ir_node *new_rd_InstOf(dbg_info *db, ir_node *block, ir_node *store,
1993 ir_node *objptr, ir_type *type);
1995 /** Constructor for a Raise node.
1997 * A High-Level Exception throw.
1999 * @param *db A pointer for debug information.
2000 * @param *block The IR block the node belongs to.
2001 * @param *store The current memory.
2002 * @param *obj A pointer to the Except variable.
2004 ir_node *new_rd_Raise(dbg_info *db, ir_node *block, ir_node *store, ir_node *obj);
2006 /** Constructor for a Bound node.
2008 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2010 * @param *db A pointer for debug information.
2011 * @param *block The block the node belong to.
2012 * @param *store The current memory.
2013 * @param *idx The ir_node that represents an index.
2014 * @param *lower The ir_node that represents the lower bound for the index.
2015 * @param *upper The ir_node that represents the upper bound for the index.
2017 ir_node *new_rd_Bound(dbg_info *db, ir_node *block,
2018 ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
2020 /** Constructor for a Pin node.
2022 * @param *db A pointer for debug information.
2023 * @param *block The block the node belong to.
2024 * @param *node The node which value should be pinned.
2026 ir_node *new_rd_Pin(dbg_info *db, ir_node *block, ir_node *node);
2028 /** Constructor for an ASM pseudo node.
2030 * @param *db A pointer for debug information.
2031 * @param *block The block the node belong to.
2032 * @param arity The number of data inputs to the node.
2033 * @param *in The array of length arity of data inputs.
2034 * @param *inputs The array of length arity of input constraints.
2035 * @param n_outs The number of data outputs to the node.
2036 * @param *outputs The array of length n_outs of output constraints.
2037 * @param n_clobber The number of clobbered registers.
2038 * @param *clobber The array of length n_clobber of clobbered registers.
2039 * @param *asm_text The assembler text.
2041 ir_node *new_rd_ASM(dbg_info *db, ir_node *block,
2042 int arity, ir_node *in[], ir_asm_constraint *inputs,
2043 int n_outs, ir_asm_constraint *outputs,
2044 int n_clobber, ident *clobber[], ident *asm_text);
2046 /*-------------------------------------------------------------------------*/
2047 /* The raw interface without debug support */
2048 /*-------------------------------------------------------------------------*/
2050 /** Constructor for a Block node.
2052 * Constructs a mature block with the given predecessors. Use Unknown
2053 * nodes as predecessors to construct a block if the number of
2054 * predecessors is known, but not the predecessors themselves. This
2055 * constructor does not set current_block. It not be used with
2056 * automatic Phi node construction.
2059 * @param irg The IR graph the block belongs to.
2060 * @param arity The number of control predecessors.
2061 * @param in[] An array of control predecessors. The length of
2062 * the array must be 'arity'. The constructor copies this array.
2064 ir_node *new_r_Block(ir_graph *irg, int arity, ir_node *in[]);
2066 /** Constructor for a Start node.
2068 * @param *irg The IR graph the node belongs to.
2069 * @param *block The IR block the node belongs to.
2071 ir_node *new_r_Start(ir_graph *irg, ir_node *block);
2073 /** Constructor for a End node.
2075 * @param *irg The IR graph the node belongs to.
2076 * @param *block The IR block the node belongs to.
2078 ir_node *new_r_End(ir_graph *irg, ir_node *block);
2080 /** Constructor for a Jmp node.
2082 * Jmp represents control flow to a single control successor.
2084 * @param *block The IR block the node belongs to.
2086 ir_node *new_r_Jmp(ir_node *block);
2088 /** Constructor for an IJmp node.
2090 * IJmp represents control flow to a single control successor not
2091 * statically known i.e. an indirect Jmp.
2093 * @param *block The IR block the node belongs to.
2094 * @param *tgt The IR node representing the target address.
2096 ir_node *new_r_IJmp(ir_node *block, ir_node *tgt);
2098 /** Constructor for a Cond node.
2100 * If c is mode_b represents a conditional branch (if/else). If c is
2101 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2102 * node, default Proj is 0.)
2104 * This is not consistent: Input to Cond is Is, Proj has as proj number
2107 * @param *block The IR block the node belongs to.
2108 * @param *c The conditions parameter.Can be of mode b or I_u.
2110 ir_node *new_r_Cond(ir_node *block, ir_node *c);
2112 /** Constructor for a Return node.
2114 * Returns the memory and zero or more return values. Only node that
2115 * can end regular control flow.
2117 * @param *block The IR block the node belongs to.
2118 * @param *store The state of memory.
2119 * @param arity Number of array indices.
2120 * @param *in[] Array with index inputs to the node. The constructor copies this array.
2122 ir_node *new_r_Return(ir_node *block, ir_node *store, int arity, ir_node *in[]);
2124 /** Constructor for a Const node.
2126 * Adds the node to the start block.
2128 * Constructor for a Const node. The constant represents a target
2129 * value. Sets the type information to type_unknown. (No more
2130 * supported: If tv is entity derives a somehow useful type.)
2131 * Derives mode from passed tarval.
2133 * @param *irg The IR graph the node belongs to.
2134 * @param *con Points to an entry in the constant table.
2136 ir_node *new_r_Const(ir_graph *irg, tarval *con);
2138 /** Constructor for a Const node.
2140 * Adds the node to the start block.
2142 * Constructor for a Const node. The constant represents a target
2143 * value. Sets the type information to type_unknown. (No more
2144 * supported: If tv is entity derives a somehow useful type.)
2146 * @param *irg The IR graph the node belongs to.
2147 * @param *mode The mode of the operands and the results.
2148 * @param value A value from which the tarval is made.
2150 ir_node *new_r_Const_long(ir_graph *irg, ir_mode *mode, long value);
2152 /** Constructor for a Const_type node.
2154 * Adds the node to the start block.
2156 * The constant represents a target value. This constructor sets high
2157 * level type information for the constant value.
2158 * Derives mode from passed tarval.
2160 * @param *irg The IR graph the node belongs to.
2161 * @param *con Points to an entry in the constant table.
2162 * @param *tp The type of the constant.
2164 ir_node *new_r_Const_type(ir_graph *irg, tarval *con, ir_type *tp);
2166 /** Constructor for a SymConst node.
2168 * This is the constructor for a symbolic constant.
2169 * There are four kinds of symbolic constants:
2170 * - type_tag The symbolic constant represents a type tag. The type the
2171 * tag stands for is given explicitly.
2172 * - size The symbolic constant represents the size of a type. The
2173 * type of which the constant represents the size is given
2175 * - addr_name The symbolic constant represents the address of an entity
2176 * (variable or method). The variable is indicated by a name
2177 * that is valid for linking.
2178 * - addr_ent The symbolic constant represents the address of an entity
2179 * (variable or method). The variable is given explicitly by
2182 * Inputs to the node:
2183 * No inputs except the block it belongs to.
2184 * Outputs of the node.
2185 * An unsigned integer (I_u) or a pointer (P).
2187 * @param *irg The IR graph the node belongs to.
2188 * @param mode The mode for the SymConst.
2189 * @param value A type, entity or a ident depending on the SymConst kind.
2190 * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
2192 ir_node *new_r_SymConst(ir_graph *irg, ir_mode *mode,
2193 union symconst_symbol value, symconst_kind symkind);
2195 /** Constructor for a simpleSel node.
2197 * This is a shortcut for the new_d_Sel() constructor. To be used for
2198 * Sel nodes that do not select from an array, i.e., have no index
2199 * inputs. It adds the two parameters 0, NULL.
2201 * @param *block The IR block the node belongs to.
2202 * @param *store The memory in which the object the entity should be selected
2203 * from is allocated.
2204 * @param *objptr The object from that the Sel operation selects a
2205 * single attribute out.
2206 * @param *ent The entity to select.
2208 ir_node *new_r_simpleSel(ir_node *block, ir_node *store,
2209 ir_node *objptr, ir_entity *ent);
2211 /** Constructor for a Sel node.
2213 * The select node selects an entity (field or method) from an entity
2214 * with a compound type. It explicitly specifies the entity selected.
2215 * Dynamically the node may select entities that overwrite the given
2216 * entity. If the selected entity is an array element entity the Sel
2217 * node takes the required array indices as inputs.
2219 * @param *block The IR block the node belongs to.
2220 * @param *store The memory in which the object the entity should be selected
2221 * from is allocated.
2222 * @param *objptr A pointer to a compound entity the Sel operation selects a
2223 * single attribute from.
2224 * @param *n_index The number of array indices needed to select an array element entity.
2225 * @param *index[] If the compound entity is an array the indices of the selected
2226 * element entity. The constructor copies this array.
2227 * @param *ent The entity to select.
2229 ir_node *new_r_Sel(ir_node *block, ir_node *store,
2230 ir_node *objptr, int n_index, ir_node *index[],
2233 /** Constructor for a Call node.
2235 * Represents all kinds of method and function calls.
2237 * @param *block The IR block the node belongs to.
2238 * @param *store The actual store.
2239 * @param *callee A pointer to the called procedure.
2240 * @param arity The number of procedure parameters.
2241 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2242 * @param *tp Type information of the procedure called.
2244 ir_node *new_r_Call(ir_node *block, ir_node *store,
2245 ir_node *callee, int arity, ir_node *in[], ir_type *tp);
2247 /** Constructor for a Builtin node.
2249 * Represents a call of a backend-specific builtin..
2251 * @param *block The IR block the node belongs to.
2252 * @param *store The actual store.
2253 * @param arity The number of procedure parameters.
2254 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2255 * @param kind The kind of the called builtin.
2256 * @param *tp Type information of the procedure called.
2258 ir_node *new_r_Builtin(ir_node *block, ir_node *store,
2259 int arity, ir_node *in[], ir_builtin_kind kind, ir_type *tp);
2261 /** Constructor for a Add node.
2263 * @param *block The IR block the node belongs to.
2264 * @param *op1 The first operand.
2265 * @param *op2 The second operand.
2266 * @param *mode The mode of the operands and the result.
2268 ir_node *new_r_Add(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2271 * Constructor for a Sub node.
2273 * @param *block The IR block the node belongs to.
2274 * @param *op1 The first operand.
2275 * @param *op2 The second operand.
2276 * @param *mode The mode of the operands and the results.
2278 ir_node *new_r_Sub(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2280 /** Constructor for a Minus node.
2282 * @param *block The IR block the node belongs to.
2283 * @param *op The operand.
2284 * @param *mode The mode of the operand and the result.
2286 ir_node *new_r_Minus(ir_node *block, ir_node *op, ir_mode *mode);
2288 /** Constructor for a Mul node.
2290 * @param *block The IR block the node belongs to.
2291 * @param *op1 The first operand.
2292 * @param *op2 The second operand.
2293 * @param *mode The mode of the operands and the result.
2295 ir_node *new_r_Mul(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2297 /** Constructor for a Mulh node.
2299 * @param *block The IR block the node belongs to.
2300 * @param *op1 The first operand.
2301 * @param *op2 The second operand.
2302 * @param *mode The mode of the operands and the result.
2304 ir_node *new_r_Mulh(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2306 /** Constructor for a Quot node.
2308 * @param *block The IR block the node belongs to.
2309 * @param *memop The store needed to model exceptions
2310 * @param *op1 The first operand.
2311 * @param *op2 The second operand.
2312 * @param *mode The mode of the result.
2313 * @param state The pinned state.
2315 ir_node *new_r_Quot(ir_node *block, ir_node *memop, ir_node *op1, ir_node *op2,
2316 ir_mode *mode, op_pin_state state);
2318 /** Constructor for a DivMod node.
2320 * @param *block The IR block the node belongs to.
2321 * @param *memop The store needed to model exceptions
2322 * @param *op1 The first operand.
2323 * @param *op2 The second operand.
2324 * @param *mode The mode of the results.
2325 * @param state The pinned state.
2327 ir_node *new_r_DivMod(ir_node *block, ir_node *memop, ir_node *op1, ir_node *op2,
2328 ir_mode *mode, op_pin_state state);
2330 /** Constructor for a Div node.
2332 * @param *block The IR block the node belongs to.
2333 * @param *memop The store needed to model exceptions
2334 * @param *op1 The first operand.
2335 * @param *op2 The second operand.
2336 * @param *mode The mode of the result.
2337 * @param state The pinned state.
2339 ir_node *new_r_Div(ir_node *block, ir_node *memop, ir_node *op1, ir_node *op2,
2340 ir_mode *mode, op_pin_state state);
2342 /** Constructor for a remainderless Div node.
2344 * @param *block The IR block the node belongs to.
2345 * @param *memop The store needed to model exceptions
2346 * @param *op1 The first operand.
2347 * @param *op2 The second operand.
2348 * @param *mode The mode of the result.
2349 * @param state The pinned state.
2351 ir_node *new_r_DivRL(ir_node *block, ir_node *memop, ir_node *op1, ir_node *op2,
2352 ir_mode *mode, op_pin_state state);
2354 /** Constructor for a Mod node.
2356 * @param *block The IR block the node belongs to.
2357 * @param *memop The store needed to model exceptions
2358 * @param *op1 The first operand.
2359 * @param *op2 The second operand.
2360 * @param *mode The mode of the result.
2361 * @param state The pinned state.
2363 ir_node *new_r_Mod(ir_node *block, ir_node *memop, ir_node *op1, ir_node *op2,
2364 ir_mode *mode, op_pin_state state);
2366 /** Constructor for a Abs node.
2368 * @param *block The IR block the node belongs to.
2369 * @param *op The operand
2370 * @param *mode The mode of the operands and the result.
2372 ir_node *new_r_Abs(ir_node *block, ir_node *op, ir_mode *mode);
2374 /** Constructor for a And node.
2376 * @param *block The IR block the node belongs to.
2377 * @param *op1 The first operand.
2378 * @param *op2 The second operand.
2379 * @param *mode The mode of the operands and the result.
2381 ir_node *new_r_And(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2383 /** Constructor for a Or node.
2385 * @param *block The IR block the node belongs to.
2386 * @param *op1 The first operand.
2387 * @param *op2 The second operand.
2388 * @param *mode The mode of the operands and the result.
2390 ir_node *new_r_Or(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2392 /** Constructor for a Eor node.
2394 * @param *block The IR block the node belongs to.
2395 * @param *op1 The first operand.
2396 * @param *op2 The second operand.
2397 * @param *mode The mode of the operands and the results.
2399 ir_node *new_r_Eor(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2401 /** Constructor for a Not node.
2403 * @param *block The IR block the node belongs to.
2404 * @param *op The operand.
2405 * @param *mode The mode of the operand and the result.
2407 ir_node *new_r_Not(ir_node *block, ir_node *op, ir_mode *mode);
2409 /** Constructor for a Cmp node.
2411 * @param *block The IR block the node belongs to.
2412 * @param *op1 The first operand.
2413 * @param *op2 The second operand.
2415 ir_node *new_r_Cmp(ir_node *block, ir_node *op1, ir_node *op2);
2417 /** Constructor for a Shl node.
2419 * @param *block The IR block the node belongs to.
2420 * @param *op The operand.
2421 * @param *k The number of bits to shift the operand .
2422 * @param *mode The mode of the operand and the result.
2424 ir_node *new_r_Shl(ir_node *block, ir_node *op, ir_node *k, ir_mode *mode);
2426 /** Constructor for a Shr node.
2428 * @param *block The IR block the node belongs to.
2429 * @param *op The operand.
2430 * @param *k The number of bits to shift the operand .
2431 * @param *mode The mode of the operand and the result.
2433 ir_node *new_r_Shr(ir_node *block, ir_node *op, ir_node *k, ir_mode *mode);
2436 * Constructor for a Shrs node.
2438 * @param *block The IR block the node belongs to.
2439 * @param *op The operand.
2440 * @param *k The number of bits to shift the operand.
2441 * @param *mode The mode of the operand and the result.
2443 ir_node *new_r_Shrs(ir_node *block, ir_node *op, ir_node *k, ir_mode *mode);
2445 /** Constructor for a Rotl node.
2447 * @param *block The IR block the node belongs to.
2448 * @param *op The operand.
2449 * @param *k The number of bits to rotate the operand.
2450 * @param *mode The mode of the operand.
2452 ir_node *new_r_Rotl(ir_node *block, ir_node *op, ir_node *k, ir_mode *mode);
2454 /** Constructor for a Conv node.
2456 * @param *block The IR block the node belongs to.
2457 * @param *op The operand.
2458 * @param *mode The mode of this the operand muss be converted .
2460 ir_node *new_r_Conv(ir_node *block, ir_node *op, ir_mode *mode);
2462 /** Constructor for a strict Conv node.
2464 * @param *block The IR block the node belongs to.
2465 * @param *op The operand.
2466 * @param *mode The mode of this the operand muss be converted .
2468 ir_node *new_r_strictConv(ir_node *block, ir_node *op, ir_mode *mode);
2470 /** Constructor for a Cast node.
2472 * High level type cast
2474 * @param *block The IR block the node belongs to.
2475 * @param *op The operand.
2476 * @param *to_tp The type of this the operand muss be casted .
2478 ir_node *new_r_Cast(ir_node *block, ir_node *op, ir_type *to_tp);
2480 /** Constructor for a Carry node.
2482 * @param *block The IR block the node belongs to.
2483 * @param *op1 The first operand.
2484 * @param *op2 The second operand.
2485 * @param *mode The mode of the operands and the result.
2487 ir_node *new_r_Carry(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2490 * Constructor for a Borrow node.
2492 * @param *block The IR block the node belongs to.
2493 * @param *op1 The first operand.
2494 * @param *op2 The second operand.
2495 * @param *mode The mode of the operands and the results.
2497 ir_node *new_r_Borrow(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2499 /** Constructor for a Phi node.
2501 * @param *block The IR block the node belongs to.
2502 * @param arity The number of predecessors
2503 * @param *in[] Array with predecessors. The constructor copies this array.
2504 * @param *mode The mode of it's inputs and output.
2506 ir_node *new_r_Phi(ir_node *block, int arity, ir_node *in[], ir_mode *mode);
2508 /** Constructor for a Load node.
2510 * @param *block The IR block the node belongs to.
2511 * @param *store The current memory
2512 * @param *adr A pointer to the variable to be read in this memory.
2513 * @param *mode The mode of the value to be loaded.
2514 * @param flags Additional flags for alignment, volatility and pin state.
2516 ir_node *new_r_Load(ir_node *block, ir_node *store,
2517 ir_node *adr, ir_mode *mode, ir_cons_flags flags);
2519 /** Constructor for a Store node.
2521 * @param *block The IR block the node belongs to.
2522 * @param *store The current memory
2523 * @param *adr A pointer to the variable to be read in this memory.
2524 * @param *val The value to write to this variable.
2525 * @param flags Additional flags for alignment, volatility and pin state.
2527 ir_node *new_r_Store(ir_node *block, ir_node *store,
2528 ir_node *adr, ir_node *val, ir_cons_flags flags);
2530 /** Constructor for a Alloc node.
2532 * The Alloc node extends the memory by space for an entity of type alloc_type.
2534 * @param *block The IR block the node belongs to.
2535 * @param *store The memory which shall contain the new variable.
2536 * @param *size The number of bytes to allocate.
2537 * @param *alloc_type The type of the allocated variable.
2538 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
2540 ir_node *new_r_Alloc(ir_node *block, ir_node *store,
2541 ir_node *size, ir_type *alloc_type, ir_where_alloc where);
2543 /** Constructor for a Free node.
2545 * Frees the memory occupied by the entity pointed to by the pointer
2546 * arg. Type indicates the type of the entity the argument points to.
2548 * @param *block The IR block the node belongs to.
2549 * @param *store The memory which shall contain the new variable.
2550 * @param *ptr The pointer to the object to free.
2551 * @param *size The number of objects of type free_type to free in a sequence.
2552 * @param *free_type The type of the freed variable.
2553 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
2555 ir_node *new_r_Free(ir_node *block, ir_node *store,
2556 ir_node *ptr, ir_node *size, ir_type *free_type, ir_where_alloc where);
2558 /** Constructor for a Sync node.
2560 * Merges several memory values. The node assumes that a variable
2561 * either occurs only in one of the memories, or it contains the same
2562 * value in all memories where it occurs.
2564 * @param *block The IR block the node belongs to.
2565 * @param arity The number of memories to synchronize.
2566 * @param *in[] An array of pointers to nodes that produce an output of type memory.
2567 * The constructor copies this array.
2569 ir_node *new_r_Sync(ir_node *block, int arity, ir_node *in[]);
2571 /** Constructor for a Proj node.
2573 * Projects a single value out of a tuple. The parameter proj gives the
2574 * position of the value within the tuple.
2576 * @param *block The IR block the node belongs to.
2577 * @param arg A node producing a tuple.
2578 * @param *mode The mode of the value to project.
2579 * @param proj The position of the value in the tuple.
2581 ir_node *new_r_Proj(ir_node *block, ir_node *arg,
2582 ir_mode *mode, long proj);
2584 /** Constructor for a defaultProj node.
2586 * Represents the default control flow of a Switch-Cond node.
2588 * @param *block The IR block the node belongs to.
2589 * @param arg A node producing a tuple.
2590 * @param max_proj The end position of the value in the tuple.
2592 ir_node *new_r_defaultProj(ir_node *block, ir_node *arg, long max_proj);
2595 /** Constructor for a Tuple node.
2597 * This is an auxiliary node to replace a node that returns a tuple
2598 * without changing the corresponding Proj nodes.
2600 * @param *block The IR block the node belongs to.
2601 * @param arity The number of tuple elements.
2602 * @param *in[] An array containing pointers to the nodes producing the tuple elements.
2603 * The constructor copies this array.
2605 ir_node *new_r_Tuple(ir_node *block, int arity, ir_node *in[]);
2607 /** Constructor for a Id node.
2609 * This is an auxiliary node to replace a node that returns a single
2612 * @param *block The IR block the node belongs to.
2613 * @param *val The operand to Id.
2614 * @param *mode The mode of *val.
2616 ir_node *new_r_Id(ir_node *block, ir_node *val, ir_mode *mode);
2618 /** Constructor for a Bad node.
2620 * Returns the unique Bad node of the graph. The same as
2623 * @param *irg The IR graph the node belongs to.
2625 ir_node *new_r_Bad(ir_graph *irg);
2627 /** Constructor for a Confirm node.
2629 * Specifies constraints for a value. To support dataflow analyses.
2631 * Example: If the value never exceeds '100' this is expressed by placing a
2632 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
2634 * @param *block The IR block the node belong to.
2635 * @param *val The value we express a constraint for
2636 * @param *bound The value to compare against. Must be a firm node, typically a constant.
2637 * @param cmp The compare operation.
2639 ir_node *new_r_Confirm(ir_node *block, ir_node *val, ir_node *bound, pn_Cmp cmp);
2641 /** Constructor for a Unknown node.
2643 * Represents an arbitrary value. Places the node in
2646 * @param *irg The IR graph the node belongs to.
2647 * @param *m The mode of the unknown value.
2649 ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2651 /** Constructor for a CallBegin node.
2653 * CallBegin represents control flow depending of the pointer value
2654 * representing the called method to the called methods. The
2655 * constructor copies the method pointer input from the passed Call
2658 * @param *block The block the node belong to.
2659 * @param *callee The call node visible in the intra procedural view.
2661 ir_node *new_r_CallBegin(ir_node *block, ir_node *ptr, ir_node *call);
2663 /** Constructor for a EndReg node.
2665 * Used to represent regular procedure end in interprocedual view.
2667 * @param *irg The IR graph the node belong to.
2668 * @param *block The block the node belong to.
2670 ir_node *new_r_EndReg(ir_graph *irg, ir_node *block);
2672 /** Constructor for a EndExcept node.
2674 * Used to represent exceptional procedure end in interprocedural view.
2676 * @param *irg The IR graph the node belong to.
2677 * @param *block The block the node belong to.
2679 ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
2681 /** Constructor for a Break node.
2683 * Break represents control flow to a single control successor just as Jmp.
2684 * The blocks separated by a break may not be concatenated by an optimization.
2685 * It is used for the interprocedural representation where blocks are parted
2686 * behind Call nodes to represent the control flow to called procedures.
2688 * @param *block The block the node belong to.
2690 ir_node *new_r_Break(ir_node *block);
2692 /** Constructor for a Filter node.
2694 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
2695 * Filter is a node with two views used to construct the interprocedural view.
2696 * In intraprocedural view its semantics are identical to the Proj node.
2697 * In interprocedural view the Filter performs the Phi operation on method
2698 * parameters or results. Other than a Phi a Filter node may not be removed
2699 * if it has only a single input.
2701 * The constructor builds the Filter in intraprocedural view.
2703 * @param *block The block the node belong to.
2704 * @param *arg The tuple value to project from.
2705 * @param *mode The mode of the projected value.
2706 * @param proj The position in the tuple to project from.
2708 ir_node *new_r_Filter(ir_node *block, ir_node *arg, ir_mode *mode, long proj);
2710 /** Constructor for a NoMem node.
2712 * Returns the unique NoMem node of the graph. The same as
2715 * @param *irg The IR graph the node belongs to.
2717 ir_node *new_r_NoMem(ir_graph *irg);
2719 /** Constructor for a Mux node.
2721 * @param *block The block the node belong to.
2722 * @param *sel The ir_node that calculates the boolean select.
2723 * @param *ir_true The ir_node that calculates the true result.
2724 * @param *ir_false The ir_node that calculates the false result.
2725 * @param *mode The mode of the node (and it_true and ir_false).
2727 ir_node *new_r_Mux(ir_node *block, ir_node *sel,
2728 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2730 /** Constructor for a CopyB node.
2732 * @param *block The block the node belong to.
2733 * @param *store The current memory
2734 * @param *dst The ir_node that represents the destination address.
2735 * @param *src The ir_node that represents the source address.
2736 * @param *data_type The type of the copied data
2738 ir_node *new_r_CopyB(ir_node *block, ir_node *store,
2739 ir_node *dst, ir_node *src, ir_type *data_type);
2741 /** Constructor for a InstOf node.
2743 * A High-Level Type check.
2745 * @param *block The block the node belong to.
2746 * @param *store The memory in which the object the entity should be selected
2747 * from is allocated.
2748 * @param *objptr A pointer to a object of a class type.
2749 * @param *type The type of which objptr must be.
2751 ir_node *new_r_InstOf(ir_node *block, ir_node *store,
2752 ir_node *objptr, ir_type *type);
2754 /** Constructor for a Raise node.
2756 * A High-Level Exception throw.
2758 * @param *block The IR block the node belongs to.
2759 * @param *store The current memory.
2760 * @param *obj A pointer to the Except variable.
2762 ir_node *new_r_Raise(ir_node *block, ir_node *store, ir_node *obj);
2764 /** Constructor for a Bound node.
2766 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2768 * @param *block The block the node belong to.
2769 * @param *store The current memory.
2770 * @param *idx The ir_node that represents an index.
2771 * @param *lower The ir_node that represents the lower bound for the index.
2772 * @param *upper The ir_node that represents the upper bound for the index.
2774 ir_node *new_r_Bound(ir_node *block, ir_node *store,
2775 ir_node *idx, ir_node *lower, ir_node *upper);
2777 /** Constructor for a Pin node.
2779 * @param *block The block the node belong to.
2780 * @param *node The node which value should be pinned.
2782 ir_node *new_r_Pin(ir_node *block, ir_node *node);
2784 /** Constructor for an ASM pseudo node.
2786 * @param *block The block the node belong to.
2787 * @param arity The number of data inputs to the node.
2788 * @param *in The array of length arity of data inputs.
2789 * @param *inputs The array of length arity of input constraints.
2790 * @param n_outs The number of data outputs to the node.
2791 * @param *outputs The array of length n_outs of output constraints.
2792 * @param n_clobber The number of clobbered registers.
2793 * @param *clobber The array of length n_clobber of clobbered registers.
2794 * @param *asm_text The assembler text.
2796 ir_node *new_r_ASM(ir_node *block,
2797 int arity, ir_node *in[], ir_asm_constraint *inputs,
2798 int n_outs, ir_asm_constraint *outputs,
2799 int n_clobber, ident *clobber[], ident *asm_text);
2801 /*-----------------------------------------------------------------------*/
2802 /* The block oriented interface */
2803 /*-----------------------------------------------------------------------*/
2805 /** Sets the current block in which the following constructors place the
2806 * nodes they construct.
2808 * @param target The new current block.
2810 void set_cur_block(ir_node *target);
2812 /** Returns the current block of the current graph. */
2813 ir_node *get_cur_block(void);
2815 /** Returns the fixed nodes of the current graph. */
2816 #define get_cur_end_block() get_irg_end_block(current_ir_graph)
2817 #define get_cur_end() get_irg_end(current_ir_graph)
2818 #define get_cur_start_block() get_irg_start_block(current_ir_graph)
2819 #define get_cur_start() get_irg_start(current_ir_graph)
2821 /** Constructor for a Block node.
2823 * Adds the block to the graph in current_ir_graph. Constructs a Block
2824 * with a fixed number of predecessors. Does set current_block. Can
2825 * be used with automatic Phi node construction.
2827 * @param *db A Pointer for debug information.
2828 * @param arity The number of control predecessors.
2829 * @param in[] An array of control predecessors. The length of
2830 * the array must be 'arity'.
2832 ir_node *new_d_Block(dbg_info *db, int arity, ir_node *in[]);
2834 /** Constructor for a Start node.
2836 * Adds the node to the block in current_ir_block.
2838 * @param *db A pointer for debug information.
2840 ir_node *new_d_Start(dbg_info *db);
2842 /** Constructor for a End node.
2844 * Adds the node to the block in current_ir_block.
2846 * @param *db A pointer for debug information.
2848 ir_node *new_d_End(dbg_info *db);
2850 /** Constructor for a Jmp node.
2852 * Adds the node to the block in current_ir_block.
2854 * Jmp represents control flow to a single control successor.
2856 * @param *db A pointer for debug information.
2858 ir_node *new_d_Jmp(dbg_info *db);
2860 /** Constructor for an IJmp node.
2862 * IJmp represents control flow to a single control successor not
2863 * statically known i.e. an indirect Jmp.
2865 * @param *db A pointer for debug information.
2866 * @param *tgt The IR node representing the target address.
2868 ir_node *new_d_IJmp(dbg_info *db, ir_node *tgt);
2870 /** Constructor for a Cond node.
2872 * Adds the node to the block in current_ir_block.
2874 * If c is mode_b represents a conditional branch (if/else). If c is
2875 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2876 * node, default Proj is 0.)
2878 * This is not consistent: Input to Cond is Is, Proj has as proj number
2881 * @param *db A pointer for debug information.
2882 * @param *c The conditions parameter.Can be of mode b or I_u.
2884 ir_node *new_d_Cond(dbg_info *db, ir_node *c);
2886 /** Constructor for a Return node.
2888 * Adds the node to the block in current_ir_block.
2890 * Returns the memory and zero or more return values. Only node that
2891 * can end regular control flow.
2893 * @param *db A pointer for debug information.
2894 * @param *store The state of memory.
2895 * @param arity Number of array indices.
2896 * @param *in Array with index inputs to the node.
2898 ir_node *new_d_Return(dbg_info *db, ir_node *store, int arity, ir_node *in[]);
2900 /** Constructor for a Const_type node.
2902 * Adds the node to the start block.
2904 * The constant represents a target value. This constructor sets high
2905 * level type information for the constant value.
2906 * Derives mode from passed tarval.
2908 * @param *db A pointer for debug information.
2909 * @param *con Points to an entry in the constant table. This pointer is
2910 added to the attributes of the node.
2911 * @param *tp The type of the constant.
2913 ir_node *new_d_Const_type(dbg_info *db, tarval *con, ir_type *tp);
2915 /** Constructor for a Const node.
2917 * Adds the node to the block in current_ir_block.
2919 * Constructor for a Const node. The constant represents a target
2920 * value. Sets the type information to type_unknown. (No more
2921 * supported: If tv is entity derives a somehow useful type.)
2922 * Derives mode from passed tarval.
2924 * @param *db A pointer for debug information.
2925 * @param *con Points to an entry in the constant table. This pointer is added
2926 * to the attributes of the node.
2928 ir_node *new_d_Const(dbg_info *db, tarval *con);
2930 /** Constructor for a SymConst_type node.
2932 * Adds the node to the block in current_ir_block.
2933 * This is the constructor for a symbolic constant.
2934 * There are four kinds of symbolic constants:
2935 * - type_tag The symbolic constant represents a type tag. The type the
2936 * tag stands for is given explicitly.
2937 * - size The symbolic constant represents the size of a type. The
2938 * type of which the constant represents the size is given
2940 * - addr_name The symbolic constant represents the address of an entity
2941 * (variable or method). The variable is indicated by a name
2942 * that is valid for linking.
2943 * - addr_ent The symbolic constant represents the address of an entity
2944 * (variable or method). The variable is given explicitly by
2947 * Inputs to the node:
2948 * No inputs except the block it belongs to.
2949 * Outputs of the node.
2950 * An unsigned integer (I_u) or a pointer (P).
2952 * @param *db A pointer for debug information.
2953 * @param mode The mode for the SymConst.
2954 * @param value A type, entity or ident depending on the SymConst kind.
2955 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size,
2956 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
2957 * @param tp The source type of the constant.
2959 ir_node *new_d_SymConst_type(dbg_info *db, ir_mode *mode,
2960 union symconst_symbol value, symconst_kind kind, ir_type *tp);
2962 /** Constructor for a SymConst node.
2964 * Same as new_d_SymConst_type, except that it sets the type to type_unknown.
2966 ir_node *new_d_SymConst(dbg_info *db, ir_mode *mode,
2967 union symconst_symbol value, symconst_kind kind);
2969 /** Constructor for a simpleSel node.
2971 * This is a shortcut for the new_d_Sel() constructor. To be used for
2972 * Sel nodes that do not select from an array, i.e., have no index
2973 * inputs. It adds the two parameters 0, NULL.
2975 * @param *db A pointer for debug information.
2976 * @param *store The memory in which the object the entity should be
2977 * selected from is allocated.
2978 * @param *objptr The object from that the Sel operation selects a
2979 * single attribute out.
2980 * @param *ent The entity to select.
2982 ir_node *new_d_simpleSel(dbg_info *db, ir_node *store, ir_node *objptr, ir_entity *ent);
2984 /** Constructor for a Sel node.
2986 * The select node selects an entity (field or method) from an entity
2987 * with a compound type. It explicitly specifies the entity selected.
2988 * Dynamically the node may select entities that overwrite the given
2989 * entity. If the selected entity is an array element entity the Sel
2990 * node takes the required array indices as inputs.
2991 * Adds the node to the block in current_ir_block.
2993 * @param *db A pointer for debug information.
2994 * @param *store The memory in which the object the entity should be selected
2995 * from is allocated.
2996 * @param *objptr A pointer to a compound entity the Sel operation selects a
2997 * single attribute from.
2998 * @param arity The number of array indices needed to select an array element entity.
2999 * @param *in[] If the compound entity is an array the indices of the selected
3000 * element entity. The constructor copies this array.
3001 * @param *ent The entity to select.
3003 ir_node *new_d_Sel(dbg_info *db, ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3006 /** Constructor for a Call node.
3008 * Represents all kinds of method and function calls.
3009 * Adds the node to the block in current_ir_block.
3011 * @param *db A pointer for debug information.
3012 * @param *store The actual store.
3013 * @param *callee A pointer to the called procedure.
3014 * @param arity The number of procedure parameters.
3015 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3016 * @param *tp Type information of the procedure called.
3018 ir_node *new_d_Call(dbg_info *db, ir_node *store, ir_node *callee, int arity, ir_node *in[],
3021 /** Constructor for a Builtin node.
3023 * Represents a call of a backend-specific builtin..
3024 * Adds the node to the block in current_ir_block.
3026 * @param *db A pointer for debug information.
3027 * @param *store The actual store.
3028 * @param arity The number of procedure parameters.
3029 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3030 * @param kind The kind of the called builtin.
3031 * @param *tp Type information of the procedure called.
3033 ir_node *new_d_Builtin(dbg_info *db, ir_node *store, int arity, ir_node *in[], ir_builtin_kind kind, ir_type *tp);
3035 /** Constructor for a Add node.
3037 * Adds the node to the block in current_ir_block.
3039 * @param *db A pointer for debug information.
3040 * @param *op1 The first operand.
3041 * @param *op2 The second operand.
3042 * @param *mode The mode of the operands and the result.
3044 ir_node *new_d_Add(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3046 /** Constructor for a Sub node.
3048 * Adds the node to the block in current_ir_block.
3050 * @param *db A pointer for debug information.
3051 * @param *op1 The first operand.
3052 * @param *op2 The second operand.
3053 * @param *mode The mode of the operands and the result.
3055 ir_node *new_d_Sub(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3057 /** Constructor for a Minus node.
3059 * Adds the node to the block in current_ir_block.
3061 * @param *db A pointer for debug information.
3062 * @param *op The operand .
3063 * @param *mode The mode of the operand and the result.
3065 ir_node *new_d_Minus(dbg_info *db, ir_node *op, ir_mode *mode);
3067 /** Constructor for a Mul node.
3069 * Adds the node to the block in current_ir_block.
3071 * @param *db A pointer for debug information.
3072 * @param *op1 The first operand.
3073 * @param *op2 The second operand.
3074 * @param *mode The mode of the operands and the result.
3076 ir_node *new_d_Mul(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3078 /** Constructor for a Mulh node.
3080 * Adds the node to the block in current_ir_block.
3082 * @param *db A pointer for debug information.
3083 * @param *op1 The first operand.
3084 * @param *op2 The second operand.
3085 * @param *mode The mode of the operands and the result.
3087 ir_node *new_d_Mulh(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3089 /** Constructor for a Quot node.
3091 * Adds the node to the block in current_ir_block.
3093 * @param *db A pointer for debug information.
3094 * @param *memop The store needed to model exceptions
3095 * @param *op1 The first operand.
3096 * @param *op2 The second operand.
3097 * @param *mode The mode of the result.
3098 * @param state The pinned state.
3100 ir_node *new_d_Quot(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3102 /** Constructor for a DivMod node.
3104 * Adds the node to the block in current_ir_block.
3106 * @param *db A pointer for debug information.
3107 * @param *memop The store needed to model exceptions
3108 * @param *op1 The first operand.
3109 * @param *op2 The second operand.
3110 * @param *mode The mode of the results.
3111 * @param state The pinned state.
3113 ir_node *new_d_DivMod(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3115 /** Constructor for a Div node.
3117 * Adds the node to the block in current_ir_block.
3119 * @param *db A pointer for debug information.
3120 * @param *memop The store needed to model exceptions
3121 * @param *op1 The first operand.
3122 * @param *op2 The second operand.
3123 * @param *mode The mode of the result.
3124 * @param state The pinned state.
3126 ir_node *new_d_Div(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3128 /** Constructor for a remainderless Div node.
3130 * Adds the node to the block in current_ir_block.
3132 * @param *db A pointer for debug information.
3133 * @param *memop The store needed to model exceptions
3134 * @param *op1 The first operand.
3135 * @param *op2 The second operand.
3136 * @param *mode The mode of the result.
3137 * @param state The pinned state.
3139 ir_node *new_d_DivRL(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3141 /** Constructor for a Mod node.
3143 * Adds the node to the block in current_ir_block.
3145 * @param *db A pointer for debug information.
3146 * @param *memop The store needed to model exceptions
3147 * @param *op1 The first operand.
3148 * @param *op2 The second operand.
3149 * @param *mode The mode of the result.
3150 * @param state The pinned state.
3152 ir_node *new_d_Mod(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3154 /** Constructor for a Abs node.
3156 * Adds the node to the block in current_ir_block.
3158 * @param *db A pointer for debug information.
3159 * @param *op The operand
3160 * @param *mode The mode of the operands and the result.
3162 ir_node *new_d_Abs(dbg_info *db, ir_node *op, ir_mode *mode);
3164 /** Constructor for a And node.
3166 * Adds the node to the block in current_ir_block.
3168 * @param *db A pointer for debug information.
3169 * @param *op1 The first operand.
3170 * @param *op2 The second operand.
3171 * @param *mode The mode of the operands and the result.
3173 ir_node *new_d_And(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3175 /** Constructor for a Or node.
3177 * Adds the node to the block in current_ir_block.
3179 * @param *db A pointer for debug information.
3180 * @param *op1 The first operand.
3181 * @param *op2 The second operand.
3182 * @param *mode The mode of the operands and the result.
3184 ir_node *new_d_Or(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3186 /** Constructor for a Eor node.
3188 * Adds the node to the block in current_ir_block.
3190 * @param *db A pointer for debug information.
3191 * @param *op1 The first operand.
3192 * @param *op2 The second operand.
3193 * @param *mode The mode of the operands and the results.
3195 ir_node *new_d_Eor(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3197 /** Constructor for a Not node.
3199 * Adds the node to the block in current_ir_block.
3201 * @param *db A pointer for debug information.
3202 * @param *op The operand.
3203 * @param *mode The mode of the operand and the result.
3205 ir_node *new_d_Not(dbg_info *db, ir_node *op, ir_mode *mode);
3207 /** Constructor for a Shl node.
3209 * Adds the node to the block in current_ir_block.
3211 * @param *db A pointer for debug information.
3212 * @param *op The operand.
3213 * @param *k The number of bits to shift the operand .
3214 * @param *mode The mode of the operand and the result.
3216 ir_node *new_d_Shl(dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3218 /** Constructor for a Shr node.
3220 * Adds the node to the block in current_ir_block.
3222 * @param *db A pointer for debug information.
3223 * @param *op The operand.
3224 * @param *k The number of bits to shift the operand .
3225 * @param *mode The mode of the operand and the result.
3227 ir_node *new_d_Shr(dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3229 /** Constructor for a Shrs node.
3231 * Adds the node to the block in current_ir_block.
3233 * @param *db A pointer for debug information.
3234 * @param *op The operand.
3235 * @param *k The number of bits to shift the operand .
3236 * @param *mode The mode of the operand and the result.
3238 ir_node *new_d_Shrs(dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3240 /** Constructor for a Rotl node.
3242 * Adds the node to the block in current_ir_block.
3244 * @param *db A pointer for debug information.
3245 * @param *op The operand.
3246 * @param *k The number of bits to rotate the operand.
3247 * @param *mode The mode of the operand.
3249 ir_node *new_d_Rotl(dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3251 /** Constructor for a Cmp node.
3253 * Adds the node to the block in current_ir_block.
3255 * @param *db A pointer for debug information.
3256 * @param *op1 The first operand.
3257 * @param *op2 The second operand.
3259 ir_node *new_d_Cmp(dbg_info *db, ir_node *op1, ir_node *op2);
3261 /** Constructor for a Conv node.
3263 * Adds the node to the block in current_ir_block.
3265 * @param *db A pointer for debug information.
3266 * @param *op The operand.
3267 * @param *mode The mode of this the operand muss be converted .
3269 ir_node *new_d_Conv(dbg_info *db, ir_node *op, ir_mode *mode);
3271 /** Constructor for a strict Conv node.
3273 * Adds the node to the block in current_ir_block.
3275 * @param *db A pointer for debug information.
3276 * @param *op The operand.
3277 * @param *mode The mode of this the operand muss be converted .
3279 ir_node *new_d_strictConv(dbg_info *db, ir_node *op, ir_mode *mode);
3281 /** Constructor for a Cast node.
3283 * High level type cast
3284 * Adds the node to the block in current_ir_block.
3286 * @param *db A pointer for debug information.
3287 * @param *op The operand.
3288 * @param *to_tp The type of this the operand muss be casted .
3290 ir_node *new_d_Cast(dbg_info *db, ir_node *op, ir_type *to_tp);
3292 /** Constructor for a Carry node.
3294 * Adds the node to the block in current_ir_block.
3296 * @param *db A pointer for debug information.
3297 * @param *op1 The first operand.
3298 * @param *op2 The second operand.
3299 * @param *mode The mode of the operands and the result.
3301 ir_node *new_d_Carry(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3303 /** Constructor for a Borrow node.
3305 * Adds the node to the block in current_ir_block.
3307 * @param *db A pointer for debug information.
3308 * @param *op1 The first operand.
3309 * @param *op2 The second operand.
3310 * @param *mode The mode of the operands and the result.
3312 ir_node *new_d_Borrow(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3314 /** Constructor for a Phi node.
3316 * Adds the node to the block in current_ir_block.
3318 * @param *db A pointer for debug information.
3319 * @param arity The number of predecessors
3320 * @param *in Array with predecessors
3321 * @param *mode The mode of it's inputs and output.
3323 ir_node *new_d_Phi(dbg_info *db, int arity, ir_node *in[], ir_mode *mode);
3325 /** Constructor for a Load node.
3327 * Adds the node to the block in current_ir_block.
3329 * @param *db A pointer for debug information.
3330 * @param *store The current memory
3331 * @param *addr A pointer to the variable to be read in this memory.
3332 * @param *mode The mode of the value to be loaded.
3333 * @param flags Additional flags for alignment, volatility and pin state.
3335 ir_node *new_d_Load(dbg_info *db, ir_node *store, ir_node *addr, ir_mode *mode, ir_cons_flags flags);
3337 /** Constructor for a Store node.
3339 * Adds the node to the block in current_ir_block.
3341 * @param *db A pointer for debug information.
3342 * @param *store The current memory
3343 * @param *addr A pointer to the variable to be read in this memory.
3344 * @param *val The value to write to this variable.
3345 * @param flags Additional flags for alignment, volatility and pin state.
3347 ir_node *new_d_Store(dbg_info *db, ir_node *store, ir_node *addr, ir_node *val, ir_cons_flags flags);
3349 /** Constructor for a Alloc node.
3351 * The Alloc node extends the memory by space for an entity of type alloc_type.
3352 * Adds the node to the block in current_ir_block.
3354 * @param *db A pointer for debug information.
3355 * @param *store The memory which shall contain the new variable.
3356 * @param *size The number of bytes to allocate.
3357 * @param *alloc_type The type of the allocated variable.
3358 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3360 ir_node *new_d_Alloc(dbg_info *db, ir_node *store, ir_node *size, ir_type *alloc_type,
3361 ir_where_alloc where);
3363 /** Constructor for a Free node.
3365 * Frees the memory occupied by the entity pointed to by the pointer
3366 * arg. Type indicates the type of the entity the argument points to.
3367 * Adds the node to the block in current_ir_block.
3369 * @param *db A pointer for debug information.
3370 * @param *store The memory which shall contain the new variable.
3371 * @param *ptr The pointer to the object to free.
3372 * @param *size The number of objects of type free_type to free in a sequence.
3373 * @param *free_type The type of the freed variable.
3374 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
3376 ir_node *new_d_Free(dbg_info *db, ir_node *store, ir_node *ptr, ir_node *size,
3377 ir_type *free_type, ir_where_alloc where);
3379 /** Constructor for a Sync node.
3381 * Merges several memory values. The node assumes that a variable
3382 * either occurs only in one of the memories, or it contains the same
3383 * value in all memories where it occurs.
3384 * Adds the node to the block in current_ir_block.
3386 * @param *db A pointer for debug information.
3387 * @param arity The number of memories to synchronize.
3388 * @param **in An array of pointers to nodes that produce an output of type
3389 * memory. The constructor copies this array.
3391 ir_node *new_d_Sync(dbg_info *db, int arity, ir_node *in[]);
3393 /** Constructor for a Proj node.
3395 * Projects a single value out of a tuple. The parameter proj gives the
3396 * position of the value within the tuple.
3397 * Adds the node to the block in current_ir_block.
3399 * @param *db A pointer for deubug information.
3400 * @param arg A node producing a tuple.
3401 * @param *mode The mode of the value to project.
3402 * @param proj The position of the value in the tuple.
3404 ir_node *new_d_Proj(dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3406 /** Constructor for a defaultProj node.
3408 * Represents the default control flow of a Switch-Cond node.
3409 * Adds the node to the block in current_ir_block.
3411 * @param *db A pointer for debug information.
3412 * @param arg A node producing a tuple.
3413 * @param max_proj The end position of the value in the tuple.
3415 ir_node *new_d_defaultProj(dbg_info *db, ir_node *arg, long max_proj);
3417 /** Constructor for a Tuple node.
3419 * This is an auxiliary node to replace a node that returns a tuple
3420 * without changing the corresponding Proj nodes.
3421 * Adds the node to the block in current_ir_block.
3423 * @param *db A pointer for debug information.
3424 * @param arity The number of tuple elements.
3425 * @param **in An array containing pointers to the nodes producing the tuple elements.
3427 ir_node *new_d_Tuple(dbg_info *db, int arity, ir_node *in[]);
3429 /** Constructor for a Id node.
3431 * This is an auxiliary node to replace a node that returns a single
3432 * value. Adds the node to the block in current_ir_block.
3434 * @param *db A pointer for debug information.
3435 * @param *val The operand to Id.
3436 * @param *mode The mode of *val.
3438 ir_node *new_d_Id(dbg_info *db, ir_node *val, ir_mode *mode);
3440 /** Constructor for a Confirm node.
3442 * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3443 * Specifies constraints for a value. To support dataflow analyses.
3445 * Example: If the value never exceeds '100' this is expressed by placing a
3446 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
3448 * @param *db A pointer for debug information.
3449 * @param *val The value we express a constraint for
3450 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3451 * @param cmp The compare operation.
3453 ir_node *new_d_Confirm(dbg_info *db, ir_node *val, ir_node *bound, pn_Cmp cmp);
3455 /** Constructor for an Unknown node.
3457 * Represents an arbitrary value. Places the node in
3460 * @param *db A pointer for debug information.
3461 * @param *m The mode of the unknown value.
3463 ir_node *new_d_Unknown(dbg_info *db, ir_mode *m);
3465 /** Constructor for a CallBegin node.
3467 * CallBegin represents control flow depending of the pointer value
3468 * representing the called method to the called methods. The
3469 * constructor copies the method pointer input from the passed Call
3470 * node.Adds the node to the block in current_ir_block.
3472 * @param *db A pointer for debug information.
3473 * @param *callee The call node visible in the intra procedural view.
3475 ir_node *new_d_CallBegin(dbg_info *db, ir_node *ptr, ir_node *call);
3477 /** Constructor for an EndReg node.
3479 *Adds the node to the block in current_ir_block.
3481 * @param *db A pointer for debug information.
3483 ir_node *new_d_EndReg(dbg_info *db);
3485 /** Constructor for an EndExcept node.
3487 * Used to represent regular procedure end in interprocedual view.
3488 * Adds the node to the block in current_ir_block.
3490 * @param *db A pointer for debug information.
3492 ir_node *new_d_EndExcept(dbg_info *db);
3494 /** Constructor for a Break node.
3496 * Used to represent exceptional procedure end in interprocedural view.
3497 * Adds the node to the block in current_ir_block.
3499 * Break represents control flow to a single control successor just as Jmp.
3500 * The blocks separated by a break may not be concatenated by an optimization.
3501 * It is used for the interprocedural representation where blocks are parted
3502 * behind Call nodes to represent the control flow to called procedures.
3504 * @param *db A pointer for debug information.
3506 ir_node *new_d_Break(dbg_info *db);
3508 /** Constructor for a Filter node.
3510 * Constructor for a Filter node. Adds the node to the block in
3511 * current_ir_block. Filter is a node with two views used to
3512 * construct the interprocedural view. In intraprocedural view its
3513 * semantics are identical to the Proj node. In interprocedural view
3514 * the Filter performs the Phi operation on method parameters or
3515 * results. Other than a Phi a Filter node may not be removed if it
3516 * has only a single input.
3518 * The constructor builds the Filter in intraprocedural view.
3520 * @param *db A pointer for debug information.
3521 * @param *arg The tuple value to project from.
3522 * @param *mode The mode of the projected value.
3523 * @param proj The position in the tuple to project from.
3525 ir_node *new_d_Filter(dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3527 /** Constructor for a Mux node.
3529 * @param *db A pointer for debug information.
3530 * @param *sel The ir_node that calculates the boolean select.
3531 * @param *ir_true The ir_node that calculates the true result.
3532 * @param *ir_false The ir_node that calculates the false result.
3533 * @param *mode The mode of the node (and it_true and ir_false).
3535 ir_node *new_d_Mux(dbg_info *db, ir_node *sel,
3536 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
3538 /** Constructor for a CopyB node.
3540 * @param *db A pointer for debug information.
3541 * @param *store The current memory
3542 * @param *dst The ir_node that represents the destination address.
3543 * @param *src The ir_node that represents the source address.
3544 * @param *data_type The type of the copied data
3546 ir_node *new_d_CopyB(dbg_info *db, ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
3548 /** Constructor for a InstOf node.
3550 * A High-Level Type check.
3552 * @param *db A pointer for debug information.
3553 * @param *store The memory in which the object the entity should be selected
3554 * from is allocated.
3555 * @param *objptr A pointer to a object of a class type.
3556 * @param *type The type of which objptr must be.
3558 ir_node *new_d_InstOf(dbg_info *db, ir_node *store, ir_node *objptr, ir_type *type);
3560 /** Constructor for a Raise node.
3562 * A High-Level Exception throw.
3564 * @param *db A pointer for debug information.
3565 * @param *store The current memory.
3566 * @param *obj A pointer to the Except variable.
3568 ir_node *new_d_Raise(dbg_info *db, ir_node *store, ir_node *obj);
3570 /** Constructor for a Bound node.
3572 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
3574 * @param *db A pointer for debug information.
3575 * @param *store The current memory
3576 * @param *idx The ir_node that represents an index.
3577 * @param *lower The ir_node that represents the lower bound for the index.
3578 * @param *upper The ir_node that represents the upper bound for the index.
3580 ir_node *new_d_Bound(dbg_info *db, ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
3582 /** Constructor for a Pin node.
3584 * @param *db A pointer for debug information.
3585 * @param *node The node which value should be pinned.
3587 ir_node *new_d_Pin(dbg_info *db, ir_node *node);
3589 /** Constructor for an ASM pseudo node.
3591 * @param *db A pointer for debug information.
3592 * @param arity The number of data inputs to the node.
3593 * @param *in The array of length arity of data inputs.
3594 * @param *inputs The array of length arity of input constraints.
3595 * @param n_outs The number of data outputs to the node.
3596 * @param *outputs The array of length n_outs of output constraints.
3597 * @param n_clobber The number of clobbered registers.
3598 * @param *clobber The array of length n_clobber of clobbered registers.
3599 * @param *asm_text The assembler text.
3601 ir_node *new_d_ASM(dbg_info *db, int arity, ir_node *in[], ir_asm_constraint *inputs,
3602 int n_outs, ir_asm_constraint *outputs,
3603 int n_clobber, ident *clobber[], ident *asm_text);
3605 /*-----------------------------------------------------------------------*/
3606 /* The block oriented interface without debug support */
3607 /*-----------------------------------------------------------------------*/
3609 /* Needed from the interface with debug support:
3610 void set_cur_block (ir_node *target); */
3612 /** Constructor for a Block node.
3614 * Constructor for a Block node. Adds the block to the graph in
3615 * current_ir_graph. Constructs a Block with a fixed number of
3616 * predecessors. Does set current_block. Can be used with automatic
3617 * Phi node construction.
3619 * @param arity The number of control predecessors.
3620 * @param in An array of control predecessors. The length of
3621 * the array must be 'arity'.
3623 ir_node *new_Block(int arity, ir_node *in[]);
3625 /** Constructor for a Start node.
3627 * Adds the node to the block in current_ir_block.
3630 ir_node *new_Start(void);
3632 /** Constructor for an End node.
3634 * Adds the node to the block in current_ir_block.
3636 ir_node *new_End(void);
3638 /** Constructor for an EndReg node.
3640 * Used to represent regular procedure end in interprocedual view.
3641 * Adds the node to the block in current_ir_block.
3643 ir_node *new_EndReg(void);
3645 /** Constructor for an EndExpcept node.
3647 * Used to represent exceptional procedure end in interprocedural view.
3648 * Adds the node to the block in current_ir_block.
3650 ir_node *new_EndExcept(void);
3652 /** Constructor for a Jump node.
3654 * Adds the node to the block in current_ir_block.
3656 * Jmp represents control flow to a single control successor.
3658 ir_node *new_Jmp(void);
3660 /** Constructor for an IJmp node.
3662 * IJmp represents control flow to a single control successor not
3663 * statically known i.e. an indirect Jmp.
3665 * @param *tgt The IR node representing the target address.
3667 ir_node *new_IJmp(ir_node *tgt);
3669 /** Constructor for a Break node.
3670 * Break represents control flow to a single control successor just as Jmp.
3671 * The blocks separated by a break may not be concatenated by an optimization.
3672 * It is used for the interprocedural representation where blocks are parted
3673 * behind Call nodes to represent the control flow to called procedures.
3674 * Adds the node to the block in current_ir_block.
3676 ir_node *new_Break(void);
3678 /** Constructor for a Cond node.
3680 * If c is mode_b represents a conditional branch (if/else). If c is
3681 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
3682 * node, default Proj is 0.). Adds the node to the block in current_ir_block.
3684 * This is not consistent: Input to Cond is Is, Proj has as proj number
3688 * @param *c The conditions parameter.Can be of mode b or I_u.
3690 ir_node *new_Cond(ir_node *c);
3692 /** Constructor for a Return node.
3694 * Returns the memory and zero or more return values. Only node that
3695 * can end regular control flow. Adds the node to the block in current_ir_block.
3697 * @param *store The state of memory.
3698 * @param arity Number of array indices.
3699 * @param *in Array with index inputs to the node.
3701 ir_node *new_Return(ir_node *store, int arity, ir_node *in[]);
3703 /** Constructor for a Const node.
3705 * Constructor for a Const node. The constant represents a target
3706 * value. Sets the type information to type_unknown. (No more
3707 * supported: If tv is entity derives a somehow useful type.)
3708 * Adds the node to the block in current_ir_block.
3709 * Derives mode from passed tarval.
3711 * @param *con Points to an entry in the constant table. This pointer is
3712 * added to the attributes of the node.
3714 ir_node *new_Const(tarval *con);
3717 * Make a const from a long.
3718 * This is just convenience for the usual
3720 * new_Const(mode, tarval_from_long(mode, ...))
3723 * @param mode The mode for the const.
3724 * @param value The value of the constant.
3725 * @return A new const node.
3727 ir_node *new_Const_long(ir_mode *mode, long value);
3729 /** Constructor for a Const node.
3731 * Derives mode from passed tarval. */
3732 ir_node *new_Const_type(tarval *con, ir_type *tp);
3734 /** Constructor for a SymConst node.
3736 * Adds the node to the block in current_ir_block.
3737 * This is the constructor for a symbolic constant.
3738 * There are four kinds of symbolic constants:
3739 * -# type_tag The symbolic constant represents a type tag. The type the
3740 * tag stands for is given explicitly.
3741 * -# size The symbolic constant represents the size of a type. The
3742 * type of which the constant represents the size is given
3744 * -# align The symbolic constant represents the alignment of a type. The
3745 * type of which the constant represents the size is given
3747 * -# addr_name The symbolic constant represents the address of an entity
3748 * (variable or method). The variable is indicated by a name
3749 * that is valid for linking.
3750 * -# addr_ent The symbolic constant represents the address of an entity
3751 * (variable or method). The variable is given explicitly by
3754 * Inputs to the node:
3755 * No inputs except the block it belongs to.
3756 * Outputs of the node.
3757 * An unsigned integer (I_u) or a pointer (P).
3759 * @param mode The mode for the SymConst.
3760 * @param value A type or a ident depending on the SymConst kind.
3761 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3762 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
3763 * @param tp The source type of the constant.
3765 ir_node *new_SymConst_type(ir_mode *mode, union symconst_symbol value, symconst_kind kind, ir_type *tp);
3767 /** Constructor for a SymConst node.
3769 * Adds the node to the block in current_ir_block.
3770 * This is the constructor for a symbolic constant.
3771 * There are four kinds of symbolic constants:
3772 * -# type_tag The symbolic constant represents a type tag. The type the
3773 * tag stands for is given explicitly.
3774 * -# size The symbolic constant represents the size of a type. The
3775 * type of which the constant represents the size is given
3777 * -# align The symbolic constant represents the alignment of a type. The
3778 * type of which the constant represents the size is given
3780 * -# addr_name The symbolic constant represents the address of an entity
3781 * (variable or method). The variable is indicated by a name
3782 * that is valid for linking.
3783 * -# addr_ent The symbolic constant represents the address of an entity
3784 * (variable or method). The variable is given explicitly by
3787 * Inputs to the node:
3788 * No inputs except the block it belongs to.
3789 * Outputs of the node.
3790 * An unsigned integer (I_u) or a pointer (P).
3792 * @param mode The mode for the SymConst.
3793 * @param value A type or a ident depending on the SymConst kind.
3794 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3795 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
3797 ir_node *new_SymConst(ir_mode *mode, union symconst_symbol value, symconst_kind kind);
3799 /** Constructor for a simpelSel node.
3801 * This is a shortcut for the new_Sel() constructor. To be used for
3802 * Sel nodes that do not select from an array, i.e., have no index
3803 * inputs. It adds the two parameters 0, NULL.
3805 * @param *store The memory in which the object the entity should be selected from is allocated.
3806 * @param *objptr The object from that the Sel operation selects a single attribute out.
3807 * @param *ent The entity to select.
3809 ir_node *new_simpleSel(ir_node *store, ir_node *objptr, ir_entity *ent);
3811 /** Constructor for a Sel node.
3813 * The select node selects an entity (field or method) from an entity
3814 * with a compound type. It explicitly specifies the entity selected.
3815 * Dynamically the node may select entities that overwrite the given
3816 * entity. If the selected entity is an array element entity the Sel
3817 * node takes the required array indices as inputs.
3818 * Adds the node to the block in current_ir_block.
3820 * @param *store The memory in which the object the entity should be selected
3821 * from is allocated.
3822 * @param *objptr A pointer to a compound entity the Sel operation selects a
3823 * single attribute from.
3824 * @param arity The number of array indices needed to select an array element entity.
3825 * @param *in[] If the compound entity is an array the indices of the selected
3826 * element entity. The constructor copies this array.
3827 * @param *ent The entity to select.
3829 ir_node *new_Sel(ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3832 /** Constructor for a Call node.
3834 * Adds the node to the block in current_ir_block.
3835 * Represents all kinds of method and function calls.
3837 * @param *store The actual store.
3838 * @param *callee A pointer to the called procedure.
3839 * @param arity The number of procedure parameters.
3840 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3841 * @param *tp Type information of the procedure called.
3843 ir_node *new_Call(ir_node *store, ir_node *callee, int arity, ir_node *in[],
3846 /** Constructor for a Builtin node.
3848 * Represents a call of a backend-specific builtin..
3849 * Represents all kinds of method and function calls.
3851 * @param *store The actual store.
3852 * @param kind The kind of the called builtin.
3853 * @param arity The number of procedure parameters.
3854 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3855 * @param *tp Type information of the procedure called.
3857 ir_node *new_Builtin(ir_node *store, int arity, ir_node *in[],
3858 ir_builtin_kind kind, ir_type *tp);
3860 /** Constructor for a CallBegin node.
3862 * CallBegin represents control flow depending of the pointer value
3863 * representing the called method to the called methods. The
3864 * constructor copies the method pointer input from the passed Call
3865 * node. Adds the node to the block in current_ir_block.
3867 * @param *callee A pointer to the called procedure.
3869 ir_node *new_CallBegin(ir_node *ptr, ir_node *call);
3871 /** Constructor for a Add node.
3873 * Adds the node to the block in current_ir_block.
3875 * @param *op1 The first operand.
3876 * @param *op2 The second operand.
3877 * @param *mode The mode of the operands and the result.
3879 ir_node *new_Add(ir_node *op1, ir_node *op2, ir_mode *mode);
3881 /** Constructor for a Sub node.
3883 * Adds the node to the block in current_ir_block.
3885 * @param *op1 The first operand.
3886 * @param *op2 The second operand.
3887 * @param *mode The mode of the operands and the result.
3889 ir_node *new_Sub(ir_node *op1, ir_node *op2, ir_mode *mode);
3891 /** Constructor for a Minus node.
3893 * Adds the node to the block in current_ir_block.
3895 * @param *op The operand .
3896 * @param *mode The mode of the operand and the result.
3898 ir_node *new_Minus(ir_node *op, ir_mode *mode);
3901 * Constructor for a Mul node. Adds the node to the block in current_ir_block.
3903 * @param *op1 The first operand.
3904 * @param *op2 The second operand.
3905 * @param *mode The mode of the operands and the result.
3907 ir_node *new_Mul(ir_node *op1, ir_node *op2, ir_mode *mode);
3910 * Constructor for a Mulh node. Adds the node to the block in current_ir_block.
3912 * @param *op1 The first operand.
3913 * @param *op2 The second operand.
3914 * @param *mode The mode of the operands and the result.
3916 ir_node *new_Mulh(ir_node *op1, ir_node *op2, ir_mode *mode);
3918 /** Constructor for a Quot node.
3920 * Adds the node to the block in current_ir_block.
3922 * @param *memop The store needed to model exceptions
3923 * @param *op1 The first operand.
3924 * @param *op2 The second operand.
3925 * @param *mode The mode of the result.
3926 * @param state The pinned state.
3928 ir_node *new_Quot(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3930 /** Constructor for a DivMod node.
3932 * Adds the node to the block in current_ir_block.
3934 * @param *memop The store needed to model exceptions
3935 * @param *op1 The first operand.
3936 * @param *op2 The second operand.
3937 * @param *mode The mode of the results.
3938 * @param state The pinned state.
3940 ir_node *new_DivMod(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3942 /** Constructor for a Div node.
3944 * Adds the node to the block in current_ir_block.
3946 * @param *memop The store needed to model exceptions
3947 * @param *op1 The first operand.
3948 * @param *op2 The second operand.
3949 * @param *mode The mode of the result.
3950 * @param state The pinned state.
3952 ir_node *new_Div(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3954 /** Constructor for a remainderless Div node.
3956 * Adds the node to the block in current_ir_block.
3958 * @param *memop The store needed to model exceptions
3959 * @param *op1 The first operand.
3960 * @param *op2 The second operand.
3961 * @param *mode The mode of the result.
3962 * @param state The pinned state.
3964 ir_node *new_DivRL(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3966 /** Constructor for a Mod node.
3968 * Adds the node to the block in current_ir_block.
3970 * @param *memop The store needed to model exceptions
3971 * @param *op1 The first operand.
3972 * @param *op2 The second operand.
3973 * @param *mode The mode of the result.
3974 * @param state The pinned state.
3976 ir_node *new_Mod(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3978 /** Constructor for a Abs node.
3980 * Adds the node to the block in current_ir_block.
3982 * @param *op The operand
3983 * @param *mode The mode of the operands and the result.
3985 ir_node *new_Abs(ir_node *op, ir_mode *mode);
3987 /** Constructor for a And node.
3989 * Adds the node to the block in current_ir_block.
3991 * @param *op1 The first operand.
3992 * @param *op2 The second operand.
3993 * @param *mode The mode of the operands and the result.
3995 ir_node *new_And(ir_node *op1, ir_node *op2, ir_mode *mode);
3998 * Constructor for a Or node. Adds the node to the block in current_ir_block.
4000 * @param *op1 The first operand.
4001 * @param *op2 The second operand.
4002 * @param *mode The mode of the operands and the result.
4004 ir_node *new_Or(ir_node *op1, ir_node *op2, ir_mode *mode);
4007 * Constructor for a Eor node. Adds the node to the block in current_ir_block.
4009 * @param *op1 The first operand.
4010 * @param *op2 The second operand.
4011 * @param *mode The mode of the operands and the results.
4013 ir_node *new_Eor(ir_node *op1, ir_node *op2, ir_mode *mode);
4015 /** Constructor for a Not node.
4017 * Adds the node to the block in current_ir_block.
4019 * @param *op The operand.
4020 * @param *mode The mode of the operand and the result.
4022 ir_node *new_Not(ir_node *op, ir_mode *mode);
4024 /** Constructor for a Shl node.
4026 * Adds the node to the block in current_ir_block.
4028 * @param *op The operand.
4029 * @param *k The number of bits to shift the operand .
4030 * @param *mode The mode of the operand and the result.
4032 ir_node *new_Shl(ir_node *op, ir_node *k, ir_mode *mode);
4035 * Constructor for a Shr node. Adds the node to the block in current_ir_block.
4037 * @param *op The operand.
4038 * @param *k The number of bits to shift the operand .
4039 * @param *mode The mode of the operand and the result.
4041 ir_node *new_Shr(ir_node *op, ir_node *k, ir_mode *mode);
4043 /** Constructor for a Shrs node.
4045 * Adds the node to the block in current_ir_block.
4047 * @param *op The operand.
4048 * @param *k The number of bits to shift the operand .
4049 * @param *mode The mode of the operand and the result.
4051 ir_node *new_Shrs(ir_node *op, ir_node *k, ir_mode *mode);
4053 /** Constructor for a Rotl node.
4055 * Adds the node to the block in current_ir_block.
4057 * @param *op The operand.
4058 * @param *k The number of bits to rotate the operand.
4059 * @param *mode The mode of the operand.
4061 ir_node *new_Rotl(ir_node *op, ir_node *k, ir_mode *mode);
4063 /** Constructor for a Cmp node.
4065 * Adds the node to the block in current_ir_block.
4067 * @param *op1 The first operand.
4068 * @param *op2 The second operand.
4070 ir_node *new_Cmp(ir_node *op1, ir_node *op2);
4072 /** Constructor for a Conv node.
4074 * Adds the node to the block in current_ir_block.
4076 * @param *op The operand.
4077 * @param *mode The mode of this the operand muss be converted.
4079 ir_node *new_Conv(ir_node *op, ir_mode *mode);
4081 /** Constructor for a strict Conv node.
4083 * Adds the node to the block in current_ir_block.
4085 * @param *op The operand.
4086 * @param *mode The mode of this the operand muss be converted.
4088 ir_node *new_strictConv(ir_node *op, ir_mode *mode);
4090 /** Constructor for a Cast node.
4092 * Adds the node to the block in current_ir_block.
4093 * High level type cast
4095 * @param *op The operand.
4096 * @param *to_tp The type of this the operand muss be casted .
4098 ir_node *new_Cast(ir_node *op, ir_type *to_tp);
4100 /** Constructor for a Carry node.
4102 * Adds the node to the block in current_ir_block.
4104 * @param *op1 The first operand.
4105 * @param *op2 The second operand.
4106 * @param *mode The mode of the operands and the result.
4108 ir_node *new_Carry(ir_node *op1, ir_node *op2, ir_mode *mode);
4110 /** Constructor for a Borrow node.
4112 * Adds the node to the block in current_ir_block.
4114 * @param *op1 The first operand.
4115 * @param *op2 The second operand.
4116 * @param *mode The mode of the operands and the result.
4118 ir_node *new_Borrow(ir_node *op1, ir_node *op2, ir_mode *mode);
4120 /** Constructor for a Phi node.
4122 * Adds the node to the block in current_ir_block.
4124 * @param arity The number of predecessors.
4125 * @param *in Array with predecessors.
4126 * @param *mode The mode of it's inputs and output.
4128 ir_node *new_Phi(int arity, ir_node *in[], ir_mode *mode);
4130 /** Constructor for a Load node.
4132 * @param *store The current memory.
4133 * @param *addr A pointer to the variable to be read in this memory.
4134 * @param *mode The mode of the value to be loaded.
4135 * @param flags Additional flags for alignment, volatility and pin state.
4137 ir_node *new_Load(ir_node *store, ir_node *addr, ir_mode *mode, ir_cons_flags flags);
4139 /** Constructor for a Store node.
4141 * @param *store The current memory.
4142 * @param *addr A pointer to the variable to be read in this memory.
4143 * @param *val The value to write to this variable.
4144 * @param flags Additional flags for alignment, volatility and pin state.
4146 ir_node *new_Store(ir_node *store, ir_node *addr, ir_node *val, ir_cons_flags flags);
4148 /** Constructor for a Alloc node.
4150 * The Alloc node extends the memory by space for an entity of type alloc_type.
4151 * Adds the node to the block in current_ir_block.
4153 * @param *store The memory which shall contain the new variable.
4154 * @param *size The number of bytes to allocate.
4155 * @param *alloc_type The type of the allocated variable.
4156 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
4158 ir_node *new_Alloc(ir_node *store, ir_node *size, ir_type *alloc_type,
4159 ir_where_alloc where);
4161 /** Constructor for a Free node.
4163 * Frees the memory occupied by the entity pointed to by the pointer
4164 * arg. Type indicates the type of the entity the argument points to.
4165 * Adds the node to the block in current_ir_block.
4167 * @param *store The memory which shall contain the new variable.
4168 * @param *ptr The pointer to the object to free.
4169 * @param *size The number of objects of type free_type to free in a sequence.
4170 * @param *free_type The type of the freed variable.
4171 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
4173 ir_node *new_Free(ir_node *store, ir_node *ptr, ir_node *size,
4174 ir_type *free_type, ir_where_alloc where);
4176 /** Constructor for a Sync node.
4178 * Merges several memory values. The node assumes that a variable
4179 * either occurs only in one of the memories, or it contains the same
4180 * value in all memories where it occurs.
4181 * Adds the node to the block in current_ir_block.
4183 * @param arity The number of memories to synchronize.
4184 * @param **in An array of pointers to nodes that produce an output of type
4185 * memory. The constructor copies this array.
4187 ir_node *new_Sync(int arity, ir_node *in[]);
4189 /** Constructor for a Proj node.
4191 * Projects a single value out of a tuple. The parameter proj gives the
4192 * position of the value within the tuple.
4193 * Adds the node to the block in current_ir_block.
4195 * @param arg A node producing a tuple.
4196 * @param *mode The mode of the value to project.
4197 * @param proj The position of the value in the tuple.
4199 ir_node *new_Proj(ir_node *arg, ir_mode *mode, long proj);
4201 /** Constructor for a Filter node.
4203 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
4204 * Filter is a node with two views used to construct the interprocedural view.
4205 * In intraprocedural view its semantics are identical to the Proj node.
4206 * In interprocedural view the Filter performs the Phi operation on method
4207 * parameters or results. Other than a Phi a Filter node may not be removed
4208 * if it has only a single input.
4210 * The constructor builds the Filter in intraprocedural view.
4212 * @param *arg The tuple value to project from.
4213 * @param *mode The mode of the projected value.
4214 * @param proj The position in the tuple to project from.
4216 ir_node *new_Filter(ir_node *arg, ir_mode *mode, long proj);
4218 /** Constructor for a defaultProj node.
4220 * Represents the default control flow of a Switch-Cond node.
4221 * Adds the node to the block in current_ir_block.
4223 * @param arg A node producing a tuple.
4224 * @param max_proj The end position of the value in the tuple.
4226 ir_node *new_defaultProj(ir_node *arg, long max_proj);
4228 /** Constructor for a Tuple node.
4230 * This is an auxiliary node to replace a node that returns a tuple
4231 * without changing the corresponding Proj nodes.
4232 * Adds the node to the block in current_ir_block.
4234 * @param arity The number of tuple elements.
4235 * @param **in An array containing pointers to the nodes producing the tuple elements.
4237 ir_node *new_Tuple(int arity, ir_node *in[]);
4239 /** Constructor for an Id node.
4241 * This is an auxiliary node to replace a node that returns a single
4242 * value. Adds the node to the block in current_ir_block.
4244 * @param *val The operand to Id.
4245 * @param *mode The mode of *val.
4247 ir_node *new_Id(ir_node *val, ir_mode *mode);
4249 /** Constructor for a Bad node.
4251 * Returns the unique Bad node of the graph. The same as
4254 ir_node *new_Bad(void);
4256 /** Constructor for a Confirm node.
4258 * Specifies constraints for a value. To support dataflow analyses.
4259 * Adds the node to the block in current_ir_block.
4261 * Example: If the value never exceeds '100' this is expressed by placing a
4262 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
4264 * @param *val The value we express a constraint for
4265 * @param *bound The value to compare against. Must be a firm node, typically a constant.
4266 * @param cmp The compare operation.
4268 ir_node *new_Confirm(ir_node *val, ir_node *bound, pn_Cmp cmp);
4270 /** Constructor for an Unknown node.
4272 * Represents an arbitrary value. Places the node in
4275 * @param *m The mode of the unknown value.
4277 ir_node *new_Unknown(ir_mode *m);
4279 /** Constructor for a NoMem node.
4281 * Returns the unique NoMem node of the graph. The same as
4284 ir_node *new_NoMem(void);
4286 /** Constructor for a Mux node.
4288 * Adds the node to the block in current_ir_block.
4290 * @param *sel The ir_node that calculates the boolean select.
4291 * @param *ir_true The ir_node that calculates the true result.
4292 * @param *ir_false The ir_node that calculates the false result.
4293 * @param *mode The mode of the node (and it_true and ir_false).
4295 ir_node *new_Mux(ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
4297 /** Constructor for a CopyB node.
4299 * Adds the node to the block in current_ir_block.
4301 * @param *store The current memory
4302 * @param *dst The ir_node that represents the destination address.
4303 * @param *src The ir_node that represents the source address.
4304 * @param *data_type The type of the copied data
4306 ir_node *new_CopyB(ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
4308 /** Constructor for a InstOf node.
4310 * A High-Level Type check.
4312 * @param *store The memory in which the object the entity should be selected
4313 * from is allocated.
4314 * @param *objptr A pointer to a object of a class type.
4315 * @param *type The type of which objptr must be.
4317 ir_node *new_InstOf(ir_node *store, ir_node *objptr, ir_type *type);
4319 /**Constructor for a Raise node.
4321 * A High-Level Exception throw.
4323 * @param *store The current memory.
4324 * @param *obj A pointer to the Except variable.
4326 ir_node *new_Raise(ir_node *store, ir_node *obj);
4328 /** Constructor for a Bound node.
4330 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
4332 * Adds the node to the block in current_ir_block.
4334 * @param *store The current memory
4335 * @param *idx The ir_node that represents an index.
4336 * @param *lower The ir_node that represents the lower bound for the index.
4337 * @param *upper The ir_node that represents the upper bound for the index.
4339 ir_node *new_Bound(ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
4341 /** Constructor for a Pin node.
4343 * @param *node The node which value should be pinned.
4345 ir_node *new_Pin(ir_node *node);
4347 /** Constructor for an ASM pseudo node.
4349 * @param arity The number of data inputs to the node.
4350 * @param *in The array of length arity of data inputs.
4351 * @param *inputs The array of length arity of input constraints.
4352 * @param n_outs The number of data outputs to the node.
4353 * @param *outputs The array of length n_outs of output constraints.
4354 * @param n_clobber The number of clobbered registers.
4355 * @param *clobber The array of length n_clobber of clobbered registers.
4356 * @param *asm_text The assembler text.
4358 ir_node *new_ASM(int arity, ir_node *in[], ir_asm_constraint *inputs,
4359 int n_outs, ir_asm_constraint *outputs,
4360 int n_clobber, ident *clobber[], ident *asm_text);
4362 /** Constructor for a Dummy node.
4364 * @param *mode The mode of the node.
4366 ir_node *new_Dummy(ir_mode *mode);
4368 ir_node *new_r_Dummy(ir_graph *irg, ir_mode *mode);
4370 ir_node *new_rd_Dummy(dbg_info *db, ir_graph *irg, ir_mode *mode);
4372 /*---------------------------------------------------------------------*/
4373 /* The comfortable interface. */
4374 /* Supports automatic Phi node construction. */
4375 /* All routines of the block oriented interface except new_Block are */
4377 /*---------------------------------------------------------------------*/
4379 /** Create an immature Block.
4381 * An immature Block has an unknown number of predecessors. Predecessors
4382 * can be added with add_immBlock_pred(). Once all predecessors are
4383 * added the block must be matured.
4385 * Adds the block to the graph in current_ir_graph. Can be used with automatic
4386 * Phi node construction.
4387 * This constructor can only be used if the graph is in state_building.
4389 ir_node *new_d_immBlock(dbg_info *db);
4390 ir_node *new_immBlock(void);
4392 /** Create an immature PartBlock.
4394 * An immature block has only one Block or PartBlock predecessor.
4395 * A PartBlock forms together with one BLock and possibly other
4396 * PartBlocks a MacroBlock.
4398 * Adds the PartBlock to the graph in current_ir_graph. Does set
4399 * current_block. Can be used with automatic Phi node construction.
4400 * This constructor can only be used if the graph is in
4403 ir_node *new_d_immPartBlock(dbg_info *db, ir_node *pred_jmp);
4404 ir_node *new_immPartBlock(ir_node *pred_jmp);
4406 /** Add a control flow edge to an immature block. */
4407 void add_immBlock_pred(ir_node *immblock, ir_node *jmp);
4409 /** Finalize a Block node, when all control flows are known. */
4410 void mature_immBlock(ir_node *block);
4411 #define mature_cur_block() mature_immBlock(get_cur_block());
4414 /** Get the current value of a local variable.
4416 * Use this function to obtain the last definition of the local variable
4417 * associated with pos. Pos may not exceed the value passed as n_loc
4418 * to new_ir_graph. This call automatically inserts Phi nodes.
4420 * @param *db A pointer for debug information.
4421 * @param pos The position/id of the local variable.
4422 * @param *mode The mode of the value to get.
4424 ir_node *get_d_value(dbg_info *db, int pos, ir_mode *mode);
4425 ir_node *get_value(int pos, ir_mode *mode);
4427 /** Remark a new definition of a variable.
4429 * Use this function to remember a new definition of the value
4430 * associated with pos. Pos may not exceed the value passed as n_loc
4431 * to new_ir_graph. This call is needed to automatically inserts Phi
4434 * @param pos The position/id of the local variable.
4435 * @param *value The new value written to the local variable.
4437 void set_value(int pos, ir_node *value);
4439 /** Find the value number for a node in the current block.
4441 * This function searches all values in the current block for
4442 * a given value and returns its value number if it was found, else
4444 * Note that this does not mean that the value does not exists,
4445 * it's just not equal the node (for instance behind a Phi/Confirm ...)
4447 * @param *value The value to find.
4449 int find_value(ir_node *value);
4451 /** Get the current memory state.
4453 * Use this function to obtain the last definition of the memory
4454 * state. This call automatically inserts Phi nodes for the memory
4457 ir_node *get_store(void);
4459 /** Remark a new definition of the memory state.
4461 * Use this function to remember a new definition of the memory state.
4462 * This call is needed to automatically inserts Phi nodes.
4464 * @param *store The new memory state.
4466 void set_store(ir_node *store);
4468 /** keep this node alive even if End is not control-reachable from it
4470 * @param ka The node to keep alive.
4472 void keep_alive(ir_node *ka);
4474 /** Returns the frame type of the current graph */
4475 ir_type *get_cur_frame_type(void);
4478 /* --- initialize and finalize IR construction --- */
4480 /** Puts the graph into state "phase_high" */
4481 #define irg_finalize_cons(irg) set_irg_phase_state(irg, phase_high)
4483 /** Puts the program and all graphs into state phase_high.
4485 * This also remarks, the construction of types is finished,
4486 * e.g., that no more subtypes will be added. */
4487 void irp_finalize_cons(void);
4489 /* --- Initialization --- */