2 * Copyright (C) 1995-2010 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,
32 * documentation no more supported since 2001
34 * IR node construction.
36 * This file documents all datatypes and constructors needed to
37 * build a FIRM representation of a procedure. The constructors are
38 * also implemented in this file.
40 * The documentation also gives a short manual how to use the library.
42 * For extensive documentation of FIRM see UKA Techreport 1999-14.
45 * Three kinds of nodes
46 * --------------------
48 * There are three kinds of nodes known to the IR: entities,
51 * + ir_nodes are the actual nodes of the FIRM intermediate representation.
52 * They represent operations on the data of the program and control flow
55 * + entity ==> implemented in entity.h
56 * Refers to a single entity of the compiled program, e.g. a field of a
57 * class or a method. If a method or variable can not be assigned to
58 * a method or class or the like, it is a global object.
60 * + types ==> implemented in type.h
61 * With types type information is represented. There are several type
64 * Implementation of the FIRM operations: ir_node
65 * ----------------------------------------------
67 * Ir_nodes represent operations on the data of the program and control flow
68 * operations. Examples of ir_nodes: Add, Jmp, Cmp
70 * FIRM is a dataflow graph. A dataflow graph is a directed graph,
71 * so that every node has incoming and outgoing edges. A node is
72 * executable if every input at its incoming edges is available.
73 * Execution of the dataflow graph is started at the Start node which
74 * has no incoming edges and ends when the End node executes, even if
75 * there are still executable or not executed nodes. (Is this true,
76 * or must all executable nodes be executed?) (There are exceptions
77 * to the dataflow paradigma that all inputs have to be available
78 * before a node can execute: Phi, Block. See UKA Techreport
81 * The implementation of FIRM differs from the view as a dataflow
82 * graph. To allow fast traversion of the graph edges are
83 * implemented as C-pointers. Inputs to nodes are not ambiguous, the
84 * results can be used by several other nodes. Each input can be
85 * implemented as a single pointer to a predecessor node, outputs
86 * need to be lists of pointers to successors. Therefore a node
87 * contains pointers to its predecessors so that the implementation is a
88 * dataflow graph with reversed edges. It has to be traversed bottom
91 * All nodes of the IR have the same basic structure. They are
92 * distinguished by a field containing the opcode.
94 * The fields of an ir_node:
96 * kind A firm_kind tag containing k_ir_node. This is useful for
97 * dynamically checking the type of a node.
99 * *op This ir_op gives the opcode as a tag and a string
100 * and the number of attributes of an ir_node. There is
101 * one statically allocated struct ir_op for each opcode.
103 * *mode The ir_mode of the operation represented by this firm
104 * node. The mode of the operation is the mode of its
105 * result. A Firm mode is a datatype as known to the
106 * target, not a type of the source language.
108 * visit A flag for traversing the IR.
110 * **in An array with pointers to the node's predecessors.
112 * *link A pointer to an ir_node. With this pointer all Phi nodes
113 * are attached to a Block, i.e. a Block points to its
114 * first Phi node, this node points to the second Phi node
115 * in the Block and so forth. Used in mature_immBlock
116 * to find all Phi nodes to be matured. It's also used to
117 * annotate a node with a better, optimized version of it.
119 * attr An attr struct containing the attributes of the nodes. The
120 * attributes depend on the opcode of the node. The number
121 * of these attributes is given in op.
125 * Not yet documented. See irop.h.
129 * Not yet documented. See irmode.h.
131 * GLOBAL VARIABLES -- now also fields of ir_graph.
134 * current_ir_graph Points to the current ir_graph. All constructors for
135 * nodes add nodes to this graph.
137 * ir_visited An int used as flag to traverse the ir_graph.
139 * block_visited An int used as a flag to traverse block nodes in the
142 * Others not yet documented.
146 * CONSTRUCTOR FOR IR_GRAPH --> see irgraph.h
147 * ========================
150 * PROCEDURE TO CONSTRUCT AN IR GRAPH --> see also Firm tutorial
151 * ==================================
153 * This library supplies several interfaces to construct a FIRM graph for
155 * - A "comfortable" interface generating SSA automatically. Automatically
156 * computed predecessors of nodes need not be specified in the constructors.
157 * (new_<Node> constructurs and a set of additional routines.)
158 * - A less comfortable interface where all predecessors except the block
159 * an operation belongs to need to be specified. SSA must be constructed
160 * by hand. (new_<Node> constructors and set_cur_block()). This interface
161 * is called "block oriented". It automatically calles the local optimizations
163 * - An even less comfortable interface where the block needs to be specified
164 * explicitly. This is called the "raw" interface. (new_r_<Node>
165 * constructors). These nodes are not optimized.
167 * To use the functionality of the comfortable interface correctly the Front
168 * End needs to follow certain protocols. This is explained in the following.
169 * To build a correct IR with the other interfaces study the semantics of
170 * the firm node (See tech-reprot UKA 1999-14). For the construction of
171 * types and entities see the documentation in those modules.
173 * First the Frontend needs to decide which variables and values used in
174 * a procedure can be represented by dataflow edges. These are variables
175 * that need not be saved to memory as they cause no side effects visible
176 * out of the procedure. Often these are all compiler generated
177 * variables and simple local variables of the procedure as integers,
178 * reals and pointers. The frontend has to count and number these variables.
180 * First an ir_graph needs to be constructed with new_ir_graph. The
181 * constructor gets the number of local variables. The graph is held in the
182 * global variable irg.
184 * Now the construction of the procedure can start. Several basic blocks can
185 * be constructed in parallel, but the code within each block needs to
186 * be constructed (almost) in program order.
188 * A global variable holds the current basic block. All (non block) nodes
189 * generated are added to this block. The current block can be set with
190 * set_cur_block(block). If several blocks are constructed in parallel block
191 * switches need to be performed constantly.
193 * To generate a Block node (with the comfortable interface), its predecessor
194 * control flow nodes need not be known. In case of cyclic control flow these
195 * can not be known when the block is constructed. With add_immBlock_pred(block,
196 * cfnode) predecessors can be added to the block. If all predecessors are
197 * added to the block mature_immBlock(b) needs to be called. Calling mature_immBlock
198 * early improves the efficiency of the Phi node construction algorithm.
199 * But if several blocks are constructed at once, mature_immBlock must only
200 * be called after performing all set_values and set_stores in the block!
201 * (See documentation of new_immBlock constructor.)
203 * The constructors of arithmetic nodes require that their predecessors
204 * are mentioned. Sometimes these are available in the Frontend as the
205 * predecessors have just been generated by the frontend. If they are local
206 * values, the predecessors can be obtained from the library with a call to
207 * get_value(local_val_nr). (local_val_nr needs to be administered by
208 * the Frontend.) A call to get_value triggers the generation of Phi nodes.
209 * If an arithmetic operation produces a local value, this value needs to be
210 * passed to the library by set_value(node, local_val_nr).
211 * In straight line code these two operations just remember and return the
212 * pointer to nodes producing the value. If the value passes block boundaries
213 * Phi nodes can be inserted.
214 * Similar routines exist to manage the Memory operands: set_store and
217 * Several nodes produce more than one result. An example is the Div node.
218 * Such nodes return tuples of values. From these individual values can be
219 * extracted by proj nodes.
221 * The following example illustrates the construction of a simple basic block
222 * with two predecessors stored in variables cf_pred1 and cf_pred2, containing
225 * and finally jumping to an other block. The variable a got the local_val_nr
226 * 42 by the frontend.
228 * ir_node *this_block, *cf_pred1, *cf_pred2, *a_val, *mem, *div, *res, *cf_op;
230 * this_block = new_immBlock();
231 * add_immBlock_pred(this_block, cf_pred1);
232 * add_immBlock_pred(this_block, cf_pred2);
233 * mature_immBlock(this_block);
234 * a_val = get_value(42, mode_Iu);
236 * div = new_Div(mem, a_val, a_val, mode_Iu);
237 * mem = new_Proj(div, mode_M, pn_Div_M); * for the numbers for Proj see docu *
238 * res = new_Proj(div, mode_Iu, pn_Div_res);
240 * set_value(res, 42);
243 * For further information look at the documentation of the nodes and
244 * constructors and at the paragraph COPING WITH DATA OBJECTS at the
245 * end of this documentation.
247 * The comfortable interface contains the following routines further explained
250 * ir_node *new_immBlock (void);
251 * ir_node *new_Start (void);
252 * ir_node *new_End (void);
253 * ir_node *new_Jmp (void);
254 * ir_node *new_IJmp (ir_node *tgt);
255 * ir_node *new_Cond (ir_node *c);
256 * ir_node *new_Return (ir_node *store, int arity, ir_node **in);
257 * ir_node *new_Const (ir_tarval *con);
258 * ir_node *new_SymConst (ir_mode *mode, symconst_symbol value, symconst_kind kind);
259 * ir_node *new_simpleSel (ir_node *store, ir_node *objptr, ir_entity *ent);
260 * ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity,
261 * ir_node **in, ir_entity *ent);
262 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity,
263 * ir_node **in, type_method *type);
264 * ir_node *new_Builtin(ir_node *store, ir_builtin_kind kind, int arity,
265 * ir_node **in, type_method *type);
266 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
267 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
268 * ir_node *new_Minus (ir_node *op, ir_mode *mode);
269 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
270 * ir_node *new_Mulh (ir_node *op1, ir_node *op2, ir_mode *mode);
271 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
272 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
273 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
274 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state;
275 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
276 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
277 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
278 * ir_node *new_Not (ir_node *op, ir_mode *mode);
279 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
280 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
281 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
282 * ir_node *new_Rotl (ir_node *op, ir_node *k, ir_mode *mode);
283 * ir_node *new_Cmp (ir_node *op1, ir_node *op2);
284 * ir_node *new_Conv (ir_node *op, ir_mode *mode);
285 * ir_node *new_Cast (ir_node *op, ir_type *to_tp);
286 * ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode);
287 * ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode);
288 * ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode, ir_cons_flags flags);
289 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val, ir_cons_flags flags);
290 * ir_node *new_Alloc (ir_node *store, ir_node *count, ir_type *alloc_type,
291 * where_alloc where);
292 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
293 * ir_type *free_type, where_alloc where);
294 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
295 * ir_node *new_NoMem (void);
296 * ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
297 * ir_node *new_CopyB (ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
298 * ir_node *new_InstOf (ir_node *store, ir_node obj, ir_type *ent);
299 * ir_node *new_Raise (ir_node *store, ir_node *obj);
300 * ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
301 * ir_node *new_Pin (ir_node *node);
303 * void add_immBlock_pred (ir_node *block, ir_node *jmp);
304 * void mature_immBlock (ir_node *block);
305 * void set_cur_block (ir_node *target);
306 * ir_node *get_value (int pos, ir_mode *mode);
307 * void set_value (int pos, ir_node *value);
308 * ir_node *get_store (void);
309 * void set_store (ir_node *store);
310 * keep_alive (ir_node ka)
312 * IR_NODES AND CONSTRUCTORS FOR IR_NODES
313 * =======================================
315 * All ir_nodes are defined by a common data structure. They are distinguished
316 * by their opcode and differ in the number of their attributes.
318 * Const nodes are always added to the start block.
319 * All other constructors add the created node to the current_block.
320 * swich_block(block) allows to set the current block to block.
322 * Watch for my inconsistent use of input and predecessor (dataflow view)
323 * and `the node points to' (implementation view).
325 * The following description of the nodes lists four properties them if these
327 * - the parameters to the constructor
328 * - the inputs of the Firm node
329 * - the outputs of the Firm node
330 * - attributes to the node
334 * ir_node *new_immBlock (void)
335 * ----------------------------
337 * Creates a new block. When a new block is created it cannot be known how
338 * many predecessors this block will have in the control flow graph.
339 * Therefore the list of inputs can not be fixed at creation. Predecessors
340 * can be added with add_immBlock_pred (block, control flow operation).
341 * With every added predecessor the number of inputs to Phi nodes also
344 * The block can be completed by mature_immBlock(block) if all predecessors are
345 * known. If several blocks are built at once, mature_immBlock can only be called
346 * after set_value has been called for all values that are life at the end
347 * of the block. This is necessary so that Phi nodes created mature_immBlock
348 * get the right predecessors in case of cyclic dependencies. If all set_values
349 * of this block are called after maturing it and before calling get_value
350 * in some block that is control flow dependent on this block, the construction
353 * Example for faulty IR construction: (draw the graph on a paper and you'll
356 * block_before_loop = new_immBlock();
357 * set_cur_block(block_before_loop);
359 * mature_immBlock(block_before_loop);
360 * before2header = new_Jmp;
362 * loop_header = new_immBlock ();
363 * set_cur_block(loop_header);
364 * header2body - new_Jmp();
366 * loop_body = new_immBlock ();
367 * set_cur_block(loop_body);
368 * body2header = new_Jmp();
370 * add_immBlock_pred(loop_header, before2header);
371 * add_immBlock_pred(loop_header, body2header);
372 * add_immBlock_pred(loop_body, header2body);
374 * mature_immBlock(loop_header);
375 * mature_immBlock(loop_body);
377 * get_value(loop_body, x); // gets the Phi in loop_header
378 * set_value(loop_header, x); // sets the value the above get_value should
379 * // have returned!!!
381 * Mature_immBlock also fixes the number of inputs to the Phi nodes. Mature_immBlock
382 * should be called as early as possible, as afterwards the generation of Phi
383 * nodes is more efficient.
386 * There is an input for each control flow predecessor of the block.
387 * The input points to an instruction producing an output of type X.
388 * Possible predecessors: Start, Jmp, Cond, Raise or Return or any node
389 * possibly causing an exception. (Often the real predecessors are Projs.)
391 * Mode BB (R), all nodes belonging to this block should consume this output.
392 * As they are strict (except Block and Phi node) it is a necessary condition
393 * that the block node executed before any other node in this block executes.
395 * block.matured Indicates whether the block is mature.
397 * This attribute contains all local values valid in this
398 * block. This is needed to build the Phi nodes and removed
399 * if the graph is complete. This field is used by the
400 * internal construction algorithm and should not be accessed
404 * ir_node *new_Block (int arity, ir_node **in)
405 * --------------------------------------------
407 * Creates a new Block with the given list of predecessors. This block
408 * is mature. As other constructors calls optimization and verify for the
409 * block. If one of the predecessors is Unknown (as it has to be filled in
410 * later) optimizations are skipped. This is necessary to
411 * construct Blocks in loops.
414 * CONTROL FLOW OPERATIONS
415 * -----------------------
417 * In each block there must be exactly one of the control flow
418 * operations Start, End, Jmp, Cond, Return or Raise. The output of a
419 * control flow operation points to the block to be executed next.
421 * ir_node *new_Start (void)
422 * -------------------------
424 * Creates a start node. Not actually needed public. There is only one such
425 * node in each procedure which is automatically created by new_ir_graph.
428 * No inputs except the block it belongs to.
430 * A tuple of 4 (5, 6) distinct values. These are labeled by the following
431 * projection numbers (pn_Start):
432 * * pn_Start_X_initial_exec mode X, points to the first block to be exe * cuted.
433 * * pn_Start_M mode M, the global store
434 * * pn_Start_P_frame_base mode P, a pointer to the base of the proce * dures stack frame.
435 * * pn_Start_P_globals mode P, a pointer to the part of the memory * containing_all_ global things.
436 * * pn_Start_T_args mode T, a tuple containing all arguments of * the procedure.
439 * ir_node *new_End (void)
440 * -----------------------
442 * Creates an end node. Not actually needed public. There is only one such
443 * node in each procedure which is automatically created by new_ir_graph.
446 * No inputs except the block it belongs to.
450 * ir_node *new_Jmp (void)
451 * -----------------------
453 * Creates a Jmp node.
456 * The block the node belongs to
458 * Control flow to the next block.
460 * ir_node *new_IJmp (ir_node *tgt)
461 * -----------------------
463 * Creates an IJmp node.
466 * The node that represents the target jump address
468 * Control flow to an unknown target, must be pinned by
471 * ir_node *new_Cond (ir_node *c)
472 * ------------------------------
474 * Creates a Cond node. There are two versions of this node.
480 * A tuple of two control flows. The first is taken if the input is
481 * false, the second if it is true.
485 * A value of mode I_u. (i)
487 * A tuple of n control flows. If the Cond's input is i, control
488 * flow will proceed along output i. If the input is >= n control
489 * flow proceeds along output n.
491 * ir_node *new_Return (ir_node *store, int arity, ir_node **in)
492 * -------------------------------------------------------------
494 * The Return node has as inputs the results of the procedure. It
495 * passes the control flow to the end_block.
501 * Control flow to the end block.
504 * ir_node *new_Const (ir_tarval *con)
505 * -----------------------------------------------
507 * Creates a constant in the constant table and adds a Const node
508 * returning this value to the start block. The mode is derived
512 * *con Points to an entry in the constant table.
513 * This pointer is added to the attributes of
514 * the node (self->attr.con)
516 * No inputs except the block it belogns to.
518 * The constant value.
520 * attr.con A tarval* pointer to the proper entry in the constant
523 * ir_node *new_SymConst (ir_mode *mode, union symconst_symbol value, symconst_addr_ent kind)
524 * -----------------------------------------------------------------------------------------
526 * There are several symbolic constants:
527 * symconst_type_tag The symbolic constant represents a type tag.
528 * symconst_type_size The symbolic constant represents the size of a type.
529 * symconst_type_align The symbolic constant represents the alignment of a type.
530 * symconst_addr_ent The symbolic constant represents the address of an entity.
531 * symconst_ofs_ent The symbolic constant represents the offset of an
532 * entity in its owner type.
533 * symconst_enum_const The symbolic constant is a enumeration constant of an
537 * mode P for SymConsts representing addresses, Iu otherwise.
538 * value The type, ident, entity or enum constant, depending on the
540 * kind The kind of the symbolic constant, see the list above.
543 * No inputs except the block it belongs to.
545 * A symbolic constant.
548 * attr.i.num The symconst_addr_ent, i.e. one of
550 * -symconst_type_size
551 * -symconst_type_align
554 * If the attr.i.num is symconst_type_tag, symconst_type_size or symconst_type_align,
555 * the node contains an attribute:
557 * attr.i.*type, a pointer to a type_class.
558 * if it is linkage_ptr_info it contains
559 * attr.i.*ptrinfo, an ident holding information for the linker.
563 * ir_node *new_simpleSel (ir_node *store, ir_node *frame, ir_entity *sel)
564 * -----------------------------------------------------------------------
567 * Selects an entity from a compound type. This entity can be a field or
571 * *store The memory in which the object the entity should be selected
573 * *frame The pointer to the object.
574 * *sel The entity to select.
577 * The memory containing the object.
578 * A pointer to the object.
579 * An unsigned integer.
581 * A pointer to the selected entity.
583 * attr.sel Pointer to the entity
586 * ir_node *new_Sel (ir_node *store, ir_node *frame, int arity, ir_node **in,
587 * --------------------------------------------------------------------------
591 * Selects a field from an array type. The entity has as owner the array, as
592 * type the arrays element type. The indices to access an array element are
596 * *store The memory in which the object the entity should be selected from
598 * *frame The pointer to the object.
599 * *arity number of array indices.
600 * *in array with index inputs to the node.
601 * *sel The entity to select.
604 * The memory containing the object.
605 * A pointer to the object.
606 * As much unsigned integer as there are array expressions.
608 * A pointer to the selected entity.
610 * attr.sel Pointer to the entity
612 * The constructors new_Sel and new_simpleSel generate the same IR nodes.
613 * simpleSel just sets the arity of the index inputs to zero.
616 * ARITHMETIC OPERATIONS
617 * ---------------------
619 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node **in,
620 * ----------------------------------------------------------------------------
624 * Creates a procedure call.
627 * *store The actual store.
628 * *callee A pointer to the called procedure.
629 * arity The number of procedure parameters.
630 * **in An array with the pointers to the parameters.
631 * The constructor copies this array.
632 * *type Type information of the procedure called.
635 * The store, the callee and the parameters.
637 * A tuple containing the eventually changed store and the procedure
640 * attr.call Contains the attributes for the procedure.
642 * ir_node *new_Builtin(ir_node *store, ir_builtin_kind kind, int arity, ir_node **in,
643 * -----------------------------------------------------------------------------------
647 * Creates a builtin call.
650 * *store The actual store.
651 * kind Describes the called builtin.
652 * arity The number of procedure parameters.
653 * **in An array with the pointers to the parameters.
654 * The constructor copies this array.
655 * *type Type information of the procedure called.
658 * The store, the kind and the parameters.
660 * A tuple containing the eventually changed store and the procedure
663 * attr.builtin Contains the attributes for the called builtin.
665 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode)
666 * ------------------------------------------------------------
670 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode)
671 * ------------------------------------------------------------
675 * ir_node *new_Minus (ir_node *op, ir_mode *mode)
676 * -----------------------------------------------
678 * Unary Minus operations on integer and floating point values.
680 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode)
681 * ------------------------------------------------------------
685 * ir_node *new_Mulh (ir_node *op1, ir_node *op2, ir_mode *mode)
686 * ------------------------------------------------------------
688 * Returns the high order bits of a n*n=2n multiplication.
690 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state)
691 * -------------------------------------------------------------------------------------------------
693 * Quot performs exact division of floating point numbers. It's mode
694 * is Tuple, the mode of the result must match the Proj mode
695 * that extracts the result of the arithmetic operations.
698 * The store needed to model exceptions and the two operands.
700 * A tuple containing a memory and a execution for modeling exceptions
701 * and the result of the arithmetic operation.
703 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state)
704 * ---------------------------------------------------------------------------------------------------
706 * Performs Div and Mod on integer values.
709 * A tuple containing a memory and a execution for modeling exceptions
710 * and the two result of the arithmetic operations.
712 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state)
713 * ------------------------------------------------------------------------------------------------
717 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state)
718 * ------------------------------------------------------------------------------------------------
722 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode)
723 * ------------------------------------------------------------
727 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode)
728 * -----------------------------------------------------------
732 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode)
733 * ------------------------------------------------------------
737 * ir_node *new_Not (ir_node *op, ir_mode *mode)
738 * ---------------------------------------------
740 * This node constructs a constant where all bits are set to one
741 * and a Eor of this constant and the operator. This simulates a
744 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode)
745 * ---------------------------------------------------------
749 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode)
750 * ---------------------------------------------------------
752 * Logic shift right, i.e., zero extended.
755 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode)
756 * ----------------------------------------------------------
758 * Arithmetic shift right, i.e., sign extended.
760 * ir_node *new_Rotl (ir_node *op, ir_node *k, ir_mode *mode)
761 * ---------------------------------------------------------
763 * Rotates the operand to the left by k bits.
765 * ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode)
766 * ------------------------------------------------------------
768 * Calculates the Carry value for integer addition. Used only
771 * ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode)
772 * ------------------------------------------------------------
774 * Calculates the Borrow value for integer substraction. Used only
777 * ir_node *new_Conv (ir_node *op, ir_mode *mode)
778 * ---------------------------------------------
780 * Mode conversion. For allowed conversions see UKA Tech Report
783 * ir_node *new_Cmp (ir_node *op1, ir_node *op2)
784 * ---------------------------------------------
787 * The two values to be compared.
789 * A 16-tuple containing the results of the 16 different comparisons.
790 * The following is a list giving the comparisons and a projection
791 * number (pn_Cmp) to use in Proj nodes to extract the proper result.
795 * pn_Cmp_Le less or equal
797 * pn_Cmp_Ge greater of equal
798 * pn_Cmp_Lg less or greater
799 * pn_Cmp_Leg less, equal or greater = ordered
800 * pn_Cmp_Uo unordered
801 * pn_Cmp_Ue unordered or equal
802 * pn_Cmp_Ul unordered or less
803 * pn_Cmp_Ule unordered, less or equal
804 * pn_Cmp_Ug unordered or greater
805 * pn_Cmp_Uge unordered, greater or equal
806 * pn_Cmp_Ne unordered, less or greater = not equal
813 * In general, Phi nodes are automaitcally inserted. In some cases, if
814 * all predecessors of a block are known, an explicit Phi node constructor
815 * is needed. E.g., to construct a FIRM graph for a statement as
816 * a = (b==c) ? 2 : 5;
818 * ir_node *new_Phi (int arity, ir_node **in, ir_mode *mode)
819 * ---------------------------------------------------------
821 * Creates a Phi node. The in's order has to correspond to the order
822 * of in's of current_block. This is not checked by the library!
823 * If one of the predecessors is Unknown (as it has to be filled in
824 * later) optimizations are skipped. This is necessary to
825 * construct Phi nodes in loops.
828 * arity number of predecessors
829 * **in array with predecessors
830 * *mode The mode of it's inputs and output.
832 * A Phi node has as many inputs as the block it belongs to.
833 * Each input points to a definition of the same value on a
834 * different path in the control flow.
836 * The definition valid in this block.
838 * ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode)
839 * -----------------------------------------------------------------------------------
841 * Creates a Mux node. This node implements the following semantic:
842 * If the sel node (which must be of mode_b) evaluates to true, its value is
843 * ir_true, else ir_false;
847 * OPERATIONS TO MANAGE MEMORY EXPLICITLY
848 * --------------------------------------
850 * ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode, ir_cons_flags flags)
851 * -------------------------------------------------------------------------------------
853 * The Load operation reads a value from memory.
856 * *store The current memory.
857 * *addr A pointer to the variable to be read in this memory.
858 * *mode The mode of the value to be loaded.
859 * flags Additional flags for alignment, volatility and pin state.
862 * The memory and a pointer to a variable in this memory.
864 * A tuple of the memory, a control flow to be taken in case of
865 * an exception and the loaded value.
867 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val, ir_cons_flags flags)
868 * -------------------------------------------------------------------------------------
870 * The Store operation writes a value to a variable in memory.
873 * The memory, a pointer to a variable in this memory and the value
874 * to write to this variable.
876 * A tuple of the changed memory and a control flow to be taken in
877 * case of an exception.
879 * ir_node *new_Alloc (ir_node *store, ir_node *count, ir_type *alloc_type,
880 * -----------------------------------------------------------------------
884 * The Alloc node allocates a new variable. It can be specified whether the
885 * variable should be allocated to the stack or to the heap.
888 * *store The memory which shall contain the new variable.
889 * *count This field is for allocating arrays, it specifies how
890 * many array elements are to be allocated.
891 * *alloc_type The type of the allocated variable. In case of allocating
892 * arrays this has to be the array type, not the type of the
894 * where Where to allocate the variable, either heap_alloc or stack_alloc.
897 * A memory and an unsigned integer.
899 * A tuple of the changed memory, a control flow to be taken in
900 * case of an exception and the pointer to the new variable.
902 * a.where Indicates where the variable is allocated.
903 * a.*type A pointer to the class the allocated data object
906 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size, ir_type *free_type,
907 * -----------------------------------------------------------------------------------
911 * The Free node frees memory of the given variable.
914 * *store The memory which shall contain the new variable.
915 * *ptr The pointer to the object to free.
916 * *size The number of objects of type free_type to free in a sequence.
917 * *free_type The type of the freed variable.
918 * where Where the variable was allocated, either heap_alloc or stack_alloc.
921 * A memory, a pointer and an unsigned integer.
923 * The changed memory.
925 * f.*type A pointer to the type information of the freed data object.
929 * ir_node *new_Sync (int arity, ir_node **in)
930 * -------------------------------------------
932 * The Sync operation unifies several partial memory blocks. These blocks
933 * have to be pairwise disjunct or the values in common locations have to
934 * be identical. This operation allows to specify all operations that eventually
935 * need several partial memory blocks as input with a single entrance by
936 * unifying the memories with a preceding Sync operation.
939 * arity The number of memories to synchronize.
940 * **in An array of pointers to nodes that produce an output of
945 * The unified memory.
951 * ir_node *new_Bad (void)
952 * -----------------------
954 * Returns the unique Bad node current_ir_graph->bad.
955 * This node is used to express results of dead code elimination.
957 * ir_node *new_NoMem (void)
958 * -----------------------------------------------------------------------------------
960 * Returns the unique NoMem node current_ir_graph->no_mem.
961 * This node is used as input for operations that need a Memory, but do not
962 * change it like Div by const != 0, analyzed calls etc.
964 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj)
965 * ----------------------------------------------------------
967 * Selects one entry of a tuple. This is a hidden edge with attributes.
970 * *arg A node producing a tuple.
971 * *mode The mode of the value to project.
972 * proj The position of the value in the tuple.
978 * ir_node *new_Tuple (int arity, ir_node **in)
979 * --------------------------------------------
981 * Builds a Tuple from single values. This is needed to implement
982 * optimizations that remove a node that produced a tuple. The node can be
983 * replaced by the Tuple operation so that the following Proj nodes have not to
984 * be changed. (They are hard to find due to the implementation with pointers
985 * in only one direction.) The Tuple node is smaller than any other
986 * node, so that a node can be changed into a Tuple by just changing it's
987 * opcode and giving it a new in array.
990 * arity The number of tuple elements.
991 * **in An array containing pointers to the nodes producing the
994 * ir_node *new_Id (ir_node *val, ir_mode *mode)
995 * ---------------------------------------------
997 * The single output of the Id operation is it's input. Also needed
1001 * HIGH LEVEL OPERATIONS
1002 * ---------------------
1004 * ir_node *new_CopyB (ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type)
1005 * -----------------------------------------------------------------------------------
1007 * Describes a high level block copy of a compound type from address src to
1008 * address dst. Must be lowered to a Call to a runtime memory copy function.
1011 * HIGH LEVEL OPERATIONS: Exception Support
1012 * ----------------------------------------
1013 * See TechReport 1999-14, chapter Exceptions.
1015 * ir_node *new_InstOf(ir_node *store, ir_node *ptr, ir_type *type);
1016 * -----------------------------------------------------------------------------------
1018 * Describes a high level type check. Must be lowered to a Call to a runtime check
1021 * ir_node *new_Raise (ir_node *store, ir_node *obj)
1022 * -------------------------------------------------
1024 * Raises an exception. Unconditional change of control flow. Writes
1025 * an explicit Except variable to memory to pass it to the exception
1026 * handler. Must be lowered to a Call to a runtime check
1031 * A pointer to the Except variable.
1033 * A tuple of control flow and the changed memory state. The control flow
1034 * points to the exception handler if it is definied in this procedure,
1035 * else it points to the end_block.
1037 * ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
1038 * -----------------------------------------------------------------------------------
1040 * Describes a high level bounds check. Must be lowered to a Call to a runtime check
1043 * ir_node *new_Pin (ir_node *node);
1044 * -----------------------------------------------------------------------------------
1046 * Pin the value of the node node in the current block No users of the Pin node can
1047 * float above the Block of the Pin. The node cannot float behind this block. Often
1048 * used to Pin the NoMem node.
1051 * COPING WITH DATA OBJECTS
1052 * ========================
1054 * Two kinds of data objects have to be distinguished for generating
1055 * FIRM. First there are local variables other than arrays that are
1056 * known to be alias free. Second there are all other data objects.
1057 * For the first a common SSA representation is built, the second
1058 * are modeled by saving them to memory. The memory is treated as
1059 * a single local variable, the alias problem is hidden in the
1060 * content of this variable.
1062 * All values known in a Block are listed in the block's attribute,
1063 * block.**graph_arr which is used to automatically insert Phi nodes.
1064 * The following two functions can be used to add a newly computed value
1065 * to the array, or to get the producer of a value, i.e., the current
1068 * inline void set_value (int pos, ir_node *value)
1069 * -----------------------------------------------
1071 * Has to be called for every assignment to a local variable. It
1072 * adds the value to the array of used values at position pos. Pos
1073 * has to be a unique identifier for an entry in the procedure's
1074 * definition table. It can be used to access the value again.
1075 * Requires current_block to be set correctly.
1077 * ir_node *get_value (int pos, ir_mode *mode)
1078 * -------------------------------------------
1080 * Returns the node defining the value referred to by pos. If the
1081 * value is not defined in this block a Phi node is generated and
1082 * all definitions reaching this Phi node are collected. It can
1083 * happen that the algorithm allocates an unnecessary Phi node,
1084 * e.g. if there is only one definition of this value, but this
1085 * definition reaches the currend block on several different
1086 * paths. This Phi node will be eliminated if optimizations are
1087 * turned on right after it's creation.
1088 * Requires current_block to be set correctly.
1090 * There are two special routines for the global store:
1092 * void set_store (ir_node *store)
1093 * -------------------------------
1095 * Adds the store to the array of known values at a reserved
1097 * Requires current_block to be set correctly.
1099 * ir_node *get_store (void)
1100 * -------------------------
1102 * Returns the node defining the actual store.
1103 * Requires current_block to be set correctly.
1106 * inline void keep_alive (ir_node *ka)
1107 * ------------------------------------
1109 * Keep this node alive because it is (might be) not in the control
1110 * flow from Start to End. Adds the node to the list in the end
1114 #ifndef FIRM_IR_IRCONS_H
1115 #define FIRM_IR_IRCONS_H
1117 #include "firm_types.h"
1122 * constrained flags for memory operations.
1124 typedef enum ir_cons_flags {
1125 cons_none = 0, /**< No constrains. */
1126 cons_volatile = 1U << 0, /**< Memory operation is volatile. */
1127 cons_unaligned = 1U << 1, /**< Memory operation is unaligned. */
1128 cons_floats = 1U << 2 /**< Memory operation can float. */
1131 /*-------------------------------------------------------------------------*/
1132 /* The raw interface */
1133 /*-------------------------------------------------------------------------*/
1135 /** Constructor for a Block node.
1137 * Constructs a mature block with the given predecessors.
1139 * @param *db A Pointer for debug information.
1140 * @param irg The IR graph the block belongs to.
1141 * @param arity The number of control predecessors.
1142 * @param in[] An array of control predecessors. The length of
1143 * the array must be 'arity'. The constructor copies this array.
1145 FIRM_API ir_node *new_rd_Block(dbg_info *db, ir_graph *irg, int arity, ir_node *in[]);
1147 /** Constructor for a Start node.
1149 * @param *db A pointer for debug information.
1150 * @param *irg The IR graph the node belongs to.
1152 FIRM_API ir_node *new_rd_Start(dbg_info *db, ir_graph *irg);
1154 /** Constructor for a End node.
1156 * @param *db A pointer for debug information.
1157 * @param *irg The IR graph the node belongs to.
1159 FIRM_API ir_node *new_rd_End(dbg_info *db, ir_graph *irg, int arity, ir_node *in[]);
1161 /** Constructor for a Jmp node.
1163 * Jmp represents control flow to a single control successor.
1165 * @param *db A pointer for debug information.
1166 * @param *block The IR block the node belongs to.
1168 FIRM_API ir_node *new_rd_Jmp(dbg_info *db, ir_node *block);
1170 /** Constructor for an IJmp node.
1172 * IJmp represents control flow to a single control successor not
1173 * statically known i.e. an indirect Jmp.
1175 * @param *db A pointer for debug information.
1176 * @param *block The IR block the node belongs to.
1177 * @param *tgt The IR node representing the target address.
1179 FIRM_API ir_node *new_rd_IJmp(dbg_info *db, ir_node *block, ir_node *tgt);
1181 /** Constructor for a Cond node.
1183 * If c is mode_b represents a conditional branch (if/else). If c is
1184 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
1185 * node, default Proj is 0.)
1187 * This is not consistent: Input to Cond is Is, Proj has as proj number
1190 * @param *db A pointer for debug information.
1191 * @param *block The IR block the node belongs to.
1192 * @param *c The conditions parameter. Can be of mode b or I_u.
1194 FIRM_API ir_node *new_rd_Cond(dbg_info *db, ir_node *block, ir_node *c);
1196 /** Constructor for a Return node.
1198 * Returns the memory and zero or more return values. Only node that
1199 * can end regular control flow.
1201 * @param *db A pointer for debug information.
1202 * @param *block The IR block the node belongs to.
1203 * @param *store The state of memory.
1204 * @param arity Number of return values.
1205 * @param *in Array of length arity with return values. The constructor copies this array.
1207 FIRM_API ir_node *new_rd_Return(dbg_info *db, ir_node *block,
1208 ir_node *store, int arity, ir_node *in[]);
1210 /** Constructor for a Const node.
1212 * Adds the node to the start block.
1214 * Constructor for a Const node. The constant represents a target
1215 * value. Sets the type information to type_unknown. (No more
1216 * supported: If tv is entity derives a somehow useful type.)
1217 * Derives mode from passed tarval.
1219 * @param *db A pointer for debug information.
1220 * @param *irg The IR graph the node belongs to.
1221 * @param *con Points to an entry in the constant table.
1223 FIRM_API ir_node *new_rd_Const(dbg_info *db, ir_graph *irg, ir_tarval *con);
1226 * Constructor for a Const node.
1228 * Adds the node to the start block.
1230 * Constructor for a Const node. The constant represents a target
1231 * value. Sets the type information to type_unknown. (No more
1232 * supported: If tv is entity derives a somehow useful type.)
1234 * @param *db A pointer for debug information.
1235 * @param *irg The IR graph the node belongs to.
1236 * @param *mode The mode of the operands and results.
1237 * @param value A value from which the tarval is made.
1239 FIRM_API ir_node *new_rd_Const_long(dbg_info *db, ir_graph *irg,
1240 ir_mode *mode, long value);
1242 /** Constructor for a SymConst node.
1244 * This is the constructor for a symbolic constant.
1245 * There are several kinds of symbolic constants:
1246 * - symconst_type_tag The symbolic constant represents a type tag. The
1247 * type the tag stands for is given explicitly.
1248 * - symconst_type_size The symbolic constant represents the size of a type.
1249 * The type of which the constant represents the size
1250 * is given explicitly.
1251 * - symconst_type_align The symbolic constant represents the alignment of a
1252 * type. The type of which the constant represents the
1253 * size is given explicitly.
1254 * - symconst_addr_ent The symbolic constant represents the address of an
1255 * entity (variable or method). The variable is given
1256 * explicitly by a firm entity.
1257 * - symconst_ofs_ent The symbolic constant represents the offset of an
1258 * entity in its owner type.
1259 * - symconst_enum_const The symbolic constant is a enumeration constant of
1260 * an enumeration type.
1262 * Inputs to the node:
1263 * No inputs except the block it belongs to.
1264 * Outputs of the node.
1265 * An unsigned integer (I_u) or a pointer (P).
1267 * Mention union in declaration so that the firmjni generator recognizes that
1268 * it can not cast the argument to an int.
1270 * @param *db A pointer for debug information.
1271 * @param *irg The IR graph the node belongs to.
1272 * @param mode The mode for the SymConst.
1273 * @param val A type, ident, entity or enum constant depending on the
1275 * @param kind The kind of the symbolic constant, see the list above
1277 FIRM_API ir_node *new_rd_SymConst(dbg_info *db, ir_graph *irg, ir_mode *mode,
1278 union symconst_symbol value,
1279 symconst_kind kind);
1281 /** Constructor for a SymConst addr_ent node.
1283 * Same as new_rd_SymConst, except that the constructor is tailored for
1284 * symconst_addr_ent.
1285 * Adds the SymConst to the start block of irg. */
1286 FIRM_API ir_node *new_rd_SymConst_addr_ent(dbg_info *db, ir_graph *irg,
1287 ir_mode *mode, ir_entity *symbol);
1289 /** Constructor for a SymConst ofs_ent node.
1291 * Same as new_rd_SymConst, except that the constructor is tailored for
1293 * Adds the SymConst to the start block of irg.
1295 FIRM_API ir_node *new_rd_SymConst_ofs_ent(dbg_info *db, ir_graph *irg,
1296 ir_mode *mode, ir_entity *symbol);
1298 /** Constructor for a SymConst type_tag node.
1300 * Same as new_rd_SymConst, except that the constructor is tailored for
1301 * symconst_type_tag.
1302 * Adds the SymConst to the start block of irg.
1304 FIRM_API ir_node *new_rd_SymConst_type_tag(dbg_info *db, ir_graph *irg,
1305 ir_mode *mode, ir_type *symbol);
1307 /** Constructor for a SymConst size node.
1309 * Same as new_rd_SymConst, except that the constructor is tailored for
1310 * symconst_type_size.
1311 * Adds the SymConst to the start block of irg. */
1312 FIRM_API ir_node *new_rd_SymConst_size(dbg_info *db, ir_graph *irg,
1313 ir_mode *mode, ir_type *symbol);
1315 /** Constructor for a SymConst size node.
1317 * Same as new_rd_SymConst, except that the constructor is tailored for
1318 * symconst_type_align.
1319 * Adds the SymConst to the start block of irg.
1321 FIRM_API ir_node *new_rd_SymConst_align(dbg_info *db, ir_graph *irg,
1322 ir_mode *mode, ir_type *symbol);
1324 /** Constructor for a simpleSel node.
1326 * This is a shortcut for the new_rd_Sel() constructor. To be used for
1327 * Sel nodes that do not select from an array, i.e., have no index
1328 * inputs. It adds the two parameters 0, NULL.
1330 * @param *db A pointer for debug information.
1331 * @param *block The IR block the node belongs to.
1332 * @param *store The memory in which the object the entity should be
1333 * selected from is allocated.
1334 * @param *objptr The object from that the Sel operation selects a
1335 * single attribute out.
1336 * @param *ent The entity to select.
1338 FIRM_API ir_node *new_rd_simpleSel(dbg_info *db, ir_node *block, ir_node *store,
1339 ir_node *objptr, ir_entity *ent);
1341 /** Constructor for a Sel node.
1343 * The select node selects an entity (field or method) from an entity
1344 * with a compound type. It explicitly specifies the entity selected.
1345 * Dynamically the node may select entities that overwrite the given
1346 * entity. If the selected entity is an array element entity the Sel
1347 * node takes the required array indices as inputs.
1349 * @param *db A pointer for debug information.
1350 * @param *block The IR block the node belongs to.
1351 * @param *store The memory in which the object the entity should be selected
1352 * from is allocated.
1353 * @param *objptr A pointer to a compound entity the Sel operation selects a
1354 * single attribute from.
1355 * @param *n_index The number of array indices needed to select an array element entity.
1356 * @param *index[] If the compound entity is an array the indices of the selected
1357 * element entity. The constructor copies this array.
1358 * @param *ent The entity to select.
1360 FIRM_API ir_node *new_rd_Sel(dbg_info *db, ir_node *block, ir_node *store,
1361 ir_node *objptr, int n_index, ir_node *index[],
1364 /** Constructor for a Call node.
1366 * Represents all kinds of method and function calls.
1368 * @param *db A pointer for debug information.
1369 * @param *block The IR block the node belongs to.
1370 * @param *store The current memory state.
1371 * @param *callee A pointer to the called procedure.
1372 * @param arity The number of procedure parameters.
1373 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1374 * @param *tp Type information of the procedure called.
1376 FIRM_API ir_node *new_rd_Call(dbg_info *db, ir_node *block, ir_node *store,
1377 ir_node *callee, int arity, ir_node *in[],
1380 /** Constructor for a Builtin node.
1382 * Represents a call of a backend-specific builtin..
1384 * @param *db A pointer for debug information.
1385 * @param *block The IR block the node belongs to.
1386 * @param *store The current memory state.
1387 * @param arity The number of procedure parameters.
1388 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1389 * @param kind The kind of the called builtin.
1390 * @param *tp Type information of the procedure called.
1392 FIRM_API ir_node *new_rd_Builtin(dbg_info *db, ir_node *block, ir_node *store,
1393 int arity, ir_node *in[], ir_builtin_kind kind,
1396 /** Constructor for a Add node.
1398 * @param *db A pointer for debug information.
1399 * @param *block The IR block the node belongs to.
1400 * @param *op1 The first operand.
1401 * @param *op2 The second operand.
1402 * @param *mode The mode of the operands and the result.
1404 FIRM_API ir_node *new_rd_Add(dbg_info *db, ir_node *block, ir_node *op1,
1405 ir_node *op2, ir_mode *mode);
1407 /** Constructor for a Sub node.
1409 * @param *db A pointer for debug information.
1410 * @param *block The IR block the node belongs to.
1411 * @param *op1 The first operand.
1412 * @param *op2 The second operand.
1413 * @param *mode The mode of the operands and the result.
1415 FIRM_API ir_node *new_rd_Sub(dbg_info *db, ir_node *block,
1416 ir_node *op1, ir_node *op2, ir_mode *mode);
1418 /** Constructor for a Minus node.
1420 * @param *db A pointer for debug information.
1421 * @param *block The IR block the node belongs to.
1422 * @param *op The operand .
1423 * @param *mode The mode of the operand and the result.
1425 FIRM_API ir_node *new_rd_Minus(dbg_info *db, ir_node *block,
1426 ir_node *op, ir_mode *mode);
1428 /** Constructor for a Mul node.
1430 * @param *db A pointer for debug information.
1431 * @param *block The IR block the node belongs to.
1432 * @param *op1 The first operand.
1433 * @param *op2 The second operand.
1434 * @param *mode The mode of the operands and the result.
1436 FIRM_API ir_node *new_rd_Mul(dbg_info *db, ir_node *block,
1437 ir_node *op1, ir_node *op2, ir_mode *mode);
1439 /** Constructor for a Mulh node.
1441 * @param *db A pointer for debug information.
1442 * @param *block The IR block the node belongs to.
1443 * @param *op1 The first operand.
1444 * @param *op2 The second operand.
1445 * @param *mode The mode of the operands and the result.
1447 FIRM_API ir_node *new_rd_Mulh(dbg_info *db, ir_node *block,
1448 ir_node *op1, ir_node *op2, ir_mode *mode);
1450 /** Constructor for a Quot node.
1452 * @param *db A pointer for debug information.
1453 * @param *block The IR block the node belongs to.
1454 * @param *memop The store needed to model exceptions
1455 * @param *op1 The first operand.
1456 * @param *op2 The second operand.
1457 * @param *mode The mode of the result.
1458 * @param state The pinned state.
1460 FIRM_API ir_node *new_rd_Quot(dbg_info *db, ir_node *block, ir_node *memop,
1461 ir_node *op1, ir_node *op2, ir_mode *mode,
1462 op_pin_state state);
1464 /** Constructor for a DivMod node.
1466 * @param *db A pointer for debug information.
1467 * @param *block The IR block the node belongs to.
1468 * @param *memop The store needed to model exceptions
1469 * @param *op1 The first operand.
1470 * @param *op2 The second operand.
1471 * @param *mode The mode of the results.
1472 * @param state The pinned state.
1474 FIRM_API ir_node *new_rd_DivMod(dbg_info *db, ir_node *block, ir_node *memop,
1475 ir_node *op1, ir_node *op2, ir_mode *mode,
1476 op_pin_state state);
1478 /** Constructor for a Div node.
1480 * @param *db A pointer for debug information.
1481 * @param *block The IR block the node belongs to.
1482 * @param *memop The store needed to model exceptions
1483 * @param *op1 The first operand.
1484 * @param *op2 The second operand.
1485 * @param *mode The mode of the result.
1486 * @param state The pinned state.
1488 FIRM_API ir_node *new_rd_Div(dbg_info *db, ir_node *block, ir_node *memop,
1489 ir_node *op1, ir_node *op2, ir_mode *mode,
1490 op_pin_state state);
1492 /** Constructor for a remainderless Div node.
1494 * @param *db A pointer for debug information.
1495 * @param *block The IR block the node belongs to.
1496 * @param *memop The store needed to model exceptions
1497 * @param *op1 The first operand.
1498 * @param *op2 The second operand.
1499 * @param *mode The mode of the result.
1500 * @param state The pinned state.
1502 FIRM_API ir_node *new_rd_DivRL(dbg_info *db, ir_node *block, ir_node *memop,
1503 ir_node *op1, ir_node *op2, ir_mode *mode,
1504 op_pin_state state);
1506 /** Constructor for a Mod node.
1508 * @param *db A pointer for debug information.
1509 * @param *block The IR block the node belongs to.
1510 * @param *memop The store needed to model exceptions
1511 * @param *op1 The first operand.
1512 * @param *op2 The second operand.
1513 * @param *mode The mode of the result.
1514 * @param state The pinned state.
1516 FIRM_API ir_node *new_rd_Mod(dbg_info *db, ir_node *block, ir_node *memop,
1517 ir_node *op1, ir_node *op2, ir_mode *mode,
1518 op_pin_state state);
1520 /** Constructor for a And node.
1522 * @param *db A pointer for debug information.
1523 * @param *block The IR block the node belongs to.
1524 * @param *op1 The first operand.
1525 * @param *op2 The second operand.
1526 * @param *mode The mode of the operands and the result.
1528 FIRM_API ir_node *new_rd_And(dbg_info *db, ir_node *block,
1529 ir_node *op1, ir_node *op2, ir_mode *mode);
1531 /** Constructor for a Or node.
1533 * @param *db A pointer for debug information.
1534 * @param *block The IR block the node belongs to.
1535 * @param *op1 The first operand.
1536 * @param *op2 The second operand.
1537 * @param *mode The mode of the operands and the result.
1539 FIRM_API ir_node *new_rd_Or(dbg_info *db, ir_node *block,
1540 ir_node *op1, ir_node *op2, ir_mode *mode);
1542 /** Constructor for a Eor node.
1544 * @param *db A pointer for debug information.
1545 * @param *block The IR block the node belongs to.
1546 * @param *op1 The first operand.
1547 * @param *op2 The second operand.
1548 * @param *mode The mode of the operands and the results.
1550 FIRM_API ir_node *new_rd_Eor(dbg_info *db, ir_node *block,
1551 ir_node *op1, ir_node *op2, ir_mode *mode);
1553 /** Constructor for a Not node.
1555 * @param *db A pointer for debug information.
1556 * @param *block The IR block the node belongs to.
1557 * @param *op The operand.
1558 * @param *mode The mode of the operand and the result.
1560 FIRM_API ir_node *new_rd_Not(dbg_info *db, ir_node *block, ir_node *op,
1563 /** Constructor for a Cmp node.
1565 * @param *db A pointer for debug information.
1566 * @param *block The IR block the node belongs to.
1567 * @param *op1 The first operand.
1568 * @param *op2 The second operand.
1570 FIRM_API ir_node *new_rd_Cmp(dbg_info *db, ir_node *block,
1571 ir_node *op1, ir_node *op2);
1573 /** Constructor for a Shl node.
1575 * @param *db A pointer for debug information.
1576 * @param *block The IR block the node belongs to.
1577 * @param *op The operand.
1578 * @param *k The number of bits to shift the operand .
1579 * @param *mode The mode of the operand and the result.
1581 FIRM_API ir_node *new_rd_Shl(dbg_info *db, ir_node *block,
1582 ir_node *op, ir_node *k, ir_mode *mode);
1584 /** Constructor for a Shr node.
1586 * @param *db A pointer for debug information.
1587 * @param *block The IR block the node belongs to.
1588 * @param *op The operand.
1589 * @param *k The number of bits to shift the operand .
1590 * @param *mode The mode of the operand and the result.
1592 FIRM_API ir_node *new_rd_Shr(dbg_info *db, ir_node *block,
1593 ir_node *op, ir_node *k, ir_mode *mode);
1595 /** Constructor for a Shrs node.
1597 * @param *db A pointer for debug information.
1598 * @param *block The IR block the node belongs to.
1599 * @param *op The operand.
1600 * @param *k The number of bits to shift the operand.
1601 * @param *mode The mode of the operand and the result.
1603 FIRM_API ir_node *new_rd_Shrs(dbg_info *db, ir_node *block,
1604 ir_node *op, ir_node *k, ir_mode *mode);
1606 /** Constructor for a Rotl node.
1608 * @param *db A pointer for debug information.
1609 * @param *block The IR block the node belongs to.
1610 * @param *op The operand.
1611 * @param *k The number of bits to rotate the operand.
1612 * @param *mode The mode of the operand.
1614 FIRM_API ir_node *new_rd_Rotl(dbg_info *db, ir_node *block,
1615 ir_node *op, ir_node *k, ir_mode *mode);
1618 /** Constructor for a Conv node.
1620 * @param *db A pointer for debug information.
1621 * @param *block The IR block the node belongs to.
1622 * @param *op The operand.
1623 * @param *mode The mode of this the operand muss be converted .
1625 FIRM_API ir_node *new_rd_Conv(dbg_info *db, ir_node *block, ir_node *op,
1628 /** Constructor for a strictConv node.
1630 * @param *db A pointer for debug information.
1631 * @param *block The IR block the node belongs to.
1632 * @param *op The operand.
1633 * @param *mode The mode of this the operand muss be converted .
1635 FIRM_API ir_node *new_rd_strictConv(dbg_info *db, ir_node *block,
1636 ir_node *op, ir_mode *mode);
1638 /** Constructor for a Cast node.
1640 * High level type cast.
1642 * @param *db A pointer for debug information.
1643 * @param *block The IR block the node belongs to.
1644 * @param *op The operand.
1645 * @param *to_tp The type of this the operand muss be casted .
1647 FIRM_API ir_node *new_rd_Cast(dbg_info *db, ir_node *block,
1648 ir_node *op, ir_type *to_tp);
1650 /** Constructor for a Carry node.
1651 * Note: This node is not supported by the backends! Only use for program
1654 * @param *db A pointer for debug information.
1655 * @param *block The IR block the node belongs to.
1656 * @param *op1 The first operand.
1657 * @param *op2 The second operand.
1658 * @param *mode The mode of the operands and the result.
1660 FIRM_API ir_node *new_rd_Carry(dbg_info *db, ir_node *block,
1661 ir_node *op1, ir_node *op2, ir_mode *mode);
1663 /** Constructor for a Borrow node.
1664 * Note: This node is not supported by the backends! Only use for program
1667 * @param *db A pointer for debug information.
1668 * @param *block The IR block the node belongs to.
1669 * @param *op1 The first operand.
1670 * @param *op2 The second operand.
1671 * @param *mode The mode of the operands and the result.
1673 FIRM_API ir_node *new_rd_Borrow(dbg_info *db, ir_node *block,
1674 ir_node *op1, ir_node *op2, ir_mode *mode);
1676 /** Constructor for a Phi node.
1678 * @param *db A pointer for debug information.
1679 * @param *block The IR block the node belongs to.
1680 * @param arity The number of predecessors
1681 * @param *in[] Array with predecessors. The constructor copies this array.
1682 * @param *mode The mode of it's inputs and output.
1684 FIRM_API ir_node *new_rd_Phi(dbg_info *db, ir_node *block, int arity,
1685 ir_node *in[], ir_mode *mode);
1687 /** Constructor for a Load node.
1689 * @param *db A pointer for debug information.
1690 * @param *block The IR block the node belongs to.
1691 * @param *store The current memory
1692 * @param *adr A pointer to the variable to be read in this memory.
1693 * @param *mode The mode of the value to be loaded.
1694 * @param flags Additional flags for alignment, volatility and pin state.
1696 FIRM_API ir_node *new_rd_Load(dbg_info *db, ir_node *block, ir_node *store,
1697 ir_node *adr, ir_mode *mode, ir_cons_flags flags);
1699 /** Constructor for a Store node.
1701 * @param *db A pointer for debug information.
1702 * @param *block The IR block the node belongs to.
1703 * @param *store The current memory
1704 * @param *adr A pointer to the variable to be read in this memory.
1705 * @param *val The value to write to this variable.
1706 * @param flags Additional flags for alignment, volatility and pin state.
1708 FIRM_API ir_node *new_rd_Store(dbg_info *db, ir_node *block, ir_node *store,
1709 ir_node *adr, ir_node *val, ir_cons_flags flags);
1711 /** Constructor for a Alloc node.
1713 * The Alloc node extends the memory by space for an entity of type alloc_type.
1715 * @param *db A pointer for debug information.
1716 * @param *block The IR block the node belongs to.
1717 * @param *store The memory which shall contain the new variable.
1718 * @param *count The number of objects to allocate.
1719 * @param *alloc_type The type of the allocated variable.
1720 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
1722 FIRM_API ir_node *new_rd_Alloc(dbg_info *db, ir_node *block, ir_node *store,
1723 ir_node *count, ir_type *alloc_type,
1724 ir_where_alloc where);
1726 /** Constructor for a Free node.
1728 * Frees the memory occupied by the entity pointed to by the pointer
1729 * arg. Type indicates the type of the entity the argument points to.
1731 * @param *db A pointer for debug information.
1732 * @param *block The IR block the node belongs to.
1733 * @param *store The memory which shall contain the new variable.
1734 * @param *ptr The pointer to the object to free.
1735 * @param *size The number of objects of type free_type to free in a sequence.
1736 * @param *free_type The type of the freed variable.
1737 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
1739 FIRM_API ir_node *new_rd_Free(dbg_info *db, ir_node *block, ir_node *store,
1740 ir_node *ptr, ir_node *size, ir_type *free_type,
1741 ir_where_alloc where);
1743 /** Constructor for a Sync node.
1745 * Merges several memory values. The node assumes that a variable
1746 * either occurs only in one of the memories, or it contains the same
1747 * value in all memories where it occurs.
1749 * @param *db A pointer for debug information.
1750 * @param *block The IR block the node belongs to.
1751 * @param arity The number of memories to synchronize.
1752 * @param *in[] An array of pointers to nodes that produce an output of type
1753 * memory. The constructor copies this array.
1755 FIRM_API ir_node *new_rd_Sync(dbg_info *db, ir_node *block, int arity,
1758 /** Constructor for a Proj node.
1760 * Projects a single value out of a tuple. The parameter proj gives the
1761 * position of the value within the tuple.
1763 * @param *db A pointer for debug information.
1764 * @param arg A node producing a tuple. The node must have mode_T.
1765 * @param *mode The mode of the value to project.
1766 * @param proj The position of the value in the tuple.
1768 FIRM_API ir_node *new_rd_Proj(dbg_info *db, ir_node *arg, ir_mode *mode,
1771 /** Constructor for a defaultProj node.
1773 * Represents the default control flow of a Switch-Cond node.
1775 * @param *db A pointer for debug information.
1776 * @param arg A node producing a tuple.
1777 * @param max_proj The end position of the value in the tuple.
1779 FIRM_API ir_node *new_rd_defaultProj(dbg_info *db, ir_node *arg, long max_proj);
1781 /** Constructor for a Tuple node.
1783 * This is an auxiliary node to replace a node that returns a tuple
1784 * without changing the corresponding Proj nodes.
1786 * @param *db A pointer for debug information.
1787 * @param *block The IR block the node belongs to.
1788 * @param arity The number of tuple elements.
1789 * @param *in[] An array containing pointers to the nodes producing the tuple
1790 * elements. The constructor copies this array.
1792 FIRM_API ir_node *new_rd_Tuple(dbg_info *db, ir_node *block,
1793 int arity, ir_node *in[]);
1795 /** Constructor for a Id node.
1797 * This is an auxiliary node to replace a node that returns a single
1800 * @param *db A pointer for debug information.
1801 * @param *block The IR block the node belongs to.
1802 * @param *val The value
1803 * @param *mode The mode of *val.
1805 FIRM_API ir_node *new_rd_Id(dbg_info *db, ir_node *block,
1806 ir_node *val, ir_mode *mode);
1808 /** Constructor for a Bad node.
1810 * @param *db A pointer for debug information.
1811 * @param *irg The IR graph the node belongs to.
1813 FIRM_API ir_node *new_rd_Bad(dbg_info *db, ir_graph *irg);
1815 /** Constructor for a Confirm node.
1817 * Specifies constraints for a value. To support dataflow analyses.
1819 * Example: If the value never exceeds '100' this is expressed by placing a
1820 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
1822 * @param *db A pointer for debug information.
1823 * @param *block The IR block the node belong to.
1824 * @param *val The value we express a constraint for
1825 * @param *bound The value to compare against. Must be a firm node, typically a constant.
1826 * @param cmp The compare operation.
1828 FIRM_API ir_node *new_rd_Confirm(dbg_info *db, ir_node *block,
1829 ir_node *val, ir_node *bound, pn_Cmp cmp);
1831 /** Constructor for an Unknown node.
1833 * Represents an arbitrary value. Places the node in the start block.
1835 * @param *db A pointer for debug information.
1836 * @param *irg The IR graph the node belongs to.
1837 * @param *m The mode of the unknown value.
1839 FIRM_API ir_node *new_rd_Unknown(dbg_info *db, ir_graph *irg, ir_mode *m);
1841 /** Constructor for a NoMem node.
1843 * @param *db A pointer for debug information.
1844 * @param *irg The IR graph the node belongs to.
1846 FIRM_API ir_node *new_rd_NoMem(dbg_info *db, ir_graph *irg);
1848 /** Constructor for a Mux node.
1850 * @param *db A pointer for debug information.
1851 * @param *block The block the node belong to.
1852 * @param *sel The ir_node that calculates the boolean select.
1853 * @param *ir_true The ir_node that calculates the true result.
1854 * @param *ir_false The ir_node that calculates the false result.
1855 * @param *mode The mode of the node (and it_true and ir_false).
1857 FIRM_API ir_node *new_rd_Mux(dbg_info *db, ir_node *block, ir_node *sel,
1858 ir_node *ir_false, ir_node *ir_true,
1861 /** Constructor for a CopyB node.
1863 * @param *db A pointer for debug information.
1864 * @param *block The block the node belong to.
1865 * @param *store The current memory
1866 * @param *dst The ir_node that represents the destination address.
1867 * @param *src The ir_node that represents the source address.
1868 * @param *data_type The type of the copied data
1870 FIRM_API ir_node *new_rd_CopyB(dbg_info *db, ir_node *block, ir_node *store,
1871 ir_node *dst, ir_node *src, ir_type *data_type);
1873 /** Constructor for a InstOf node.
1875 * A High-Level Type check.
1877 * @param *db A pointer for debug information.
1878 * @param *block The IR block the node belongs to.
1879 * @param *store The memory in which the object the entity should be selected
1880 * from is allocated.
1881 * @param *objptr A pointer to a object of a class type.
1882 * @param *type The type of which objptr must be.
1884 FIRM_API ir_node *new_rd_InstOf(dbg_info *db, ir_node *block, ir_node *store,
1885 ir_node *objptr, ir_type *type);
1887 /** Constructor for a Raise node.
1889 * A High-Level Exception throw.
1891 * @param *db A pointer for debug information.
1892 * @param *block The IR block the node belongs to.
1893 * @param *store The current memory.
1894 * @param *obj A pointer to the Except variable.
1896 FIRM_API ir_node *new_rd_Raise(dbg_info *db, ir_node *block, ir_node *store,
1899 /** Constructor for a Bound node.
1901 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
1903 * @param *db A pointer for debug information.
1904 * @param *block The block the node belong to.
1905 * @param *store The current memory.
1906 * @param *idx The ir_node that represents an index.
1907 * @param *lower The ir_node that represents the lower bound for the index.
1908 * @param *upper The ir_node that represents the upper bound for the index.
1910 FIRM_API ir_node *new_rd_Bound(dbg_info *db, ir_node *block,
1911 ir_node *store, ir_node *idx, ir_node *lower,
1914 /** Constructor for a Pin node.
1916 * @param *db A pointer for debug information.
1917 * @param *block The block the node belong to.
1918 * @param *node The node which value should be pinned.
1920 FIRM_API ir_node *new_rd_Pin(dbg_info *db, ir_node *block, ir_node *node);
1922 /** Constructor for an ASM pseudo node.
1924 * @param *db A pointer for debug information.
1925 * @param *block The block the node belong to.
1926 * @param arity The number of data inputs to the node.
1927 * @param *in The array of length arity of data inputs.
1928 * @param *inputs The array of length arity of input constraints.
1929 * @param n_outs The number of data outputs to the node.
1930 * @param *outputs The array of length n_outs of output constraints.
1931 * @param n_clobber The number of clobbered registers.
1932 * @param *clobber The array of length n_clobber of clobbered registers.
1933 * @param *asm_text The assembler text.
1935 FIRM_API ir_node *new_rd_ASM(dbg_info *db, ir_node *block,
1936 int arity, ir_node *in[], ir_asm_constraint *inputs,
1937 int n_outs, ir_asm_constraint *outputs,
1938 int n_clobber, ident *clobber[], ident *asm_text);
1940 /*-------------------------------------------------------------------------*/
1941 /* The raw interface without debug support */
1942 /*-------------------------------------------------------------------------*/
1944 /** Constructor for a Block node.
1946 * Constructs a mature block with the given predecessors. Use Unknown
1947 * nodes as predecessors to construct a block if the number of
1948 * predecessors is known, but not the predecessors themselves. This
1949 * constructor does not set current_block. It not be used with
1950 * automatic Phi node construction.
1953 * @param irg The IR graph the block belongs to.
1954 * @param arity The number of control predecessors.
1955 * @param in[] An array of control predecessors. The length of
1956 * the array must be 'arity'. The constructor copies this array.
1958 FIRM_API ir_node *new_r_Block(ir_graph *irg, int arity, ir_node *in[]);
1960 /** Constructor for a Start node. */
1961 FIRM_API ir_node *new_r_Start(ir_graph *irg);
1963 /** Constructor for a End node. */
1964 FIRM_API ir_node *new_r_End(ir_graph *irg, int arity, ir_node *in[]);
1966 /** Constructor for a Jmp node.
1968 * Jmp represents control flow to a single control successor.
1970 * @param *block The IR block the node belongs to.
1972 FIRM_API ir_node *new_r_Jmp(ir_node *block);
1974 /** Constructor for an IJmp node.
1976 * IJmp represents control flow to a single control successor not
1977 * statically known i.e. an indirect Jmp.
1979 * @param *block The IR block the node belongs to.
1980 * @param *tgt The IR node representing the target address.
1982 FIRM_API ir_node *new_r_IJmp(ir_node *block, ir_node *tgt);
1984 /** Constructor for a Cond node.
1986 * If c is mode_b represents a conditional branch (if/else). If c is
1987 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
1988 * node, default Proj is 0.)
1990 * This is not consistent: Input to Cond is Is, Proj has as proj number
1993 * @param *block The IR block the node belongs to.
1994 * @param *c The conditions parameter.Can be of mode b or I_u.
1996 FIRM_API ir_node *new_r_Cond(ir_node *block, ir_node *c);
1998 /** Constructor for a Return node.
2000 * Returns the memory and zero or more return values. Only node that
2001 * can end regular control flow.
2003 * @param *block The IR block the node belongs to.
2004 * @param *store The state of memory.
2005 * @param arity Number of array indices.
2006 * @param *in[] Array with index inputs to the node. The constructor copies this array.
2008 FIRM_API ir_node *new_r_Return(ir_node *block, ir_node *store,
2009 int arity, ir_node *in[]);
2011 /** Constructor for a Const node.
2013 * Adds the node to the start block.
2015 * Constructor for a Const node. The constant represents a target
2016 * value. Sets the type information to type_unknown. (No more
2017 * supported: If tv is entity derives a somehow useful type.)
2018 * Derives mode from passed tarval.
2020 * @param *irg The IR graph the node belongs to.
2021 * @param *con Points to an entry in the constant table.
2023 FIRM_API ir_node *new_r_Const(ir_graph *irg, ir_tarval *con);
2025 /** Constructor for a Const node.
2027 * Adds the node to the start block.
2029 * Constructor for a Const node. The constant represents a target
2030 * value. Sets the type information to type_unknown. (No more
2031 * supported: If tv is entity derives a somehow useful type.)
2033 * @param *irg The IR graph the node belongs to.
2034 * @param *mode The mode of the operands and the results.
2035 * @param value A value from which the tarval is made.
2037 FIRM_API ir_node *new_r_Const_long(ir_graph *irg, ir_mode *mode, long value);
2039 /** Constructor for a SymConst node.
2041 * This is the constructor for a symbolic constant.
2042 * There are several kinds of symbolic constants:
2043 * - symconst_type_tag The symbolic constant represents a type tag. The
2044 * type the tag stands for is given explicitly.
2045 * - symconst_type_size The symbolic constant represents the size of a type.
2046 * The type of which the constant represents the size
2047 * is given explicitly.
2048 * - symconst_type_align The symbolic constant represents the alignment of a
2049 * type. The type of which the constant represents the
2050 * size is given explicitly.
2051 * - symconst_addr_ent The symbolic constant represents the address of an
2052 * entity (variable or method). The variable is given
2053 * explicitly by a firm entity.
2054 * - symconst_ofs_ent The symbolic constant represents the offset of an
2055 * entity in its owner type.
2056 * - symconst_enum_const The symbolic constant is a enumeration constant of
2057 * an enumeration type.
2059 * Inputs to the node:
2060 * No inputs except the block it belongs to.
2061 * Outputs of the node.
2062 * An unsigned integer (I_u) or a pointer (P).
2064 * Mention union in declaration so that the firmjni generator recognizes that
2065 * it can not cast the argument to an int.
2067 * @param *irg The IR graph the node belongs to.
2068 * @param mode The mode for the SymConst.
2069 * @param value A type, ident, entity or enum constant depending on the
2071 * @param kind The kind of the symbolic constant, see the list above
2073 FIRM_API ir_node *new_r_SymConst(ir_graph *irg, ir_mode *mode,
2074 union symconst_symbol value,
2075 symconst_kind kind);
2077 /** Constructor for a simpleSel node.
2079 * This is a shortcut for the new_d_Sel() constructor. To be used for
2080 * Sel nodes that do not select from an array, i.e., have no index
2081 * inputs. It adds the two parameters 0, NULL.
2083 * @param *block The IR block the node belongs to.
2084 * @param *store The memory in which the object the entity should be selected
2085 * from is allocated.
2086 * @param *objptr The object from that the Sel operation selects a
2087 * single attribute out.
2088 * @param *ent The entity to select.
2090 FIRM_API ir_node *new_r_simpleSel(ir_node *block, ir_node *store,
2091 ir_node *objptr, ir_entity *ent);
2093 /** Constructor for a Sel node.
2095 * The select node selects an entity (field or method) from an entity
2096 * with a compound type. It explicitly specifies the entity selected.
2097 * Dynamically the node may select entities that overwrite the given
2098 * entity. If the selected entity is an array element entity the Sel
2099 * node takes the required array indices as inputs.
2101 * @param *block The IR block the node belongs to.
2102 * @param *store The memory in which the object the entity should be selected
2103 * from is allocated.
2104 * @param *objptr A pointer to a compound entity the Sel operation selects a
2105 * single attribute from.
2106 * @param *n_index The number of array indices needed to select an array element entity.
2107 * @param *index[] If the compound entity is an array the indices of the selected
2108 * element entity. The constructor copies this array.
2109 * @param *ent The entity to select.
2111 FIRM_API ir_node *new_r_Sel(ir_node *block, ir_node *store,
2112 ir_node *objptr, int n_index, ir_node *index[],
2115 /** Constructor for a Call node.
2117 * Represents all kinds of method and function calls.
2119 * @param *block The IR block the node belongs to.
2120 * @param *store The actual store.
2121 * @param *callee A pointer to the called procedure.
2122 * @param arity The number of procedure parameters.
2123 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2124 * @param *tp Type information of the procedure called.
2126 FIRM_API ir_node *new_r_Call(ir_node *block, ir_node *store,
2127 ir_node *callee, int arity, ir_node *in[],
2130 /** Constructor for a Builtin node.
2132 * Represents a call of a backend-specific builtin..
2134 * @param *block The IR block the node belongs to.
2135 * @param *store The actual store.
2136 * @param arity The number of procedure parameters.
2137 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2138 * @param kind The kind of the called builtin.
2139 * @param *tp Type information of the procedure called.
2141 FIRM_API ir_node *new_r_Builtin(ir_node *block, ir_node *store,
2142 int arity, ir_node *in[], ir_builtin_kind kind,
2145 /** Constructor for a Add node.
2147 * @param *block The IR block the node belongs to.
2148 * @param *op1 The first operand.
2149 * @param *op2 The second operand.
2150 * @param *mode The mode of the operands and the result.
2152 FIRM_API ir_node *new_r_Add(ir_node *block, ir_node *op1, ir_node *op2,
2156 * Constructor for a Sub node.
2158 * @param *block The IR block the node belongs to.
2159 * @param *op1 The first operand.
2160 * @param *op2 The second operand.
2161 * @param *mode The mode of the operands and the results.
2163 FIRM_API ir_node *new_r_Sub(ir_node *block, ir_node *op1, ir_node *op2,
2166 /** Constructor for a Minus node.
2168 * @param *block The IR block the node belongs to.
2169 * @param *op The operand.
2170 * @param *mode The mode of the operand and the result.
2172 FIRM_API ir_node *new_r_Minus(ir_node *block, ir_node *op, ir_mode *mode);
2174 /** Constructor for a Mul node.
2176 * @param *block The IR block the node belongs to.
2177 * @param *op1 The first operand.
2178 * @param *op2 The second operand.
2179 * @param *mode The mode of the operands and the result.
2181 FIRM_API ir_node *new_r_Mul(ir_node *block, ir_node *op1, ir_node *op2,
2184 /** Constructor for a Mulh node.
2186 * @param *block The IR block the node belongs to.
2187 * @param *op1 The first operand.
2188 * @param *op2 The second operand.
2189 * @param *mode The mode of the operands and the result.
2191 FIRM_API ir_node *new_r_Mulh(ir_node *block, ir_node *op1, ir_node *op2,
2194 /** Constructor for a Quot node.
2196 * @param *block The IR block the node belongs to.
2197 * @param *memop The store needed to model exceptions
2198 * @param *op1 The first operand.
2199 * @param *op2 The second operand.
2200 * @param *mode The mode of the result.
2201 * @param state The pinned state.
2203 FIRM_API ir_node *new_r_Quot(ir_node *block, ir_node *memop,
2204 ir_node *op1, ir_node *op2, ir_mode *mode,
2205 op_pin_state state);
2207 /** Constructor for a DivMod node.
2209 * @param *block The IR block the node belongs to.
2210 * @param *memop The store needed to model exceptions
2211 * @param *op1 The first operand.
2212 * @param *op2 The second operand.
2213 * @param *mode The mode of the results.
2214 * @param state The pinned state.
2216 FIRM_API ir_node *new_r_DivMod(ir_node *block, ir_node *memop,
2217 ir_node *op1, ir_node *op2, ir_mode *mode,
2218 op_pin_state state);
2220 /** Constructor for a Div node.
2222 * @param *block The IR block the node belongs to.
2223 * @param *memop The store needed to model exceptions
2224 * @param *op1 The first operand.
2225 * @param *op2 The second operand.
2226 * @param *mode The mode of the result.
2227 * @param state The pinned state.
2229 FIRM_API ir_node *new_r_Div(ir_node *block, ir_node *memop,
2230 ir_node *op1, ir_node *op2, ir_mode *mode,
2231 op_pin_state state);
2233 /** Constructor for a remainderless Div node.
2235 * @param *block The IR block the node belongs to.
2236 * @param *memop The store needed to model exceptions
2237 * @param *op1 The first operand.
2238 * @param *op2 The second operand.
2239 * @param *mode The mode of the result.
2240 * @param state The pinned state.
2242 FIRM_API ir_node *new_r_DivRL(ir_node *block, ir_node *memop,
2243 ir_node *op1, ir_node *op2, ir_mode *mode,
2244 op_pin_state state);
2246 /** Constructor for a Mod node.
2248 * @param *block The IR block the node belongs to.
2249 * @param *memop The store needed to model exceptions
2250 * @param *op1 The first operand.
2251 * @param *op2 The second operand.
2252 * @param *mode The mode of the result.
2253 * @param state The pinned state.
2255 FIRM_API ir_node *new_r_Mod(ir_node *block, ir_node *memop,
2256 ir_node *op1, ir_node *op2, ir_mode *mode,
2257 op_pin_state state);
2259 /** Constructor for a And node.
2261 * @param *block The IR block the node belongs to.
2262 * @param *op1 The first operand.
2263 * @param *op2 The second operand.
2264 * @param *mode The mode of the operands and the result.
2266 FIRM_API ir_node *new_r_And(ir_node *block, ir_node *op1, ir_node *op2,
2269 /** Constructor for a Or node.
2271 * @param *block The IR block the node belongs to.
2272 * @param *op1 The first operand.
2273 * @param *op2 The second operand.
2274 * @param *mode The mode of the operands and the result.
2276 FIRM_API ir_node *new_r_Or(ir_node *block, ir_node *op1, ir_node *op2,
2279 /** Constructor for a Eor node.
2281 * @param *block The IR block the node belongs to.
2282 * @param *op1 The first operand.
2283 * @param *op2 The second operand.
2284 * @param *mode The mode of the operands and the results.
2286 FIRM_API ir_node *new_r_Eor(ir_node *block, ir_node *op1, ir_node *op2,
2289 /** Constructor for a Not node.
2291 * @param *block The IR block the node belongs to.
2292 * @param *op The operand.
2293 * @param *mode The mode of the operand and the result.
2295 FIRM_API ir_node *new_r_Not(ir_node *block, ir_node *op, ir_mode *mode);
2297 /** Constructor for a Cmp node.
2299 * @param *block The IR block the node belongs to.
2300 * @param *op1 The first operand.
2301 * @param *op2 The second operand.
2303 FIRM_API ir_node *new_r_Cmp(ir_node *block, ir_node *op1, ir_node *op2);
2305 /** Constructor for a Shl node.
2307 * @param *block The IR block the node belongs to.
2308 * @param *op The operand.
2309 * @param *k The number of bits to shift the operand .
2310 * @param *mode The mode of the operand and the result.
2312 FIRM_API ir_node *new_r_Shl(ir_node *block, ir_node *op, ir_node *k,
2315 /** Constructor for a Shr node.
2317 * @param *block The IR block the node belongs to.
2318 * @param *op The operand.
2319 * @param *k The number of bits to shift the operand .
2320 * @param *mode The mode of the operand and the result.
2322 FIRM_API ir_node *new_r_Shr(ir_node *block, ir_node *op, ir_node *k,
2326 * Constructor for a Shrs node.
2328 * @param *block The IR block the node belongs to.
2329 * @param *op The operand.
2330 * @param *k The number of bits to shift the operand.
2331 * @param *mode The mode of the operand and the result.
2333 FIRM_API ir_node *new_r_Shrs(ir_node *block, ir_node *op, ir_node *k,
2336 /** Constructor for a Rotl node.
2338 * @param *block The IR block the node belongs to.
2339 * @param *op The operand.
2340 * @param *k The number of bits to rotate the operand.
2341 * @param *mode The mode of the operand.
2343 FIRM_API ir_node *new_r_Rotl(ir_node *block, ir_node *op, ir_node *k,
2346 /** Constructor for a Conv node.
2348 * @param *block The IR block the node belongs to.
2349 * @param *op The operand.
2350 * @param *mode The mode of this the operand muss be converted .
2352 FIRM_API ir_node *new_r_Conv(ir_node *block, ir_node *op, ir_mode *mode);
2354 /** Constructor for a strict Conv node.
2356 * @param *block The IR block the node belongs to.
2357 * @param *op The operand.
2358 * @param *mode The mode of this the operand muss be converted .
2360 FIRM_API ir_node *new_r_strictConv(ir_node *block, ir_node *op, ir_mode *mode);
2362 /** Constructor for a Cast node.
2364 * High level type cast
2366 * @param *block The IR block the node belongs to.
2367 * @param *op The operand.
2368 * @param *to_tp The type of this the operand muss be casted .
2370 FIRM_API ir_node *new_r_Cast(ir_node *block, ir_node *op, ir_type *to_tp);
2372 /** Constructor for a Carry node.
2374 * @param *block The IR block the node belongs to.
2375 * @param *op1 The first operand.
2376 * @param *op2 The second operand.
2377 * @param *mode The mode of the operands and the result.
2379 FIRM_API ir_node *new_r_Carry(ir_node *block, ir_node *op1, ir_node *op2,
2383 * Constructor for a Borrow node.
2385 * @param *block The IR block the node belongs to.
2386 * @param *op1 The first operand.
2387 * @param *op2 The second operand.
2388 * @param *mode The mode of the operands and the results.
2390 FIRM_API ir_node *new_r_Borrow(ir_node *block, ir_node *op1, ir_node *op2,
2393 /** Constructor for a Phi node.
2395 * @param *block The IR block the node belongs to.
2396 * @param arity The number of predecessors
2397 * @param *in[] Array with predecessors. The constructor copies this array.
2398 * @param *mode The mode of it's inputs and output.
2400 FIRM_API ir_node *new_r_Phi(ir_node *block, int arity, ir_node *in[],
2403 /** Constructor for a Load node.
2405 * @param *block The IR block the node belongs to.
2406 * @param *store The current memory
2407 * @param *adr A pointer to the variable to be read in this memory.
2408 * @param *mode The mode of the value to be loaded.
2409 * @param flags Additional flags for alignment, volatility and pin state.
2411 FIRM_API ir_node *new_r_Load(ir_node *block, ir_node *store,
2412 ir_node *adr, ir_mode *mode, ir_cons_flags flags);
2414 /** Constructor for a Store node.
2416 * @param *block The IR block the node belongs to.
2417 * @param *store The current memory
2418 * @param *adr A pointer to the variable to be read in this memory.
2419 * @param *val The value to write to this variable.
2420 * @param flags Additional flags for alignment, volatility and pin state.
2422 FIRM_API ir_node *new_r_Store(ir_node *block, ir_node *store,
2423 ir_node *adr, ir_node *val, ir_cons_flags flags);
2425 /** Constructor for a Alloc node.
2427 * The Alloc node extends the memory by space for an entity of type alloc_type.
2429 * @param *block The IR block the node belongs to.
2430 * @param *store The memory which shall contain the new variable.
2431 * @param *count The number of objects to allocate.
2432 * @param *alloc_type The type of the allocated variable.
2433 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
2435 FIRM_API ir_node *new_r_Alloc(ir_node *block, ir_node *store,
2436 ir_node *count, ir_type *alloc_type,
2437 ir_where_alloc where);
2439 /** Constructor for a Free node.
2441 * Frees the memory occupied by the entity pointed to by the pointer
2442 * arg. Type indicates the type of the entity the argument points to.
2444 * @param *block The IR block the node belongs to.
2445 * @param *store The memory which shall contain the new variable.
2446 * @param *ptr The pointer to the object to free.
2447 * @param *size The number of objects of type free_type to free in a sequence.
2448 * @param *free_type The type of the freed variable.
2449 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
2451 FIRM_API ir_node *new_r_Free(ir_node *block, ir_node *store, ir_node *ptr,
2452 ir_node *size, ir_type *free_type,
2453 ir_where_alloc where);
2455 /** Constructor for a Sync node.
2457 * Merges several memory values. The node assumes that a variable
2458 * either occurs only in one of the memories, or it contains the same
2459 * value in all memories where it occurs.
2461 * @param *block The IR block the node belongs to.
2462 * @param arity The number of memories to synchronize.
2463 * @param *in[] An array of pointers to nodes that produce an output of type memory.
2464 * The constructor copies this array.
2466 FIRM_API ir_node *new_r_Sync(ir_node *block, int arity, ir_node *in[]);
2468 /** Constructor for a Proj node.
2470 * Projects a single value out of a tuple. The parameter proj gives the
2471 * position of the value within the tuple.
2473 * @param arg A node producing a tuple.
2474 * @param mode The mode of the value to project.
2475 * @param proj The position of the value in the tuple.
2477 FIRM_API ir_node *new_r_Proj(ir_node *arg, ir_mode *mode, long proj);
2479 /** Constructor for a defaultProj node.
2481 * Represents the default control flow of a Switch-Cond node.
2483 * @param arg A node producing a tuple.
2484 * @param max_proj The end position of the value in the tuple.
2486 FIRM_API ir_node *new_r_defaultProj(ir_node *arg, long max_proj);
2489 /** Constructor for a Tuple node.
2491 * This is an auxiliary node to replace a node that returns a tuple
2492 * without changing the corresponding Proj nodes.
2494 * @param *block The IR block the node belongs to.
2495 * @param arity The number of tuple elements.
2496 * @param *in[] An array containing pointers to the nodes producing the tuple elements.
2497 * The constructor copies this array.
2499 FIRM_API ir_node *new_r_Tuple(ir_node *block, int arity, ir_node *in[]);
2501 /** Constructor for a Id node.
2503 * This is an auxiliary node to replace a node that returns a single
2506 * @param *block The IR block the node belongs to.
2507 * @param *val The operand to Id.
2508 * @param *mode The mode of *val.
2510 FIRM_API ir_node *new_r_Id(ir_node *block, ir_node *val, ir_mode *mode);
2512 /** Constructor for a Bad node.
2514 * @param *irg The IR graph the node belongs to.
2516 FIRM_API ir_node *new_r_Bad(ir_graph *irg);
2518 /** Constructor for a Confirm node.
2520 * Specifies constraints for a value. To support dataflow analyses.
2522 * Example: If the value never exceeds '100' this is expressed by placing a
2523 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
2525 * @param *block The IR block the node belong to.
2526 * @param *val The value we express a constraint for
2527 * @param *bound The value to compare against. Must be a firm node, typically a constant.
2528 * @param cmp The compare operation.
2530 FIRM_API ir_node *new_r_Confirm(ir_node *block, ir_node *val, ir_node *bound,
2533 /** Constructor for a Unknown node.
2535 * Represents an arbitrary value. Places the node in
2538 * @param *irg The IR graph the node belongs to.
2539 * @param *m The mode of the unknown value.
2541 FIRM_API ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2543 /** Constructor for a NoMem node.
2545 * @param *irg The IR graph the node belongs to.
2547 FIRM_API ir_node *new_r_NoMem(ir_graph *irg);
2549 /** Constructor for a Mux node.
2551 * @param *block The block the node belong to.
2552 * @param *sel The ir_node that calculates the boolean select.
2553 * @param *ir_true The ir_node that calculates the true result.
2554 * @param *ir_false The ir_node that calculates the false result.
2555 * @param *mode The mode of the node (and it_true and ir_false).
2557 FIRM_API ir_node *new_r_Mux(ir_node *block, ir_node *sel,
2558 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2560 /** Constructor for a CopyB node.
2562 * @param *block The block the node belong to.
2563 * @param *store The current memory
2564 * @param *dst The ir_node that represents the destination address.
2565 * @param *src The ir_node that represents the source address.
2566 * @param *data_type The type of the copied data
2568 FIRM_API ir_node *new_r_CopyB(ir_node *block, ir_node *store,
2569 ir_node *dst, ir_node *src, ir_type *data_type);
2571 /** Constructor for a InstOf node.
2573 * A High-Level Type check.
2575 * @param *block The block the node belong to.
2576 * @param *store The memory in which the object the entity should be selected
2577 * from is allocated.
2578 * @param *objptr A pointer to a object of a class type.
2579 * @param *type The type of which objptr must be.
2581 FIRM_API ir_node *new_r_InstOf(ir_node *block, ir_node *store,
2582 ir_node *objptr, ir_type *type);
2584 /** Constructor for a Raise node.
2586 * A High-Level Exception throw.
2588 * @param *block The IR block the node belongs to.
2589 * @param *store The current memory.
2590 * @param *obj A pointer to the Except variable.
2592 FIRM_API ir_node *new_r_Raise(ir_node *block, ir_node *store, ir_node *obj);
2594 /** Constructor for a Bound node.
2596 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2598 * @param *block The block the node belong to.
2599 * @param *store The current memory.
2600 * @param *idx The ir_node that represents an index.
2601 * @param *lower The ir_node that represents the lower bound for the index.
2602 * @param *upper The ir_node that represents the upper bound for the index.
2604 FIRM_API ir_node *new_r_Bound(ir_node *block, ir_node *store,
2605 ir_node *idx, ir_node *lower, ir_node *upper);
2607 /** Constructor for a Pin node.
2609 * @param *block The block the node belong to.
2610 * @param *node The node which value should be pinned.
2612 FIRM_API ir_node *new_r_Pin(ir_node *block, ir_node *node);
2614 /** Constructor for an ASM pseudo node.
2616 * @param *block The block the node belong to.
2617 * @param arity The number of data inputs to the node.
2618 * @param *in The array of length arity of data inputs.
2619 * @param *inputs The array of length arity of input constraints.
2620 * @param n_outs The number of data outputs to the node.
2621 * @param *outputs The array of length n_outs of output constraints.
2622 * @param n_clobber The number of clobbered registers.
2623 * @param *clobber The array of length n_clobber of clobbered registers.
2624 * @param *asm_text The assembler text.
2626 FIRM_API ir_node *new_r_ASM(ir_node *block,
2627 int arity, ir_node *in[], ir_asm_constraint *inputs,
2628 int n_outs, ir_asm_constraint *outputs,
2629 int n_clobber, ident *clobber[], ident *asm_text);
2631 /*-----------------------------------------------------------------------*/
2632 /* The block oriented interface */
2633 /*-----------------------------------------------------------------------*/
2635 /** Sets the current block in which the following constructors place the
2636 * nodes they construct.
2638 * @param target The new current block.
2640 FIRM_API void set_cur_block(ir_node *target);
2641 FIRM_API void set_r_cur_block(ir_graph *irg, ir_node *target);
2643 /** Returns the current block of the current graph. */
2644 FIRM_API ir_node *get_cur_block(void);
2645 FIRM_API ir_node *get_r_cur_block(ir_graph *irg);
2647 /** Constructor for a Block node.
2649 * Adds the block to the graph in current_ir_graph. Constructs a Block
2650 * with a fixed number of predecessors.
2652 * @param *db A Pointer for debug information.
2653 * @param arity The number of control predecessors.
2654 * @param in[] An array of control predecessors. The length of
2655 * the array must be 'arity'.
2657 FIRM_API ir_node *new_d_Block(dbg_info *db, int arity, ir_node *in[]);
2659 /** Constructor for a Start node.
2661 * Adds the node to the block in current_ir_block.
2663 * @param *db A pointer for debug information.
2665 FIRM_API ir_node *new_d_Start(dbg_info *db);
2667 /** Constructor for a End node.
2669 * Adds the node to the block in current_ir_block.
2671 * @param *db A pointer for debug information.
2673 FIRM_API ir_node *new_d_End(dbg_info *db, int arity, ir_node *in[]);
2675 /** Constructor for a Jmp node.
2677 * Adds the node to the block in current_ir_block.
2679 * Jmp represents control flow to a single control successor.
2681 * @param *db A pointer for debug information.
2683 FIRM_API ir_node *new_d_Jmp(dbg_info *db);
2685 /** Constructor for an IJmp node.
2687 * IJmp represents control flow to a single control successor not
2688 * statically known i.e. an indirect Jmp.
2690 * @param *db A pointer for debug information.
2691 * @param *tgt The IR node representing the target address.
2693 FIRM_API ir_node *new_d_IJmp(dbg_info *db, ir_node *tgt);
2695 /** Constructor for a Cond node.
2697 * Adds the node to the block in current_ir_block.
2699 * If c is mode_b represents a conditional branch (if/else). If c is
2700 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2701 * node, default Proj is 0.)
2703 * This is not consistent: Input to Cond is Is, Proj has as proj number
2706 * @param *db A pointer for debug information.
2707 * @param *c The conditions parameter.Can be of mode b or I_u.
2709 FIRM_API ir_node *new_d_Cond(dbg_info *db, ir_node *c);
2711 /** Constructor for a Return node.
2713 * Adds the node to the block in current_ir_block.
2715 * Returns the memory and zero or more return values. Only node that
2716 * can end regular control flow.
2718 * @param *db A pointer for debug information.
2719 * @param *store The state of memory.
2720 * @param arity Number of array indices.
2721 * @param *in Array with index inputs to the node.
2723 FIRM_API ir_node *new_d_Return(dbg_info *db, ir_node *store,
2724 int arity, ir_node *in[]);
2726 /** Constructor for a Const node.
2728 * Adds the node to the block in current_ir_block.
2730 * Constructor for a Const node. The constant represents a target
2731 * value. Sets the type information to type_unknown. (No more
2732 * supported: If tv is entity derives a somehow useful type.)
2733 * Derives mode from passed tarval.
2735 * @param *db A pointer for debug information.
2736 * @param *con Points to an entry in the constant table. This pointer is added
2737 * to the attributes of the node.
2739 FIRM_API ir_node *new_d_Const(dbg_info *db, ir_tarval *con);
2742 * @see new_rd_Const_long()
2744 * @param *db A pointer for debug information.
2745 * @param *mode The mode of the operands and results.
2746 * @param value A value from which the tarval is made.
2748 FIRM_API ir_node *new_d_Const_long(dbg_info *db, ir_mode *mode, long value);
2750 /** Constructor for a SymConst node.
2752 * This is the constructor for a symbolic constant.
2753 * There are several kinds of symbolic constants:
2754 * - symconst_type_tag The symbolic constant represents a type tag. The
2755 * type the tag stands for is given explicitly.
2756 * - symconst_type_size The symbolic constant represents the size of a type.
2757 * The type of which the constant represents the size
2758 * is given explicitly.
2759 * - symconst_type_align The symbolic constant represents the alignment of a
2760 * type. The type of which the constant represents the
2761 * size is given explicitly.
2762 * - symconst_addr_ent The symbolic constant represents the address of an
2763 * entity (variable or method). The variable is given
2764 * explicitly by a firm entity.
2765 * - symconst_ofs_ent The symbolic constant represents the offset of an
2766 * entity in its owner type.
2767 * - symconst_enum_const The symbolic constant is a enumeration constant of
2768 * an enumeration type.
2770 * Inputs to the node:
2771 * No inputs except the block it belongs to.
2772 * Outputs of the node.
2773 * An unsigned integer (I_u) or a pointer (P).
2775 * Mention union in declaration so that the firmjni generator recognizes that
2776 * it can not cast the argument to an int.
2778 * @param *db A pointer for debug information.
2779 * @param mode The mode for the SymConst.
2780 * @param value A type, ident, entity or enum constant depending on the
2782 * @param kind The kind of the symbolic constant, see the list above
2784 FIRM_API ir_node *new_d_SymConst(dbg_info *db, ir_mode *mode,
2785 union symconst_symbol value,
2786 symconst_kind kind);
2788 /** Constructor for a simpleSel node.
2790 * This is a shortcut for the new_d_Sel() constructor. To be used for
2791 * Sel nodes that do not select from an array, i.e., have no index
2792 * inputs. It adds the two parameters 0, NULL.
2794 * @param *db A pointer for debug information.
2795 * @param *store The memory in which the object the entity should be
2796 * selected from is allocated.
2797 * @param *objptr The object from that the Sel operation selects a
2798 * single attribute out.
2799 * @param *ent The entity to select.
2801 FIRM_API ir_node *new_d_simpleSel(dbg_info *db, ir_node *store, ir_node *objptr,
2804 /** Constructor for a Sel node.
2806 * The select node selects an entity (field or method) from an entity
2807 * with a compound type. It explicitly specifies the entity selected.
2808 * Dynamically the node may select entities that overwrite the given
2809 * entity. If the selected entity is an array element entity the Sel
2810 * node takes the required array indices as inputs.
2811 * Adds the node to the block in current_ir_block.
2813 * @param *db A pointer for debug information.
2814 * @param *store The memory in which the object the entity should be selected
2815 * from is allocated.
2816 * @param *objptr A pointer to a compound entity the Sel operation selects a
2817 * single attribute from.
2818 * @param arity The number of array indices needed to select an array element entity.
2819 * @param *in[] If the compound entity is an array the indices of the selected
2820 * element entity. The constructor copies this array.
2821 * @param *ent The entity to select.
2823 FIRM_API ir_node *new_d_Sel(dbg_info *db, ir_node *store, ir_node *objptr,
2824 int arity, ir_node *in[], ir_entity *ent);
2826 /** Constructor for a Call node.
2828 * Represents all kinds of method and function calls.
2829 * Adds the node to the block in current_ir_block.
2831 * @param *db A pointer for debug information.
2832 * @param *store The actual store.
2833 * @param *callee A pointer to the called procedure.
2834 * @param arity The number of procedure parameters.
2835 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2836 * @param *tp Type information of the procedure called.
2838 FIRM_API ir_node *new_d_Call(dbg_info *db, ir_node *store, ir_node *callee,
2839 int arity, ir_node *in[], ir_type *tp);
2841 /** Constructor for a Builtin node.
2843 * Represents a call of a backend-specific builtin..
2844 * Adds the node to the block in current_ir_block.
2846 * @param *db A pointer for debug information.
2847 * @param *store The actual store.
2848 * @param arity The number of procedure parameters.
2849 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2850 * @param kind The kind of the called builtin.
2851 * @param *tp Type information of the procedure called.
2853 FIRM_API ir_node *new_d_Builtin(dbg_info *db, ir_node *store,
2854 int arity, ir_node *in[],
2855 ir_builtin_kind kind, ir_type *tp);
2857 /** Constructor for a Add node.
2859 * Adds the node to the block in current_ir_block.
2861 * @param *db A pointer for debug information.
2862 * @param *op1 The first operand.
2863 * @param *op2 The second operand.
2864 * @param *mode The mode of the operands and the result.
2866 FIRM_API ir_node *new_d_Add(dbg_info *db, ir_node *op1, ir_node *op2,
2869 /** Constructor for a Sub node.
2871 * Adds the node to the block in current_ir_block.
2873 * @param *db A pointer for debug information.
2874 * @param *op1 The first operand.
2875 * @param *op2 The second operand.
2876 * @param *mode The mode of the operands and the result.
2878 FIRM_API ir_node *new_d_Sub(dbg_info *db, ir_node *op1, ir_node *op2,
2881 /** Constructor for a Minus node.
2883 * Adds the node to the block in current_ir_block.
2885 * @param *db A pointer for debug information.
2886 * @param *op The operand .
2887 * @param *mode The mode of the operand and the result.
2889 FIRM_API ir_node *new_d_Minus(dbg_info *db, ir_node *op, ir_mode *mode);
2891 /** Constructor for a Mul node.
2893 * Adds the node to the block in current_ir_block.
2895 * @param *db A pointer for debug information.
2896 * @param *op1 The first operand.
2897 * @param *op2 The second operand.
2898 * @param *mode The mode of the operands and the result.
2900 FIRM_API ir_node *new_d_Mul(dbg_info *db, ir_node *op1, ir_node *op2,
2903 /** Constructor for a Mulh node.
2905 * Adds the node to the block in current_ir_block.
2907 * @param *db A pointer for debug information.
2908 * @param *op1 The first operand.
2909 * @param *op2 The second operand.
2910 * @param *mode The mode of the operands and the result.
2912 FIRM_API ir_node *new_d_Mulh(dbg_info *db, ir_node *op1, ir_node *op2,
2915 /** Constructor for a Quot node.
2917 * Adds the node to the block in current_ir_block.
2919 * @param *db A pointer for debug information.
2920 * @param *memop The store needed to model exceptions
2921 * @param *op1 The first operand.
2922 * @param *op2 The second operand.
2923 * @param *mode The mode of the result.
2924 * @param state The pinned state.
2926 FIRM_API ir_node *new_d_Quot(dbg_info *db, ir_node *memop,
2927 ir_node *op1, ir_node *op2, ir_mode *mode,
2928 op_pin_state state);
2930 /** Constructor for a DivMod node.
2932 * Adds the node to the block in current_ir_block.
2934 * @param *db A pointer for debug information.
2935 * @param *memop The store needed to model exceptions
2936 * @param *op1 The first operand.
2937 * @param *op2 The second operand.
2938 * @param *mode The mode of the results.
2939 * @param state The pinned state.
2941 FIRM_API ir_node *new_d_DivMod(dbg_info *db, ir_node *memop, ir_node *op1,
2942 ir_node *op2, ir_mode *mode, op_pin_state state);
2944 /** Constructor for a Div node.
2946 * Adds the node to the block in current_ir_block.
2948 * @param *db A pointer for debug information.
2949 * @param *memop The store needed to model exceptions
2950 * @param *op1 The first operand.
2951 * @param *op2 The second operand.
2952 * @param *mode The mode of the result.
2953 * @param state The pinned state.
2955 FIRM_API ir_node *new_d_Div(dbg_info *db, ir_node *memop, ir_node *op1,
2956 ir_node *op2, ir_mode *mode, op_pin_state state);
2958 /** Constructor for a remainderless Div node.
2960 * Adds the node to the block in current_ir_block.
2962 * @param *db A pointer for debug information.
2963 * @param *memop The store needed to model exceptions
2964 * @param *op1 The first operand.
2965 * @param *op2 The second operand.
2966 * @param *mode The mode of the result.
2967 * @param state The pinned state.
2969 FIRM_API ir_node *new_d_DivRL(dbg_info *db, ir_node *memop,
2970 ir_node *op1, ir_node *op2, ir_mode *mode,
2971 op_pin_state state);
2973 /** Constructor for a Mod node.
2975 * Adds the node to the block in current_ir_block.
2977 * @param *db A pointer for debug information.
2978 * @param *memop The store needed to model exceptions
2979 * @param *op1 The first operand.
2980 * @param *op2 The second operand.
2981 * @param *mode The mode of the result.
2982 * @param state The pinned state.
2984 FIRM_API ir_node *new_d_Mod(dbg_info *db, ir_node *memop,
2985 ir_node *op1, ir_node *op2, ir_mode *mode,
2986 op_pin_state state);
2988 /** Constructor for a And node.
2990 * Adds the node to the block in current_ir_block.
2992 * @param *db A pointer for debug information.
2993 * @param *op1 The first operand.
2994 * @param *op2 The second operand.
2995 * @param *mode The mode of the operands and the result.
2997 FIRM_API ir_node *new_d_And(dbg_info *db, ir_node *op1, ir_node *op2,
3000 /** Constructor for a Or node.
3002 * Adds the node to the block in current_ir_block.
3004 * @param *db A pointer for debug information.
3005 * @param *op1 The first operand.
3006 * @param *op2 The second operand.
3007 * @param *mode The mode of the operands and the result.
3009 FIRM_API ir_node *new_d_Or(dbg_info *db, ir_node *op1, ir_node *op2,
3012 /** Constructor for a Eor node.
3014 * Adds the node to the block in current_ir_block.
3016 * @param *db A pointer for debug information.
3017 * @param *op1 The first operand.
3018 * @param *op2 The second operand.
3019 * @param *mode The mode of the operands and the results.
3021 FIRM_API ir_node *new_d_Eor(dbg_info *db, ir_node *op1, ir_node *op2,
3024 /** Constructor for a Not node.
3026 * Adds the node to the block in current_ir_block.
3028 * @param *db A pointer for debug information.
3029 * @param *op The operand.
3030 * @param *mode The mode of the operand and the result.
3032 FIRM_API ir_node *new_d_Not(dbg_info *db, ir_node *op, ir_mode *mode);
3034 /** Constructor for a Shl node.
3036 * Adds the node to the block in current_ir_block.
3038 * @param *db A pointer for debug information.
3039 * @param *op The operand.
3040 * @param *k The number of bits to shift the operand .
3041 * @param *mode The mode of the operand and the result.
3043 FIRM_API ir_node *new_d_Shl(dbg_info *db, ir_node *op, ir_node *k,
3046 /** Constructor for a Shr node.
3048 * Adds the node to the block in current_ir_block.
3050 * @param *db A pointer for debug information.
3051 * @param *op The operand.
3052 * @param *k The number of bits to shift the operand .
3053 * @param *mode The mode of the operand and the result.
3055 FIRM_API ir_node *new_d_Shr(dbg_info *db, ir_node *op, ir_node *k,
3058 /** Constructor for a Shrs node.
3060 * Adds the node to the block in current_ir_block.
3062 * @param *db A pointer for debug information.
3063 * @param *op The operand.
3064 * @param *k The number of bits to shift the operand .
3065 * @param *mode The mode of the operand and the result.
3067 FIRM_API ir_node *new_d_Shrs(dbg_info *db, ir_node *op, ir_node *k,
3070 /** Constructor for a Rotl node.
3072 * Adds the node to the block in current_ir_block.
3074 * @param *db A pointer for debug information.
3075 * @param *op The operand.
3076 * @param *k The number of bits to rotate the operand.
3077 * @param *mode The mode of the operand.
3079 FIRM_API ir_node *new_d_Rotl(dbg_info *db, ir_node *op, ir_node *k,
3082 /** Constructor for a Cmp node.
3084 * Adds the node to the block in current_ir_block.
3086 * @param *db A pointer for debug information.
3087 * @param *op1 The first operand.
3088 * @param *op2 The second operand.
3090 FIRM_API ir_node *new_d_Cmp(dbg_info *db, ir_node *op1, ir_node *op2);
3092 /** Constructor for a Conv node.
3094 * Adds the node to the block in current_ir_block.
3096 * @param *db A pointer for debug information.
3097 * @param *op The operand.
3098 * @param *mode The mode of this the operand muss be converted .
3100 FIRM_API ir_node *new_d_Conv(dbg_info *db, ir_node *op, ir_mode *mode);
3102 /** Constructor for a strict Conv node.
3104 * Adds the node to the block in current_ir_block.
3106 * @param *db A pointer for debug information.
3107 * @param *op The operand.
3108 * @param *mode The mode of this the operand muss be converted .
3110 FIRM_API ir_node *new_d_strictConv(dbg_info *db, ir_node *op, ir_mode *mode);
3112 /** Constructor for a Cast node.
3114 * High level type cast
3115 * Adds the node to the block in current_ir_block.
3117 * @param *db A pointer for debug information.
3118 * @param *op The operand.
3119 * @param *to_tp The type of this the operand muss be casted .
3121 FIRM_API ir_node *new_d_Cast(dbg_info *db, ir_node *op, ir_type *to_tp);
3123 /** Constructor for a Carry node.
3125 * Adds the node to the block in current_ir_block.
3127 * @param *db A pointer for debug information.
3128 * @param *op1 The first operand.
3129 * @param *op2 The second operand.
3130 * @param *mode The mode of the operands and the result.
3132 FIRM_API ir_node *new_d_Carry(dbg_info *db, ir_node *op1, ir_node *op2,
3135 /** Constructor for a Borrow node.
3137 * Adds the node to the block in current_ir_block.
3139 * @param *db A pointer for debug information.
3140 * @param *op1 The first operand.
3141 * @param *op2 The second operand.
3142 * @param *mode The mode of the operands and the result.
3144 FIRM_API ir_node *new_d_Borrow(dbg_info *db, ir_node *op1, ir_node *op2,
3147 /** Constructor for a Phi node.
3149 * Adds the node to the block in current_ir_block.
3151 * @param *db A pointer for debug information.
3152 * @param arity The number of predecessors
3153 * @param *in Array with predecessors
3154 * @param *mode The mode of it's inputs and output.
3156 FIRM_API ir_node *new_d_Phi(dbg_info *db, int arity, ir_node *in[],
3159 /** Constructor for a Load node.
3161 * Adds the node to the block in current_ir_block.
3163 * @param *db A pointer for debug information.
3164 * @param *store The current memory
3165 * @param *addr A pointer to the variable to be read in this memory.
3166 * @param *mode The mode of the value to be loaded.
3167 * @param flags Additional flags for alignment, volatility and pin state.
3169 FIRM_API ir_node *new_d_Load(dbg_info *db, ir_node *store, ir_node *addr,
3170 ir_mode *mode, ir_cons_flags flags);
3172 /** Constructor for a Store node.
3174 * Adds the node to the block in current_ir_block.
3176 * @param *db A pointer for debug information.
3177 * @param *store The current memory
3178 * @param *addr A pointer to the variable to be read in this memory.
3179 * @param *val The value to write to this variable.
3180 * @param flags Additional flags for alignment, volatility and pin state.
3182 FIRM_API ir_node *new_d_Store(dbg_info *db, ir_node *store, ir_node *addr,
3183 ir_node *val, ir_cons_flags flags);
3185 /** Constructor for a Alloc node.
3187 * The Alloc node extends the memory by space for an entity of type alloc_type.
3188 * Adds the node to the block in current_ir_block.
3190 * @param *db A pointer for debug information.
3191 * @param *store The memory which shall contain the new variable.
3192 * @param *count The number of objects to allocate.
3193 * @param *alloc_type The type of the allocated variable.
3194 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3196 FIRM_API ir_node *new_d_Alloc(dbg_info *db, ir_node *store, ir_node *count,
3197 ir_type *alloc_type, ir_where_alloc where);
3199 /** Constructor for a Free node.
3201 * Frees the memory occupied by the entity pointed to by the pointer
3202 * arg. Type indicates the type of the entity the argument points to.
3203 * Adds the node to the block in current_ir_block.
3205 * @param *db A pointer for debug information.
3206 * @param *store The memory which shall contain the new variable.
3207 * @param *ptr The pointer to the object to free.
3208 * @param *size The number of objects of type free_type to free in a sequence.
3209 * @param *free_type The type of the freed variable.
3210 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
3212 FIRM_API ir_node *new_d_Free(dbg_info *db, ir_node *store, ir_node *ptr,
3213 ir_node *size, ir_type *free_type,
3214 ir_where_alloc where);
3216 /** Constructor for a Sync node.
3218 * Merges several memory values. The node assumes that a variable
3219 * either occurs only in one of the memories, or it contains the same
3220 * value in all memories where it occurs.
3221 * Adds the node to the block in current_ir_block.
3223 * @param *db A pointer for debug information.
3224 * @param arity The number of memories to synchronize.
3225 * @param **in An array of pointers to nodes that produce an output of type
3226 * memory. The constructor copies this array.
3228 FIRM_API ir_node *new_d_Sync(dbg_info *db, int arity, ir_node *in[]);
3230 /** Constructor for a Proj node.
3232 * Projects a single value out of a tuple. The parameter proj gives the
3233 * position of the value within the tuple.
3234 * Adds the node to the block in current_ir_block.
3236 * @param *db A pointer for deubug information.
3237 * @param arg A node producing a tuple.
3238 * @param *mode The mode of the value to project.
3239 * @param proj The position of the value in the tuple.
3241 FIRM_API ir_node *new_d_Proj(dbg_info *db, ir_node *arg, ir_mode *mode,
3244 /** Constructor for a defaultProj node.
3246 * Represents the default control flow of a Switch-Cond node.
3247 * Adds the node to the block in current_ir_block.
3249 * @param *db A pointer for debug information.
3250 * @param arg A node producing a tuple.
3251 * @param max_proj The end position of the value in the tuple.
3253 FIRM_API ir_node *new_d_defaultProj(dbg_info *db, ir_node *arg, long max_proj);
3255 /** Constructor for a Tuple node.
3257 * This is an auxiliary node to replace a node that returns a tuple
3258 * without changing the corresponding Proj nodes.
3259 * Adds the node to the block in current_ir_block.
3261 * @param *db A pointer for debug information.
3262 * @param arity The number of tuple elements.
3263 * @param **in An array containing pointers to the nodes producing the tuple elements.
3265 FIRM_API ir_node *new_d_Tuple(dbg_info *db, int arity, ir_node *in[]);
3267 /** Constructor for a Id node.
3269 * This is an auxiliary node to replace a node that returns a single
3270 * value. Adds the node to the block in current_ir_block.
3272 * @param *db A pointer for debug information.
3273 * @param *val The operand to Id.
3274 * @param *mode The mode of *val.
3276 FIRM_API ir_node *new_d_Id(dbg_info *db, ir_node *val, ir_mode *mode);
3278 /** Constructor for a Bad node.
3280 * @param *db A pointer for debug information.
3282 FIRM_API ir_node *new_d_Bad(dbg_info *db);
3284 /** Constructor for a Confirm node.
3286 * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3287 * Specifies constraints for a value. To support dataflow analyses.
3289 * Example: If the value never exceeds '100' this is expressed by placing a
3290 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
3292 * @param *db A pointer for debug information.
3293 * @param *val The value we express a constraint for
3294 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3295 * @param cmp The compare operation.
3297 FIRM_API ir_node *new_d_Confirm(dbg_info *db, ir_node *val, ir_node *bound,
3300 /** Constructor for an Unknown node.
3302 * Represents an arbitrary value. Places the node in
3305 * @param *db A pointer for debug information.
3306 * @param *m The mode of the unknown value.
3308 FIRM_API ir_node *new_d_Unknown(dbg_info *db, ir_mode *m);
3310 /** Constructor for a NoMem node.
3312 * @param *db A pointer for debug information.
3314 FIRM_API ir_node *new_d_NoMem(dbg_info *db);
3316 /** Constructor for a Mux node.
3318 * @param *db A pointer for debug information.
3319 * @param *sel The ir_node that calculates the boolean select.
3320 * @param *ir_true The ir_node that calculates the true result.
3321 * @param *ir_false The ir_node that calculates the false result.
3322 * @param *mode The mode of the node (and it_true and ir_false).
3324 FIRM_API ir_node *new_d_Mux(dbg_info *db, ir_node *sel,
3325 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
3327 /** Constructor for a CopyB node.
3329 * @param *db A pointer for debug information.
3330 * @param *store The current memory
3331 * @param *dst The ir_node that represents the destination address.
3332 * @param *src The ir_node that represents the source address.
3333 * @param *data_type The type of the copied data
3335 FIRM_API ir_node *new_d_CopyB(dbg_info *db, ir_node *store, ir_node *dst,
3336 ir_node *src, ir_type *data_type);
3338 /** Constructor for a InstOf node.
3340 * A High-Level Type check.
3342 * @param *db A pointer for debug information.
3343 * @param *store The memory in which the object the entity should be selected
3344 * from is allocated.
3345 * @param *objptr A pointer to a object of a class type.
3346 * @param *type The type of which objptr must be.
3348 FIRM_API ir_node *new_d_InstOf(dbg_info *db, ir_node *store, ir_node *objptr,
3351 /** Constructor for a Raise node.
3353 * A High-Level Exception throw.
3355 * @param *db A pointer for debug information.
3356 * @param *store The current memory.
3357 * @param *obj A pointer to the Except variable.
3359 FIRM_API ir_node *new_d_Raise(dbg_info *db, ir_node *store, ir_node *obj);
3361 /** Constructor for a Bound node.
3363 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
3365 * @param *db A pointer for debug information.
3366 * @param *store The current memory
3367 * @param *idx The ir_node that represents an index.
3368 * @param *lower The ir_node that represents the lower bound for the index.
3369 * @param *upper The ir_node that represents the upper bound for the index.
3371 FIRM_API ir_node *new_d_Bound(dbg_info *db, ir_node *store, ir_node *idx,
3372 ir_node *lower, ir_node *upper);
3374 /** Constructor for a Pin node.
3376 * @param *db A pointer for debug information.
3377 * @param *node The node which value should be pinned.
3379 FIRM_API ir_node *new_d_Pin(dbg_info *db, ir_node *node);
3381 /** Constructor for an ASM pseudo node.
3383 * @param *db A pointer for debug information.
3384 * @param arity The number of data inputs to the node.
3385 * @param *in The array of length arity of data inputs.
3386 * @param *inputs The array of length arity of input constraints.
3387 * @param n_outs The number of data outputs to the node.
3388 * @param *outputs The array of length n_outs of output constraints.
3389 * @param n_clobber The number of clobbered registers.
3390 * @param *clobber The array of length n_clobber of clobbered registers.
3391 * @param *asm_text The assembler text.
3393 FIRM_API ir_node *new_d_ASM(dbg_info *db, int arity, ir_node *in[],
3394 ir_asm_constraint *inputs,
3395 int n_outs, ir_asm_constraint *outputs,
3396 int n_clobber, ident *clobber[], ident *asm_text);
3398 /*-----------------------------------------------------------------------*/
3399 /* The block oriented interface without debug support */
3400 /*-----------------------------------------------------------------------*/
3402 /** Constructor for a Block node.
3404 * Constructor for a Block node. Adds the block to the graph in
3405 * current_ir_graph. Constructs a Block with a fixed number of predecessors.
3407 * @param arity The number of control predecessors.
3408 * @param in An array of control predecessors. The length of
3409 * the array must be 'arity'.
3411 FIRM_API ir_node *new_Block(int arity, ir_node *in[]);
3413 /** Constructor for a Start node.
3415 * Adds the node to the block in current_ir_block.
3418 FIRM_API ir_node *new_Start(void);
3420 /** Constructor for an End node.
3422 * Adds the node to the block in current_ir_block.
3424 FIRM_API ir_node *new_End(int arity, ir_node *in[]);
3426 /** Constructor for a Jump node.
3428 * Adds the node to the block in current_ir_block.
3430 * Jmp represents control flow to a single control successor.
3432 FIRM_API ir_node *new_Jmp(void);
3434 /** Constructor for an IJmp node.
3436 * IJmp represents control flow to a single control successor not
3437 * statically known i.e. an indirect Jmp.
3439 * @param *tgt The IR node representing the target address.
3441 FIRM_API ir_node *new_IJmp(ir_node *tgt);
3443 /** Constructor for a Cond node.
3445 * If c is mode_b represents a conditional branch (if/else). If c is
3446 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
3447 * node, default Proj is 0.). Adds the node to the block in current_ir_block.
3449 * This is not consistent: Input to Cond is Is, Proj has as proj number
3453 * @param *c The conditions parameter.Can be of mode b or I_u.
3455 FIRM_API ir_node *new_Cond(ir_node *c);
3457 /** Constructor for a Return node.
3459 * Returns the memory and zero or more return values. Only node that
3460 * can end regular control flow. Adds the node to the block in current_ir_block.
3462 * @param *store The state of memory.
3463 * @param arity Number of array indices.
3464 * @param *in Array with index inputs to the node.
3466 FIRM_API ir_node *new_Return(ir_node *store, int arity, ir_node *in[]);
3468 /** Constructor for a Const node.
3470 * Constructor for a Const node. The constant represents a target
3471 * value. Sets the type information to type_unknown. (No more
3472 * supported: If tv is entity derives a somehow useful type.)
3473 * Adds the node to the block in current_ir_block.
3474 * Derives mode from passed tarval.
3476 * @param *con Points to an entry in the constant table. This pointer is
3477 * added to the attributes of the node.
3479 FIRM_API ir_node *new_Const(ir_tarval *con);
3482 * Make a const from a long.
3483 * This is just convenience for the usual
3485 * new_Const(mode, tarval_from_long(mode, ...))
3488 * @param mode The mode for the const.
3489 * @param value The value of the constant.
3490 * @return A new const node.
3492 FIRM_API ir_node *new_Const_long(ir_mode *mode, long value);
3494 /** Constructor for a SymConst node.
3496 * This is the constructor for a symbolic constant.
3497 * There are several kinds of symbolic constants:
3498 * - symconst_type_tag The symbolic constant represents a type tag. The
3499 * type the tag stands for is given explicitly.
3500 * - symconst_type_size The symbolic constant represents the size of a type.
3501 * The type of which the constant represents the size
3502 * is given explicitly.
3503 * - symconst_type_align The symbolic constant represents the alignment of a
3504 * type. The type of which the constant represents the
3505 * size is given explicitly.
3506 * - symconst_addr_ent The symbolic constant represents the address of an
3507 * entity (variable or method). The variable is given
3508 * explicitly by a firm entity.
3509 * - symconst_ofs_ent The symbolic constant represents the offset of an
3510 * entity in its owner type.
3511 * - symconst_enum_const The symbolic constant is a enumeration constant of
3512 * an enumeration type.
3514 * Inputs to the node:
3515 * No inputs except the block it belongs to.
3516 * Outputs of the node.
3517 * An unsigned integer (I_u) or a pointer (P).
3519 * Mention union in declaration so that the firmjni generator recognizes that
3520 * it can not cast the argument to an int.
3522 * @param mode The mode for the SymConst.
3523 * @param value A type, ident, entity or enum constant depending on the
3525 * @param kind The kind of the symbolic constant, see the list above
3527 FIRM_API ir_node *new_SymConst(ir_mode *mode, union symconst_symbol value,
3528 symconst_kind kind);
3530 /** Constructor for a simpelSel node.
3532 * This is a shortcut for the new_Sel() constructor. To be used for
3533 * Sel nodes that do not select from an array, i.e., have no index
3534 * inputs. It adds the two parameters 0, NULL.
3536 * @param *store The memory in which the object the entity should be selected from is allocated.
3537 * @param *objptr The object from that the Sel operation selects a single attribute out.
3538 * @param *ent The entity to select.
3540 FIRM_API ir_node *new_simpleSel(ir_node *store, ir_node *objptr,
3543 /** Constructor for a Sel node.
3545 * The select node selects an entity (field or method) from an entity
3546 * with a compound type. It explicitly specifies the entity selected.
3547 * Dynamically the node may select entities that overwrite the given
3548 * entity. If the selected entity is an array element entity the Sel
3549 * node takes the required array indices as inputs.
3550 * Adds the node to the block in current_ir_block.
3552 * @param *store The memory in which the object the entity should be selected
3553 * from is allocated.
3554 * @param *objptr A pointer to a compound entity the Sel operation selects a
3555 * single attribute from.
3556 * @param arity The number of array indices needed to select an array element entity.
3557 * @param *in[] If the compound entity is an array the indices of the selected
3558 * element entity. The constructor copies this array.
3559 * @param *ent The entity to select.
3561 FIRM_API ir_node *new_Sel(ir_node *store, ir_node *objptr,
3562 int arity, ir_node *in[], ir_entity *ent);
3564 /** Constructor for a Call node.
3566 * Adds the node to the block in current_ir_block.
3567 * Represents all kinds of method and function calls.
3569 * @param *store The actual store.
3570 * @param *callee A pointer to the called procedure.
3571 * @param arity The number of procedure parameters.
3572 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3573 * @param *tp Type information of the procedure called.
3575 FIRM_API ir_node *new_Call(ir_node *store, ir_node *callee,
3576 int arity, ir_node *in[], ir_type *tp);
3578 /** Constructor for a Builtin node.
3580 * Represents a call of a backend-specific builtin..
3581 * Represents all kinds of method and function calls.
3583 * @param *store The actual store.
3584 * @param kind The kind of the called builtin.
3585 * @param arity The number of procedure parameters.
3586 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3587 * @param *tp Type information of the procedure called.
3589 FIRM_API ir_node *new_Builtin(ir_node *store, int arity, ir_node *in[],
3590 ir_builtin_kind kind, ir_type *tp);
3592 /** Constructor for a Add node.
3594 * Adds the node to the block in current_ir_block.
3596 * @param *op1 The first operand.
3597 * @param *op2 The second operand.
3598 * @param *mode The mode of the operands and the result.
3600 FIRM_API ir_node *new_Add(ir_node *op1, ir_node *op2, ir_mode *mode);
3602 /** Constructor for a Sub node.
3604 * Adds the node to the block in current_ir_block.
3606 * @param *op1 The first operand.
3607 * @param *op2 The second operand.
3608 * @param *mode The mode of the operands and the result.
3610 FIRM_API ir_node *new_Sub(ir_node *op1, ir_node *op2, ir_mode *mode);
3612 /** Constructor for a Minus node.
3614 * Adds the node to the block in current_ir_block.
3616 * @param *op The operand .
3617 * @param *mode The mode of the operand and the result.
3619 FIRM_API ir_node *new_Minus(ir_node *op, ir_mode *mode);
3622 * Constructor for a Mul node. Adds the node to the block in current_ir_block.
3624 * @param *op1 The first operand.
3625 * @param *op2 The second operand.
3626 * @param *mode The mode of the operands and the result.
3628 FIRM_API ir_node *new_Mul(ir_node *op1, ir_node *op2, ir_mode *mode);
3631 * Constructor for a Mulh node. Adds the node to the block in current_ir_block.
3633 * @param *op1 The first operand.
3634 * @param *op2 The second operand.
3635 * @param *mode The mode of the operands and the result.
3637 FIRM_API ir_node *new_Mulh(ir_node *op1, ir_node *op2, ir_mode *mode);
3639 /** Constructor for a Quot node.
3641 * Adds the node to the block in current_ir_block.
3643 * @param *memop The store needed to model exceptions
3644 * @param *op1 The first operand.
3645 * @param *op2 The second operand.
3646 * @param *mode The mode of the result.
3647 * @param state The pinned state.
3649 FIRM_API ir_node *new_Quot(ir_node *memop, ir_node *op1, ir_node *op2,
3650 ir_mode *mode, op_pin_state state);
3652 /** Constructor for a DivMod node.
3654 * Adds the node to the block in current_ir_block.
3656 * @param *memop The store needed to model exceptions
3657 * @param *op1 The first operand.
3658 * @param *op2 The second operand.
3659 * @param *mode The mode of the results.
3660 * @param state The pinned state.
3662 FIRM_API ir_node *new_DivMod(ir_node *memop, ir_node *op1, ir_node *op2,
3663 ir_mode *mode, op_pin_state state);
3665 /** Constructor for a Div node.
3667 * Adds the node to the block in current_ir_block.
3669 * @param *memop The store needed to model exceptions
3670 * @param *op1 The first operand.
3671 * @param *op2 The second operand.
3672 * @param *mode The mode of the result.
3673 * @param state The pinned state.
3675 FIRM_API ir_node *new_Div(ir_node *memop, ir_node *op1, ir_node *op2,
3676 ir_mode *mode, op_pin_state state);
3678 /** Constructor for a remainderless Div node.
3680 * Adds the node to the block in current_ir_block.
3682 * @param *memop The store needed to model exceptions
3683 * @param *op1 The first operand.
3684 * @param *op2 The second operand.
3685 * @param *mode The mode of the result.
3686 * @param state The pinned state.
3688 FIRM_API ir_node *new_DivRL(ir_node *memop, ir_node *op1, ir_node *op2,
3689 ir_mode *mode, op_pin_state state);
3691 /** Constructor for a Mod node.
3693 * Adds the node to the block in current_ir_block.
3695 * @param *memop The store needed to model exceptions
3696 * @param *op1 The first operand.
3697 * @param *op2 The second operand.
3698 * @param *mode The mode of the result.
3699 * @param state The pinned state.
3701 FIRM_API ir_node *new_Mod(ir_node *memop, ir_node *op1, ir_node *op2,
3702 ir_mode *mode, op_pin_state state);
3704 /** Constructor for a And node.
3706 * Adds the node to the block in current_ir_block.
3708 * @param *op1 The first operand.
3709 * @param *op2 The second operand.
3710 * @param *mode The mode of the operands and the result.
3712 FIRM_API ir_node *new_And(ir_node *op1, ir_node *op2, ir_mode *mode);
3715 * Constructor for a Or node. Adds the node to the block in current_ir_block.
3717 * @param *op1 The first operand.
3718 * @param *op2 The second operand.
3719 * @param *mode The mode of the operands and the result.
3721 FIRM_API ir_node *new_Or(ir_node *op1, ir_node *op2, ir_mode *mode);
3724 * Constructor for a Eor node. Adds the node to the block in current_ir_block.
3726 * @param *op1 The first operand.
3727 * @param *op2 The second operand.
3728 * @param *mode The mode of the operands and the results.
3730 FIRM_API ir_node *new_Eor(ir_node *op1, ir_node *op2, ir_mode *mode);
3732 /** Constructor for a Not node.
3734 * Adds the node to the block in current_ir_block.
3736 * @param *op The operand.
3737 * @param *mode The mode of the operand and the result.
3739 FIRM_API ir_node *new_Not(ir_node *op, ir_mode *mode);
3741 /** Constructor for a Shl node.
3743 * Adds the node to the block in current_ir_block.
3745 * @param *op The operand.
3746 * @param *k The number of bits to shift the operand .
3747 * @param *mode The mode of the operand and the result.
3749 FIRM_API ir_node *new_Shl(ir_node *op, ir_node *k, ir_mode *mode);
3752 * Constructor for a Shr node. Adds the node to the block in current_ir_block.
3754 * @param *op The operand.
3755 * @param *k The number of bits to shift the operand .
3756 * @param *mode The mode of the operand and the result.
3758 FIRM_API ir_node *new_Shr(ir_node *op, ir_node *k, ir_mode *mode);
3760 /** Constructor for a Shrs node.
3762 * Adds the node to the block in current_ir_block.
3764 * @param *op The operand.
3765 * @param *k The number of bits to shift the operand .
3766 * @param *mode The mode of the operand and the result.
3768 FIRM_API ir_node *new_Shrs(ir_node *op, ir_node *k, ir_mode *mode);
3770 /** Constructor for a Rotl node.
3772 * Adds the node to the block in current_ir_block.
3774 * @param *op The operand.
3775 * @param *k The number of bits to rotate the operand.
3776 * @param *mode The mode of the operand.
3778 FIRM_API ir_node *new_Rotl(ir_node *op, ir_node *k, ir_mode *mode);
3780 /** Constructor for a Cmp node.
3782 * Adds the node to the block in current_ir_block.
3784 * @param *op1 The first operand.
3785 * @param *op2 The second operand.
3787 FIRM_API ir_node *new_Cmp(ir_node *op1, ir_node *op2);
3789 /** Constructor for a Conv node.
3791 * Adds the node to the block in current_ir_block.
3793 * @param *op The operand.
3794 * @param *mode The mode of this the operand muss be converted.
3796 FIRM_API ir_node *new_Conv(ir_node *op, ir_mode *mode);
3798 /** Constructor for a strict Conv node.
3800 * Adds the node to the block in current_ir_block.
3802 * @param *op The operand.
3803 * @param *mode The mode of this the operand muss be converted.
3805 FIRM_API ir_node *new_strictConv(ir_node *op, ir_mode *mode);
3807 /** Constructor for a Cast node.
3809 * Adds the node to the block in current_ir_block.
3810 * High level type cast
3812 * @param *op The operand.
3813 * @param *to_tp The type of this the operand muss be casted .
3815 FIRM_API ir_node *new_Cast(ir_node *op, ir_type *to_tp);
3817 /** Constructor for a Carry node.
3819 * Adds the node to the block in current_ir_block.
3821 * @param *op1 The first operand.
3822 * @param *op2 The second operand.
3823 * @param *mode The mode of the operands and the result.
3825 FIRM_API ir_node *new_Carry(ir_node *op1, ir_node *op2, ir_mode *mode);
3827 /** Constructor for a Borrow node.
3829 * Adds the node to the block in current_ir_block.
3831 * @param *op1 The first operand.
3832 * @param *op2 The second operand.
3833 * @param *mode The mode of the operands and the result.
3835 FIRM_API ir_node *new_Borrow(ir_node *op1, ir_node *op2, ir_mode *mode);
3837 /** Constructor for a Phi node.
3839 * Adds the node to the block in current_ir_block.
3841 * @param arity The number of predecessors.
3842 * @param *in Array with predecessors.
3843 * @param *mode The mode of it's inputs and output.
3845 FIRM_API ir_node *new_Phi(int arity, ir_node *in[], ir_mode *mode);
3847 /** Constructor for a Load node.
3849 * @param *store The current memory.
3850 * @param *addr A pointer to the variable to be read in this memory.
3851 * @param *mode The mode of the value to be loaded.
3852 * @param flags Additional flags for alignment, volatility and pin state.
3854 FIRM_API ir_node *new_Load(ir_node *store, ir_node *addr, ir_mode *mode,
3855 ir_cons_flags flags);
3857 /** Constructor for a Store node.
3859 * @param *store The current memory.
3860 * @param *addr A pointer to the variable to be read in this memory.
3861 * @param *val The value to write to this variable.
3862 * @param flags Additional flags for alignment, volatility and pin state.
3864 FIRM_API ir_node *new_Store(ir_node *store, ir_node *addr, ir_node *val,
3865 ir_cons_flags flags);
3867 /** Constructor for a Alloc node.
3869 * The Alloc node extends the memory by space for an entity of type alloc_type.
3870 * Adds the node to the block in current_ir_block.
3872 * @param *store The memory which shall contain the new variable.
3873 * @param *count The number of objects to allocate.
3874 * @param *alloc_type The type of the allocated variable.
3875 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3877 FIRM_API ir_node *new_Alloc(ir_node *store, ir_node *count, ir_type *alloc_type,
3878 ir_where_alloc where);
3880 /** Constructor for a Free node.
3882 * Frees the memory occupied by the entity pointed to by the pointer
3883 * arg. Type indicates the type of the entity the argument points to.
3884 * Adds the node to the block in current_ir_block.
3886 * @param *store The memory which shall contain the new variable.
3887 * @param *ptr The pointer to the object to free.
3888 * @param *size The number of objects of type free_type to free in a sequence.
3889 * @param *free_type The type of the freed variable.
3890 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
3892 FIRM_API ir_node *new_Free(ir_node *store, ir_node *ptr, ir_node *size,
3893 ir_type *free_type, ir_where_alloc where);
3895 /** Constructor for a Sync node.
3897 * Merges several memory values. The node assumes that a variable
3898 * either occurs only in one of the memories, or it contains the same
3899 * value in all memories where it occurs.
3900 * Adds the node to the block in current_ir_block.
3902 * @param arity The number of memories to synchronize.
3903 * @param **in An array of pointers to nodes that produce an output of type
3904 * memory. The constructor copies this array.
3906 FIRM_API ir_node *new_Sync(int arity, ir_node *in[]);
3908 /** Constructor for a Proj node.
3910 * Projects a single value out of a tuple. The parameter proj gives the
3911 * position of the value within the tuple.
3912 * Adds the node to the block in current_ir_block.
3914 * @param arg A node producing a tuple.
3915 * @param *mode The mode of the value to project.
3916 * @param proj The position of the value in the tuple.
3918 FIRM_API ir_node *new_Proj(ir_node *arg, ir_mode *mode, long proj);
3920 /** Constructor for a defaultProj node.
3922 * Represents the default control flow of a Switch-Cond node.
3923 * Adds the node to the block in current_ir_block.
3925 * @param arg A node producing a tuple.
3926 * @param max_proj The end position of the value in the tuple.
3928 FIRM_API ir_node *new_defaultProj(ir_node *arg, long max_proj);
3930 /** Constructor for a Tuple node.
3932 * This is an auxiliary node to replace a node that returns a tuple
3933 * without changing the corresponding Proj nodes.
3934 * Adds the node to the block in current_ir_block.
3936 * @param arity The number of tuple elements.
3937 * @param **in An array containing pointers to the nodes producing the tuple elements.
3939 FIRM_API ir_node *new_Tuple(int arity, ir_node *in[]);
3941 /** Constructor for an Id node.
3943 * This is an auxiliary node to replace a node that returns a single
3944 * value. Adds the node to the block in current_ir_block.
3946 * @param *val The operand to Id.
3947 * @param *mode The mode of *val.
3949 FIRM_API ir_node *new_Id(ir_node *val, ir_mode *mode);
3951 /** Constructor for a Bad node.
3953 FIRM_API ir_node *new_Bad(void);
3955 /** Constructor for a Confirm node.
3957 * Specifies constraints for a value. To support dataflow analyses.
3958 * Adds the node to the block in current_ir_block.
3960 * Example: If the value never exceeds '100' this is expressed by placing a
3961 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
3963 * @param *val The value we express a constraint for
3964 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3965 * @param cmp The compare operation.
3967 FIRM_API ir_node *new_Confirm(ir_node *val, ir_node *bound, pn_Cmp cmp);
3969 /** Constructor for an Unknown node.
3971 * Represents an arbitrary value. Places the node in
3974 * @param *m The mode of the unknown value.
3976 FIRM_API ir_node *new_Unknown(ir_mode *m);
3978 /** Constructor for a NoMem node. */
3979 FIRM_API ir_node *new_NoMem(void);
3981 /** Constructor for a Mux node.
3983 * Adds the node to the block in current_ir_block.
3985 * @param *sel The ir_node that calculates the boolean select.
3986 * @param *ir_true The ir_node that calculates the true result.
3987 * @param *ir_false The ir_node that calculates the false result.
3988 * @param *mode The mode of the node (and it_true and ir_false).
3990 FIRM_API ir_node *new_Mux(ir_node *sel, ir_node *ir_false, ir_node *ir_true,
3993 /** Constructor for a CopyB node.
3995 * Adds the node to the block in current_ir_block.
3997 * @param *store The current memory
3998 * @param *dst The ir_node that represents the destination address.
3999 * @param *src The ir_node that represents the source address.
4000 * @param *data_type The type of the copied data
4002 FIRM_API ir_node *new_CopyB(ir_node *store, ir_node *dst, ir_node *src,
4003 ir_type *data_type);
4005 /** Constructor for a InstOf node.
4007 * A High-Level Type check.
4009 * @param *store The memory in which the object the entity should be selected
4010 * from is allocated.
4011 * @param *objptr A pointer to a object of a class type.
4012 * @param *type The type of which objptr must be.
4014 FIRM_API ir_node *new_InstOf(ir_node *store, ir_node *objptr, ir_type *type);
4016 /**Constructor for a Raise node.
4018 * A High-Level Exception throw.
4020 * @param *store The current memory.
4021 * @param *obj A pointer to the Except variable.
4023 FIRM_API ir_node *new_Raise(ir_node *store, ir_node *obj);
4025 /** Constructor for a Bound node.
4027 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
4029 * Adds the node to the block in current_ir_block.
4031 * @param *store The current memory
4032 * @param *idx The ir_node that represents an index.
4033 * @param *lower The ir_node that represents the lower bound for the index.
4034 * @param *upper The ir_node that represents the upper bound for the index.
4036 FIRM_API ir_node *new_Bound(ir_node *store, ir_node *idx, ir_node *lower,
4039 /** Constructor for a Pin node.
4041 * @param *node The node which value should be pinned.
4043 FIRM_API ir_node *new_Pin(ir_node *node);
4045 /** Constructor for an ASM pseudo node.
4047 * @param arity The number of data inputs to the node.
4048 * @param *in The array of length arity of data inputs.
4049 * @param *inputs The array of length arity of input constraints.
4050 * @param n_outs The number of data outputs to the node.
4051 * @param *outputs The array of length n_outs of output constraints.
4052 * @param n_clobber The number of clobbered registers.
4053 * @param *clobber The array of length n_clobber of clobbered registers.
4054 * @param *asm_text The assembler text.
4056 FIRM_API ir_node *new_ASM(int arity, ir_node *in[], ir_asm_constraint *inputs,
4057 int n_outs, ir_asm_constraint *outputs,
4058 int n_clobber, ident *clobber[], ident *asm_text);
4061 * @brief Constructor for a Dummy node.
4063 * @param *db debug info for the node
4064 * @param *mode The mode of the node.
4065 * @param *irg the graph to put the node into
4066 * @returns the newly created note
4068 FIRM_API ir_node *new_rd_Dummy(dbg_info *db, ir_graph *irg, ir_mode *mode);
4071 * @copybrief new_rd_Dummy()
4073 * @param *mode The mode of the node.
4074 * @param *irg the graph to put the node into
4075 * @returns the newly created note
4077 FIRM_API ir_node *new_r_Dummy(ir_graph *irg, ir_mode *mode);
4080 * @copybrief new_rd_Dummy()
4082 * @param *db debug info for the node
4083 * @param *mode The mode of the node.
4084 * @returns the newly created note
4086 FIRM_API ir_node *new_d_Dummy(dbg_info *db, ir_mode *mode);
4089 * @copybrief new_rd_Dummy()
4091 * @param *mode The mode of the node.
4092 * @returns the newly created note
4094 FIRM_API ir_node *new_Dummy(ir_mode *mode);
4096 /*---------------------------------------------------------------------*/
4097 /* The comfortable interface. */
4098 /* Supports automatic Phi node construction. */
4099 /* All routines of the block oriented interface except new_Block are */
4101 /*---------------------------------------------------------------------*/
4103 /** Create an immature Block.
4105 * An immature Block has an unknown number of predecessors. Predecessors
4106 * can be added with add_immBlock_pred(). Once all predecessors are
4107 * added the block must be matured.
4109 * Adds the block to the graph in current_ir_graph. Can be used with automatic
4110 * Phi node construction.
4111 * This constructor can only be used if the graph is in state_building.
4113 FIRM_API ir_node *new_d_immBlock(dbg_info *db);
4114 FIRM_API ir_node *new_immBlock(void);
4115 FIRM_API ir_node *new_r_immBlock(ir_graph *irg);
4116 FIRM_API ir_node *new_rd_immBlock(dbg_info *db, ir_graph *irg);
4118 /** Add a control flow edge to an immature block. */
4119 FIRM_API void add_immBlock_pred(ir_node *immblock, ir_node *jmp);
4121 /** Finalize a Block node, when all control flows are known. */
4122 FIRM_API void mature_immBlock(ir_node *block);
4124 /** Get the current value of a local variable.
4126 * Use this function to obtain the last definition of the local variable
4127 * associated with pos. Pos may not exceed the value passed as n_loc
4128 * to new_ir_graph. This call automatically inserts Phi nodes.
4130 * @param *db A pointer for debug information.
4131 * @param pos The position/id of the local variable.
4132 * @param *mode The mode of the value to get.
4134 FIRM_API ir_node *get_value(int pos, ir_mode *mode);
4135 FIRM_API ir_node *get_r_value(ir_graph *irg, int pos, ir_mode *mode);
4138 * Try to guess the mode of a local variable.
4139 * This is done by recursively going up the control flow graph until
4140 * we find a definition for the variable. The mode of the first found
4141 * definition is returned. NULL in case no definition is found.
4143 * @param pos The position/id of the local variable.
4145 FIRM_API ir_mode *ir_guess_mode(int pos);
4147 /** Remark a new definition of a variable.
4149 * Use this function to remember a new definition of the value
4150 * associated with pos. Pos may not exceed the value passed as n_loc
4151 * to new_ir_graph. This call is needed to automatically inserts Phi
4154 * @param pos The position/id of the local variable.
4155 * @param *value The new value written to the local variable.
4157 FIRM_API void set_value(int pos, ir_node *value);
4158 FIRM_API void set_r_value(ir_graph *irg, int pos, ir_node *value);
4161 * Find the value number for a node in the current block.
4163 * @param value the searched value
4165 * @return the value number of the value or -1 if this value has
4166 * no value number in the current block.
4168 FIRM_API int find_value(ir_node *value);
4170 /** Get the current memory state.
4172 * Use this function to obtain the last definition of the memory
4173 * state. This call automatically inserts Phi nodes for the memory
4176 FIRM_API ir_node *get_store(void);
4177 FIRM_API ir_node *get_r_store(ir_graph *irg);
4179 /** Remark a new definition of the memory state.
4181 * Use this function to remember a new definition of the memory state.
4182 * This call is needed to automatically inserts Phi nodes.
4184 * @param *store The new memory state.
4186 FIRM_API void set_store(ir_node *store);
4187 FIRM_API void set_r_store(ir_graph *irg, ir_node *store);
4189 /** keep this node alive even if End is not control-reachable from it
4191 * @param ka The node to keep alive.
4193 FIRM_API void keep_alive(ir_node *ka);
4195 /* --- initialize and finalize IR construction --- */
4197 /** Puts the graph into state "phase_high" */
4198 FIRM_API void irg_finalize_cons(ir_graph *irg);
4200 /** Puts the program and all graphs into state phase_high.
4202 * This also remarks, the construction of types is finished,
4203 * e.g., that no more subtypes will be added. */
4204 FIRM_API void irp_finalize_cons(void);
4206 FIRM_API void ir_set_uninitialized_local_variable_func(
4207 uninitialized_local_variable_func_t *func);