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 * Const nodes are always added to the start block.
331 * All other constructors add the created node to the current_block.
332 * swich_block(block) allows to set the current block to block.
334 * Watch for my inconsistent use of input and predecessor (dataflow view)
335 * and `the node points to' (implementation view).
337 * The following description of the nodes lists four properties them if these
339 * - the parameters to the constructor
340 * - the inputs of the Firm node
341 * - the outputs of the Firm node
342 * - attributes to the node
346 * ir_node *new_immBlock (void)
347 * ----------------------------
349 * Creates a new block. When a new block is created it cannot be known how
350 * many predecessors this block will have in the control flow graph.
351 * Therefore the list of inputs can not be fixed at creation. Predecessors
352 * can be added with add_immBlock_pred (block, control flow operation).
353 * With every added predecessor the number of inputs to Phi nodes also
356 * The block can be completed by mature_immBlock(block) if all predecessors are
357 * known. If several blocks are built at once, mature_immBlock can only be called
358 * after set_value has been called for all values that are life at the end
359 * of the block. This is necessary so that Phi nodes created mature_immBlock
360 * get the right predecessors in case of cyclic dependencies. If all set_values
361 * of this block are called after maturing it and before calling get_value
362 * in some block that is control flow dependent on this block, the construction
365 * Example for faulty IR construction: (draw the graph on a paper and you'll
368 * block_before_loop = new_immBlock();
369 * set_cur_block(block_before_loop);
371 * mature_immBlock(block_before_loop);
372 * before2header = new_Jmp;
374 * loop_header = new_immBlock ();
375 * set_cur_block(loop_header);
376 * header2body - new_Jmp();
378 * loop_body = new_immBlock ();
379 * set_cur_block(loop_body);
380 * body2header = new_Jmp();
382 * add_immBlock_pred(loop_header, before2header);
383 * add_immBlock_pred(loop_header, body2header);
384 * add_immBlock_pred(loop_body, header2body);
386 * mature_immBlock(loop_header);
387 * mature_immBlock(loop_body);
389 * get_value(loop_body, x); // gets the Phi in loop_header
390 * set_value(loop_header, x); // sets the value the above get_value should
391 * // have returned!!!
393 * Mature_immBlock also fixes the number of inputs to the Phi nodes. Mature_immBlock
394 * should be called as early as possible, as afterwards the generation of Phi
395 * nodes is more efficient.
398 * There is an input for each control flow predecessor of the block.
399 * The input points to an instruction producing an output of type X.
400 * Possible predecessors: Start, Jmp, Cond, Raise or Return or any node
401 * possibly causing an exception. (Often the real predecessors are Projs.)
403 * Mode BB (R), all nodes belonging to this block should consume this output.
404 * As they are strict (except Block and Phi node) it is a necessary condition
405 * that the block node executed before any other node in this block executes.
407 * block.matured Indicates whether the block is mature.
409 * This attribute contains all local values valid in this
410 * block. This is needed to build the Phi nodes and removed
411 * if the graph is complete. This field is used by the
412 * internal construction algorithm and should not be accessed
416 * ir_node *new_Block (int arity, ir_node **in)
417 * --------------------------------------------
419 * Creates a new Block with the given list of predecessors. This block
420 * is mature. As other constructors calls optimization and vrfy for the
421 * block. If one of the predecessors is Unknown (as it has to be filled in
422 * later) optimizations are skipped. This is necessary to
423 * construct Blocks in loops. Leaving Unknown in the Block after finishing
424 * the construction may have strange effects, especially for interprocedural
425 * representation and analysis.
428 * CONTROL FLOW OPERATIONS
429 * -----------------------
431 * In each block there must be exactly one of the control flow
432 * operations Start, End, Jmp, Cond, Return or Raise. The output of a
433 * control flow operation points to the block to be executed next.
435 * ir_node *new_Start (void)
436 * -------------------------
438 * Creates a start node. Not actually needed public. There is only one such
439 * node in each procedure which is automatically created by new_ir_graph.
442 * No inputs except the block it belogns to.
444 * A tuple of 4 (5, 6) distinct values. These are labeled by the following
445 * projection numbers (pn_Start):
446 * * pn_Start_X_initial_exec mode X, points to the first block to be exe * cuted.
447 * * pn_Start_M mode M, the global store
448 * * pn_Start_P_frame_base mode P, a pointer to the base of the proce * dures stack frame.
449 * * pn_Start_P_globals mode P, a pointer to the part of the memory * containing_all_ global things.
450 * * pn_Start_T_args mode T, a tuple containing all arguments of * the procedure.
453 * ir_node *new_End (void)
454 * -----------------------
456 * Creates an end node. Not actually needed public. There is only one such
457 * node in each procedure which is automatically created by new_ir_graph.
460 * No inputs except the block it belongs to.
464 * ir_node *new_Jmp (void)
465 * -----------------------
467 * Creates a Jmp node.
470 * The block the node belongs to
472 * Control flow to the next block.
474 * ir_node *new_IJmp (ir_node *tgt)
475 * -----------------------
477 * Creates an IJmp node.
480 * The node that represents the target jump address
482 * Control flow to an unknown target, must be pinned by
485 * ir_node *new_Cond (ir_node *c)
486 * ------------------------------
488 * Creates a Cond node. There are two versions of this node.
494 * A tuple of two control flows. The first is taken if the input is
495 * false, the second if it is true.
499 * A value of mode I_u. (i)
501 * A tuple of n control flows. If the Cond's input is i, control
502 * flow will procede along output i. If the input is >= n control
503 * flow proceeds along output n.
505 * ir_node *new_Return (ir_node *store, int arity, ir_node **in)
506 * -------------------------------------------------------------
508 * The return node has as inputs the results of the procedure. It
509 * passes the control flow to the end_block.
515 * Control flow to the end block.
519 * ir_node *new_Const (tarval *con)
520 * -----------------------------------------------
522 * Creates a constant in the constant table and adds a Const node
523 * returning this value to the start block. The mode is derived
527 * *con Points to an entry in the constant table.
528 * This pointer is added to the attributes of
529 * the node (self->attr.con)
531 * No inputs except the block it belogns to.
533 * The constant value.
535 * attr.con A tarval* pointer to the proper entry in the constant
538 * ir_node *new_SymConst (ir_mode *mode, union symconst_symbol value, symconst_addr_ent kind)
539 * -----------------------------------------------------------------------------------------
541 * There are several symbolic constants:
542 * symconst_type_tag The symbolic constant represents a type tag.
543 * symconst_type_size The symbolic constant represents the size of a type.
544 * symconst_type_align The symbolic constant represents the alignment of a type.
545 * symconst_addr_ent The symbolic constant represents the address of an entity.
546 * symconst_ofs_ent The symbolic constant represents the offset of an
547 * entity in its owner type.
548 * symconst_enum_const The symbolic constant is a enumeration constant of an
552 * mode P for SymConsts representing addresses, Iu otherwise.
553 * value The type, ident, entity or enum constant, depending on the
555 * kind The kind of the symbolic constant, see the list above.
558 * No inputs except the block it belongs to.
560 * A symbolic constant.
563 * attr.i.num The symconst_addr_ent, i.e. one of
565 * -symconst_type_size
566 * -symconst_type_align
569 * If the attr.i.num is symconst_type_tag, symconst_type_size or symconst_type_align,
570 * the node contains an attribute:
572 * attr.i.*type, a pointer to a type_class.
573 * if it is linkage_ptr_info it contains
574 * attr.i.*ptrinfo, an ident holding information for the linker.
578 * ir_node *new_simpleSel (ir_node *store, ir_node *frame, ir_entity *sel)
579 * -----------------------------------------------------------------------
582 * Selects an entity from a compound type. This entity can be a field or
586 * *store The memory in which the object the entity should be selected
588 * *frame The pointer to the object.
589 * *sel The entity to select.
592 * The memory containing the object.
593 * A pointer to the object.
594 * An unsigned integer.
596 * A pointer to the selected entity.
598 * attr.sel Pointer to the entity
601 * ir_node *new_Sel (ir_node *store, ir_node *frame, int arity, ir_node **in,
602 * --------------------------------------------------------------------------
606 * Selects a field from an array type. The entity has as owner the array, as
607 * type the arrays element type. The indices to access an array element are
611 * *store The memory in which the object the entity should be selected from
613 * *frame The pointer to the object.
614 * *arity number of array indices.
615 * *in array with index inputs to the node.
616 * *sel The entity to select.
619 * The memory containing the object.
620 * A pointer to the object.
621 * As much unsigned integer as there are array expressions.
623 * A pointer to the selected entity.
625 * attr.sel Pointer to the entity
627 * The constructors new_Sel and new_simpleSel generate the same IR nodes.
628 * simpleSel just sets the arity of the index inputs to zero.
631 * ARITHMETIC OPERATIONS
632 * ---------------------
634 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node **in,
635 * ----------------------------------------------------------------------------
639 * Creates a procedure call.
642 * *store The actual store.
643 * *callee A pointer to the called procedure.
644 * arity The number of procedure parameters.
645 * **in An array with the pointers to the parameters.
646 * The constructor copies this array.
647 * *type Type information of the procedure called.
650 * The store, the callee and the parameters.
652 * A tuple containing the eventually changed store and the procedure
655 * attr.call Contains the attributes for the procedure.
657 * ir_node *new_Builtin(ir_node *store, ir_builtin_kind kind, int arity, ir_node **in,
658 * -----------------------------------------------------------------------------------
662 * Creates a builtin call.
665 * *store The actual store.
666 * kind Describes the called builtin.
667 * arity The number of procedure parameters.
668 * **in An array with the pointers to the parameters.
669 * The constructor copies this array.
670 * *type Type information of the procedure called.
673 * The store, the kind and the parameters.
675 * A tuple containing the eventually changed store and the procedure
678 * attr.builtin Contains the attributes for the called builtin.
680 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode)
681 * ------------------------------------------------------------
685 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode)
686 * ------------------------------------------------------------
690 * ir_node *new_Minus (ir_node *op, ir_mode *mode)
691 * -----------------------------------------------
693 * Unary Minus operations on integer and floating point values.
695 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode)
696 * ------------------------------------------------------------
700 * ir_node *new_Mulh (ir_node *op1, ir_node *op2, ir_mode *mode)
701 * ------------------------------------------------------------
703 * Returns the high order bits of a n*n=2n multiplication.
705 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state)
706 * -------------------------------------------------------------------------------------------------
708 * Quot performs exact division of floating point numbers. It's mode
709 * is Tuple, the mode of the result must match the Proj mode
710 * that extracts the result of the arithmetic operations.
713 * The store needed to model exceptions and the two operands.
715 * A tuple containing a memory and a execution for modeling exceptions
716 * and the result of the arithmetic operation.
718 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state)
719 * ---------------------------------------------------------------------------------------------------
721 * Performs Div and Mod on integer values.
724 * A tuple containing a memory and a execution for modeling exceptions
725 * and the two result of the arithmetic operations.
727 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state)
728 * ------------------------------------------------------------------------------------------------
732 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state)
733 * ------------------------------------------------------------------------------------------------
737 * ir_node *new_Abs (ir_node *op, ir_mode *mode)
738 * ---------------------------------------------
742 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode)
743 * ------------------------------------------------------------
747 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode)
748 * -----------------------------------------------------------
752 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode)
753 * ------------------------------------------------------------
757 * ir_node *new_Not (ir_node *op, ir_mode *mode)
758 * ---------------------------------------------
760 * This node constructs a constant where all bits are set to one
761 * and a Eor of this constant and the operator. This simulates a
764 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode)
765 * ---------------------------------------------------------
769 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode)
770 * ---------------------------------------------------------
772 * Logic shift right, i.e., zero extended.
775 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode)
776 * ----------------------------------------------------------
778 * Arithmetic shift right, i.e., sign extended.
780 * ir_node *new_Rotl (ir_node *op, ir_node *k, ir_mode *mode)
781 * ---------------------------------------------------------
783 * Rotates the operand to the left by k bits.
785 * ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode)
786 * ------------------------------------------------------------
788 * Calculates the Carry value for integer addition. Used only
791 * ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode)
792 * ------------------------------------------------------------
794 * Calculates the Borrow value for integer substraction. Used only
797 * ir_node *new_Conv (ir_node *op, ir_mode *mode)
798 * ---------------------------------------------
800 * Mode conversion. For allowed conversions see UKA Tech Report
803 * ir_node *new_Cmp (ir_node *op1, ir_node *op2)
804 * ---------------------------------------------
807 * The two values to be compared.
809 * A 16-tuple containing the results of the 16 different comparisons.
810 * The following is a list giving the comparisons and a projection
811 * number (pn_Cmp) to use in Proj nodes to extract the proper result.
815 * pn_Cmp_Le less or equal
817 * pn_Cmp_Ge greater of equal
818 * pn_Cmp_Lg less or greater
819 * pn_Cmp_Leg less, equal or greater = ordered
820 * pn_Cmp_Uo unordered
821 * pn_Cmp_Ue unordered or equal
822 * pn_Cmp_Ul unordered or less
823 * pn_Cmp_Ule unordered, less or equal
824 * pn_Cmp_Ug unordered or greater
825 * pn_Cmp_Uge unordered, greater or equal
826 * pn_Cmp_Ne unordered, less or greater = not equal
833 * In general, Phi nodes are automaitcally inserted. In some cases, if
834 * all predecessors of a block are known, an explicit Phi node constructor
835 * is needed. E.g., to construct a FIRM graph for a statement as
836 * a = (b==c) ? 2 : 5;
838 * ir_node *new_Phi (int arity, ir_node **in, ir_mode *mode)
839 * ---------------------------------------------------------
841 * Creates a Phi node. The in's order has to correspond to the order
842 * of in's of current_block. This is not checked by the library!
843 * If one of the predecessors is Unknown (as it has to be filled in
844 * later) optimizations are skipped. This is necessary to
845 * construct Phi nodes in loops. Leaving Unknown in the Phi after finishing
846 * the construction may have strange effects, especially for interprocedural
847 * representation and analysis.
850 * arity number of predecessors
851 * **in array with predecessors
852 * *mode The mode of it's inputs and output.
854 * A Phi node has as many inputs as the block it belongs to.
855 * Each input points to a definition of the same value on a
856 * different path in the control flow.
858 * The definition valid in this block.
860 * ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode)
861 * -----------------------------------------------------------------------------------
863 * Creates a Mux node. This node implements the following semantic:
864 * If the sel node (which must be of mode_b) evaluates to true, its value is
865 * ir_true, else ir_false;
869 * OPERATIONS TO MANAGE MEMORY EXPLICITLY
870 * --------------------------------------
872 * ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode, ir_cons_flags flags)
873 * -------------------------------------------------------------------------------------
875 * The Load operation reads a value from memory.
878 * *store The current memory.
879 * *addr A pointer to the variable to be read in this memory.
880 * *mode The mode of the value to be loaded.
881 * flags Additional flags for alignment, volatility and pin state.
884 * The memory and a pointer to a variable in this memory.
886 * A tuple of the memory, a control flow to be taken in case of
887 * an exception and the loaded value.
889 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val, ir_cons_flags flags)
890 * -------------------------------------------------------------------------------------
892 * The Store operation writes a value to a variable in memory.
895 * The memory, a pointer to a variable in this memory and the value
896 * to write to this variable.
898 * A tuple of the changed memory and a control flow to be taken in
899 * case of an exception.
901 * ir_node *new_Alloc (ir_node *store, ir_node *count, ir_type *alloc_type,
902 * -----------------------------------------------------------------------
906 * The Alloc node allocates a new variable. It can be specified whether the
907 * variable should be allocated to the stack or to the heap.
910 * *store The memory which shall contain the new variable.
911 * *count This field is for allocating arrays, i.e., it gives the multiple
912 * of the size of alloc_type to allocate memory for.
913 * *alloc_type The type of the allocated variable.
914 * where Where to allocate the variable, either heap_alloc or stack_alloc.
917 * A memory and an unsigned integer.
919 * A tuple of the changed memory, a control flow to be taken in
920 * case of an exception and the pointer to the new variable.
922 * a.where Indicates where the variable is allocated.
923 * a.*type A pointer to the class the allocated data object
926 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size, ir_type *free_type,
927 * -----------------------------------------------------------------------------------
931 * The Free node frees memory of the given variable.
934 * *store The memory which shall contain the new variable.
935 * *ptr The pointer to the object to free.
936 * *size The number of objects of type free_type to free in a sequence.
937 * *free_type The type of the freed variable.
938 * where Where the variable was allocated, either heap_alloc or stack_alloc.
941 * A memory, a pointer and an unsigned integer.
943 * The changed memory.
945 * f.*type A pointer to the type information of the freed data object.
949 * ir_node *new_Sync (int arity, ir_node **in)
950 * -------------------------------------------
952 * The Sync operation unifies several partial memory blocks. These blocks
953 * have to be pairwise disjunct or the values in common locations have to
954 * be identical. This operation allows to specify all operations that eventually
955 * need several partial memory blocks as input with a single entrance by
956 * unifying the memories with a preceding Sync operation.
959 * arity The number of memories to synchronize.
960 * **in An array of pointers to nodes that produce an output of
965 * The unified memory.
971 * ir_node *new_Bad (void)
972 * -----------------------
974 * Returns the unique Bad node current_ir_graph->bad.
975 * This node is used to express results of dead code elimination.
977 * ir_node *new_NoMem (void)
978 * -----------------------------------------------------------------------------------
980 * Returns the unique NoMem node current_ir_graph->no_mem.
981 * This node is used as input for operations that need a Memory, but do not
982 * change it like Div by const != 0, analyzed calls etc.
984 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj)
985 * ----------------------------------------------------------
987 * Selects one entry of a tuple. This is a hidden edge with attributes.
990 * *arg A node producing a tuple.
991 * *mode The mode of the value to project.
992 * proj The position of the value in the tuple.
998 * ir_node *new_Tuple (int arity, ir_node **in)
999 * --------------------------------------------
1001 * Builds a Tuple from single values. This is needed to implement
1002 * optimizations that remove a node that produced a tuple. The node can be
1003 * replaced by the Tuple operation so that the following Proj nodes have not to
1004 * be changed. (They are hard to find due to the implementation with pointers
1005 * in only one direction.) The Tuple node is smaller than any other
1006 * node, so that a node can be changed into a Tuple by just changing it's
1007 * opcode and giving it a new in array.
1010 * arity The number of tuple elements.
1011 * **in An array containing pointers to the nodes producing the
1014 * ir_node *new_Id (ir_node *val, ir_mode *mode)
1015 * ---------------------------------------------
1017 * The single output of the Id operation is it's input. Also needed
1018 * for optimizations.
1021 * HIGH LEVEL OPERATIONS
1022 * ---------------------
1024 * ir_node *new_CopyB (ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type)
1025 * -----------------------------------------------------------------------------------
1027 * Describes a high level block copy of a compound type from address src to
1028 * address dst. Must be lowered to a Call to a runtime memory copy function.
1031 * HIGH LEVEL OPERATIONS: Exception Support
1032 * ----------------------------------------
1033 * See TechReport 1999-14, chapter Exceptions.
1035 * ir_node *new_InstOf(ir_node *store, ir_node *ptr, ir_type *type);
1036 * -----------------------------------------------------------------------------------
1038 * Describes a high level type check. Must be lowered to a Call to a runtime check
1041 * ir_node *new_Raise (ir_node *store, ir_node *obj)
1042 * -------------------------------------------------
1044 * Raises an exception. Unconditional change of control flow. Writes
1045 * an explicit Except variable to memory to pass it to the exception
1046 * handler. Must be lowered to a Call to a runtime check
1051 * A pointer to the Except variable.
1053 * A tuple of control flow and the changed memory state. The control flow
1054 * points to the exception handler if it is definied in this procedure,
1055 * else it points to the end_block.
1057 * ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
1058 * -----------------------------------------------------------------------------------
1060 * Describes a high level bounds check. Must be lowered to a Call to a runtime check
1063 * ir_node *new_Pin (ir_node *node);
1064 * -----------------------------------------------------------------------------------
1066 * Pin the value of the node node in the current block No users of the Pin node can
1067 * float above the Block of the Pin. The node cannot float behind this block. Often
1068 * used to Pin the NoMem node.
1071 * COPING WITH DATA OBJECTS
1072 * ========================
1074 * Two kinds of data objects have to be distinguished for generating
1075 * FIRM. First there are local variables other than arrays that are
1076 * known to be alias free. Second there are all other data objects.
1077 * For the first a common SSA representation is built, the second
1078 * are modeled by saving them to memory. The memory is treated as
1079 * a single local variable, the alias problem is hidden in the
1080 * content of this variable.
1082 * All values known in a Block are listed in the block's attribute,
1083 * block.**graph_arr which is used to automatically insert Phi nodes.
1084 * The following two functions can be used to add a newly computed value
1085 * to the array, or to get the producer of a value, i.e., the current
1088 * inline void set_value (int pos, ir_node *value)
1089 * -----------------------------------------------
1091 * Has to be called for every assignment to a local variable. It
1092 * adds the value to the array of used values at position pos. Pos
1093 * has to be a unique identifier for an entry in the procedure's
1094 * definition table. It can be used to access the value again.
1095 * Requires current_block to be set correctly.
1097 * ir_node *get_value (int pos, ir_mode *mode)
1098 * -------------------------------------------
1100 * Returns the node defining the value referred to by pos. If the
1101 * value is not defined in this block a Phi node is generated and
1102 * all definitions reaching this Phi node are collected. It can
1103 * happen that the algorithm allocates an unnecessary Phi node,
1104 * e.g. if there is only one definition of this value, but this
1105 * definition reaches the currend block on several different
1106 * paths. This Phi node will be eliminated if optimizations are
1107 * turned on right after it's creation.
1108 * Requires current_block to be set correctly.
1110 * There are two special routines for the global store:
1112 * void set_store (ir_node *store)
1113 * -------------------------------
1115 * Adds the store to the array of known values at a reserved
1117 * Requires current_block to be set correctly.
1119 * ir_node *get_store (void)
1120 * -------------------------
1122 * Returns the node defining the actual store.
1123 * Requires current_block to be set correctly.
1126 * inline void keep_alive (ir_node *ka)
1127 * ------------------------------------
1129 * Keep this node alive because it is (might be) not in the control
1130 * flow from Start to End. Adds the node to the list in the end
1134 #ifndef FIRM_IR_IRCONS_H
1135 #define FIRM_IR_IRCONS_H
1137 #include "firm_types.h"
1140 * constrained flags for memory operations.
1142 typedef enum ir_cons_flags {
1143 cons_none = 0, /**< No constrains. */
1144 cons_volatile = 1U << 0, /**< Memory operation is volatile. */
1145 cons_unaligned = 1U << 1, /**< Memory operation is unaligned. */
1146 cons_floats = 1U << 2 /**< Memory operation can float. */
1149 /*-------------------------------------------------------------------------*/
1150 /* The raw interface */
1151 /*-------------------------------------------------------------------------*/
1153 /** Constructor for a Block node.
1155 * Constructs a mature block with the given predecessors.
1157 * @param *db A Pointer for debug information.
1158 * @param irg The IR graph the block belongs to.
1159 * @param arity The number of control predecessors.
1160 * @param in[] An array of control predecessors. The length of
1161 * the array must be 'arity'. The constructor copies this array.
1163 ir_node *new_rd_Block(dbg_info *db, ir_graph *irg, int arity, ir_node *in[]);
1165 /** Constructor for a Start node.
1167 * @param *db A pointer for debug information.
1168 * @param *irg The IR graph the node belongs to.
1169 * @param *block The IR block the node belongs to.
1171 ir_node *new_rd_Start(dbg_info *db, ir_graph *irg, ir_node *block);
1173 /** Constructor for a End node.
1175 * @param *db A pointer for debug information.
1176 * @param *irg The IR graph the node belongs to.
1177 * @param *block The IR block the node belongs to.
1179 ir_node *new_rd_End(dbg_info *db, ir_graph *irg, ir_node *block);
1181 /** Constructor for a Jmp node.
1183 * Jmp represents control flow to a single control successor.
1185 * @param *db A pointer for debug information.
1186 * @param *block The IR block the node belongs to.
1188 ir_node *new_rd_Jmp(dbg_info *db, ir_node *block);
1190 /** Constructor for an IJmp node.
1192 * IJmp represents control flow to a single control successor not
1193 * statically known i.e. an indirect Jmp.
1195 * @param *db A pointer for debug information.
1196 * @param *block The IR block the node belongs to.
1197 * @param *tgt The IR node representing the target address.
1199 ir_node *new_rd_IJmp(dbg_info *db, ir_node *block, ir_node *tgt);
1201 /** Constructor for a Break node.
1203 * Break represents control flow to a single control successor just as Jmp.
1204 * The blocks separated by a break may not be concatenated by an optimization.
1205 * It is used for the interprocedural representation where blocks are parted
1206 * behind Call nodes to represent the control flow to called procedures.
1208 * @param *db A pointer for debug information.
1209 * @param *block The block the node belong to.
1211 ir_node *new_rd_Break(dbg_info *db, ir_node *block);
1213 /** Constructor for a Cond node.
1215 * If c is mode_b represents a conditional branch (if/else). If c is
1216 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
1217 * node, default Proj is 0.)
1219 * This is not consistent: Input to Cond is Is, Proj has as proj number
1222 * @param *db A pointer for debug information.
1223 * @param *block The IR block the node belongs to.
1224 * @param *c The conditions parameter. Can be of mode b or I_u.
1226 ir_node *new_rd_Cond(dbg_info *db, ir_node *block, ir_node *c);
1228 /** Constructor for a Return node.
1230 * Returns the memory and zero or more return values. Only node that
1231 * can end regular control flow.
1233 * @param *db A pointer for debug information.
1234 * @param *block The IR block the node belongs to.
1235 * @param *store The state of memory.
1236 * @param arity Number of return values.
1237 * @param *in Array of length arity with return values. The constructor copies this array.
1239 ir_node *new_rd_Return(dbg_info *db, ir_node *block,
1240 ir_node *store, int arity, ir_node *in[]);
1242 /** Constructor for a Const_type node.
1244 * Adds the node to the start block.
1246 * The constant represents a target value. This constructor sets high
1247 * level type information for the constant value.
1248 * Derives mode from passed tarval.
1250 * @param *db A pointer for debug information.
1251 * @param *irg The IR graph the node belongs to.
1252 * @param *con Points to an entry in the constant table.
1253 * @param *tp The type of the constant.
1255 ir_node *new_rd_Const_type(dbg_info *db, ir_graph *irg,
1256 tarval *con, ir_type *tp);
1258 /** Constructor for a Const node.
1260 * Adds the node to the start block.
1262 * Constructor for a Const node. The constant represents a target
1263 * value. Sets the type information to type_unknown. (No more
1264 * supported: If tv is entity derives a somehow useful type.)
1265 * Derives mode from passed tarval.
1267 * @param *db A pointer for debug information.
1268 * @param *irg The IR graph the node belongs to.
1269 * @param *con Points to an entry in the constant table.
1271 ir_node *new_rd_Const(dbg_info *db, ir_graph *irg, tarval *con);
1273 /** Constructor for a Const node.
1275 * Adds the node to the start block.
1277 * Constructor for a Const node. The constant represents a target
1278 * value. Sets the type information to type_unknown. (No more
1279 * supported: If tv is entity derives a somehow useful type.)
1281 * @param *db A pointer for debug information.
1282 * @param *irg The IR graph the node belongs to.
1283 * @param *mode The mode of the operands and results.
1284 * @param value A value from which the tarval is made.
1286 ir_node *new_rd_Const_long(dbg_info *db, ir_graph *irg,
1287 ir_mode *mode, long value);
1289 /** Constructor for a SymConst_type node.
1291 * This is the constructor for a symbolic constant.
1292 * There are several kinds of symbolic constants:
1293 * - symconst_type_tag The symbolic constant represents a type tag. The
1294 * type the tag stands for is given explicitly.
1295 * - symconst_type_size The symbolic constant represents the size of a type.
1296 * The type of which the constant represents the size
1297 * is given explicitly.
1298 * - symconst_type_align The symbolic constant represents the alignment of a
1299 * type. The type of which the constant represents the
1300 * size is given explicitly.
1301 * - symconst_addr_ent The symbolic constant represents the address of an
1302 * entity (variable or method). The variable is given
1303 * explicitly by a firm entity.
1304 * - symconst_ofs_ent The symbolic constant represents the offset of an
1305 * entity in its owner type.
1306 * - symconst_enum_const The symbolic constant is a enumeration constant of
1307 * an enumeration type.
1309 * Inputs to the node:
1310 * No inputs except the block it belongs to.
1311 * Outputs of the node.
1312 * An unsigned integer (I_u) or a pointer (P).
1314 * Mention union in declaration so that the firmjni generator recognizes that
1315 * it can not cast the argument to an int.
1317 * @param *db A pointer for debug information.
1318 * @param *irg The IR graph the node belongs to.
1319 * @param mode The mode for the SymConst.
1320 * @param value A type, ident, entity or enum constant depending on the
1322 * @param kind The kind of the symbolic constant, see the list above
1323 * @param tp The source type of the constant.
1325 ir_node *new_rd_SymConst_type(dbg_info *db, ir_graph *irg, ir_mode *mode,
1326 union symconst_symbol value, symconst_kind kind,
1329 /** Constructor for a SymConst node.
1331 * Same as new_rd_SymConst_type, except that it sets the type to type_unknown.
1333 ir_node *new_rd_SymConst(dbg_info *db, ir_graph *irg, ir_mode *mode,
1334 union symconst_symbol value, symconst_kind kind);
1336 /** Constructor for a SymConst addr_ent node.
1338 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1339 * symconst_addr_ent.
1340 * Adds the SymConst to the start block of irg. */
1341 ir_node *new_rd_SymConst_addr_ent(dbg_info *db, ir_graph *irg, ir_mode *mode,
1342 ir_entity *symbol, ir_type *tp);
1344 /** Constructor for a SymConst ofs_ent node.
1346 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1348 * Adds the SymConst to the start block of irg.
1350 ir_node *new_rd_SymConst_ofs_ent(dbg_info *db, ir_graph *irg, ir_mode *mode,
1351 ir_entity *symbol, ir_type *tp);
1353 /** Constructor for a SymConst type_tag node.
1355 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1356 * symconst_type_tag.
1357 * Adds the SymConst to the start block of irg.
1359 ir_node *new_rd_SymConst_type_tag(dbg_info *db, ir_graph *irg, ir_mode *mode,
1360 ir_type *symbol, ir_type *tp);
1362 /** Constructor for a SymConst size node.
1364 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1365 * symconst_type_size.
1366 * Adds the SymConst to the start block of irg. */
1367 ir_node *new_rd_SymConst_size(dbg_info *db, ir_graph *irg, ir_mode *mode,
1368 ir_type *symbol, ir_type *tp);
1370 /** Constructor for a SymConst size node.
1372 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1373 * symconst_type_align.
1374 * Adds the SymConst to the start block of irg.
1376 ir_node *new_rd_SymConst_align(dbg_info *db, ir_graph *irg, ir_mode *mode,
1377 ir_type *symbol, ir_type *tp);
1379 /** Constructor for a simpleSel node.
1381 * This is a shortcut for the new_rd_Sel() constructor. To be used for
1382 * Sel nodes that do not select from an array, i.e., have no index
1383 * inputs. It adds the two parameters 0, NULL.
1385 * @param *db A pointer for debug information.
1386 * @param *block The IR block the node belongs to.
1387 * @param *store The memory in which the object the entity should be
1388 * selected from is allocated.
1389 * @param *objptr The object from that the Sel operation selects a
1390 * single attribute out.
1391 * @param *ent The entity to select.
1393 ir_node *new_rd_simpleSel(dbg_info *db, ir_node *block,
1394 ir_node *store, ir_node *objptr, ir_entity *ent);
1396 /** Constructor for a Sel node.
1398 * The select node selects an entity (field or method) from an entity
1399 * with a compound type. It explicitly specifies the entity selected.
1400 * Dynamically the node may select entities that overwrite the given
1401 * entity. If the selected entity is an array element entity the Sel
1402 * node takes the required array indices as inputs.
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 selected
1407 * from is allocated.
1408 * @param *objptr A pointer to a compound entity the Sel operation selects a
1409 * single attribute from.
1410 * @param *n_index The number of array indices needed to select an array element entity.
1411 * @param *index[] If the compound entity is an array the indices of the selected
1412 * element entity. The constructor copies this array.
1413 * @param *ent The entity to select.
1415 ir_node *new_rd_Sel(dbg_info *db, ir_node *block, ir_node *store,
1416 ir_node *objptr, int n_index, ir_node *index[], ir_entity *ent);
1418 /** Constructor for a Call node.
1420 * Represents all kinds of method and function calls.
1422 * @param *db A pointer for debug information.
1423 * @param *block The IR block the node belongs to.
1424 * @param *store The current memory state.
1425 * @param *callee A pointer to the called procedure.
1426 * @param arity The number of procedure parameters.
1427 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1428 * @param *tp Type information of the procedure called.
1430 ir_node *new_rd_Call(dbg_info *db, ir_node *block, ir_node *store,
1431 ir_node *callee, int arity, ir_node *in[], ir_type *tp);
1433 /** Constructor for a Builtin node.
1435 * Represents a call of a backend-specific builtin..
1437 * @param *db A pointer for debug information.
1438 * @param *block The IR block the node belongs to.
1439 * @param *store The current memory state.
1440 * @param arity The number of procedure parameters.
1441 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1442 * @param kind The kind of the called builtin.
1443 * @param *tp Type information of the procedure called.
1445 ir_node *new_rd_Builtin(dbg_info *db, ir_node *block, ir_node *store,
1446 int arity, ir_node *in[], ir_builtin_kind kind, ir_type *tp);
1448 /** Constructor for a Add node.
1450 * @param *db A pointer for debug information.
1451 * @param *block The IR block the node belongs to.
1452 * @param *op1 The first operand.
1453 * @param *op2 The second operand.
1454 * @param *mode The mode of the operands and the result.
1456 ir_node *new_rd_Add(dbg_info *db, ir_node *block,
1457 ir_node *op1, ir_node *op2, ir_mode *mode);
1459 /** Constructor for a Sub node.
1461 * @param *db A pointer for debug information.
1462 * @param *block The IR block the node belongs to.
1463 * @param *op1 The first operand.
1464 * @param *op2 The second operand.
1465 * @param *mode The mode of the operands and the result.
1467 ir_node *new_rd_Sub(dbg_info *db, ir_node *block,
1468 ir_node *op1, ir_node *op2, ir_mode *mode);
1470 /** Constructor for a Minus node.
1472 * @param *db A pointer for debug information.
1473 * @param *block The IR block the node belongs to.
1474 * @param *op The operand .
1475 * @param *mode The mode of the operand and the result.
1477 ir_node *new_rd_Minus(dbg_info *db, ir_node *block,
1478 ir_node *op, ir_mode *mode);
1480 /** Constructor for a Mul node.
1482 * @param *db A pointer for debug information.
1483 * @param *block The IR block the node belongs to.
1484 * @param *op1 The first operand.
1485 * @param *op2 The second operand.
1486 * @param *mode The mode of the operands and the result.
1488 ir_node *new_rd_Mul(dbg_info *db, ir_node *block,
1489 ir_node *op1, ir_node *op2, ir_mode *mode);
1491 /** Constructor for a Mulh node.
1493 * @param *db A pointer for debug information.
1494 * @param *block The IR block the node belongs to.
1495 * @param *op1 The first operand.
1496 * @param *op2 The second operand.
1497 * @param *mode The mode of the operands and the result.
1499 ir_node *new_rd_Mulh(dbg_info *db, ir_node *block,
1500 ir_node *op1, ir_node *op2, ir_mode *mode);
1502 /** Constructor for a Quot node.
1504 * @param *db A pointer for debug information.
1505 * @param *block The IR block the node belongs to.
1506 * @param *memop The store needed to model exceptions
1507 * @param *op1 The first operand.
1508 * @param *op2 The second operand.
1509 * @param *mode The mode of the result.
1510 * @param state The pinned state.
1512 ir_node *new_rd_Quot(dbg_info *db, ir_node *block, ir_node *memop,
1513 ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1515 /** Constructor for a DivMod node.
1517 * @param *db A pointer for debug information.
1518 * @param *block The IR block the node belongs to.
1519 * @param *memop The store needed to model exceptions
1520 * @param *op1 The first operand.
1521 * @param *op2 The second operand.
1522 * @param *mode The mode of the results.
1523 * @param state The pinned state.
1525 ir_node *new_rd_DivMod(dbg_info *db, ir_node *block, ir_node *memop,
1526 ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1528 /** Constructor for a Div node.
1530 * @param *db A pointer for debug information.
1531 * @param *block The IR block the node belongs to.
1532 * @param *memop The store needed to model exceptions
1533 * @param *op1 The first operand.
1534 * @param *op2 The second operand.
1535 * @param *mode The mode of the result.
1536 * @param state The pinned state.
1538 ir_node *new_rd_Div(dbg_info *db, ir_node *block, ir_node *memop,
1539 ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1541 /** Constructor for a remainderless Div node.
1543 * @param *db A pointer for debug information.
1544 * @param *block The IR block the node belongs to.
1545 * @param *memop The store needed to model exceptions
1546 * @param *op1 The first operand.
1547 * @param *op2 The second operand.
1548 * @param *mode The mode of the result.
1549 * @param state The pinned state.
1551 ir_node *new_rd_DivRL(dbg_info *db, ir_node *block, ir_node *memop,
1552 ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1554 /** Constructor for a Mod node.
1556 * @param *db A pointer for debug information.
1557 * @param *block The IR block the node belongs to.
1558 * @param *memop The store needed to model exceptions
1559 * @param *op1 The first operand.
1560 * @param *op2 The second operand.
1561 * @param *mode The mode of the result.
1562 * @param state The pinned state.
1564 ir_node *new_rd_Mod(dbg_info *db, ir_node *block, ir_node *memop,
1565 ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1567 /** Constructor for a Abs node.
1569 * @param *db A pointer for debug information.
1570 * @param *block The IR block the node belongs to.
1571 * @param *op The operand
1572 * @param *mode The mode of the operands and the result.
1574 ir_node *new_rd_Abs(dbg_info *db, ir_node *block, ir_node *op, ir_mode *mode);
1576 /** Constructor for a And node.
1578 * @param *db A pointer for debug information.
1579 * @param *block The IR block the node belongs to.
1580 * @param *op1 The first operand.
1581 * @param *op2 The second operand.
1582 * @param *mode The mode of the operands and the result.
1584 ir_node *new_rd_And(dbg_info *db, ir_node *block,
1585 ir_node *op1, ir_node *op2, ir_mode *mode);
1587 /** Constructor for a Or node.
1589 * @param *db A pointer for debug information.
1590 * @param *block The IR block the node belongs to.
1591 * @param *op1 The first operand.
1592 * @param *op2 The second operand.
1593 * @param *mode The mode of the operands and the result.
1595 ir_node *new_rd_Or(dbg_info *db, ir_node *block,
1596 ir_node *op1, ir_node *op2, ir_mode *mode);
1598 /** Constructor for a Eor node.
1600 * @param *db A pointer for debug information.
1601 * @param *block The IR block the node belongs to.
1602 * @param *op1 The first operand.
1603 * @param *op2 The second operand.
1604 * @param *mode The mode of the operands and the results.
1606 ir_node *new_rd_Eor(dbg_info *db, ir_node *block,
1607 ir_node *op1, ir_node *op2, ir_mode *mode);
1609 /** Constructor for a Not node.
1611 * @param *db A pointer for debug information.
1612 * @param *block The IR block the node belongs to.
1613 * @param *op The operand.
1614 * @param *mode The mode of the operand and the result.
1616 ir_node *new_rd_Not(dbg_info *db, ir_node *block, ir_node *op, ir_mode *mode);
1618 /** Constructor for a Cmp node.
1620 * @param *db A pointer for debug information.
1621 * @param *block The IR block the node belongs to.
1622 * @param *op1 The first operand.
1623 * @param *op2 The second operand.
1625 ir_node *new_rd_Cmp(dbg_info *db, ir_node *block, ir_node *op1, ir_node *op2);
1627 /** Constructor for a Shl node.
1629 * @param *db A pointer for debug information.
1630 * @param *block The IR block the node belongs to.
1631 * @param *op The operand.
1632 * @param *k The number of bits to shift the operand .
1633 * @param *mode The mode of the operand and the result.
1635 ir_node *new_rd_Shl(dbg_info *db, ir_node *block,
1636 ir_node *op, ir_node *k, ir_mode *mode);
1638 /** Constructor for a Shr node.
1640 * @param *db A pointer for debug information.
1641 * @param *block The IR block the node belongs to.
1642 * @param *op The operand.
1643 * @param *k The number of bits to shift the operand .
1644 * @param *mode The mode of the operand and the result.
1646 ir_node *new_rd_Shr(dbg_info *db, ir_node *block,
1647 ir_node *op, ir_node *k, ir_mode *mode);
1649 /** Constructor for a Shrs node.
1651 * @param *db A pointer for debug information.
1652 * @param *block The IR block the node belongs to.
1653 * @param *op The operand.
1654 * @param *k The number of bits to shift the operand.
1655 * @param *mode The mode of the operand and the result.
1657 ir_node *new_rd_Shrs(dbg_info *db, ir_node *block,
1658 ir_node *op, ir_node *k, ir_mode *mode);
1660 /** Constructor for a Rotl node.
1662 * @param *db A pointer for debug information.
1663 * @param *block The IR block the node belongs to.
1664 * @param *op The operand.
1665 * @param *k The number of bits to rotate the operand.
1666 * @param *mode The mode of the operand.
1668 ir_node *new_rd_Rotl(dbg_info *db, ir_node *block,
1669 ir_node *op, ir_node *k, ir_mode *mode);
1672 /** Constructor for a Conv node.
1674 * @param *db A pointer for debug information.
1675 * @param *block The IR block the node belongs to.
1676 * @param *op The operand.
1677 * @param *mode The mode of this the operand muss be converted .
1679 ir_node *new_rd_Conv(dbg_info *db, ir_node *block, ir_node *op, ir_mode *mode);
1681 /** Constructor for a strictConv node.
1683 * @param *db A pointer for debug information.
1684 * @param *block The IR block the node belongs to.
1685 * @param *op The operand.
1686 * @param *mode The mode of this the operand muss be converted .
1688 ir_node *new_rd_strictConv(dbg_info *db, ir_node *block,
1689 ir_node *op, ir_mode *mode);
1691 /** Constructor for a Cast node.
1693 * High level type cast.
1695 * @param *db A pointer for debug information.
1696 * @param *block The IR block the node belongs to.
1697 * @param *op The operand.
1698 * @param *to_tp The type of this the operand muss be casted .
1700 ir_node *new_rd_Cast(dbg_info *db, ir_node *block,
1701 ir_node *op, ir_type *to_tp);
1703 /** Constructor for a Carry node.
1705 * @param *db A pointer for debug information.
1706 * @param *block The IR block the node belongs to.
1707 * @param *op1 The first operand.
1708 * @param *op2 The second operand.
1709 * @param *mode The mode of the operands and the result.
1711 ir_node *new_rd_Carry(dbg_info *db, ir_node *block,
1712 ir_node *op1, ir_node *op2, ir_mode *mode);
1714 /** Constructor for a Borrow node.
1716 * @param *db A pointer for debug information.
1717 * @param *block The IR block the node belongs to.
1718 * @param *op1 The first operand.
1719 * @param *op2 The second operand.
1720 * @param *mode The mode of the operands and the result.
1722 ir_node *new_rd_Borrow(dbg_info *db, ir_node *block,
1723 ir_node *op1, ir_node *op2, ir_mode *mode);
1725 /** Constructor for a Phi node.
1727 * @param *db A pointer for debug information.
1728 * @param *block The IR block the node belongs to.
1729 * @param arity The number of predecessors
1730 * @param *in[] Array with predecessors. The constructor copies this array.
1731 * @param *mode The mode of it's inputs and output.
1733 ir_node *new_rd_Phi(dbg_info *db, ir_node *block, int arity,
1734 ir_node *in[], ir_mode *mode);
1736 /** Constructor for a Load node.
1738 * @param *db A pointer for debug information.
1739 * @param *block The IR block the node belongs to.
1740 * @param *store The current memory
1741 * @param *adr A pointer to the variable to be read in this memory.
1742 * @param *mode The mode of the value to be loaded.
1743 * @param flags Additional flags for alignment, volatility and pin state.
1745 ir_node *new_rd_Load(dbg_info *db, ir_node *block, ir_node *store,
1746 ir_node *adr, ir_mode *mode, ir_cons_flags flags);
1748 /** Constructor for a Store node.
1750 * @param *db A pointer for debug information.
1751 * @param *block The IR block the node belongs to.
1752 * @param *store The current memory
1753 * @param *adr A pointer to the variable to be read in this memory.
1754 * @param *val The value to write to this variable.
1755 * @param flags Additional flags for alignment, volatility and pin state.
1757 ir_node *new_rd_Store(dbg_info *db, ir_node *block, ir_node *store,
1758 ir_node *adr, ir_node *val, ir_cons_flags flags);
1760 /** Constructor for a Alloc node.
1762 * The Alloc node extends the memory by space for an entity of type alloc_type.
1764 * @param *db A pointer for debug information.
1765 * @param *block The IR block the node belongs to.
1766 * @param *store The memory which shall contain the new variable.
1767 * @param *count The number of objects to allocate.
1768 * @param *alloc_type The type of the allocated variable.
1769 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
1771 ir_node *new_rd_Alloc(dbg_info *db, ir_node *block, ir_node *store,
1772 ir_node *count, ir_type *alloc_type, ir_where_alloc where);
1774 /** Constructor for a Free node.
1776 * Frees the memory occupied by the entity pointed to by the pointer
1777 * arg. Type indicates the type of the entity the argument points to.
1779 * @param *db A pointer for debug information.
1780 * @param *block The IR block the node belongs to.
1781 * @param *store The memory which shall contain the new variable.
1782 * @param *ptr The pointer to the object to free.
1783 * @param *size The number of objects of type free_type to free in a sequence.
1784 * @param *free_type The type of the freed variable.
1785 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
1787 ir_node *new_rd_Free(dbg_info *db, ir_node *block, ir_node *store,
1788 ir_node *ptr, ir_node *size, ir_type *free_type, ir_where_alloc where);
1790 /** Constructor for a Sync node.
1792 * Merges several memory values. The node assumes that a variable
1793 * either occurs only in one of the memories, or it contains the same
1794 * value in all memories where it occurs.
1796 * @param *db A pointer for debug information.
1797 * @param *block The IR block the node belongs to.
1798 * @param arity The number of memories to synchronize.
1799 * @param *in[] An array of pointers to nodes that produce an output of type
1800 * memory. The constructor copies this array.
1802 ir_node *new_rd_Sync(dbg_info *db, ir_node *block, int arity, ir_node *in[]);
1804 /** Constructor for a Proj node.
1806 * Projects a single value out of a tuple. The parameter proj gives the
1807 * position of the value within the tuple.
1809 * @param *db A pointer for debug information.
1810 * @param arg A node producing a tuple. The node must have mode_T.
1811 * @param *mode The mode of the value to project.
1812 * @param proj The position of the value in the tuple.
1814 ir_node *new_rd_Proj(dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
1816 /** Constructor for a defaultProj node.
1818 * Represents the default control flow of a Switch-Cond node.
1820 * @param *db A pointer for debug information.
1821 * @param *block The IR block the node belongs to.
1822 * @param arg A node producing a tuple.
1823 * @param max_proj The end position of the value in the tuple.
1825 ir_node *new_rd_defaultProj(dbg_info *db, ir_node *arg, long max_proj);
1827 /** Constructor for a Tuple node.
1829 * This is an auxiliary node to replace a node that returns a tuple
1830 * without changing the corresponding Proj nodes.
1832 * @param *db A pointer for debug information.
1833 * @param *block The IR block the node belongs to.
1834 * @param arity The number of tuple elements.
1835 * @param *in[] An array containing pointers to the nodes producing the tuple
1836 * elements. The constructor copies this array.
1838 ir_node *new_rd_Tuple(dbg_info *db, ir_node *block,
1839 int arity, ir_node *in[]);
1841 /** Constructor for a Id node.
1843 * This is an auxiliary node to replace a node that returns a single
1846 * @param *db A pointer for debug information.
1847 * @param *block The IR block the node belongs to.
1848 * @param *val The value
1849 * @param *mode The mode of *val.
1851 ir_node *new_rd_Id(dbg_info *db, ir_node *block,
1852 ir_node *val, ir_mode *mode);
1854 /** Constructor for a Confirm node.
1856 * Specifies constraints for a value. To support dataflow analyses.
1858 * Example: If the value never exceeds '100' this is expressed by placing a
1859 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
1861 * @param *db A pointer for debug information.
1862 * @param *block The IR block the node belong to.
1863 * @param *val The value we express a constraint for
1864 * @param *bound The value to compare against. Must be a firm node, typically a constant.
1865 * @param cmp The compare operation.
1867 ir_node *new_rd_Confirm(dbg_info *db, ir_node *block,
1868 ir_node *val, ir_node *bound, pn_Cmp cmp);
1870 /** Constructor for an Unknown node.
1872 * Represents an arbitrary value. Places the node in the start block.
1874 * @param *db A pointer for debug information.
1875 * @param *irg The IR graph the node belongs to.
1876 * @param *m The mode of the unknown value.
1878 ir_node *new_rd_Unknown(dbg_info *db, ir_graph *irg, ir_mode *m);
1880 /** Constructor for a CallBegin node.
1882 * CallBegin represents control flow depending of the pointer value
1883 * representing the called method to the called methods. The
1884 * constructor copies the method pointer input from the passed Call
1887 * @param *db A pointer for debug information.
1888 * @param *block The block the node belong to.
1889 * @param *callee The call node visible in the intra procedural view.
1891 ir_node *new_rd_CallBegin(dbg_info *db, ir_node *block, ir_node *ptr, ir_node *call);
1893 /** Constructor for a EndReg node.
1895 * Used to represent regular procedure end in interprocedual view.
1897 * @param *db A pointer for debug information.
1898 * @param *irg The IR graph the node belong to.
1899 * @param *block The block the node belong to.
1901 ir_node *new_rd_EndReg(dbg_info *db, ir_graph *irg, ir_node *block);
1903 /** Constructor for a EndExcept node.
1905 * Used to represent exceptional procedure end in interprocedural view.
1907 * @param *db A pointer for debug information.
1908 * @param *irg The IR graph the node belong to.
1909 * @param *block The block the node belong to.
1911 ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
1913 /** Constructor for a Filter node.
1915 * Adds the node to the block in current_ir_block. Filter is a node
1916 * with two views used to construct the interprocedural view. In
1917 * intraprocedural view its semantics are identical to the Proj node.
1918 * In interprocedural view the Filter performs the Phi operation on
1919 * method parameters or results. Other than a Phi a Filter node may
1920 * not be removed if it has only a single input.
1922 * The constructor builds the Filter in intraprocedural view.
1924 * @param *db A pointer for debug information.
1925 * @param *block The block the node belong to.
1926 * @param *arg The tuple value to project from.
1927 * @param *mode The mode of the projected value.
1928 * @param proj The position in the tuple to project from.
1930 ir_node *new_rd_Filter(dbg_info *db,ir_node *block, ir_node *arg,
1931 ir_mode *mode, long proj);
1933 /** Constructor for a Mux node.
1935 * @param *db A pointer for debug information.
1936 * @param *block The block the node belong to.
1937 * @param *sel The ir_node that calculates the boolean select.
1938 * @param *ir_true The ir_node that calculates the true result.
1939 * @param *ir_false The ir_node that calculates the false result.
1940 * @param *mode The mode of the node (and it_true and ir_false).
1942 ir_node *new_rd_Mux(dbg_info *db, ir_node *block, ir_node *sel,
1943 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
1945 /** Constructor for a CopyB node.
1947 * @param *db A pointer for debug information.
1948 * @param *block The block the node belong to.
1949 * @param *store The current memory
1950 * @param *dst The ir_node that represents the destination address.
1951 * @param *src The ir_node that represents the source address.
1952 * @param *data_type The type of the copied data
1954 ir_node *new_rd_CopyB(dbg_info *db, ir_node *block, ir_node *store,
1955 ir_node *dst, ir_node *src, ir_type *data_type);
1957 /** Constructor for a InstOf node.
1959 * A High-Level Type check.
1961 * @param *db A pointer for debug information.
1962 * @param *block The IR block the node belongs to.
1963 * @param *store The memory in which the object the entity should be selected
1964 * from is allocated.
1965 * @param *objptr A pointer to a object of a class type.
1966 * @param *type The type of which objptr must be.
1968 ir_node *new_rd_InstOf(dbg_info *db, ir_node *block, ir_node *store,
1969 ir_node *objptr, ir_type *type);
1971 /** Constructor for a Raise node.
1973 * A High-Level Exception throw.
1975 * @param *db A pointer for debug information.
1976 * @param *block The IR block the node belongs to.
1977 * @param *store The current memory.
1978 * @param *obj A pointer to the Except variable.
1980 ir_node *new_rd_Raise(dbg_info *db, ir_node *block, ir_node *store, ir_node *obj);
1982 /** Constructor for a Bound node.
1984 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
1986 * @param *db A pointer for debug information.
1987 * @param *block The block the node belong to.
1988 * @param *store The current memory.
1989 * @param *idx The ir_node that represents an index.
1990 * @param *lower The ir_node that represents the lower bound for the index.
1991 * @param *upper The ir_node that represents the upper bound for the index.
1993 ir_node *new_rd_Bound(dbg_info *db, ir_node *block,
1994 ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
1996 /** Constructor for a Pin node.
1998 * @param *db A pointer for debug information.
1999 * @param *block The block the node belong to.
2000 * @param *node The node which value should be pinned.
2002 ir_node *new_rd_Pin(dbg_info *db, ir_node *block, ir_node *node);
2004 /** Constructor for an ASM pseudo node.
2006 * @param *db A pointer for debug information.
2007 * @param *block The block the node belong to.
2008 * @param arity The number of data inputs to the node.
2009 * @param *in The array of length arity of data inputs.
2010 * @param *inputs The array of length arity of input constraints.
2011 * @param n_outs The number of data outputs to the node.
2012 * @param *outputs The array of length n_outs of output constraints.
2013 * @param n_clobber The number of clobbered registers.
2014 * @param *clobber The array of length n_clobber of clobbered registers.
2015 * @param *asm_text The assembler text.
2017 ir_node *new_rd_ASM(dbg_info *db, ir_node *block,
2018 int arity, ir_node *in[], ir_asm_constraint *inputs,
2019 int n_outs, ir_asm_constraint *outputs,
2020 int n_clobber, ident *clobber[], ident *asm_text);
2022 /*-------------------------------------------------------------------------*/
2023 /* The raw interface without debug support */
2024 /*-------------------------------------------------------------------------*/
2026 /** Constructor for a Block node.
2028 * Constructs a mature block with the given predecessors. Use Unknown
2029 * nodes as predecessors to construct a block if the number of
2030 * predecessors is known, but not the predecessors themselves. This
2031 * constructor does not set current_block. It not be used with
2032 * automatic Phi node construction.
2035 * @param irg The IR graph the block belongs to.
2036 * @param arity The number of control predecessors.
2037 * @param in[] An array of control predecessors. The length of
2038 * the array must be 'arity'. The constructor copies this array.
2040 ir_node *new_r_Block(ir_graph *irg, int arity, ir_node *in[]);
2042 /** Constructor for a Start node.
2044 * @param *irg The IR graph the node belongs to.
2045 * @param *block The IR block the node belongs to.
2047 ir_node *new_r_Start(ir_graph *irg, ir_node *block);
2049 /** Constructor for a End node.
2051 * @param *irg The IR graph the node belongs to.
2052 * @param *block The IR block the node belongs to.
2054 ir_node *new_r_End(ir_graph *irg, ir_node *block);
2056 /** Constructor for a Jmp node.
2058 * Jmp represents control flow to a single control successor.
2060 * @param *block The IR block the node belongs to.
2062 ir_node *new_r_Jmp(ir_node *block);
2064 /** Constructor for an IJmp node.
2066 * IJmp represents control flow to a single control successor not
2067 * statically known i.e. an indirect Jmp.
2069 * @param *block The IR block the node belongs to.
2070 * @param *tgt The IR node representing the target address.
2072 ir_node *new_r_IJmp(ir_node *block, ir_node *tgt);
2074 /** Constructor for a Cond node.
2076 * If c is mode_b represents a conditional branch (if/else). If c is
2077 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2078 * node, default Proj is 0.)
2080 * This is not consistent: Input to Cond is Is, Proj has as proj number
2083 * @param *block The IR block the node belongs to.
2084 * @param *c The conditions parameter.Can be of mode b or I_u.
2086 ir_node *new_r_Cond(ir_node *block, ir_node *c);
2088 /** Constructor for a Return node.
2090 * Returns the memory and zero or more return values. Only node that
2091 * can end regular control flow.
2093 * @param *block The IR block the node belongs to.
2094 * @param *store The state of memory.
2095 * @param arity Number of array indices.
2096 * @param *in[] Array with index inputs to the node. The constructor copies this array.
2098 ir_node *new_r_Return(ir_node *block, ir_node *store, int arity, ir_node *in[]);
2100 /** Constructor for a Const node.
2102 * Adds the node to the start block.
2104 * Constructor for a Const node. The constant represents a target
2105 * value. Sets the type information to type_unknown. (No more
2106 * supported: If tv is entity derives a somehow useful type.)
2107 * Derives mode from passed tarval.
2109 * @param *irg The IR graph the node belongs to.
2110 * @param *con Points to an entry in the constant table.
2112 ir_node *new_r_Const(ir_graph *irg, tarval *con);
2114 /** Constructor for a Const node.
2116 * Adds the node to the start block.
2118 * Constructor for a Const node. The constant represents a target
2119 * value. Sets the type information to type_unknown. (No more
2120 * supported: If tv is entity derives a somehow useful type.)
2122 * @param *irg The IR graph the node belongs to.
2123 * @param *mode The mode of the operands and the results.
2124 * @param value A value from which the tarval is made.
2126 ir_node *new_r_Const_long(ir_graph *irg, ir_mode *mode, long value);
2128 /** Constructor for a Const_type node.
2130 * Adds the node to the start block.
2132 * The constant represents a target value. This constructor sets high
2133 * level type information for the constant value.
2134 * Derives mode from passed tarval.
2136 * @param *irg The IR graph the node belongs to.
2137 * @param *con Points to an entry in the constant table.
2138 * @param *tp The type of the constant.
2140 ir_node *new_r_Const_type(ir_graph *irg, tarval *con, ir_type *tp);
2142 /** Constructor for a SymConst node.
2144 * This is the constructor for a symbolic constant.
2145 * There are several kinds of symbolic constants:
2146 * - symconst_type_tag The symbolic constant represents a type tag. The
2147 * type the tag stands for is given explicitly.
2148 * - symconst_type_size The symbolic constant represents the size of a type.
2149 * The type of which the constant represents the size
2150 * is given explicitly.
2151 * - symconst_type_align The symbolic constant represents the alignment of a
2152 * type. The type of which the constant represents the
2153 * size is given explicitly.
2154 * - symconst_addr_ent The symbolic constant represents the address of an
2155 * entity (variable or method). The variable is given
2156 * explicitly by a firm entity.
2157 * - symconst_ofs_ent The symbolic constant represents the offset of an
2158 * entity in its owner type.
2159 * - symconst_enum_const The symbolic constant is a enumeration constant of
2160 * an enumeration type.
2162 * Inputs to the node:
2163 * No inputs except the block it belongs to.
2164 * Outputs of the node.
2165 * An unsigned integer (I_u) or a pointer (P).
2167 * Mention union in declaration so that the firmjni generator recognizes that
2168 * it can not cast the argument to an int.
2170 * @param *irg The IR graph the node belongs to.
2171 * @param mode The mode for the SymConst.
2172 * @param value A type, ident, entity or enum constant depending on the
2174 * @param kind The kind of the symbolic constant, see the list above
2176 ir_node *new_r_SymConst(ir_graph *irg, ir_mode *mode,
2177 union symconst_symbol value, symconst_kind kind);
2179 /** Constructor for a simpleSel node.
2181 * This is a shortcut for the new_d_Sel() constructor. To be used for
2182 * Sel nodes that do not select from an array, i.e., have no index
2183 * inputs. It adds the two parameters 0, NULL.
2185 * @param *block The IR block the node belongs to.
2186 * @param *store The memory in which the object the entity should be selected
2187 * from is allocated.
2188 * @param *objptr The object from that the Sel operation selects a
2189 * single attribute out.
2190 * @param *ent The entity to select.
2192 ir_node *new_r_simpleSel(ir_node *block, ir_node *store,
2193 ir_node *objptr, ir_entity *ent);
2195 /** Constructor for a Sel node.
2197 * The select node selects an entity (field or method) from an entity
2198 * with a compound type. It explicitly specifies the entity selected.
2199 * Dynamically the node may select entities that overwrite the given
2200 * entity. If the selected entity is an array element entity the Sel
2201 * node takes the required array indices as inputs.
2203 * @param *block The IR block the node belongs to.
2204 * @param *store The memory in which the object the entity should be selected
2205 * from is allocated.
2206 * @param *objptr A pointer to a compound entity the Sel operation selects a
2207 * single attribute from.
2208 * @param *n_index The number of array indices needed to select an array element entity.
2209 * @param *index[] If the compound entity is an array the indices of the selected
2210 * element entity. The constructor copies this array.
2211 * @param *ent The entity to select.
2213 ir_node *new_r_Sel(ir_node *block, ir_node *store,
2214 ir_node *objptr, int n_index, ir_node *index[],
2217 /** Constructor for a Call node.
2219 * Represents all kinds of method and function calls.
2221 * @param *block The IR block the node belongs to.
2222 * @param *store The actual store.
2223 * @param *callee A pointer to the called procedure.
2224 * @param arity The number of procedure parameters.
2225 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2226 * @param *tp Type information of the procedure called.
2228 ir_node *new_r_Call(ir_node *block, ir_node *store,
2229 ir_node *callee, int arity, ir_node *in[], ir_type *tp);
2231 /** Constructor for a Builtin node.
2233 * Represents a call of a backend-specific builtin..
2235 * @param *block The IR block the node belongs to.
2236 * @param *store The actual store.
2237 * @param arity The number of procedure parameters.
2238 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2239 * @param kind The kind of the called builtin.
2240 * @param *tp Type information of the procedure called.
2242 ir_node *new_r_Builtin(ir_node *block, ir_node *store,
2243 int arity, ir_node *in[], ir_builtin_kind kind, ir_type *tp);
2245 /** Constructor for a Add node.
2247 * @param *block The IR block the node belongs to.
2248 * @param *op1 The first operand.
2249 * @param *op2 The second operand.
2250 * @param *mode The mode of the operands and the result.
2252 ir_node *new_r_Add(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2255 * Constructor for a Sub node.
2257 * @param *block The IR block the node belongs to.
2258 * @param *op1 The first operand.
2259 * @param *op2 The second operand.
2260 * @param *mode The mode of the operands and the results.
2262 ir_node *new_r_Sub(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2264 /** Constructor for a Minus node.
2266 * @param *block The IR block the node belongs to.
2267 * @param *op The operand.
2268 * @param *mode The mode of the operand and the result.
2270 ir_node *new_r_Minus(ir_node *block, ir_node *op, ir_mode *mode);
2272 /** Constructor for a Mul node.
2274 * @param *block The IR block the node belongs to.
2275 * @param *op1 The first operand.
2276 * @param *op2 The second operand.
2277 * @param *mode The mode of the operands and the result.
2279 ir_node *new_r_Mul(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2281 /** Constructor for a Mulh node.
2283 * @param *block The IR block the node belongs to.
2284 * @param *op1 The first operand.
2285 * @param *op2 The second operand.
2286 * @param *mode The mode of the operands and the result.
2288 ir_node *new_r_Mulh(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2290 /** Constructor for a Quot node.
2292 * @param *block The IR block the node belongs to.
2293 * @param *memop The store needed to model exceptions
2294 * @param *op1 The first operand.
2295 * @param *op2 The second operand.
2296 * @param *mode The mode of the result.
2297 * @param state The pinned state.
2299 ir_node *new_r_Quot(ir_node *block, ir_node *memop, ir_node *op1, ir_node *op2,
2300 ir_mode *mode, op_pin_state state);
2302 /** Constructor for a DivMod node.
2304 * @param *block The IR block the node belongs to.
2305 * @param *memop The store needed to model exceptions
2306 * @param *op1 The first operand.
2307 * @param *op2 The second operand.
2308 * @param *mode The mode of the results.
2309 * @param state The pinned state.
2311 ir_node *new_r_DivMod(ir_node *block, ir_node *memop, ir_node *op1, ir_node *op2,
2312 ir_mode *mode, op_pin_state state);
2314 /** Constructor for a Div node.
2316 * @param *block The IR block the node belongs to.
2317 * @param *memop The store needed to model exceptions
2318 * @param *op1 The first operand.
2319 * @param *op2 The second operand.
2320 * @param *mode The mode of the result.
2321 * @param state The pinned state.
2323 ir_node *new_r_Div(ir_node *block, ir_node *memop, ir_node *op1, ir_node *op2,
2324 ir_mode *mode, op_pin_state state);
2326 /** Constructor for a remainderless Div node.
2328 * @param *block The IR block the node belongs to.
2329 * @param *memop The store needed to model exceptions
2330 * @param *op1 The first operand.
2331 * @param *op2 The second operand.
2332 * @param *mode The mode of the result.
2333 * @param state The pinned state.
2335 ir_node *new_r_DivRL(ir_node *block, ir_node *memop, ir_node *op1, ir_node *op2,
2336 ir_mode *mode, op_pin_state state);
2338 /** Constructor for a Mod node.
2340 * @param *block The IR block the node belongs to.
2341 * @param *memop The store needed to model exceptions
2342 * @param *op1 The first operand.
2343 * @param *op2 The second operand.
2344 * @param *mode The mode of the result.
2345 * @param state The pinned state.
2347 ir_node *new_r_Mod(ir_node *block, ir_node *memop, ir_node *op1, ir_node *op2,
2348 ir_mode *mode, op_pin_state state);
2350 /** Constructor for a Abs node.
2352 * @param *block The IR block the node belongs to.
2353 * @param *op The operand
2354 * @param *mode The mode of the operands and the result.
2356 ir_node *new_r_Abs(ir_node *block, ir_node *op, ir_mode *mode);
2358 /** Constructor for a And node.
2360 * @param *block The IR block the node belongs to.
2361 * @param *op1 The first operand.
2362 * @param *op2 The second operand.
2363 * @param *mode The mode of the operands and the result.
2365 ir_node *new_r_And(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2367 /** Constructor for a Or node.
2369 * @param *block The IR block the node belongs to.
2370 * @param *op1 The first operand.
2371 * @param *op2 The second operand.
2372 * @param *mode The mode of the operands and the result.
2374 ir_node *new_r_Or(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2376 /** Constructor for a Eor node.
2378 * @param *block The IR block the node belongs to.
2379 * @param *op1 The first operand.
2380 * @param *op2 The second operand.
2381 * @param *mode The mode of the operands and the results.
2383 ir_node *new_r_Eor(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2385 /** Constructor for a Not node.
2387 * @param *block The IR block the node belongs to.
2388 * @param *op The operand.
2389 * @param *mode The mode of the operand and the result.
2391 ir_node *new_r_Not(ir_node *block, ir_node *op, ir_mode *mode);
2393 /** Constructor for a Cmp node.
2395 * @param *block The IR block the node belongs to.
2396 * @param *op1 The first operand.
2397 * @param *op2 The second operand.
2399 ir_node *new_r_Cmp(ir_node *block, ir_node *op1, ir_node *op2);
2401 /** Constructor for a Shl node.
2403 * @param *block The IR block the node belongs to.
2404 * @param *op The operand.
2405 * @param *k The number of bits to shift the operand .
2406 * @param *mode The mode of the operand and the result.
2408 ir_node *new_r_Shl(ir_node *block, ir_node *op, ir_node *k, ir_mode *mode);
2410 /** Constructor for a Shr node.
2412 * @param *block The IR block the node belongs to.
2413 * @param *op The operand.
2414 * @param *k The number of bits to shift the operand .
2415 * @param *mode The mode of the operand and the result.
2417 ir_node *new_r_Shr(ir_node *block, ir_node *op, ir_node *k, ir_mode *mode);
2420 * Constructor for a Shrs node.
2422 * @param *block The IR block the node belongs to.
2423 * @param *op The operand.
2424 * @param *k The number of bits to shift the operand.
2425 * @param *mode The mode of the operand and the result.
2427 ir_node *new_r_Shrs(ir_node *block, ir_node *op, ir_node *k, ir_mode *mode);
2429 /** Constructor for a Rotl node.
2431 * @param *block The IR block the node belongs to.
2432 * @param *op The operand.
2433 * @param *k The number of bits to rotate the operand.
2434 * @param *mode The mode of the operand.
2436 ir_node *new_r_Rotl(ir_node *block, ir_node *op, ir_node *k, ir_mode *mode);
2438 /** Constructor for a Conv node.
2440 * @param *block The IR block the node belongs to.
2441 * @param *op The operand.
2442 * @param *mode The mode of this the operand muss be converted .
2444 ir_node *new_r_Conv(ir_node *block, ir_node *op, ir_mode *mode);
2446 /** Constructor for a strict Conv node.
2448 * @param *block The IR block the node belongs to.
2449 * @param *op The operand.
2450 * @param *mode The mode of this the operand muss be converted .
2452 ir_node *new_r_strictConv(ir_node *block, ir_node *op, ir_mode *mode);
2454 /** Constructor for a Cast node.
2456 * High level type cast
2458 * @param *block The IR block the node belongs to.
2459 * @param *op The operand.
2460 * @param *to_tp The type of this the operand muss be casted .
2462 ir_node *new_r_Cast(ir_node *block, ir_node *op, ir_type *to_tp);
2464 /** Constructor for a Carry node.
2466 * @param *block The IR block the node belongs to.
2467 * @param *op1 The first operand.
2468 * @param *op2 The second operand.
2469 * @param *mode The mode of the operands and the result.
2471 ir_node *new_r_Carry(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2474 * Constructor for a Borrow node.
2476 * @param *block The IR block the node belongs to.
2477 * @param *op1 The first operand.
2478 * @param *op2 The second operand.
2479 * @param *mode The mode of the operands and the results.
2481 ir_node *new_r_Borrow(ir_node *block, ir_node *op1, ir_node *op2, ir_mode *mode);
2483 /** Constructor for a Phi node.
2485 * @param *block The IR block the node belongs to.
2486 * @param arity The number of predecessors
2487 * @param *in[] Array with predecessors. The constructor copies this array.
2488 * @param *mode The mode of it's inputs and output.
2490 ir_node *new_r_Phi(ir_node *block, int arity, ir_node *in[], ir_mode *mode);
2492 /** Constructor for a Load node.
2494 * @param *block The IR block the node belongs to.
2495 * @param *store The current memory
2496 * @param *adr A pointer to the variable to be read in this memory.
2497 * @param *mode The mode of the value to be loaded.
2498 * @param flags Additional flags for alignment, volatility and pin state.
2500 ir_node *new_r_Load(ir_node *block, ir_node *store,
2501 ir_node *adr, ir_mode *mode, ir_cons_flags flags);
2503 /** Constructor for a Store node.
2505 * @param *block The IR block the node belongs to.
2506 * @param *store The current memory
2507 * @param *adr A pointer to the variable to be read in this memory.
2508 * @param *val The value to write to this variable.
2509 * @param flags Additional flags for alignment, volatility and pin state.
2511 ir_node *new_r_Store(ir_node *block, ir_node *store,
2512 ir_node *adr, ir_node *val, ir_cons_flags flags);
2514 /** Constructor for a Alloc node.
2516 * The Alloc node extends the memory by space for an entity of type alloc_type.
2518 * @param *block The IR block the node belongs to.
2519 * @param *store The memory which shall contain the new variable.
2520 * @param *count The number of objects to allocate.
2521 * @param *alloc_type The type of the allocated variable.
2522 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
2524 ir_node *new_r_Alloc(ir_node *block, ir_node *store,
2525 ir_node *count, ir_type *alloc_type, ir_where_alloc where);
2527 /** Constructor for a Free node.
2529 * Frees the memory occupied by the entity pointed to by the pointer
2530 * arg. Type indicates the type of the entity the argument points to.
2532 * @param *block The IR block the node belongs to.
2533 * @param *store The memory which shall contain the new variable.
2534 * @param *ptr The pointer to the object to free.
2535 * @param *size The number of objects of type free_type to free in a sequence.
2536 * @param *free_type The type of the freed variable.
2537 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
2539 ir_node *new_r_Free(ir_node *block, ir_node *store,
2540 ir_node *ptr, ir_node *size, ir_type *free_type, ir_where_alloc where);
2542 /** Constructor for a Sync node.
2544 * Merges several memory values. The node assumes that a variable
2545 * either occurs only in one of the memories, or it contains the same
2546 * value in all memories where it occurs.
2548 * @param *block The IR block the node belongs to.
2549 * @param arity The number of memories to synchronize.
2550 * @param *in[] An array of pointers to nodes that produce an output of type memory.
2551 * The constructor copies this array.
2553 ir_node *new_r_Sync(ir_node *block, int arity, ir_node *in[]);
2555 /** Constructor for a Proj node.
2557 * Projects a single value out of a tuple. The parameter proj gives the
2558 * position of the value within the tuple.
2560 * @param arg A node producing a tuple.
2561 * @param mode The mode of the value to project.
2562 * @param proj The position of the value in the tuple.
2564 ir_node *new_r_Proj(ir_node *arg, ir_mode *mode, long proj);
2566 /** Constructor for a defaultProj node.
2568 * Represents the default control flow of a Switch-Cond node.
2570 * @param *block The IR block the node belongs to.
2571 * @param arg A node producing a tuple.
2572 * @param max_proj The end position of the value in the tuple.
2574 ir_node *new_r_defaultProj(ir_node *arg, long max_proj);
2577 /** Constructor for a Tuple node.
2579 * This is an auxiliary node to replace a node that returns a tuple
2580 * without changing the corresponding Proj nodes.
2582 * @param *block The IR block the node belongs to.
2583 * @param arity The number of tuple elements.
2584 * @param *in[] An array containing pointers to the nodes producing the tuple elements.
2585 * The constructor copies this array.
2587 ir_node *new_r_Tuple(ir_node *block, int arity, ir_node *in[]);
2589 /** Constructor for a Id node.
2591 * This is an auxiliary node to replace a node that returns a single
2594 * @param *block The IR block the node belongs to.
2595 * @param *val The operand to Id.
2596 * @param *mode The mode of *val.
2598 ir_node *new_r_Id(ir_node *block, ir_node *val, ir_mode *mode);
2600 /** Constructor for a Bad node.
2602 * Returns the unique Bad node of the graph. The same as
2605 * @param *irg The IR graph the node belongs to.
2607 ir_node *new_r_Bad(ir_graph *irg);
2609 /** Constructor for a Confirm node.
2611 * Specifies constraints for a value. To support dataflow analyses.
2613 * Example: If the value never exceeds '100' this is expressed by placing a
2614 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
2616 * @param *block The IR block the node belong to.
2617 * @param *val The value we express a constraint for
2618 * @param *bound The value to compare against. Must be a firm node, typically a constant.
2619 * @param cmp The compare operation.
2621 ir_node *new_r_Confirm(ir_node *block, ir_node *val, ir_node *bound, pn_Cmp cmp);
2623 /** Constructor for a Unknown node.
2625 * Represents an arbitrary value. Places the node in
2628 * @param *irg The IR graph the node belongs to.
2629 * @param *m The mode of the unknown value.
2631 ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2633 /** Constructor for a CallBegin node.
2635 * CallBegin represents control flow depending of the pointer value
2636 * representing the called method to the called methods. The
2637 * constructor copies the method pointer input from the passed Call
2640 * @param *block The block the node belong to.
2641 * @param *callee The call node visible in the intra procedural view.
2643 ir_node *new_r_CallBegin(ir_node *block, ir_node *ptr, ir_node *call);
2645 /** Constructor for a EndReg node.
2647 * Used to represent regular procedure end in interprocedual view.
2649 * @param *irg The IR graph the node belong to.
2650 * @param *block The block the node belong to.
2652 ir_node *new_r_EndReg(ir_graph *irg, ir_node *block);
2654 /** Constructor for a EndExcept node.
2656 * Used to represent exceptional procedure end in interprocedural view.
2658 * @param *irg The IR graph the node belong to.
2659 * @param *block The block the node belong to.
2661 ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
2663 /** Constructor for a Break node.
2665 * Break represents control flow to a single control successor just as Jmp.
2666 * The blocks separated by a break may not be concatenated by an optimization.
2667 * It is used for the interprocedural representation where blocks are parted
2668 * behind Call nodes to represent the control flow to called procedures.
2670 * @param *block The block the node belong to.
2672 ir_node *new_r_Break(ir_node *block);
2674 /** Constructor for a Filter node.
2676 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
2677 * Filter is a node with two views used to construct the interprocedural view.
2678 * In intraprocedural view its semantics are identical to the Proj node.
2679 * In interprocedural view the Filter performs the Phi operation on method
2680 * parameters or results. Other than a Phi a Filter node may not be removed
2681 * if it has only a single input.
2683 * The constructor builds the Filter in intraprocedural view.
2685 * @param *block The block the node belong to.
2686 * @param *arg The tuple value to project from.
2687 * @param *mode The mode of the projected value.
2688 * @param proj The position in the tuple to project from.
2690 ir_node *new_r_Filter(ir_node *block, ir_node *arg, ir_mode *mode, long proj);
2692 /** Constructor for a NoMem node.
2694 * Returns the unique NoMem node of the graph. The same as
2697 * @param *irg The IR graph the node belongs to.
2699 ir_node *new_r_NoMem(ir_graph *irg);
2701 /** Constructor for a Mux node.
2703 * @param *block The block the node belong to.
2704 * @param *sel The ir_node that calculates the boolean select.
2705 * @param *ir_true The ir_node that calculates the true result.
2706 * @param *ir_false The ir_node that calculates the false result.
2707 * @param *mode The mode of the node (and it_true and ir_false).
2709 ir_node *new_r_Mux(ir_node *block, ir_node *sel,
2710 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2712 /** Constructor for a CopyB node.
2714 * @param *block The block the node belong to.
2715 * @param *store The current memory
2716 * @param *dst The ir_node that represents the destination address.
2717 * @param *src The ir_node that represents the source address.
2718 * @param *data_type The type of the copied data
2720 ir_node *new_r_CopyB(ir_node *block, ir_node *store,
2721 ir_node *dst, ir_node *src, ir_type *data_type);
2723 /** Constructor for a InstOf node.
2725 * A High-Level Type check.
2727 * @param *block The block the node belong to.
2728 * @param *store The memory in which the object the entity should be selected
2729 * from is allocated.
2730 * @param *objptr A pointer to a object of a class type.
2731 * @param *type The type of which objptr must be.
2733 ir_node *new_r_InstOf(ir_node *block, ir_node *store,
2734 ir_node *objptr, ir_type *type);
2736 /** Constructor for a Raise node.
2738 * A High-Level Exception throw.
2740 * @param *block The IR block the node belongs to.
2741 * @param *store The current memory.
2742 * @param *obj A pointer to the Except variable.
2744 ir_node *new_r_Raise(ir_node *block, ir_node *store, ir_node *obj);
2746 /** Constructor for a Bound node.
2748 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2750 * @param *block The block the node belong to.
2751 * @param *store The current memory.
2752 * @param *idx The ir_node that represents an index.
2753 * @param *lower The ir_node that represents the lower bound for the index.
2754 * @param *upper The ir_node that represents the upper bound for the index.
2756 ir_node *new_r_Bound(ir_node *block, ir_node *store,
2757 ir_node *idx, ir_node *lower, ir_node *upper);
2759 /** Constructor for a Pin node.
2761 * @param *block The block the node belong to.
2762 * @param *node The node which value should be pinned.
2764 ir_node *new_r_Pin(ir_node *block, ir_node *node);
2766 /** Constructor for an ASM pseudo node.
2768 * @param *block The block the node belong to.
2769 * @param arity The number of data inputs to the node.
2770 * @param *in The array of length arity of data inputs.
2771 * @param *inputs The array of length arity of input constraints.
2772 * @param n_outs The number of data outputs to the node.
2773 * @param *outputs The array of length n_outs of output constraints.
2774 * @param n_clobber The number of clobbered registers.
2775 * @param *clobber The array of length n_clobber of clobbered registers.
2776 * @param *asm_text The assembler text.
2778 ir_node *new_r_ASM(ir_node *block,
2779 int arity, ir_node *in[], ir_asm_constraint *inputs,
2780 int n_outs, ir_asm_constraint *outputs,
2781 int n_clobber, ident *clobber[], ident *asm_text);
2783 /*-----------------------------------------------------------------------*/
2784 /* The block oriented interface */
2785 /*-----------------------------------------------------------------------*/
2787 /** Sets the current block in which the following constructors place the
2788 * nodes they construct.
2790 * @param target The new current block.
2792 void set_cur_block(ir_node *target);
2794 /** Returns the current block of the current graph. */
2795 ir_node *get_cur_block(void);
2797 /** Constructor for a Block node.
2799 * Adds the block to the graph in current_ir_graph. Constructs a Block
2800 * with a fixed number of predecessors.
2802 * @param *db A Pointer for debug information.
2803 * @param arity The number of control predecessors.
2804 * @param in[] An array of control predecessors. The length of
2805 * the array must be 'arity'.
2807 ir_node *new_d_Block(dbg_info *db, int arity, ir_node *in[]);
2809 /** Constructor for a Start node.
2811 * Adds the node to the block in current_ir_block.
2813 * @param *db A pointer for debug information.
2815 ir_node *new_d_Start(dbg_info *db);
2817 /** Constructor for a End node.
2819 * Adds the node to the block in current_ir_block.
2821 * @param *db A pointer for debug information.
2823 ir_node *new_d_End(dbg_info *db);
2825 /** Constructor for a Jmp node.
2827 * Adds the node to the block in current_ir_block.
2829 * Jmp represents control flow to a single control successor.
2831 * @param *db A pointer for debug information.
2833 ir_node *new_d_Jmp(dbg_info *db);
2835 /** Constructor for an IJmp node.
2837 * IJmp represents control flow to a single control successor not
2838 * statically known i.e. an indirect Jmp.
2840 * @param *db A pointer for debug information.
2841 * @param *tgt The IR node representing the target address.
2843 ir_node *new_d_IJmp(dbg_info *db, ir_node *tgt);
2845 /** Constructor for a Cond node.
2847 * Adds the node to the block in current_ir_block.
2849 * If c is mode_b represents a conditional branch (if/else). If c is
2850 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2851 * node, default Proj is 0.)
2853 * This is not consistent: Input to Cond is Is, Proj has as proj number
2856 * @param *db A pointer for debug information.
2857 * @param *c The conditions parameter.Can be of mode b or I_u.
2859 ir_node *new_d_Cond(dbg_info *db, ir_node *c);
2861 /** Constructor for a Return node.
2863 * Adds the node to the block in current_ir_block.
2865 * Returns the memory and zero or more return values. Only node that
2866 * can end regular control flow.
2868 * @param *db A pointer for debug information.
2869 * @param *store The state of memory.
2870 * @param arity Number of array indices.
2871 * @param *in Array with index inputs to the node.
2873 ir_node *new_d_Return(dbg_info *db, ir_node *store, int arity, ir_node *in[]);
2875 /** Constructor for a Const_type node.
2877 * Adds the node to the start block.
2879 * The constant represents a target value. This constructor sets high
2880 * level type information for the constant value.
2881 * Derives mode from passed tarval.
2883 * @param *db A pointer for debug information.
2884 * @param *con Points to an entry in the constant table. This pointer is
2885 added to the attributes of the node.
2886 * @param *tp The type of the constant.
2888 ir_node *new_d_Const_type(dbg_info *db, tarval *con, ir_type *tp);
2890 /** Constructor for a Const node.
2892 * Adds the node to the block in current_ir_block.
2894 * Constructor for a Const node. The constant represents a target
2895 * value. Sets the type information to type_unknown. (No more
2896 * supported: If tv is entity derives a somehow useful type.)
2897 * Derives mode from passed tarval.
2899 * @param *db A pointer for debug information.
2900 * @param *con Points to an entry in the constant table. This pointer is added
2901 * to the attributes of the node.
2903 ir_node *new_d_Const(dbg_info *db, tarval *con);
2905 /** Constructor for a SymConst_type node.
2907 * This is the constructor for a symbolic constant.
2908 * There are several kinds of symbolic constants:
2909 * - symconst_type_tag The symbolic constant represents a type tag. The
2910 * type the tag stands for is given explicitly.
2911 * - symconst_type_size The symbolic constant represents the size of a type.
2912 * The type of which the constant represents the size
2913 * is given explicitly.
2914 * - symconst_type_align The symbolic constant represents the alignment of a
2915 * type. The type of which the constant represents the
2916 * size is given explicitly.
2917 * - symconst_addr_ent The symbolic constant represents the address of an
2918 * entity (variable or method). The variable is given
2919 * explicitly by a firm entity.
2920 * - symconst_ofs_ent The symbolic constant represents the offset of an
2921 * entity in its owner type.
2922 * - symconst_enum_const The symbolic constant is a enumeration constant of
2923 * an enumeration type.
2925 * Inputs to the node:
2926 * No inputs except the block it belongs to.
2927 * Outputs of the node.
2928 * An unsigned integer (I_u) or a pointer (P).
2930 * Mention union in declaration so that the firmjni generator recognizes that
2931 * it can not cast the argument to an int.
2933 * @param *db A pointer for debug information.
2934 * @param mode The mode for the SymConst.
2935 * @param value A type, ident, entity or enum constant depending on the
2937 * @param kind The kind of the symbolic constant, see the list above
2938 * @param tp The source type of the constant.
2940 ir_node *new_d_SymConst_type(dbg_info *db, ir_mode *mode,
2941 union symconst_symbol value, symconst_kind kind, ir_type *tp);
2943 /** Constructor for a SymConst node.
2945 * Same as new_d_SymConst_type, except that it sets the type to type_unknown.
2947 ir_node *new_d_SymConst(dbg_info *db, ir_mode *mode,
2948 union symconst_symbol value, symconst_kind kind);
2950 /** Constructor for a simpleSel node.
2952 * This is a shortcut for the new_d_Sel() constructor. To be used for
2953 * Sel nodes that do not select from an array, i.e., have no index
2954 * inputs. It adds the two parameters 0, NULL.
2956 * @param *db A pointer for debug information.
2957 * @param *store The memory in which the object the entity should be
2958 * selected from is allocated.
2959 * @param *objptr The object from that the Sel operation selects a
2960 * single attribute out.
2961 * @param *ent The entity to select.
2963 ir_node *new_d_simpleSel(dbg_info *db, ir_node *store, ir_node *objptr, ir_entity *ent);
2965 /** Constructor for a Sel node.
2967 * The select node selects an entity (field or method) from an entity
2968 * with a compound type. It explicitly specifies the entity selected.
2969 * Dynamically the node may select entities that overwrite the given
2970 * entity. If the selected entity is an array element entity the Sel
2971 * node takes the required array indices as inputs.
2972 * Adds the node to the block in current_ir_block.
2974 * @param *db A pointer for debug information.
2975 * @param *store The memory in which the object the entity should be selected
2976 * from is allocated.
2977 * @param *objptr A pointer to a compound entity the Sel operation selects a
2978 * single attribute from.
2979 * @param arity The number of array indices needed to select an array element entity.
2980 * @param *in[] If the compound entity is an array the indices of the selected
2981 * element entity. The constructor copies this array.
2982 * @param *ent The entity to select.
2984 ir_node *new_d_Sel(dbg_info *db, ir_node *store, ir_node *objptr, int arity, ir_node *in[],
2987 /** Constructor for a Call node.
2989 * Represents all kinds of method and function calls.
2990 * Adds the node to the block in current_ir_block.
2992 * @param *db A pointer for debug information.
2993 * @param *store The actual store.
2994 * @param *callee A pointer to the called procedure.
2995 * @param arity The number of procedure parameters.
2996 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2997 * @param *tp Type information of the procedure called.
2999 ir_node *new_d_Call(dbg_info *db, ir_node *store, ir_node *callee, int arity, ir_node *in[],
3002 /** Constructor for a Builtin node.
3004 * Represents a call of a backend-specific builtin..
3005 * Adds the node to the block in current_ir_block.
3007 * @param *db A pointer for debug information.
3008 * @param *store The actual store.
3009 * @param arity The number of procedure parameters.
3010 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3011 * @param kind The kind of the called builtin.
3012 * @param *tp Type information of the procedure called.
3014 ir_node *new_d_Builtin(dbg_info *db, ir_node *store, int arity, ir_node *in[], ir_builtin_kind kind, ir_type *tp);
3016 /** Constructor for a Add node.
3018 * Adds the node to the block in current_ir_block.
3020 * @param *db A pointer for debug information.
3021 * @param *op1 The first operand.
3022 * @param *op2 The second operand.
3023 * @param *mode The mode of the operands and the result.
3025 ir_node *new_d_Add(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3027 /** Constructor for a Sub node.
3029 * Adds the node to the block in current_ir_block.
3031 * @param *db A pointer for debug information.
3032 * @param *op1 The first operand.
3033 * @param *op2 The second operand.
3034 * @param *mode The mode of the operands and the result.
3036 ir_node *new_d_Sub(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3038 /** Constructor for a Minus node.
3040 * Adds the node to the block in current_ir_block.
3042 * @param *db A pointer for debug information.
3043 * @param *op The operand .
3044 * @param *mode The mode of the operand and the result.
3046 ir_node *new_d_Minus(dbg_info *db, ir_node *op, ir_mode *mode);
3048 /** Constructor for a Mul node.
3050 * Adds the node to the block in current_ir_block.
3052 * @param *db A pointer for debug information.
3053 * @param *op1 The first operand.
3054 * @param *op2 The second operand.
3055 * @param *mode The mode of the operands and the result.
3057 ir_node *new_d_Mul(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3059 /** Constructor for a Mulh node.
3061 * Adds the node to the block in current_ir_block.
3063 * @param *db A pointer for debug information.
3064 * @param *op1 The first operand.
3065 * @param *op2 The second operand.
3066 * @param *mode The mode of the operands and the result.
3068 ir_node *new_d_Mulh(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3070 /** Constructor for a Quot node.
3072 * Adds the node to the block in current_ir_block.
3074 * @param *db A pointer for debug information.
3075 * @param *memop The store needed to model exceptions
3076 * @param *op1 The first operand.
3077 * @param *op2 The second operand.
3078 * @param *mode The mode of the result.
3079 * @param state The pinned state.
3081 ir_node *new_d_Quot(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3083 /** Constructor for a DivMod node.
3085 * Adds the node to the block in current_ir_block.
3087 * @param *db A pointer for debug information.
3088 * @param *memop The store needed to model exceptions
3089 * @param *op1 The first operand.
3090 * @param *op2 The second operand.
3091 * @param *mode The mode of the results.
3092 * @param state The pinned state.
3094 ir_node *new_d_DivMod(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3096 /** Constructor for a Div node.
3098 * Adds the node to the block in current_ir_block.
3100 * @param *db A pointer for debug information.
3101 * @param *memop The store needed to model exceptions
3102 * @param *op1 The first operand.
3103 * @param *op2 The second operand.
3104 * @param *mode The mode of the result.
3105 * @param state The pinned state.
3107 ir_node *new_d_Div(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3109 /** Constructor for a remainderless Div node.
3111 * Adds the node to the block in current_ir_block.
3113 * @param *db A pointer for debug information.
3114 * @param *memop The store needed to model exceptions
3115 * @param *op1 The first operand.
3116 * @param *op2 The second operand.
3117 * @param *mode The mode of the result.
3118 * @param state The pinned state.
3120 ir_node *new_d_DivRL(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3122 /** Constructor for a Mod node.
3124 * Adds the node to the block in current_ir_block.
3126 * @param *db A pointer for debug information.
3127 * @param *memop The store needed to model exceptions
3128 * @param *op1 The first operand.
3129 * @param *op2 The second operand.
3130 * @param *mode The mode of the result.
3131 * @param state The pinned state.
3133 ir_node *new_d_Mod(dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3135 /** Constructor for a Abs node.
3137 * Adds the node to the block in current_ir_block.
3139 * @param *db A pointer for debug information.
3140 * @param *op The operand
3141 * @param *mode The mode of the operands and the result.
3143 ir_node *new_d_Abs(dbg_info *db, ir_node *op, ir_mode *mode);
3145 /** Constructor for a And node.
3147 * Adds the node to the block in current_ir_block.
3149 * @param *db A pointer for debug information.
3150 * @param *op1 The first operand.
3151 * @param *op2 The second operand.
3152 * @param *mode The mode of the operands and the result.
3154 ir_node *new_d_And(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3156 /** Constructor for a Or node.
3158 * Adds the node to the block in current_ir_block.
3160 * @param *db A pointer for debug information.
3161 * @param *op1 The first operand.
3162 * @param *op2 The second operand.
3163 * @param *mode The mode of the operands and the result.
3165 ir_node *new_d_Or(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3167 /** Constructor for a Eor node.
3169 * Adds the node to the block in current_ir_block.
3171 * @param *db A pointer for debug information.
3172 * @param *op1 The first operand.
3173 * @param *op2 The second operand.
3174 * @param *mode The mode of the operands and the results.
3176 ir_node *new_d_Eor(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3178 /** Constructor for a Not node.
3180 * Adds the node to the block in current_ir_block.
3182 * @param *db A pointer for debug information.
3183 * @param *op The operand.
3184 * @param *mode The mode of the operand and the result.
3186 ir_node *new_d_Not(dbg_info *db, ir_node *op, ir_mode *mode);
3188 /** Constructor for a Shl node.
3190 * Adds the node to the block in current_ir_block.
3192 * @param *db A pointer for debug information.
3193 * @param *op The operand.
3194 * @param *k The number of bits to shift the operand .
3195 * @param *mode The mode of the operand and the result.
3197 ir_node *new_d_Shl(dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3199 /** Constructor for a Shr node.
3201 * Adds the node to the block in current_ir_block.
3203 * @param *db A pointer for debug information.
3204 * @param *op The operand.
3205 * @param *k The number of bits to shift the operand .
3206 * @param *mode The mode of the operand and the result.
3208 ir_node *new_d_Shr(dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3210 /** Constructor for a Shrs node.
3212 * Adds the node to the block in current_ir_block.
3214 * @param *db A pointer for debug information.
3215 * @param *op The operand.
3216 * @param *k The number of bits to shift the operand .
3217 * @param *mode The mode of the operand and the result.
3219 ir_node *new_d_Shrs(dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3221 /** Constructor for a Rotl node.
3223 * Adds the node to the block in current_ir_block.
3225 * @param *db A pointer for debug information.
3226 * @param *op The operand.
3227 * @param *k The number of bits to rotate the operand.
3228 * @param *mode The mode of the operand.
3230 ir_node *new_d_Rotl(dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3232 /** Constructor for a Cmp node.
3234 * Adds the node to the block in current_ir_block.
3236 * @param *db A pointer for debug information.
3237 * @param *op1 The first operand.
3238 * @param *op2 The second operand.
3240 ir_node *new_d_Cmp(dbg_info *db, ir_node *op1, ir_node *op2);
3242 /** Constructor for a Conv node.
3244 * Adds the node to the block in current_ir_block.
3246 * @param *db A pointer for debug information.
3247 * @param *op The operand.
3248 * @param *mode The mode of this the operand muss be converted .
3250 ir_node *new_d_Conv(dbg_info *db, ir_node *op, ir_mode *mode);
3252 /** Constructor for a strict Conv node.
3254 * Adds the node to the block in current_ir_block.
3256 * @param *db A pointer for debug information.
3257 * @param *op The operand.
3258 * @param *mode The mode of this the operand muss be converted .
3260 ir_node *new_d_strictConv(dbg_info *db, ir_node *op, ir_mode *mode);
3262 /** Constructor for a Cast node.
3264 * High level type cast
3265 * Adds the node to the block in current_ir_block.
3267 * @param *db A pointer for debug information.
3268 * @param *op The operand.
3269 * @param *to_tp The type of this the operand muss be casted .
3271 ir_node *new_d_Cast(dbg_info *db, ir_node *op, ir_type *to_tp);
3273 /** Constructor for a Carry node.
3275 * Adds the node to the block in current_ir_block.
3277 * @param *db A pointer for debug information.
3278 * @param *op1 The first operand.
3279 * @param *op2 The second operand.
3280 * @param *mode The mode of the operands and the result.
3282 ir_node *new_d_Carry(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3284 /** Constructor for a Borrow node.
3286 * Adds the node to the block in current_ir_block.
3288 * @param *db A pointer for debug information.
3289 * @param *op1 The first operand.
3290 * @param *op2 The second operand.
3291 * @param *mode The mode of the operands and the result.
3293 ir_node *new_d_Borrow(dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3295 /** Constructor for a Phi node.
3297 * Adds the node to the block in current_ir_block.
3299 * @param *db A pointer for debug information.
3300 * @param arity The number of predecessors
3301 * @param *in Array with predecessors
3302 * @param *mode The mode of it's inputs and output.
3304 ir_node *new_d_Phi(dbg_info *db, int arity, ir_node *in[], ir_mode *mode);
3306 /** Constructor for a Load node.
3308 * Adds the node to the block in current_ir_block.
3310 * @param *db A pointer for debug information.
3311 * @param *store The current memory
3312 * @param *addr A pointer to the variable to be read in this memory.
3313 * @param *mode The mode of the value to be loaded.
3314 * @param flags Additional flags for alignment, volatility and pin state.
3316 ir_node *new_d_Load(dbg_info *db, ir_node *store, ir_node *addr, ir_mode *mode, ir_cons_flags flags);
3318 /** Constructor for a Store node.
3320 * Adds the node to the block in current_ir_block.
3322 * @param *db A pointer for debug information.
3323 * @param *store The current memory
3324 * @param *addr A pointer to the variable to be read in this memory.
3325 * @param *val The value to write to this variable.
3326 * @param flags Additional flags for alignment, volatility and pin state.
3328 ir_node *new_d_Store(dbg_info *db, ir_node *store, ir_node *addr, ir_node *val, ir_cons_flags flags);
3330 /** Constructor for a Alloc node.
3332 * The Alloc node extends the memory by space for an entity of type alloc_type.
3333 * Adds the node to the block in current_ir_block.
3335 * @param *db A pointer for debug information.
3336 * @param *store The memory which shall contain the new variable.
3337 * @param *count The number of objects to allocate.
3338 * @param *alloc_type The type of the allocated variable.
3339 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3341 ir_node *new_d_Alloc(dbg_info *db, ir_node *store, ir_node *count, ir_type *alloc_type,
3342 ir_where_alloc where);
3344 /** Constructor for a Free node.
3346 * Frees the memory occupied by the entity pointed to by the pointer
3347 * arg. Type indicates the type of the entity the argument points to.
3348 * Adds the node to the block in current_ir_block.
3350 * @param *db A pointer for debug information.
3351 * @param *store The memory which shall contain the new variable.
3352 * @param *ptr The pointer to the object to free.
3353 * @param *size The number of objects of type free_type to free in a sequence.
3354 * @param *free_type The type of the freed variable.
3355 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
3357 ir_node *new_d_Free(dbg_info *db, ir_node *store, ir_node *ptr, ir_node *size,
3358 ir_type *free_type, ir_where_alloc where);
3360 /** Constructor for a Sync node.
3362 * Merges several memory values. The node assumes that a variable
3363 * either occurs only in one of the memories, or it contains the same
3364 * value in all memories where it occurs.
3365 * Adds the node to the block in current_ir_block.
3367 * @param *db A pointer for debug information.
3368 * @param arity The number of memories to synchronize.
3369 * @param **in An array of pointers to nodes that produce an output of type
3370 * memory. The constructor copies this array.
3372 ir_node *new_d_Sync(dbg_info *db, int arity, ir_node *in[]);
3374 /** Constructor for a Proj node.
3376 * Projects a single value out of a tuple. The parameter proj gives the
3377 * position of the value within the tuple.
3378 * Adds the node to the block in current_ir_block.
3380 * @param *db A pointer for deubug information.
3381 * @param arg A node producing a tuple.
3382 * @param *mode The mode of the value to project.
3383 * @param proj The position of the value in the tuple.
3385 ir_node *new_d_Proj(dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3387 /** Constructor for a defaultProj node.
3389 * Represents the default control flow of a Switch-Cond node.
3390 * Adds the node to the block in current_ir_block.
3392 * @param *db A pointer for debug information.
3393 * @param arg A node producing a tuple.
3394 * @param max_proj The end position of the value in the tuple.
3396 ir_node *new_d_defaultProj(dbg_info *db, ir_node *arg, long max_proj);
3398 /** Constructor for a Tuple node.
3400 * This is an auxiliary node to replace a node that returns a tuple
3401 * without changing the corresponding Proj nodes.
3402 * Adds the node to the block in current_ir_block.
3404 * @param *db A pointer for debug information.
3405 * @param arity The number of tuple elements.
3406 * @param **in An array containing pointers to the nodes producing the tuple elements.
3408 ir_node *new_d_Tuple(dbg_info *db, int arity, ir_node *in[]);
3410 /** Constructor for a Id node.
3412 * This is an auxiliary node to replace a node that returns a single
3413 * value. Adds the node to the block in current_ir_block.
3415 * @param *db A pointer for debug information.
3416 * @param *val The operand to Id.
3417 * @param *mode The mode of *val.
3419 ir_node *new_d_Id(dbg_info *db, ir_node *val, ir_mode *mode);
3421 /** Constructor for a Confirm node.
3423 * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3424 * Specifies constraints for a value. To support dataflow analyses.
3426 * Example: If the value never exceeds '100' this is expressed by placing a
3427 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
3429 * @param *db A pointer for debug information.
3430 * @param *val The value we express a constraint for
3431 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3432 * @param cmp The compare operation.
3434 ir_node *new_d_Confirm(dbg_info *db, ir_node *val, ir_node *bound, pn_Cmp cmp);
3436 /** Constructor for an Unknown node.
3438 * Represents an arbitrary value. Places the node in
3441 * @param *db A pointer for debug information.
3442 * @param *m The mode of the unknown value.
3444 ir_node *new_d_Unknown(dbg_info *db, ir_mode *m);
3446 /** Constructor for a CallBegin node.
3448 * CallBegin represents control flow depending of the pointer value
3449 * representing the called method to the called methods. The
3450 * constructor copies the method pointer input from the passed Call
3451 * node.Adds the node to the block in current_ir_block.
3453 * @param *db A pointer for debug information.
3454 * @param *callee The call node visible in the intra procedural view.
3456 ir_node *new_d_CallBegin(dbg_info *db, ir_node *ptr, ir_node *call);
3458 /** Constructor for an EndReg node.
3460 *Adds the node to the block in current_ir_block.
3462 * @param *db A pointer for debug information.
3464 ir_node *new_d_EndReg(dbg_info *db);
3466 /** Constructor for an EndExcept node.
3468 * Used to represent regular procedure end in interprocedual view.
3469 * Adds the node to the block in current_ir_block.
3471 * @param *db A pointer for debug information.
3473 ir_node *new_d_EndExcept(dbg_info *db);
3475 /** Constructor for a Break node.
3477 * Used to represent exceptional procedure end in interprocedural view.
3478 * Adds the node to the block in current_ir_block.
3480 * Break represents control flow to a single control successor just as Jmp.
3481 * The blocks separated by a break may not be concatenated by an optimization.
3482 * It is used for the interprocedural representation where blocks are parted
3483 * behind Call nodes to represent the control flow to called procedures.
3485 * @param *db A pointer for debug information.
3487 ir_node *new_d_Break(dbg_info *db);
3489 /** Constructor for a Filter node.
3491 * Constructor for a Filter node. Adds the node to the block in
3492 * current_ir_block. Filter is a node with two views used to
3493 * construct the interprocedural view. In intraprocedural view its
3494 * semantics are identical to the Proj node. In interprocedural view
3495 * the Filter performs the Phi operation on method parameters or
3496 * results. Other than a Phi a Filter node may not be removed if it
3497 * has only a single input.
3499 * The constructor builds the Filter in intraprocedural view.
3501 * @param *db A pointer for debug information.
3502 * @param *arg The tuple value to project from.
3503 * @param *mode The mode of the projected value.
3504 * @param proj The position in the tuple to project from.
3506 ir_node *new_d_Filter(dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3508 /** Constructor for a Mux node.
3510 * @param *db A pointer for debug information.
3511 * @param *sel The ir_node that calculates the boolean select.
3512 * @param *ir_true The ir_node that calculates the true result.
3513 * @param *ir_false The ir_node that calculates the false result.
3514 * @param *mode The mode of the node (and it_true and ir_false).
3516 ir_node *new_d_Mux(dbg_info *db, ir_node *sel,
3517 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
3519 /** Constructor for a CopyB node.
3521 * @param *db A pointer for debug information.
3522 * @param *store The current memory
3523 * @param *dst The ir_node that represents the destination address.
3524 * @param *src The ir_node that represents the source address.
3525 * @param *data_type The type of the copied data
3527 ir_node *new_d_CopyB(dbg_info *db, ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
3529 /** Constructor for a InstOf node.
3531 * A High-Level Type check.
3533 * @param *db A pointer for debug information.
3534 * @param *store The memory in which the object the entity should be selected
3535 * from is allocated.
3536 * @param *objptr A pointer to a object of a class type.
3537 * @param *type The type of which objptr must be.
3539 ir_node *new_d_InstOf(dbg_info *db, ir_node *store, ir_node *objptr, ir_type *type);
3541 /** Constructor for a Raise node.
3543 * A High-Level Exception throw.
3545 * @param *db A pointer for debug information.
3546 * @param *store The current memory.
3547 * @param *obj A pointer to the Except variable.
3549 ir_node *new_d_Raise(dbg_info *db, ir_node *store, ir_node *obj);
3551 /** Constructor for a Bound node.
3553 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
3555 * @param *db A pointer for debug information.
3556 * @param *store The current memory
3557 * @param *idx The ir_node that represents an index.
3558 * @param *lower The ir_node that represents the lower bound for the index.
3559 * @param *upper The ir_node that represents the upper bound for the index.
3561 ir_node *new_d_Bound(dbg_info *db, ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
3563 /** Constructor for a Pin node.
3565 * @param *db A pointer for debug information.
3566 * @param *node The node which value should be pinned.
3568 ir_node *new_d_Pin(dbg_info *db, ir_node *node);
3570 /** Constructor for an ASM pseudo node.
3572 * @param *db A pointer for debug information.
3573 * @param arity The number of data inputs to the node.
3574 * @param *in The array of length arity of data inputs.
3575 * @param *inputs The array of length arity of input constraints.
3576 * @param n_outs The number of data outputs to the node.
3577 * @param *outputs The array of length n_outs of output constraints.
3578 * @param n_clobber The number of clobbered registers.
3579 * @param *clobber The array of length n_clobber of clobbered registers.
3580 * @param *asm_text The assembler text.
3582 ir_node *new_d_ASM(dbg_info *db, int arity, ir_node *in[], ir_asm_constraint *inputs,
3583 int n_outs, ir_asm_constraint *outputs,
3584 int n_clobber, ident *clobber[], ident *asm_text);
3586 /*-----------------------------------------------------------------------*/
3587 /* The block oriented interface without debug support */
3588 /*-----------------------------------------------------------------------*/
3590 /** Constructor for a Block node.
3592 * Constructor for a Block node. Adds the block to the graph in
3593 * current_ir_graph. Constructs a Block with a fixed number of predecessors.
3595 * @param arity The number of control predecessors.
3596 * @param in An array of control predecessors. The length of
3597 * the array must be 'arity'.
3599 ir_node *new_Block(int arity, ir_node *in[]);
3601 /** Constructor for a Start node.
3603 * Adds the node to the block in current_ir_block.
3606 ir_node *new_Start(void);
3608 /** Constructor for an End node.
3610 * Adds the node to the block in current_ir_block.
3612 ir_node *new_End(void);
3614 /** Constructor for an EndReg node.
3616 * Used to represent regular procedure end in interprocedual view.
3617 * Adds the node to the block in current_ir_block.
3619 ir_node *new_EndReg(void);
3621 /** Constructor for an EndExpcept node.
3623 * Used to represent exceptional procedure end in interprocedural view.
3624 * Adds the node to the block in current_ir_block.
3626 ir_node *new_EndExcept(void);
3628 /** Constructor for a Jump node.
3630 * Adds the node to the block in current_ir_block.
3632 * Jmp represents control flow to a single control successor.
3634 ir_node *new_Jmp(void);
3636 /** Constructor for an IJmp node.
3638 * IJmp represents control flow to a single control successor not
3639 * statically known i.e. an indirect Jmp.
3641 * @param *tgt The IR node representing the target address.
3643 ir_node *new_IJmp(ir_node *tgt);
3645 /** Constructor for a Break node.
3646 * Break represents control flow to a single control successor just as Jmp.
3647 * The blocks separated by a break may not be concatenated by an optimization.
3648 * It is used for the interprocedural representation where blocks are parted
3649 * behind Call nodes to represent the control flow to called procedures.
3650 * Adds the node to the block in current_ir_block.
3652 ir_node *new_Break(void);
3654 /** Constructor for a Cond node.
3656 * If c is mode_b represents a conditional branch (if/else). If c is
3657 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
3658 * node, default Proj is 0.). Adds the node to the block in current_ir_block.
3660 * This is not consistent: Input to Cond is Is, Proj has as proj number
3664 * @param *c The conditions parameter.Can be of mode b or I_u.
3666 ir_node *new_Cond(ir_node *c);
3668 /** Constructor for a Return node.
3670 * Returns the memory and zero or more return values. Only node that
3671 * can end regular control flow. Adds the node to the block in current_ir_block.
3673 * @param *store The state of memory.
3674 * @param arity Number of array indices.
3675 * @param *in Array with index inputs to the node.
3677 ir_node *new_Return(ir_node *store, int arity, ir_node *in[]);
3679 /** Constructor for a Const node.
3681 * Constructor for a Const node. The constant represents a target
3682 * value. Sets the type information to type_unknown. (No more
3683 * supported: If tv is entity derives a somehow useful type.)
3684 * Adds the node to the block in current_ir_block.
3685 * Derives mode from passed tarval.
3687 * @param *con Points to an entry in the constant table. This pointer is
3688 * added to the attributes of the node.
3690 ir_node *new_Const(tarval *con);
3693 * Make a const from a long.
3694 * This is just convenience for the usual
3696 * new_Const(mode, tarval_from_long(mode, ...))
3699 * @param mode The mode for the const.
3700 * @param value The value of the constant.
3701 * @return A new const node.
3703 ir_node *new_Const_long(ir_mode *mode, long value);
3705 /** Constructor for a Const node.
3707 * Derives mode from passed tarval. */
3708 ir_node *new_Const_type(tarval *con, ir_type *tp);
3710 /** Constructor for a SymConst_type node.
3712 * This is the constructor for a symbolic constant.
3713 * There are several kinds of symbolic constants:
3714 * - symconst_type_tag The symbolic constant represents a type tag. The
3715 * type the tag stands for is given explicitly.
3716 * - symconst_type_size The symbolic constant represents the size of a type.
3717 * The type of which the constant represents the size
3718 * is given explicitly.
3719 * - symconst_type_align The symbolic constant represents the alignment of a
3720 * type. The type of which the constant represents the
3721 * size is given explicitly.
3722 * - symconst_addr_ent The symbolic constant represents the address of an
3723 * entity (variable or method). The variable is given
3724 * explicitly by a firm entity.
3725 * - symconst_ofs_ent The symbolic constant represents the offset of an
3726 * entity in its owner type.
3727 * - symconst_enum_const The symbolic constant is a enumeration constant of
3728 * an enumeration type.
3730 * Inputs to the node:
3731 * No inputs except the block it belongs to.
3732 * Outputs of the node.
3733 * An unsigned integer (I_u) or a pointer (P).
3735 * Mention union in declaration so that the firmjni generator recognizes that
3736 * it can not cast the argument to an int.
3738 * @param mode The mode for the SymConst.
3739 * @param value A type, ident, entity or enum constant depending on the
3741 * @param kind The kind of the symbolic constant, see the list above
3742 * @param tp The source type of the constant.
3744 ir_node *new_SymConst_type(ir_mode *mode, union symconst_symbol value, symconst_kind kind, ir_type *tp);
3746 /** Constructor for a SymConst node.
3748 * This is the constructor for a symbolic constant.
3749 * There are several kinds of symbolic constants:
3750 * - symconst_type_tag The symbolic constant represents a type tag. The
3751 * type the tag stands for is given explicitly.
3752 * - symconst_type_size The symbolic constant represents the size of a type.
3753 * The type of which the constant represents the size
3754 * is given explicitly.
3755 * - symconst_type_align The symbolic constant represents the alignment of a
3756 * type. The type of which the constant represents the
3757 * size is given explicitly.
3758 * - symconst_addr_ent The symbolic constant represents the address of an
3759 * entity (variable or method). The variable is given
3760 * explicitly by a firm entity.
3761 * - symconst_ofs_ent The symbolic constant represents the offset of an
3762 * entity in its owner type.
3763 * - symconst_enum_const The symbolic constant is a enumeration constant of
3764 * an enumeration type.
3766 * Inputs to the node:
3767 * No inputs except the block it belongs to.
3768 * Outputs of the node.
3769 * An unsigned integer (I_u) or a pointer (P).
3771 * Mention union in declaration so that the firmjni generator recognizes that
3772 * it can not cast the argument to an int.
3774 * @param mode The mode for the SymConst.
3775 * @param value A type, ident, entity or enum constant depending on the
3777 * @param kind The kind of the symbolic constant, see the list above
3779 ir_node *new_SymConst(ir_mode *mode, union symconst_symbol value, symconst_kind kind);
3781 /** Constructor for a simpelSel node.
3783 * This is a shortcut for the new_Sel() constructor. To be used for
3784 * Sel nodes that do not select from an array, i.e., have no index
3785 * inputs. It adds the two parameters 0, NULL.
3787 * @param *store The memory in which the object the entity should be selected from is allocated.
3788 * @param *objptr The object from that the Sel operation selects a single attribute out.
3789 * @param *ent The entity to select.
3791 ir_node *new_simpleSel(ir_node *store, ir_node *objptr, ir_entity *ent);
3793 /** Constructor for a Sel node.
3795 * The select node selects an entity (field or method) from an entity
3796 * with a compound type. It explicitly specifies the entity selected.
3797 * Dynamically the node may select entities that overwrite the given
3798 * entity. If the selected entity is an array element entity the Sel
3799 * node takes the required array indices as inputs.
3800 * Adds the node to the block in current_ir_block.
3802 * @param *store The memory in which the object the entity should be selected
3803 * from is allocated.
3804 * @param *objptr A pointer to a compound entity the Sel operation selects a
3805 * single attribute from.
3806 * @param arity The number of array indices needed to select an array element entity.
3807 * @param *in[] If the compound entity is an array the indices of the selected
3808 * element entity. The constructor copies this array.
3809 * @param *ent The entity to select.
3811 ir_node *new_Sel(ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3814 /** Constructor for a Call node.
3816 * Adds the node to the block in current_ir_block.
3817 * Represents all kinds of method and function calls.
3819 * @param *store The actual store.
3820 * @param *callee A pointer to the called procedure.
3821 * @param arity The number of procedure parameters.
3822 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3823 * @param *tp Type information of the procedure called.
3825 ir_node *new_Call(ir_node *store, ir_node *callee, int arity, ir_node *in[],
3828 /** Constructor for a Builtin node.
3830 * Represents a call of a backend-specific builtin..
3831 * Represents all kinds of method and function calls.
3833 * @param *store The actual store.
3834 * @param kind The kind of the called builtin.
3835 * @param arity The number of procedure parameters.
3836 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3837 * @param *tp Type information of the procedure called.
3839 ir_node *new_Builtin(ir_node *store, int arity, ir_node *in[],
3840 ir_builtin_kind kind, ir_type *tp);
3842 /** Constructor for a CallBegin node.
3844 * CallBegin represents control flow depending of the pointer value
3845 * representing the called method to the called methods. The
3846 * constructor copies the method pointer input from the passed Call
3847 * node. Adds the node to the block in current_ir_block.
3849 * @param *callee A pointer to the called procedure.
3851 ir_node *new_CallBegin(ir_node *ptr, ir_node *call);
3853 /** Constructor for a Add node.
3855 * Adds the node to the block in current_ir_block.
3857 * @param *op1 The first operand.
3858 * @param *op2 The second operand.
3859 * @param *mode The mode of the operands and the result.
3861 ir_node *new_Add(ir_node *op1, ir_node *op2, ir_mode *mode);
3863 /** Constructor for a Sub node.
3865 * Adds the node to the block in current_ir_block.
3867 * @param *op1 The first operand.
3868 * @param *op2 The second operand.
3869 * @param *mode The mode of the operands and the result.
3871 ir_node *new_Sub(ir_node *op1, ir_node *op2, ir_mode *mode);
3873 /** Constructor for a Minus node.
3875 * Adds the node to the block in current_ir_block.
3877 * @param *op The operand .
3878 * @param *mode The mode of the operand and the result.
3880 ir_node *new_Minus(ir_node *op, ir_mode *mode);
3883 * Constructor for a Mul node. Adds the node to the block in current_ir_block.
3885 * @param *op1 The first operand.
3886 * @param *op2 The second operand.
3887 * @param *mode The mode of the operands and the result.
3889 ir_node *new_Mul(ir_node *op1, ir_node *op2, ir_mode *mode);
3892 * Constructor for a Mulh node. Adds the node to the block in current_ir_block.
3894 * @param *op1 The first operand.
3895 * @param *op2 The second operand.
3896 * @param *mode The mode of the operands and the result.
3898 ir_node *new_Mulh(ir_node *op1, ir_node *op2, ir_mode *mode);
3900 /** Constructor for a Quot node.
3902 * Adds the node to the block in current_ir_block.
3904 * @param *memop The store needed to model exceptions
3905 * @param *op1 The first operand.
3906 * @param *op2 The second operand.
3907 * @param *mode The mode of the result.
3908 * @param state The pinned state.
3910 ir_node *new_Quot(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3912 /** Constructor for a DivMod node.
3914 * Adds the node to the block in current_ir_block.
3916 * @param *memop The store needed to model exceptions
3917 * @param *op1 The first operand.
3918 * @param *op2 The second operand.
3919 * @param *mode The mode of the results.
3920 * @param state The pinned state.
3922 ir_node *new_DivMod(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3924 /** Constructor for a Div node.
3926 * Adds the node to the block in current_ir_block.
3928 * @param *memop The store needed to model exceptions
3929 * @param *op1 The first operand.
3930 * @param *op2 The second operand.
3931 * @param *mode The mode of the result.
3932 * @param state The pinned state.
3934 ir_node *new_Div(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3936 /** Constructor for a remainderless Div node.
3938 * Adds the node to the block in current_ir_block.
3940 * @param *memop The store needed to model exceptions
3941 * @param *op1 The first operand.
3942 * @param *op2 The second operand.
3943 * @param *mode The mode of the result.
3944 * @param state The pinned state.
3946 ir_node *new_DivRL(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3948 /** Constructor for a Mod node.
3950 * Adds the node to the block in current_ir_block.
3952 * @param *memop The store needed to model exceptions
3953 * @param *op1 The first operand.
3954 * @param *op2 The second operand.
3955 * @param *mode The mode of the result.
3956 * @param state The pinned state.
3958 ir_node *new_Mod(ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3960 /** Constructor for a Abs node.
3962 * Adds the node to the block in current_ir_block.
3964 * @param *op The operand
3965 * @param *mode The mode of the operands and the result.
3967 ir_node *new_Abs(ir_node *op, ir_mode *mode);
3969 /** Constructor for a And node.
3971 * Adds the node to the block in current_ir_block.
3973 * @param *op1 The first operand.
3974 * @param *op2 The second operand.
3975 * @param *mode The mode of the operands and the result.
3977 ir_node *new_And(ir_node *op1, ir_node *op2, ir_mode *mode);
3980 * Constructor for a Or node. Adds the node to the block in current_ir_block.
3982 * @param *op1 The first operand.
3983 * @param *op2 The second operand.
3984 * @param *mode The mode of the operands and the result.
3986 ir_node *new_Or(ir_node *op1, ir_node *op2, ir_mode *mode);
3989 * Constructor for a Eor node. Adds the node to the block in current_ir_block.
3991 * @param *op1 The first operand.
3992 * @param *op2 The second operand.
3993 * @param *mode The mode of the operands and the results.
3995 ir_node *new_Eor(ir_node *op1, ir_node *op2, ir_mode *mode);
3997 /** Constructor for a Not node.
3999 * Adds the node to the block in current_ir_block.
4001 * @param *op The operand.
4002 * @param *mode The mode of the operand and the result.
4004 ir_node *new_Not(ir_node *op, ir_mode *mode);
4006 /** Constructor for a Shl node.
4008 * Adds the node to the block in current_ir_block.
4010 * @param *op The operand.
4011 * @param *k The number of bits to shift the operand .
4012 * @param *mode The mode of the operand and the result.
4014 ir_node *new_Shl(ir_node *op, ir_node *k, ir_mode *mode);
4017 * Constructor for a Shr node. Adds the node to the block in current_ir_block.
4019 * @param *op The operand.
4020 * @param *k The number of bits to shift the operand .
4021 * @param *mode The mode of the operand and the result.
4023 ir_node *new_Shr(ir_node *op, ir_node *k, ir_mode *mode);
4025 /** Constructor for a Shrs node.
4027 * Adds the node to the block in current_ir_block.
4029 * @param *op The operand.
4030 * @param *k The number of bits to shift the operand .
4031 * @param *mode The mode of the operand and the result.
4033 ir_node *new_Shrs(ir_node *op, ir_node *k, ir_mode *mode);
4035 /** Constructor for a Rotl node.
4037 * Adds the node to the block in current_ir_block.
4039 * @param *op The operand.
4040 * @param *k The number of bits to rotate the operand.
4041 * @param *mode The mode of the operand.
4043 ir_node *new_Rotl(ir_node *op, ir_node *k, ir_mode *mode);
4045 /** Constructor for a Cmp node.
4047 * Adds the node to the block in current_ir_block.
4049 * @param *op1 The first operand.
4050 * @param *op2 The second operand.
4052 ir_node *new_Cmp(ir_node *op1, ir_node *op2);
4054 /** Constructor for a Conv node.
4056 * Adds the node to the block in current_ir_block.
4058 * @param *op The operand.
4059 * @param *mode The mode of this the operand muss be converted.
4061 ir_node *new_Conv(ir_node *op, ir_mode *mode);
4063 /** Constructor for a strict Conv node.
4065 * Adds the node to the block in current_ir_block.
4067 * @param *op The operand.
4068 * @param *mode The mode of this the operand muss be converted.
4070 ir_node *new_strictConv(ir_node *op, ir_mode *mode);
4072 /** Constructor for a Cast node.
4074 * Adds the node to the block in current_ir_block.
4075 * High level type cast
4077 * @param *op The operand.
4078 * @param *to_tp The type of this the operand muss be casted .
4080 ir_node *new_Cast(ir_node *op, ir_type *to_tp);
4082 /** Constructor for a Carry node.
4084 * Adds the node to the block in current_ir_block.
4086 * @param *op1 The first operand.
4087 * @param *op2 The second operand.
4088 * @param *mode The mode of the operands and the result.
4090 ir_node *new_Carry(ir_node *op1, ir_node *op2, ir_mode *mode);
4092 /** Constructor for a Borrow node.
4094 * Adds the node to the block in current_ir_block.
4096 * @param *op1 The first operand.
4097 * @param *op2 The second operand.
4098 * @param *mode The mode of the operands and the result.
4100 ir_node *new_Borrow(ir_node *op1, ir_node *op2, ir_mode *mode);
4102 /** Constructor for a Phi node.
4104 * Adds the node to the block in current_ir_block.
4106 * @param arity The number of predecessors.
4107 * @param *in Array with predecessors.
4108 * @param *mode The mode of it's inputs and output.
4110 ir_node *new_Phi(int arity, ir_node *in[], ir_mode *mode);
4112 /** Constructor for a Load node.
4114 * @param *store The current memory.
4115 * @param *addr A pointer to the variable to be read in this memory.
4116 * @param *mode The mode of the value to be loaded.
4117 * @param flags Additional flags for alignment, volatility and pin state.
4119 ir_node *new_Load(ir_node *store, ir_node *addr, ir_mode *mode, ir_cons_flags flags);
4121 /** Constructor for a Store node.
4123 * @param *store The current memory.
4124 * @param *addr A pointer to the variable to be read in this memory.
4125 * @param *val The value to write to this variable.
4126 * @param flags Additional flags for alignment, volatility and pin state.
4128 ir_node *new_Store(ir_node *store, ir_node *addr, ir_node *val, ir_cons_flags flags);
4130 /** Constructor for a Alloc node.
4132 * The Alloc node extends the memory by space for an entity of type alloc_type.
4133 * Adds the node to the block in current_ir_block.
4135 * @param *store The memory which shall contain the new variable.
4136 * @param *count The number of objects to allocate.
4137 * @param *alloc_type The type of the allocated variable.
4138 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
4140 ir_node *new_Alloc(ir_node *store, ir_node *count, ir_type *alloc_type,
4141 ir_where_alloc where);
4143 /** Constructor for a Free node.
4145 * Frees the memory occupied by the entity pointed to by the pointer
4146 * arg. Type indicates the type of the entity the argument points to.
4147 * Adds the node to the block in current_ir_block.
4149 * @param *store The memory which shall contain the new variable.
4150 * @param *ptr The pointer to the object to free.
4151 * @param *size The number of objects of type free_type to free in a sequence.
4152 * @param *free_type The type of the freed variable.
4153 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
4155 ir_node *new_Free(ir_node *store, ir_node *ptr, ir_node *size,
4156 ir_type *free_type, ir_where_alloc where);
4158 /** Constructor for a Sync node.
4160 * Merges several memory values. The node assumes that a variable
4161 * either occurs only in one of the memories, or it contains the same
4162 * value in all memories where it occurs.
4163 * Adds the node to the block in current_ir_block.
4165 * @param arity The number of memories to synchronize.
4166 * @param **in An array of pointers to nodes that produce an output of type
4167 * memory. The constructor copies this array.
4169 ir_node *new_Sync(int arity, ir_node *in[]);
4171 /** Constructor for a Proj node.
4173 * Projects a single value out of a tuple. The parameter proj gives the
4174 * position of the value within the tuple.
4175 * Adds the node to the block in current_ir_block.
4177 * @param arg A node producing a tuple.
4178 * @param *mode The mode of the value to project.
4179 * @param proj The position of the value in the tuple.
4181 ir_node *new_Proj(ir_node *arg, ir_mode *mode, long proj);
4183 /** Constructor for a Filter node.
4185 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
4186 * Filter is a node with two views used to construct the interprocedural view.
4187 * In intraprocedural view its semantics are identical to the Proj node.
4188 * In interprocedural view the Filter performs the Phi operation on method
4189 * parameters or results. Other than a Phi a Filter node may not be removed
4190 * if it has only a single input.
4192 * The constructor builds the Filter in intraprocedural view.
4194 * @param *arg The tuple value to project from.
4195 * @param *mode The mode of the projected value.
4196 * @param proj The position in the tuple to project from.
4198 ir_node *new_Filter(ir_node *arg, ir_mode *mode, long proj);
4200 /** Constructor for a defaultProj node.
4202 * Represents the default control flow of a Switch-Cond node.
4203 * Adds the node to the block in current_ir_block.
4205 * @param arg A node producing a tuple.
4206 * @param max_proj The end position of the value in the tuple.
4208 ir_node *new_defaultProj(ir_node *arg, long max_proj);
4210 /** Constructor for a Tuple node.
4212 * This is an auxiliary node to replace a node that returns a tuple
4213 * without changing the corresponding Proj nodes.
4214 * Adds the node to the block in current_ir_block.
4216 * @param arity The number of tuple elements.
4217 * @param **in An array containing pointers to the nodes producing the tuple elements.
4219 ir_node *new_Tuple(int arity, ir_node *in[]);
4221 /** Constructor for an Id node.
4223 * This is an auxiliary node to replace a node that returns a single
4224 * value. Adds the node to the block in current_ir_block.
4226 * @param *val The operand to Id.
4227 * @param *mode The mode of *val.
4229 ir_node *new_Id(ir_node *val, ir_mode *mode);
4231 /** Constructor for a Bad node.
4233 * Returns the unique Bad node of the graph. The same as
4236 ir_node *new_Bad(void);
4238 /** Constructor for a Confirm node.
4240 * Specifies constraints for a value. To support dataflow analyses.
4241 * Adds the node to the block in current_ir_block.
4243 * Example: If the value never exceeds '100' this is expressed by placing a
4244 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
4246 * @param *val The value we express a constraint for
4247 * @param *bound The value to compare against. Must be a firm node, typically a constant.
4248 * @param cmp The compare operation.
4250 ir_node *new_Confirm(ir_node *val, ir_node *bound, pn_Cmp cmp);
4252 /** Constructor for an Unknown node.
4254 * Represents an arbitrary value. Places the node in
4257 * @param *m The mode of the unknown value.
4259 ir_node *new_Unknown(ir_mode *m);
4261 /** Constructor for a NoMem node.
4263 * Returns the unique NoMem node of the graph. The same as
4266 ir_node *new_NoMem(void);
4268 /** Constructor for a Mux node.
4270 * Adds the node to the block in current_ir_block.
4272 * @param *sel The ir_node that calculates the boolean select.
4273 * @param *ir_true The ir_node that calculates the true result.
4274 * @param *ir_false The ir_node that calculates the false result.
4275 * @param *mode The mode of the node (and it_true and ir_false).
4277 ir_node *new_Mux(ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
4279 /** Constructor for a CopyB node.
4281 * Adds the node to the block in current_ir_block.
4283 * @param *store The current memory
4284 * @param *dst The ir_node that represents the destination address.
4285 * @param *src The ir_node that represents the source address.
4286 * @param *data_type The type of the copied data
4288 ir_node *new_CopyB(ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
4290 /** Constructor for a InstOf node.
4292 * A High-Level Type check.
4294 * @param *store The memory in which the object the entity should be selected
4295 * from is allocated.
4296 * @param *objptr A pointer to a object of a class type.
4297 * @param *type The type of which objptr must be.
4299 ir_node *new_InstOf(ir_node *store, ir_node *objptr, ir_type *type);
4301 /**Constructor for a Raise node.
4303 * A High-Level Exception throw.
4305 * @param *store The current memory.
4306 * @param *obj A pointer to the Except variable.
4308 ir_node *new_Raise(ir_node *store, ir_node *obj);
4310 /** Constructor for a Bound node.
4312 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
4314 * Adds the node to the block in current_ir_block.
4316 * @param *store The current memory
4317 * @param *idx The ir_node that represents an index.
4318 * @param *lower The ir_node that represents the lower bound for the index.
4319 * @param *upper The ir_node that represents the upper bound for the index.
4321 ir_node *new_Bound(ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
4323 /** Constructor for a Pin node.
4325 * @param *node The node which value should be pinned.
4327 ir_node *new_Pin(ir_node *node);
4329 /** Constructor for an ASM pseudo node.
4331 * @param arity The number of data inputs to the node.
4332 * @param *in The array of length arity of data inputs.
4333 * @param *inputs The array of length arity of input constraints.
4334 * @param n_outs The number of data outputs to the node.
4335 * @param *outputs The array of length n_outs of output constraints.
4336 * @param n_clobber The number of clobbered registers.
4337 * @param *clobber The array of length n_clobber of clobbered registers.
4338 * @param *asm_text The assembler text.
4340 ir_node *new_ASM(int arity, ir_node *in[], ir_asm_constraint *inputs,
4341 int n_outs, ir_asm_constraint *outputs,
4342 int n_clobber, ident *clobber[], ident *asm_text);
4344 /** Constructor for a Dummy node.
4346 * @param *mode The mode of the node.
4348 ir_node *new_Dummy(ir_mode *mode);
4350 ir_node *new_r_Dummy(ir_graph *irg, ir_mode *mode);
4352 ir_node *new_rd_Dummy(dbg_info *db, ir_graph *irg, ir_mode *mode);
4354 /*---------------------------------------------------------------------*/
4355 /* The comfortable interface. */
4356 /* Supports automatic Phi node construction. */
4357 /* All routines of the block oriented interface except new_Block are */
4359 /*---------------------------------------------------------------------*/
4361 /** Create an immature Block.
4363 * An immature Block has an unknown number of predecessors. Predecessors
4364 * can be added with add_immBlock_pred(). Once all predecessors are
4365 * added the block must be matured.
4367 * Adds the block to the graph in current_ir_graph. Can be used with automatic
4368 * Phi node construction.
4369 * This constructor can only be used if the graph is in state_building.
4371 ir_node *new_d_immBlock(dbg_info *db);
4372 ir_node *new_immBlock(void);
4374 /** Create an immature PartBlock.
4376 * An immature block has only one Block or PartBlock predecessor.
4377 * A PartBlock forms together with one BLock and possibly other
4378 * PartBlocks a MacroBlock.
4380 * Adds the PartBlock to the graph in current_ir_graph. Does set
4381 * current_block. Can be used with automatic Phi node construction.
4382 * This constructor can only be used if the graph is in
4385 ir_node *new_d_immPartBlock(dbg_info *db, ir_node *pred_jmp);
4386 ir_node *new_immPartBlock(ir_node *pred_jmp);
4388 /** Add a control flow edge to an immature block. */
4389 void add_immBlock_pred(ir_node *immblock, ir_node *jmp);
4391 /** Finalize a Block node, when all control flows are known. */
4392 void mature_immBlock(ir_node *block);
4393 #define mature_cur_block() mature_immBlock(get_cur_block());
4396 /** Get the current value of a local variable.
4398 * Use this function to obtain the last definition of the local variable
4399 * associated with pos. Pos may not exceed the value passed as n_loc
4400 * to new_ir_graph. This call automatically inserts Phi nodes.
4402 * @param *db A pointer for debug information.
4403 * @param pos The position/id of the local variable.
4404 * @param *mode The mode of the value to get.
4406 ir_node *get_d_value(dbg_info *db, int pos, ir_mode *mode);
4407 ir_node *get_value(int pos, ir_mode *mode);
4409 /** Remark a new definition of a variable.
4411 * Use this function to remember a new definition of the value
4412 * associated with pos. Pos may not exceed the value passed as n_loc
4413 * to new_ir_graph. This call is needed to automatically inserts Phi
4416 * @param pos The position/id of the local variable.
4417 * @param *value The new value written to the local variable.
4419 void set_value(int pos, ir_node *value);
4421 /** Get the current memory state.
4423 * Use this function to obtain the last definition of the memory
4424 * state. This call automatically inserts Phi nodes for the memory
4427 ir_node *get_store(void);
4429 /** Remark a new definition of the memory state.
4431 * Use this function to remember a new definition of the memory state.
4432 * This call is needed to automatically inserts Phi nodes.
4434 * @param *store The new memory state.
4436 void set_store(ir_node *store);
4438 /** keep this node alive even if End is not control-reachable from it
4440 * @param ka The node to keep alive.
4442 void keep_alive(ir_node *ka);
4444 /** Returns the frame type of the current graph */
4445 ir_type *get_cur_frame_type(void);
4448 /* --- initialize and finalize IR construction --- */
4450 /** Puts the graph into state "phase_high" */
4451 #define irg_finalize_cons(irg) set_irg_phase_state(irg, phase_high)
4453 /** Puts the program and all graphs into state phase_high.
4455 * This also remarks, the construction of types is finished,
4456 * e.g., that no more subtypes will be added. */
4457 void irp_finalize_cons(void);
4459 /* --- Initialization --- */