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"
1141 * constrained flags for memory operations.
1143 typedef enum ir_cons_flags {
1144 cons_none = 0, /**< No constrains. */
1145 cons_volatile = 1U << 0, /**< Memory operation is volatile. */
1146 cons_unaligned = 1U << 1, /**< Memory operation is unaligned. */
1147 cons_floats = 1U << 2 /**< Memory operation can float. */
1150 /*-------------------------------------------------------------------------*/
1151 /* The raw interface */
1152 /*-------------------------------------------------------------------------*/
1154 /** Constructor for a Block node.
1156 * Constructs a mature block with the given predecessors.
1158 * @param *db A Pointer for debug information.
1159 * @param irg The IR graph the block belongs to.
1160 * @param arity The number of control predecessors.
1161 * @param in[] An array of control predecessors. The length of
1162 * the array must be 'arity'. The constructor copies this array.
1164 FIRM_DLL ir_node *new_rd_Block(dbg_info *db, ir_graph *irg, int arity, ir_node *in[]);
1166 /** Constructor for a Start node.
1168 * @param *db A pointer for debug information.
1169 * @param *irg The IR graph the node belongs to.
1170 * @param *block The IR block the node belongs to.
1172 FIRM_DLL ir_node *new_rd_Start(dbg_info *db, ir_graph *irg, ir_node *block);
1174 /** Constructor for a End node.
1176 * @param *db A pointer for debug information.
1177 * @param *irg The IR graph the node belongs to.
1178 * @param *block The IR block the node belongs to.
1180 FIRM_DLL ir_node *new_rd_End(dbg_info *db, ir_graph *irg, ir_node *block);
1182 /** Constructor for a Jmp node.
1184 * Jmp represents control flow to a single control successor.
1186 * @param *db A pointer for debug information.
1187 * @param *block The IR block the node belongs to.
1189 FIRM_DLL ir_node *new_rd_Jmp(dbg_info *db, ir_node *block);
1191 /** Constructor for an IJmp node.
1193 * IJmp represents control flow to a single control successor not
1194 * statically known i.e. an indirect Jmp.
1196 * @param *db A pointer for debug information.
1197 * @param *block The IR block the node belongs to.
1198 * @param *tgt The IR node representing the target address.
1200 FIRM_DLL ir_node *new_rd_IJmp(dbg_info *db, ir_node *block, ir_node *tgt);
1202 /** Constructor for a Break node.
1204 * Break represents control flow to a single control successor just as Jmp.
1205 * The blocks separated by a break may not be concatenated by an optimization.
1206 * It is used for the interprocedural representation where blocks are parted
1207 * behind Call nodes to represent the control flow to called procedures.
1209 * @param *db A pointer for debug information.
1210 * @param *block The block the node belong to.
1212 FIRM_DLL ir_node *new_rd_Break(dbg_info *db, ir_node *block);
1214 /** Constructor for a Cond node.
1216 * If c is mode_b represents a conditional branch (if/else). If c is
1217 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
1218 * node, default Proj is 0.)
1220 * This is not consistent: Input to Cond is Is, Proj has as proj number
1223 * @param *db A pointer for debug information.
1224 * @param *block The IR block the node belongs to.
1225 * @param *c The conditions parameter. Can be of mode b or I_u.
1227 FIRM_DLL ir_node *new_rd_Cond(dbg_info *db, ir_node *block, ir_node *c);
1229 /** Constructor for a Return node.
1231 * Returns the memory and zero or more return values. Only node that
1232 * can end regular control flow.
1234 * @param *db A pointer for debug information.
1235 * @param *block The IR block the node belongs to.
1236 * @param *store The state of memory.
1237 * @param arity Number of return values.
1238 * @param *in Array of length arity with return values. The constructor copies this array.
1240 FIRM_DLL ir_node *new_rd_Return(dbg_info *db, ir_node *block,
1241 ir_node *store, int arity, ir_node *in[]);
1243 /** Constructor for a Const_type node.
1245 * Adds the node to the start block.
1247 * The constant represents a target value. This constructor sets high
1248 * level type information for the constant value.
1249 * Derives mode from passed tarval.
1251 * @param *db A pointer for debug information.
1252 * @param *irg The IR graph the node belongs to.
1253 * @param *con Points to an entry in the constant table.
1254 * @param *tp The type of the constant.
1256 FIRM_DLL ir_node *new_rd_Const_type(dbg_info *db, ir_graph *irg,
1257 tarval *con, ir_type *tp);
1259 /** Constructor for a Const node.
1261 * Adds the node to the start block.
1263 * Constructor for a Const node. The constant represents a target
1264 * value. Sets the type information to type_unknown. (No more
1265 * supported: If tv is entity derives a somehow useful type.)
1266 * Derives mode from passed tarval.
1268 * @param *db A pointer for debug information.
1269 * @param *irg The IR graph the node belongs to.
1270 * @param *con Points to an entry in the constant table.
1272 FIRM_DLL ir_node *new_rd_Const(dbg_info *db, ir_graph *irg, tarval *con);
1275 * Constructor for a Const node.
1277 * Adds the node to the start block.
1279 * Constructor for a Const node. The constant represents a target
1280 * value. Sets the type information to type_unknown. (No more
1281 * supported: If tv is entity derives a somehow useful type.)
1283 * @param *db A pointer for debug information.
1284 * @param *irg The IR graph the node belongs to.
1285 * @param *mode The mode of the operands and results.
1286 * @param value A value from which the tarval is made.
1288 FIRM_DLL ir_node *new_rd_Const_long(dbg_info *db, ir_graph *irg,
1289 ir_mode *mode, long value);
1291 /** Constructor for a SymConst_type node.
1293 * This is the constructor for a symbolic constant.
1294 * There are several kinds of symbolic constants:
1295 * - symconst_type_tag The symbolic constant represents a type tag. The
1296 * type the tag stands for is given explicitly.
1297 * - symconst_type_size The symbolic constant represents the size of a type.
1298 * The type of which the constant represents the size
1299 * is given explicitly.
1300 * - symconst_type_align The symbolic constant represents the alignment of a
1301 * type. The type of which the constant represents the
1302 * size is given explicitly.
1303 * - symconst_addr_ent The symbolic constant represents the address of an
1304 * entity (variable or method). The variable is given
1305 * explicitly by a firm entity.
1306 * - symconst_ofs_ent The symbolic constant represents the offset of an
1307 * entity in its owner type.
1308 * - symconst_enum_const The symbolic constant is a enumeration constant of
1309 * an enumeration type.
1311 * Inputs to the node:
1312 * No inputs except the block it belongs to.
1313 * Outputs of the node.
1314 * An unsigned integer (I_u) or a pointer (P).
1316 * Mention union in declaration so that the firmjni generator recognizes that
1317 * it can not cast the argument to an int.
1319 * @param *db A pointer for debug information.
1320 * @param *irg The IR graph the node belongs to.
1321 * @param mode The mode for the SymConst.
1322 * @param val A type, ident, entity or enum constant depending on the
1324 * @param kind The kind of the symbolic constant, see the list above
1325 * @param tp The source type of the constant.
1327 FIRM_DLL ir_node *new_rd_SymConst_type(dbg_info *db, ir_graph *irg,
1328 ir_mode *mode, union symconst_symbol val,
1329 symconst_kind kind, ir_type *tp);
1331 /** Constructor for a SymConst node.
1333 * Same as new_rd_SymConst_type, except that it sets the type to type_unknown.
1335 FIRM_DLL ir_node *new_rd_SymConst(dbg_info *db, ir_graph *irg, ir_mode *mode,
1336 union symconst_symbol value,
1337 symconst_kind kind);
1339 /** Constructor for a SymConst addr_ent node.
1341 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1342 * symconst_addr_ent.
1343 * Adds the SymConst to the start block of irg. */
1344 FIRM_DLL ir_node *new_rd_SymConst_addr_ent(dbg_info *db, ir_graph *irg,
1345 ir_mode *mode, ir_entity *symbol,
1348 /** Constructor for a SymConst ofs_ent node.
1350 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1352 * Adds the SymConst to the start block of irg.
1354 FIRM_DLL ir_node *new_rd_SymConst_ofs_ent(dbg_info *db, ir_graph *irg,
1355 ir_mode *mode, ir_entity *symbol,
1358 /** Constructor for a SymConst type_tag node.
1360 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1361 * symconst_type_tag.
1362 * Adds the SymConst to the start block of irg.
1364 FIRM_DLL ir_node *new_rd_SymConst_type_tag(dbg_info *db, ir_graph *irg,
1365 ir_mode *mode, ir_type *symbol,
1368 /** Constructor for a SymConst size node.
1370 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1371 * symconst_type_size.
1372 * Adds the SymConst to the start block of irg. */
1373 FIRM_DLL ir_node *new_rd_SymConst_size(dbg_info *db, ir_graph *irg,
1374 ir_mode *mode, ir_type *symbol,
1377 /** Constructor for a SymConst size node.
1379 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1380 * symconst_type_align.
1381 * Adds the SymConst to the start block of irg.
1383 FIRM_DLL ir_node *new_rd_SymConst_align(dbg_info *db, ir_graph *irg,
1384 ir_mode *mode, ir_type *symbol,
1387 /** Constructor for a simpleSel node.
1389 * This is a shortcut for the new_rd_Sel() constructor. To be used for
1390 * Sel nodes that do not select from an array, i.e., have no index
1391 * inputs. It adds the two parameters 0, NULL.
1393 * @param *db A pointer for debug information.
1394 * @param *block The IR block the node belongs to.
1395 * @param *store The memory in which the object the entity should be
1396 * selected from is allocated.
1397 * @param *objptr The object from that the Sel operation selects a
1398 * single attribute out.
1399 * @param *ent The entity to select.
1401 FIRM_DLL ir_node *new_rd_simpleSel(dbg_info *db, ir_node *block, ir_node *store,
1402 ir_node *objptr, ir_entity *ent);
1404 /** Constructor for a Sel node.
1406 * The select node selects an entity (field or method) from an entity
1407 * with a compound type. It explicitly specifies the entity selected.
1408 * Dynamically the node may select entities that overwrite the given
1409 * entity. If the selected entity is an array element entity the Sel
1410 * node takes the required array indices as inputs.
1412 * @param *db A pointer for debug information.
1413 * @param *block The IR block the node belongs to.
1414 * @param *store The memory in which the object the entity should be selected
1415 * from is allocated.
1416 * @param *objptr A pointer to a compound entity the Sel operation selects a
1417 * single attribute from.
1418 * @param *n_index The number of array indices needed to select an array element entity.
1419 * @param *index[] If the compound entity is an array the indices of the selected
1420 * element entity. The constructor copies this array.
1421 * @param *ent The entity to select.
1423 FIRM_DLL ir_node *new_rd_Sel(dbg_info *db, ir_node *block, ir_node *store,
1424 ir_node *objptr, int n_index, ir_node *index[],
1427 /** Constructor for a Call node.
1429 * Represents all kinds of method and function calls.
1431 * @param *db A pointer for debug information.
1432 * @param *block The IR block the node belongs to.
1433 * @param *store The current memory state.
1434 * @param *callee A pointer to the called procedure.
1435 * @param arity The number of procedure parameters.
1436 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1437 * @param *tp Type information of the procedure called.
1439 FIRM_DLL ir_node *new_rd_Call(dbg_info *db, ir_node *block, ir_node *store,
1440 ir_node *callee, int arity, ir_node *in[],
1443 /** Constructor for a Builtin node.
1445 * Represents a call of a backend-specific builtin..
1447 * @param *db A pointer for debug information.
1448 * @param *block The IR block the node belongs to.
1449 * @param *store The current memory state.
1450 * @param arity The number of procedure parameters.
1451 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1452 * @param kind The kind of the called builtin.
1453 * @param *tp Type information of the procedure called.
1455 FIRM_DLL ir_node *new_rd_Builtin(dbg_info *db, ir_node *block, ir_node *store,
1456 int arity, ir_node *in[], ir_builtin_kind kind,
1459 /** Constructor for a Add 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 FIRM_DLL ir_node *new_rd_Add(dbg_info *db, ir_node *block, ir_node *op1,
1468 ir_node *op2, ir_mode *mode);
1470 /** Constructor for a Sub node.
1472 * @param *db A pointer for debug information.
1473 * @param *block The IR block the node belongs to.
1474 * @param *op1 The first operand.
1475 * @param *op2 The second operand.
1476 * @param *mode The mode of the operands and the result.
1478 FIRM_DLL ir_node *new_rd_Sub(dbg_info *db, ir_node *block,
1479 ir_node *op1, ir_node *op2, ir_mode *mode);
1481 /** Constructor for a Minus node.
1483 * @param *db A pointer for debug information.
1484 * @param *block The IR block the node belongs to.
1485 * @param *op The operand .
1486 * @param *mode The mode of the operand and the result.
1488 FIRM_DLL ir_node *new_rd_Minus(dbg_info *db, ir_node *block,
1489 ir_node *op, ir_mode *mode);
1491 /** Constructor for a Mul 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 FIRM_DLL ir_node *new_rd_Mul(dbg_info *db, ir_node *block,
1500 ir_node *op1, ir_node *op2, ir_mode *mode);
1502 /** Constructor for a Mulh node.
1504 * @param *db A pointer for debug information.
1505 * @param *block The IR block the node belongs to.
1506 * @param *op1 The first operand.
1507 * @param *op2 The second operand.
1508 * @param *mode The mode of the operands and the result.
1510 FIRM_DLL ir_node *new_rd_Mulh(dbg_info *db, ir_node *block,
1511 ir_node *op1, ir_node *op2, ir_mode *mode);
1513 /** Constructor for a Quot node.
1515 * @param *db A pointer for debug information.
1516 * @param *block The IR block the node belongs to.
1517 * @param *memop The store needed to model exceptions
1518 * @param *op1 The first operand.
1519 * @param *op2 The second operand.
1520 * @param *mode The mode of the result.
1521 * @param state The pinned state.
1523 FIRM_DLL ir_node *new_rd_Quot(dbg_info *db, ir_node *block, ir_node *memop,
1524 ir_node *op1, ir_node *op2, ir_mode *mode,
1525 op_pin_state state);
1527 /** Constructor for a DivMod node.
1529 * @param *db A pointer for debug information.
1530 * @param *block The IR block the node belongs to.
1531 * @param *memop The store needed to model exceptions
1532 * @param *op1 The first operand.
1533 * @param *op2 The second operand.
1534 * @param *mode The mode of the results.
1535 * @param state The pinned state.
1537 FIRM_DLL ir_node *new_rd_DivMod(dbg_info *db, ir_node *block, ir_node *memop,
1538 ir_node *op1, ir_node *op2, ir_mode *mode,
1539 op_pin_state state);
1541 /** Constructor for a 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 FIRM_DLL ir_node *new_rd_Div(dbg_info *db, ir_node *block, ir_node *memop,
1552 ir_node *op1, ir_node *op2, ir_mode *mode,
1553 op_pin_state state);
1555 /** Constructor for a remainderless Div node.
1557 * @param *db A pointer for debug information.
1558 * @param *block The IR block the node belongs to.
1559 * @param *memop The store needed to model exceptions
1560 * @param *op1 The first operand.
1561 * @param *op2 The second operand.
1562 * @param *mode The mode of the result.
1563 * @param state The pinned state.
1565 FIRM_DLL ir_node *new_rd_DivRL(dbg_info *db, ir_node *block, ir_node *memop,
1566 ir_node *op1, ir_node *op2, ir_mode *mode,
1567 op_pin_state state);
1569 /** Constructor for a Mod node.
1571 * @param *db A pointer for debug information.
1572 * @param *block The IR block the node belongs to.
1573 * @param *memop The store needed to model exceptions
1574 * @param *op1 The first operand.
1575 * @param *op2 The second operand.
1576 * @param *mode The mode of the result.
1577 * @param state The pinned state.
1579 FIRM_DLL ir_node *new_rd_Mod(dbg_info *db, ir_node *block, ir_node *memop,
1580 ir_node *op1, ir_node *op2, ir_mode *mode,
1581 op_pin_state state);
1583 /** Constructor for a Abs node.
1585 * @param *db A pointer for debug information.
1586 * @param *block The IR block the node belongs to.
1587 * @param *op The operand
1588 * @param *mode The mode of the operands and the result.
1590 FIRM_DLL ir_node *new_rd_Abs(dbg_info *db, ir_node *block, ir_node *op,
1593 /** Constructor for a And node.
1595 * @param *db A pointer for debug information.
1596 * @param *block The IR block the node belongs to.
1597 * @param *op1 The first operand.
1598 * @param *op2 The second operand.
1599 * @param *mode The mode of the operands and the result.
1601 FIRM_DLL ir_node *new_rd_And(dbg_info *db, ir_node *block,
1602 ir_node *op1, ir_node *op2, ir_mode *mode);
1604 /** Constructor for a Or node.
1606 * @param *db A pointer for debug information.
1607 * @param *block The IR block the node belongs to.
1608 * @param *op1 The first operand.
1609 * @param *op2 The second operand.
1610 * @param *mode The mode of the operands and the result.
1612 FIRM_DLL ir_node *new_rd_Or(dbg_info *db, ir_node *block,
1613 ir_node *op1, ir_node *op2, ir_mode *mode);
1615 /** Constructor for a Eor node.
1617 * @param *db A pointer for debug information.
1618 * @param *block The IR block the node belongs to.
1619 * @param *op1 The first operand.
1620 * @param *op2 The second operand.
1621 * @param *mode The mode of the operands and the results.
1623 FIRM_DLL ir_node *new_rd_Eor(dbg_info *db, ir_node *block,
1624 ir_node *op1, ir_node *op2, ir_mode *mode);
1626 /** Constructor for a Not node.
1628 * @param *db A pointer for debug information.
1629 * @param *block The IR block the node belongs to.
1630 * @param *op The operand.
1631 * @param *mode The mode of the operand and the result.
1633 FIRM_DLL ir_node *new_rd_Not(dbg_info *db, ir_node *block, ir_node *op,
1636 /** Constructor for a Cmp node.
1638 * @param *db A pointer for debug information.
1639 * @param *block The IR block the node belongs to.
1640 * @param *op1 The first operand.
1641 * @param *op2 The second operand.
1643 FIRM_DLL ir_node *new_rd_Cmp(dbg_info *db, ir_node *block,
1644 ir_node *op1, ir_node *op2);
1646 /** Constructor for a Shl node.
1648 * @param *db A pointer for debug information.
1649 * @param *block The IR block the node belongs to.
1650 * @param *op The operand.
1651 * @param *k The number of bits to shift the operand .
1652 * @param *mode The mode of the operand and the result.
1654 FIRM_DLL ir_node *new_rd_Shl(dbg_info *db, ir_node *block,
1655 ir_node *op, ir_node *k, ir_mode *mode);
1657 /** Constructor for a Shr node.
1659 * @param *db A pointer for debug information.
1660 * @param *block The IR block the node belongs to.
1661 * @param *op The operand.
1662 * @param *k The number of bits to shift the operand .
1663 * @param *mode The mode of the operand and the result.
1665 FIRM_DLL ir_node *new_rd_Shr(dbg_info *db, ir_node *block,
1666 ir_node *op, ir_node *k, ir_mode *mode);
1668 /** Constructor for a Shrs node.
1670 * @param *db A pointer for debug information.
1671 * @param *block The IR block the node belongs to.
1672 * @param *op The operand.
1673 * @param *k The number of bits to shift the operand.
1674 * @param *mode The mode of the operand and the result.
1676 FIRM_DLL ir_node *new_rd_Shrs(dbg_info *db, ir_node *block,
1677 ir_node *op, ir_node *k, ir_mode *mode);
1679 /** Constructor for a Rotl node.
1681 * @param *db A pointer for debug information.
1682 * @param *block The IR block the node belongs to.
1683 * @param *op The operand.
1684 * @param *k The number of bits to rotate the operand.
1685 * @param *mode The mode of the operand.
1687 FIRM_DLL ir_node *new_rd_Rotl(dbg_info *db, ir_node *block,
1688 ir_node *op, ir_node *k, ir_mode *mode);
1691 /** Constructor for a Conv node.
1693 * @param *db A pointer for debug information.
1694 * @param *block The IR block the node belongs to.
1695 * @param *op The operand.
1696 * @param *mode The mode of this the operand muss be converted .
1698 FIRM_DLL ir_node *new_rd_Conv(dbg_info *db, ir_node *block, ir_node *op,
1701 /** Constructor for a strictConv node.
1703 * @param *db A pointer for debug information.
1704 * @param *block The IR block the node belongs to.
1705 * @param *op The operand.
1706 * @param *mode The mode of this the operand muss be converted .
1708 FIRM_DLL ir_node *new_rd_strictConv(dbg_info *db, ir_node *block,
1709 ir_node *op, ir_mode *mode);
1711 /** Constructor for a Cast node.
1713 * High level type cast.
1715 * @param *db A pointer for debug information.
1716 * @param *block The IR block the node belongs to.
1717 * @param *op The operand.
1718 * @param *to_tp The type of this the operand muss be casted .
1720 FIRM_DLL ir_node *new_rd_Cast(dbg_info *db, ir_node *block,
1721 ir_node *op, ir_type *to_tp);
1723 /** Constructor for a Carry node.
1725 * @param *db A pointer for debug information.
1726 * @param *block The IR block the node belongs to.
1727 * @param *op1 The first operand.
1728 * @param *op2 The second operand.
1729 * @param *mode The mode of the operands and the result.
1731 FIRM_DLL ir_node *new_rd_Carry(dbg_info *db, ir_node *block,
1732 ir_node *op1, ir_node *op2, ir_mode *mode);
1734 /** Constructor for a Borrow node.
1736 * @param *db A pointer for debug information.
1737 * @param *block The IR block the node belongs to.
1738 * @param *op1 The first operand.
1739 * @param *op2 The second operand.
1740 * @param *mode The mode of the operands and the result.
1742 FIRM_DLL ir_node *new_rd_Borrow(dbg_info *db, ir_node *block,
1743 ir_node *op1, ir_node *op2, ir_mode *mode);
1745 /** Constructor for a Phi node.
1747 * @param *db A pointer for debug information.
1748 * @param *block The IR block the node belongs to.
1749 * @param arity The number of predecessors
1750 * @param *in[] Array with predecessors. The constructor copies this array.
1751 * @param *mode The mode of it's inputs and output.
1753 FIRM_DLL ir_node *new_rd_Phi(dbg_info *db, ir_node *block, int arity,
1754 ir_node *in[], ir_mode *mode);
1756 /** Constructor for a Load node.
1758 * @param *db A pointer for debug information.
1759 * @param *block The IR block the node belongs to.
1760 * @param *store The current memory
1761 * @param *adr A pointer to the variable to be read in this memory.
1762 * @param *mode The mode of the value to be loaded.
1763 * @param flags Additional flags for alignment, volatility and pin state.
1765 FIRM_DLL ir_node *new_rd_Load(dbg_info *db, ir_node *block, ir_node *store,
1766 ir_node *adr, ir_mode *mode, ir_cons_flags flags);
1768 /** Constructor for a Store node.
1770 * @param *db A pointer for debug information.
1771 * @param *block The IR block the node belongs to.
1772 * @param *store The current memory
1773 * @param *adr A pointer to the variable to be read in this memory.
1774 * @param *val The value to write to this variable.
1775 * @param flags Additional flags for alignment, volatility and pin state.
1777 FIRM_DLL ir_node *new_rd_Store(dbg_info *db, ir_node *block, ir_node *store,
1778 ir_node *adr, ir_node *val, ir_cons_flags flags);
1780 /** Constructor for a Alloc node.
1782 * The Alloc node extends the memory by space for an entity of type alloc_type.
1784 * @param *db A pointer for debug information.
1785 * @param *block The IR block the node belongs to.
1786 * @param *store The memory which shall contain the new variable.
1787 * @param *count The number of objects to allocate.
1788 * @param *alloc_type The type of the allocated variable.
1789 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
1791 FIRM_DLL ir_node *new_rd_Alloc(dbg_info *db, ir_node *block, ir_node *store,
1792 ir_node *count, ir_type *alloc_type,
1793 ir_where_alloc where);
1795 /** Constructor for a Free node.
1797 * Frees the memory occupied by the entity pointed to by the pointer
1798 * arg. Type indicates the type of the entity the argument points to.
1800 * @param *db A pointer for debug information.
1801 * @param *block The IR block the node belongs to.
1802 * @param *store The memory which shall contain the new variable.
1803 * @param *ptr The pointer to the object to free.
1804 * @param *size The number of objects of type free_type to free in a sequence.
1805 * @param *free_type The type of the freed variable.
1806 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
1808 FIRM_DLL ir_node *new_rd_Free(dbg_info *db, ir_node *block, ir_node *store,
1809 ir_node *ptr, ir_node *size, ir_type *free_type,
1810 ir_where_alloc where);
1812 /** Constructor for a Sync node.
1814 * Merges several memory values. The node assumes that a variable
1815 * either occurs only in one of the memories, or it contains the same
1816 * value in all memories where it occurs.
1818 * @param *db A pointer for debug information.
1819 * @param *block The IR block the node belongs to.
1820 * @param arity The number of memories to synchronize.
1821 * @param *in[] An array of pointers to nodes that produce an output of type
1822 * memory. The constructor copies this array.
1824 FIRM_DLL ir_node *new_rd_Sync(dbg_info *db, ir_node *block, int arity,
1827 /** Constructor for a Proj node.
1829 * Projects a single value out of a tuple. The parameter proj gives the
1830 * position of the value within the tuple.
1832 * @param *db A pointer for debug information.
1833 * @param arg A node producing a tuple. The node must have mode_T.
1834 * @param *mode The mode of the value to project.
1835 * @param proj The position of the value in the tuple.
1837 FIRM_DLL ir_node *new_rd_Proj(dbg_info *db, ir_node *arg, ir_mode *mode,
1840 /** Constructor for a defaultProj node.
1842 * Represents the default control flow of a Switch-Cond node.
1844 * @param *db A pointer for debug information.
1845 * @param arg A node producing a tuple.
1846 * @param max_proj The end position of the value in the tuple.
1848 FIRM_DLL ir_node *new_rd_defaultProj(dbg_info *db, ir_node *arg, long max_proj);
1850 /** Constructor for a Tuple node.
1852 * This is an auxiliary node to replace a node that returns a tuple
1853 * without changing the corresponding Proj nodes.
1855 * @param *db A pointer for debug information.
1856 * @param *block The IR block the node belongs to.
1857 * @param arity The number of tuple elements.
1858 * @param *in[] An array containing pointers to the nodes producing the tuple
1859 * elements. The constructor copies this array.
1861 FIRM_DLL ir_node *new_rd_Tuple(dbg_info *db, ir_node *block,
1862 int arity, ir_node *in[]);
1864 /** Constructor for a Id node.
1866 * This is an auxiliary node to replace a node that returns a single
1869 * @param *db A pointer for debug information.
1870 * @param *block The IR block the node belongs to.
1871 * @param *val The value
1872 * @param *mode The mode of *val.
1874 FIRM_DLL ir_node *new_rd_Id(dbg_info *db, ir_node *block,
1875 ir_node *val, ir_mode *mode);
1877 /** Constructor for a Confirm node.
1879 * Specifies constraints for a value. To support dataflow analyses.
1881 * Example: If the value never exceeds '100' this is expressed by placing a
1882 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
1884 * @param *db A pointer for debug information.
1885 * @param *block The IR block the node belong to.
1886 * @param *val The value we express a constraint for
1887 * @param *bound The value to compare against. Must be a firm node, typically a constant.
1888 * @param cmp The compare operation.
1890 FIRM_DLL ir_node *new_rd_Confirm(dbg_info *db, ir_node *block,
1891 ir_node *val, ir_node *bound, pn_Cmp cmp);
1893 /** Constructor for an Unknown node.
1895 * Represents an arbitrary value. Places the node in the start block.
1897 * @param *db A pointer for debug information.
1898 * @param *irg The IR graph the node belongs to.
1899 * @param *m The mode of the unknown value.
1901 FIRM_DLL ir_node *new_rd_Unknown(dbg_info *db, ir_graph *irg, ir_mode *m);
1903 /** Constructor for a CallBegin node.
1905 * CallBegin represents control flow depending of the pointer value
1906 * representing the called method to the called methods. The
1907 * constructor copies the method pointer input from the passed Call
1910 * @param *db A pointer for debug information.
1911 * @param *block The block the node belong to.
1912 * @param *ptr pointer to the called function
1913 * @param *call associated call operation
1915 FIRM_DLL ir_node *new_rd_CallBegin(dbg_info *db, ir_node *block, ir_node *ptr,
1918 /** Constructor for a EndReg node.
1920 * Used to represent regular procedure end in interprocedual view.
1922 * @param *db A pointer for debug information.
1923 * @param *irg The IR graph the node belong to.
1924 * @param *block The block the node belong to.
1926 FIRM_DLL ir_node *new_rd_EndReg(dbg_info *db, ir_graph *irg, ir_node *block);
1928 /** Constructor for a EndExcept node.
1930 * Used to represent exceptional procedure end in interprocedural view.
1932 * @param *db A pointer for debug information.
1933 * @param *irg The IR graph the node belong to.
1934 * @param *block The block the node belong to.
1936 FIRM_DLL ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
1938 /** Constructor for a Filter node.
1940 * Adds the node to the block in current_ir_block. Filter is a node
1941 * with two views used to construct the interprocedural view. In
1942 * intraprocedural view its semantics are identical to the Proj node.
1943 * In interprocedural view the Filter performs the Phi operation on
1944 * method parameters or results. Other than a Phi a Filter node may
1945 * not be removed if it has only a single input.
1947 * The constructor builds the Filter in intraprocedural view.
1949 * @param *db A pointer for debug information.
1950 * @param *block The block the node belong to.
1951 * @param *arg The tuple value to project from.
1952 * @param *mode The mode of the projected value.
1953 * @param proj The position in the tuple to project from.
1955 FIRM_DLL ir_node *new_rd_Filter(dbg_info *db,ir_node *block, ir_node *arg,
1956 ir_mode *mode, long proj);
1958 /** Constructor for a Mux node.
1960 * @param *db A pointer for debug information.
1961 * @param *block The block the node belong to.
1962 * @param *sel The ir_node that calculates the boolean select.
1963 * @param *ir_true The ir_node that calculates the true result.
1964 * @param *ir_false The ir_node that calculates the false result.
1965 * @param *mode The mode of the node (and it_true and ir_false).
1967 FIRM_DLL ir_node *new_rd_Mux(dbg_info *db, ir_node *block, ir_node *sel,
1968 ir_node *ir_false, ir_node *ir_true,
1971 /** Constructor for a CopyB node.
1973 * @param *db A pointer for debug information.
1974 * @param *block The block the node belong to.
1975 * @param *store The current memory
1976 * @param *dst The ir_node that represents the destination address.
1977 * @param *src The ir_node that represents the source address.
1978 * @param *data_type The type of the copied data
1980 FIRM_DLL ir_node *new_rd_CopyB(dbg_info *db, ir_node *block, ir_node *store,
1981 ir_node *dst, ir_node *src, ir_type *data_type);
1983 /** Constructor for a InstOf node.
1985 * A High-Level Type check.
1987 * @param *db A pointer for debug information.
1988 * @param *block The IR block the node belongs to.
1989 * @param *store The memory in which the object the entity should be selected
1990 * from is allocated.
1991 * @param *objptr A pointer to a object of a class type.
1992 * @param *type The type of which objptr must be.
1994 FIRM_DLL ir_node *new_rd_InstOf(dbg_info *db, ir_node *block, ir_node *store,
1995 ir_node *objptr, ir_type *type);
1997 /** Constructor for a Raise node.
1999 * A High-Level Exception throw.
2001 * @param *db A pointer for debug information.
2002 * @param *block The IR block the node belongs to.
2003 * @param *store The current memory.
2004 * @param *obj A pointer to the Except variable.
2006 FIRM_DLL ir_node *new_rd_Raise(dbg_info *db, ir_node *block, ir_node *store,
2009 /** Constructor for a Bound node.
2011 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2013 * @param *db A pointer for debug information.
2014 * @param *block The block the node belong to.
2015 * @param *store The current memory.
2016 * @param *idx The ir_node that represents an index.
2017 * @param *lower The ir_node that represents the lower bound for the index.
2018 * @param *upper The ir_node that represents the upper bound for the index.
2020 FIRM_DLL ir_node *new_rd_Bound(dbg_info *db, ir_node *block,
2021 ir_node *store, ir_node *idx, ir_node *lower,
2024 /** Constructor for a Pin node.
2026 * @param *db A pointer for debug information.
2027 * @param *block The block the node belong to.
2028 * @param *node The node which value should be pinned.
2030 FIRM_DLL ir_node *new_rd_Pin(dbg_info *db, ir_node *block, ir_node *node);
2032 /** Constructor for an ASM pseudo node.
2034 * @param *db A pointer for debug information.
2035 * @param *block The block the node belong to.
2036 * @param arity The number of data inputs to the node.
2037 * @param *in The array of length arity of data inputs.
2038 * @param *inputs The array of length arity of input constraints.
2039 * @param n_outs The number of data outputs to the node.
2040 * @param *outputs The array of length n_outs of output constraints.
2041 * @param n_clobber The number of clobbered registers.
2042 * @param *clobber The array of length n_clobber of clobbered registers.
2043 * @param *asm_text The assembler text.
2045 FIRM_DLL ir_node *new_rd_ASM(dbg_info *db, ir_node *block,
2046 int arity, ir_node *in[], ir_asm_constraint *inputs,
2047 int n_outs, ir_asm_constraint *outputs,
2048 int n_clobber, ident *clobber[], ident *asm_text);
2050 /*-------------------------------------------------------------------------*/
2051 /* The raw interface without debug support */
2052 /*-------------------------------------------------------------------------*/
2054 /** Constructor for a Block node.
2056 * Constructs a mature block with the given predecessors. Use Unknown
2057 * nodes as predecessors to construct a block if the number of
2058 * predecessors is known, but not the predecessors themselves. This
2059 * constructor does not set current_block. It not be used with
2060 * automatic Phi node construction.
2063 * @param irg The IR graph the block belongs to.
2064 * @param arity The number of control predecessors.
2065 * @param in[] An array of control predecessors. The length of
2066 * the array must be 'arity'. The constructor copies this array.
2068 FIRM_DLL ir_node *new_r_Block(ir_graph *irg, int arity, ir_node *in[]);
2070 /** Constructor for a Start node.
2072 * @param *irg The IR graph the node belongs to.
2073 * @param *block The IR block the node belongs to.
2075 FIRM_DLL ir_node *new_r_Start(ir_graph *irg, ir_node *block);
2077 /** Constructor for a End node.
2079 * @param *irg The IR graph the node belongs to.
2080 * @param *block The IR block the node belongs to.
2082 FIRM_DLL ir_node *new_r_End(ir_graph *irg, ir_node *block);
2084 /** Constructor for a Jmp node.
2086 * Jmp represents control flow to a single control successor.
2088 * @param *block The IR block the node belongs to.
2090 FIRM_DLL ir_node *new_r_Jmp(ir_node *block);
2092 /** Constructor for an IJmp node.
2094 * IJmp represents control flow to a single control successor not
2095 * statically known i.e. an indirect Jmp.
2097 * @param *block The IR block the node belongs to.
2098 * @param *tgt The IR node representing the target address.
2100 FIRM_DLL ir_node *new_r_IJmp(ir_node *block, ir_node *tgt);
2102 /** Constructor for a Cond node.
2104 * If c is mode_b represents a conditional branch (if/else). If c is
2105 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2106 * node, default Proj is 0.)
2108 * This is not consistent: Input to Cond is Is, Proj has as proj number
2111 * @param *block The IR block the node belongs to.
2112 * @param *c The conditions parameter.Can be of mode b or I_u.
2114 FIRM_DLL ir_node *new_r_Cond(ir_node *block, ir_node *c);
2116 /** Constructor for a Return node.
2118 * Returns the memory and zero or more return values. Only node that
2119 * can end regular control flow.
2121 * @param *block The IR block the node belongs to.
2122 * @param *store The state of memory.
2123 * @param arity Number of array indices.
2124 * @param *in[] Array with index inputs to the node. The constructor copies this array.
2126 FIRM_DLL ir_node *new_r_Return(ir_node *block, ir_node *store,
2127 int arity, ir_node *in[]);
2129 /** Constructor for a Const node.
2131 * Adds the node to the start block.
2133 * Constructor for a Const node. The constant represents a target
2134 * value. Sets the type information to type_unknown. (No more
2135 * supported: If tv is entity derives a somehow useful type.)
2136 * Derives mode from passed tarval.
2138 * @param *irg The IR graph the node belongs to.
2139 * @param *con Points to an entry in the constant table.
2141 FIRM_DLL ir_node *new_r_Const(ir_graph *irg, tarval *con);
2143 /** Constructor for a Const node.
2145 * Adds the node to the start block.
2147 * Constructor for a Const node. The constant represents a target
2148 * value. Sets the type information to type_unknown. (No more
2149 * supported: If tv is entity derives a somehow useful type.)
2151 * @param *irg The IR graph the node belongs to.
2152 * @param *mode The mode of the operands and the results.
2153 * @param value A value from which the tarval is made.
2155 FIRM_DLL ir_node *new_r_Const_long(ir_graph *irg, ir_mode *mode, long value);
2157 /** Constructor for a Const_type node.
2159 * Adds the node to the start block.
2161 * The constant represents a target value. This constructor sets high
2162 * level type information for the constant value.
2163 * Derives mode from passed tarval.
2165 * @param *irg The IR graph the node belongs to.
2166 * @param *con Points to an entry in the constant table.
2167 * @param *tp The type of the constant.
2169 FIRM_DLL ir_node *new_r_Const_type(ir_graph *irg, tarval *con, ir_type *tp);
2171 /** Constructor for a SymConst node.
2173 * This is the constructor for a symbolic constant.
2174 * There are several kinds of symbolic constants:
2175 * - symconst_type_tag The symbolic constant represents a type tag. The
2176 * type the tag stands for is given explicitly.
2177 * - symconst_type_size The symbolic constant represents the size of a type.
2178 * The type of which the constant represents the size
2179 * is given explicitly.
2180 * - symconst_type_align The symbolic constant represents the alignment of a
2181 * type. The type of which the constant represents the
2182 * size is given explicitly.
2183 * - symconst_addr_ent The symbolic constant represents the address of an
2184 * entity (variable or method). The variable is given
2185 * explicitly by a firm entity.
2186 * - symconst_ofs_ent The symbolic constant represents the offset of an
2187 * entity in its owner type.
2188 * - symconst_enum_const The symbolic constant is a enumeration constant of
2189 * an enumeration type.
2191 * Inputs to the node:
2192 * No inputs except the block it belongs to.
2193 * Outputs of the node.
2194 * An unsigned integer (I_u) or a pointer (P).
2196 * Mention union in declaration so that the firmjni generator recognizes that
2197 * it can not cast the argument to an int.
2199 * @param *irg The IR graph the node belongs to.
2200 * @param mode The mode for the SymConst.
2201 * @param value A type, ident, entity or enum constant depending on the
2203 * @param kind The kind of the symbolic constant, see the list above
2205 FIRM_DLL ir_node *new_r_SymConst(ir_graph *irg, ir_mode *mode,
2206 union symconst_symbol value,
2207 symconst_kind kind);
2209 /** Constructor for a simpleSel node.
2211 * This is a shortcut for the new_d_Sel() constructor. To be used for
2212 * Sel nodes that do not select from an array, i.e., have no index
2213 * inputs. It adds the two parameters 0, NULL.
2215 * @param *block The IR block the node belongs to.
2216 * @param *store The memory in which the object the entity should be selected
2217 * from is allocated.
2218 * @param *objptr The object from that the Sel operation selects a
2219 * single attribute out.
2220 * @param *ent The entity to select.
2222 FIRM_DLL ir_node *new_r_simpleSel(ir_node *block, ir_node *store,
2223 ir_node *objptr, ir_entity *ent);
2225 /** Constructor for a Sel node.
2227 * The select node selects an entity (field or method) from an entity
2228 * with a compound type. It explicitly specifies the entity selected.
2229 * Dynamically the node may select entities that overwrite the given
2230 * entity. If the selected entity is an array element entity the Sel
2231 * node takes the required array indices as inputs.
2233 * @param *block The IR block the node belongs to.
2234 * @param *store The memory in which the object the entity should be selected
2235 * from is allocated.
2236 * @param *objptr A pointer to a compound entity the Sel operation selects a
2237 * single attribute from.
2238 * @param *n_index The number of array indices needed to select an array element entity.
2239 * @param *index[] If the compound entity is an array the indices of the selected
2240 * element entity. The constructor copies this array.
2241 * @param *ent The entity to select.
2243 FIRM_DLL ir_node *new_r_Sel(ir_node *block, ir_node *store,
2244 ir_node *objptr, int n_index, ir_node *index[],
2247 /** Constructor for a Call node.
2249 * Represents all kinds of method and function calls.
2251 * @param *block The IR block the node belongs to.
2252 * @param *store The actual store.
2253 * @param *callee A pointer to the called procedure.
2254 * @param arity The number of procedure parameters.
2255 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2256 * @param *tp Type information of the procedure called.
2258 FIRM_DLL ir_node *new_r_Call(ir_node *block, ir_node *store,
2259 ir_node *callee, int arity, ir_node *in[],
2262 /** Constructor for a Builtin node.
2264 * Represents a call of a backend-specific builtin..
2266 * @param *block The IR block the node belongs to.
2267 * @param *store The actual store.
2268 * @param arity The number of procedure parameters.
2269 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2270 * @param kind The kind of the called builtin.
2271 * @param *tp Type information of the procedure called.
2273 FIRM_DLL ir_node *new_r_Builtin(ir_node *block, ir_node *store,
2274 int arity, ir_node *in[], ir_builtin_kind kind,
2277 /** Constructor for a Add node.
2279 * @param *block The IR block the node belongs to.
2280 * @param *op1 The first operand.
2281 * @param *op2 The second operand.
2282 * @param *mode The mode of the operands and the result.
2284 FIRM_DLL ir_node *new_r_Add(ir_node *block, ir_node *op1, ir_node *op2,
2288 * Constructor for a Sub node.
2290 * @param *block The IR block the node belongs to.
2291 * @param *op1 The first operand.
2292 * @param *op2 The second operand.
2293 * @param *mode The mode of the operands and the results.
2295 FIRM_DLL ir_node *new_r_Sub(ir_node *block, ir_node *op1, ir_node *op2,
2298 /** Constructor for a Minus node.
2300 * @param *block The IR block the node belongs to.
2301 * @param *op The operand.
2302 * @param *mode The mode of the operand and the result.
2304 FIRM_DLL ir_node *new_r_Minus(ir_node *block, ir_node *op, ir_mode *mode);
2306 /** Constructor for a Mul node.
2308 * @param *block The IR block the node belongs to.
2309 * @param *op1 The first operand.
2310 * @param *op2 The second operand.
2311 * @param *mode The mode of the operands and the result.
2313 FIRM_DLL ir_node *new_r_Mul(ir_node *block, ir_node *op1, ir_node *op2,
2316 /** Constructor for a Mulh node.
2318 * @param *block The IR block the node belongs to.
2319 * @param *op1 The first operand.
2320 * @param *op2 The second operand.
2321 * @param *mode The mode of the operands and the result.
2323 FIRM_DLL ir_node *new_r_Mulh(ir_node *block, ir_node *op1, ir_node *op2,
2326 /** Constructor for a Quot 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 FIRM_DLL ir_node *new_r_Quot(ir_node *block, ir_node *memop,
2336 ir_node *op1, ir_node *op2, ir_mode *mode,
2337 op_pin_state state);
2339 /** Constructor for a DivMod node.
2341 * @param *block The IR block the node belongs to.
2342 * @param *memop The store needed to model exceptions
2343 * @param *op1 The first operand.
2344 * @param *op2 The second operand.
2345 * @param *mode The mode of the results.
2346 * @param state The pinned state.
2348 FIRM_DLL ir_node *new_r_DivMod(ir_node *block, ir_node *memop,
2349 ir_node *op1, ir_node *op2, ir_mode *mode,
2350 op_pin_state state);
2352 /** Constructor for a Div node.
2354 * @param *block The IR block the node belongs to.
2355 * @param *memop The store needed to model exceptions
2356 * @param *op1 The first operand.
2357 * @param *op2 The second operand.
2358 * @param *mode The mode of the result.
2359 * @param state The pinned state.
2361 FIRM_DLL ir_node *new_r_Div(ir_node *block, ir_node *memop,
2362 ir_node *op1, ir_node *op2, ir_mode *mode,
2363 op_pin_state state);
2365 /** Constructor for a remainderless Div node.
2367 * @param *block The IR block the node belongs to.
2368 * @param *memop The store needed to model exceptions
2369 * @param *op1 The first operand.
2370 * @param *op2 The second operand.
2371 * @param *mode The mode of the result.
2372 * @param state The pinned state.
2374 FIRM_DLL ir_node *new_r_DivRL(ir_node *block, ir_node *memop,
2375 ir_node *op1, ir_node *op2, ir_mode *mode,
2376 op_pin_state state);
2378 /** Constructor for a Mod node.
2380 * @param *block The IR block the node belongs to.
2381 * @param *memop The store needed to model exceptions
2382 * @param *op1 The first operand.
2383 * @param *op2 The second operand.
2384 * @param *mode The mode of the result.
2385 * @param state The pinned state.
2387 FIRM_DLL ir_node *new_r_Mod(ir_node *block, ir_node *memop,
2388 ir_node *op1, ir_node *op2, ir_mode *mode,
2389 op_pin_state state);
2391 /** Constructor for a Abs node.
2393 * @param *block The IR block the node belongs to.
2394 * @param *op The operand
2395 * @param *mode The mode of the operands and the result.
2397 FIRM_DLL ir_node *new_r_Abs(ir_node *block, ir_node *op, ir_mode *mode);
2399 /** Constructor for a And node.
2401 * @param *block The IR block the node belongs to.
2402 * @param *op1 The first operand.
2403 * @param *op2 The second operand.
2404 * @param *mode The mode of the operands and the result.
2406 FIRM_DLL ir_node *new_r_And(ir_node *block, ir_node *op1, ir_node *op2,
2409 /** Constructor for a Or node.
2411 * @param *block The IR block the node belongs to.
2412 * @param *op1 The first operand.
2413 * @param *op2 The second operand.
2414 * @param *mode The mode of the operands and the result.
2416 FIRM_DLL ir_node *new_r_Or(ir_node *block, ir_node *op1, ir_node *op2,
2419 /** Constructor for a Eor node.
2421 * @param *block The IR block the node belongs to.
2422 * @param *op1 The first operand.
2423 * @param *op2 The second operand.
2424 * @param *mode The mode of the operands and the results.
2426 FIRM_DLL ir_node *new_r_Eor(ir_node *block, ir_node *op1, ir_node *op2,
2429 /** Constructor for a Not node.
2431 * @param *block The IR block the node belongs to.
2432 * @param *op The operand.
2433 * @param *mode The mode of the operand and the result.
2435 FIRM_DLL ir_node *new_r_Not(ir_node *block, ir_node *op, ir_mode *mode);
2437 /** Constructor for a Cmp node.
2439 * @param *block The IR block the node belongs to.
2440 * @param *op1 The first operand.
2441 * @param *op2 The second operand.
2443 FIRM_DLL ir_node *new_r_Cmp(ir_node *block, ir_node *op1, ir_node *op2);
2445 /** Constructor for a Shl node.
2447 * @param *block The IR block the node belongs to.
2448 * @param *op The operand.
2449 * @param *k The number of bits to shift the operand .
2450 * @param *mode The mode of the operand and the result.
2452 FIRM_DLL ir_node *new_r_Shl(ir_node *block, ir_node *op, ir_node *k,
2455 /** Constructor for a Shr node.
2457 * @param *block The IR block the node belongs to.
2458 * @param *op The operand.
2459 * @param *k The number of bits to shift the operand .
2460 * @param *mode The mode of the operand and the result.
2462 FIRM_DLL ir_node *new_r_Shr(ir_node *block, ir_node *op, ir_node *k,
2466 * Constructor for a Shrs node.
2468 * @param *block The IR block the node belongs to.
2469 * @param *op The operand.
2470 * @param *k The number of bits to shift the operand.
2471 * @param *mode The mode of the operand and the result.
2473 FIRM_DLL ir_node *new_r_Shrs(ir_node *block, ir_node *op, ir_node *k,
2476 /** Constructor for a Rotl node.
2478 * @param *block The IR block the node belongs to.
2479 * @param *op The operand.
2480 * @param *k The number of bits to rotate the operand.
2481 * @param *mode The mode of the operand.
2483 FIRM_DLL ir_node *new_r_Rotl(ir_node *block, ir_node *op, ir_node *k,
2486 /** Constructor for a Conv node.
2488 * @param *block The IR block the node belongs to.
2489 * @param *op The operand.
2490 * @param *mode The mode of this the operand muss be converted .
2492 FIRM_DLL ir_node *new_r_Conv(ir_node *block, ir_node *op, ir_mode *mode);
2494 /** Constructor for a strict Conv node.
2496 * @param *block The IR block the node belongs to.
2497 * @param *op The operand.
2498 * @param *mode The mode of this the operand muss be converted .
2500 FIRM_DLL ir_node *new_r_strictConv(ir_node *block, ir_node *op, ir_mode *mode);
2502 /** Constructor for a Cast node.
2504 * High level type cast
2506 * @param *block The IR block the node belongs to.
2507 * @param *op The operand.
2508 * @param *to_tp The type of this the operand muss be casted .
2510 FIRM_DLL ir_node *new_r_Cast(ir_node *block, ir_node *op, ir_type *to_tp);
2512 /** Constructor for a Carry node.
2514 * @param *block The IR block the node belongs to.
2515 * @param *op1 The first operand.
2516 * @param *op2 The second operand.
2517 * @param *mode The mode of the operands and the result.
2519 FIRM_DLL ir_node *new_r_Carry(ir_node *block, ir_node *op1, ir_node *op2,
2523 * Constructor for a Borrow node.
2525 * @param *block The IR block the node belongs to.
2526 * @param *op1 The first operand.
2527 * @param *op2 The second operand.
2528 * @param *mode The mode of the operands and the results.
2530 FIRM_DLL ir_node *new_r_Borrow(ir_node *block, ir_node *op1, ir_node *op2,
2533 /** Constructor for a Phi node.
2535 * @param *block The IR block the node belongs to.
2536 * @param arity The number of predecessors
2537 * @param *in[] Array with predecessors. The constructor copies this array.
2538 * @param *mode The mode of it's inputs and output.
2540 FIRM_DLL ir_node *new_r_Phi(ir_node *block, int arity, ir_node *in[],
2543 /** Constructor for a Load node.
2545 * @param *block The IR block the node belongs to.
2546 * @param *store The current memory
2547 * @param *adr A pointer to the variable to be read in this memory.
2548 * @param *mode The mode of the value to be loaded.
2549 * @param flags Additional flags for alignment, volatility and pin state.
2551 FIRM_DLL ir_node *new_r_Load(ir_node *block, ir_node *store,
2552 ir_node *adr, ir_mode *mode, ir_cons_flags flags);
2554 /** Constructor for a Store node.
2556 * @param *block The IR block the node belongs to.
2557 * @param *store The current memory
2558 * @param *adr A pointer to the variable to be read in this memory.
2559 * @param *val The value to write to this variable.
2560 * @param flags Additional flags for alignment, volatility and pin state.
2562 FIRM_DLL ir_node *new_r_Store(ir_node *block, ir_node *store,
2563 ir_node *adr, ir_node *val, ir_cons_flags flags);
2565 /** Constructor for a Alloc node.
2567 * The Alloc node extends the memory by space for an entity of type alloc_type.
2569 * @param *block The IR block the node belongs to.
2570 * @param *store The memory which shall contain the new variable.
2571 * @param *count The number of objects to allocate.
2572 * @param *alloc_type The type of the allocated variable.
2573 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
2575 FIRM_DLL ir_node *new_r_Alloc(ir_node *block, ir_node *store,
2576 ir_node *count, ir_type *alloc_type,
2577 ir_where_alloc where);
2579 /** Constructor for a Free node.
2581 * Frees the memory occupied by the entity pointed to by the pointer
2582 * arg. Type indicates the type of the entity the argument points to.
2584 * @param *block The IR block the node belongs to.
2585 * @param *store The memory which shall contain the new variable.
2586 * @param *ptr The pointer to the object to free.
2587 * @param *size The number of objects of type free_type to free in a sequence.
2588 * @param *free_type The type of the freed variable.
2589 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
2591 FIRM_DLL ir_node *new_r_Free(ir_node *block, ir_node *store, ir_node *ptr,
2592 ir_node *size, ir_type *free_type,
2593 ir_where_alloc where);
2595 /** Constructor for a Sync node.
2597 * Merges several memory values. The node assumes that a variable
2598 * either occurs only in one of the memories, or it contains the same
2599 * value in all memories where it occurs.
2601 * @param *block The IR block the node belongs to.
2602 * @param arity The number of memories to synchronize.
2603 * @param *in[] An array of pointers to nodes that produce an output of type memory.
2604 * The constructor copies this array.
2606 FIRM_DLL ir_node *new_r_Sync(ir_node *block, int arity, ir_node *in[]);
2608 /** Constructor for a Proj node.
2610 * Projects a single value out of a tuple. The parameter proj gives the
2611 * position of the value within the tuple.
2613 * @param arg A node producing a tuple.
2614 * @param mode The mode of the value to project.
2615 * @param proj The position of the value in the tuple.
2617 FIRM_DLL ir_node *new_r_Proj(ir_node *arg, ir_mode *mode, long proj);
2619 /** Constructor for a defaultProj node.
2621 * Represents the default control flow of a Switch-Cond node.
2623 * @param arg A node producing a tuple.
2624 * @param max_proj The end position of the value in the tuple.
2626 FIRM_DLL ir_node *new_r_defaultProj(ir_node *arg, long max_proj);
2629 /** Constructor for a Tuple node.
2631 * This is an auxiliary node to replace a node that returns a tuple
2632 * without changing the corresponding Proj nodes.
2634 * @param *block The IR block the node belongs to.
2635 * @param arity The number of tuple elements.
2636 * @param *in[] An array containing pointers to the nodes producing the tuple elements.
2637 * The constructor copies this array.
2639 FIRM_DLL ir_node *new_r_Tuple(ir_node *block, int arity, ir_node *in[]);
2641 /** Constructor for a Id node.
2643 * This is an auxiliary node to replace a node that returns a single
2646 * @param *block The IR block the node belongs to.
2647 * @param *val The operand to Id.
2648 * @param *mode The mode of *val.
2650 FIRM_DLL ir_node *new_r_Id(ir_node *block, ir_node *val, ir_mode *mode);
2652 /** Constructor for a Bad node.
2654 * Returns the unique Bad node of the graph. The same as
2657 * @param *irg The IR graph the node belongs to.
2659 FIRM_DLL ir_node *new_r_Bad(ir_graph *irg);
2661 /** Constructor for a Confirm node.
2663 * Specifies constraints for a value. To support dataflow analyses.
2665 * Example: If the value never exceeds '100' this is expressed by placing a
2666 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
2668 * @param *block The IR block the node belong to.
2669 * @param *val The value we express a constraint for
2670 * @param *bound The value to compare against. Must be a firm node, typically a constant.
2671 * @param cmp The compare operation.
2673 FIRM_DLL ir_node *new_r_Confirm(ir_node *block, ir_node *val, ir_node *bound,
2676 /** Constructor for a Unknown node.
2678 * Represents an arbitrary value. Places the node in
2681 * @param *irg The IR graph the node belongs to.
2682 * @param *m The mode of the unknown value.
2684 FIRM_DLL ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2686 /** Constructor for a CallBegin node.
2688 * CallBegin represents control flow depending of the pointer value
2689 * representing the called method to the called methods. The
2690 * constructor copies the method pointer input from the passed Call
2693 * @param *block The block the node belong to.
2694 * @param *ptr pointer to the called function
2695 * @param *call associated call operation
2697 FIRM_DLL ir_node *new_r_CallBegin(ir_node *block, ir_node *ptr, ir_node *call);
2699 /** Constructor for a EndReg node.
2701 * Used to represent regular procedure end in interprocedual view.
2703 * @param *irg The IR graph the node belong to.
2704 * @param *block The block the node belong to.
2706 FIRM_DLL ir_node *new_r_EndReg(ir_graph *irg, ir_node *block);
2708 /** Constructor for a EndExcept node.
2710 * Used to represent exceptional procedure end in interprocedural view.
2712 * @param *irg The IR graph the node belong to.
2713 * @param *block The block the node belong to.
2715 FIRM_DLL ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
2717 /** Constructor for a Break node.
2719 * Break represents control flow to a single control successor just as Jmp.
2720 * The blocks separated by a break may not be concatenated by an optimization.
2721 * It is used for the interprocedural representation where blocks are parted
2722 * behind Call nodes to represent the control flow to called procedures.
2724 * @param *block The block the node belong to.
2726 FIRM_DLL ir_node *new_r_Break(ir_node *block);
2728 /** Constructor for a Filter node.
2730 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
2731 * Filter is a node with two views used to construct the interprocedural view.
2732 * In intraprocedural view its semantics are identical to the Proj node.
2733 * In interprocedural view the Filter performs the Phi operation on method
2734 * parameters or results. Other than a Phi a Filter node may not be removed
2735 * if it has only a single input.
2737 * The constructor builds the Filter in intraprocedural view.
2739 * @param *block The block the node belong to.
2740 * @param *arg The tuple value to project from.
2741 * @param *mode The mode of the projected value.
2742 * @param proj The position in the tuple to project from.
2744 FIRM_DLL ir_node *new_r_Filter(ir_node *block, ir_node *arg, ir_mode *mode,
2747 /** Constructor for a NoMem node.
2749 * Returns the unique NoMem node of the graph. The same as
2752 * @param *irg The IR graph the node belongs to.
2754 FIRM_DLL ir_node *new_r_NoMem(ir_graph *irg);
2756 /** Constructor for a Mux node.
2758 * @param *block The block the node belong to.
2759 * @param *sel The ir_node that calculates the boolean select.
2760 * @param *ir_true The ir_node that calculates the true result.
2761 * @param *ir_false The ir_node that calculates the false result.
2762 * @param *mode The mode of the node (and it_true and ir_false).
2764 FIRM_DLL ir_node *new_r_Mux(ir_node *block, ir_node *sel,
2765 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2767 /** Constructor for a CopyB node.
2769 * @param *block The block the node belong to.
2770 * @param *store The current memory
2771 * @param *dst The ir_node that represents the destination address.
2772 * @param *src The ir_node that represents the source address.
2773 * @param *data_type The type of the copied data
2775 FIRM_DLL ir_node *new_r_CopyB(ir_node *block, ir_node *store,
2776 ir_node *dst, ir_node *src, ir_type *data_type);
2778 /** Constructor for a InstOf node.
2780 * A High-Level Type check.
2782 * @param *block The block the node belong to.
2783 * @param *store The memory in which the object the entity should be selected
2784 * from is allocated.
2785 * @param *objptr A pointer to a object of a class type.
2786 * @param *type The type of which objptr must be.
2788 FIRM_DLL ir_node *new_r_InstOf(ir_node *block, ir_node *store,
2789 ir_node *objptr, ir_type *type);
2791 /** Constructor for a Raise node.
2793 * A High-Level Exception throw.
2795 * @param *block The IR block the node belongs to.
2796 * @param *store The current memory.
2797 * @param *obj A pointer to the Except variable.
2799 FIRM_DLL ir_node *new_r_Raise(ir_node *block, ir_node *store, ir_node *obj);
2801 /** Constructor for a Bound node.
2803 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2805 * @param *block The block the node belong to.
2806 * @param *store The current memory.
2807 * @param *idx The ir_node that represents an index.
2808 * @param *lower The ir_node that represents the lower bound for the index.
2809 * @param *upper The ir_node that represents the upper bound for the index.
2811 FIRM_DLL ir_node *new_r_Bound(ir_node *block, ir_node *store,
2812 ir_node *idx, ir_node *lower, ir_node *upper);
2814 /** Constructor for a Pin node.
2816 * @param *block The block the node belong to.
2817 * @param *node The node which value should be pinned.
2819 FIRM_DLL ir_node *new_r_Pin(ir_node *block, ir_node *node);
2821 /** Constructor for an ASM pseudo node.
2823 * @param *block The block the node belong to.
2824 * @param arity The number of data inputs to the node.
2825 * @param *in The array of length arity of data inputs.
2826 * @param *inputs The array of length arity of input constraints.
2827 * @param n_outs The number of data outputs to the node.
2828 * @param *outputs The array of length n_outs of output constraints.
2829 * @param n_clobber The number of clobbered registers.
2830 * @param *clobber The array of length n_clobber of clobbered registers.
2831 * @param *asm_text The assembler text.
2833 FIRM_DLL ir_node *new_r_ASM(ir_node *block,
2834 int arity, ir_node *in[], ir_asm_constraint *inputs,
2835 int n_outs, ir_asm_constraint *outputs,
2836 int n_clobber, ident *clobber[], ident *asm_text);
2838 /*-----------------------------------------------------------------------*/
2839 /* The block oriented interface */
2840 /*-----------------------------------------------------------------------*/
2842 /** Sets the current block in which the following constructors place the
2843 * nodes they construct.
2845 * @param target The new current block.
2847 FIRM_DLL void set_cur_block(ir_node *target);
2849 /** Returns the current block of the current graph. */
2850 FIRM_DLL ir_node *get_cur_block(void);
2852 /** Constructor for a Block node.
2854 * Adds the block to the graph in current_ir_graph. Constructs a Block
2855 * with a fixed number of predecessors.
2857 * @param *db A Pointer for debug information.
2858 * @param arity The number of control predecessors.
2859 * @param in[] An array of control predecessors. The length of
2860 * the array must be 'arity'.
2862 FIRM_DLL ir_node *new_d_Block(dbg_info *db, int arity, ir_node *in[]);
2864 /** Constructor for a Start node.
2866 * Adds the node to the block in current_ir_block.
2868 * @param *db A pointer for debug information.
2870 FIRM_DLL ir_node *new_d_Start(dbg_info *db);
2872 /** Constructor for a End node.
2874 * Adds the node to the block in current_ir_block.
2876 * @param *db A pointer for debug information.
2878 FIRM_DLL ir_node *new_d_End(dbg_info *db);
2880 /** Constructor for a Jmp node.
2882 * Adds the node to the block in current_ir_block.
2884 * Jmp represents control flow to a single control successor.
2886 * @param *db A pointer for debug information.
2888 FIRM_DLL ir_node *new_d_Jmp(dbg_info *db);
2890 /** Constructor for an IJmp node.
2892 * IJmp represents control flow to a single control successor not
2893 * statically known i.e. an indirect Jmp.
2895 * @param *db A pointer for debug information.
2896 * @param *tgt The IR node representing the target address.
2898 FIRM_DLL ir_node *new_d_IJmp(dbg_info *db, ir_node *tgt);
2900 /** Constructor for a Cond node.
2902 * Adds the node to the block in current_ir_block.
2904 * If c is mode_b represents a conditional branch (if/else). If c is
2905 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2906 * node, default Proj is 0.)
2908 * This is not consistent: Input to Cond is Is, Proj has as proj number
2911 * @param *db A pointer for debug information.
2912 * @param *c The conditions parameter.Can be of mode b or I_u.
2914 FIRM_DLL ir_node *new_d_Cond(dbg_info *db, ir_node *c);
2916 /** Constructor for a Return node.
2918 * Adds the node to the block in current_ir_block.
2920 * Returns the memory and zero or more return values. Only node that
2921 * can end regular control flow.
2923 * @param *db A pointer for debug information.
2924 * @param *store The state of memory.
2925 * @param arity Number of array indices.
2926 * @param *in Array with index inputs to the node.
2928 FIRM_DLL ir_node *new_d_Return(dbg_info *db, ir_node *store,
2929 int arity, ir_node *in[]);
2931 /** Constructor for a Const_type node.
2933 * Adds the node to the start block.
2935 * The constant represents a target value. This constructor sets high
2936 * level type information for the constant value.
2937 * Derives mode from passed tarval.
2939 * @param *db A pointer for debug information.
2940 * @param *con Points to an entry in the constant table. This pointer is
2941 added to the attributes of the node.
2942 * @param *tp The type of the constant.
2944 FIRM_DLL ir_node *new_d_Const_type(dbg_info *db, tarval *con, ir_type *tp);
2946 /** Constructor for a Const node.
2948 * Adds the node to the block in current_ir_block.
2950 * Constructor for a Const node. The constant represents a target
2951 * value. Sets the type information to type_unknown. (No more
2952 * supported: If tv is entity derives a somehow useful type.)
2953 * Derives mode from passed tarval.
2955 * @param *db A pointer for debug information.
2956 * @param *con Points to an entry in the constant table. This pointer is added
2957 * to the attributes of the node.
2959 FIRM_DLL ir_node *new_d_Const(dbg_info *db, tarval *con);
2962 * @see new_rd_Const_long()
2964 * @param *db A pointer for debug information.
2965 * @param *mode The mode of the operands and results.
2966 * @param value A value from which the tarval is made.
2968 FIRM_DLL ir_node *new_d_Const_long(dbg_info *db, ir_mode *mode, long value);
2970 /** Constructor for a SymConst_type node.
2972 * This is the constructor for a symbolic constant.
2973 * There are several kinds of symbolic constants:
2974 * - symconst_type_tag The symbolic constant represents a type tag. The
2975 * type the tag stands for is given explicitly.
2976 * - symconst_type_size The symbolic constant represents the size of a type.
2977 * The type of which the constant represents the size
2978 * is given explicitly.
2979 * - symconst_type_align The symbolic constant represents the alignment of a
2980 * type. The type of which the constant represents the
2981 * size is given explicitly.
2982 * - symconst_addr_ent The symbolic constant represents the address of an
2983 * entity (variable or method). The variable is given
2984 * explicitly by a firm entity.
2985 * - symconst_ofs_ent The symbolic constant represents the offset of an
2986 * entity in its owner type.
2987 * - symconst_enum_const The symbolic constant is a enumeration constant of
2988 * an enumeration type.
2990 * Inputs to the node:
2991 * No inputs except the block it belongs to.
2992 * Outputs of the node.
2993 * An unsigned integer (I_u) or a pointer (P).
2995 * Mention union in declaration so that the firmjni generator recognizes that
2996 * it can not cast the argument to an int.
2998 * @param *db A pointer for debug information.
2999 * @param mode The mode for the SymConst.
3000 * @param value A type, ident, entity or enum constant depending on the
3002 * @param kind The kind of the symbolic constant, see the list above
3003 * @param tp The source type of the constant.
3005 FIRM_DLL ir_node *new_d_SymConst_type(dbg_info *db, ir_mode *mode,
3006 union symconst_symbol value,
3007 symconst_kind kind, ir_type *tp);
3009 /** Constructor for a SymConst node.
3011 * Same as new_d_SymConst_type, except that it sets the type to type_unknown.
3013 FIRM_DLL ir_node *new_d_SymConst(dbg_info *db, ir_mode *mode,
3014 union symconst_symbol value,
3015 symconst_kind kind);
3017 /** Constructor for a simpleSel node.
3019 * This is a shortcut for the new_d_Sel() constructor. To be used for
3020 * Sel nodes that do not select from an array, i.e., have no index
3021 * inputs. It adds the two parameters 0, NULL.
3023 * @param *db A pointer for debug information.
3024 * @param *store The memory in which the object the entity should be
3025 * selected from is allocated.
3026 * @param *objptr The object from that the Sel operation selects a
3027 * single attribute out.
3028 * @param *ent The entity to select.
3030 FIRM_DLL ir_node *new_d_simpleSel(dbg_info *db, ir_node *store, ir_node *objptr,
3033 /** Constructor for a Sel node.
3035 * The select node selects an entity (field or method) from an entity
3036 * with a compound type. It explicitly specifies the entity selected.
3037 * Dynamically the node may select entities that overwrite the given
3038 * entity. If the selected entity is an array element entity the Sel
3039 * node takes the required array indices as inputs.
3040 * Adds the node to the block in current_ir_block.
3042 * @param *db A pointer for debug information.
3043 * @param *store The memory in which the object the entity should be selected
3044 * from is allocated.
3045 * @param *objptr A pointer to a compound entity the Sel operation selects a
3046 * single attribute from.
3047 * @param arity The number of array indices needed to select an array element entity.
3048 * @param *in[] If the compound entity is an array the indices of the selected
3049 * element entity. The constructor copies this array.
3050 * @param *ent The entity to select.
3052 FIRM_DLL ir_node *new_d_Sel(dbg_info *db, ir_node *store, ir_node *objptr,
3053 int arity, ir_node *in[], ir_entity *ent);
3055 /** Constructor for a Call node.
3057 * Represents all kinds of method and function calls.
3058 * Adds the node to the block in current_ir_block.
3060 * @param *db A pointer for debug information.
3061 * @param *store The actual store.
3062 * @param *callee A pointer to the called procedure.
3063 * @param arity The number of procedure parameters.
3064 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3065 * @param *tp Type information of the procedure called.
3067 FIRM_DLL ir_node *new_d_Call(dbg_info *db, ir_node *store, ir_node *callee,
3068 int arity, ir_node *in[], ir_type *tp);
3070 /** Constructor for a Builtin node.
3072 * Represents a call of a backend-specific builtin..
3073 * Adds the node to the block in current_ir_block.
3075 * @param *db A pointer for debug information.
3076 * @param *store The actual store.
3077 * @param arity The number of procedure parameters.
3078 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3079 * @param kind The kind of the called builtin.
3080 * @param *tp Type information of the procedure called.
3082 FIRM_DLL ir_node *new_d_Builtin(dbg_info *db, ir_node *store,
3083 int arity, ir_node *in[],
3084 ir_builtin_kind kind, ir_type *tp);
3086 /** Constructor for a Add node.
3088 * Adds the node to the block in current_ir_block.
3090 * @param *db A pointer for debug information.
3091 * @param *op1 The first operand.
3092 * @param *op2 The second operand.
3093 * @param *mode The mode of the operands and the result.
3095 FIRM_DLL ir_node *new_d_Add(dbg_info *db, ir_node *op1, ir_node *op2,
3098 /** Constructor for a Sub node.
3100 * Adds the node to the block in current_ir_block.
3102 * @param *db A pointer for debug information.
3103 * @param *op1 The first operand.
3104 * @param *op2 The second operand.
3105 * @param *mode The mode of the operands and the result.
3107 FIRM_DLL ir_node *new_d_Sub(dbg_info *db, ir_node *op1, ir_node *op2,
3110 /** Constructor for a Minus node.
3112 * Adds the node to the block in current_ir_block.
3114 * @param *db A pointer for debug information.
3115 * @param *op The operand .
3116 * @param *mode The mode of the operand and the result.
3118 FIRM_DLL ir_node *new_d_Minus(dbg_info *db, ir_node *op, ir_mode *mode);
3120 /** Constructor for a Mul node.
3122 * Adds the node to the block in current_ir_block.
3124 * @param *db A pointer for debug information.
3125 * @param *op1 The first operand.
3126 * @param *op2 The second operand.
3127 * @param *mode The mode of the operands and the result.
3129 FIRM_DLL ir_node *new_d_Mul(dbg_info *db, ir_node *op1, ir_node *op2,
3132 /** Constructor for a Mulh node.
3134 * Adds the node to the block in current_ir_block.
3136 * @param *db A pointer for debug information.
3137 * @param *op1 The first operand.
3138 * @param *op2 The second operand.
3139 * @param *mode The mode of the operands and the result.
3141 FIRM_DLL ir_node *new_d_Mulh(dbg_info *db, ir_node *op1, ir_node *op2,
3144 /** Constructor for a Quot node.
3146 * Adds the node to the block in current_ir_block.
3148 * @param *db A pointer for debug information.
3149 * @param *memop The store needed to model exceptions
3150 * @param *op1 The first operand.
3151 * @param *op2 The second operand.
3152 * @param *mode The mode of the result.
3153 * @param state The pinned state.
3155 FIRM_DLL ir_node *new_d_Quot(dbg_info *db, ir_node *memop,
3156 ir_node *op1, ir_node *op2, ir_mode *mode,
3157 op_pin_state state);
3159 /** Constructor for a DivMod node.
3161 * Adds the node to the block in current_ir_block.
3163 * @param *db A pointer for debug information.
3164 * @param *memop The store needed to model exceptions
3165 * @param *op1 The first operand.
3166 * @param *op2 The second operand.
3167 * @param *mode The mode of the results.
3168 * @param state The pinned state.
3170 FIRM_DLL ir_node *new_d_DivMod(dbg_info *db, ir_node *memop, ir_node *op1,
3171 ir_node *op2, ir_mode *mode, op_pin_state state);
3173 /** Constructor for a Div node.
3175 * Adds the node to the block in current_ir_block.
3177 * @param *db A pointer for debug information.
3178 * @param *memop The store needed to model exceptions
3179 * @param *op1 The first operand.
3180 * @param *op2 The second operand.
3181 * @param *mode The mode of the result.
3182 * @param state The pinned state.
3184 FIRM_DLL ir_node *new_d_Div(dbg_info *db, ir_node *memop, ir_node *op1,
3185 ir_node *op2, ir_mode *mode, op_pin_state state);
3187 /** Constructor for a remainderless Div node.
3189 * Adds the node to the block in current_ir_block.
3191 * @param *db A pointer for debug information.
3192 * @param *memop The store needed to model exceptions
3193 * @param *op1 The first operand.
3194 * @param *op2 The second operand.
3195 * @param *mode The mode of the result.
3196 * @param state The pinned state.
3198 FIRM_DLL ir_node *new_d_DivRL(dbg_info *db, ir_node *memop,
3199 ir_node *op1, ir_node *op2, ir_mode *mode,
3200 op_pin_state state);
3202 /** Constructor for a Mod node.
3204 * Adds the node to the block in current_ir_block.
3206 * @param *db A pointer for debug information.
3207 * @param *memop The store needed to model exceptions
3208 * @param *op1 The first operand.
3209 * @param *op2 The second operand.
3210 * @param *mode The mode of the result.
3211 * @param state The pinned state.
3213 FIRM_DLL ir_node *new_d_Mod(dbg_info *db, ir_node *memop,
3214 ir_node *op1, ir_node *op2, ir_mode *mode,
3215 op_pin_state state);
3217 /** Constructor for a Abs node.
3219 * Adds the node to the block in current_ir_block.
3221 * @param *db A pointer for debug information.
3222 * @param *op The operand
3223 * @param *mode The mode of the operands and the result.
3225 FIRM_DLL ir_node *new_d_Abs(dbg_info *db, ir_node *op, ir_mode *mode);
3227 /** Constructor for a And node.
3229 * Adds the node to the block in current_ir_block.
3231 * @param *db A pointer for debug information.
3232 * @param *op1 The first operand.
3233 * @param *op2 The second operand.
3234 * @param *mode The mode of the operands and the result.
3236 FIRM_DLL ir_node *new_d_And(dbg_info *db, ir_node *op1, ir_node *op2,
3239 /** Constructor for a Or node.
3241 * Adds the node to the block in current_ir_block.
3243 * @param *db A pointer for debug information.
3244 * @param *op1 The first operand.
3245 * @param *op2 The second operand.
3246 * @param *mode The mode of the operands and the result.
3248 FIRM_DLL ir_node *new_d_Or(dbg_info *db, ir_node *op1, ir_node *op2,
3251 /** Constructor for a Eor node.
3253 * Adds the node to the block in current_ir_block.
3255 * @param *db A pointer for debug information.
3256 * @param *op1 The first operand.
3257 * @param *op2 The second operand.
3258 * @param *mode The mode of the operands and the results.
3260 FIRM_DLL ir_node *new_d_Eor(dbg_info *db, ir_node *op1, ir_node *op2,
3263 /** Constructor for a Not node.
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 *mode The mode of the operand and the result.
3271 FIRM_DLL ir_node *new_d_Not(dbg_info *db, ir_node *op, ir_mode *mode);
3273 /** Constructor for a Shl node.
3275 * Adds the node to the block in current_ir_block.
3277 * @param *db A pointer for debug information.
3278 * @param *op The operand.
3279 * @param *k The number of bits to shift the operand .
3280 * @param *mode The mode of the operand and the result.
3282 FIRM_DLL ir_node *new_d_Shl(dbg_info *db, ir_node *op, ir_node *k,
3285 /** Constructor for a Shr node.
3287 * Adds the node to the block in current_ir_block.
3289 * @param *db A pointer for debug information.
3290 * @param *op The operand.
3291 * @param *k The number of bits to shift the operand .
3292 * @param *mode The mode of the operand and the result.
3294 FIRM_DLL ir_node *new_d_Shr(dbg_info *db, ir_node *op, ir_node *k,
3297 /** Constructor for a Shrs node.
3299 * Adds the node to the block in current_ir_block.
3301 * @param *db A pointer for debug information.
3302 * @param *op The operand.
3303 * @param *k The number of bits to shift the operand .
3304 * @param *mode The mode of the operand and the result.
3306 FIRM_DLL ir_node *new_d_Shrs(dbg_info *db, ir_node *op, ir_node *k,
3309 /** Constructor for a Rotl node.
3311 * Adds the node to the block in current_ir_block.
3313 * @param *db A pointer for debug information.
3314 * @param *op The operand.
3315 * @param *k The number of bits to rotate the operand.
3316 * @param *mode The mode of the operand.
3318 FIRM_DLL ir_node *new_d_Rotl(dbg_info *db, ir_node *op, ir_node *k,
3321 /** Constructor for a Cmp node.
3323 * Adds the node to the block in current_ir_block.
3325 * @param *db A pointer for debug information.
3326 * @param *op1 The first operand.
3327 * @param *op2 The second operand.
3329 FIRM_DLL ir_node *new_d_Cmp(dbg_info *db, ir_node *op1, ir_node *op2);
3331 /** Constructor for a Conv node.
3333 * Adds the node to the block in current_ir_block.
3335 * @param *db A pointer for debug information.
3336 * @param *op The operand.
3337 * @param *mode The mode of this the operand muss be converted .
3339 FIRM_DLL ir_node *new_d_Conv(dbg_info *db, ir_node *op, ir_mode *mode);
3341 /** Constructor for a strict Conv node.
3343 * Adds the node to the block in current_ir_block.
3345 * @param *db A pointer for debug information.
3346 * @param *op The operand.
3347 * @param *mode The mode of this the operand muss be converted .
3349 FIRM_DLL ir_node *new_d_strictConv(dbg_info *db, ir_node *op, ir_mode *mode);
3351 /** Constructor for a Cast node.
3353 * High level type cast
3354 * Adds the node to the block in current_ir_block.
3356 * @param *db A pointer for debug information.
3357 * @param *op The operand.
3358 * @param *to_tp The type of this the operand muss be casted .
3360 FIRM_DLL ir_node *new_d_Cast(dbg_info *db, ir_node *op, ir_type *to_tp);
3362 /** Constructor for a Carry node.
3364 * Adds the node to the block in current_ir_block.
3366 * @param *db A pointer for debug information.
3367 * @param *op1 The first operand.
3368 * @param *op2 The second operand.
3369 * @param *mode The mode of the operands and the result.
3371 FIRM_DLL ir_node *new_d_Carry(dbg_info *db, ir_node *op1, ir_node *op2,
3374 /** Constructor for a Borrow node.
3376 * Adds the node to the block in current_ir_block.
3378 * @param *db A pointer for debug information.
3379 * @param *op1 The first operand.
3380 * @param *op2 The second operand.
3381 * @param *mode The mode of the operands and the result.
3383 FIRM_DLL ir_node *new_d_Borrow(dbg_info *db, ir_node *op1, ir_node *op2,
3386 /** Constructor for a Phi node.
3388 * Adds the node to the block in current_ir_block.
3390 * @param *db A pointer for debug information.
3391 * @param arity The number of predecessors
3392 * @param *in Array with predecessors
3393 * @param *mode The mode of it's inputs and output.
3395 FIRM_DLL ir_node *new_d_Phi(dbg_info *db, int arity, ir_node *in[],
3398 /** Constructor for a Load node.
3400 * Adds the node to the block in current_ir_block.
3402 * @param *db A pointer for debug information.
3403 * @param *store The current memory
3404 * @param *addr A pointer to the variable to be read in this memory.
3405 * @param *mode The mode of the value to be loaded.
3406 * @param flags Additional flags for alignment, volatility and pin state.
3408 FIRM_DLL ir_node *new_d_Load(dbg_info *db, ir_node *store, ir_node *addr,
3409 ir_mode *mode, ir_cons_flags flags);
3411 /** Constructor for a Store node.
3413 * Adds the node to the block in current_ir_block.
3415 * @param *db A pointer for debug information.
3416 * @param *store The current memory
3417 * @param *addr A pointer to the variable to be read in this memory.
3418 * @param *val The value to write to this variable.
3419 * @param flags Additional flags for alignment, volatility and pin state.
3421 FIRM_DLL ir_node *new_d_Store(dbg_info *db, ir_node *store, ir_node *addr,
3422 ir_node *val, ir_cons_flags flags);
3424 /** Constructor for a Alloc node.
3426 * The Alloc node extends the memory by space for an entity of type alloc_type.
3427 * Adds the node to the block in current_ir_block.
3429 * @param *db A pointer for debug information.
3430 * @param *store The memory which shall contain the new variable.
3431 * @param *count The number of objects to allocate.
3432 * @param *alloc_type The type of the allocated variable.
3433 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3435 FIRM_DLL ir_node *new_d_Alloc(dbg_info *db, ir_node *store, ir_node *count,
3436 ir_type *alloc_type, ir_where_alloc where);
3438 /** Constructor for a Free node.
3440 * Frees the memory occupied by the entity pointed to by the pointer
3441 * arg. Type indicates the type of the entity the argument points to.
3442 * Adds the node to the block in current_ir_block.
3444 * @param *db A pointer for debug information.
3445 * @param *store The memory which shall contain the new variable.
3446 * @param *ptr The pointer to the object to free.
3447 * @param *size The number of objects of type free_type to free in a sequence.
3448 * @param *free_type The type of the freed variable.
3449 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
3451 FIRM_DLL ir_node *new_d_Free(dbg_info *db, ir_node *store, ir_node *ptr,
3452 ir_node *size, ir_type *free_type,
3453 ir_where_alloc where);
3455 /** Constructor for a Sync node.
3457 * Merges several memory values. The node assumes that a variable
3458 * either occurs only in one of the memories, or it contains the same
3459 * value in all memories where it occurs.
3460 * Adds the node to the block in current_ir_block.
3462 * @param *db A pointer for debug information.
3463 * @param arity The number of memories to synchronize.
3464 * @param **in An array of pointers to nodes that produce an output of type
3465 * memory. The constructor copies this array.
3467 FIRM_DLL ir_node *new_d_Sync(dbg_info *db, int arity, ir_node *in[]);
3469 /** Constructor for a Proj node.
3471 * Projects a single value out of a tuple. The parameter proj gives the
3472 * position of the value within the tuple.
3473 * Adds the node to the block in current_ir_block.
3475 * @param *db A pointer for deubug information.
3476 * @param arg A node producing a tuple.
3477 * @param *mode The mode of the value to project.
3478 * @param proj The position of the value in the tuple.
3480 FIRM_DLL ir_node *new_d_Proj(dbg_info *db, ir_node *arg, ir_mode *mode,
3483 /** Constructor for a defaultProj node.
3485 * Represents the default control flow of a Switch-Cond node.
3486 * Adds the node to the block in current_ir_block.
3488 * @param *db A pointer for debug information.
3489 * @param arg A node producing a tuple.
3490 * @param max_proj The end position of the value in the tuple.
3492 FIRM_DLL ir_node *new_d_defaultProj(dbg_info *db, ir_node *arg, long max_proj);
3494 /** Constructor for a Tuple node.
3496 * This is an auxiliary node to replace a node that returns a tuple
3497 * without changing the corresponding Proj nodes.
3498 * Adds the node to the block in current_ir_block.
3500 * @param *db A pointer for debug information.
3501 * @param arity The number of tuple elements.
3502 * @param **in An array containing pointers to the nodes producing the tuple elements.
3504 FIRM_DLL ir_node *new_d_Tuple(dbg_info *db, int arity, ir_node *in[]);
3506 /** Constructor for a Id node.
3508 * This is an auxiliary node to replace a node that returns a single
3509 * value. Adds the node to the block in current_ir_block.
3511 * @param *db A pointer for debug information.
3512 * @param *val The operand to Id.
3513 * @param *mode The mode of *val.
3515 FIRM_DLL ir_node *new_d_Id(dbg_info *db, ir_node *val, ir_mode *mode);
3517 /** Constructor for a Confirm node.
3519 * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3520 * Specifies constraints for a value. To support dataflow analyses.
3522 * Example: If the value never exceeds '100' this is expressed by placing a
3523 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
3525 * @param *db A pointer for debug information.
3526 * @param *val The value we express a constraint for
3527 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3528 * @param cmp The compare operation.
3530 FIRM_DLL ir_node *new_d_Confirm(dbg_info *db, ir_node *val, ir_node *bound,
3533 /** Constructor for an Unknown node.
3535 * Represents an arbitrary value. Places the node in
3538 * @param *db A pointer for debug information.
3539 * @param *m The mode of the unknown value.
3541 FIRM_DLL ir_node *new_d_Unknown(dbg_info *db, ir_mode *m);
3543 /** Constructor for a CallBegin node.
3545 * CallBegin represents control flow depending of the pointer value
3546 * representing the called method to the called methods. The
3547 * constructor copies the method pointer input from the passed Call
3548 * node.Adds the node to the block in current_ir_block.
3550 * @param *db A pointer for debug information.
3551 * @param *ptr pointer to the called function
3552 * @param *call associated call operation
3554 FIRM_DLL ir_node *new_d_CallBegin(dbg_info *db, ir_node *ptr, ir_node *call);
3556 /** Constructor for an EndReg node.
3558 *Adds the node to the block in current_ir_block.
3560 * @param *db A pointer for debug information.
3562 FIRM_DLL ir_node *new_d_EndReg(dbg_info *db);
3564 /** Constructor for an EndExcept node.
3566 * Used to represent regular procedure end in interprocedual view.
3567 * Adds the node to the block in current_ir_block.
3569 * @param *db A pointer for debug information.
3571 FIRM_DLL ir_node *new_d_EndExcept(dbg_info *db);
3573 /** Constructor for a Break node.
3575 * Used to represent exceptional procedure end in interprocedural view.
3576 * Adds the node to the block in current_ir_block.
3578 * Break represents control flow to a single control successor just as Jmp.
3579 * The blocks separated by a break may not be concatenated by an optimization.
3580 * It is used for the interprocedural representation where blocks are parted
3581 * behind Call nodes to represent the control flow to called procedures.
3583 * @param *db A pointer for debug information.
3585 FIRM_DLL ir_node *new_d_Break(dbg_info *db);
3587 /** Constructor for a Filter node.
3589 * Constructor for a Filter node. Adds the node to the block in
3590 * current_ir_block. Filter is a node with two views used to
3591 * construct the interprocedural view. In intraprocedural view its
3592 * semantics are identical to the Proj node. In interprocedural view
3593 * the Filter performs the Phi operation on method parameters or
3594 * results. Other than a Phi a Filter node may not be removed if it
3595 * has only a single input.
3597 * The constructor builds the Filter in intraprocedural view.
3599 * @param *db A pointer for debug information.
3600 * @param *arg The tuple value to project from.
3601 * @param *mode The mode of the projected value.
3602 * @param proj The position in the tuple to project from.
3604 FIRM_DLL ir_node *new_d_Filter(dbg_info *db, ir_node *arg, ir_mode *mode,
3607 /** Constructor for a Mux node.
3609 * @param *db A pointer for debug information.
3610 * @param *sel The ir_node that calculates the boolean select.
3611 * @param *ir_true The ir_node that calculates the true result.
3612 * @param *ir_false The ir_node that calculates the false result.
3613 * @param *mode The mode of the node (and it_true and ir_false).
3615 FIRM_DLL ir_node *new_d_Mux(dbg_info *db, ir_node *sel,
3616 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
3618 /** Constructor for a CopyB node.
3620 * @param *db A pointer for debug information.
3621 * @param *store The current memory
3622 * @param *dst The ir_node that represents the destination address.
3623 * @param *src The ir_node that represents the source address.
3624 * @param *data_type The type of the copied data
3626 FIRM_DLL ir_node *new_d_CopyB(dbg_info *db, ir_node *store, ir_node *dst,
3627 ir_node *src, ir_type *data_type);
3629 /** Constructor for a InstOf node.
3631 * A High-Level Type check.
3633 * @param *db A pointer for debug information.
3634 * @param *store The memory in which the object the entity should be selected
3635 * from is allocated.
3636 * @param *objptr A pointer to a object of a class type.
3637 * @param *type The type of which objptr must be.
3639 FIRM_DLL ir_node *new_d_InstOf(dbg_info *db, ir_node *store, ir_node *objptr,
3642 /** Constructor for a Raise node.
3644 * A High-Level Exception throw.
3646 * @param *db A pointer for debug information.
3647 * @param *store The current memory.
3648 * @param *obj A pointer to the Except variable.
3650 FIRM_DLL ir_node *new_d_Raise(dbg_info *db, ir_node *store, ir_node *obj);
3652 /** Constructor for a Bound node.
3654 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
3656 * @param *db A pointer for debug information.
3657 * @param *store The current memory
3658 * @param *idx The ir_node that represents an index.
3659 * @param *lower The ir_node that represents the lower bound for the index.
3660 * @param *upper The ir_node that represents the upper bound for the index.
3662 FIRM_DLL ir_node *new_d_Bound(dbg_info *db, ir_node *store, ir_node *idx,
3663 ir_node *lower, ir_node *upper);
3665 /** Constructor for a Pin node.
3667 * @param *db A pointer for debug information.
3668 * @param *node The node which value should be pinned.
3670 FIRM_DLL ir_node *new_d_Pin(dbg_info *db, ir_node *node);
3672 /** Constructor for an ASM pseudo node.
3674 * @param *db A pointer for debug information.
3675 * @param arity The number of data inputs to the node.
3676 * @param *in The array of length arity of data inputs.
3677 * @param *inputs The array of length arity of input constraints.
3678 * @param n_outs The number of data outputs to the node.
3679 * @param *outputs The array of length n_outs of output constraints.
3680 * @param n_clobber The number of clobbered registers.
3681 * @param *clobber The array of length n_clobber of clobbered registers.
3682 * @param *asm_text The assembler text.
3684 FIRM_DLL ir_node *new_d_ASM(dbg_info *db, int arity, ir_node *in[],
3685 ir_asm_constraint *inputs,
3686 int n_outs, ir_asm_constraint *outputs,
3687 int n_clobber, ident *clobber[], ident *asm_text);
3689 /*-----------------------------------------------------------------------*/
3690 /* The block oriented interface without debug support */
3691 /*-----------------------------------------------------------------------*/
3693 /** Constructor for a Block node.
3695 * Constructor for a Block node. Adds the block to the graph in
3696 * current_ir_graph. Constructs a Block with a fixed number of predecessors.
3698 * @param arity The number of control predecessors.
3699 * @param in An array of control predecessors. The length of
3700 * the array must be 'arity'.
3702 FIRM_DLL ir_node *new_Block(int arity, ir_node *in[]);
3704 /** Constructor for a Start node.
3706 * Adds the node to the block in current_ir_block.
3709 FIRM_DLL ir_node *new_Start(void);
3711 /** Constructor for an End node.
3713 * Adds the node to the block in current_ir_block.
3715 FIRM_DLL ir_node *new_End(void);
3717 /** Constructor for an EndReg node.
3719 * Used to represent regular procedure end in interprocedual view.
3720 * Adds the node to the block in current_ir_block.
3722 FIRM_DLL ir_node *new_EndReg(void);
3724 /** Constructor for an EndExpcept node.
3726 * Used to represent exceptional procedure end in interprocedural view.
3727 * Adds the node to the block in current_ir_block.
3729 FIRM_DLL ir_node *new_EndExcept(void);
3731 /** Constructor for a Jump node.
3733 * Adds the node to the block in current_ir_block.
3735 * Jmp represents control flow to a single control successor.
3737 FIRM_DLL ir_node *new_Jmp(void);
3739 /** Constructor for an IJmp node.
3741 * IJmp represents control flow to a single control successor not
3742 * statically known i.e. an indirect Jmp.
3744 * @param *tgt The IR node representing the target address.
3746 FIRM_DLL ir_node *new_IJmp(ir_node *tgt);
3748 /** Constructor for a Break node.
3749 * Break represents control flow to a single control successor just as Jmp.
3750 * The blocks separated by a break may not be concatenated by an optimization.
3751 * It is used for the interprocedural representation where blocks are parted
3752 * behind Call nodes to represent the control flow to called procedures.
3753 * Adds the node to the block in current_ir_block.
3755 FIRM_DLL ir_node *new_Break(void);
3757 /** Constructor for a Cond node.
3759 * If c is mode_b represents a conditional branch (if/else). If c is
3760 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
3761 * node, default Proj is 0.). Adds the node to the block in current_ir_block.
3763 * This is not consistent: Input to Cond is Is, Proj has as proj number
3767 * @param *c The conditions parameter.Can be of mode b or I_u.
3769 FIRM_DLL ir_node *new_Cond(ir_node *c);
3771 /** Constructor for a Return node.
3773 * Returns the memory and zero or more return values. Only node that
3774 * can end regular control flow. Adds the node to the block in current_ir_block.
3776 * @param *store The state of memory.
3777 * @param arity Number of array indices.
3778 * @param *in Array with index inputs to the node.
3780 FIRM_DLL ir_node *new_Return(ir_node *store, int arity, ir_node *in[]);
3782 /** Constructor for a Const node.
3784 * Constructor for a Const node. The constant represents a target
3785 * value. Sets the type information to type_unknown. (No more
3786 * supported: If tv is entity derives a somehow useful type.)
3787 * Adds the node to the block in current_ir_block.
3788 * Derives mode from passed tarval.
3790 * @param *con Points to an entry in the constant table. This pointer is
3791 * added to the attributes of the node.
3793 FIRM_DLL ir_node *new_Const(tarval *con);
3796 * Make a const from a long.
3797 * This is just convenience for the usual
3799 * new_Const(mode, tarval_from_long(mode, ...))
3802 * @param mode The mode for the const.
3803 * @param value The value of the constant.
3804 * @return A new const node.
3806 FIRM_DLL ir_node *new_Const_long(ir_mode *mode, long value);
3808 /** Constructor for a Const node.
3810 * Derives mode from passed tarval. */
3811 FIRM_DLL ir_node *new_Const_type(tarval *con, ir_type *tp);
3813 /** Constructor for a SymConst_type node.
3815 * This is the constructor for a symbolic constant.
3816 * There are several kinds of symbolic constants:
3817 * - symconst_type_tag The symbolic constant represents a type tag. The
3818 * type the tag stands for is given explicitly.
3819 * - symconst_type_size The symbolic constant represents the size of a type.
3820 * The type of which the constant represents the size
3821 * is given explicitly.
3822 * - symconst_type_align The symbolic constant represents the alignment of a
3823 * type. The type of which the constant represents the
3824 * size is given explicitly.
3825 * - symconst_addr_ent The symbolic constant represents the address of an
3826 * entity (variable or method). The variable is given
3827 * explicitly by a firm entity.
3828 * - symconst_ofs_ent The symbolic constant represents the offset of an
3829 * entity in its owner type.
3830 * - symconst_enum_const The symbolic constant is a enumeration constant of
3831 * an enumeration type.
3833 * Inputs to the node:
3834 * No inputs except the block it belongs to.
3835 * Outputs of the node.
3836 * An unsigned integer (I_u) or a pointer (P).
3838 * Mention union in declaration so that the firmjni generator recognizes that
3839 * it can not cast the argument to an int.
3841 * @param mode The mode for the SymConst.
3842 * @param value A type, ident, entity or enum constant depending on the
3844 * @param kind The kind of the symbolic constant, see the list above
3845 * @param tp The source type of the constant.
3847 FIRM_DLL ir_node *new_SymConst_type(ir_mode *mode, union symconst_symbol value,
3848 symconst_kind kind, ir_type *tp);
3850 /** Constructor for a SymConst node.
3852 * This is the constructor for a symbolic constant.
3853 * There are several kinds of symbolic constants:
3854 * - symconst_type_tag The symbolic constant represents a type tag. The
3855 * type the tag stands for is given explicitly.
3856 * - symconst_type_size The symbolic constant represents the size of a type.
3857 * The type of which the constant represents the size
3858 * is given explicitly.
3859 * - symconst_type_align The symbolic constant represents the alignment of a
3860 * type. The type of which the constant represents the
3861 * size is given explicitly.
3862 * - symconst_addr_ent The symbolic constant represents the address of an
3863 * entity (variable or method). The variable is given
3864 * explicitly by a firm entity.
3865 * - symconst_ofs_ent The symbolic constant represents the offset of an
3866 * entity in its owner type.
3867 * - symconst_enum_const The symbolic constant is a enumeration constant of
3868 * an enumeration type.
3870 * Inputs to the node:
3871 * No inputs except the block it belongs to.
3872 * Outputs of the node.
3873 * An unsigned integer (I_u) or a pointer (P).
3875 * Mention union in declaration so that the firmjni generator recognizes that
3876 * it can not cast the argument to an int.
3878 * @param mode The mode for the SymConst.
3879 * @param value A type, ident, entity or enum constant depending on the
3881 * @param kind The kind of the symbolic constant, see the list above
3883 FIRM_DLL ir_node *new_SymConst(ir_mode *mode, union symconst_symbol value,
3884 symconst_kind kind);
3886 /** Constructor for a simpelSel node.
3888 * This is a shortcut for the new_Sel() constructor. To be used for
3889 * Sel nodes that do not select from an array, i.e., have no index
3890 * inputs. It adds the two parameters 0, NULL.
3892 * @param *store The memory in which the object the entity should be selected from is allocated.
3893 * @param *objptr The object from that the Sel operation selects a single attribute out.
3894 * @param *ent The entity to select.
3896 FIRM_DLL ir_node *new_simpleSel(ir_node *store, ir_node *objptr,
3899 /** Constructor for a Sel node.
3901 * The select node selects an entity (field or method) from an entity
3902 * with a compound type. It explicitly specifies the entity selected.
3903 * Dynamically the node may select entities that overwrite the given
3904 * entity. If the selected entity is an array element entity the Sel
3905 * node takes the required array indices as inputs.
3906 * Adds the node to the block in current_ir_block.
3908 * @param *store The memory in which the object the entity should be selected
3909 * from is allocated.
3910 * @param *objptr A pointer to a compound entity the Sel operation selects a
3911 * single attribute from.
3912 * @param arity The number of array indices needed to select an array element entity.
3913 * @param *in[] If the compound entity is an array the indices of the selected
3914 * element entity. The constructor copies this array.
3915 * @param *ent The entity to select.
3917 FIRM_DLL ir_node *new_Sel(ir_node *store, ir_node *objptr,
3918 int arity, ir_node *in[], ir_entity *ent);
3920 /** Constructor for a Call node.
3922 * Adds the node to the block in current_ir_block.
3923 * Represents all kinds of method and function calls.
3925 * @param *store The actual store.
3926 * @param *callee A pointer to the called procedure.
3927 * @param arity The number of procedure parameters.
3928 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3929 * @param *tp Type information of the procedure called.
3931 FIRM_DLL ir_node *new_Call(ir_node *store, ir_node *callee,
3932 int arity, ir_node *in[], ir_type *tp);
3934 /** Constructor for a Builtin node.
3936 * Represents a call of a backend-specific builtin..
3937 * Represents all kinds of method and function calls.
3939 * @param *store The actual store.
3940 * @param kind The kind of the called builtin.
3941 * @param arity The number of procedure parameters.
3942 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3943 * @param *tp Type information of the procedure called.
3945 FIRM_DLL ir_node *new_Builtin(ir_node *store, int arity, ir_node *in[],
3946 ir_builtin_kind kind, ir_type *tp);
3948 /** Constructor for a CallBegin node.
3950 * CallBegin represents control flow depending of the pointer value
3951 * representing the called method to the called methods. The
3952 * constructor copies the method pointer input from the passed Call
3953 * node. Adds the node to the block in current_ir_block.
3955 * @param *ptr pointer to the called function
3956 * @param *call associated call operation
3958 FIRM_DLL ir_node *new_CallBegin(ir_node *ptr, ir_node *call);
3960 /** Constructor for a Add node.
3962 * Adds the node to the block in current_ir_block.
3964 * @param *op1 The first operand.
3965 * @param *op2 The second operand.
3966 * @param *mode The mode of the operands and the result.
3968 FIRM_DLL ir_node *new_Add(ir_node *op1, ir_node *op2, ir_mode *mode);
3970 /** Constructor for a Sub node.
3972 * Adds the node to the block in current_ir_block.
3974 * @param *op1 The first operand.
3975 * @param *op2 The second operand.
3976 * @param *mode The mode of the operands and the result.
3978 FIRM_DLL ir_node *new_Sub(ir_node *op1, ir_node *op2, ir_mode *mode);
3980 /** Constructor for a Minus node.
3982 * Adds the node to the block in current_ir_block.
3984 * @param *op The operand .
3985 * @param *mode The mode of the operand and the result.
3987 FIRM_DLL ir_node *new_Minus(ir_node *op, ir_mode *mode);
3990 * Constructor for a Mul node. Adds the node to the block in current_ir_block.
3992 * @param *op1 The first operand.
3993 * @param *op2 The second operand.
3994 * @param *mode The mode of the operands and the result.
3996 FIRM_DLL ir_node *new_Mul(ir_node *op1, ir_node *op2, ir_mode *mode);
3999 * Constructor for a Mulh node. Adds the node to the block in current_ir_block.
4001 * @param *op1 The first operand.
4002 * @param *op2 The second operand.
4003 * @param *mode The mode of the operands and the result.
4005 FIRM_DLL ir_node *new_Mulh(ir_node *op1, ir_node *op2, ir_mode *mode);
4007 /** Constructor for a Quot node.
4009 * Adds the node to the block in current_ir_block.
4011 * @param *memop The store needed to model exceptions
4012 * @param *op1 The first operand.
4013 * @param *op2 The second operand.
4014 * @param *mode The mode of the result.
4015 * @param state The pinned state.
4017 FIRM_DLL ir_node *new_Quot(ir_node *memop, ir_node *op1, ir_node *op2,
4018 ir_mode *mode, op_pin_state state);
4020 /** Constructor for a DivMod node.
4022 * Adds the node to the block in current_ir_block.
4024 * @param *memop The store needed to model exceptions
4025 * @param *op1 The first operand.
4026 * @param *op2 The second operand.
4027 * @param *mode The mode of the results.
4028 * @param state The pinned state.
4030 FIRM_DLL ir_node *new_DivMod(ir_node *memop, ir_node *op1, ir_node *op2,
4031 ir_mode *mode, op_pin_state state);
4033 /** Constructor for a Div node.
4035 * Adds the node to the block in current_ir_block.
4037 * @param *memop The store needed to model exceptions
4038 * @param *op1 The first operand.
4039 * @param *op2 The second operand.
4040 * @param *mode The mode of the result.
4041 * @param state The pinned state.
4043 FIRM_DLL ir_node *new_Div(ir_node *memop, ir_node *op1, ir_node *op2,
4044 ir_mode *mode, op_pin_state state);
4046 /** Constructor for a remainderless Div node.
4048 * Adds the node to the block in current_ir_block.
4050 * @param *memop The store needed to model exceptions
4051 * @param *op1 The first operand.
4052 * @param *op2 The second operand.
4053 * @param *mode The mode of the result.
4054 * @param state The pinned state.
4056 FIRM_DLL ir_node *new_DivRL(ir_node *memop, ir_node *op1, ir_node *op2,
4057 ir_mode *mode, op_pin_state state);
4059 /** Constructor for a Mod node.
4061 * Adds the node to the block in current_ir_block.
4063 * @param *memop The store needed to model exceptions
4064 * @param *op1 The first operand.
4065 * @param *op2 The second operand.
4066 * @param *mode The mode of the result.
4067 * @param state The pinned state.
4069 FIRM_DLL ir_node *new_Mod(ir_node *memop, ir_node *op1, ir_node *op2,
4070 ir_mode *mode, op_pin_state state);
4072 /** Constructor for a Abs node.
4074 * Adds the node to the block in current_ir_block.
4076 * @param *op The operand
4077 * @param *mode The mode of the operands and the result.
4079 FIRM_DLL ir_node *new_Abs(ir_node *op, ir_mode *mode);
4081 /** Constructor for a And node.
4083 * Adds the node to the block in current_ir_block.
4085 * @param *op1 The first operand.
4086 * @param *op2 The second operand.
4087 * @param *mode The mode of the operands and the result.
4089 FIRM_DLL ir_node *new_And(ir_node *op1, ir_node *op2, ir_mode *mode);
4092 * Constructor for a Or node. Adds the node to the block in current_ir_block.
4094 * @param *op1 The first operand.
4095 * @param *op2 The second operand.
4096 * @param *mode The mode of the operands and the result.
4098 FIRM_DLL ir_node *new_Or(ir_node *op1, ir_node *op2, ir_mode *mode);
4101 * Constructor for a Eor node. Adds the node to the block in current_ir_block.
4103 * @param *op1 The first operand.
4104 * @param *op2 The second operand.
4105 * @param *mode The mode of the operands and the results.
4107 FIRM_DLL ir_node *new_Eor(ir_node *op1, ir_node *op2, ir_mode *mode);
4109 /** Constructor for a Not node.
4111 * Adds the node to the block in current_ir_block.
4113 * @param *op The operand.
4114 * @param *mode The mode of the operand and the result.
4116 FIRM_DLL ir_node *new_Not(ir_node *op, ir_mode *mode);
4118 /** Constructor for a Shl node.
4120 * Adds the node to the block in current_ir_block.
4122 * @param *op The operand.
4123 * @param *k The number of bits to shift the operand .
4124 * @param *mode The mode of the operand and the result.
4126 FIRM_DLL ir_node *new_Shl(ir_node *op, ir_node *k, ir_mode *mode);
4129 * Constructor for a Shr node. Adds the node to the block in current_ir_block.
4131 * @param *op The operand.
4132 * @param *k The number of bits to shift the operand .
4133 * @param *mode The mode of the operand and the result.
4135 FIRM_DLL ir_node *new_Shr(ir_node *op, ir_node *k, ir_mode *mode);
4137 /** Constructor for a Shrs node.
4139 * Adds the node to the block in current_ir_block.
4141 * @param *op The operand.
4142 * @param *k The number of bits to shift the operand .
4143 * @param *mode The mode of the operand and the result.
4145 FIRM_DLL ir_node *new_Shrs(ir_node *op, ir_node *k, ir_mode *mode);
4147 /** Constructor for a Rotl node.
4149 * Adds the node to the block in current_ir_block.
4151 * @param *op The operand.
4152 * @param *k The number of bits to rotate the operand.
4153 * @param *mode The mode of the operand.
4155 FIRM_DLL ir_node *new_Rotl(ir_node *op, ir_node *k, ir_mode *mode);
4157 /** Constructor for a Cmp node.
4159 * Adds the node to the block in current_ir_block.
4161 * @param *op1 The first operand.
4162 * @param *op2 The second operand.
4164 FIRM_DLL ir_node *new_Cmp(ir_node *op1, ir_node *op2);
4166 /** Constructor for a Conv node.
4168 * Adds the node to the block in current_ir_block.
4170 * @param *op The operand.
4171 * @param *mode The mode of this the operand muss be converted.
4173 FIRM_DLL ir_node *new_Conv(ir_node *op, ir_mode *mode);
4175 /** Constructor for a strict Conv node.
4177 * Adds the node to the block in current_ir_block.
4179 * @param *op The operand.
4180 * @param *mode The mode of this the operand muss be converted.
4182 FIRM_DLL ir_node *new_strictConv(ir_node *op, ir_mode *mode);
4184 /** Constructor for a Cast node.
4186 * Adds the node to the block in current_ir_block.
4187 * High level type cast
4189 * @param *op The operand.
4190 * @param *to_tp The type of this the operand muss be casted .
4192 FIRM_DLL ir_node *new_Cast(ir_node *op, ir_type *to_tp);
4194 /** Constructor for a Carry node.
4196 * Adds the node to the block in current_ir_block.
4198 * @param *op1 The first operand.
4199 * @param *op2 The second operand.
4200 * @param *mode The mode of the operands and the result.
4202 FIRM_DLL ir_node *new_Carry(ir_node *op1, ir_node *op2, ir_mode *mode);
4204 /** Constructor for a Borrow node.
4206 * Adds the node to the block in current_ir_block.
4208 * @param *op1 The first operand.
4209 * @param *op2 The second operand.
4210 * @param *mode The mode of the operands and the result.
4212 FIRM_DLL ir_node *new_Borrow(ir_node *op1, ir_node *op2, ir_mode *mode);
4214 /** Constructor for a Phi node.
4216 * Adds the node to the block in current_ir_block.
4218 * @param arity The number of predecessors.
4219 * @param *in Array with predecessors.
4220 * @param *mode The mode of it's inputs and output.
4222 FIRM_DLL ir_node *new_Phi(int arity, ir_node *in[], ir_mode *mode);
4224 /** Constructor for a Load node.
4226 * @param *store The current memory.
4227 * @param *addr A pointer to the variable to be read in this memory.
4228 * @param *mode The mode of the value to be loaded.
4229 * @param flags Additional flags for alignment, volatility and pin state.
4231 FIRM_DLL ir_node *new_Load(ir_node *store, ir_node *addr, ir_mode *mode,
4232 ir_cons_flags flags);
4234 /** Constructor for a Store node.
4236 * @param *store The current memory.
4237 * @param *addr A pointer to the variable to be read in this memory.
4238 * @param *val The value to write to this variable.
4239 * @param flags Additional flags for alignment, volatility and pin state.
4241 FIRM_DLL ir_node *new_Store(ir_node *store, ir_node *addr, ir_node *val,
4242 ir_cons_flags flags);
4244 /** Constructor for a Alloc node.
4246 * The Alloc node extends the memory by space for an entity of type alloc_type.
4247 * Adds the node to the block in current_ir_block.
4249 * @param *store The memory which shall contain the new variable.
4250 * @param *count The number of objects to allocate.
4251 * @param *alloc_type The type of the allocated variable.
4252 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
4254 FIRM_DLL ir_node *new_Alloc(ir_node *store, ir_node *count, ir_type *alloc_type,
4255 ir_where_alloc where);
4257 /** Constructor for a Free node.
4259 * Frees the memory occupied by the entity pointed to by the pointer
4260 * arg. Type indicates the type of the entity the argument points to.
4261 * Adds the node to the block in current_ir_block.
4263 * @param *store The memory which shall contain the new variable.
4264 * @param *ptr The pointer to the object to free.
4265 * @param *size The number of objects of type free_type to free in a sequence.
4266 * @param *free_type The type of the freed variable.
4267 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
4269 FIRM_DLL ir_node *new_Free(ir_node *store, ir_node *ptr, ir_node *size,
4270 ir_type *free_type, ir_where_alloc where);
4272 /** Constructor for a Sync node.
4274 * Merges several memory values. The node assumes that a variable
4275 * either occurs only in one of the memories, or it contains the same
4276 * value in all memories where it occurs.
4277 * Adds the node to the block in current_ir_block.
4279 * @param arity The number of memories to synchronize.
4280 * @param **in An array of pointers to nodes that produce an output of type
4281 * memory. The constructor copies this array.
4283 FIRM_DLL ir_node *new_Sync(int arity, ir_node *in[]);
4285 /** Constructor for a Proj node.
4287 * Projects a single value out of a tuple. The parameter proj gives the
4288 * position of the value within the tuple.
4289 * Adds the node to the block in current_ir_block.
4291 * @param arg A node producing a tuple.
4292 * @param *mode The mode of the value to project.
4293 * @param proj The position of the value in the tuple.
4295 FIRM_DLL ir_node *new_Proj(ir_node *arg, ir_mode *mode, long proj);
4297 /** Constructor for a Filter node.
4299 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
4300 * Filter is a node with two views used to construct the interprocedural view.
4301 * In intraprocedural view its semantics are identical to the Proj node.
4302 * In interprocedural view the Filter performs the Phi operation on method
4303 * parameters or results. Other than a Phi a Filter node may not be removed
4304 * if it has only a single input.
4306 * The constructor builds the Filter in intraprocedural view.
4308 * @param *arg The tuple value to project from.
4309 * @param *mode The mode of the projected value.
4310 * @param proj The position in the tuple to project from.
4312 FIRM_DLL ir_node *new_Filter(ir_node *arg, ir_mode *mode, long proj);
4314 /** Constructor for a defaultProj node.
4316 * Represents the default control flow of a Switch-Cond node.
4317 * Adds the node to the block in current_ir_block.
4319 * @param arg A node producing a tuple.
4320 * @param max_proj The end position of the value in the tuple.
4322 FIRM_DLL ir_node *new_defaultProj(ir_node *arg, long max_proj);
4324 /** Constructor for a Tuple node.
4326 * This is an auxiliary node to replace a node that returns a tuple
4327 * without changing the corresponding Proj nodes.
4328 * Adds the node to the block in current_ir_block.
4330 * @param arity The number of tuple elements.
4331 * @param **in An array containing pointers to the nodes producing the tuple elements.
4333 FIRM_DLL ir_node *new_Tuple(int arity, ir_node *in[]);
4335 /** Constructor for an Id node.
4337 * This is an auxiliary node to replace a node that returns a single
4338 * value. Adds the node to the block in current_ir_block.
4340 * @param *val The operand to Id.
4341 * @param *mode The mode of *val.
4343 FIRM_DLL ir_node *new_Id(ir_node *val, ir_mode *mode);
4345 /** Constructor for a Bad node.
4347 * Returns the unique Bad node of the graph. The same as
4350 FIRM_DLL ir_node *new_Bad(void);
4352 /** Constructor for a Confirm node.
4354 * Specifies constraints for a value. To support dataflow analyses.
4355 * Adds the node to the block in current_ir_block.
4357 * Example: If the value never exceeds '100' this is expressed by placing a
4358 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
4360 * @param *val The value we express a constraint for
4361 * @param *bound The value to compare against. Must be a firm node, typically a constant.
4362 * @param cmp The compare operation.
4364 FIRM_DLL ir_node *new_Confirm(ir_node *val, ir_node *bound, pn_Cmp cmp);
4366 /** Constructor for an Unknown node.
4368 * Represents an arbitrary value. Places the node in
4371 * @param *m The mode of the unknown value.
4373 FIRM_DLL ir_node *new_Unknown(ir_mode *m);
4375 /** Constructor for a NoMem node.
4377 * Returns the unique NoMem node of the graph. The same as
4380 FIRM_DLL ir_node *new_NoMem(void);
4382 /** Constructor for a Mux node.
4384 * Adds the node to the block in current_ir_block.
4386 * @param *sel The ir_node that calculates the boolean select.
4387 * @param *ir_true The ir_node that calculates the true result.
4388 * @param *ir_false The ir_node that calculates the false result.
4389 * @param *mode The mode of the node (and it_true and ir_false).
4391 FIRM_DLL ir_node *new_Mux(ir_node *sel, ir_node *ir_false, ir_node *ir_true,
4394 /** Constructor for a CopyB node.
4396 * Adds the node to the block in current_ir_block.
4398 * @param *store The current memory
4399 * @param *dst The ir_node that represents the destination address.
4400 * @param *src The ir_node that represents the source address.
4401 * @param *data_type The type of the copied data
4403 FIRM_DLL ir_node *new_CopyB(ir_node *store, ir_node *dst, ir_node *src,
4404 ir_type *data_type);
4406 /** Constructor for a InstOf node.
4408 * A High-Level Type check.
4410 * @param *store The memory in which the object the entity should be selected
4411 * from is allocated.
4412 * @param *objptr A pointer to a object of a class type.
4413 * @param *type The type of which objptr must be.
4415 FIRM_DLL ir_node *new_InstOf(ir_node *store, ir_node *objptr, ir_type *type);
4417 /**Constructor for a Raise node.
4419 * A High-Level Exception throw.
4421 * @param *store The current memory.
4422 * @param *obj A pointer to the Except variable.
4424 FIRM_DLL ir_node *new_Raise(ir_node *store, ir_node *obj);
4426 /** Constructor for a Bound node.
4428 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
4430 * Adds the node to the block in current_ir_block.
4432 * @param *store The current memory
4433 * @param *idx The ir_node that represents an index.
4434 * @param *lower The ir_node that represents the lower bound for the index.
4435 * @param *upper The ir_node that represents the upper bound for the index.
4437 FIRM_DLL ir_node *new_Bound(ir_node *store, ir_node *idx, ir_node *lower,
4440 /** Constructor for a Pin node.
4442 * @param *node The node which value should be pinned.
4444 FIRM_DLL ir_node *new_Pin(ir_node *node);
4446 /** Constructor for an ASM pseudo node.
4448 * @param arity The number of data inputs to the node.
4449 * @param *in The array of length arity of data inputs.
4450 * @param *inputs The array of length arity of input constraints.
4451 * @param n_outs The number of data outputs to the node.
4452 * @param *outputs The array of length n_outs of output constraints.
4453 * @param n_clobber The number of clobbered registers.
4454 * @param *clobber The array of length n_clobber of clobbered registers.
4455 * @param *asm_text The assembler text.
4457 FIRM_DLL ir_node *new_ASM(int arity, ir_node *in[], ir_asm_constraint *inputs,
4458 int n_outs, ir_asm_constraint *outputs,
4459 int n_clobber, ident *clobber[], ident *asm_text);
4462 * @brief Constructor for a Dummy node.
4464 * @param *db debug info for the node
4465 * @param *mode The mode of the node.
4466 * @param *irg the graph to put the node into
4467 * @returns the newly created note
4469 FIRM_DLL ir_node *new_rd_Dummy(dbg_info *db, ir_graph *irg, ir_mode *mode);
4472 * @copybrief new_rd_Dummy()
4474 * @param *mode The mode of the node.
4475 * @param *irg the graph to put the node into
4476 * @returns the newly created note
4478 FIRM_DLL ir_node *new_r_Dummy(ir_graph *irg, ir_mode *mode);
4481 * @copybrief new_rd_Dummy()
4483 * @param *db debug info for the node
4484 * @param *mode The mode of the node.
4485 * @returns the newly created note
4487 FIRM_DLL ir_node *new_d_Dummy(dbg_info *db, ir_mode *mode);
4490 * @copybrief new_rd_Dummy()
4492 * @param *mode The mode of the node.
4493 * @returns the newly created note
4495 FIRM_DLL ir_node *new_Dummy(ir_mode *mode);
4497 /*---------------------------------------------------------------------*/
4498 /* The comfortable interface. */
4499 /* Supports automatic Phi node construction. */
4500 /* All routines of the block oriented interface except new_Block are */
4502 /*---------------------------------------------------------------------*/
4504 /** Create an immature Block.
4506 * An immature Block has an unknown number of predecessors. Predecessors
4507 * can be added with add_immBlock_pred(). Once all predecessors are
4508 * added the block must be matured.
4510 * Adds the block to the graph in current_ir_graph. Can be used with automatic
4511 * Phi node construction.
4512 * This constructor can only be used if the graph is in state_building.
4514 FIRM_DLL ir_node *new_d_immBlock(dbg_info *db);
4515 FIRM_DLL ir_node *new_immBlock(void);
4517 /** Create an immature PartBlock.
4519 * An immature block has only one Block or PartBlock predecessor.
4520 * A PartBlock forms together with one BLock and possibly other
4521 * PartBlocks a MacroBlock.
4523 * Adds the PartBlock to the graph in current_ir_graph. Does set
4524 * current_block. Can be used with automatic Phi node construction.
4525 * This constructor can only be used if the graph is in
4528 FIRM_DLL ir_node *new_d_immPartBlock(dbg_info *db, ir_node *pred_jmp);
4529 FIRM_DLL ir_node *new_immPartBlock(ir_node *pred_jmp);
4531 /** Add a control flow edge to an immature block. */
4532 FIRM_DLL void add_immBlock_pred(ir_node *immblock, ir_node *jmp);
4534 /** Finalize a Block node, when all control flows are known. */
4535 FIRM_DLL void mature_immBlock(ir_node *block);
4536 #define mature_cur_block() mature_immBlock(get_cur_block());
4539 /** Get the current value of a local variable.
4541 * Use this function to obtain the last definition of the local variable
4542 * associated with pos. Pos may not exceed the value passed as n_loc
4543 * to new_ir_graph. This call automatically inserts Phi nodes.
4545 * @param *db A pointer for debug information.
4546 * @param pos The position/id of the local variable.
4547 * @param *mode The mode of the value to get.
4549 FIRM_DLL ir_node *get_d_value(dbg_info *db, int pos, ir_mode *mode);
4550 FIRM_DLL ir_node *get_value(int pos, ir_mode *mode);
4552 /** Remark a new definition of a variable.
4554 * Use this function to remember a new definition of the value
4555 * associated with pos. Pos may not exceed the value passed as n_loc
4556 * to new_ir_graph. This call is needed to automatically inserts Phi
4559 * @param pos The position/id of the local variable.
4560 * @param *value The new value written to the local variable.
4562 FIRM_DLL void set_value(int pos, ir_node *value);
4565 * Find the value number for a node in the current block.
4567 * @param value the searched value
4569 * @return the value number of the value or -1 if this value has
4570 * no value number in the current block.
4572 FIRM_DLL int find_value(ir_node *value);
4574 /** Get the current memory state.
4576 * Use this function to obtain the last definition of the memory
4577 * state. This call automatically inserts Phi nodes for the memory
4580 FIRM_DLL ir_node *get_store(void);
4582 /** Remark a new definition of the memory state.
4584 * Use this function to remember a new definition of the memory state.
4585 * This call is needed to automatically inserts Phi nodes.
4587 * @param *store The new memory state.
4589 FIRM_DLL void set_store(ir_node *store);
4591 /** keep this node alive even if End is not control-reachable from it
4593 * @param ka The node to keep alive.
4595 FIRM_DLL void keep_alive(ir_node *ka);
4597 /** Returns the frame type of the current graph */
4598 FIRM_DLL ir_type *get_cur_frame_type(void);
4601 /* --- initialize and finalize IR construction --- */
4603 /** Puts the graph into state "phase_high" */
4604 #define irg_finalize_cons(irg) set_irg_phase_state(irg, phase_high)
4606 /** Puts the program and all graphs into state phase_high.
4608 * This also remarks, the construction of types is finished,
4609 * e.g., that no more subtypes will be added. */
4610 FIRM_DLL void irp_finalize_cons(void);