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 *count, 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 *count, 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 * *count This field is for allocating arrays, i.e., it gives the multiple
920 * of the size of alloc_type to allocate memory for.
921 * *alloc_type The type of the allocated variable.
922 * where Where to allocate the variable, either heap_alloc or stack_alloc.
925 * A memory and an unsigned integer.
927 * A tuple of the changed memory, a control flow to be taken in
928 * case of an exception and the pointer to the new variable.
930 * a.where Indicates where the variable is allocated.
931 * a.*type A pointer to the class the allocated data object
934 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size, ir_type *free_type,
935 * -----------------------------------------------------------------------------------
939 * The Free node frees memory of the given variable.
942 * *store The memory which shall contain the new variable.
943 * *ptr The pointer to the object to free.
944 * *size The number of objects of type free_type to free in a sequence.
945 * *free_type The type of the freed variable.
946 * where Where the variable was allocated, either heap_alloc or stack_alloc.
949 * A memory, a pointer and an unsigned integer.
951 * The changed memory.
953 * f.*type A pointer to the type information of the freed data object.
957 * ir_node *new_Sync (int arity, ir_node **in)
958 * -------------------------------------------
960 * The Sync operation unifies several partial memory blocks. These blocks
961 * have to be pairwise disjunct or the values in common locations have to
962 * be identical. This operation allows to specify all operations that eventually
963 * need several partial memory blocks as input with a single entrance by
964 * unifying the memories with a preceding Sync operation.
967 * arity The number of memories to synchronize.
968 * **in An array of pointers to nodes that produce an output of
973 * The unified memory.
979 * ir_node *new_Bad (void)
980 * -----------------------
982 * Returns the unique Bad node current_ir_graph->bad.
983 * This node is used to express results of dead code elimination.
985 * ir_node *new_NoMem (void)
986 * -----------------------------------------------------------------------------------
988 * Returns the unique NoMem node current_ir_graph->no_mem.
989 * This node is used as input for operations that need a Memory, but do not
990 * change it like Div by const != 0, analyzed calls etc.
992 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj)
993 * ----------------------------------------------------------
995 * Selects one entry of a tuple. This is a hidden edge with attributes.
998 * *arg A node producing a tuple.
999 * *mode The mode of the value to project.
1000 * proj The position of the value in the tuple.
1006 * ir_node *new_Tuple (int arity, ir_node **in)
1007 * --------------------------------------------
1009 * Builds a Tuple from single values. This is needed to implement
1010 * optimizations that remove a node that produced a tuple. The node can be
1011 * replaced by the Tuple operation so that the following Proj nodes have not to
1012 * be changed. (They are hard to find due to the implementation with pointers
1013 * in only one direction.) The Tuple node is smaller than any other
1014 * node, so that a node can be changed into a Tuple by just changing it's
1015 * opcode and giving it a new in array.
1018 * arity The number of tuple elements.
1019 * **in An array containing pointers to the nodes producing the
1022 * ir_node *new_Id (ir_node *val, ir_mode *mode)
1023 * ---------------------------------------------
1025 * The single output of the Id operation is it's input. Also needed
1026 * for optimizations.
1029 * HIGH LEVEL OPERATIONS
1030 * ---------------------
1032 * ir_node *new_CopyB (ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type)
1033 * -----------------------------------------------------------------------------------
1035 * Describes a high level block copy of a compound type from address src to
1036 * address dst. Must be lowered to a Call to a runtime memory copy function.
1039 * HIGH LEVEL OPERATIONS: Exception Support
1040 * ----------------------------------------
1041 * See TechReport 1999-14, chapter Exceptions.
1043 * ir_node *new_InstOf(ir_node *store, ir_node *ptr, ir_type *type);
1044 * -----------------------------------------------------------------------------------
1046 * Describes a high level type check. Must be lowered to a Call to a runtime check
1049 * ir_node *new_Raise (ir_node *store, ir_node *obj)
1050 * -------------------------------------------------
1052 * Raises an exception. Unconditional change of control flow. Writes
1053 * an explicit Except variable to memory to pass it to the exception
1054 * handler. Must be lowered to a Call to a runtime check
1059 * A pointer to the Except variable.
1061 * A tuple of control flow and the changed memory state. The control flow
1062 * points to the exception handler if it is definied in this procedure,
1063 * else it points to the end_block.
1065 * ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
1066 * -----------------------------------------------------------------------------------
1068 * Describes a high level bounds check. Must be lowered to a Call to a runtime check
1071 * ir_node *new_Pin (ir_node *node);
1072 * -----------------------------------------------------------------------------------
1074 * Pin the value of the node node in the current block No users of the Pin node can
1075 * float above the Block of the Pin. The node cannot float behind this block. Often
1076 * used to Pin the NoMem node.
1079 * COPING WITH DATA OBJECTS
1080 * ========================
1082 * Two kinds of data objects have to be distinguished for generating
1083 * FIRM. First there are local variables other than arrays that are
1084 * known to be alias free. Second there are all other data objects.
1085 * For the first a common SSA representation is built, the second
1086 * are modeled by saving them to memory. The memory is treated as
1087 * a single local variable, the alias problem is hidden in the
1088 * content of this variable.
1090 * All values known in a Block are listed in the block's attribute,
1091 * block.**graph_arr which is used to automatically insert Phi nodes.
1092 * The following two functions can be used to add a newly computed value
1093 * to the array, or to get the producer of a value, i.e., the current
1096 * inline void set_value (int pos, ir_node *value)
1097 * -----------------------------------------------
1099 * Has to be called for every assignment to a local variable. It
1100 * adds the value to the array of used values at position pos. Pos
1101 * has to be a unique identifier for an entry in the procedure's
1102 * definition table. It can be used to access the value again.
1103 * Requires current_block to be set correctly.
1105 * ir_node *get_value (int pos, ir_mode *mode)
1106 * -------------------------------------------
1108 * Returns the node defining the value referred to by pos. If the
1109 * value is not defined in this block a Phi node is generated and
1110 * all definitions reaching this Phi node are collected. It can
1111 * happen that the algorithm allocates an unnecessary Phi node,
1112 * e.g. if there is only one definition of this value, but this
1113 * definition reaches the currend block on several different
1114 * paths. This Phi node will be eliminated if optimizations are
1115 * turned on right after it's creation.
1116 * Requires current_block to be set correctly.
1118 * There are two special routines for the global store:
1120 * void set_store (ir_node *store)
1121 * -------------------------------
1123 * Adds the store to the array of known values at a reserved
1125 * Requires current_block to be set correctly.
1127 * ir_node *get_store (void)
1128 * -------------------------
1130 * Returns the node defining the actual store.
1131 * Requires current_block to be set correctly.
1134 * inline void keep_alive (ir_node *ka)
1135 * ------------------------------------
1137 * Keep this node alive because it is (might be) not in the control
1138 * flow from Start to End. Adds the node to the list in the end
1142 #ifndef FIRM_IR_IRCONS_H
1143 #define FIRM_IR_IRCONS_H
1145 #include "firm_types.h"
1148 * constrained flags for memory operations.
1150 typedef enum ir_cons_flags {
1151 cons_none = 0, /**< No constrains. */
1152 cons_volatile = 1U << 0, /**< Memory operation is volatile. */
1153 cons_unaligned = 1U << 1, /**< Memory operation is unaligned. */
1154 cons_floats = 1U << 2 /**< Memory operation can float. */
1157 /*-------------------------------------------------------------------------*/
1158 /* The raw interface */
1159 /*-------------------------------------------------------------------------*/
1161 /** Constructor for a Block node.
1163 * Constructs a mature block with the given predecessors. Use Unknown
1164 * nodes as predecessors to construct a block if the number of
1165 * predecessors is known, but not the predecessors themselves. This
1166 * constructor does not set current_block. It not be used with
1167 * automatic Phi node construction.
1169 * @param *db A Pointer for debug information.
1170 * @param irg The IR graph the block belongs to.
1171 * @param arity The number of control predecessors.
1172 * @param in[] An array of control predecessors. The length of
1173 * the array must be 'arity'. The constructor copies this array.
1175 ir_node *new_rd_Block(dbg_info *db, ir_graph *irg, int arity, ir_node *in[]);
1177 /** Constructor for a Start node.
1179 * @param *db A pointer for debug information.
1180 * @param *irg The IR graph the node belongs to.
1181 * @param *block The IR block the node belongs to.
1183 ir_node *new_rd_Start(dbg_info *db, ir_graph *irg, ir_node *block);
1185 /** Constructor for a End node.
1187 * @param *db A pointer for debug information.
1188 * @param *irg The IR graph the node belongs to.
1189 * @param *block The IR block the node belongs to.
1191 ir_node *new_rd_End(dbg_info *db, ir_graph *irg, ir_node *block);
1193 /** Constructor for a Jmp node.
1195 * Jmp represents control flow to a single control successor.
1197 * @param *db A pointer for debug information.
1198 * @param *block The IR block the node belongs to.
1200 ir_node *new_rd_Jmp(dbg_info *db, ir_node *block);
1202 /** Constructor for an IJmp node.
1204 * IJmp represents control flow to a single control successor not
1205 * statically known i.e. an indirect Jmp.
1207 * @param *db A pointer for debug information.
1208 * @param *block The IR block the node belongs to.
1209 * @param *tgt The IR node representing the target address.
1211 ir_node *new_rd_IJmp(dbg_info *db, ir_node *block, ir_node *tgt);
1213 /** Constructor for a Break node.
1215 * Break represents control flow to a single control successor just as Jmp.
1216 * The blocks separated by a break may not be concatenated by an optimization.
1217 * It is used for the interprocedural representation where blocks are parted
1218 * behind Call nodes to represent the control flow to called procedures.
1220 * @param *db A pointer for debug information.
1221 * @param *block The block the node belong to.
1223 ir_node *new_rd_Break(dbg_info *db, ir_node *block);
1225 /** Constructor for a Cond node.
1227 * If c is mode_b represents a conditional branch (if/else). If c is
1228 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
1229 * node, default Proj is 0.)
1231 * This is not consistent: Input to Cond is Is, Proj has as proj number
1234 * @param *db A pointer for debug information.
1235 * @param *block The IR block the node belongs to.
1236 * @param *c The conditions parameter. Can be of mode b or I_u.
1238 ir_node *new_rd_Cond(dbg_info *db, ir_node *block, ir_node *c);
1240 /** Constructor for a Return node.
1242 * Returns the memory and zero or more return values. Only node that
1243 * can end regular control flow.
1245 * @param *db A pointer for debug information.
1246 * @param *block The IR block the node belongs to.
1247 * @param *store The state of memory.
1248 * @param arity Number of return values.
1249 * @param *in Array of length arity with return values. The constructor copies this array.
1251 ir_node *new_rd_Return(dbg_info *db, ir_node *block,
1252 ir_node *store, int arity, ir_node *in[]);
1254 /** Constructor for a Const_type node.
1256 * Adds the node to the start block.
1258 * The constant represents a target value. This constructor sets high
1259 * level type information for the constant value.
1260 * Derives mode from passed tarval.
1262 * @param *db A pointer for debug information.
1263 * @param *irg The IR graph the node belongs to.
1264 * @param *con Points to an entry in the constant table.
1265 * @param *tp The type of the constant.
1267 ir_node *new_rd_Const_type(dbg_info *db, ir_graph *irg,
1268 tarval *con, ir_type *tp);
1270 /** Constructor for a Const node.
1272 * Adds the node to the start block.
1274 * Constructor for a Const node. The constant represents a target
1275 * value. Sets the type information to type_unknown. (No more
1276 * supported: If tv is entity derives a somehow useful type.)
1277 * Derives mode from passed tarval.
1279 * @param *db A pointer for debug information.
1280 * @param *irg The IR graph the node belongs to.
1281 * @param *con Points to an entry in the constant table.
1283 ir_node *new_rd_Const(dbg_info *db, ir_graph *irg, tarval *con);
1285 /** Constructor for a Const node.
1287 * Adds the node to the start block.
1289 * Constructor for a Const node. The constant represents a target
1290 * value. Sets the type information to type_unknown. (No more
1291 * supported: If tv is entity derives a somehow useful type.)
1293 * @param *db A pointer for debug information.
1294 * @param *irg The IR graph the node belongs to.
1295 * @param *mode The mode of the operands and results.
1296 * @param value A value from which the tarval is made.
1298 ir_node *new_rd_Const_long(dbg_info *db, ir_graph *irg,
1299 ir_mode *mode, long value);
1301 /** Constructor for a SymConst_type node.
1303 * This is the constructor for a symbolic constant.
1304 * There are four kinds of symbolic constants:
1305 * - type_tag The symbolic constant represents a type tag. The type the
1306 * tag stands for is given explicitly.
1307 * - type_size The symbolic constant represents the size of a type. The
1308 * type of which the constant represents the size is given
1310 * - type_align The symbolic constant represents the alignment of a type. The
1311 * type of which the constant represents the size is given
1313 * - addr_name The symbolic constant represents the address of an entity
1314 * (variable or method). The variable is indicated by a name
1315 * that is valid for linking.
1316 * - addr_ent The symbolic constant represents the address of an entity
1317 * (variable or method). The variable is given explicitly by
1320 * Inputs to the node:
1321 * No inputs except the block it belongs to.
1322 * Outputs of the node.
1323 * An unsigned integer (I_u) or a pointer (P).
1325 * Mention union in declaration so that the firmjni generator recognizes that
1326 * it can not cast the argument to an int.
1328 * @param *db A pointer for debug information.
1329 * @param *irg The IR graph the node belongs to.
1330 * @param mode The mode for the SymConst.
1331 * @param symkind The kind of the symbolic constant: type_tag, size, addr_name or addr_ent.
1332 * @param value A type, entity or a ident depending on the SymConst kind.
1333 * @param tp The source type of the constant.
1335 ir_node *new_rd_SymConst_type(dbg_info *db, ir_graph *irg, ir_mode *mode,
1336 union symconst_symbol value,
1337 symconst_kind symkind, ir_type *tp);
1339 /** Constructor for a SymConst node.
1341 * Same as new_rd_SymConst_type, except that it sets the type to type_unknown.
1343 ir_node *new_rd_SymConst(dbg_info *db, ir_graph *irg, ir_mode *mode,
1344 union symconst_symbol value, symconst_kind symkind);
1346 /** Constructor for a SymConst addr_ent node.
1348 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1349 * symconst_addr_ent.
1350 * Adds the SymConst to the start block of irg. */
1351 ir_node *new_rd_SymConst_addr_ent(dbg_info *db, ir_graph *irg, ir_mode *mode,
1352 ir_entity *symbol, ir_type *tp);
1354 /** Constructor for a SymConst ofs_ent node.
1356 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1358 * Adds the SymConst to the start block of irg.
1360 ir_node *new_rd_SymConst_ofs_ent(dbg_info *db, ir_graph *irg, ir_mode *mode,
1361 ir_entity *symbol, ir_type *tp);
1363 /** Constructor for a SymConst addr_name node.
1365 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1366 * symconst_addr_ent.
1367 * Adds the SymConst to the start block of irg.
1369 ir_node *new_rd_SymConst_addr_name(dbg_info *db, ir_graph *irg, ir_mode *mode,
1370 ident *symbol, ir_type *tp);
1372 /** Constructor for a SymConst type_tag node.
1374 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1375 * symconst_addr_ent.
1376 * Adds the SymConst to the start block of irg.
1378 ir_node *new_rd_SymConst_type_tag(dbg_info *db, ir_graph *irg, ir_mode *mode,
1379 ir_type *symbol, ir_type *tp);
1381 /** Constructor for a SymConst size node.
1383 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1384 * symconst_type_size.
1385 * Adds the SymConst to the start block of irg. */
1386 ir_node *new_rd_SymConst_size(dbg_info *db, ir_graph *irg, ir_mode *mode,
1387 ir_type *symbol, ir_type *tp);
1389 /** Constructor for a SymConst size node.
1391 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1392 * symconst_type_align.
1393 * Adds the SymConst to the start block of irg.
1395 ir_node *new_rd_SymConst_align(dbg_info *db, ir_graph *irg, ir_mode *mode,
1396 ir_type *symbol, ir_type *tp);
1398 /** Constructor for a simpleSel node.
1400 * This is a shortcut for the new_rd_Sel() constructor. To be used for
1401 * Sel nodes that do not select from an array, i.e., have no index
1402 * inputs. It adds the two parameters 0, NULL.
1404 * @param *db A pointer for debug information.
1405 * @param *block The IR block the node belongs to.
1406 * @param *store The memory in which the object the entity should be
1407 * selected from is allocated.
1408 * @param *objptr The object from that the Sel operation selects a
1409 * single attribute out.
1410 * @param *ent The entity to select.
1412 ir_node *new_rd_simpleSel(dbg_info *db, ir_node *block,
1413 ir_node *store, ir_node *objptr, ir_entity *ent);
1415 /** Constructor for a Sel node.
1417 * The select node selects an entity (field or method) from an entity
1418 * with a compound type. It explicitly specifies the entity selected.
1419 * Dynamically the node may select entities that overwrite the given
1420 * entity. If the selected entity is an array element entity the Sel
1421 * node takes the required array indices as inputs.
1423 * @param *db A pointer for debug information.
1424 * @param *block The IR block the node belongs to.
1425 * @param *store The memory in which the object the entity should be selected
1426 * from is allocated.
1427 * @param *objptr A pointer to a compound entity the Sel operation selects a
1428 * single attribute from.
1429 * @param *n_index The number of array indices needed to select an array element entity.
1430 * @param *index[] If the compound entity is an array the indices of the selected
1431 * element entity. The constructor copies this array.
1432 * @param *ent The entity to select.
1434 ir_node *new_rd_Sel(dbg_info *db, ir_node *block, ir_node *store,
1435 ir_node *objptr, int n_index, ir_node *index[], ir_entity *ent);
1437 /** Constructor for a Call node.
1439 * Represents all kinds of method and function calls.
1441 * @param *db A pointer for debug information.
1442 * @param *block The IR block the node belongs to.
1443 * @param *store The current memory state.
1444 * @param *callee A pointer to the called procedure.
1445 * @param arity The number of procedure parameters.
1446 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1447 * @param *tp Type information of the procedure called.
1449 ir_node *new_rd_Call(dbg_info *db, ir_node *block, ir_node *store,
1450 ir_node *callee, int arity, ir_node *in[], ir_type *tp);
1452 /** Constructor for a Builtin node.
1454 * Represents a call of a backend-specific builtin..
1456 * @param *db A pointer for debug information.
1457 * @param *block The IR block the node belongs to.
1458 * @param *store The current memory state.
1459 * @param arity The number of procedure parameters.
1460 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1461 * @param kind The kind of the called builtin.
1462 * @param *tp Type information of the procedure called.
1464 ir_node *new_rd_Builtin(dbg_info *db, ir_node *block, ir_node *store,
1465 int arity, ir_node *in[], ir_builtin_kind kind, ir_type *tp);
1467 /** Constructor for a Add node.
1469 * @param *db A pointer for debug information.
1470 * @param *block The IR block the node belongs to.
1471 * @param *op1 The first operand.
1472 * @param *op2 The second operand.
1473 * @param *mode The mode of the operands and the result.
1475 ir_node *new_rd_Add(dbg_info *db, ir_node *block,
1476 ir_node *op1, ir_node *op2, ir_mode *mode);
1478 /** Constructor for a Sub node.
1480 * @param *db A pointer for debug information.
1481 * @param *block The IR block the node belongs to.
1482 * @param *op1 The first operand.
1483 * @param *op2 The second operand.
1484 * @param *mode The mode of the operands and the result.
1486 ir_node *new_rd_Sub(dbg_info *db, ir_node *block,
1487 ir_node *op1, ir_node *op2, ir_mode *mode);
1489 /** Constructor for a Minus node.
1491 * @param *db A pointer for debug information.
1492 * @param *block The IR block the node belongs to.
1493 * @param *op The operand .
1494 * @param *mode The mode of the operand and the result.
1496 ir_node *new_rd_Minus(dbg_info *db, ir_node *block,
1497 ir_node *op, ir_mode *mode);
1499 /** Constructor for a Mul node.
1501 * @param *db A pointer for debug information.
1502 * @param *block The IR block the node belongs to.
1503 * @param *op1 The first operand.
1504 * @param *op2 The second operand.
1505 * @param *mode The mode of the operands and the result.
1507 ir_node *new_rd_Mul(dbg_info *db, ir_node *block,
1508 ir_node *op1, ir_node *op2, ir_mode *mode);
1510 /** Constructor for a Mulh node.
1512 * @param *db A pointer for debug information.
1513 * @param *block The IR block the node belongs to.
1514 * @param *op1 The first operand.
1515 * @param *op2 The second operand.
1516 * @param *mode The mode of the operands and the result.
1518 ir_node *new_rd_Mulh(dbg_info *db, ir_node *block,
1519 ir_node *op1, ir_node *op2, ir_mode *mode);
1521 /** Constructor for a Quot node.
1523 * @param *db A pointer for debug information.
1524 * @param *block The IR block the node belongs to.
1525 * @param *memop The store needed to model exceptions
1526 * @param *op1 The first operand.
1527 * @param *op2 The second operand.
1528 * @param *mode The mode of the result.
1529 * @param state The pinned state.
1531 ir_node *new_rd_Quot(dbg_info *db, ir_node *block, ir_node *memop,
1532 ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1534 /** Constructor for a DivMod node.
1536 * @param *db A pointer for debug information.
1537 * @param *block The IR block the node belongs to.
1538 * @param *memop The store needed to model exceptions
1539 * @param *op1 The first operand.
1540 * @param *op2 The second operand.
1541 * @param *mode The mode of the results.
1542 * @param state The pinned state.
1544 ir_node *new_rd_DivMod(dbg_info *db, ir_node *block, ir_node *memop,
1545 ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1547 /** Constructor for a Div node.
1549 * @param *db A pointer for debug information.
1550 * @param *block The IR block the node belongs to.
1551 * @param *memop The store needed to model exceptions
1552 * @param *op1 The first operand.
1553 * @param *op2 The second operand.
1554 * @param *mode The mode of the result.
1555 * @param state The pinned state.
1557 ir_node *new_rd_Div(dbg_info *db, ir_node *block, ir_node *memop,
1558 ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1560 /** Constructor for a remainderless Div node.
1562 * @param *db A pointer for debug information.
1563 * @param *block The IR block the node belongs to.
1564 * @param *memop The store needed to model exceptions
1565 * @param *op1 The first operand.
1566 * @param *op2 The second operand.
1567 * @param *mode The mode of the result.
1568 * @param state The pinned state.
1570 ir_node *new_rd_DivRL(dbg_info *db, ir_node *block, ir_node *memop,
1571 ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1573 /** Constructor for a Mod node.
1575 * @param *db A pointer for debug information.
1576 * @param *block The IR block the node belongs to.
1577 * @param *memop The store needed to model exceptions
1578 * @param *op1 The first operand.
1579 * @param *op2 The second operand.
1580 * @param *mode The mode of the result.
1581 * @param state The pinned state.
1583 ir_node *new_rd_Mod(dbg_info *db, ir_node *block, ir_node *memop,
1584 ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1586 /** Constructor for a Abs node.
1588 * @param *db A pointer for debug information.
1589 * @param *block The IR block the node belongs to.
1590 * @param *op The operand
1591 * @param *mode The mode of the operands and the result.
1593 ir_node *new_rd_Abs(dbg_info *db, ir_node *block, ir_node *op, ir_mode *mode);
1595 /** Constructor for a And node.
1597 * @param *db A pointer for debug information.
1598 * @param *block The IR block the node belongs to.
1599 * @param *op1 The first operand.
1600 * @param *op2 The second operand.
1601 * @param *mode The mode of the operands and the result.
1603 ir_node *new_rd_And(dbg_info *db, ir_node *block,
1604 ir_node *op1, ir_node *op2, ir_mode *mode);
1606 /** Constructor for a Or node.
1608 * @param *db A pointer for debug information.
1609 * @param *block The IR block the node belongs to.
1610 * @param *op1 The first operand.
1611 * @param *op2 The second operand.
1612 * @param *mode The mode of the operands and the result.
1614 ir_node *new_rd_Or(dbg_info *db, ir_node *block,
1615 ir_node *op1, ir_node *op2, ir_mode *mode);
1617 /** Constructor for a Eor node.
1619 * @param *db A pointer for debug information.
1620 * @param *block The IR block the node belongs to.
1621 * @param *op1 The first operand.
1622 * @param *op2 The second operand.
1623 * @param *mode The mode of the operands and the results.
1625 ir_node *new_rd_Eor(dbg_info *db, ir_node *block,
1626 ir_node *op1, ir_node *op2, ir_mode *mode);
1628 /** Constructor for a Not node.
1630 * @param *db A pointer for debug information.
1631 * @param *block The IR block the node belongs to.
1632 * @param *op The operand.
1633 * @param *mode The mode of the operand and the result.
1635 ir_node *new_rd_Not(dbg_info *db, ir_node *block, ir_node *op, ir_mode *mode);
1637 /** Constructor for a Cmp node.
1639 * @param *db A pointer for debug information.
1640 * @param *block The IR block the node belongs to.
1641 * @param *op1 The first operand.
1642 * @param *op2 The second operand.
1644 ir_node *new_rd_Cmp(dbg_info *db, ir_node *block, ir_node *op1, ir_node *op2);
1646 /** Constructor for a Shl node.
1648 * @param *db A pointer for debug information.
1649 * @param *block The IR block the node belongs to.
1650 * @param *op The operand.
1651 * @param *k The number of bits to shift the operand .
1652 * @param *mode The mode of the operand and the result.
1654 ir_node *new_rd_Shl(dbg_info *db, ir_node *block,
1655 ir_node *op, ir_node *k, ir_mode *mode);
1657 /** Constructor for a Shr node.
1659 * @param *db A pointer for debug information.
1660 * @param *block The IR block the node belongs to.
1661 * @param *op The operand.
1662 * @param *k The number of bits to shift the operand .
1663 * @param *mode The mode of the operand and the result.
1665 ir_node *new_rd_Shr(dbg_info *db, ir_node *block,
1666 ir_node *op, ir_node *k, ir_mode *mode);
1668 /** Constructor for a Shrs node.
1670 * @param *db A pointer for debug information.
1671 * @param *block The IR block the node belongs to.
1672 * @param *op The operand.
1673 * @param *k The number of bits to shift the operand.
1674 * @param *mode The mode of the operand and the result.
1676 ir_node *new_rd_Shrs(dbg_info *db, ir_node *block,
1677 ir_node *op, ir_node *k, ir_mode *mode);
1679 /** Constructor for a Rotl node.
1681 * @param *db A pointer for debug information.
1682 * @param *block The IR block the node belongs to.
1683 * @param *op The operand.
1684 * @param *k The number of bits to rotate the operand.
1685 * @param *mode The mode of the operand.
1687 ir_node *new_rd_Rotl(dbg_info *db, ir_node *block,
1688 ir_node *op, ir_node *k, ir_mode *mode);
1691 /** Constructor for a Conv node.
1693 * @param *db A pointer for debug information.
1694 * @param *block The IR block the node belongs to.
1695 * @param *op The operand.
1696 * @param *mode The mode of this the operand muss be converted .
1698 ir_node *new_rd_Conv(dbg_info *db, ir_node *block, ir_node *op, ir_mode *mode);
1700 /** Constructor for a strictConv node.
1702 * @param *db A pointer for debug information.
1703 * @param *block The IR block the node belongs to.
1704 * @param *op The operand.
1705 * @param *mode The mode of this the operand muss be converted .
1707 ir_node *new_rd_strictConv(dbg_info *db, ir_node *block,
1708 ir_node *op, ir_mode *mode);
1710 /** Constructor for a Cast node.
1712 * High level type cast.
1714 * @param *db A pointer for debug information.
1715 * @param *block The IR block the node belongs to.
1716 * @param *op The operand.
1717 * @param *to_tp The type of this the operand muss be casted .
1719 ir_node *new_rd_Cast(dbg_info *db, ir_node *block,
1720 ir_node *op, ir_type *to_tp);
1722 /** Constructor for a Carry node.
1724 * @param *db A pointer for debug information.
1725 * @param *block The IR block the node belongs to.
1726 * @param *op1 The first operand.
1727 * @param *op2 The second operand.
1728 * @param *mode The mode of the operands and the result.
1730 ir_node *new_rd_Carry(dbg_info *db, ir_node *block,
1731 ir_node *op1, ir_node *op2, ir_mode *mode);
1733 /** Constructor for a Borrow node.
1735 * @param *db A pointer for debug information.
1736 * @param *block The IR block the node belongs to.
1737 * @param *op1 The first operand.
1738 * @param *op2 The second operand.
1739 * @param *mode The mode of the operands and the result.
1741 ir_node *new_rd_Borrow(dbg_info *db, ir_node *block,
1742 ir_node *op1, ir_node *op2, ir_mode *mode);
1744 /** Constructor for a Phi node.
1746 * @param *db A pointer for debug information.
1747 * @param *block The IR block the node belongs to.
1748 * @param arity The number of predecessors
1749 * @param *in[] Array with predecessors. The constructor copies this array.
1750 * @param *mode The mode of it's inputs and output.
1752 ir_node *new_rd_Phi(dbg_info *db, ir_node *block, int arity,
1753 ir_node *in[], ir_mode *mode);
1755 /** Constructor for a Load node.
1757 * @param *db A pointer for debug information.
1758 * @param *block The IR block the node belongs to.
1759 * @param *store The current memory
1760 * @param *adr A pointer to the variable to be read in this memory.
1761 * @param *mode The mode of the value to be loaded.
1762 * @param flags Additional flags for alignment, volatility and pin state.
1764 ir_node *new_rd_Load(dbg_info *db, ir_node *block, ir_node *store,
1765 ir_node *adr, ir_mode *mode, ir_cons_flags flags);
1767 /** Constructor for a Store node.
1769 * @param *db A pointer for debug information.
1770 * @param *block The IR block the node belongs to.
1771 * @param *store The current memory
1772 * @param *adr A pointer to the variable to be read in this memory.
1773 * @param *val The value to write to this variable.
1774 * @param flags Additional flags for alignment, volatility and pin state.
1776 ir_node *new_rd_Store(dbg_info *db, ir_node *block, ir_node *store,
1777 ir_node *adr, ir_node *val, ir_cons_flags flags);
1779 /** Constructor for a Alloc node.
1781 * The Alloc node extends the memory by space for an entity of type alloc_type.
1783 * @param *db A pointer for debug information.
1784 * @param *block The IR block the node belongs to.
1785 * @param *store The memory which shall contain the new variable.
1786 * @param *count The number of objects to allocate.
1787 * @param *alloc_type The type of the allocated variable.
1788 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
1790 ir_node *new_rd_Alloc(dbg_info *db, ir_node *block, ir_node *store,
1791 ir_node *count, ir_type *alloc_type, ir_where_alloc where);
1793 /** Constructor for a Free node.
1795 * Frees the memory occupied by the entity pointed to by the pointer
1796 * arg. Type indicates the type of the entity the argument points to.
1798 * @param *db A pointer for debug information.
1799 * @param *block The IR block the node belongs to.
1800 * @param *store The memory which shall contain the new variable.
1801 * @param *ptr The pointer to the object to free.
1802 * @param *size The number of objects of type free_type to free in a sequence.
1803 * @param *free_type The type of the freed variable.
1804 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
1806 ir_node *new_rd_Free(dbg_info *db, ir_node *block, ir_node *store,
1807 ir_node *ptr, ir_node *size, ir_type *free_type, ir_where_alloc where);
1809 /** Constructor for a Sync node.
1811 * Merges several memory values. The node assumes that a variable
1812 * either occurs only in one of the memories, or it contains the same
1813 * value in all memories where it occurs.
1815 * @param *db A pointer for debug information.
1816 * @param *block The IR block the node belongs to.
1817 * @param arity The number of memories to synchronize.
1818 * @param *in[] An array of pointers to nodes that produce an output of type
1819 * memory. The constructor copies this array.
1821 ir_node *new_rd_Sync(dbg_info *db, ir_node *block, int arity, ir_node *in[]);
1823 /** Constructor for a Proj node.
1825 * Projects a single value out of a tuple. The parameter proj gives the
1826 * position of the value within the tuple.
1828 * @param *db A pointer for debug information.
1829 * @param *block The IR block the node belongs to.
1830 * @param arg A node producing a tuple. The node must have mode_T.
1831 * @param *mode The mode of the value to project.
1832 * @param proj The position of the value in the tuple.
1834 ir_node *new_rd_Proj(dbg_info *db, ir_node *block, ir_node *arg,
1835 ir_mode *mode, long proj);
1837 /** Constructor for a defaultProj node.
1839 * Represents the default control flow of a Switch-Cond node.
1841 * @param *db A pointer for debug information.
1842 * @param *block The IR block the node belongs to.
1843 * @param arg A node producing a tuple.
1844 * @param max_proj The end position of the value in the tuple.
1846 ir_node *new_rd_defaultProj(dbg_info *db, ir_node *block,
1847 ir_node *arg, long max_proj);
1849 /** Constructor for a Tuple node.
1851 * This is an auxiliary node to replace a node that returns a tuple
1852 * without changing the corresponding Proj nodes.
1854 * @param *db A pointer for debug information.
1855 * @param *block The IR block the node belongs to.
1856 * @param arity The number of tuple elements.
1857 * @param *in[] An array containing pointers to the nodes producing the tuple
1858 * elements. The constructor copies this array.
1860 ir_node *new_rd_Tuple(dbg_info *db, ir_node *block,
1861 int arity, ir_node *in[]);
1863 /** Constructor for a Id node.
1865 * This is an auxiliary node to replace a node that returns a single
1868 * @param *db A pointer for debug information.
1869 * @param *block The IR block the node belongs to.
1870 * @param *val The value
1871 * @param *mode The mode of *val.
1873 ir_node *new_rd_Id(dbg_info *db, ir_node *block,
1874 ir_node *val, ir_mode *mode);
1876 /** Constructor for a Confirm node.
1878 * Specifies constraints for a value. To support dataflow analyses.
1880 * Example: If the value never exceeds '100' this is expressed by placing a
1881 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
1883 * @param *db A pointer for debug information.
1884 * @param *block The IR block the node belong to.
1885 * @param *val The value we express a constraint for
1886 * @param *bound The value to compare against. Must be a firm node, typically a constant.
1887 * @param cmp The compare operation.
1889 ir_node *new_rd_Confirm(dbg_info *db, ir_node *block,
1890 ir_node *val, ir_node *bound, pn_Cmp cmp);
1892 /** Constructor for an Unknown node.
1894 * Represents an arbitrary value. Places the node in the start block.
1896 * @param *db A pointer for debug information.
1897 * @param *irg The IR graph the node belongs to.
1898 * @param *m The mode of the unknown value.
1900 ir_node *new_rd_Unknown(dbg_info *db, ir_graph *irg, ir_mode *m);
1902 /** Constructor for a CallBegin node.
1904 * CallBegin represents control flow depending of the pointer value
1905 * representing the called method to the called methods. The
1906 * constructor copies the method pointer input from the passed Call
1909 * @param *db A pointer for debug information.
1910 * @param *block The block the node belong to.
1911 * @param *callee The call node visible in the intra procedural view.
1913 ir_node *new_rd_CallBegin(dbg_info *db, ir_node *block, ir_node *ptr, ir_node *call);
1915 /** Constructor for a EndReg node.
1917 * Used to represent regular procedure end in interprocedual view.
1919 * @param *db A pointer for debug information.
1920 * @param *irg The IR graph the node belong to.
1921 * @param *block The block the node belong to.
1923 ir_node *new_rd_EndReg(dbg_info *db, ir_graph *irg, ir_node *block);
1925 /** Constructor for a EndExcept node.
1927 * Used to represent exceptional procedure end in interprocedural view.
1929 * @param *db A pointer for debug information.
1930 * @param *irg The IR graph the node belong to.
1931 * @param *block The block the node belong to.
1933 ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
1935 /** Constructor for a Filter node.
1937 * Adds the node to the block in current_ir_block. Filter is a node
1938 * with two views used to construct the interprocedural view. In
1939 * intraprocedural view its semantics are identical to the Proj node.
1940 * In interprocedural view the Filter performs the Phi operation on
1941 * method parameters or results. Other than a Phi a Filter node may
1942 * not be removed if it has only a single input.
1944 * The constructor builds the Filter in intraprocedural view.
1946 * @param *db A pointer for debug information.
1947 * @param *block The block the node belong to.
1948 * @param *arg The tuple value to project from.
1949 * @param *mode The mode of the projected value.
1950 * @param proj The position in the tuple to project from.
1952 ir_node *new_rd_Filter(dbg_info *db,ir_node *block, ir_node *arg,
1953 ir_mode *mode, long proj);
1955 /** Constructor for a Mux node.
1957 * @param *db A pointer for debug information.
1958 * @param *block The block the node belong to.
1959 * @param *sel The ir_node that calculates the boolean select.
1960 * @param *ir_true The ir_node that calculates the true result.
1961 * @param *ir_false The ir_node that calculates the false result.
1962 * @param *mode The mode of the node (and it_true and ir_false).
1964 ir_node *new_rd_Mux(dbg_info *db, ir_node *block, ir_node *sel,
1965 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
1967 /** Constructor for a CopyB node.
1969 * @param *db A pointer for debug information.
1970 * @param *block The block the node belong to.
1971 * @param *store The current memory
1972 * @param *dst The ir_node that represents the destination address.
1973 * @param *src The ir_node that represents the source address.
1974 * @param *data_type The type of the copied data
1976 ir_node *new_rd_CopyB(dbg_info *db, ir_node *block, ir_node *store,
1977 ir_node *dst, ir_node *src, ir_type *data_type);
1979 /** Constructor for a InstOf node.
1981 * A High-Level Type check.
1983 * @param *db A pointer for debug information.
1984 * @param *block The IR block the node belongs to.
1985 * @param *store The memory in which the object the entity should be selected
1986 * from is allocated.
1987 * @param *objptr A pointer to a object of a class type.
1988 * @param *type The type of which objptr must be.
1990 ir_node *new_rd_InstOf(dbg_info *db, ir_node *block, ir_node *store,
1991 ir_node *objptr, ir_type *type);
1993 /** Constructor for a Raise node.
1995 * A High-Level Exception throw.
1997 * @param *db A pointer for debug information.
1998 * @param *block The IR block the node belongs to.
1999 * @param *store The current memory.
2000 * @param *obj A pointer to the Except variable.
2002 ir_node *new_rd_Raise(dbg_info *db, ir_node *block, ir_node *store, ir_node *obj);
2004 /** Constructor for a Bound node.
2006 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2008 * @param *db A pointer for debug information.
2009 * @param *block The block the node belong to.
2010 * @param *store The current memory.
2011 * @param *idx The ir_node that represents an index.
2012 * @param *lower The ir_node that represents the lower bound for the index.
2013 * @param *upper The ir_node that represents the upper bound for the index.
2015 ir_node *new_rd_Bound(dbg_info *db, ir_node *block,
2016 ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
2018 /** Constructor for a Pin node.
2020 * @param *db A pointer for debug information.
2021 * @param *block The block the node belong to.
2022 * @param *node The node which value should be pinned.
2024 ir_node *new_rd_Pin(dbg_info *db, ir_node *block, ir_node *node);
2026 /** Constructor for an ASM pseudo node.
2028 * @param *db A pointer for debug information.
2029 * @param *block The block the node belong to.
2030 * @param arity The number of data inputs to the node.
2031 * @param *in The array of length arity of data inputs.
2032 * @param *inputs The array of length arity of input constraints.
2033 * @param n_outs The number of data outputs to the node.
2034 * @param *outputs The array of length n_outs of output constraints.
2035 * @param n_clobber The number of clobbered registers.
2036 * @param *clobber The array of length n_clobber of clobbered registers.
2037 * @param *asm_text The assembler text.
2039 ir_node *new_rd_ASM(dbg_info *db, ir_node *block,
2040 int arity, ir_node *in[], ir_asm_constraint *inputs,
2041 int n_outs, ir_asm_constraint *outputs,
2042 int n_clobber, ident *clobber[], ident *asm_text);
2044 /*-------------------------------------------------------------------------*/
2045 /* The raw interface without debug support */
2046 /*-------------------------------------------------------------------------*/
2048 /** Constructor for a Block node.
2050 * Constructs a mature block with the given predecessors. Use Unknown
2051 * nodes as predecessors to construct a block if the number of
2052 * predecessors is known, but not the predecessors themselves. This
2053 * constructor does not set current_block. It not be used with
2054 * automatic Phi node construction.
2057 * @param irg The IR graph the block belongs to.
2058 * @param arity The number of control predecessors.
2059 * @param in[] An array of control predecessors. The length of
2060 * the array must be 'arity'. The constructor copies this array.
2062 ir_node *new_r_Block(ir_graph *irg, int arity, ir_node *in[]);
2064 /** Constructor for a Start node.
2066 * @param *irg The IR graph the node belongs to.
2067 * @param *block The IR block the node belongs to.
2069 ir_node *new_r_Start(ir_graph *irg, ir_node *block);
2071 /** Constructor for a End node.
2073 * @param *irg The IR graph the node belongs to.
2074 * @param *block The IR block the node belongs to.
2076 ir_node *new_r_End(ir_graph *irg, ir_node *block);
2078 /** Constructor for a Jmp node.
2080 * Jmp represents control flow to a single control successor.
2082 * @param *block The IR block the node belongs to.
2084 ir_node *new_r_Jmp(ir_node *block);
2086 /** Constructor for an IJmp node.
2088 * IJmp represents control flow to a single control successor not
2089 * statically known i.e. an indirect Jmp.
2091 * @param *block The IR block the node belongs to.
2092 * @param *tgt The IR node representing the target address.
2094 ir_node *new_r_IJmp(ir_node *block, ir_node *tgt);
2096 /** Constructor for a Cond node.
2098 * If c is mode_b represents a conditional branch (if/else). If c is
2099 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2100 * node, default Proj is 0.)
2102 * This is not consistent: Input to Cond is Is, Proj has as proj number
2105 * @param *block The IR block the node belongs to.
2106 * @param *c The conditions parameter.Can be of mode b or I_u.
2108 ir_node *new_r_Cond(ir_node *block, ir_node *c);
2110 /** Constructor for a Return node.
2112 * Returns the memory and zero or more return values. Only node that
2113 * can end regular control flow.
2115 * @param *block The IR block the node belongs to.
2116 * @param *store The state of memory.
2117 * @param arity Number of array indices.
2118 * @param *in[] Array with index inputs to the node. The constructor copies this array.
2120 ir_node *new_r_Return(ir_node *block, ir_node *store, int arity, ir_node *in[]);
2122 /** Constructor for a Const node.
2124 * Adds the node to the start block.
2126 * Constructor for a Const node. The constant represents a target
2127 * value. Sets the type information to type_unknown. (No more
2128 * supported: If tv is entity derives a somehow useful type.)
2129 * Derives mode from passed tarval.
2131 * @param *irg The IR graph the node belongs to.
2132 * @param *con Points to an entry in the constant table.
2134 ir_node *new_r_Const(ir_graph *irg, tarval *con);
2136 /** Constructor for a Const node.
2138 * Adds the node to the start block.
2140 * Constructor for a Const node. The constant represents a target
2141 * value. Sets the type information to type_unknown. (No more
2142 * supported: If tv is entity derives a somehow useful type.)
2144 * @param *irg The IR graph the node belongs to.
2145 * @param *mode The mode of the operands and the results.
2146 * @param value A value from which the tarval is made.
2148 ir_node *new_r_Const_long(ir_graph *irg, ir_mode *mode, long value);
2150 /** Constructor for a Const_type node.
2152 * Adds the node to the start block.
2154 * The constant represents a target value. This constructor sets high
2155 * level type information for the constant value.
2156 * Derives mode from passed tarval.
2158 * @param *irg The IR graph the node belongs to.
2159 * @param *con Points to an entry in the constant table.
2160 * @param *tp The type of the constant.
2162 ir_node *new_r_Const_type(ir_graph *irg, tarval *con, ir_type *tp);
2164 /** Constructor for a SymConst node.
2166 * This is the constructor for a symbolic constant.
2167 * There are four kinds of symbolic constants:
2168 * - type_tag The symbolic constant represents a type tag. The type the
2169 * tag stands for is given explicitly.
2170 * - size The symbolic constant represents the size of a type. The
2171 * type of which the constant represents the size is given
2173 * - addr_name The symbolic constant represents the address of an entity
2174 * (variable or method). The variable is indicated by a name
2175 * that is valid for linking.
2176 * - addr_ent The symbolic constant represents the address of an entity
2177 * (variable or method). The variable is given explicitly by
2180 * Inputs to the node:
2181 * No inputs except the block it belongs to.
2182 * Outputs of the node.
2183 * An unsigned integer (I_u) or a pointer (P).
2185 * @param *irg The IR graph the node belongs to.
2186 * @param mode The mode for the SymConst.
2187 * @param value A type, entity or a ident depending on the SymConst kind.
2188 * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
2190 ir_node *new_r_SymConst(ir_graph *irg, ir_mode *mode,
2191 union symconst_symbol value, symconst_kind symkind);
2193 /** Constructor for a simpleSel node.
2195 * This is a shortcut for the new_d_Sel() constructor. To be used for
2196 * Sel nodes that do not select from an array, i.e., have no index
2197 * inputs. It adds the two parameters 0, NULL.
2199 * @param *block The IR block the node belongs to.
2200 * @param *store The memory in which the object the entity should be selected
2201 * from is allocated.
2202 * @param *objptr The object from that the Sel operation selects a
2203 * single attribute out.
2204 * @param *ent The entity to select.
2206 ir_node *new_r_simpleSel(ir_node *block, ir_node *store,
2207 ir_node *objptr, ir_entity *ent);
2209 /** Constructor for a Sel node.
2211 * The select node selects an entity (field or method) from an entity
2212 * with a compound type. It explicitly specifies the entity selected.
2213 * Dynamically the node may select entities that overwrite the given
2214 * entity. If the selected entity is an array element entity the Sel
2215 * node takes the required array indices as inputs.
2217 * @param *block The IR block the node belongs to.
2218 * @param *store The memory in which the object the entity should be selected
2219 * from is allocated.
2220 * @param *objptr A pointer to a compound entity the Sel operation selects a
2221 * single attribute from.
2222 * @param *n_index The number of array indices needed to select an array element entity.
2223 * @param *index[] If the compound entity is an array the indices of the selected
2224 * element entity. The constructor copies this array.
2225 * @param *ent The entity to select.
2227 ir_node *new_r_Sel(ir_node *block, ir_node *store,
2228 ir_node *objptr, int n_index, ir_node *index[],
2231 /** Constructor for a Call node.
2233 * Represents all kinds of method and function calls.
2235 * @param *block The IR block the node belongs to.
2236 * @param *store The actual store.
2237 * @param *callee A pointer to the called procedure.
2238 * @param arity The number of procedure parameters.
2239 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2240 * @param *tp Type information of the procedure called.
2242 ir_node *new_r_Call(ir_node *block, ir_node *store,
2243 ir_node *callee, int arity, ir_node *in[], ir_type *tp);
2245 /** Constructor for a Builtin node.
2247 * Represents a call of a backend-specific builtin..
2249 * @param *block The IR block the node belongs to.
2250 * @param *store The actual store.
2251 * @param arity The number of procedure parameters.
2252 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2253 * @param kind The kind of the called builtin.
2254 * @param *tp Type information of the procedure called.
2256 ir_node *new_r_Builtin(ir_node *block, ir_node *store,
2257 int arity, ir_node *in[], ir_builtin_kind kind, ir_type *tp);
2259 /** Constructor for a Add node.
2261 * @param *block The IR block the node belongs to.
2262 * @param *op1 The first operand.
2263 * @param *op2 The second operand.
2264 * @param *mode The mode of the operands and the result.
2266 ir_node *new_r_Add(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2269 * Constructor for a Sub node.
2271 * @param *block The IR block the node belongs to.
2272 * @param *op1 The first operand.
2273 * @param *op2 The second operand.
2274 * @param *mode The mode of the operands and the results.
2276 ir_node *new_r_Sub(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2278 /** Constructor for a Minus node.
2280 * @param *block The IR block the node belongs to.
2281 * @param *op The operand.
2282 * @param *mode The mode of the operand and the result.
2284 ir_node *new_r_Minus(ir_node *block, ir_node *op, ir_mode *mode);
2286 /** Constructor for a Mul node.
2288 * @param *block The IR block the node belongs to.
2289 * @param *op1 The first operand.
2290 * @param *op2 The second operand.
2291 * @param *mode The mode of the operands and the result.
2293 ir_node *new_r_Mul(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2295 /** Constructor for a Mulh node.
2297 * @param *block The IR block the node belongs to.
2298 * @param *op1 The first operand.
2299 * @param *op2 The second operand.
2300 * @param *mode The mode of the operands and the result.
2302 ir_node *new_r_Mulh(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2304 /** Constructor for a Quot node.
2306 * @param *block The IR block the node belongs to.
2307 * @param *memop The store needed to model exceptions
2308 * @param *op1 The first operand.
2309 * @param *op2 The second operand.
2310 * @param *mode The mode of the result.
2311 * @param state The pinned state.
2313 ir_node *new_r_Quot(ir_node *block, ir_node *memop, ir_node *op1, ir_node *op2,
2314 ir_mode *mode, op_pin_state state);
2316 /** Constructor for a DivMod node.
2318 * @param *block The IR block the node belongs to.
2319 * @param *memop The store needed to model exceptions
2320 * @param *op1 The first operand.
2321 * @param *op2 The second operand.
2322 * @param *mode The mode of the results.
2323 * @param state The pinned state.
2325 ir_node *new_r_DivMod(ir_node *block, ir_node *memop, ir_node *op1, ir_node *op2,
2326 ir_mode *mode, op_pin_state state);
2328 /** Constructor for a Div node.
2330 * @param *block The IR block the node belongs to.
2331 * @param *memop The store needed to model exceptions
2332 * @param *op1 The first operand.
2333 * @param *op2 The second operand.
2334 * @param *mode The mode of the result.
2335 * @param state The pinned state.
2337 ir_node *new_r_Div(ir_node *block, ir_node *memop, ir_node *op1, ir_node *op2,
2338 ir_mode *mode, op_pin_state state);
2340 /** Constructor for a remainderless Div node.
2342 * @param *block The IR block the node belongs to.
2343 * @param *memop The store needed to model exceptions
2344 * @param *op1 The first operand.
2345 * @param *op2 The second operand.
2346 * @param *mode The mode of the result.
2347 * @param state The pinned state.
2349 ir_node *new_r_DivRL(ir_node *block, ir_node *memop, ir_node *op1, ir_node *op2,
2350 ir_mode *mode, op_pin_state state);
2352 /** Constructor for a Mod node.
2354 * @param *block The IR block the node belongs to.
2355 * @param *memop The store needed to model exceptions
2356 * @param *op1 The first operand.
2357 * @param *op2 The second operand.
2358 * @param *mode The mode of the result.
2359 * @param state The pinned state.
2361 ir_node *new_r_Mod(ir_node *block, ir_node *memop, ir_node *op1, ir_node *op2,
2362 ir_mode *mode, op_pin_state state);
2364 /** Constructor for a Abs node.
2366 * @param *block The IR block the node belongs to.
2367 * @param *op The operand
2368 * @param *mode The mode of the operands and the result.
2370 ir_node *new_r_Abs(ir_node *block, ir_node *op, ir_mode *mode);
2372 /** Constructor for a And node.
2374 * @param *block The IR block the node belongs to.
2375 * @param *op1 The first operand.
2376 * @param *op2 The second operand.
2377 * @param *mode The mode of the operands and the result.
2379 ir_node *new_r_And(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2381 /** Constructor for a Or node.
2383 * @param *block The IR block the node belongs to.
2384 * @param *op1 The first operand.
2385 * @param *op2 The second operand.
2386 * @param *mode The mode of the operands and the result.
2388 ir_node *new_r_Or(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2390 /** Constructor for a Eor node.
2392 * @param *block The IR block the node belongs to.
2393 * @param *op1 The first operand.
2394 * @param *op2 The second operand.
2395 * @param *mode The mode of the operands and the results.
2397 ir_node *new_r_Eor(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2399 /** Constructor for a Not node.
2401 * @param *block The IR block the node belongs to.
2402 * @param *op The operand.
2403 * @param *mode The mode of the operand and the result.
2405 ir_node *new_r_Not(ir_node *block, ir_node *op, ir_mode *mode);
2407 /** Constructor for a Cmp node.
2409 * @param *block The IR block the node belongs to.
2410 * @param *op1 The first operand.
2411 * @param *op2 The second operand.
2413 ir_node *new_r_Cmp(ir_node *block, ir_node *op1, ir_node *op2);
2415 /** Constructor for a Shl node.
2417 * @param *block The IR block the node belongs to.
2418 * @param *op The operand.
2419 * @param *k The number of bits to shift the operand .
2420 * @param *mode The mode of the operand and the result.
2422 ir_node *new_r_Shl(ir_node *block, ir_node *op, ir_node *k, ir_mode *mode);
2424 /** Constructor for a Shr node.
2426 * @param *block The IR block the node belongs to.
2427 * @param *op The operand.
2428 * @param *k The number of bits to shift the operand .
2429 * @param *mode The mode of the operand and the result.
2431 ir_node *new_r_Shr(ir_node *block, ir_node *op, ir_node *k, ir_mode *mode);
2434 * Constructor for a Shrs node.
2436 * @param *block The IR block the node belongs to.
2437 * @param *op The operand.
2438 * @param *k The number of bits to shift the operand.
2439 * @param *mode The mode of the operand and the result.
2441 ir_node *new_r_Shrs(ir_node *block, ir_node *op, ir_node *k, ir_mode *mode);
2443 /** Constructor for a Rotl node.
2445 * @param *block The IR block the node belongs to.
2446 * @param *op The operand.
2447 * @param *k The number of bits to rotate the operand.
2448 * @param *mode The mode of the operand.
2450 ir_node *new_r_Rotl(ir_node *block, ir_node *op, ir_node *k, ir_mode *mode);
2452 /** Constructor for a Conv node.
2454 * @param *block The IR block the node belongs to.
2455 * @param *op The operand.
2456 * @param *mode The mode of this the operand muss be converted .
2458 ir_node *new_r_Conv(ir_node *block, ir_node *op, ir_mode *mode);
2460 /** Constructor for a strict Conv node.
2462 * @param *block The IR block the node belongs to.
2463 * @param *op The operand.
2464 * @param *mode The mode of this the operand muss be converted .
2466 ir_node *new_r_strictConv(ir_node *block, ir_node *op, ir_mode *mode);
2468 /** Constructor for a Cast node.
2470 * High level type cast
2472 * @param *block The IR block the node belongs to.
2473 * @param *op The operand.
2474 * @param *to_tp The type of this the operand muss be casted .
2476 ir_node *new_r_Cast(ir_node *block, ir_node *op, ir_type *to_tp);
2478 /** Constructor for a Carry node.
2480 * @param *block The IR block the node belongs to.
2481 * @param *op1 The first operand.
2482 * @param *op2 The second operand.
2483 * @param *mode The mode of the operands and the result.
2485 ir_node *new_r_Carry(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2488 * Constructor for a Borrow node.
2490 * @param *block The IR block the node belongs to.
2491 * @param *op1 The first operand.
2492 * @param *op2 The second operand.
2493 * @param *mode The mode of the operands and the results.
2495 ir_node *new_r_Borrow(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2497 /** Constructor for a Phi node.
2499 * @param *block The IR block the node belongs to.
2500 * @param arity The number of predecessors
2501 * @param *in[] Array with predecessors. The constructor copies this array.
2502 * @param *mode The mode of it's inputs and output.
2504 ir_node *new_r_Phi(ir_node *block, int arity, ir_node *in[], ir_mode *mode);
2506 /** Constructor for a Load node.
2508 * @param *block The IR block the node belongs to.
2509 * @param *store The current memory
2510 * @param *adr A pointer to the variable to be read in this memory.
2511 * @param *mode The mode of the value to be loaded.
2512 * @param flags Additional flags for alignment, volatility and pin state.
2514 ir_node *new_r_Load(ir_node *block, ir_node *store,
2515 ir_node *adr, ir_mode *mode, ir_cons_flags flags);
2517 /** Constructor for a Store node.
2519 * @param *block The IR block the node belongs to.
2520 * @param *store The current memory
2521 * @param *adr A pointer to the variable to be read in this memory.
2522 * @param *val The value to write to this variable.
2523 * @param flags Additional flags for alignment, volatility and pin state.
2525 ir_node *new_r_Store(ir_node *block, ir_node *store,
2526 ir_node *adr, ir_node *val, ir_cons_flags flags);
2528 /** Constructor for a Alloc node.
2530 * The Alloc node extends the memory by space for an entity of type alloc_type.
2532 * @param *block The IR block the node belongs to.
2533 * @param *store The memory which shall contain the new variable.
2534 * @param *count The number of objects to allocate.
2535 * @param *alloc_type The type of the allocated variable.
2536 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
2538 ir_node *new_r_Alloc(ir_node *block, ir_node *store,
2539 ir_node *count, ir_type *alloc_type, ir_where_alloc where);
2541 /** Constructor for a Free node.
2543 * Frees the memory occupied by the entity pointed to by the pointer
2544 * arg. Type indicates the type of the entity the argument points to.
2546 * @param *block The IR block the node belongs to.
2547 * @param *store The memory which shall contain the new variable.
2548 * @param *ptr The pointer to the object to free.
2549 * @param *size The number of objects of type free_type to free in a sequence.
2550 * @param *free_type The type of the freed variable.
2551 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
2553 ir_node *new_r_Free(ir_node *block, ir_node *store,
2554 ir_node *ptr, ir_node *size, ir_type *free_type, ir_where_alloc where);
2556 /** Constructor for a Sync node.
2558 * Merges several memory values. The node assumes that a variable
2559 * either occurs only in one of the memories, or it contains the same
2560 * value in all memories where it occurs.
2562 * @param *block The IR block the node belongs to.
2563 * @param arity The number of memories to synchronize.
2564 * @param *in[] An array of pointers to nodes that produce an output of type memory.
2565 * The constructor copies this array.
2567 ir_node *new_r_Sync(ir_node *block, int arity, ir_node *in[]);
2569 /** Constructor for a Proj node.
2571 * Projects a single value out of a tuple. The parameter proj gives the
2572 * position of the value within the tuple.
2574 * @param *block The IR block the node belongs to.
2575 * @param arg A node producing a tuple.
2576 * @param *mode The mode of the value to project.
2577 * @param proj The position of the value in the tuple.
2579 ir_node *new_r_Proj(ir_node *block, ir_node *arg,
2580 ir_mode *mode, long proj);
2582 /** Constructor for a defaultProj node.
2584 * Represents the default control flow of a Switch-Cond node.
2586 * @param *block The IR block the node belongs to.
2587 * @param arg A node producing a tuple.
2588 * @param max_proj The end position of the value in the tuple.
2590 ir_node *new_r_defaultProj(ir_node *block, ir_node *arg, long max_proj);
2593 /** Constructor for a Tuple node.
2595 * This is an auxiliary node to replace a node that returns a tuple
2596 * without changing the corresponding Proj nodes.
2598 * @param *block The IR block the node belongs to.
2599 * @param arity The number of tuple elements.
2600 * @param *in[] An array containing pointers to the nodes producing the tuple elements.
2601 * The constructor copies this array.
2603 ir_node *new_r_Tuple(ir_node *block, int arity, ir_node *in[]);
2605 /** Constructor for a Id node.
2607 * This is an auxiliary node to replace a node that returns a single
2610 * @param *block The IR block the node belongs to.
2611 * @param *val The operand to Id.
2612 * @param *mode The mode of *val.
2614 ir_node *new_r_Id(ir_node *block, ir_node *val, ir_mode *mode);
2616 /** Constructor for a Bad node.
2618 * Returns the unique Bad node of the graph. The same as
2621 * @param *irg The IR graph the node belongs to.
2623 ir_node *new_r_Bad(ir_graph *irg);
2625 /** Constructor for a Confirm node.
2627 * Specifies constraints for a value. To support dataflow analyses.
2629 * Example: If the value never exceeds '100' this is expressed by placing a
2630 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
2632 * @param *block The IR block the node belong to.
2633 * @param *val The value we express a constraint for
2634 * @param *bound The value to compare against. Must be a firm node, typically a constant.
2635 * @param cmp The compare operation.
2637 ir_node *new_r_Confirm(ir_node *block, ir_node *val, ir_node *bound, pn_Cmp cmp);
2639 /** Constructor for a Unknown node.
2641 * Represents an arbitrary value. Places the node in
2644 * @param *irg The IR graph the node belongs to.
2645 * @param *m The mode of the unknown value.
2647 ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2649 /** Constructor for a CallBegin node.
2651 * CallBegin represents control flow depending of the pointer value
2652 * representing the called method to the called methods. The
2653 * constructor copies the method pointer input from the passed Call
2656 * @param *block The block the node belong to.
2657 * @param *callee The call node visible in the intra procedural view.
2659 ir_node *new_r_CallBegin(ir_node *block, ir_node *ptr, ir_node *call);
2661 /** Constructor for a EndReg node.
2663 * Used to represent regular procedure end in interprocedual view.
2665 * @param *irg The IR graph the node belong to.
2666 * @param *block The block the node belong to.
2668 ir_node *new_r_EndReg(ir_graph *irg, ir_node *block);
2670 /** Constructor for a EndExcept node.
2672 * Used to represent exceptional procedure end in interprocedural view.
2674 * @param *irg The IR graph the node belong to.
2675 * @param *block The block the node belong to.
2677 ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
2679 /** Constructor for a Break node.
2681 * Break represents control flow to a single control successor just as Jmp.
2682 * The blocks separated by a break may not be concatenated by an optimization.
2683 * It is used for the interprocedural representation where blocks are parted
2684 * behind Call nodes to represent the control flow to called procedures.
2686 * @param *block The block the node belong to.
2688 ir_node *new_r_Break(ir_node *block);
2690 /** Constructor for a Filter node.
2692 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
2693 * Filter is a node with two views used to construct the interprocedural view.
2694 * In intraprocedural view its semantics are identical to the Proj node.
2695 * In interprocedural view the Filter performs the Phi operation on method
2696 * parameters or results. Other than a Phi a Filter node may not be removed
2697 * if it has only a single input.
2699 * The constructor builds the Filter in intraprocedural view.
2701 * @param *block The block the node belong to.
2702 * @param *arg The tuple value to project from.
2703 * @param *mode The mode of the projected value.
2704 * @param proj The position in the tuple to project from.
2706 ir_node *new_r_Filter(ir_node *block, ir_node *arg, ir_mode *mode, long proj);
2708 /** Constructor for a NoMem node.
2710 * Returns the unique NoMem node of the graph. The same as
2713 * @param *irg The IR graph the node belongs to.
2715 ir_node *new_r_NoMem(ir_graph *irg);
2717 /** Constructor for a Mux node.
2719 * @param *block The block the node belong to.
2720 * @param *sel The ir_node that calculates the boolean select.
2721 * @param *ir_true The ir_node that calculates the true result.
2722 * @param *ir_false The ir_node that calculates the false result.
2723 * @param *mode The mode of the node (and it_true and ir_false).
2725 ir_node *new_r_Mux(ir_node *block, ir_node *sel,
2726 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2728 /** Constructor for a CopyB node.
2730 * @param *block The block the node belong to.
2731 * @param *store The current memory
2732 * @param *dst The ir_node that represents the destination address.
2733 * @param *src The ir_node that represents the source address.
2734 * @param *data_type The type of the copied data
2736 ir_node *new_r_CopyB(ir_node *block, ir_node *store,
2737 ir_node *dst, ir_node *src, ir_type *data_type);
2739 /** Constructor for a InstOf node.
2741 * A High-Level Type check.
2743 * @param *block The block the node belong to.
2744 * @param *store The memory in which the object the entity should be selected
2745 * from is allocated.
2746 * @param *objptr A pointer to a object of a class type.
2747 * @param *type The type of which objptr must be.
2749 ir_node *new_r_InstOf(ir_node *block, ir_node *store,
2750 ir_node *objptr, ir_type *type);
2752 /** Constructor for a Raise node.
2754 * A High-Level Exception throw.
2756 * @param *block The IR block the node belongs to.
2757 * @param *store The current memory.
2758 * @param *obj A pointer to the Except variable.
2760 ir_node *new_r_Raise(ir_node *block, ir_node *store, ir_node *obj);
2762 /** Constructor for a Bound node.
2764 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2766 * @param *block The block the node belong to.
2767 * @param *store The current memory.
2768 * @param *idx The ir_node that represents an index.
2769 * @param *lower The ir_node that represents the lower bound for the index.
2770 * @param *upper The ir_node that represents the upper bound for the index.
2772 ir_node *new_r_Bound(ir_node *block, ir_node *store,
2773 ir_node *idx, ir_node *lower, ir_node *upper);
2775 /** Constructor for a Pin node.
2777 * @param *block The block the node belong to.
2778 * @param *node The node which value should be pinned.
2780 ir_node *new_r_Pin(ir_node *block, ir_node *node);
2782 /** Constructor for an ASM pseudo node.
2784 * @param *block The block the node belong to.
2785 * @param arity The number of data inputs to the node.
2786 * @param *in The array of length arity of data inputs.
2787 * @param *inputs The array of length arity of input constraints.
2788 * @param n_outs The number of data outputs to the node.
2789 * @param *outputs The array of length n_outs of output constraints.
2790 * @param n_clobber The number of clobbered registers.
2791 * @param *clobber The array of length n_clobber of clobbered registers.
2792 * @param *asm_text The assembler text.
2794 ir_node *new_r_ASM(ir_node *block,
2795 int arity, ir_node *in[], ir_asm_constraint *inputs,
2796 int n_outs, ir_asm_constraint *outputs,
2797 int n_clobber, ident *clobber[], ident *asm_text);
2799 /*-----------------------------------------------------------------------*/
2800 /* The block oriented interface */
2801 /*-----------------------------------------------------------------------*/
2803 /** Sets the current block in which the following constructors place the
2804 * nodes they construct.
2806 * @param target The new current block.
2808 void set_cur_block(ir_node *target);
2810 /** Returns the current block of the current graph. */
2811 ir_node *get_cur_block(void);
2813 /** Returns the fixed nodes of the current graph. */
2814 #define get_cur_end_block() get_irg_end_block(current_ir_graph)
2815 #define get_cur_end() get_irg_end(current_ir_graph)
2816 #define get_cur_start_block() get_irg_start_block(current_ir_graph)
2817 #define get_cur_start() get_irg_start(current_ir_graph)
2819 /** Constructor for a Block node.
2821 * Adds the block to the graph in current_ir_graph. Constructs a Block
2822 * with a fixed number of predecessors. Does set current_block. Can
2823 * be used with automatic Phi node construction.
2825 * @param *db A Pointer for debug information.
2826 * @param arity The number of control predecessors.
2827 * @param in[] An array of control predecessors. The length of
2828 * the array must be 'arity'.
2830 ir_node *new_d_Block(dbg_info *db, int arity, ir_node *in[]);
2832 /** Constructor for a Start node.
2834 * Adds the node to the block in current_ir_block.
2836 * @param *db A pointer for debug information.
2838 ir_node *new_d_Start(dbg_info *db);
2840 /** Constructor for a End node.
2842 * Adds the node to the block in current_ir_block.
2844 * @param *db A pointer for debug information.
2846 ir_node *new_d_End(dbg_info *db);
2848 /** Constructor for a Jmp node.
2850 * Adds the node to the block in current_ir_block.
2852 * Jmp represents control flow to a single control successor.
2854 * @param *db A pointer for debug information.
2856 ir_node *new_d_Jmp(dbg_info *db);
2858 /** Constructor for an IJmp node.
2860 * IJmp represents control flow to a single control successor not
2861 * statically known i.e. an indirect Jmp.
2863 * @param *db A pointer for debug information.
2864 * @param *tgt The IR node representing the target address.
2866 ir_node *new_d_IJmp(dbg_info *db, ir_node *tgt);
2868 /** Constructor for a Cond node.
2870 * Adds the node to the block in current_ir_block.
2872 * If c is mode_b represents a conditional branch (if/else). If c is
2873 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2874 * node, default Proj is 0.)
2876 * This is not consistent: Input to Cond is Is, Proj has as proj number
2879 * @param *db A pointer for debug information.
2880 * @param *c The conditions parameter.Can be of mode b or I_u.
2882 ir_node *new_d_Cond(dbg_info *db, ir_node *c);
2884 /** Constructor for a Return node.
2886 * Adds the node to the block in current_ir_block.
2888 * Returns the memory and zero or more return values. Only node that
2889 * can end regular control flow.
2891 * @param *db A pointer for debug information.
2892 * @param *store The state of memory.
2893 * @param arity Number of array indices.
2894 * @param *in Array with index inputs to the node.
2896 ir_node *new_d_Return(dbg_info *db, ir_node *store, int arity, ir_node *in[]);
2898 /** Constructor for a Const_type node.
2900 * Adds the node to the start block.
2902 * The constant represents a target value. This constructor sets high
2903 * level type information for the constant value.
2904 * Derives mode from passed tarval.
2906 * @param *db A pointer for debug information.
2907 * @param *con Points to an entry in the constant table. This pointer is
2908 added to the attributes of the node.
2909 * @param *tp The type of the constant.
2911 ir_node *new_d_Const_type(dbg_info *db, tarval *con, ir_type *tp);
2913 /** Constructor for a Const node.
2915 * Adds the node to the block in current_ir_block.
2917 * Constructor for a Const node. The constant represents a target
2918 * value. Sets the type information to type_unknown. (No more
2919 * supported: If tv is entity derives a somehow useful type.)
2920 * Derives mode from passed tarval.
2922 * @param *db A pointer for debug information.
2923 * @param *con Points to an entry in the constant table. This pointer is added
2924 * to the attributes of the node.
2926 ir_node *new_d_Const(dbg_info *db, tarval *con);
2928 /** Constructor for a SymConst_type node.
2930 * Adds the node to the block in current_ir_block.
2931 * This is the constructor for a symbolic constant.
2932 * There are four kinds of symbolic constants:
2933 * - type_tag The symbolic constant represents a type tag. The type the
2934 * tag stands for is given explicitly.
2935 * - size The symbolic constant represents the size of a type. The
2936 * type of which the constant represents the size is given
2938 * - addr_name The symbolic constant represents the address of an entity
2939 * (variable or method). The variable is indicated by a name
2940 * that is valid for linking.
2941 * - addr_ent The symbolic constant represents the address of an entity
2942 * (variable or method). The variable is given explicitly by
2945 * Inputs to the node:
2946 * No inputs except the block it belongs to.
2947 * Outputs of the node.
2948 * An unsigned integer (I_u) or a pointer (P).
2950 * @param *db A pointer for debug information.
2951 * @param mode The mode for the SymConst.
2952 * @param value A type, entity or ident depending on the SymConst kind.
2953 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size,
2954 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
2955 * @param tp The source type of the constant.
2957 ir_node *new_d_SymConst_type(dbg_info *db, ir_mode *mode,
2958 union symconst_symbol value, symconst_kind kind, ir_type *tp);
2960 /** Constructor for a SymConst node.
2962 * Same as new_d_SymConst_type, except that it sets the type to type_unknown.
2964 ir_node *new_d_SymConst(dbg_info *db, ir_mode *mode,
2965 union symconst_symbol value, symconst_kind kind);
2967 /** Constructor for a simpleSel node.
2969 * This is a shortcut for the new_d_Sel() constructor. To be used for
2970 * Sel nodes that do not select from an array, i.e., have no index
2971 * inputs. It adds the two parameters 0, NULL.
2973 * @param *db A pointer for debug information.
2974 * @param *store The memory in which the object the entity should be
2975 * selected from is allocated.
2976 * @param *objptr The object from that the Sel operation selects a
2977 * single attribute out.
2978 * @param *ent The entity to select.
2980 ir_node *new_d_simpleSel(dbg_info *db, ir_node *store, ir_node *objptr, ir_entity *ent);
2982 /** Constructor for a Sel node.
2984 * The select node selects an entity (field or method) from an entity
2985 * with a compound type. It explicitly specifies the entity selected.
2986 * Dynamically the node may select entities that overwrite the given
2987 * entity. If the selected entity is an array element entity the Sel
2988 * node takes the required array indices as inputs.
2989 * Adds the node to the block in current_ir_block.
2991 * @param *db A pointer for debug information.
2992 * @param *store The memory in which the object the entity should be selected
2993 * from is allocated.
2994 * @param *objptr A pointer to a compound entity the Sel operation selects a
2995 * single attribute from.
2996 * @param arity The number of array indices needed to select an array element entity.
2997 * @param *in[] If the compound entity is an array the indices of the selected
2998 * element entity. The constructor copies this array.
2999 * @param *ent The entity to select.
3001 ir_node *new_d_Sel(dbg_info *db, ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3004 /** Constructor for a Call node.
3006 * Represents all kinds of method and function calls.
3007 * Adds the node to the block in current_ir_block.
3009 * @param *db A pointer for debug information.
3010 * @param *store The actual store.
3011 * @param *callee A pointer to the called procedure.
3012 * @param arity The number of procedure parameters.
3013 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3014 * @param *tp Type information of the procedure called.
3016 ir_node *new_d_Call(dbg_info *db, ir_node *store, ir_node *callee, int arity, ir_node *in[],
3019 /** Constructor for a Builtin node.
3021 * Represents a call of a backend-specific builtin..
3022 * Adds the node to the block in current_ir_block.
3024 * @param *db A pointer for debug information.
3025 * @param *store The actual store.
3026 * @param arity The number of procedure parameters.
3027 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3028 * @param kind The kind of the called builtin.
3029 * @param *tp Type information of the procedure called.
3031 ir_node *new_d_Builtin(dbg_info *db, ir_node *store, int arity, ir_node *in[], ir_builtin_kind kind, ir_type *tp);
3033 /** Constructor for a Add node.
3035 * Adds the node to the block in current_ir_block.
3037 * @param *db A pointer for debug information.
3038 * @param *op1 The first operand.
3039 * @param *op2 The second operand.
3040 * @param *mode The mode of the operands and the result.
3042 ir_node *new_d_Add(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3044 /** Constructor for a Sub node.
3046 * Adds the node to the block in current_ir_block.
3048 * @param *db A pointer for debug information.
3049 * @param *op1 The first operand.
3050 * @param *op2 The second operand.
3051 * @param *mode The mode of the operands and the result.
3053 ir_node *new_d_Sub(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3055 /** Constructor for a Minus node.
3057 * Adds the node to the block in current_ir_block.
3059 * @param *db A pointer for debug information.
3060 * @param *op The operand .
3061 * @param *mode The mode of the operand and the result.
3063 ir_node *new_d_Minus(dbg_info *db, ir_node *op, ir_mode *mode);
3065 /** Constructor for a Mul node.
3067 * Adds the node to the block in current_ir_block.
3069 * @param *db A pointer for debug information.
3070 * @param *op1 The first operand.
3071 * @param *op2 The second operand.
3072 * @param *mode The mode of the operands and the result.
3074 ir_node *new_d_Mul(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3076 /** Constructor for a Mulh node.
3078 * Adds the node to the block in current_ir_block.
3080 * @param *db A pointer for debug information.
3081 * @param *op1 The first operand.
3082 * @param *op2 The second operand.
3083 * @param *mode The mode of the operands and the result.
3085 ir_node *new_d_Mulh(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3087 /** Constructor for a Quot node.
3089 * Adds the node to the block in current_ir_block.
3091 * @param *db A pointer for debug information.
3092 * @param *memop The store needed to model exceptions
3093 * @param *op1 The first operand.
3094 * @param *op2 The second operand.
3095 * @param *mode The mode of the result.
3096 * @param state The pinned state.
3098 ir_node *new_d_Quot(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3100 /** Constructor for a DivMod node.
3102 * Adds the node to the block in current_ir_block.
3104 * @param *db A pointer for debug information.
3105 * @param *memop The store needed to model exceptions
3106 * @param *op1 The first operand.
3107 * @param *op2 The second operand.
3108 * @param *mode The mode of the results.
3109 * @param state The pinned state.
3111 ir_node *new_d_DivMod(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3113 /** Constructor for a Div node.
3115 * Adds the node to the block in current_ir_block.
3117 * @param *db A pointer for debug information.
3118 * @param *memop The store needed to model exceptions
3119 * @param *op1 The first operand.
3120 * @param *op2 The second operand.
3121 * @param *mode The mode of the result.
3122 * @param state The pinned state.
3124 ir_node *new_d_Div(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3126 /** Constructor for a remainderless Div node.
3128 * Adds the node to the block in current_ir_block.
3130 * @param *db A pointer for debug information.
3131 * @param *memop The store needed to model exceptions
3132 * @param *op1 The first operand.
3133 * @param *op2 The second operand.
3134 * @param *mode The mode of the result.
3135 * @param state The pinned state.
3137 ir_node *new_d_DivRL(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3139 /** Constructor for a Mod node.
3141 * Adds the node to the block in current_ir_block.
3143 * @param *db A pointer for debug information.
3144 * @param *memop The store needed to model exceptions
3145 * @param *op1 The first operand.
3146 * @param *op2 The second operand.
3147 * @param *mode The mode of the result.
3148 * @param state The pinned state.
3150 ir_node *new_d_Mod(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3152 /** Constructor for a Abs node.
3154 * Adds the node to the block in current_ir_block.
3156 * @param *db A pointer for debug information.
3157 * @param *op The operand
3158 * @param *mode The mode of the operands and the result.
3160 ir_node *new_d_Abs(dbg_info *db, ir_node *op, ir_mode *mode);
3162 /** Constructor for a And node.
3164 * Adds the node to the block in current_ir_block.
3166 * @param *db A pointer for debug information.
3167 * @param *op1 The first operand.
3168 * @param *op2 The second operand.
3169 * @param *mode The mode of the operands and the result.
3171 ir_node *new_d_And(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3173 /** Constructor for a Or node.
3175 * Adds the node to the block in current_ir_block.
3177 * @param *db A pointer for debug information.
3178 * @param *op1 The first operand.
3179 * @param *op2 The second operand.
3180 * @param *mode The mode of the operands and the result.
3182 ir_node *new_d_Or(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3184 /** Constructor for a Eor node.
3186 * Adds the node to the block in current_ir_block.
3188 * @param *db A pointer for debug information.
3189 * @param *op1 The first operand.
3190 * @param *op2 The second operand.
3191 * @param *mode The mode of the operands and the results.
3193 ir_node *new_d_Eor(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3195 /** Constructor for a Not node.
3197 * Adds the node to the block in current_ir_block.
3199 * @param *db A pointer for debug information.
3200 * @param *op The operand.
3201 * @param *mode The mode of the operand and the result.
3203 ir_node *new_d_Not(dbg_info *db, ir_node *op, ir_mode *mode);
3205 /** Constructor for a Shl node.
3207 * Adds the node to the block in current_ir_block.
3209 * @param *db A pointer for debug information.
3210 * @param *op The operand.
3211 * @param *k The number of bits to shift the operand .
3212 * @param *mode The mode of the operand and the result.
3214 ir_node *new_d_Shl(dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3216 /** Constructor for a Shr node.
3218 * Adds the node to the block in current_ir_block.
3220 * @param *db A pointer for debug information.
3221 * @param *op The operand.
3222 * @param *k The number of bits to shift the operand .
3223 * @param *mode The mode of the operand and the result.
3225 ir_node *new_d_Shr(dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3227 /** Constructor for a Shrs node.
3229 * Adds the node to the block in current_ir_block.
3231 * @param *db A pointer for debug information.
3232 * @param *op The operand.
3233 * @param *k The number of bits to shift the operand .
3234 * @param *mode The mode of the operand and the result.
3236 ir_node *new_d_Shrs(dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3238 /** Constructor for a Rotl node.
3240 * Adds the node to the block in current_ir_block.
3242 * @param *db A pointer for debug information.
3243 * @param *op The operand.
3244 * @param *k The number of bits to rotate the operand.
3245 * @param *mode The mode of the operand.
3247 ir_node *new_d_Rotl(dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3249 /** Constructor for a Cmp node.
3251 * Adds the node to the block in current_ir_block.
3253 * @param *db A pointer for debug information.
3254 * @param *op1 The first operand.
3255 * @param *op2 The second operand.
3257 ir_node *new_d_Cmp(dbg_info *db, ir_node *op1, ir_node *op2);
3259 /** Constructor for a Conv node.
3261 * Adds the node to the block in current_ir_block.
3263 * @param *db A pointer for debug information.
3264 * @param *op The operand.
3265 * @param *mode The mode of this the operand muss be converted .
3267 ir_node *new_d_Conv(dbg_info *db, ir_node *op, ir_mode *mode);
3269 /** Constructor for a strict Conv node.
3271 * Adds the node to the block in current_ir_block.
3273 * @param *db A pointer for debug information.
3274 * @param *op The operand.
3275 * @param *mode The mode of this the operand muss be converted .
3277 ir_node *new_d_strictConv(dbg_info *db, ir_node *op, ir_mode *mode);
3279 /** Constructor for a Cast node.
3281 * High level type cast
3282 * Adds the node to the block in current_ir_block.
3284 * @param *db A pointer for debug information.
3285 * @param *op The operand.
3286 * @param *to_tp The type of this the operand muss be casted .
3288 ir_node *new_d_Cast(dbg_info *db, ir_node *op, ir_type *to_tp);
3290 /** Constructor for a Carry node.
3292 * Adds the node to the block in current_ir_block.
3294 * @param *db A pointer for debug information.
3295 * @param *op1 The first operand.
3296 * @param *op2 The second operand.
3297 * @param *mode The mode of the operands and the result.
3299 ir_node *new_d_Carry(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3301 /** Constructor for a Borrow node.
3303 * Adds the node to the block in current_ir_block.
3305 * @param *db A pointer for debug information.
3306 * @param *op1 The first operand.
3307 * @param *op2 The second operand.
3308 * @param *mode The mode of the operands and the result.
3310 ir_node *new_d_Borrow(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3312 /** Constructor for a Phi node.
3314 * Adds the node to the block in current_ir_block.
3316 * @param *db A pointer for debug information.
3317 * @param arity The number of predecessors
3318 * @param *in Array with predecessors
3319 * @param *mode The mode of it's inputs and output.
3321 ir_node *new_d_Phi(dbg_info *db, int arity, ir_node *in[], ir_mode *mode);
3323 /** Constructor for a Load node.
3325 * Adds the node to the block in current_ir_block.
3327 * @param *db A pointer for debug information.
3328 * @param *store The current memory
3329 * @param *addr A pointer to the variable to be read in this memory.
3330 * @param *mode The mode of the value to be loaded.
3331 * @param flags Additional flags for alignment, volatility and pin state.
3333 ir_node *new_d_Load(dbg_info *db, ir_node *store, ir_node *addr, ir_mode *mode, ir_cons_flags flags);
3335 /** Constructor for a Store node.
3337 * Adds the node to the block in current_ir_block.
3339 * @param *db A pointer for debug information.
3340 * @param *store The current memory
3341 * @param *addr A pointer to the variable to be read in this memory.
3342 * @param *val The value to write to this variable.
3343 * @param flags Additional flags for alignment, volatility and pin state.
3345 ir_node *new_d_Store(dbg_info *db, ir_node *store, ir_node *addr, ir_node *val, ir_cons_flags flags);
3347 /** Constructor for a Alloc node.
3349 * The Alloc node extends the memory by space for an entity of type alloc_type.
3350 * Adds the node to the block in current_ir_block.
3352 * @param *db A pointer for debug information.
3353 * @param *store The memory which shall contain the new variable.
3354 * @param *count The number of objects to allocate.
3355 * @param *alloc_type The type of the allocated variable.
3356 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3358 ir_node *new_d_Alloc(dbg_info *db, ir_node *store, ir_node *count, ir_type *alloc_type,
3359 ir_where_alloc where);
3361 /** Constructor for a Free node.
3363 * Frees the memory occupied by the entity pointed to by the pointer
3364 * arg. Type indicates the type of the entity the argument points to.
3365 * Adds the node to the block in current_ir_block.
3367 * @param *db A pointer for debug information.
3368 * @param *store The memory which shall contain the new variable.
3369 * @param *ptr The pointer to the object to free.
3370 * @param *size The number of objects of type free_type to free in a sequence.
3371 * @param *free_type The type of the freed variable.
3372 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
3374 ir_node *new_d_Free(dbg_info *db, ir_node *store, ir_node *ptr, ir_node *size,
3375 ir_type *free_type, ir_where_alloc where);
3377 /** Constructor for a Sync node.
3379 * Merges several memory values. The node assumes that a variable
3380 * either occurs only in one of the memories, or it contains the same
3381 * value in all memories where it occurs.
3382 * Adds the node to the block in current_ir_block.
3384 * @param *db A pointer for debug information.
3385 * @param arity The number of memories to synchronize.
3386 * @param **in An array of pointers to nodes that produce an output of type
3387 * memory. The constructor copies this array.
3389 ir_node *new_d_Sync(dbg_info *db, int arity, ir_node *in[]);
3391 /** Constructor for a Proj node.
3393 * Projects a single value out of a tuple. The parameter proj gives the
3394 * position of the value within the tuple.
3395 * Adds the node to the block in current_ir_block.
3397 * @param *db A pointer for deubug information.
3398 * @param arg A node producing a tuple.
3399 * @param *mode The mode of the value to project.
3400 * @param proj The position of the value in the tuple.
3402 ir_node *new_d_Proj(dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3404 /** Constructor for a defaultProj node.
3406 * Represents the default control flow of a Switch-Cond node.
3407 * Adds the node to the block in current_ir_block.
3409 * @param *db A pointer for debug information.
3410 * @param arg A node producing a tuple.
3411 * @param max_proj The end position of the value in the tuple.
3413 ir_node *new_d_defaultProj(dbg_info *db, ir_node *arg, long max_proj);
3415 /** Constructor for a Tuple node.
3417 * This is an auxiliary node to replace a node that returns a tuple
3418 * without changing the corresponding Proj nodes.
3419 * Adds the node to the block in current_ir_block.
3421 * @param *db A pointer for debug information.
3422 * @param arity The number of tuple elements.
3423 * @param **in An array containing pointers to the nodes producing the tuple elements.
3425 ir_node *new_d_Tuple(dbg_info *db, int arity, ir_node *in[]);
3427 /** Constructor for a Id node.
3429 * This is an auxiliary node to replace a node that returns a single
3430 * value. Adds the node to the block in current_ir_block.
3432 * @param *db A pointer for debug information.
3433 * @param *val The operand to Id.
3434 * @param *mode The mode of *val.
3436 ir_node *new_d_Id(dbg_info *db, ir_node *val, ir_mode *mode);
3438 /** Constructor for a Confirm node.
3440 * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3441 * Specifies constraints for a value. To support dataflow analyses.
3443 * Example: If the value never exceeds '100' this is expressed by placing a
3444 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
3446 * @param *db A pointer for debug information.
3447 * @param *val The value we express a constraint for
3448 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3449 * @param cmp The compare operation.
3451 ir_node *new_d_Confirm(dbg_info *db, ir_node *val, ir_node *bound, pn_Cmp cmp);
3453 /** Constructor for an Unknown node.
3455 * Represents an arbitrary value. Places the node in
3458 * @param *db A pointer for debug information.
3459 * @param *m The mode of the unknown value.
3461 ir_node *new_d_Unknown(dbg_info *db, ir_mode *m);
3463 /** Constructor for a CallBegin node.
3465 * CallBegin represents control flow depending of the pointer value
3466 * representing the called method to the called methods. The
3467 * constructor copies the method pointer input from the passed Call
3468 * node.Adds the node to the block in current_ir_block.
3470 * @param *db A pointer for debug information.
3471 * @param *callee The call node visible in the intra procedural view.
3473 ir_node *new_d_CallBegin(dbg_info *db, ir_node *ptr, ir_node *call);
3475 /** Constructor for an EndReg node.
3477 *Adds the node to the block in current_ir_block.
3479 * @param *db A pointer for debug information.
3481 ir_node *new_d_EndReg(dbg_info *db);
3483 /** Constructor for an EndExcept node.
3485 * Used to represent regular procedure end in interprocedual view.
3486 * Adds the node to the block in current_ir_block.
3488 * @param *db A pointer for debug information.
3490 ir_node *new_d_EndExcept(dbg_info *db);
3492 /** Constructor for a Break node.
3494 * Used to represent exceptional procedure end in interprocedural view.
3495 * Adds the node to the block in current_ir_block.
3497 * Break represents control flow to a single control successor just as Jmp.
3498 * The blocks separated by a break may not be concatenated by an optimization.
3499 * It is used for the interprocedural representation where blocks are parted
3500 * behind Call nodes to represent the control flow to called procedures.
3502 * @param *db A pointer for debug information.
3504 ir_node *new_d_Break(dbg_info *db);
3506 /** Constructor for a Filter node.
3508 * Constructor for a Filter node. Adds the node to the block in
3509 * current_ir_block. Filter is a node with two views used to
3510 * construct the interprocedural view. In intraprocedural view its
3511 * semantics are identical to the Proj node. In interprocedural view
3512 * the Filter performs the Phi operation on method parameters or
3513 * results. Other than a Phi a Filter node may not be removed if it
3514 * has only a single input.
3516 * The constructor builds the Filter in intraprocedural view.
3518 * @param *db A pointer for debug information.
3519 * @param *arg The tuple value to project from.
3520 * @param *mode The mode of the projected value.
3521 * @param proj The position in the tuple to project from.
3523 ir_node *new_d_Filter(dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3525 /** Constructor for a Mux node.
3527 * @param *db A pointer for debug information.
3528 * @param *sel The ir_node that calculates the boolean select.
3529 * @param *ir_true The ir_node that calculates the true result.
3530 * @param *ir_false The ir_node that calculates the false result.
3531 * @param *mode The mode of the node (and it_true and ir_false).
3533 ir_node *new_d_Mux(dbg_info *db, ir_node *sel,
3534 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
3536 /** Constructor for a CopyB node.
3538 * @param *db A pointer for debug information.
3539 * @param *store The current memory
3540 * @param *dst The ir_node that represents the destination address.
3541 * @param *src The ir_node that represents the source address.
3542 * @param *data_type The type of the copied data
3544 ir_node *new_d_CopyB(dbg_info *db, ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
3546 /** Constructor for a InstOf node.
3548 * A High-Level Type check.
3550 * @param *db A pointer for debug information.
3551 * @param *store The memory in which the object the entity should be selected
3552 * from is allocated.
3553 * @param *objptr A pointer to a object of a class type.
3554 * @param *type The type of which objptr must be.
3556 ir_node *new_d_InstOf(dbg_info *db, ir_node *store, ir_node *objptr, ir_type *type);
3558 /** Constructor for a Raise node.
3560 * A High-Level Exception throw.
3562 * @param *db A pointer for debug information.
3563 * @param *store The current memory.
3564 * @param *obj A pointer to the Except variable.
3566 ir_node *new_d_Raise(dbg_info *db, ir_node *store, ir_node *obj);
3568 /** Constructor for a Bound node.
3570 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
3572 * @param *db A pointer for debug information.
3573 * @param *store The current memory
3574 * @param *idx The ir_node that represents an index.
3575 * @param *lower The ir_node that represents the lower bound for the index.
3576 * @param *upper The ir_node that represents the upper bound for the index.
3578 ir_node *new_d_Bound(dbg_info *db, ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
3580 /** Constructor for a Pin node.
3582 * @param *db A pointer for debug information.
3583 * @param *node The node which value should be pinned.
3585 ir_node *new_d_Pin(dbg_info *db, ir_node *node);
3587 /** Constructor for an ASM pseudo node.
3589 * @param *db A pointer for debug information.
3590 * @param arity The number of data inputs to the node.
3591 * @param *in The array of length arity of data inputs.
3592 * @param *inputs The array of length arity of input constraints.
3593 * @param n_outs The number of data outputs to the node.
3594 * @param *outputs The array of length n_outs of output constraints.
3595 * @param n_clobber The number of clobbered registers.
3596 * @param *clobber The array of length n_clobber of clobbered registers.
3597 * @param *asm_text The assembler text.
3599 ir_node *new_d_ASM(dbg_info *db, int arity, ir_node *in[], ir_asm_constraint *inputs,
3600 int n_outs, ir_asm_constraint *outputs,
3601 int n_clobber, ident *clobber[], ident *asm_text);
3603 /*-----------------------------------------------------------------------*/
3604 /* The block oriented interface without debug support */
3605 /*-----------------------------------------------------------------------*/
3607 /* Needed from the interface with debug support:
3608 void set_cur_block (ir_node *target); */
3610 /** Constructor for a Block node.
3612 * Constructor for a Block node. Adds the block to the graph in
3613 * current_ir_graph. Constructs a Block with a fixed number of
3614 * predecessors. Does set current_block. Can be used with automatic
3615 * Phi node construction.
3617 * @param arity The number of control predecessors.
3618 * @param in An array of control predecessors. The length of
3619 * the array must be 'arity'.
3621 ir_node *new_Block(int arity, ir_node *in[]);
3623 /** Constructor for a Start node.
3625 * Adds the node to the block in current_ir_block.
3628 ir_node *new_Start(void);
3630 /** Constructor for an End node.
3632 * Adds the node to the block in current_ir_block.
3634 ir_node *new_End(void);
3636 /** Constructor for an EndReg node.
3638 * Used to represent regular procedure end in interprocedual view.
3639 * Adds the node to the block in current_ir_block.
3641 ir_node *new_EndReg(void);
3643 /** Constructor for an EndExpcept node.
3645 * Used to represent exceptional procedure end in interprocedural view.
3646 * Adds the node to the block in current_ir_block.
3648 ir_node *new_EndExcept(void);
3650 /** Constructor for a Jump node.
3652 * Adds the node to the block in current_ir_block.
3654 * Jmp represents control flow to a single control successor.
3656 ir_node *new_Jmp(void);
3658 /** Constructor for an IJmp node.
3660 * IJmp represents control flow to a single control successor not
3661 * statically known i.e. an indirect Jmp.
3663 * @param *tgt The IR node representing the target address.
3665 ir_node *new_IJmp(ir_node *tgt);
3667 /** Constructor for a Break node.
3668 * Break represents control flow to a single control successor just as Jmp.
3669 * The blocks separated by a break may not be concatenated by an optimization.
3670 * It is used for the interprocedural representation where blocks are parted
3671 * behind Call nodes to represent the control flow to called procedures.
3672 * Adds the node to the block in current_ir_block.
3674 ir_node *new_Break(void);
3676 /** Constructor for a Cond node.
3678 * If c is mode_b represents a conditional branch (if/else). If c is
3679 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
3680 * node, default Proj is 0.). Adds the node to the block in current_ir_block.
3682 * This is not consistent: Input to Cond is Is, Proj has as proj number
3686 * @param *c The conditions parameter.Can be of mode b or I_u.
3688 ir_node *new_Cond(ir_node *c);
3690 /** Constructor for a Return node.
3692 * Returns the memory and zero or more return values. Only node that
3693 * can end regular control flow. Adds the node to the block in current_ir_block.
3695 * @param *store The state of memory.
3696 * @param arity Number of array indices.
3697 * @param *in Array with index inputs to the node.
3699 ir_node *new_Return(ir_node *store, int arity, ir_node *in[]);
3701 /** Constructor for a Const node.
3703 * Constructor for a Const node. The constant represents a target
3704 * value. Sets the type information to type_unknown. (No more
3705 * supported: If tv is entity derives a somehow useful type.)
3706 * Adds the node to the block in current_ir_block.
3707 * Derives mode from passed tarval.
3709 * @param *con Points to an entry in the constant table. This pointer is
3710 * added to the attributes of the node.
3712 ir_node *new_Const(tarval *con);
3715 * Make a const from a long.
3716 * This is just convenience for the usual
3718 * new_Const(mode, tarval_from_long(mode, ...))
3721 * @param mode The mode for the const.
3722 * @param value The value of the constant.
3723 * @return A new const node.
3725 ir_node *new_Const_long(ir_mode *mode, long value);
3727 /** Constructor for a Const node.
3729 * Derives mode from passed tarval. */
3730 ir_node *new_Const_type(tarval *con, ir_type *tp);
3732 /** Constructor for a SymConst node.
3734 * Adds the node to the block in current_ir_block.
3735 * This is the constructor for a symbolic constant.
3736 * There are four kinds of symbolic constants:
3737 * -# type_tag The symbolic constant represents a type tag. The type the
3738 * tag stands for is given explicitly.
3739 * -# size The symbolic constant represents the size of a type. The
3740 * type of which the constant represents the size is given
3742 * -# align The symbolic constant represents the alignment of a type. The
3743 * type of which the constant represents the size is given
3745 * -# addr_name The symbolic constant represents the address of an entity
3746 * (variable or method). The variable is indicated by a name
3747 * that is valid for linking.
3748 * -# addr_ent The symbolic constant represents the address of an entity
3749 * (variable or method). The variable is given explicitly by
3752 * Inputs to the node:
3753 * No inputs except the block it belongs to.
3754 * Outputs of the node.
3755 * An unsigned integer (I_u) or a pointer (P).
3757 * @param mode The mode for the SymConst.
3758 * @param value A type or a ident depending on the SymConst kind.
3759 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3760 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
3761 * @param tp The source type of the constant.
3763 ir_node *new_SymConst_type(ir_mode *mode, union symconst_symbol value, symconst_kind kind, ir_type *tp);
3765 /** Constructor for a SymConst node.
3767 * Adds the node to the block in current_ir_block.
3768 * This is the constructor for a symbolic constant.
3769 * There are four kinds of symbolic constants:
3770 * -# type_tag The symbolic constant represents a type tag. The type the
3771 * tag stands for is given explicitly.
3772 * -# size The symbolic constant represents the size of a type. The
3773 * type of which the constant represents the size is given
3775 * -# align The symbolic constant represents the alignment of a type. The
3776 * type of which the constant represents the size is given
3778 * -# addr_name The symbolic constant represents the address of an entity
3779 * (variable or method). The variable is indicated by a name
3780 * that is valid for linking.
3781 * -# addr_ent The symbolic constant represents the address of an entity
3782 * (variable or method). The variable is given explicitly by
3785 * Inputs to the node:
3786 * No inputs except the block it belongs to.
3787 * Outputs of the node.
3788 * An unsigned integer (I_u) or a pointer (P).
3790 * @param mode The mode for the SymConst.
3791 * @param value A type or a ident depending on the SymConst kind.
3792 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3793 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
3795 ir_node *new_SymConst(ir_mode *mode, union symconst_symbol value, symconst_kind kind);
3797 /** Constructor for a simpelSel node.
3799 * This is a shortcut for the new_Sel() constructor. To be used for
3800 * Sel nodes that do not select from an array, i.e., have no index
3801 * inputs. It adds the two parameters 0, NULL.
3803 * @param *store The memory in which the object the entity should be selected from is allocated.
3804 * @param *objptr The object from that the Sel operation selects a single attribute out.
3805 * @param *ent The entity to select.
3807 ir_node *new_simpleSel(ir_node *store, ir_node *objptr, ir_entity *ent);
3809 /** Constructor for a Sel node.
3811 * The select node selects an entity (field or method) from an entity
3812 * with a compound type. It explicitly specifies the entity selected.
3813 * Dynamically the node may select entities that overwrite the given
3814 * entity. If the selected entity is an array element entity the Sel
3815 * node takes the required array indices as inputs.
3816 * Adds the node to the block in current_ir_block.
3818 * @param *store The memory in which the object the entity should be selected
3819 * from is allocated.
3820 * @param *objptr A pointer to a compound entity the Sel operation selects a
3821 * single attribute from.
3822 * @param arity The number of array indices needed to select an array element entity.
3823 * @param *in[] If the compound entity is an array the indices of the selected
3824 * element entity. The constructor copies this array.
3825 * @param *ent The entity to select.
3827 ir_node *new_Sel(ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3830 /** Constructor for a Call node.
3832 * Adds the node to the block in current_ir_block.
3833 * Represents all kinds of method and function calls.
3835 * @param *store The actual store.
3836 * @param *callee A pointer to the called procedure.
3837 * @param arity The number of procedure parameters.
3838 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3839 * @param *tp Type information of the procedure called.
3841 ir_node *new_Call(ir_node *store, ir_node *callee, int arity, ir_node *in[],
3844 /** Constructor for a Builtin node.
3846 * Represents a call of a backend-specific builtin..
3847 * Represents all kinds of method and function calls.
3849 * @param *store The actual store.
3850 * @param kind The kind of the called builtin.
3851 * @param arity The number of procedure parameters.
3852 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3853 * @param *tp Type information of the procedure called.
3855 ir_node *new_Builtin(ir_node *store, int arity, ir_node *in[],
3856 ir_builtin_kind kind, ir_type *tp);
3858 /** Constructor for a CallBegin node.
3860 * CallBegin represents control flow depending of the pointer value
3861 * representing the called method to the called methods. The
3862 * constructor copies the method pointer input from the passed Call
3863 * node. Adds the node to the block in current_ir_block.
3865 * @param *callee A pointer to the called procedure.
3867 ir_node *new_CallBegin(ir_node *ptr, ir_node *call);
3869 /** Constructor for a Add node.
3871 * Adds the node to the block in current_ir_block.
3873 * @param *op1 The first operand.
3874 * @param *op2 The second operand.
3875 * @param *mode The mode of the operands and the result.
3877 ir_node *new_Add(ir_node *op1, ir_node *op2, ir_mode *mode);
3879 /** Constructor for a Sub node.
3881 * Adds the node to the block in current_ir_block.
3883 * @param *op1 The first operand.
3884 * @param *op2 The second operand.
3885 * @param *mode The mode of the operands and the result.
3887 ir_node *new_Sub(ir_node *op1, ir_node *op2, ir_mode *mode);
3889 /** Constructor for a Minus node.
3891 * Adds the node to the block in current_ir_block.
3893 * @param *op The operand .
3894 * @param *mode The mode of the operand and the result.
3896 ir_node *new_Minus(ir_node *op, ir_mode *mode);
3899 * Constructor for a Mul node. Adds the node to the block in current_ir_block.
3901 * @param *op1 The first operand.
3902 * @param *op2 The second operand.
3903 * @param *mode The mode of the operands and the result.
3905 ir_node *new_Mul(ir_node *op1, ir_node *op2, ir_mode *mode);
3908 * Constructor for a Mulh node. Adds the node to the block in current_ir_block.
3910 * @param *op1 The first operand.
3911 * @param *op2 The second operand.
3912 * @param *mode The mode of the operands and the result.
3914 ir_node *new_Mulh(ir_node *op1, ir_node *op2, ir_mode *mode);
3916 /** Constructor for a Quot node.
3918 * Adds the node to the block in current_ir_block.
3920 * @param *memop The store needed to model exceptions
3921 * @param *op1 The first operand.
3922 * @param *op2 The second operand.
3923 * @param *mode The mode of the result.
3924 * @param state The pinned state.
3926 ir_node *new_Quot(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3928 /** Constructor for a DivMod node.
3930 * Adds the node to the block in current_ir_block.
3932 * @param *memop The store needed to model exceptions
3933 * @param *op1 The first operand.
3934 * @param *op2 The second operand.
3935 * @param *mode The mode of the results.
3936 * @param state The pinned state.
3938 ir_node *new_DivMod(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3940 /** Constructor for a Div node.
3942 * Adds the node to the block in current_ir_block.
3944 * @param *memop The store needed to model exceptions
3945 * @param *op1 The first operand.
3946 * @param *op2 The second operand.
3947 * @param *mode The mode of the result.
3948 * @param state The pinned state.
3950 ir_node *new_Div(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3952 /** Constructor for a remainderless Div node.
3954 * Adds the node to the block in current_ir_block.
3956 * @param *memop The store needed to model exceptions
3957 * @param *op1 The first operand.
3958 * @param *op2 The second operand.
3959 * @param *mode The mode of the result.
3960 * @param state The pinned state.
3962 ir_node *new_DivRL(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3964 /** Constructor for a Mod node.
3966 * Adds the node to the block in current_ir_block.
3968 * @param *memop The store needed to model exceptions
3969 * @param *op1 The first operand.
3970 * @param *op2 The second operand.
3971 * @param *mode The mode of the result.
3972 * @param state The pinned state.
3974 ir_node *new_Mod(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3976 /** Constructor for a Abs node.
3978 * Adds the node to the block in current_ir_block.
3980 * @param *op The operand
3981 * @param *mode The mode of the operands and the result.
3983 ir_node *new_Abs(ir_node *op, ir_mode *mode);
3985 /** Constructor for a And node.
3987 * Adds the node to the block in current_ir_block.
3989 * @param *op1 The first operand.
3990 * @param *op2 The second operand.
3991 * @param *mode The mode of the operands and the result.
3993 ir_node *new_And(ir_node *op1, ir_node *op2, ir_mode *mode);
3996 * Constructor for a Or node. Adds the node to the block in current_ir_block.
3998 * @param *op1 The first operand.
3999 * @param *op2 The second operand.
4000 * @param *mode The mode of the operands and the result.
4002 ir_node *new_Or(ir_node *op1, ir_node *op2, ir_mode *mode);
4005 * Constructor for a Eor node. Adds the node to the block in current_ir_block.
4007 * @param *op1 The first operand.
4008 * @param *op2 The second operand.
4009 * @param *mode The mode of the operands and the results.
4011 ir_node *new_Eor(ir_node *op1, ir_node *op2, ir_mode *mode);
4013 /** Constructor for a Not node.
4015 * Adds the node to the block in current_ir_block.
4017 * @param *op The operand.
4018 * @param *mode The mode of the operand and the result.
4020 ir_node *new_Not(ir_node *op, ir_mode *mode);
4022 /** Constructor for a Shl node.
4024 * Adds the node to the block in current_ir_block.
4026 * @param *op The operand.
4027 * @param *k The number of bits to shift the operand .
4028 * @param *mode The mode of the operand and the result.
4030 ir_node *new_Shl(ir_node *op, ir_node *k, ir_mode *mode);
4033 * Constructor for a Shr node. Adds the node to the block in current_ir_block.
4035 * @param *op The operand.
4036 * @param *k The number of bits to shift the operand .
4037 * @param *mode The mode of the operand and the result.
4039 ir_node *new_Shr(ir_node *op, ir_node *k, ir_mode *mode);
4041 /** Constructor for a Shrs node.
4043 * Adds the node to the block in current_ir_block.
4045 * @param *op The operand.
4046 * @param *k The number of bits to shift the operand .
4047 * @param *mode The mode of the operand and the result.
4049 ir_node *new_Shrs(ir_node *op, ir_node *k, ir_mode *mode);
4051 /** Constructor for a Rotl node.
4053 * Adds the node to the block in current_ir_block.
4055 * @param *op The operand.
4056 * @param *k The number of bits to rotate the operand.
4057 * @param *mode The mode of the operand.
4059 ir_node *new_Rotl(ir_node *op, ir_node *k, ir_mode *mode);
4061 /** Constructor for a Cmp node.
4063 * Adds the node to the block in current_ir_block.
4065 * @param *op1 The first operand.
4066 * @param *op2 The second operand.
4068 ir_node *new_Cmp(ir_node *op1, ir_node *op2);
4070 /** Constructor for a Conv node.
4072 * Adds the node to the block in current_ir_block.
4074 * @param *op The operand.
4075 * @param *mode The mode of this the operand muss be converted.
4077 ir_node *new_Conv(ir_node *op, ir_mode *mode);
4079 /** Constructor for a strict Conv node.
4081 * Adds the node to the block in current_ir_block.
4083 * @param *op The operand.
4084 * @param *mode The mode of this the operand muss be converted.
4086 ir_node *new_strictConv(ir_node *op, ir_mode *mode);
4088 /** Constructor for a Cast node.
4090 * Adds the node to the block in current_ir_block.
4091 * High level type cast
4093 * @param *op The operand.
4094 * @param *to_tp The type of this the operand muss be casted .
4096 ir_node *new_Cast(ir_node *op, ir_type *to_tp);
4098 /** Constructor for a Carry node.
4100 * Adds the node to the block in current_ir_block.
4102 * @param *op1 The first operand.
4103 * @param *op2 The second operand.
4104 * @param *mode The mode of the operands and the result.
4106 ir_node *new_Carry(ir_node *op1, ir_node *op2, ir_mode *mode);
4108 /** Constructor for a Borrow node.
4110 * Adds the node to the block in current_ir_block.
4112 * @param *op1 The first operand.
4113 * @param *op2 The second operand.
4114 * @param *mode The mode of the operands and the result.
4116 ir_node *new_Borrow(ir_node *op1, ir_node *op2, ir_mode *mode);
4118 /** Constructor for a Phi node.
4120 * Adds the node to the block in current_ir_block.
4122 * @param arity The number of predecessors.
4123 * @param *in Array with predecessors.
4124 * @param *mode The mode of it's inputs and output.
4126 ir_node *new_Phi(int arity, ir_node *in[], ir_mode *mode);
4128 /** Constructor for a Load node.
4130 * @param *store The current memory.
4131 * @param *addr A pointer to the variable to be read in this memory.
4132 * @param *mode The mode of the value to be loaded.
4133 * @param flags Additional flags for alignment, volatility and pin state.
4135 ir_node *new_Load(ir_node *store, ir_node *addr, ir_mode *mode, ir_cons_flags flags);
4137 /** Constructor for a Store node.
4139 * @param *store The current memory.
4140 * @param *addr A pointer to the variable to be read in this memory.
4141 * @param *val The value to write to this variable.
4142 * @param flags Additional flags for alignment, volatility and pin state.
4144 ir_node *new_Store(ir_node *store, ir_node *addr, ir_node *val, ir_cons_flags flags);
4146 /** Constructor for a Alloc node.
4148 * The Alloc node extends the memory by space for an entity of type alloc_type.
4149 * Adds the node to the block in current_ir_block.
4151 * @param *store The memory which shall contain the new variable.
4152 * @param *count The number of objects to allocate.
4153 * @param *alloc_type The type of the allocated variable.
4154 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
4156 ir_node *new_Alloc(ir_node *store, ir_node *count, ir_type *alloc_type,
4157 ir_where_alloc where);
4159 /** Constructor for a Free node.
4161 * Frees the memory occupied by the entity pointed to by the pointer
4162 * arg. Type indicates the type of the entity the argument points to.
4163 * Adds the node to the block in current_ir_block.
4165 * @param *store The memory which shall contain the new variable.
4166 * @param *ptr The pointer to the object to free.
4167 * @param *size The number of objects of type free_type to free in a sequence.
4168 * @param *free_type The type of the freed variable.
4169 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
4171 ir_node *new_Free(ir_node *store, ir_node *ptr, ir_node *size,
4172 ir_type *free_type, ir_where_alloc where);
4174 /** Constructor for a Sync node.
4176 * Merges several memory values. The node assumes that a variable
4177 * either occurs only in one of the memories, or it contains the same
4178 * value in all memories where it occurs.
4179 * Adds the node to the block in current_ir_block.
4181 * @param arity The number of memories to synchronize.
4182 * @param **in An array of pointers to nodes that produce an output of type
4183 * memory. The constructor copies this array.
4185 ir_node *new_Sync(int arity, ir_node *in[]);
4187 /** Constructor for a Proj node.
4189 * Projects a single value out of a tuple. The parameter proj gives the
4190 * position of the value within the tuple.
4191 * Adds the node to the block in current_ir_block.
4193 * @param arg A node producing a tuple.
4194 * @param *mode The mode of the value to project.
4195 * @param proj The position of the value in the tuple.
4197 ir_node *new_Proj(ir_node *arg, ir_mode *mode, long proj);
4199 /** Constructor for a Filter node.
4201 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
4202 * Filter is a node with two views used to construct the interprocedural view.
4203 * In intraprocedural view its semantics are identical to the Proj node.
4204 * In interprocedural view the Filter performs the Phi operation on method
4205 * parameters or results. Other than a Phi a Filter node may not be removed
4206 * if it has only a single input.
4208 * The constructor builds the Filter in intraprocedural view.
4210 * @param *arg The tuple value to project from.
4211 * @param *mode The mode of the projected value.
4212 * @param proj The position in the tuple to project from.
4214 ir_node *new_Filter(ir_node *arg, ir_mode *mode, long proj);
4216 /** Constructor for a defaultProj node.
4218 * Represents the default control flow of a Switch-Cond node.
4219 * Adds the node to the block in current_ir_block.
4221 * @param arg A node producing a tuple.
4222 * @param max_proj The end position of the value in the tuple.
4224 ir_node *new_defaultProj(ir_node *arg, long max_proj);
4226 /** Constructor for a Tuple node.
4228 * This is an auxiliary node to replace a node that returns a tuple
4229 * without changing the corresponding Proj nodes.
4230 * Adds the node to the block in current_ir_block.
4232 * @param arity The number of tuple elements.
4233 * @param **in An array containing pointers to the nodes producing the tuple elements.
4235 ir_node *new_Tuple(int arity, ir_node *in[]);
4237 /** Constructor for an Id node.
4239 * This is an auxiliary node to replace a node that returns a single
4240 * value. Adds the node to the block in current_ir_block.
4242 * @param *val The operand to Id.
4243 * @param *mode The mode of *val.
4245 ir_node *new_Id(ir_node *val, ir_mode *mode);
4247 /** Constructor for a Bad node.
4249 * Returns the unique Bad node of the graph. The same as
4252 ir_node *new_Bad(void);
4254 /** Constructor for a Confirm node.
4256 * Specifies constraints for a value. To support dataflow analyses.
4257 * Adds the node to the block in current_ir_block.
4259 * Example: If the value never exceeds '100' this is expressed by placing a
4260 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
4262 * @param *val The value we express a constraint for
4263 * @param *bound The value to compare against. Must be a firm node, typically a constant.
4264 * @param cmp The compare operation.
4266 ir_node *new_Confirm(ir_node *val, ir_node *bound, pn_Cmp cmp);
4268 /** Constructor for an Unknown node.
4270 * Represents an arbitrary value. Places the node in
4273 * @param *m The mode of the unknown value.
4275 ir_node *new_Unknown(ir_mode *m);
4277 /** Constructor for a NoMem node.
4279 * Returns the unique NoMem node of the graph. The same as
4282 ir_node *new_NoMem(void);
4284 /** Constructor for a Mux node.
4286 * Adds the node to the block in current_ir_block.
4288 * @param *sel The ir_node that calculates the boolean select.
4289 * @param *ir_true The ir_node that calculates the true result.
4290 * @param *ir_false The ir_node that calculates the false result.
4291 * @param *mode The mode of the node (and it_true and ir_false).
4293 ir_node *new_Mux(ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
4295 /** Constructor for a CopyB node.
4297 * Adds the node to the block in current_ir_block.
4299 * @param *store The current memory
4300 * @param *dst The ir_node that represents the destination address.
4301 * @param *src The ir_node that represents the source address.
4302 * @param *data_type The type of the copied data
4304 ir_node *new_CopyB(ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
4306 /** Constructor for a InstOf node.
4308 * A High-Level Type check.
4310 * @param *store The memory in which the object the entity should be selected
4311 * from is allocated.
4312 * @param *objptr A pointer to a object of a class type.
4313 * @param *type The type of which objptr must be.
4315 ir_node *new_InstOf(ir_node *store, ir_node *objptr, ir_type *type);
4317 /**Constructor for a Raise node.
4319 * A High-Level Exception throw.
4321 * @param *store The current memory.
4322 * @param *obj A pointer to the Except variable.
4324 ir_node *new_Raise(ir_node *store, ir_node *obj);
4326 /** Constructor for a Bound node.
4328 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
4330 * Adds the node to the block in current_ir_block.
4332 * @param *store The current memory
4333 * @param *idx The ir_node that represents an index.
4334 * @param *lower The ir_node that represents the lower bound for the index.
4335 * @param *upper The ir_node that represents the upper bound for the index.
4337 ir_node *new_Bound(ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
4339 /** Constructor for a Pin node.
4341 * @param *node The node which value should be pinned.
4343 ir_node *new_Pin(ir_node *node);
4345 /** Constructor for an ASM pseudo node.
4347 * @param arity The number of data inputs to the node.
4348 * @param *in The array of length arity of data inputs.
4349 * @param *inputs The array of length arity of input constraints.
4350 * @param n_outs The number of data outputs to the node.
4351 * @param *outputs The array of length n_outs of output constraints.
4352 * @param n_clobber The number of clobbered registers.
4353 * @param *clobber The array of length n_clobber of clobbered registers.
4354 * @param *asm_text The assembler text.
4356 ir_node *new_ASM(int arity, ir_node *in[], ir_asm_constraint *inputs,
4357 int n_outs, ir_asm_constraint *outputs,
4358 int n_clobber, ident *clobber[], ident *asm_text);
4360 /** Constructor for a Dummy node.
4362 * @param *mode The mode of the node.
4364 ir_node *new_Dummy(ir_mode *mode);
4366 ir_node *new_r_Dummy(ir_graph *irg, ir_mode *mode);
4368 ir_node *new_rd_Dummy(dbg_info *db, ir_graph *irg, ir_mode *mode);
4370 /*---------------------------------------------------------------------*/
4371 /* The comfortable interface. */
4372 /* Supports automatic Phi node construction. */
4373 /* All routines of the block oriented interface except new_Block are */
4375 /*---------------------------------------------------------------------*/
4377 /** Create an immature Block.
4379 * An immature Block has an unknown number of predecessors. Predecessors
4380 * can be added with add_immBlock_pred(). Once all predecessors are
4381 * added the block must be matured.
4383 * Adds the block to the graph in current_ir_graph. Can be used with automatic
4384 * Phi node construction.
4385 * This constructor can only be used if the graph is in state_building.
4387 ir_node *new_d_immBlock(dbg_info *db);
4388 ir_node *new_immBlock(void);
4390 /** Create an immature PartBlock.
4392 * An immature block has only one Block or PartBlock predecessor.
4393 * A PartBlock forms together with one BLock and possibly other
4394 * PartBlocks a MacroBlock.
4396 * Adds the PartBlock to the graph in current_ir_graph. Does set
4397 * current_block. Can be used with automatic Phi node construction.
4398 * This constructor can only be used if the graph is in
4401 ir_node *new_d_immPartBlock(dbg_info *db, ir_node *pred_jmp);
4402 ir_node *new_immPartBlock(ir_node *pred_jmp);
4404 /** Add a control flow edge to an immature block. */
4405 void add_immBlock_pred(ir_node *immblock, ir_node *jmp);
4407 /** Finalize a Block node, when all control flows are known. */
4408 void mature_immBlock(ir_node *block);
4409 #define mature_cur_block() mature_immBlock(get_cur_block());
4412 /** Get the current value of a local variable.
4414 * Use this function to obtain the last definition of the local variable
4415 * associated with pos. Pos may not exceed the value passed as n_loc
4416 * to new_ir_graph. This call automatically inserts Phi nodes.
4418 * @param *db A pointer for debug information.
4419 * @param pos The position/id of the local variable.
4420 * @param *mode The mode of the value to get.
4422 ir_node *get_d_value(dbg_info *db, int pos, ir_mode *mode);
4423 ir_node *get_value(int pos, ir_mode *mode);
4425 /** Remark a new definition of a variable.
4427 * Use this function to remember a new definition of the value
4428 * associated with pos. Pos may not exceed the value passed as n_loc
4429 * to new_ir_graph. This call is needed to automatically inserts Phi
4432 * @param pos The position/id of the local variable.
4433 * @param *value The new value written to the local variable.
4435 void set_value(int pos, ir_node *value);
4437 /** Find the value number for a node in the current block.
4439 * This function searches all values in the current block for
4440 * a given value and returns its value number if it was found, else
4442 * Note that this does not mean that the value does not exists,
4443 * it's just not equal the node (for instance behind a Phi/Confirm ...)
4445 * @param *value The value to find.
4447 int find_value(ir_node *value);
4449 /** Get the current memory state.
4451 * Use this function to obtain the last definition of the memory
4452 * state. This call automatically inserts Phi nodes for the memory
4455 ir_node *get_store(void);
4457 /** Remark a new definition of the memory state.
4459 * Use this function to remember a new definition of the memory state.
4460 * This call is needed to automatically inserts Phi nodes.
4462 * @param *store The new memory state.
4464 void set_store(ir_node *store);
4466 /** keep this node alive even if End is not control-reachable from it
4468 * @param ka The node to keep alive.
4470 void keep_alive(ir_node *ka);
4472 /** Returns the frame type of the current graph */
4473 ir_type *get_cur_frame_type(void);
4476 /* --- initialize and finalize IR construction --- */
4478 /** Puts the graph into state "phase_high" */
4479 #define irg_finalize_cons(irg) set_irg_phase_state(irg, phase_high)
4481 /** Puts the program and all graphs into state phase_high.
4483 * This also remarks, the construction of types is finished,
4484 * e.g., that no more subtypes will be added. */
4485 void irp_finalize_cons(void);
4487 /* --- Initialization --- */