2 * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * @brief Various irnode constructors. Automatic construction of SSA
24 * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Boris Boesler,
30 Ideas for improvement:
31 -# Handle construction of exceptions more comfortable:
32 Add new constructors that pass the exception region (or better the
33 Phi for the memories, the ex. region can be found from there) as parameter,
34 constructor then adds all Proj nodes and returns the pointer
35 to the Proj node that selects the result of the arithmetic operation.
36 -# Maybe hide the exception region in a global variable, especially if
37 it is always unambiguous.
43 * documentation no more supported since 2001
45 * IR node construction.
47 * This file documents all datatypes and constructors needed to
48 * build a FIRM representation of a procedure. The constructors are
49 * also implemented in this file.
51 * The documentation also gives a short manual how to use the library.
53 * For extensive documentation of FIRM see UKA Techreport 1999-14.
56 * Three kinds of nodes
57 * --------------------
59 * There are three kinds of nodes known to the IR: entities,
62 * + ir_nodes are the actual nodes of the FIRM intermediate representation.
63 * They represent operations on the data of the program and control flow
66 * + entity ==> implemented in entity.h
67 * Refers to a single entity of the compiled program, e.g. a field of a
68 * class or a method. If a method or variable can not be assigned to
69 * a method or class or the like, it is a global object.
71 * + types ==> implemented in type.h
72 * With types type information is represented. There are several type
75 * Implementation of the FIRM operations: ir_node
76 * ----------------------------------------------
78 * Ir_nodes represent operations on the data of the program and control flow
79 * operations. Examples of ir_nodes: Add, Jmp, Cmp
81 * FIRM is a dataflow graph. A dataflow graph is a directed graph,
82 * so that every node has incoming and outgoing edges. A node is
83 * executable if every input at it's incoming edges is available.
84 * Execution of the dataflow graph is started at the Start node which
85 * has no incoming edges and ends when the End node executes, even if
86 * there are still executable or not executed nodes. (Is this true,
87 * or must all executable nodes be executed?) (There are exceptions
88 * to the dataflow paradigma that all inputs have to be available
89 * before a node can execute: Phi, Block. See UKA Techreport
92 * The implementation of FIRM differs from the view as a dataflow
93 * graph. To allow fast traversion of the graph edges are
94 * implemented as C-pointers. Inputs to nodes are not ambiguous, the
95 * results can be used by several other nodes. Each input can be
96 * implemented as a single pointer to a predecessor node, outputs
97 * need to be lists of pointers to successors. Therefore a node
98 * contains pointers to it's predecessor so that the implementation is a
99 * dataflow graph with reversed edges. It has to be traversed bottom
102 * All nodes of the IR have the same basic structure. They are
103 * distinguished by a field containing the opcode.
105 * The fields of an ir_node:
107 * kind A firm_kind tag containing k_ir_node. This is useful for
108 * dynamically checking the type of a node.
110 * *op This ir_op gives the opcode as a tag and a string
111 * and the number of attributes of an ir_node. There is
112 * one statically allocated struct ir_op for each opcode.
114 * *mode The ir_mode of the operation represented by this firm
115 * node. The mode of the operation is the mode of it's
116 * result. A Firm mode is a datatype as known to the target,
117 * not a type of the source language.
119 * visit A flag for traversing the IR.
121 * **in An array with pointers to the node's predecessors.
123 * *link A pointer to an ir_node. With this pointer all Phi nodes
124 * are attached to a Block, i.e., a Block points to it's
125 * first Phi node, this node points to the second Phi node
126 * in the Block and so fourth. Used in mature_immBlock
127 * to find all Phi nodes to be matured. It's also used to
128 * annotate a node with a better, optimized version of it.
130 * attr An attr struct containing the attributes of the nodes. The
131 * attributes depend on the opcode of the node. The number
132 * of these attributes is given in op.
136 * Not yet documented. See irop.h.
140 * Not yet documented. See irmode.h.
142 * GLOBAL VARIABLES -- now also fields of ir_graph.
145 * current_ir_graph Points to the current ir_graph. All constructors for
146 * nodes add nodes to this graph.
148 * ir_visited An int used as flag to traverse the ir_graph.
150 * block_visited An int used as a flag to traverse block nodes in the
153 * Others not yet documented.
157 * CONSTRUCTOR FOR IR_GRAPH --> see irgraph.h
158 * ========================
161 * PROCEDURE TO CONSTRUCT AN IR GRAPH --> see also Firm tutorial
162 * ==================================
164 * This library supplies several interfaces to construct a FIRM graph for
166 * - A "comfortable" interface generating SSA automatically. Automatically
167 * computed predecessors of nodes need not be specified in the constructors.
168 * (new_<Node> constructurs and a set of additional routines.)
169 * - A less comfortable interface where all predecessors except the block
170 * an operation belongs to need to be specified. SSA must be constructed
171 * by hand. (new_<Node> constructors and set_cur_block()). This interface
172 * is called "block oriented". It automatically calles the local optimizations
174 * - An even less comfortable interface where the block needs to be specified
175 * explicitly. This is called the "raw" interface. (new_r_<Node>
176 * constructors). These nodes are not optimized.
178 * To use the functionality of the comfortable interface correctly the Front
179 * End needs to follow certain protocols. This is explained in the following.
180 * To build a correct IR with the other interfaces study the semantics of
181 * the firm node (See tech-reprot UKA 1999-14). For the construction of
182 * types and entities see the documentation in those modules.
184 * First the Frontend needs to decide which variables and values used in
185 * a procedure can be represented by dataflow edges. These are variables
186 * that need not be saved to memory as they cause no side effects visible
187 * out of the procedure. Often these are all compiler generated
188 * variables and simple local variables of the procedure as integers,
189 * reals and pointers. The frontend has to count and number these variables.
191 * First an ir_graph needs to be constructed with new_ir_graph. The
192 * constructor gets the number of local variables. The graph is hold in the
193 * global variable irg.
195 * Now the construction of the procedure can start. Several basic blocks can
196 * be constructed in parallel, but the code within each block needs to
197 * be constructed (almost) in program order.
199 * A global variable holds the current basic block. All (non block) nodes
200 * generated are added to this block. The current block can be set with
201 * set_cur_block(block). If several blocks are constructed in parallel block
202 * switches need to be performed constantly.
204 * To generate a Block node (with the comfortable interface), its predecessor
205 * control flow nodes need not be known. In case of cyclic control flow these
206 * can not be known when the block is constructed. With add_immBlock_pred(block,
207 * cfnode) predecessors can be added to the block. If all predecessors are
208 * added to the block mature_immBlock(b) needs to be called. Calling mature_immBlock
209 * early improves the efficiency of the Phi node construction algorithm.
210 * But if several blocks are constructed at once, mature_immBlock must only
211 * be called after performing all set_values and set_stores in the block!
212 * (See documentation of new_immBlock constructor.)
214 * The constructors of arithmetic nodes require that their predecessors
215 * are mentioned. Sometimes these are available in the Frontend as the
216 * predecessors have just been generated by the frontend. If they are local
217 * values the predecessors can be obtained from the library with a call to
218 * get_value(local_val_nr). (local_val_nr needs to be administered by
219 * the Frontend.) A call to get_value triggers the generation of Phi nodes.
220 * If an arithmetic operation produces a local value this value needs to be
221 * passed to the library by set_value(node, local_val_nr).
222 * In straight line code these two operations just remember and return the
223 * pointer to nodes producing the value. If the value passes block boundaries
224 * Phi nodes can be inserted.
225 * Similar routines exist to manage the Memory operands: set_store and
228 * Several nodes produce more than one result. An example is the Div node.
229 * Such nodes return tuples of values. From these individual values can be
230 * extracted by proj nodes.
232 * The following example illustrates the construction of a simple basic block
233 * with two predecessors stored in variables cf_pred1 and cf_pred2, containing
236 * and finally jumping to an other block. The variable a got the local_val_nr
237 * 42 by the frontend.
239 * ir_node *this_block, *cf_pred1, *cf_pred2, *a_val, *mem, *div, *res, *cf_op;
241 * this_block = new_immBlock();
242 * add_immBlock_pred(this_block, cf_pred1);
243 * add_immBlock_pred(this_block, cf_pred2);
244 * mature_immBlock(this_block);
245 * a_val = get_value(42, mode_Iu);
247 * div = new_Div(mem, a_val, a_val, mode_Iu);
248 * mem = new_Proj(div, mode_M, pn_Div_M); * for the numbers for Proj see docu *
249 * res = new_Proj(div, mode_Iu, pn_Div_res);
251 * set_value(res, 42);
254 * For further information look at the documentation of the nodes and
255 * constructors and at the paragraph COPING WITH DATA OBJECTS at the
256 * end of this documentation.
258 * The comfortable interface contains the following routines further explained
261 * ir_node *new_immBlock (void);
262 * ir_node *new_Start (void);
263 * ir_node *new_End (void);
264 * ir_node *new_Jmp (void);
265 * ir_node *new_IJmp (ir_node *tgt);
266 * ir_node *new_Cond (ir_node *c);
267 * ir_node *new_Return (ir_node *store, int arity, ir_node **in);
268 * ir_node *new_Const (ir_mode *mode, tarval *con);
269 * ir_node *new_SymConst (ir_mode *mode, symconst_symbol value, symconst_kind kind);
270 * ir_node *new_simpleSel (ir_node *store, ir_node *objptr, ir_entity *ent);
271 * ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity,
272 * ir_node **in, ir_entity *ent);
273 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity,
274 * ir_node **in, type_method *type);
275 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
276 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
277 * ir_node *new_Minus (ir_node *op, ir_mode *mode);
278 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
279 * ir_node *new_Mulh (ir_node *op1, ir_node *op2, ir_mode *mode);
280 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
281 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
282 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
283 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state;
284 * ir_node *new_Abs (ir_node *op, ir_mode *mode);
285 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
286 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
287 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
288 * ir_node *new_Not (ir_node *op, ir_mode *mode);
289 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
290 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
291 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
292 * ir_node *new_Rotl (ir_node *op, ir_node *k, ir_mode *mode);
293 * ir_node *new_Cmp (ir_node *op1, ir_node *op2);
294 * ir_node *new_Conv (ir_node *op, ir_mode *mode);
295 * ir_node *new_Cast (ir_node *op, ir_type *to_tp);
296 * ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode);
297 * ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode);
298 * ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode);
299 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
300 * ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
301 * where_alloc where);
302 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
303 * ir_type *free_type, where_alloc where);
304 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
305 * ir_node *new_NoMem (void);
306 * ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
307 * ir_node *new_CopyB (ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
308 * ir_node *new_InstOf (ir_node *store, ir_node obj, ir_type *ent);
309 * ir_node *new_Raise (ir_node *store, ir_node *obj);
310 * ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
311 * ir_node *new_Pin (ir_node *node);
313 * void add_immBlock_pred (ir_node *block, ir_node *jmp);
314 * void mature_immBlock (ir_node *block);
315 * void set_cur_block (ir_node *target);
316 * ir_node *get_value (int pos, ir_mode *mode);
317 * void set_value (int pos, ir_node *value);
318 * ir_node *get_store (void);
319 * void set_store (ir_node *store);
320 * keep_alive (ir_node ka)
322 * IR_NODES AND CONSTRUCTORS FOR IR_NODES
323 * =======================================
325 * All ir_nodes are defined by a common data structure. They are distinguished
326 * by their opcode and differ in the number of their attributes.
328 * The constructor for the block node sets current_block to itself.
329 * Const nodes are always added to the start block.
330 * All other constructors add the created node to the current_block.
331 * swich_block(block) allows to set the current block to block.
333 * Watch for my inconsistent use of input and predecessor (dataflow view)
334 * and `the node points to' (implementation view).
336 * The following description of the nodes lists four properties them if these
338 * - the parameters to the constructor
339 * - the inputs of the Firm node
340 * - the outputs of the Firm node
341 * - attributes to the node
345 * ir_node *new_immBlock (void)
346 * ----------------------------
348 * Creates a new block. Sets current_block to itself. When a new block is
349 * created it cannot be known how many predecessors this block will have in the
350 * control flow graph. Therefore the list of inputs can not be fixed at
351 * creation. Predecessors can be added with add_immBlock_pred (block, control flow
352 * operation). With every added predecessor the number of inputs to Phi nodes
355 * The block can be completed by mature_immBlock(block) if all predecessors are
356 * known. If several blocks are built at once, mature_immBlock can only be called
357 * after set_value has been called for all values that are life at the end
358 * of the block. This is necessary so that Phi nodes created mature_immBlock
359 * get the right predecessors in case of cyclic dependencies. If all set_values
360 * of this block are called after maturing it and before calling get_value
361 * in some block that is control flow dependent on this block, the construction
364 * Example for faulty IR construction: (draw the graph on a paper and you'll
367 * block_before_loop = new_block();
369 * mature_immBlock(block_before_loop);
370 * before2header = new_Jmp;
372 * loop_header = new_block ();
373 * header2body - new_Jmp();
375 * loop_body = new_block ();
376 * body2header = new_Jmp();
378 * add_immBlock_pred(loop_header, before2header);
379 * add_immBlock_pred(loop_header, body2header);
380 * add_immBlock_pred(loop_body, header2body);
382 * mature_immBlock(loop_header);
383 * mature_immBlock(loop_body);
385 * get_value(loop_body, x); // gets the Phi in loop_header
386 * set_value(loop_header, x); // sets the value the above get_value should
387 * // have returned!!!
389 * Mature_immBlock also fixes the number of inputs to the Phi nodes. Mature_immBlock
390 * should be called as early as possible, as afterwards the generation of Phi
391 * nodes is more efficient.
394 * There is an input for each control flow predecessor of the block.
395 * The input points to an instruction producing an output of type X.
396 * Possible predecessors: Start, Jmp, Cond, Raise or Return or any node
397 * possibly causing an exception. (Often the real predecessors are Projs.)
399 * Mode BB (R), all nodes belonging to this block should consume this output.
400 * As they are strict (except Block and Phi node) it is a necessary condition
401 * that the block node executed before any other node in this block executes.
403 * block.matured Indicates whether the block is mature.
405 * This attribute contains all local values valid in this
406 * block. This is needed to build the Phi nodes and removed
407 * if the graph is complete. This field is used by the
408 * internal construction algorithm and should not be accessed
412 * ir_node *new_Block (int arity, ir_node **in)
413 * --------------------------------------------
415 * Creates a new Block with the given list of predecessors. This block
416 * is mature. As other constructors calls optimization and vrfy for the
417 * block. If one of the predecessors is Unknown (as it has to be filled in
418 * later) optimizations are skipped. This is necessary to
419 * construct Blocks in loops. Leaving Unknown in the Block after finishing
420 * the construction may have strange effects, especially for interprocedural
421 * representation and analysis.
424 * CONTROL FLOW OPERATIONS
425 * -----------------------
427 * In each block there must be exactly one of the control flow
428 * operations Start, End, Jmp, Cond, Return or Raise. The output of a
429 * control flow operation points to the block to be executed next.
431 * ir_node *new_Start (void)
432 * -------------------------
434 * Creates a start node. Not actually needed public. There is only one such
435 * node in each procedure which is automatically created by new_ir_graph.
438 * No inputs except the block it belogns to.
440 * A tuple of 4 (5, 6) distinct values. These are labeled by the following
441 * projection numbers (pn_Start):
442 * * pn_Start_X_initial_exec mode X, points to the first block to be exe * cuted.
443 * * pn_Start_M mode M, the global store
444 * * pn_Start_P_frame_base mode P, a pointer to the base of the proce * dures stack frame.
445 * * pn_Start_P_globals mode P, a pointer to the part of the memory * containing_all_ global things.
446 * * pn_Start_T_args mode T, a tuple containing all arguments of * the procedure.
449 * ir_node *new_End (void)
450 * -----------------------
452 * Creates an end node. Not actually needed public. There is only one such
453 * node in each procedure which is automatically created by new_ir_graph.
456 * No inputs except the block it belongs to.
460 * ir_node *new_Jmp (void)
461 * -----------------------
463 * Creates a Jmp node.
466 * The block the node belongs to
468 * Control flow to the next block.
470 * ir_node *new_IJmp (ir_node *tgt)
471 * -----------------------
473 * Creates an IJmp node.
476 * The node that represents the target jump address
478 * Control flow to an unknown target, must be pinned by
481 * ir_node *new_Cond (ir_node *c)
482 * ------------------------------
484 * Creates a Cond node. There are two versions of this node.
490 * A tuple of two control flows. The first is taken if the input is
491 * false, the second if it is true.
495 * A value of mode I_u. (i)
497 * A tuple of n control flows. If the Cond's input is i, control
498 * flow will procede along output i. If the input is >= n control
499 * flow proceeds along output n.
501 * ir_node *new_Return (ir_node *store, int arity, ir_node **in)
502 * -------------------------------------------------------------
504 * The return node has as inputs the results of the procedure. It
505 * passes the control flow to the end_block.
511 * Control flow to the end block.
515 * ir_node *new_Const (ir_mode *mode, tarval *con)
516 * -----------------------------------------------
518 * Creates a constant in the constant table and adds a Const node
519 * returning this value to the start block.
522 * *mode The mode of the constant.
523 * *con Points to an entry in the constant table.
524 * This pointer is added to the attributes of
525 * the node (self->attr.con)
527 * No inputs except the block it belogns to.
529 * The constant value.
531 * attr.con A tarval* pointer to the proper entry in the constant
534 * ir_node *new_SymConst (ir_mode *mode,union symconst_symbol value, symconst_addr_ent kind)
535 * -----------------------------------------------------------------------------------------
537 * There are three five of symbolic constants:
538 * symconst_type_tag The symbolic constant represents a type tag.
539 * symconst_type_size The symbolic constant represents the size of a type.
540 * symconst_type_align The symbolic constant represents the alignment of a type.
541 * symconst_addr_name Information for the linker, e.g. the name of a global
543 * symconst_addr_ent The symbolic constant represents the address of an entity.
545 * To represent a pointer to an entity that is represented by an entity
546 * datastructure don't use
547 * new_SymConst((type_or_id*)get_entity_ld_ident(ent), symconst_addr_name);.
548 * Use a real const instead:
549 * new_SymConst(ent, symconst_addr_ent);
550 * This makes the Constant independent of name changes of the entity due to
554 * kind The kind of the symbolic constant: type_tag, size or link_info.
555 * *type_or_id Points to the type the tag stands for or to the type
556 * whose size is represented by the constant or to an ident
557 * representing the linkage info.
560 * No inputs except the block it belongs to.
562 * A symbolic constant.
565 * attr.i.num The symconst_addr_ent, i.e. one of
567 * -symconst_type_size
568 * -symconst_type_align
569 * -symconst_addr_name
572 * If the attr.i.num is symconst_type_tag, symconst_type_size or symconst_type_align,
573 * the node contains an attribute:
575 * attr.i.*type, a pointer to a type_class.
576 * if it is linkage_ptr_info it contains
577 * attr.i.*ptrinfo, an ident holding information for the linker.
581 * ir_node *new_simpleSel (ir_node *store, ir_node *frame, ir_entity *sel)
582 * -----------------------------------------------------------------------
585 * Selects an entity from a compound type. This entity can be a field or
589 * *store The memory in which the object the entity should be selected
591 * *frame The pointer to the object.
592 * *sel The entity to select.
595 * The memory containing the object.
596 * A pointer to the object.
597 * An unsigned integer.
599 * A pointer to the selected entity.
601 * attr.sel Pointer to the entity
604 * ir_node *new_Sel (ir_node *store, ir_node *frame, int arity, ir_node **in,
605 * --------------------------------------------------------------------------
609 * Selects a field from an array type. The entity has as owner the array, as
610 * type the arrays element type. The indices to access an array element are
614 * *store The memory in which the object the entity should be selected from
616 * *frame The pointer to the object.
617 * *arity number of array indices.
618 * *in array with index inputs to the node.
619 * *sel The entity to select.
622 * The memory containing the object.
623 * A pointer to the object.
624 * As much unsigned integer as there are array expressions.
626 * A pointer to the selected entity.
628 * attr.sel Pointer to the entity
630 * The constructors new_Sel and new_simpleSel generate the same IR nodes.
631 * simpleSel just sets the arity of the index inputs to zero.
634 * ARITHMETIC OPERATIONS
635 * ---------------------
637 * ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node **in,
638 * ----------------------------------------------------------------------------
642 * Creates a procedure call.
645 * *store The actual store.
646 * *callee A pointer to the called procedure.
647 * arity The number of procedure parameters.
648 * **in An array with the pointers to the parameters.
649 * The constructor copies this array.
650 * *type Type information of the procedure called.
653 * The store, the callee and the parameters.
655 * A tuple containing the eventually changed store and the procedure
658 * attr.call Contains the type information for the procedure.
661 * ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode)
662 * ------------------------------------------------------------
666 * ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode)
667 * ------------------------------------------------------------
671 * ir_node *new_Minus (ir_node *op, ir_mode *mode)
672 * -----------------------------------------------
674 * Unary Minus operations on integer and floating point values.
676 * ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode)
677 * ------------------------------------------------------------
681 * ir_node *new_Mulh (ir_node *op1, ir_node *op2, ir_mode *mode)
682 * ------------------------------------------------------------
684 * Returns the high order bits of a n*n=2n multiplication.
686 * ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state)
687 * -------------------------------------------------------------------------------------------------
689 * Quot performs exact division of floating point numbers. It's mode
690 * is Tuple, the mode of the result must match the Proj mode
691 * that extracts the result of the arithmetic operations.
694 * The store needed to model exceptions and the two operands.
696 * A tuple containing a memory and a execution for modeling exceptions
697 * and the result of the arithmetic operation.
699 * ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state)
700 * ---------------------------------------------------------------------------------------------------
702 * Performs Div and Mod on integer values.
705 * A tuple containing a memory and a execution for modeling exceptions
706 * and the two result of the arithmetic operations.
708 * ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state)
709 * ------------------------------------------------------------------------------------------------
713 * ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state)
714 * ------------------------------------------------------------------------------------------------
718 * ir_node *new_Abs (ir_node *op, ir_mode *mode)
719 * ---------------------------------------------
723 * ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode)
724 * ------------------------------------------------------------
728 * ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode)
729 * -----------------------------------------------------------
733 * ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode)
734 * ------------------------------------------------------------
738 * ir_node *new_Not (ir_node *op, ir_mode *mode)
739 * ---------------------------------------------
741 * This node constructs a constant where all bits are set to one
742 * and a Eor of this constant and the operator. This simulates a
745 * ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode)
746 * ---------------------------------------------------------
750 * ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode)
751 * ---------------------------------------------------------
753 * Logic shift right, i.e., zero extended.
756 * ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode)
757 * ----------------------------------------------------------
759 * Arithmetic shift right, i.e., sign extended.
761 * ir_node *new_Rotl (ir_node *op, ir_node *k, ir_mode *mode)
762 * ---------------------------------------------------------
764 * Rotates the operand to the left by k bits.
766 * ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode)
767 * ------------------------------------------------------------
769 * Calculates the Carry value for integer addition. Used only
772 * ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode)
773 * ------------------------------------------------------------
775 * Calculates the Borrow value for integer substraction. Used only
778 * ir_node *new_Conv (ir_node *op, ir_mode *mode)
779 * ---------------------------------------------
781 * Mode conversion. For allowed conversions see UKA Tech Report
784 * ir_node *new_Cmp (ir_node *op1, ir_node *op2)
785 * ---------------------------------------------
788 * The two values to be compared.
790 * A 16-tuple containing the results of the 16 different comparisons.
791 * The following is a list giving the comparisons and a projection
792 * number (pn_Cmp) to use in Proj nodes to extract the proper result.
796 * pn_Cmp_Le less or equal
798 * pn_Cmp_Ge greater of equal
799 * pn_Cmp_Lg less or greater
800 * pn_Cmp_Leg less, equal or greater = ordered
801 * pn_Cmp_Uo unordered
802 * pn_Cmp_Ue unordered or equal
803 * pn_Cmp_Ul unordered or less
804 * pn_Cmp_Ule unordered, less or equal
805 * pn_Cmp_Ug unordered or greater
806 * pn_Cmp_Uge unordered, greater or equal
807 * pn_Cmp_Ne unordered, less or greater = not equal
814 * In general, Phi nodes are automaitcally inserted. In some cases, if
815 * all predecessors of a block are known, an explicit Phi node constructor
816 * is needed. E.g., to construct a FIRM graph for a statement as
817 * a = (b==c) ? 2 : 5;
819 * ir_node *new_Phi (int arity, ir_node **in, ir_mode *mode)
820 * ---------------------------------------------------------
822 * Creates a Phi node. The in's order has to correspond to the order
823 * of in's of current_block. This is not checked by the library!
824 * If one of the predecessors is Unknown (as it has to be filled in
825 * later) optimizations are skipped. This is necessary to
826 * construct Phi nodes in loops. Leaving Unknown in the Phi after finishing
827 * the construction may have strange effects, especially for interprocedural
828 * representation and analysis.
831 * arity number of predecessors
832 * **in array with predecessors
833 * *mode The mode of it's inputs and output.
835 * A Phi node has as many inputs as the block it belongs to.
836 * Each input points to a definition of the same value on a
837 * different path in the control flow.
839 * The definition valid in this block.
841 * ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode)
842 * -----------------------------------------------------------------------------
844 * Creates a Mux node. This node implements the following semantic:
845 * If the sel node (which must be of mode_b) evaluates to true, its value is
846 * ir_true, else ir_false;
850 * OPERATIONS TO MANAGE MEMORY EXPLICITLY
851 * --------------------------------------
853 * ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode)
854 * ----------------------------------------------------------------
856 * The Load operation reads a value from memory.
859 * *store The current memory.
860 * *addr A pointer to the variable to be read in this memory.
861 * *mode The mode of the value to be loaded.
864 * The memory and a pointer to a variable in this memory.
866 * A tuple of the memory, a control flow to be taken in case of
867 * an exception and the loaded value.
869 * ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val)
870 * ----------------------------------------------------------------
872 * The Store operation writes a value to a variable in memory.
875 * The memory, a pointer to a variable in this memory and the value
876 * to write to this variable.
878 * A tuple of the changed memory and a control flow to be taken in
879 * case of an exception.
881 * ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
882 * -----------------------------------------------------------------------
886 * The Alloc node allocates a new variable. It can be specified whether the
887 * variable should be allocated to the stack or to the heap.
890 * *store The memory which shall contain the new variable.
891 * ** *size The number of bytes to allocate. Old. **
892 * *size We decided that the size easily can be derived from the type.
893 * This field is for allocating arrays, i.e., it gives the multiple
894 * of the size of alloc_type to allocate memory for.
895 * *alloc_type The type of the allocated variable.
896 * where Where to allocate the variable, either heap_alloc or stack_alloc.
899 * A memory and an unsigned integer.
901 * A tuple of the changed memory, a control flow to be taken in
902 * case of an exception and the pointer to the new variable.
904 * a.where Indicates where the variable is allocated.
905 * a.*type A pointer to the class the allocated data object
908 * ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size, ir_type *free_type,
909 * -----------------------------------------------------------------------------------
913 * The Free node frees memory of the given variable.
916 * *store The memory which shall contain the new variable.
917 * *ptr The pointer to the object to free.
918 * *size The number of objects of type free_type to free in a sequence.
919 * *free_type The type of the freed variable.
920 * where Where the variable was allocated, either heap_alloc or stack_alloc.
923 * A memory, a pointer and an unsigned integer.
925 * The changed memory.
927 * f.*type A pointer to the type information of the freed data object.
931 * ir_node *new_Sync (int arity, ir_node **in)
932 * -------------------------------------------
934 * The Sync operation unifies several partial memory blocks. These blocks
935 * have to be pairwise disjunct or the values in common locations have to
936 * be identical. This operation allows to specify all operations that eventually
937 * need several partial memory blocks as input with a single entrance by
938 * unifying the memories with a preceding Sync operation.
941 * arity The number of memories to synchronize.
942 * **in An array of pointers to nodes that produce an output of
947 * The unified memory.
953 * ir_node *new_Bad (void)
954 * -----------------------
956 * Returns the unique Bad node current_ir_graph->bad.
957 * This node is used to express results of dead code elimination.
959 * ir_node *new_NoMem (void)
960 * -----------------------------------------------------------------------------------
962 * Returns the unique NoMem node current_ir_graph->no_mem.
963 * This node is used as input for operations that need a Memory, but do not
964 * change it like Div by const != 0, analyzed calls etc.
966 * ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj)
967 * ----------------------------------------------------------
969 * Selects one entry of a tuple. This is a hidden edge with attributes.
972 * *arg A node producing a tuple.
973 * *mode The mode of the value to project.
974 * proj The position of the value in the tuple.
980 * ir_node *new_Tuple (int arity, ir_node **in)
981 * --------------------------------------------
983 * Builds a Tuple from single values. This is needed to implement
984 * optimizations that remove a node that produced a tuple. The node can be
985 * replaced by the Tuple operation so that the following Proj nodes have not to
986 * be changed. (They are hard to find due to the implementation with pointers
987 * in only one direction.) The Tuple node is smaller than any other
988 * node, so that a node can be changed into a Tuple by just changing it's
989 * opcode and giving it a new in array.
992 * arity The number of tuple elements.
993 * **in An array containing pointers to the nodes producing the
996 * ir_node *new_Id (ir_node *val, ir_mode *mode)
997 * ---------------------------------------------
999 * The single output of the Id operation is it's input. Also needed
1000 * for optimizations.
1003 * HIGH LEVEL OPERATIONS
1004 * ---------------------
1006 * ir_node *new_CopyB (ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type)
1007 * -----------------------------------------------------------------------------------
1009 * Describes a high level block copy of a compound type from address src to
1010 * address dst. Must be lowered to a Call to a runtime memory copy function.
1013 * HIGH LEVEL OPERATIONS: Exception Support
1014 * ----------------------------------------
1015 * See TechReport 1999-14, chapter Exceptions.
1017 * ir_node *new_InstOf(ir_node *store, ir_node *ptr, ir_type *type);
1018 * -----------------------------------------------------------------------------------
1020 * Describes a high level type check. Must be lowered to a Call to a runtime check
1023 * ir_node *new_Raise (ir_node *store, ir_node *obj)
1024 * -------------------------------------------------
1026 * Raises an exception. Unconditional change of control flow. Writes
1027 * an explicit Except variable to memory to pass it to the exception
1028 * handler. Must be lowered to a Call to a runtime check
1033 * A pointer to the Except variable.
1035 * A tuple of control flow and the changed memory state. The control flow
1036 * points to the exception handler if it is definied in this procedure,
1037 * else it points to the end_block.
1039 * ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
1040 * -----------------------------------------------------------------------------------
1042 * Describes a high level bounds check. Must be lowered to a Call to a runtime check
1045 * ir_node *new_Pin (ir_node *node);
1046 * -----------------------------------------------------------------------------------
1048 * Pin the value of the node node in the current block No users of the Pin node can
1049 * float above the Block of the Pin. The node cannot float behind this block. Often
1050 * used to Pin the NoMem node.
1053 * COPING WITH DATA OBJECTS
1054 * ========================
1056 * Two kinds of data objects have to be distinguished for generating
1057 * FIRM. First there are local variables other than arrays that are
1058 * known to be alias free. Second there are all other data objects.
1059 * For the first a common SSA representation is built, the second
1060 * are modeled by saving them to memory. The memory is treated as
1061 * a single local variable, the alias problem is hidden in the
1062 * content of this variable.
1064 * All values known in a Block are listed in the block's attribute,
1065 * block.**graph_arr which is used to automatically insert Phi nodes.
1066 * The following two functions can be used to add a newly computed value
1067 * to the array, or to get the producer of a value, i.e., the current
1070 * inline void set_value (int pos, ir_node *value)
1071 * -----------------------------------------------
1073 * Has to be called for every assignment to a local variable. It
1074 * adds the value to the array of used values at position pos. Pos
1075 * has to be a unique identifier for an entry in the procedure's
1076 * definition table. It can be used to access the value again.
1077 * Requires current_block to be set correctly.
1079 * ir_node *get_value (int pos, ir_mode *mode)
1080 * -------------------------------------------
1082 * Returns the node defining the value referred to by pos. If the
1083 * value is not defined in this block a Phi node is generated and
1084 * all definitions reaching this Phi node are collected. It can
1085 * happen that the algorithm allocates an unnecessary Phi node,
1086 * e.g. if there is only one definition of this value, but this
1087 * definition reaches the currend block on several different
1088 * paths. This Phi node will be eliminated if optimizations are
1089 * turned on right after it's creation.
1090 * Requires current_block to be set correctly.
1092 * There are two special routines for the global store:
1094 * void set_store (ir_node *store)
1095 * -------------------------------
1097 * Adds the store to the array of known values at a reserved
1099 * Requires current_block to be set correctly.
1101 * ir_node *get_store (void)
1102 * -------------------------
1104 * Returns the node defining the actual store.
1105 * Requires current_block to be set correctly.
1108 * inline void keep_alive (ir_node *ka)
1109 * ------------------------------------
1111 * Keep this node alive because it is (might be) not in the control
1112 * flow from Start to End. Adds the node to the list in the end
1116 #ifndef FIRM_IR_IRCONS_H
1117 #define FIRM_IR_IRCONS_H
1119 #include "firm_common.h"
1121 #include "irgraph.h"
1123 /*-------------------------------------------------------------------------*/
1124 /* The raw interface */
1125 /*-------------------------------------------------------------------------*/
1127 /** Constructor for a Block node.
1129 * Constructs a mature block with the given predecessors. Use Unknown
1130 * nodes as predecessors to construct a block if the number of
1131 * predecessors is known, but not the predecessors themselves. This
1132 * constructor does not set current_block. It not be used with
1133 * automatic Phi node construction.
1135 * @param *db A Pointer for debug information.
1136 * @param irg The IR graph the block belongs to.
1137 * @param arity The number of control predecessors.
1138 * @param in[] An array of control predecessors. The length of
1139 * the array must be 'arity'. The constructor copies this array.
1141 ir_node *new_rd_Block (dbg_info *db, ir_graph *irg, int arity, ir_node *in[]);
1143 /** Constructor for a Start node.
1145 * @param *db A pointer for debug information.
1146 * @param *irg The IR graph the node belongs to.
1147 * @param *block The IR block the node belongs to.
1149 ir_node *new_rd_Start (dbg_info *db, ir_graph *irg, ir_node *block);
1151 /** Constructor for a End node.
1153 * @param *db A pointer for debug information.
1154 * @param *irg The IR graph the node belongs to.
1155 * @param *block The IR block the node belongs to.
1157 ir_node *new_rd_End (dbg_info *db, ir_graph *irg, ir_node *block);
1159 /** Constructor for a Jmp node.
1161 * Jmp represents control flow to a single control successor.
1163 * @param *db A pointer for debug information.
1164 * @param *irg The IR graph the node belongs to.
1165 * @param *block The IR block the node belongs to.
1167 ir_node *new_rd_Jmp (dbg_info *db, ir_graph *irg, ir_node *block);
1169 /** Constructor for an IJmp node.
1171 * IJmp represents control flow to a single control successor not
1172 * statically known i.e. an indirect Jmp.
1174 * @param *db A pointer for debug information.
1175 * @param *irg The IR graph the node belongs to.
1176 * @param *block The IR block the node belongs to.
1177 * @param *tgt The IR node representing the target address.
1179 ir_node *new_rd_IJmp (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *tgt);
1181 /** Constructor for a Break node.
1183 * Break represents control flow to a single control successor just as Jmp.
1184 * The blocks separated by a break may not be concatenated by an optimization.
1185 * It is used for the interprocedural representation where blocks are parted
1186 * behind Call nodes to represent the control flow to called procedures.
1188 * @param *db A pointer for debug information.
1189 * @param *irg The IR graph the node belong to.
1190 * @param *block The block the node belong to.
1192 ir_node *new_rd_Break (dbg_info *db, ir_graph *irg, ir_node *block);
1194 /** Constructor for a Cond node.
1196 * If c is mode_b represents a conditional branch (if/else). If c is
1197 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
1198 * node, default Proj is 0.)
1200 * This is not consistent: Input to Cond is Is, Proj has as proj number
1203 * @param *db A pointer for debug information.
1204 * @param *irg The IR graph the node belongs to.
1205 * @param *block The IR block the node belongs to.
1206 * @param *c The conditions parameter. Can be of mode b or I_u.
1208 ir_node *new_rd_Cond (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *c);
1210 /** Constructor for a Return node.
1212 * Returns the memory and zero or more return values. Only node that
1213 * can end regular control flow.
1215 * @param *db A pointer for debug information.
1216 * @param *irg The IR graph the node belongs to.
1217 * @param *block The IR block the node belongs to.
1218 * @param *store The state of memory.
1219 * @param arity Number of return values.
1220 * @param *in Array of length arity with return values. The constructor copies this array.
1222 ir_node *new_rd_Return (dbg_info *db, ir_graph *irg, ir_node *block,
1223 ir_node *store, int arity, ir_node *in[]);
1225 /** Constructor for a Const_type node.
1227 * The constant represents a target value. This constructor sets high
1228 * level type information for the constant value.
1230 * @param *db A pointer for debug information.
1231 * @param *irg The IR graph the node belongs to.
1232 * @param *block The IR block the node belongs to.
1233 * @param *mode The mode of the operands and results.
1234 * @param *con Points to an entry in the constant table.
1235 * @param *tp The type of the constant.
1237 ir_node *new_rd_Const_type (dbg_info *db, ir_graph *irg, ir_node *block,
1238 ir_mode *mode, tarval *con, ir_type *tp);
1240 /** Constructor for a Const node.
1242 * Constructor for a Const node. The constant represents a target
1243 * value. Sets the type information to type_unknown. (No more
1244 * supported: If tv is entity derives a somehow useful type.)
1246 * @param *db A pointer for debug information.
1247 * @param *irg The IR graph the node belongs to.
1248 * @param *block The IR block the node belongs to.
1249 * @param *mode The mode of the operands and results.
1250 * @param *con Points to an entry in the constant table.
1252 ir_node *new_rd_Const (dbg_info *db, ir_graph *irg, ir_node *block,
1253 ir_mode *mode, tarval *con);
1255 /** Constructor for a SymConst_type node.
1257 * This is the constructor for a symbolic constant.
1258 * There are four kinds of symbolic constants:
1259 * - type_tag The symbolic constant represents a type tag. The type the
1260 * tag stands for is given explicitly.
1261 * - type_size The symbolic constant represents the size of a type. The
1262 * type of which the constant represents the size is given
1264 * - type_align The symbolic constant represents the alignment of a type. The
1265 * type of which the constant represents the size is given
1267 * - addr_name The symbolic constant represents the address of an entity
1268 * (variable or method). The variable is indicated by a name
1269 * that is valid for linking.
1270 * - addr_ent The symbolic constant represents the address of an entity
1271 * (variable or method). The variable is given explicitly by
1274 * Inputs to the node:
1275 * No inputs except the block it belongs to.
1276 * Outputs of the node.
1277 * An unsigned integer (I_u) or a pointer (P).
1279 * Mention union in declaration so that the firmjni generator recognizes that
1280 * it can not cast the argument to an int.
1282 * @param *db A pointer for debug information.
1283 * @param *irg The IR graph the node belongs to.
1284 * @param *block The IR block the node belongs to.
1285 * @param mode The mode for the SymConst.
1286 * @param symkind The kind of the symbolic constant: type_tag, size, addr_name or addr_ent.
1287 * @param value A type, entity or a ident depending on the SymConst kind.
1288 * @param tp The source type of the constant.
1290 ir_node *new_rd_SymConst_type(dbg_info *db, ir_graph *irg, ir_node *block, ir_mode *mode,
1291 union symconst_symbol value,
1292 symconst_kind symkind, ir_type *tp);
1294 /** Constructor for a SymConst node.
1296 * Same as new_rd_SymConst_type, except that it sets the type to type_unknown.
1298 ir_node *new_rd_SymConst(dbg_info *db, ir_graph *irg, ir_node *block, ir_mode *mode,
1299 union symconst_symbol value, symconst_kind symkind);
1301 /** Constructor for a SymConst addr_ent node.
1303 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1304 * symconst_addr_ent.
1305 * Adds the SymConst to the start block of irg. */
1306 ir_node *new_rd_SymConst_addr_ent(dbg_info *db, ir_graph *irg, ir_mode *mode,
1307 ir_entity *symbol, ir_type *tp);
1309 /** Constructor for a SymConst ofs_ent node.
1311 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1313 * Adds the SymConst to the start block of irg.
1315 ir_node *new_rd_SymConst_ofs_ent(dbg_info *db, ir_graph *irg, ir_mode *mode,
1316 ir_entity *symbol, ir_type *tp);
1318 /** Constructor for a SymConst addr_name node.
1320 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1321 * symconst_addr_ent.
1322 * Adds the SymConst to the start block of irg.
1324 ir_node *new_rd_SymConst_addr_name(dbg_info *db, ir_graph *irg, ir_mode *mode,
1325 ident *symbol, ir_type *tp);
1327 /** Constructor for a SymConst type_tag node.
1329 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1330 * symconst_addr_ent.
1331 * Adds the SymConst to the start block of irg.
1333 ir_node *new_rd_SymConst_type_tag(dbg_info *db, ir_graph *irg, ir_mode *mode,
1334 ir_type *symbol, ir_type *tp);
1336 /** Constructor for a SymConst size node.
1338 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1339 * symconst_type_size.
1340 * Adds the SymConst to the start block of irg. */
1341 ir_node *new_rd_SymConst_size(dbg_info *db, ir_graph *irg, ir_mode *mode,
1342 ir_type *symbol, ir_type *tp);
1344 /** Constructor for a SymConst size node.
1346 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1347 * symconst_type_align.
1348 * Adds the SymConst to the start block of irg.
1350 ir_node *new_rd_SymConst_align(dbg_info *db, ir_graph *irg, ir_mode *mode,
1351 ir_type *symbol, ir_type *tp);
1353 /** Constructor for a simpleSel node.
1355 * This is a shortcut for the new_rd_Sel() constructor. To be used for
1356 * Sel nodes that do not select from an array, i.e., have no index
1357 * inputs. It adds the two parameters 0, NULL.
1359 * @param *db A pointer for debug information.
1360 * @param *irg The IR graph the node belongs to.
1361 * @param *block The IR block the node belongs to.
1362 * @param *store The memory in which the object the entity should be
1363 * selected from is allocated.
1364 * @param *objptr The object from that the Sel operation selects a
1365 * single attribute out.
1366 * @param *ent The entity to select.
1368 ir_node *new_rd_simpleSel (dbg_info *db, ir_graph *irg, ir_node *block,
1369 ir_node *store, ir_node *objptr, ir_entity *ent);
1371 /** Constructor for a Sel node.
1373 * The select node selects an entity (field or method) from an entity
1374 * with a compound type. It explicitly specifies the entity selected.
1375 * Dynamically the node may select entities that overwrite the given
1376 * entity. If the selected entity is an array element entity the Sel
1377 * node takes the required array indices as inputs.
1379 * @param *db A pointer for debug information.
1380 * @param *irg The IR graph the node belongs to.
1381 * @param *block The IR block the node belongs to.
1382 * @param *store The memory in which the object the entity should be selected
1383 * from is allocated.
1384 * @param *objptr A pointer to a compound entity the Sel operation selects a
1385 * single attribute from.
1386 * @param *n_index The number of array indices needed to select an array element entity.
1387 * @param *index[] If the compound entity is an array the indices of the selected
1388 * element entity. The constructor copies this array.
1389 * @param *ent The entity to select.
1391 ir_node *new_rd_Sel (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1392 ir_node *objptr, int n_index, ir_node *index[], ir_entity *ent);
1394 /** Constructor for a Call node.
1396 * Represents all kinds of method and function calls.
1398 * @param *db A pointer for debug information.
1399 * @param *irg The IR graph the node belongs to.
1400 * @param *block The IR block the node belongs to.
1401 * @param *store The current memory state.
1402 * @param *callee A pointer to the called procedure.
1403 * @param arity The number of procedure parameters.
1404 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1405 * @param *tp Type information of the procedure called.
1407 ir_node *new_rd_Call (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1408 ir_node *callee, int arity, ir_node *in[], ir_type *tp);
1410 /** Constructor for a Add node.
1412 * @param *db A pointer for debug information.
1413 * @param *irg The IR graph the node belongs to.
1414 * @param *block The IR block the node belongs to.
1415 * @param *op1 The first operand.
1416 * @param *op2 The second operand.
1417 * @param *mode The mode of the operands and the result.
1419 ir_node *new_rd_Add (dbg_info *db, ir_graph *irg, ir_node *block,
1420 ir_node *op1, ir_node *op2, ir_mode *mode);
1422 /** Constructor for a Sub node.
1424 * @param *db A pointer for debug information.
1425 * @param *irg The IR graph the node belongs to.
1426 * @param *block The IR block the node belongs to.
1427 * @param *op1 The first operand.
1428 * @param *op2 The second operand.
1429 * @param *mode The mode of the operands and the result.
1431 ir_node *new_rd_Sub (dbg_info *db, ir_graph *irg, ir_node *block,
1432 ir_node *op1, ir_node *op2, ir_mode *mode);
1434 /** Constructor for a Minus node.
1436 * @param *db A pointer for debug information.
1437 * @param *irg The IR graph the node belongs to.
1438 * @param *block The IR block the node belongs to.
1439 * @param *op The operand .
1440 * @param *mode The mode of the operand and the result.
1442 ir_node *new_rd_Minus (dbg_info *db, ir_graph *irg, ir_node *block,
1443 ir_node *op, ir_mode *mode);
1445 /** Constructor for a Mul node.
1447 * @param *db A pointer for debug information.
1448 * @param *irg The IR graph the node belongs to.
1449 * @param *block The IR block the node belongs to.
1450 * @param *op1 The first operand.
1451 * @param *op2 The second operand.
1452 * @param *mode The mode of the operands and the result.
1454 ir_node *new_rd_Mul (dbg_info *db, ir_graph *irg, ir_node *block,
1455 ir_node *op1, ir_node *op2, ir_mode *mode);
1457 /** Constructor for a Mulh node.
1459 * @param *db A pointer for debug information.
1460 * @param *irg The IR graph the node belongs to.
1461 * @param *block The IR block the node belongs to.
1462 * @param *op1 The first operand.
1463 * @param *op2 The second operand.
1464 * @param *mode The mode of the operands and the result.
1466 ir_node *new_rd_Mulh (dbg_info *db, ir_graph *irg, ir_node *block,
1467 ir_node *op1, ir_node *op2, ir_mode *mode);
1469 /** Constructor for a Quot node.
1471 * @param *db A pointer for debug information.
1472 * @param *irg The IR graph the node belongs to.
1473 * @param *block The IR block the node belongs to.
1474 * @param *memop The store needed to model exceptions
1475 * @param *op1 The first operand.
1476 * @param *op2 The second operand.
1477 * @param *mode The mode of the result.
1478 * @param state The pinned state.
1480 ir_node *new_rd_Quot (dbg_info *db, ir_graph *irg, ir_node *block,
1481 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1483 /** Constructor for a DivMod node.
1485 * @param *db A pointer for debug information.
1486 * @param *irg The IR graph the node belongs to.
1487 * @param *block The IR block the node belongs to.
1488 * @param *memop The store needed to model exceptions
1489 * @param *op1 The first operand.
1490 * @param *op2 The second operand.
1491 * @param *mode The mode of the results.
1492 * @param state The pinned state.
1494 ir_node *new_rd_DivMod (dbg_info *db, ir_graph *irg, ir_node *block,
1495 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1497 /** Constructor for a Div node.
1499 * @param *db A pointer for debug information.
1500 * @param *irg The IR graph the node belongs to.
1501 * @param *block The IR block the node belongs to.
1502 * @param *memop The store needed to model exceptions
1503 * @param *op1 The first operand.
1504 * @param *op2 The second operand.
1505 * @param *mode The mode of the result.
1506 * @param state The pinned state.
1508 ir_node *new_rd_Div (dbg_info *db, ir_graph *irg, ir_node *block,
1509 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1511 /** Constructor for a remainderless Div node.
1513 * @param *db A pointer for debug information.
1514 * @param *irg The IR graph the node belongs to.
1515 * @param *block The IR block the node belongs to.
1516 * @param *memop The store needed to model exceptions
1517 * @param *op1 The first operand.
1518 * @param *op2 The second operand.
1519 * @param *mode The mode of the result.
1520 * @param state The pinned state.
1522 ir_node *new_rd_DivRL (dbg_info *db, ir_graph *irg, ir_node *block,
1523 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1525 /** Constructor for a Mod node.
1527 * @param *db A pointer for debug information.
1528 * @param *irg The IR graph the node belongs to.
1529 * @param *block The IR block the node belongs to.
1530 * @param *memop The store needed to model exceptions
1531 * @param *op1 The first operand.
1532 * @param *op2 The second operand.
1533 * @param *mode The mode of the result.
1534 * @param state The pinned state.
1536 ir_node *new_rd_Mod (dbg_info *db, ir_graph *irg, ir_node *block,
1537 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1539 /** Constructor for a Abs node.
1541 * @param *db A pointer for debug information.
1542 * @param *irg The IR graph the node belongs to.
1543 * @param *block The IR block the node belongs to.
1544 * @param *op The operand
1545 * @param *mode The mode of the operands and the result.
1547 ir_node *new_rd_Abs (dbg_info *db, ir_graph *irg, ir_node *block,
1548 ir_node *op, ir_mode *mode);
1550 /** Constructor for a And node.
1552 * @param *db A pointer for debug information.
1553 * @param *irg The IR graph the node belongs to.
1554 * @param *block The IR block the node belongs to.
1555 * @param *op1 The first operand.
1556 * @param *op2 The second operand.
1557 * @param *mode The mode of the operands and the result.
1559 ir_node *new_rd_And (dbg_info *db, ir_graph *irg, ir_node *block,
1560 ir_node *op1, ir_node *op2, ir_mode *mode);
1562 /** Constructor for a Or node.
1564 * @param *db A pointer for debug information.
1565 * @param *irg The IR graph the node belongs to.
1566 * @param *block The IR block the node belongs to.
1567 * @param *op1 The first operand.
1568 * @param *op2 The second operand.
1569 * @param *mode The mode of the operands and the result.
1571 ir_node *new_rd_Or (dbg_info *db, ir_graph *irg, ir_node *block,
1572 ir_node *op1, ir_node *op2, ir_mode *mode);
1574 /** Constructor for a Eor node.
1576 * @param *db A pointer for debug information.
1577 * @param *irg The IR graph the node belongs to.
1578 * @param *block The IR block the node belongs to.
1579 * @param *op1 The first operand.
1580 * @param *op2 The second operand.
1581 * @param *mode The mode of the operands and the results.
1583 ir_node *new_rd_Eor (dbg_info *db, ir_graph *irg, ir_node *block,
1584 ir_node *op1, ir_node *op2, ir_mode *mode);
1586 /** Constructor for a Not node.
1588 * @param *db A pointer for debug information.
1589 * @param *irg The IR graph the node belongs to.
1590 * @param *block The IR block the node belongs to.
1591 * @param *op The operand.
1592 * @param *mode The mode of the operand and the result.
1594 ir_node *new_rd_Not (dbg_info *db, ir_graph *irg, ir_node *block,
1595 ir_node *op, ir_mode *mode);
1597 /** Constructor for a Cmp node.
1599 * @param *db A pointer for debug information.
1600 * @param *irg The IR graph the node belongs to.
1601 * @param *block The IR block the node belongs to.
1602 * @param *op1 The first operand.
1603 * @param *op2 The second operand.
1605 ir_node *new_rd_Cmp (dbg_info *db, ir_graph *irg, ir_node *block,
1606 ir_node *op1, ir_node *op2);
1608 /** Constructor for a Shl node.
1610 * @param *db A pointer for debug information.
1611 * @param *irg The IR graph the node belongs to.
1612 * @param *block The IR block the node belongs to.
1613 * @param *op The operand.
1614 * @param *k The number of bits to shift the operand .
1615 * @param *mode The mode of the operand and the result.
1617 ir_node *new_rd_Shl (dbg_info *db, ir_graph *irg, ir_node *block,
1618 ir_node *op, ir_node *k, ir_mode *mode);
1620 /** Constructor for a Shr node.
1622 * @param *db A pointer for debug information.
1623 * @param *irg The IR graph the node belongs to.
1624 * @param *block The IR block the node belongs to.
1625 * @param *op The operand.
1626 * @param *k The number of bits to shift the operand .
1627 * @param *mode The mode of the operand and the result.
1629 ir_node *new_rd_Shr (dbg_info *db, ir_graph *irg, ir_node *block,
1630 ir_node *op, ir_node *k, ir_mode *mode);
1632 /** Constructor for a Shrs node.
1634 * @param *db A pointer for debug information.
1635 * @param *irg The IR graph the node belongs to.
1636 * @param *block The IR block the node belongs to.
1637 * @param *op The operand.
1638 * @param *k The number of bits to shift the operand.
1639 * @param *mode The mode of the operand and the result.
1641 ir_node *new_rd_Shrs (dbg_info *db, ir_graph *irg, ir_node *block,
1642 ir_node *op, ir_node *k, ir_mode *mode);
1644 /** Constructor for a Rotl node.
1646 * @param *db A pointer for debug information.
1647 * @param *irg The IR graph the node belongs to.
1648 * @param *block The IR block the node belongs to.
1649 * @param *op The operand.
1650 * @param *k The number of bits to rotate the operand.
1651 * @param *mode The mode of the operand.
1653 ir_node *new_rd_Rotl (dbg_info *db, ir_graph *irg, ir_node *block,
1654 ir_node *op, ir_node *k, ir_mode *mode);
1657 /** Constructor for a Conv node.
1659 * @param *db A pointer for debug information.
1660 * @param *irg The IR graph the node belongs to.
1661 * @param *block The IR block the node belongs to.
1662 * @param *op The operand.
1663 * @param *mode The mode of this the operand muss be converted .
1665 ir_node *new_rd_Conv (dbg_info *db, ir_graph *irg, ir_node *block,
1666 ir_node *op, ir_mode *mode);
1668 /** Constructor for a Cast node.
1670 * High level type cast.
1672 * @param *db A pointer for debug information.
1673 * @param *irg The IR graph the node belongs to.
1674 * @param *block The IR block the node belongs to.
1675 * @param *op The operand.
1676 * @param *to_tp The type of this the operand muss be casted .
1678 ir_node *new_rd_Cast (dbg_info *db, ir_graph *irg, ir_node *block,
1679 ir_node *op, ir_type *to_tp);
1681 /** Constructor for a Carry node.
1683 * @param *db A pointer for debug information.
1684 * @param *irg The IR graph the node belongs to.
1685 * @param *block The IR block the node belongs to.
1686 * @param *op1 The first operand.
1687 * @param *op2 The second operand.
1688 * @param *mode The mode of the operands and the result.
1690 ir_node *new_rd_Carry (dbg_info *db, ir_graph *irg, ir_node *block,
1691 ir_node *op1, ir_node *op2, ir_mode *mode);
1693 /** Constructor for a Borrow node.
1695 * @param *db A pointer for debug information.
1696 * @param *irg The IR graph the node belongs to.
1697 * @param *block The IR block the node belongs to.
1698 * @param *op1 The first operand.
1699 * @param *op2 The second operand.
1700 * @param *mode The mode of the operands and the result.
1702 ir_node *new_rd_Borrow (dbg_info *db, ir_graph *irg, ir_node *block,
1703 ir_node *op1, ir_node *op2, ir_mode *mode);
1705 /** Constructor for a Phi node.
1707 * @param *db A pointer for debug information.
1708 * @param *irg The IR graph the node belongs to.
1709 * @param *block The IR block the node belongs to.
1710 * @param arity The number of predecessors
1711 * @param *in[] Array with predecessors. The constructor copies this array.
1712 * @param *mode The mode of it's inputs and output.
1714 ir_node *new_rd_Phi (dbg_info *db, ir_graph *irg, ir_node *block, int arity,
1715 ir_node *in[], ir_mode *mode);
1717 /** Constructor for a Load node.
1719 * @param *db A pointer for debug information.
1720 * @param *irg The IR graph the node belongs to.
1721 * @param *block The IR block the node belongs to.
1722 * @param *store The current memory
1723 * @param *adr A pointer to the variable to be read in this memory.
1724 * @param *mode The mode of the value to be loaded.
1726 ir_node *new_rd_Load (dbg_info *db, ir_graph *irg, ir_node *block,
1727 ir_node *store, ir_node *adr, ir_mode *mode);
1729 /** Constructor for a Store node.
1731 * @param *db A pointer for debug information.
1732 * @param *irg The IR graph the node belongs to.
1733 * @param *block The IR block the node belongs to.
1734 * @param *store The current memory
1735 * @param *adr A pointer to the variable to be read in this memory.
1736 * @param *val The value to write to this variable.
1738 ir_node *new_rd_Store (dbg_info *db, ir_graph *irg, ir_node *block,
1739 ir_node *store, ir_node *adr, ir_node *val);
1741 /** Constructor for a Alloc node.
1743 * The Alloc node extends the memory by space for an entity of type alloc_type.
1745 * @param *db A pointer for debug information.
1746 * @param *irg The IR graph the node belongs to.
1747 * @param *block The IR block the node belongs to.
1748 * @param *store The memory which shall contain the new variable.
1749 * @param *size The number of bytes to allocate.
1750 * @param *alloc_type The type of the allocated variable.
1751 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
1753 ir_node *new_rd_Alloc (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1754 ir_node *size, ir_type *alloc_type, ir_where_alloc where);
1756 /** Constructor for a Free node.
1758 * Frees the memory occupied by the entity pointed to by the pointer
1759 * arg. Type indicates the type of the entity the argument points to.
1761 * @param *db A pointer for debug information.
1762 * @param *irg The IR graph the node belongs to.
1763 * @param *block The IR block the node belongs to.
1764 * @param *store The memory which shall contain the new variable.
1765 * @param *ptr The pointer to the object to free.
1766 * @param *size The number of objects of type free_type to free in a sequence.
1767 * @param *free_type The type of the freed variable.
1768 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
1770 ir_node *new_rd_Free (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1771 ir_node *ptr, ir_node *size, ir_type *free_type, ir_where_alloc where);
1773 /** Constructor for a Sync node.
1775 * Merges several memory values. The node assumes that a variable
1776 * either occurs only in one of the memories, or it contains the same
1777 * value in all memories where it occurs.
1779 * @param *db A pointer for debug information.
1780 * @param *irg The IR graph the node belongs to.
1781 * @param *block The IR block the node belongs to.
1782 * @param arity The number of memories to synchronize.
1783 * @param *in[] An array of pointers to nodes that produce an output of type
1784 * memory. The constructor copies this array.
1786 ir_node *new_rd_Sync (dbg_info *db, ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
1788 /** Constructor for a Proj node.
1790 * Projects a single value out of a tuple. The parameter proj gives the
1791 * position of the value within the tuple.
1793 * @param *db A pointer for debug information.
1794 * @param *irg The IR graph the node belongs to.
1795 * @param *block The IR block the node belongs to.
1796 * @param arg A node producing a tuple. The node must have mode_T.
1797 * @param *mode The mode of the value to project.
1798 * @param proj The position of the value in the tuple.
1800 ir_node *new_rd_Proj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1801 ir_mode *mode, long proj);
1803 /** Constructor for a defaultProj node.
1805 * Represents the default control flow of a Switch-Cond node.
1807 * @param *db A pointer for debug information.
1808 * @param *irg The IR graph the node belongs to.
1809 * @param *block The IR block the node belongs to.
1810 * @param arg A node producing a tuple.
1811 * @param max_proj The end position of the value in the tuple.
1813 ir_node *new_rd_defaultProj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1816 /** Constructor for a Tuple node.
1818 * This is an auxiliary node to replace a node that returns a tuple
1819 * without changing the corresponding Proj nodes.
1821 * @param *db A pointer for debug information.
1822 * @param *irg The IR graph the node belongs to.
1823 * @param *block The IR block the node belongs to.
1824 * @param arity The number of tuple elements.
1825 * @param *in[] An array containing pointers to the nodes producing the tuple
1826 * elements. The constructor copies this array.
1828 ir_node *new_rd_Tuple (dbg_info *db, ir_graph *irg, ir_node *block,
1829 int arity, ir_node *in[]);
1831 /** Constructor for a Id node.
1833 * This is an auxiliary node to replace a node that returns a single
1836 * @param *db A pointer for debug information.
1837 * @param *irg The IR graph the node belongs to.
1838 * @param *block The IR block the node belongs to.
1839 * @param *val The value
1840 * @param *mode The mode of *val.
1842 ir_node *new_rd_Id (dbg_info *db, ir_graph *irg, ir_node *block,
1843 ir_node *val, ir_mode *mode);
1845 /** Constructor for a Bad node.
1847 * Returns the unique Bad node of the graph. The same as
1850 * @param *irg The IR graph the node belongs to.
1852 ir_node *new_rd_Bad (ir_graph *irg);
1854 /** Constructor for a Confirm node.
1856 * Specifies constraints for a value. To support dataflow analyses.
1858 * Example: If the value never exceeds '100' this is expressed by placing a
1859 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
1861 * @param *irg The IR graph the node belong to.
1862 * @param *block The IR block the node belong to.
1863 * @param *db A pointer for debug information.
1864 * @param *val The value we express a constraint for
1865 * @param *bound The value to compare against. Must be a firm node, typically a constant.
1866 * @param cmp The compare operation.
1868 ir_node *new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block,
1869 ir_node *val, ir_node *bound, pn_Cmp cmp);
1871 /** Constructor for an Unknown node.
1873 * Represents an arbitrary value. Places the node in the start block.
1875 * @param *irg The IR graph the node belongs to.
1876 * @param *m The mode of the unknown value.
1878 ir_node *new_rd_Unknown(ir_graph *irg, ir_mode *m);
1880 /** Constructor for a CallBegin node.
1882 * CallBegin represents control flow depending of the pointer value
1883 * representing the called method to the called methods. The
1884 * constructor copies the method pointer input from the passed Call
1887 * @param *db A pointer for debug information.
1888 * @param *irg The IR graph the node belong to.
1889 * @param *block The block the node belong to.
1890 * @param *callee The call node visible in the intra procedural view.
1892 ir_node *new_rd_CallBegin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *callee);
1894 /** Constructor for a EndReg node.
1896 * Used to represent regular procedure end in interprocedual view.
1898 * @param *db A pointer for debug information.
1899 * @param *irg The IR graph the node belong to.
1900 * @param *block The block the node belong to.
1902 ir_node *new_rd_EndReg (dbg_info *db, ir_graph *irg, ir_node *block);
1904 /** Constructor for a EndExcept node.
1906 * Used to represent exceptional procedure end in interprocedural view.
1908 * @param *db A pointer for debug information.
1909 * @param *irg The IR graph the node belong to.
1910 * @param *block The block the node belong to.
1912 ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
1914 /** Constructor for a Filter node.
1916 * Adds the node to the block in current_ir_block. Filter is a node
1917 * with two views used to construct the interprocedural view. In
1918 * intraprocedural view its semantics are identical to the Proj node.
1919 * In interprocedural view the Filter performs the Phi operation on
1920 * method parameters or results. Other than a Phi a Filter node may
1921 * not be removed if it has only a single input.
1923 * The constructor builds the Filter in intraprocedural view.
1925 * @param *db A pointer for debug information.
1926 * @param *irg The IR graph the node belong to.
1927 * @param *block The block the node belong to.
1928 * @param *arg The tuple value to project from.
1929 * @param *mode The mode of the projected value.
1930 * @param proj The position in the tuple to project from.
1932 ir_node *new_rd_Filter (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1933 ir_mode *mode, long proj);
1935 /** Constructor for a NoMem node.
1937 * Returns the unique NoMem node of the graph. The same as
1940 * @param *irg The IR graph the node belongs to.
1942 ir_node *new_rd_NoMem (ir_graph *irg);
1944 /** Constructor for a Mux node.
1946 * @param *db A pointer for debug information.
1947 * @param *irg The IR graph the node belong to.
1948 * @param *block The block the node belong to.
1949 * @param *sel The ir_node that calculates the boolean select.
1950 * @param *ir_true The ir_node that calculates the true result.
1951 * @param *ir_false The ir_node that calculates the false result.
1952 * @param *mode The mode of the node (and it_true and ir_false).
1954 ir_node *new_rd_Mux (dbg_info *db, ir_graph *irg, ir_node *block,
1955 ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
1957 /** Constructor for a CopyB node.
1959 * @param *db A pointer for debug information.
1960 * @param *irg The IR graph the node belong to.
1961 * @param *block The block the node belong to.
1962 * @param *store The current memory
1963 * @param *dst The ir_node that represents the destination address.
1964 * @param *src The ir_node that represents the source address.
1965 * @param *data_type The type of the copied data
1967 ir_node *new_rd_CopyB(dbg_info *db, ir_graph *irg, ir_node *block,
1968 ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
1970 /** Constructor for a InstOf node.
1972 * A High-Level Type check.
1974 * @param *db A pointer for debug information.
1975 * @param *irg The IR graph the node belongs to.
1976 * @param *block The IR block the node belongs to.
1977 * @param *store The memory in which the object the entity should be selected
1978 * from is allocated.
1979 * @param *objptr A pointer to a object of a class type.
1980 * @param *type The type of which objptr must be.
1982 ir_node *new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1983 ir_node *objptr, ir_type *type);
1985 /** Constructor for a Raise node.
1987 * A High-Level Exception throw.
1989 * @param *db A pointer for debug information.
1990 * @param *irg The IR graph the node belongs to.
1991 * @param *block The IR block the node belongs to.
1992 * @param *store The current memory.
1993 * @param *obj A pointer to the Except variable.
1995 ir_node *new_rd_Raise (dbg_info *db, ir_graph *irg, ir_node *block,
1996 ir_node *store, ir_node *obj);
1998 /** Constructor for a Bound node.
2000 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2002 * @param *db A pointer for debug information.
2003 * @param *irg The IR graph the node belong to.
2004 * @param *block The block the node belong to.
2005 * @param *store The current memory.
2006 * @param *idx The ir_node that represents an index.
2007 * @param *lower The ir_node that represents the lower bound for the index.
2008 * @param *upper The ir_node that represents the upper bound for the index.
2010 ir_node *new_rd_Bound(dbg_info *db, ir_graph *irg, ir_node *block,
2011 ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
2013 /** Constructor for a Pin node.
2015 * @param *db A pointer for debug information.
2016 * @param *irg The IR graph the node belong to.
2017 * @param *block The block the node belong to.
2018 * @param *node The node which value should be pinned.
2020 ir_node *new_rd_Pin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *node);
2022 /** Constructor for an ASM pseudo node.
2024 * @param *db A pointer for debug information.
2025 * @param *irg The IR graph the node belong to.
2026 * @param *block The block the node belong to.
2027 * @param arity The number of data inputs to the node.
2028 * @param *in The array of length arity of data inputs.
2029 * @param *inputs The array of length arity of input constraints.
2030 * @param n_outs The number of data outputs to the node.
2031 * @param *outputs The array of length n_outs of output constraints.
2032 * @param n_clobber The number of clobbered registers.
2033 * @param *clobber The array of length n_clobber of clobbered registers.
2034 * @param *asm_text The assembler text.
2036 ir_node *new_rd_ASM(dbg_info *db, ir_graph *irg, ir_node *block,
2037 int arity, ir_node *in[], ir_asm_constraint *inputs,
2038 int n_outs, ir_asm_constraint *outputs,
2039 int n_clobber, ident *clobber[], ident *asm_text);
2041 /*-------------------------------------------------------------------------*/
2042 /* The raw interface without debug support */
2043 /*-------------------------------------------------------------------------*/
2045 /** Constructor for a Block node.
2047 * Constructs a mature block with the given predecessors. Use Unknown
2048 * nodes as predecessors to construct a block if the number of
2049 * predecessors is known, but not the predecessors themselves. This
2050 * constructor does not set current_block. It not be used with
2051 * automatic Phi node construction.
2054 * @param irg The IR graph the block belongs to.
2055 * @param arity The number of control predecessors.
2056 * @param in[] An array of control predecessors. The length of
2057 * the array must be 'arity'. The constructor copies this array.
2059 ir_node *new_r_Block (ir_graph *irg, int arity, ir_node *in[]);
2061 /** Constructor for a Start node.
2063 * @param *irg The IR graph the node belongs to.
2064 * @param *block The IR block the node belongs to.
2066 ir_node *new_r_Start (ir_graph *irg, ir_node *block);
2068 /** Constructor for a End node.
2070 * @param *irg The IR graph the node belongs to.
2071 * @param *block The IR block the node belongs to.
2073 ir_node *new_r_End (ir_graph *irg, ir_node *block);
2075 /** Constructor for a Jmp node.
2077 * Jmp represents control flow to a single control successor.
2079 * @param *irg The IR graph the node belongs to.
2080 * @param *block The IR block the node belongs to.
2082 ir_node *new_r_Jmp (ir_graph *irg, ir_node *block);
2084 /** Constructor for an IJmp node.
2086 * IJmp represents control flow to a single control successor not
2087 * statically known i.e. an indirect Jmp.
2089 * @param *irg The IR graph the node belongs to.
2090 * @param *block The IR block the node belongs to.
2091 * @param *tgt The IR node representing the target address.
2093 ir_node *new_r_IJmp (ir_graph *irg, ir_node *block, ir_node *tgt);
2095 /** Constructor for a Cond node.
2097 * If c is mode_b represents a conditional branch (if/else). If c is
2098 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2099 * node, default Proj is 0.)
2101 * This is not consistent: Input to Cond is Is, Proj has as proj number
2104 * @param *irg The IR graph the node belongs to.
2105 * @param *block The IR block the node belongs to.
2106 * @param *c The conditions parameter.Can be of mode b or I_u.
2108 ir_node *new_r_Cond (ir_graph *irg, ir_node *block, ir_node *c);
2110 /** Constructor for a Return node.
2112 * Returns the memory and zero or more return values. Only node that
2113 * can end regular control flow.
2115 * @param *irg The IR graph the node belongs to.
2116 * @param *block The IR block the node belongs to.
2117 * @param *store The state of memory.
2118 * @param arity Number of array indices.
2119 * @param *in[] Array with index inputs to the node. The constructor copies this array.
2121 ir_node *new_r_Return (ir_graph *irg, ir_node *block,
2122 ir_node *store, int arity, ir_node *in[]);
2124 /** Constructor for a Const node.
2126 * Constructor for a Const node. The constant represents a target
2127 * value. Sets the type information to type_unknown. (No more
2128 * supported: If tv is entity derives a somehow useful type.)
2130 * @param *irg The IR graph the node belongs to.
2131 * @param *block The IR block the node belongs to.
2132 * @param *mode The mode of the operands and the results.
2133 * @param *con Points to an entry in the constant table.
2135 ir_node *new_r_Const (ir_graph *irg, ir_node *block,
2136 ir_mode *mode, tarval *con);
2138 /** Constructor for a Const node.
2140 * Constructor for a Const node. The constant represents a target
2141 * value. Sets the type information to type_unknown. (No more
2142 * supported: If tv is entity derives a somehow useful type.)
2144 * @param *irg The IR graph the node belongs to.
2145 * @param *block The IR block the node belongs to.
2146 * @param *mode The mode of the operands and the results.
2147 * @param value A value from which the tarval is made.
2149 ir_node *new_r_Const_long(ir_graph *irg, ir_node *block,
2150 ir_mode *mode, long value);
2152 /** Constructor for a Const_type node.
2154 * The constant represents a target value. This constructor sets high
2155 * level type information for the constant value.
2157 * @param *irg The IR graph the node belongs to.
2158 * @param *block The IR block the node belongs to.
2159 * @param *mode The mode of the operands and results.
2160 * @param *con Points to an entry in the constant table.
2161 * @param *tp The type of the constant.
2163 ir_node *new_r_Const_type(ir_graph *irg, ir_node *block,
2164 ir_mode *mode, tarval *con, ir_type *tp);
2166 /** Constructor for a SymConst node.
2168 * This is the constructor for a symbolic constant.
2169 * There are four kinds of symbolic constants:
2170 * - type_tag The symbolic constant represents a type tag. The type the
2171 * tag stands for is given explicitly.
2172 * - size The symbolic constant represents the size of a type. The
2173 * type of which the constant represents the size is given
2175 * - addr_name The symbolic constant represents the address of an entity
2176 * (variable or method). The variable is indicated by a name
2177 * that is valid for linking.
2178 * - addr_ent The symbolic constant represents the address of an entity
2179 * (variable or method). The variable is given explicitly by
2182 * Inputs to the node:
2183 * No inputs except the block it belongs to.
2184 * Outputs of the node.
2185 * An unsigned integer (I_u) or a pointer (P).
2187 * @param *irg The IR graph the node belongs to.
2188 * @param *block The IR block the node belongs to.
2189 * @param mode The mode for the SymConst.
2190 * @param value A type, entity or a ident depending on the SymConst kind.
2191 * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
2193 ir_node *new_r_SymConst(ir_graph *irg, ir_node *block, ir_mode *mode,
2194 union symconst_symbol value, symconst_kind symkind);
2196 /** Constructor for a simpleSel node.
2198 * This is a shortcut for the new_d_Sel() constructor. To be used for
2199 * Sel nodes that do not select from an array, i.e., have no index
2200 * inputs. It adds the two parameters 0, NULL.
2202 * @param *irg The IR graph the node belongs to.
2203 * @param *block The IR block the node belongs to.
2204 * @param *store The memory in which the object the entity should be selected
2205 * from is allocated.
2206 * @param *objptr The object from that the Sel operation selects a
2207 * single attribute out.
2208 * @param *ent The entity to select.
2210 ir_node *new_r_simpleSel(ir_graph *irg, ir_node *block, ir_node *store,
2211 ir_node *objptr, ir_entity *ent);
2213 /** Constructor for a Sel node.
2215 * The select node selects an entity (field or method) from an entity
2216 * with a compound type. It explicitly specifies the entity selected.
2217 * Dynamically the node may select entities that overwrite the given
2218 * entity. If the selected entity is an array element entity the Sel
2219 * node takes the required array indices as inputs.
2221 * @param *irg The IR graph the node belongs to.
2222 * @param *block The IR block the node belongs to.
2223 * @param *store The memory in which the object the entity should be selected
2224 * from is allocated.
2225 * @param *objptr A pointer to a compound entity the Sel operation selects a
2226 * single attribute from.
2227 * @param *n_index The number of array indices needed to select an array element entity.
2228 * @param *index[] If the compound entity is an array the indices of the selected
2229 * element entity. The constructor copies this array.
2230 * @param *ent The entity to select.
2232 ir_node *new_r_Sel (ir_graph *irg, ir_node *block, ir_node *store,
2233 ir_node *objptr, int n_index, ir_node *index[],
2236 /** Constructor for a Call node.
2238 * Represents all kinds of method and function calls.
2240 * @param *irg The IR graph the node belongs to.
2241 * @param *block The IR block the node belongs to.
2242 * @param *store The actual store.
2243 * @param *callee A pointer to the called procedure.
2244 * @param arity The number of procedure parameters.
2245 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2246 * @param *tp Type information of the procedure called.
2248 ir_node *new_r_Call (ir_graph *irg, ir_node *block, ir_node *store,
2249 ir_node *callee, int arity, ir_node *in[],
2252 /** Constructor for a Add node.
2254 * @param *irg The IR graph the node belongs to.
2255 * @param *block The IR block the node belongs to.
2256 * @param *op1 The first operand.
2257 * @param *op2 The second operand.
2258 * @param *mode The mode of the operands and the result.
2260 ir_node *new_r_Add (ir_graph *irg, ir_node *block,
2261 ir_node *op1, ir_node *op2, ir_mode *mode);
2264 * Constructor for a Sub node.
2266 * @param *irg The IR graph the node belongs to.
2267 * @param *block The IR block the node belongs to.
2268 * @param *op1 The first operand.
2269 * @param *op2 The second operand.
2270 * @param *mode The mode of the operands and the results.
2272 ir_node *new_r_Sub (ir_graph *irg, ir_node *block,
2273 ir_node *op1, ir_node *op2, ir_mode *mode);
2275 /** Constructor for a Minus node.
2277 * @param *irg The IR graph the node belongs to.
2278 * @param *block The IR block the node belongs to.
2279 * @param *op The operand.
2280 * @param *mode The mode of the operand and the result.
2282 ir_node *new_r_Minus (ir_graph *irg, ir_node *block,
2283 ir_node *op, ir_mode *mode);
2285 /** Constructor for a Mul node.
2287 * @param *irg The IR graph the node belongs to.
2288 * @param *block The IR block the node belongs to.
2289 * @param *op1 The first operand.
2290 * @param *op2 The second operand.
2291 * @param *mode The mode of the operands and the result.
2293 ir_node *new_r_Mul (ir_graph *irg, ir_node *block,
2294 ir_node *op1, ir_node *op2, ir_mode *mode);
2296 /** Constructor for a Mulh node.
2298 * @param *irg The IR graph the node belongs to.
2299 * @param *block The IR block the node belongs to.
2300 * @param *op1 The first operand.
2301 * @param *op2 The second operand.
2302 * @param *mode The mode of the operands and the result.
2304 ir_node *new_r_Mulh (ir_graph *irg, ir_node *block,
2305 ir_node *op1, ir_node *op2, ir_mode *mode);
2307 /** Constructor for a Quot node.
2309 * @param *irg The IR graph the node belongs to.
2310 * @param *block The IR block the node belongs to.
2311 * @param *memop The store needed to model exceptions
2312 * @param *op1 The first operand.
2313 * @param *op2 The second operand.
2314 * @param *mode The mode of the result.
2315 * @param state The pinned state.
2317 ir_node *new_r_Quot (ir_graph *irg, ir_node *block,
2318 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2320 /** Constructor for a DivMod node.
2322 * @param *irg The IR graph the node belongs to.
2323 * @param *block The IR block the node belongs to.
2324 * @param *memop The store needed to model exceptions
2325 * @param *op1 The first operand.
2326 * @param *op2 The second operand.
2327 * @param *mode The mode of the results.
2328 * @param state The pinned state.
2330 ir_node *new_r_DivMod (ir_graph *irg, ir_node *block,
2331 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2333 /** Constructor for a Div node.
2335 * @param *irg The IR graph the node belongs to.
2336 * @param *block The IR block the node belongs to.
2337 * @param *memop The store needed to model exceptions
2338 * @param *op1 The first operand.
2339 * @param *op2 The second operand.
2340 * @param *mode The mode of the result.
2341 * @param state The pinned state.
2343 ir_node *new_r_Div (ir_graph *irg, ir_node *block,
2344 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2346 /** Constructor for a remainderless Div node.
2348 * @param *irg The IR graph the node belongs to.
2349 * @param *block The IR block the node belongs to.
2350 * @param *memop The store needed to model exceptions
2351 * @param *op1 The first operand.
2352 * @param *op2 The second operand.
2353 * @param *mode The mode of the result.
2354 * @param state The pinned state.
2356 ir_node *new_r_DivRL (ir_graph *irg, ir_node *block,
2357 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2359 /** Constructor for a Mod node.
2361 * @param *irg The IR graph the node belongs to.
2362 * @param *block The IR block the node belongs to.
2363 * @param *memop The store needed to model exceptions
2364 * @param *op1 The first operand.
2365 * @param *op2 The second operand.
2366 * @param *mode The mode of the result.
2367 * @param state The pinned state.
2369 ir_node *new_r_Mod (ir_graph *irg, ir_node *block,
2370 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2372 /** Constructor for a Abs node.
2374 * @param *irg The IR graph the node belongs to.
2375 * @param *block The IR block the node belongs to.
2376 * @param *op The operand
2377 * @param *mode The mode of the operands and the result.
2379 ir_node *new_r_Abs (ir_graph *irg, ir_node *block,
2380 ir_node *op, ir_mode *mode);
2382 /** Constructor for a And node.
2384 * @param *irg The IR graph the node belongs to.
2385 * @param *block The IR block the node belongs to.
2386 * @param *op1 The first operand.
2387 * @param *op2 The second operand.
2388 * @param *mode The mode of the operands and the result.
2390 ir_node *new_r_And (ir_graph *irg, ir_node *block,
2391 ir_node *op1, ir_node *op2, ir_mode *mode);
2393 /** Constructor for a Or node.
2395 * @param *irg The IR graph the node belongs to.
2396 * @param *block The IR block the node belongs to.
2397 * @param *op1 The first operand.
2398 * @param *op2 The second operand.
2399 * @param *mode The mode of the operands and the result.
2401 ir_node *new_r_Or (ir_graph *irg, ir_node *block,
2402 ir_node *op1, ir_node *op2, ir_mode *mode);
2404 /** Constructor for a Eor node.
2406 * @param *irg The IR graph the node belongs to.
2407 * @param *block The IR block the node belongs to.
2408 * @param *op1 The first operand.
2409 * @param *op2 The second operand.
2410 * @param *mode The mode of the operands and the results.
2412 ir_node *new_r_Eor (ir_graph *irg, ir_node *block,
2413 ir_node *op1, ir_node *op2, ir_mode *mode);
2415 /** Constructor for a Not node.
2417 * @param *irg The IR graph the node belongs to.
2418 * @param *block The IR block the node belongs to.
2419 * @param *op The operand.
2420 * @param *mode The mode of the operand and the result.
2422 ir_node *new_r_Not (ir_graph *irg, ir_node *block,
2423 ir_node *op, ir_mode *mode);
2425 /** Constructor for a Cmp node.
2427 * @param *irg The IR graph the node belongs to.
2428 * @param *block The IR block the node belongs to.
2429 * @param *op1 The first operand.
2430 * @param *op2 The second operand.
2432 ir_node *new_r_Cmp (ir_graph *irg, ir_node *block,
2433 ir_node *op1, ir_node *op2);
2435 /** Constructor for a Shl node.
2437 * @param *irg The IR graph the node belongs to.
2438 * @param *block The IR block the node belongs to.
2439 * @param *op The operand.
2440 * @param *k The number of bits to shift the operand .
2441 * @param *mode The mode of the operand and the result.
2443 ir_node *new_r_Shl (ir_graph *irg, ir_node *block,
2444 ir_node *op, ir_node *k, ir_mode *mode);
2446 /** Constructor for a Shr node.
2448 * @param *irg The IR graph the node belongs to.
2449 * @param *block The IR block the node belongs to.
2450 * @param *op The operand.
2451 * @param *k The number of bits to shift the operand .
2452 * @param *mode The mode of the operand and the result.
2454 ir_node *new_r_Shr (ir_graph *irg, ir_node *block,
2455 ir_node *op, ir_node *k, ir_mode *mode);
2458 * Constructor for a Shrs node.
2460 * @param *irg The IR graph the node belongs to.
2461 * @param *block The IR block the node belongs to.
2462 * @param *op The operand.
2463 * @param *k The number of bits to shift the operand.
2464 * @param *mode The mode of the operand and the result.
2466 ir_node *new_r_Shrs (ir_graph *irg, ir_node *block,
2467 ir_node *op, ir_node *k, ir_mode *mode);
2469 /** Constructor for a Rotl node.
2471 * @param *irg The IR graph the node belongs to.
2472 * @param *block The IR block the node belongs to.
2473 * @param *op The operand.
2474 * @param *k The number of bits to rotate the operand.
2475 * @param *mode The mode of the operand.
2477 ir_node *new_r_Rotl (ir_graph *irg, ir_node *block,
2478 ir_node *op, ir_node *k, ir_mode *mode);
2480 /** Constructor for a Conv node.
2482 * @param *irg The IR graph the node belongs to.
2483 * @param *block The IR block the node belongs to.
2484 * @param *op The operand.
2485 * @param *mode The mode of this the operand muss be converted .
2487 ir_node *new_r_Conv (ir_graph *irg, ir_node *block,
2488 ir_node *op, ir_mode *mode);
2490 /** Constructor for a Cast node.
2492 * High level type cast
2494 * @param *irg The IR graph the node belongs to.
2495 * @param *block The IR block the node belongs to.
2496 * @param *op The operand.
2497 * @param *to_tp The type of this the operand muss be casted .
2499 ir_node *new_r_Cast (ir_graph *irg, ir_node *block,
2500 ir_node *op, ir_type *to_tp);
2502 /** Constructor for a Carry node.
2504 * @param *irg The IR graph the node belongs to.
2505 * @param *block The IR block the node belongs to.
2506 * @param *op1 The first operand.
2507 * @param *op2 The second operand.
2508 * @param *mode The mode of the operands and the result.
2510 ir_node *new_r_Carry (ir_graph *irg, ir_node *block,
2511 ir_node *op1, ir_node *op2, ir_mode *mode);
2514 * Constructor for a Borrow node.
2516 * @param *irg The IR graph the node belongs to.
2517 * @param *block The IR block the node belongs to.
2518 * @param *op1 The first operand.
2519 * @param *op2 The second operand.
2520 * @param *mode The mode of the operands and the results.
2522 ir_node *new_r_Borrow (ir_graph *irg, ir_node *block,
2523 ir_node *op1, ir_node *op2, ir_mode *mode);
2525 /** Constructor for a Phi node.
2527 * @param *irg The IR graph the node belongs to.
2528 * @param *block The IR block the node belongs to.
2529 * @param arity The number of predecessors
2530 * @param *in[] Array with predecessors. The constructor copies this array.
2531 * @param *mode The mode of it's inputs and output.
2533 ir_node *new_r_Phi (ir_graph *irg, ir_node *block, int arity,
2534 ir_node *in[], ir_mode *mode);
2536 /** Constructor for a Load node.
2538 * @param *irg The IR graph the node belongs to.
2539 * @param *block The IR block the node belongs to.
2540 * @param *store The current memory
2541 * @param *adr A pointer to the variable to be read in this memory.
2542 * @param *mode The mode of the value to be loaded.
2544 ir_node *new_r_Load (ir_graph *irg, ir_node *block,
2545 ir_node *store, ir_node *adr, ir_mode *mode);
2547 /** Constructor for a Store node.
2549 * @param *irg The IR graph the node belongs to.
2550 * @param *block The IR block the node belongs to.
2551 * @param *store The current memory
2552 * @param *adr A pointer to the variable to be read in this memory.
2553 * @param *val The value to write to this variable.
2555 ir_node *new_r_Store (ir_graph *irg, ir_node *block,
2556 ir_node *store, ir_node *adr, ir_node *val);
2558 /** Constructor for a Alloc node.
2560 * The Alloc node extends the memory by space for an entity of type alloc_type.
2562 * @param *irg The IR graph the node belongs to.
2563 * @param *block The IR block the node belongs to.
2564 * @param *store The memory which shall contain the new variable.
2565 * @param *size The number of bytes to allocate.
2566 * @param *alloc_type The type of the allocated variable.
2567 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
2569 ir_node *new_r_Alloc (ir_graph *irg, ir_node *block, ir_node *store,
2570 ir_node *size, ir_type *alloc_type, ir_where_alloc where);
2572 /** Constructor for a Free node.
2574 * Frees the memory occupied by the entity pointed to by the pointer
2575 * arg. Type indicates the type of the entity the argument points to.
2577 * @param *irg The IR graph the node belongs to.
2578 * @param *block The IR block the node belongs to.
2579 * @param *store The memory which shall contain the new variable.
2580 * @param *ptr The pointer to the object to free.
2581 * @param *size The number of objects of type free_type to free in a sequence.
2582 * @param *free_type The type of the freed variable.
2583 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
2585 ir_node *new_r_Free (ir_graph *irg, ir_node *block, ir_node *store,
2586 ir_node *ptr, ir_node *size, ir_type *free_type, ir_where_alloc where);
2588 /** Constructor for a Sync node.
2590 * Merges several memory values. The node assumes that a variable
2591 * either occurs only in one of the memories, or it contains the same
2592 * value in all memories where it occurs.
2594 * @param *irg The IR graph the node belongs to.
2595 * @param *block The IR block the node belongs to.
2596 * @param arity The number of memories to synchronize.
2597 * @param *in[] An array of pointers to nodes that produce an output of type memory.
2598 * The constructor copies this array.
2600 ir_node *new_r_Sync (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2602 /** Constructor for a Proj node.
2604 * Projects a single value out of a tuple. The parameter proj gives the
2605 * position of the value within the tuple.
2607 * @param *irg The IR graph the node belongs to.
2608 * @param *block The IR block the node belongs to.
2609 * @param arg A node producing a tuple.
2610 * @param *mode The mode of the value to project.
2611 * @param proj The position of the value in the tuple.
2613 ir_node *new_r_Proj (ir_graph *irg, ir_node *block, ir_node *arg,
2614 ir_mode *mode, long proj);
2616 /** Constructor for a defaultProj node.
2618 * Represents the default control flow of a Switch-Cond node.
2620 * @param *irg The IR graph the node belongs to.
2621 * @param *block The IR block the node belongs to.
2622 * @param arg A node producing a tuple.
2623 * @param max_proj The end position of the value in the tuple.
2625 ir_node *new_r_defaultProj (ir_graph *irg, ir_node *block, ir_node *arg, long max_proj);
2628 /** Constructor for a Tuple node.
2630 * This is an auxiliary node to replace a node that returns a tuple
2631 * without changing the corresponding Proj nodes.
2633 * @param *irg The IR graph the node belongs to.
2634 * @param *block The IR block the node belongs to.
2635 * @param arity The number of tuple elements.
2636 * @param *in[] An array containing pointers to the nodes producing the tuple elements.
2637 * The constructor copies this array.
2639 ir_node *new_r_Tuple (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2641 /** Constructor for a Id node.
2643 * This is an auxiliary node to replace a node that returns a single
2646 * @param *irg The IR graph the node belongs to.
2647 * @param *block The IR block the node belongs to.
2648 * @param *val The operand to Id.
2649 * @param *mode The mode of *val.
2651 ir_node *new_r_Id (ir_graph *irg, ir_node *block,
2652 ir_node *val, ir_mode *mode);
2654 /** Constructor for a Bad node.
2656 * Returns the unique Bad node of the graph. The same as
2659 * @param *irg The IR graph the node belongs to.
2662 ir_node *new_r_Bad (ir_graph *irg);
2664 /** Constructor for a Confirm node.
2666 * Specifies constraints for a value. To support dataflow analyses.
2668 * Example: If the value never exceeds '100' this is expressed by placing a
2669 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
2671 * @param *irg The IR graph the node belong to.
2672 * @param *block The IR block the node belong to.
2673 * @param *val The value we express a constraint for
2674 * @param *bound The value to compare against. Must be a firm node, typically a constant.
2675 * @param cmp The compare operation.
2677 ir_node *new_r_Confirm(ir_graph *irg, ir_node *block,
2678 ir_node *val, ir_node *bound, pn_Cmp cmp);
2680 /** Constructor for a Unknown node.
2682 * Represents an arbitrary value. Places the node in
2685 * @param *irg The IR graph the node belongs to.
2686 * @param *m The mode of the unknown value.
2688 ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2690 /** Constructor for a CallBegin node.
2692 * CallBegin represents control flow depending of the pointer value
2693 * representing the called method to the called methods. The
2694 * constructor copies the method pointer input from the passed Call
2697 * @param *irg The IR graph the node belong to.
2698 * @param *block The block the node belong to.
2699 * @param *callee The call node visible in the intra procedural view.
2701 ir_node *new_r_CallBegin(ir_graph *irg, ir_node *block, ir_node *callee);
2703 /** Constructor for a EndReg node.
2705 * Used to represent regular procedure end in interprocedual view.
2707 * @param *irg The IR graph the node belong to.
2708 * @param *block The block the node belong to.
2710 ir_node *new_r_EndReg (ir_graph *irg, ir_node *block);
2712 /** Constructor for a EndExcept node.
2714 * Used to represent exceptional procedure end in interprocedural view.
2716 * @param *irg The IR graph the node belong to.
2717 * @param *block The block the node belong to.
2719 ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
2721 /** Constructor for a Break node.
2723 * Break represents control flow to a single control successor just as Jmp.
2724 * The blocks separated by a break may not be concatenated by an optimization.
2725 * It is used for the interprocedural representation where blocks are parted
2726 * behind Call nodes to represent the control flow to called procedures.
2728 * @param *irg The IR graph the node belong to.
2729 * @param *block The block the node belong to.
2731 ir_node *new_r_Break (ir_graph *irg, ir_node *block);
2733 /** Constructor for a Filter node.
2735 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
2736 * Filter is a node with two views used to construct the interprocedural view.
2737 * In intraprocedural view its semantics are identical to the Proj node.
2738 * In interprocedural view the Filter performs the Phi operation on method
2739 * parameters or results. Other than a Phi a Filter node may not be removed
2740 * if it has only a single input.
2742 * The constructor builds the Filter in intraprocedural view.
2744 * @param *irg The IR graph the node belong to.
2745 * @param *block The block the node belong to.
2746 * @param *arg The tuple value to project from.
2747 * @param *mode The mode of the projected value.
2748 * @param proj The position in the tuple to project from.
2750 ir_node *new_r_Filter (ir_graph *irg, ir_node *block, ir_node *arg,
2751 ir_mode *mode, long proj);
2753 /** Constructor for a NoMem node.
2755 * Returns the unique NoMem node of the graph. The same as
2758 * @param *irg The IR graph the node belongs to.
2760 ir_node *new_r_NoMem (ir_graph *irg);
2762 /** Constructor for a Mux node.
2764 * @param *irg The IR graph the node belong to.
2765 * @param *block The block the node belong to.
2766 * @param *sel The ir_node that calculates the boolean select.
2767 * @param *ir_true The ir_node that calculates the true result.
2768 * @param *ir_false The ir_node that calculates the false result.
2769 * @param *mode The mode of the node (and it_true and ir_false).
2771 ir_node *new_r_Mux (ir_graph *irg, ir_node *block,
2772 ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2774 /** Constructor for a CopyB node.
2776 * @param *irg The IR graph the node belong to.
2777 * @param *block The block the node belong to.
2778 * @param *store The current memory
2779 * @param *dst The ir_node that represents the destination address.
2780 * @param *src The ir_node that represents the source address.
2781 * @param *data_type The type of the copied data
2783 ir_node *new_r_CopyB(ir_graph *irg, ir_node *block,
2784 ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
2786 /** Constructor for a InstOf node.
2788 * A High-Level Type check.
2790 * @param *irg The IR graph the node belongs to.
2791 * @param *block The IR block the node belongs to.
2792 * @param *store The memory in which the object the entity should be selected
2793 * from is allocated.
2794 * @param *objptr A pointer to a object of a class type.
2795 * @param *type The type of which objptr must be.
2797 ir_node *new_r_InstOf(ir_graph *irg, ir_node *block, ir_node *store,
2798 ir_node *objptr, ir_type *type);
2800 /** Constructor for a Raise node.
2802 * A High-Level Exception throw.
2804 * @param *irg The IR graph the node belongs to.
2805 * @param *block The IR block the node belongs to.
2806 * @param *store The current memory.
2807 * @param *obj A pointer to the Except variable.
2809 ir_node *new_r_Raise(ir_graph *irg, ir_node *block,
2810 ir_node *store, ir_node *obj);
2812 /** Constructor for a Bound node.
2814 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2816 * @param *irg The IR graph the node belong to.
2817 * @param *block The block the node belong to.
2818 * @param *store The current memory.
2819 * @param *idx The ir_node that represents an index.
2820 * @param *lower The ir_node that represents the lower bound for the index.
2821 * @param *upper The ir_node that represents the upper bound for the index.
2823 ir_node *new_r_Bound(ir_graph *irg, ir_node *block,
2824 ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
2826 /** Constructor for a Pin node.
2828 * @param *irg The IR graph the node belong to.
2829 * @param *block The block the node belong to.
2830 * @param *node The node which value should be pinned.
2832 ir_node *new_r_Pin(ir_graph *irg, ir_node *block, ir_node *node);
2834 /** Constructor for an ASM pseudo node.
2836 * @param *irg The IR graph the node belong to.
2837 * @param *block The block the node belong to.
2838 * @param arity The number of data inputs to the node.
2839 * @param *in The array of length arity of data inputs.
2840 * @param *inputs The array of length arity of input constraints.
2841 * @param n_outs The number of data outputs to the node.
2842 * @param *outputs The array of length n_outs of output constraints.
2843 * @param n_clobber The number of clobbered registers.
2844 * @param *clobber The array of length n_clobber of clobbered registers.
2845 * @param *asm_text The assembler text.
2847 ir_node *new_r_ASM(ir_graph *irg, ir_node *block,
2848 int arity, ir_node *in[], ir_asm_constraint *inputs,
2849 int n_outs, ir_asm_constraint *outputs,
2850 int n_clobber, ident *clobber[], ident *asm_text);
2852 /*-----------------------------------------------------------------------*/
2853 /* The block oriented interface */
2854 /*-----------------------------------------------------------------------*/
2856 /** Sets the current block in which the following constructors place the
2857 * nodes they construct.
2859 * @param target The new current block.
2861 void set_cur_block (ir_node *target);
2863 /** Returns the current block of the current graph. */
2864 ir_node *get_cur_block(void);
2866 /** Returns the fixed nodes of the current graph. */
2867 #define get_cur_end_block() get_irg_end_block(current_ir_graph)
2868 #define get_cur_end() get_irg_end(current_ir_graph)
2869 #define get_cur_start_block() get_irg_start_block(current_ir_graph)
2870 #define get_cur_start() get_irg_start(current_ir_graph)
2872 /** Constructor for a Block node.
2874 * Adds the block to the graph in current_ir_graph. Constructs a Block
2875 * with a fixed number of predecessors. Does set current_block. Can
2876 * be used with automatic Phi node construction.
2878 * @param *db A Pointer for debug information.
2879 * @param arity The number of control predecessors.
2880 * @param in[] An array of control predecessors. The length of
2881 * the array must be 'arity'.
2883 ir_node *new_d_Block(dbg_info *db, int arity, ir_node *in[]);
2885 /** Constructor for a Start node.
2887 * Adds the node to the block in current_ir_block.
2889 * @param *db A pointer for debug information.
2891 ir_node *new_d_Start (dbg_info *db);
2893 /** Constructor for a End node.
2895 * Adds the node to the block in current_ir_block.
2897 * @param *db A pointer for debug information.
2899 ir_node *new_d_End (dbg_info *db);
2901 /** Constructor for a Jmp node.
2903 * Adds the node to the block in current_ir_block.
2905 * Jmp represents control flow to a single control successor.
2907 * @param *db A pointer for debug information.
2909 ir_node *new_d_Jmp (dbg_info *db);
2911 /** Constructor for an IJmp node.
2913 * IJmp represents control flow to a single control successor not
2914 * statically known i.e. an indirect Jmp.
2916 * @param *db A pointer for debug information.
2917 * @param *tgt The IR node representing the target address.
2919 ir_node *new_d_IJmp (dbg_info *db, ir_node *tgt);
2921 /** Constructor for a Cond node.
2923 * Adds the node to the block in current_ir_block.
2925 * If c is mode_b represents a conditional branch (if/else). If c is
2926 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2927 * node, default Proj is 0.)
2929 * This is not consistent: Input to Cond is Is, Proj has as proj number
2932 * @param *db A pointer for debug information.
2933 * @param *c The conditions parameter.Can be of mode b or I_u.
2935 ir_node *new_d_Cond (dbg_info *db, ir_node *c);
2937 /** Constructor for a Return node.
2939 * Adds the node to the block in current_ir_block.
2941 * Returns the memory and zero or more return values. Only node that
2942 * can end regular control flow.
2944 * @param *db A pointer for debug information.
2945 * @param *store The state of memory.
2946 * @param arity Number of array indices.
2947 * @param *in Array with index inputs to the node.
2949 ir_node *new_d_Return (dbg_info *db, ir_node *store, int arity, ir_node *in[]);
2951 /** Constructor for a Const_type node.
2953 * Adds the node to the block in current_ir_block.
2955 * The constant represents a target value. This constructor sets high
2956 * level type information for the constant value.
2958 * @param *db A pointer for debug information.
2959 * @param *mode The mode of the operands and results.
2960 * @param *con Points to an entry in the constant table. This pointer is
2961 added to the attributes of the node.
2962 * @param *tp The type of the constant.
2964 ir_node *new_d_Const_type (dbg_info *db, ir_mode *mode, tarval *con, ir_type *tp);
2966 /** Constructor for a Const node.
2968 * Adds the node to the block in current_ir_block.
2970 * Constructor for a Const node. The constant represents a target
2971 * value. Sets the type information to type_unknown. (No more
2972 * supported: If tv is entity derives a somehow useful type.)
2974 * @param *db A pointer for debug information.
2975 * @param *mode The mode of the operands and results.
2976 * @param *con Points to an entry in the constant table. This pointer is added
2977 * to the attributes of the node.
2979 ir_node *new_d_Const (dbg_info *db, ir_mode *mode, tarval *con);
2981 /** Constructor for a SymConst_type node.
2983 * Adds the node to the block in current_ir_block.
2984 * This is the constructor for a symbolic constant.
2985 * There are four kinds of symbolic constants:
2986 * - type_tag The symbolic constant represents a type tag. The type the
2987 * tag stands for is given explicitly.
2988 * - size The symbolic constant represents the size of a type. The
2989 * type of which the constant represents the size is given
2991 * - addr_name The symbolic constant represents the address of an entity
2992 * (variable or method). The variable is indicated by a name
2993 * that is valid for linking.
2994 * - addr_ent The symbolic constant represents the address of an entity
2995 * (variable or method). The variable is given explicitly by
2998 * Inputs to the node:
2999 * No inputs except the block it belongs to.
3000 * Outputs of the node.
3001 * An unsigned integer (I_u) or a pointer (P).
3003 * @param *db A pointer for debug information.
3004 * @param mode The mode for the SymConst.
3005 * @param value A type, entity or ident depending on the SymConst kind.
3006 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size,
3007 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
3008 * @param tp The source type of the constant.
3010 ir_node *new_d_SymConst_type(dbg_info *db, ir_mode *mode,
3011 union symconst_symbol value, symconst_kind kind, ir_type *tp);
3013 /** Constructor for a SymConst node.
3015 * Same as new_d_SymConst_type, except that it sets the type to type_unknown.
3017 ir_node *new_d_SymConst(dbg_info *db, ir_mode *mode,
3018 union symconst_symbol value, symconst_kind kind);
3020 /** Constructor for a simpleSel node.
3022 * This is a shortcut for the new_d_Sel() constructor. To be used for
3023 * Sel nodes that do not select from an array, i.e., have no index
3024 * inputs. It adds the two parameters 0, NULL.
3026 * @param *db A pointer for debug information.
3027 * @param *store The memory in which the object the entity should be
3028 * selected from is allocated.
3029 * @param *objptr The object from that the Sel operation selects a
3030 * single attribute out.
3031 * @param *ent The entity to select.
3033 ir_node *new_d_simpleSel(dbg_info *db, ir_node *store, ir_node *objptr, ir_entity *ent);
3035 /** Constructor for a Sel node.
3037 * The select node selects an entity (field or method) from an entity
3038 * with a compound type. It explicitly specifies the entity selected.
3039 * Dynamically the node may select entities that overwrite the given
3040 * entity. If the selected entity is an array element entity the Sel
3041 * node takes the required array indices as inputs.
3042 * Adds the node to the block in current_ir_block.
3044 * @param *db A pointer for debug information.
3045 * @param *store The memory in which the object the entity should be selected
3046 * from is allocated.
3047 * @param *objptr A pointer to a compound entity the Sel operation selects a
3048 * single attribute from.
3049 * @param arity The number of array indices needed to select an array element entity.
3050 * @param *in[] If the compound entity is an array the indices of the selected
3051 * element entity. The constructor copies this array.
3052 * @param *ent The entity to select.
3054 ir_node *new_d_Sel (dbg_info *db, ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3057 /** Constructor for a Call node.
3059 * Represents all kinds of method and function calls.
3060 * Adds the node to the block in current_ir_block.
3062 * @param *db A pointer for debug information.
3063 * @param *store The actual store.
3064 * @param *callee A pointer to the called procedure.
3065 * @param arity The number of procedure parameters.
3066 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3067 * @param *tp Type information of the procedure called.
3069 ir_node *new_d_Call (dbg_info *db, ir_node *store, ir_node *callee, int arity, ir_node *in[],
3072 /** Constructor for a Add node.
3074 * Adds the node to the block in current_ir_block.
3076 * @param *db A pointer for debug information.
3077 * @param *op1 The first operand.
3078 * @param *op2 The second operand.
3079 * @param *mode The mode of the operands and the result.
3081 ir_node *new_d_Add (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3083 /** Constructor for a Sub node.
3085 * Adds the node to the block in current_ir_block.
3087 * @param *db A pointer for debug information.
3088 * @param *op1 The first operand.
3089 * @param *op2 The second operand.
3090 * @param *mode The mode of the operands and the result.
3092 ir_node *new_d_Sub (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3094 /** Constructor for a Minus node.
3096 * Adds the node to the block in current_ir_block.
3098 * @param *db A pointer for debug information.
3099 * @param *op The operand .
3100 * @param *mode The mode of the operand and the result.
3102 ir_node *new_d_Minus (dbg_info *db, ir_node *op, ir_mode *mode);
3104 /** Constructor for a Mul node.
3106 * Adds the node to the block in current_ir_block.
3108 * @param *db A pointer for debug information.
3109 * @param *op1 The first operand.
3110 * @param *op2 The second operand.
3111 * @param *mode The mode of the operands and the result.
3113 ir_node *new_d_Mul (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3115 /** Constructor for a Mulh node.
3117 * Adds the node to the block in current_ir_block.
3119 * @param *db A pointer for debug information.
3120 * @param *op1 The first operand.
3121 * @param *op2 The second operand.
3122 * @param *mode The mode of the operands and the result.
3124 ir_node *new_d_Mulh (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3126 /** Constructor for a Quot node.
3128 * Adds the node to the block in current_ir_block.
3130 * @param *db A pointer for debug information.
3131 * @param *memop The store needed to model exceptions
3132 * @param *op1 The first operand.
3133 * @param *op2 The second operand.
3134 * @param *mode The mode of the result.
3135 * @param state The pinned state.
3137 ir_node *new_d_Quot (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3139 /** Constructor for a DivMod node.
3141 * Adds the node to the block in current_ir_block.
3143 * @param *db A pointer for debug information.
3144 * @param *memop The store needed to model exceptions
3145 * @param *op1 The first operand.
3146 * @param *op2 The second operand.
3147 * @param *mode The mode of the results.
3148 * @param state The pinned state.
3150 ir_node *new_d_DivMod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3152 /** Constructor for a Div node.
3154 * Adds the node to the block in current_ir_block.
3156 * @param *db A pointer for debug information.
3157 * @param *memop The store needed to model exceptions
3158 * @param *op1 The first operand.
3159 * @param *op2 The second operand.
3160 * @param *mode The mode of the result.
3161 * @param state The pinned state.
3163 ir_node *new_d_Div (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3165 /** Constructor for a remainderless Div node.
3167 * Adds the node to the block in current_ir_block.
3169 * @param *db A pointer for debug information.
3170 * @param *memop The store needed to model exceptions
3171 * @param *op1 The first operand.
3172 * @param *op2 The second operand.
3173 * @param *mode The mode of the result.
3174 * @param state The pinned state.
3176 ir_node *new_d_DivRL (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3178 /** Constructor for a Mod node.
3180 * Adds the node to the block in current_ir_block.
3182 * @param *db A pointer for debug information.
3183 * @param *memop The store needed to model exceptions
3184 * @param *op1 The first operand.
3185 * @param *op2 The second operand.
3186 * @param *mode The mode of the result.
3187 * @param state The pinned state.
3189 ir_node *new_d_Mod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3191 /** Constructor for a Abs node.
3193 * Adds the node to the block in current_ir_block.
3195 * @param *db A pointer for debug information.
3196 * @param *op The operand
3197 * @param *mode The mode of the operands and the result.
3199 ir_node *new_d_Abs (dbg_info *db, ir_node *op, ir_mode *mode);
3201 /** Constructor for a And node.
3203 * Adds the node to the block in current_ir_block.
3205 * @param *db A pointer for debug information.
3206 * @param *op1 The first operand.
3207 * @param *op2 The second operand.
3208 * @param *mode The mode of the operands and the result.
3210 ir_node *new_d_And (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3212 /** Constructor for a Or node.
3214 * Adds the node to the block in current_ir_block.
3216 * @param *db A pointer for debug information.
3217 * @param *op1 The first operand.
3218 * @param *op2 The second operand.
3219 * @param *mode The mode of the operands and the result.
3221 ir_node *new_d_Or (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3223 /** Constructor for a Eor node.
3225 * Adds the node to the block in current_ir_block.
3227 * @param *db A pointer for debug information.
3228 * @param *op1 The first operand.
3229 * @param *op2 The second operand.
3230 * @param *mode The mode of the operands and the results.
3232 ir_node *new_d_Eor (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3234 /** Constructor for a Not node.
3236 * Adds the node to the block in current_ir_block.
3238 * @param *db A pointer for debug information.
3239 * @param *op The operand.
3240 * @param *mode The mode of the operand and the result.
3242 ir_node *new_d_Not (dbg_info *db, ir_node *op, ir_mode *mode);
3244 /** Constructor for a Shl node.
3246 * Adds the node to the block in current_ir_block.
3248 * @param *db A pointer for debug information.
3249 * @param *op The operand.
3250 * @param *k The number of bits to shift the operand .
3251 * @param *mode The mode of the operand and the result.
3253 ir_node *new_d_Shl (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3255 /** Constructor for a Shr node.
3257 * Adds the node to the block in current_ir_block.
3259 * @param *db A pointer for debug information.
3260 * @param *op The operand.
3261 * @param *k The number of bits to shift the operand .
3262 * @param *mode The mode of the operand and the result.
3264 ir_node *new_d_Shr (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3266 /** Constructor for a Shrs node.
3268 * Adds the node to the block in current_ir_block.
3270 * @param *db A pointer for debug information.
3271 * @param *op The operand.
3272 * @param *k The number of bits to shift the operand .
3273 * @param *mode The mode of the operand and the result.
3275 ir_node *new_d_Shrs (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3277 /** Constructor for a Rotl node.
3279 * Adds the node to the block in current_ir_block.
3281 * @param *db A pointer for debug information.
3282 * @param *op The operand.
3283 * @param *k The number of bits to rotate the operand.
3284 * @param *mode The mode of the operand.
3286 ir_node *new_d_Rotl (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3288 /** Constructor for a Cmp node.
3290 * Adds the node to the block in current_ir_block.
3292 * @param *db A pointer for debug information.
3293 * @param *op1 The first operand.
3294 * @param *op2 The second operand.
3296 ir_node *new_d_Cmp (dbg_info *db, ir_node *op1, ir_node *op2);
3298 /** Constructor for a Conv node.
3300 * Adds the node to the block in current_ir_block.
3302 * @param *db A pointer for debug information.
3303 * @param *op The operand.
3304 * @param *mode The mode of this the operand muss be converted .
3306 ir_node *new_d_Conv (dbg_info *db, ir_node *op, ir_mode *mode);
3308 /** Constructor for a strict Conv node.
3310 * Adds the node to the block in current_ir_block.
3312 * @param *db A pointer for debug information.
3313 * @param *op The operand.
3314 * @param *mode The mode of this the operand muss be converted .
3316 ir_node *new_d_strictConv (dbg_info *db, ir_node *op, ir_mode *mode);
3318 /** Constructor for a Cast node.
3320 * High level type cast
3321 * Adds the node to the block in current_ir_block.
3323 * @param *db A pointer for debug information.
3324 * @param *op The operand.
3325 * @param *to_tp The type of this the operand muss be casted .
3327 ir_node *new_d_Cast (dbg_info *db, ir_node *op, ir_type *to_tp);
3329 /** Constructor for a Carry node.
3331 * Adds the node to the block in current_ir_block.
3333 * @param *db A pointer for debug information.
3334 * @param *op1 The first operand.
3335 * @param *op2 The second operand.
3336 * @param *mode The mode of the operands and the result.
3338 ir_node *new_d_Carry (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3340 /** Constructor for a Borrow node.
3342 * Adds the node to the block in current_ir_block.
3344 * @param *db A pointer for debug information.
3345 * @param *op1 The first operand.
3346 * @param *op2 The second operand.
3347 * @param *mode The mode of the operands and the result.
3349 ir_node *new_d_Borrow (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3351 /** Constructor for a Phi node.
3353 * Adds the node to the block in current_ir_block.
3355 * @param *db A pointer for debug information.
3356 * @param arity The number of predecessors
3357 * @param *in Array with predecessors
3358 * @param *mode The mode of it's inputs and output.
3360 ir_node *new_d_Phi (dbg_info *db, int arity, ir_node *in[], ir_mode *mode);
3362 /** Constructor for a Load node.
3364 * Adds the node to the block in current_ir_block.
3366 * @param *db A pointer for debug information.
3367 * @param *store The current memory
3368 * @param *addr A pointer to the variable to be read in this memory.
3369 * @param *mode The mode of the value to be loaded.
3371 ir_node *new_d_Load (dbg_info *db, ir_node *store, ir_node *addr, ir_mode *mode);
3373 /** Constructor for a Store node.
3375 * Adds the node to the block in current_ir_block.
3377 * @param *db A pointer for debug information.
3378 * @param *store The current memory
3379 * @param *addr A pointer to the variable to be read in this memory.
3380 * @param *val The value to write to this variable.
3382 ir_node *new_d_Store (dbg_info *db, ir_node *store, ir_node *addr, ir_node *val);
3384 /** Constructor for a Alloc node.
3386 * The Alloc node extends the memory by space for an entity of type alloc_type.
3387 * Adds the node to the block in current_ir_block.
3389 * @param *db A pointer for debug information.
3390 * @param *store The memory which shall contain the new variable.
3391 * @param *size The number of bytes to allocate.
3392 * @param *alloc_type The type of the allocated variable.
3393 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3395 ir_node *new_d_Alloc (dbg_info *db, ir_node *store, ir_node *size, ir_type *alloc_type,
3396 ir_where_alloc where);
3398 /** Constructor for a Free node.
3400 * Frees the memory occupied by the entity pointed to by the pointer
3401 * arg. Type indicates the type of the entity the argument points to.
3402 * Adds the node to the block in current_ir_block.
3404 * @param *db A pointer for debug information.
3405 * @param *store The memory which shall contain the new variable.
3406 * @param *ptr The pointer to the object to free.
3407 * @param *size The number of objects of type free_type to free in a sequence.
3408 * @param *free_type The type of the freed variable.
3409 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
3411 ir_node *new_d_Free (dbg_info *db, ir_node *store, ir_node *ptr, ir_node *size,
3412 ir_type *free_type, ir_where_alloc where);
3414 /** Constructor for a Sync node.
3416 * Merges several memory values. The node assumes that a variable
3417 * either occurs only in one of the memories, or it contains the same
3418 * value in all memories where it occurs.
3419 * Adds the node to the block in current_ir_block.
3421 * @param *db A pointer for debug information.
3422 * @param arity The number of memories to synchronize.
3423 * @param **in An array of pointers to nodes that produce an output of type
3424 * memory. The constructor copies this array.
3426 ir_node *new_d_Sync (dbg_info *db, int arity, ir_node *in[]);
3428 /** Constructor for a Proj node.
3430 * Projects a single value out of a tuple. The parameter proj gives the
3431 * position of the value within the tuple.
3432 * Adds the node to the block in current_ir_block.
3434 * @param *db A pointer for deubug information.
3435 * @param arg A node producing a tuple.
3436 * @param *mode The mode of the value to project.
3437 * @param proj The position of the value in the tuple.
3439 ir_node *new_d_Proj (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3441 /** Constructor for a defaultProj node.
3443 * Represents the default control flow of a Switch-Cond node.
3444 * Adds the node to the block in current_ir_block.
3446 * @param *db A pointer for debug information.
3447 * @param arg A node producing a tuple.
3448 * @param max_proj The end position of the value in the tuple.
3450 ir_node *new_d_defaultProj (dbg_info *db, ir_node *arg, long max_proj);
3452 /** Constructor for a Tuple node.
3454 * This is an auxiliary node to replace a node that returns a tuple
3455 * without changing the corresponding Proj nodes.
3456 * Adds the node to the block in current_ir_block.
3458 * @param *db A pointer for debug information.
3459 * @param arity The number of tuple elements.
3460 * @param **in An array containing pointers to the nodes producing the tuple elements.
3462 ir_node *new_d_Tuple (dbg_info *db, int arity, ir_node *in[]);
3464 /** Constructor for a Id node.
3466 * This is an auxiliary node to replace a node that returns a single
3467 * value. Adds the node to the block in current_ir_block.
3469 * @param *db A pointer for debug information.
3470 * @param *val The operand to Id.
3471 * @param *mode The mode of *val.
3473 ir_node *new_d_Id (dbg_info *db, ir_node *val, ir_mode *mode);
3475 /** Constructor for a Bad node.
3477 * Returns the unique Bad node of the graph. The same as
3480 ir_node *new_d_Bad (void);
3482 /** Constructor for a Confirm node.
3484 * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3485 * Specifies constraints for a value. To support dataflow analyses.
3487 * Example: If the value never exceeds '100' this is expressed by placing a
3488 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
3490 * @param *db A pointer for debug information.
3491 * @param *val The value we express a constraint for
3492 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3493 * @param cmp The compare operation.
3495 ir_node *new_d_Confirm (dbg_info *db, ir_node *val, ir_node *bound, pn_Cmp cmp);
3497 /** Constructor for an Unknown node.
3499 * Represents an arbitrary value. Places the node in
3502 * @param *m The mode of the unknown value.
3504 ir_node *new_d_Unknown(ir_mode *m);
3506 /** Constructor for a CallBegin node.
3508 * CallBegin represents control flow depending of the pointer value
3509 * representing the called method to the called methods. The
3510 * constructor copies the method pointer input from the passed Call
3511 * node.Adds the node to the block in current_ir_block.
3513 * @param *db A pointer for debug information.
3514 * @param *callee The call node visible in the intra procedural view.
3516 ir_node *new_d_CallBegin(dbg_info *db, ir_node *callee);
3518 /** Constructor for an EndReg node.
3520 *Adds the node to the block in current_ir_block.
3522 * @param *db A pointer for debug information.
3524 ir_node *new_d_EndReg (dbg_info *db);
3526 /** Constructor for an EndExcept node.
3528 * Used to represent regular procedure end in interprocedual view.
3529 * Adds the node to the block in current_ir_block.
3531 * @param *db A pointer for debug information.
3533 ir_node *new_d_EndExcept(dbg_info *db);
3535 /** Constructor for a Break node.
3537 * Used to represent exceptional procedure end in interprocedural view.
3538 * Adds the node to the block in current_ir_block.
3540 * Break represents control flow to a single control successor just as Jmp.
3541 * The blocks separated by a break may not be concatenated by an optimization.
3542 * It is used for the interprocedural representation where blocks are parted
3543 * behind Call nodes to represent the control flow to called procedures.
3545 * @param *db A pointer for debug information.
3547 ir_node *new_d_Break (dbg_info *db);
3549 /** Constructor for a Filter node.
3551 * Constructor for a Filter node. Adds the node to the block in
3552 * current_ir_block. Filter is a node with two views used to
3553 * construct the interprocedural view. In intraprocedural view its
3554 * semantics are identical to the Proj node. In interprocedural view
3555 * the Filter performs the Phi operation on method parameters or
3556 * results. Other than a Phi a Filter node may not be removed if it
3557 * has only a single input.
3559 * The constructor builds the Filter in intraprocedural view.
3561 * @param *db A pointer for debug information.
3562 * @param *arg The tuple value to project from.
3563 * @param *mode The mode of the projected value.
3564 * @param proj The position in the tuple to project from.
3566 ir_node *new_d_Filter (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3569 /** Constructor for a NoMem node.
3571 * Returns the unique NoMem node of the graph. The same as
3574 ir_node *new_d_NoMem (void);
3576 /** Constructor for a Mux node.
3578 * @param *db A pointer for debug information.
3579 * @param *sel The ir_node that calculates the boolean select.
3580 * @param *ir_true The ir_node that calculates the true result.
3581 * @param *ir_false The ir_node that calculates the false result.
3582 * @param *mode The mode of the node (and it_true and ir_false).
3584 ir_node *new_d_Mux (dbg_info *db, ir_node *sel,
3585 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
3587 /** Constructor for a CopyB node.
3589 * @param *db A pointer for debug information.
3590 * @param *store The current memory
3591 * @param *dst The ir_node that represents the destination address.
3592 * @param *src The ir_node that represents the source address.
3593 * @param *data_type The type of the copied data
3595 ir_node *new_d_CopyB(dbg_info *db, ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
3597 /** Constructor for a InstOf node.
3599 * A High-Level Type check.
3601 * @param *db A pointer for debug information.
3602 * @param *store The memory in which the object the entity should be selected
3603 * from is allocated.
3604 * @param *objptr A pointer to a object of a class type.
3605 * @param *type The type of which objptr must be.
3607 ir_node *new_d_InstOf (dbg_info *db, ir_node *store, ir_node *objptr, ir_type *type);
3609 /** Constructor for a Raise node.
3611 * A High-Level Exception throw.
3613 * @param *db A pointer for debug information.
3614 * @param *store The current memory.
3615 * @param *obj A pointer to the Except variable.
3617 ir_node *new_d_Raise (dbg_info *db, ir_node *store, ir_node *obj);
3619 /** Constructor for a Bound node.
3621 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
3623 * @param *db A pointer for debug information.
3624 * @param *store The current memory
3625 * @param *idx The ir_node that represents an index.
3626 * @param *lower The ir_node that represents the lower bound for the index.
3627 * @param *upper The ir_node that represents the upper bound for the index.
3629 ir_node *new_d_Bound(dbg_info *db, ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
3631 /** Constructor for a Pin node.
3633 * @param *db A pointer for debug information.
3634 * @param *node The node which value should be pinned.
3636 ir_node *new_d_Pin(dbg_info *db, ir_node *node);
3638 /** Constructor for an ASM pseudo node.
3640 * @param *db A pointer for debug information.
3641 * @param arity The number of data inputs to the node.
3642 * @param *in The array of length arity of data inputs.
3643 * @param *inputs The array of length arity of input constraints.
3644 * @param n_outs The number of data outputs to the node.
3645 * @param *outputs The array of length n_outs of output constraints.
3646 * @param n_clobber The number of clobbered registers.
3647 * @param *clobber The array of length n_clobber of clobbered registers.
3648 * @param *asm_text The assembler text.
3650 ir_node *new_d_ASM(dbg_info *db, int arity, ir_node *in[], ir_asm_constraint *inputs,
3651 int n_outs, ir_asm_constraint *outputs,
3652 int n_clobber, ident *clobber[], ident *asm_text);
3654 /*-----------------------------------------------------------------------*/
3655 /* The block oriented interface without debug support */
3656 /*-----------------------------------------------------------------------*/
3658 /* Needed from the interface with debug support:
3659 void set_cur_block (ir_node *target); */
3661 /** Constructor for a Block node.
3663 * Constructor for a Block node. Adds the block to the graph in
3664 * current_ir_graph. Constructs a Block with a fixed number of
3665 * predecessors. Does set current_block. Can be used with automatic
3666 * Phi node construction.
3668 * @param arity The number of control predecessors.
3669 * @param in An array of control predecessors. The length of
3670 * the array must be 'arity'.
3672 ir_node *new_Block(int arity, ir_node *in[]);
3674 /** Constructor for a Start node.
3676 * Adds the node to the block in current_ir_block.
3679 ir_node *new_Start (void);
3681 /** Constructor for an End node.
3683 * Adds the node to the block in current_ir_block.
3685 ir_node *new_End (void);
3687 /** Constructor for an EndReg node.
3689 * Used to represent regular procedure end in interprocedual view.
3690 * Adds the node to the block in current_ir_block.
3692 ir_node *new_EndReg (void);
3694 /** Constructor for an EndExpcept node.
3696 * Used to represent exceptional procedure end in interprocedural view.
3697 * Adds the node to the block in current_ir_block.
3699 ir_node *new_EndExcept(void);
3701 /** Constructor for a Jump node.
3703 * Adds the node to the block in current_ir_block.
3705 * Jmp represents control flow to a single control successor.
3707 ir_node *new_Jmp (void);
3709 /** Constructor for an IJmp node.
3711 * IJmp represents control flow to a single control successor not
3712 * statically known i.e. an indirect Jmp.
3714 * @param *tgt The IR node representing the target address.
3716 ir_node *new_IJmp (ir_node *tgt);
3718 /** Constructor for a Break node.
3719 * Break represents control flow to a single control successor just as Jmp.
3720 * The blocks separated by a break may not be concatenated by an optimization.
3721 * It is used for the interprocedural representation where blocks are parted
3722 * behind Call nodes to represent the control flow to called procedures.
3723 * Adds the node to the block in current_ir_block.
3725 ir_node *new_Break (void);
3727 /** Constructor for a Cond node.
3729 * If c is mode_b represents a conditional branch (if/else). If c is
3730 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
3731 * node, default Proj is 0.). Adds the node to the block in current_ir_block.
3733 * This is not consistent: Input to Cond is Is, Proj has as proj number
3737 * @param *c The conditions parameter.Can be of mode b or I_u.
3739 ir_node *new_Cond (ir_node *c);
3741 /** Constructor for a Return node.
3743 * Returns the memory and zero or more return values. Only node that
3744 * can end regular control flow. Adds the node to the block in current_ir_block.
3746 * @param *store The state of memory.
3747 * @param arity Number of array indices.
3748 * @param *in Array with index inputs to the node.
3750 ir_node *new_Return (ir_node *store, int arity, ir_node *in[]);
3752 /** Constructor for a Const node.
3754 * Constructor for a Const node. The constant represents a target
3755 * value. Sets the type information to type_unknown. (No more
3756 * supported: If tv is entity derives a somehow useful type.)
3757 * Adds the node to the block in current_ir_block.
3759 * @param *mode The mode of the operands and results.
3760 * @param *con Points to an entry in the constant table. This pointer is
3761 * added to the attributes of the node.
3763 ir_node *new_Const (ir_mode *mode, tarval *con);
3766 * Make a const from a long.
3767 * This is just convenience for the usual
3769 * new_Const(mode, tarval_from_long(mode, ...))
3772 * @param mode The mode for the const.
3773 * @param value The value of the constant.
3774 * @return A new const node.
3776 ir_node *new_Const_long(ir_mode *mode, long value);
3778 /** Constructor for a Const node.
3780 * Derives mode from passed type. */
3781 ir_node *new_Const_type(tarval *con, ir_type *tp);
3783 /** Constructor for a SymConst node.
3785 * Adds the node to the block in current_ir_block.
3786 * This is the constructor for a symbolic constant.
3787 * There are four kinds of symbolic constants:
3788 * -# type_tag The symbolic constant represents a type tag. The type the
3789 * tag stands for is given explicitly.
3790 * -# size The symbolic constant represents the size of a type. The
3791 * type of which the constant represents the size is given
3793 * -# align The symbolic constant represents the alignment of a type. The
3794 * type of which the constant represents the size is given
3796 * -# addr_name The symbolic constant represents the address of an entity
3797 * (variable or method). The variable is indicated by a name
3798 * that is valid for linking.
3799 * -# addr_ent The symbolic constant represents the address of an entity
3800 * (variable or method). The variable is given explicitly by
3803 * Inputs to the node:
3804 * No inputs except the block it belongs to.
3805 * Outputs of the node.
3806 * An unsigned integer (I_u) or a pointer (P).
3808 * @param mode The mode for the SymConst.
3809 * @param value A type or a ident depending on the SymConst kind.
3810 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3811 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
3812 * @param tp The source type of the constant.
3814 ir_node *new_SymConst_type(ir_mode *mode, union symconst_symbol value, symconst_kind kind, ir_type *tp);
3816 /** Constructor for a SymConst node.
3818 * Adds the node to the block in current_ir_block.
3819 * This is the constructor for a symbolic constant.
3820 * There are four kinds of symbolic constants:
3821 * -# type_tag The symbolic constant represents a type tag. The type the
3822 * tag stands for is given explicitly.
3823 * -# size The symbolic constant represents the size of a type. The
3824 * type of which the constant represents the size is given
3826 * -# align The symbolic constant represents the alignment of a type. The
3827 * type of which the constant represents the size is given
3829 * -# addr_name The symbolic constant represents the address of an entity
3830 * (variable or method). The variable is indicated by a name
3831 * that is valid for linking.
3832 * -# addr_ent The symbolic constant represents the address of an entity
3833 * (variable or method). The variable is given explicitly by
3836 * Inputs to the node:
3837 * No inputs except the block it belongs to.
3838 * Outputs of the node.
3839 * An unsigned integer (I_u) or a pointer (P).
3841 * @param mode The mode for the SymConst.
3842 * @param value A type or a ident depending on the SymConst kind.
3843 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3844 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
3846 ir_node *new_SymConst(ir_mode *mode, union symconst_symbol value, symconst_kind kind);
3848 /** Constructor for a simpelSel node.
3850 * This is a shortcut for the new_Sel() constructor. To be used for
3851 * Sel nodes that do not select from an array, i.e., have no index
3852 * inputs. It adds the two parameters 0, NULL.
3854 * @param *store The memory in which the object the entity should be selected from is allocated.
3855 * @param *objptr The object from that the Sel operation selects a single attribute out.
3856 * @param *ent The entity to select.
3858 ir_node *new_simpleSel(ir_node *store, ir_node *objptr, ir_entity *ent);
3860 /** Constructor for a Sel node.
3862 * The select node selects an entity (field or method) from an entity
3863 * with a compound type. It explicitly specifies the entity selected.
3864 * Dynamically the node may select entities that overwrite the given
3865 * entity. If the selected entity is an array element entity the Sel
3866 * node takes the required array indices as inputs.
3867 * Adds the node to the block in current_ir_block.
3869 * @param *store The memory in which the object the entity should be selected
3870 * from is allocated.
3871 * @param *objptr A pointer to a compound entity the Sel operation selects a
3872 * single attribute from.
3873 * @param arity The number of array indices needed to select an array element entity.
3874 * @param *in[] If the compound entity is an array the indices of the selected
3875 * element entity. The constructor copies this array.
3876 * @param *ent The entity to select.
3878 ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3881 /** Constructor for a Call node.
3883 * Adds the node to the block in current_ir_block.
3884 * Represents all kinds of method and function calls.
3886 * @param *store The actual store.
3887 * @param *callee A pointer to the called procedure.
3888 * @param arity The number of procedure parameters.
3889 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3890 * @param *tp Type information of the procedure called.
3892 ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node *in[],
3895 /** Constructor for a CallBegin node.
3897 * CallBegin represents control flow depending of the pointer value
3898 * representing the called method to the called methods. The
3899 * constructor copies the method pointer input from the passed Call
3900 * node. Adds the node to the block in current_ir_block.
3902 * @param *callee A pointer to the called procedure.
3904 ir_node *new_CallBegin(ir_node *callee);
3906 /** Constructor for a Add node.
3908 * Adds the node to the block in current_ir_block.
3910 * @param *op1 The first operand.
3911 * @param *op2 The second operand.
3912 * @param *mode The mode of the operands and the result.
3914 ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
3916 /** Constructor for a Sub node.
3918 * Adds the node to the block in current_ir_block.
3920 * @param *op1 The first operand.
3921 * @param *op2 The second operand.
3922 * @param *mode The mode of the operands and the result.
3924 ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
3926 /** Constructor for a Minus node.
3928 * Adds the node to the block in current_ir_block.
3930 * @param *op The operand .
3931 * @param *mode The mode of the operand and the result.
3933 ir_node *new_Minus (ir_node *op, ir_mode *mode);
3936 * Constructor for a Mul node. Adds the node to the block in current_ir_block.
3938 * @param *op1 The first operand.
3939 * @param *op2 The second operand.
3940 * @param *mode The mode of the operands and the result.
3942 ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
3945 * Constructor for a Mulh node. Adds the node to the block in current_ir_block.
3947 * @param *op1 The first operand.
3948 * @param *op2 The second operand.
3949 * @param *mode The mode of the operands and the result.
3951 ir_node *new_Mulh (ir_node *op1, ir_node *op2, ir_mode *mode);
3953 /** Constructor for a Quot node.
3955 * Adds the node to the block in current_ir_block.
3957 * @param *memop The store needed to model exceptions
3958 * @param *op1 The first operand.
3959 * @param *op2 The second operand.
3960 * @param *mode The mode of the result.
3961 * @param state The pinned state.
3963 ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3965 /** Constructor for a DivMod node.
3967 * Adds the node to the block in current_ir_block.
3969 * @param *memop The store needed to model exceptions
3970 * @param *op1 The first operand.
3971 * @param *op2 The second operand.
3972 * @param *mode The mode of the results.
3973 * @param state The pinned state.
3975 ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3977 /** Constructor for a Div node.
3979 * Adds the node to the block in current_ir_block.
3981 * @param *memop The store needed to model exceptions
3982 * @param *op1 The first operand.
3983 * @param *op2 The second operand.
3984 * @param *mode The mode of the result.
3985 * @param state The pinned state.
3987 ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3989 /** Constructor for a remainderless Div node.
3991 * Adds the node to the block in current_ir_block.
3993 * @param *memop The store needed to model exceptions
3994 * @param *op1 The first operand.
3995 * @param *op2 The second operand.
3996 * @param *mode The mode of the result.
3997 * @param state The pinned state.
3999 ir_node *new_DivRL (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
4001 /** Constructor for a Mod node.
4003 * Adds the node to the block in current_ir_block.
4005 * @param *memop The store needed to model exceptions
4006 * @param *op1 The first operand.
4007 * @param *op2 The second operand.
4008 * @param *mode The mode of the result.
4009 * @param state The pinned state.
4011 ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
4013 /** Constructor for a Abs node.
4015 * Adds the node to the block in current_ir_block.
4017 * @param *op The operand
4018 * @param *mode The mode of the operands and the result.
4020 ir_node *new_Abs (ir_node *op, ir_mode *mode);
4022 /** Constructor for a And node.
4024 * Adds the node to the block in current_ir_block.
4026 * @param *op1 The first operand.
4027 * @param *op2 The second operand.
4028 * @param *mode The mode of the operands and the result.
4030 ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
4033 * Constructor for a Or node. Adds the node to the block in current_ir_block.
4035 * @param *op1 The first operand.
4036 * @param *op2 The second operand.
4037 * @param *mode The mode of the operands and the result.
4039 ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
4042 * Constructor for a Eor node. Adds the node to the block in current_ir_block.
4044 * @param *op1 The first operand.
4045 * @param *op2 The second operand.
4046 * @param *mode The mode of the operands and the results.
4048 ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
4050 /** Constructor for a Not node.
4052 * Adds the node to the block in current_ir_block.
4054 * @param *op The operand.
4055 * @param *mode The mode of the operand and the result.
4057 ir_node *new_Not (ir_node *op, ir_mode *mode);
4059 /** Constructor for a Shl node.
4061 * Adds the node to the block in current_ir_block.
4063 * @param *op The operand.
4064 * @param *k The number of bits to shift the operand .
4065 * @param *mode The mode of the operand and the result.
4067 ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
4070 * Constructor for a Shr node. Adds the node to the block in current_ir_block.
4072 * @param *op The operand.
4073 * @param *k The number of bits to shift the operand .
4074 * @param *mode The mode of the operand and the result.
4076 ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
4078 /** Constructor for a Shrs node.
4080 * Adds the node to the block in current_ir_block.
4082 * @param *op The operand.
4083 * @param *k The number of bits to shift the operand .
4084 * @param *mode The mode of the operand and the result.
4086 ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
4088 /** Constructor for a Rotl node.
4090 * Adds the node to the block in current_ir_block.
4092 * @param *op The operand.
4093 * @param *k The number of bits to rotate the operand.
4094 * @param *mode The mode of the operand.
4096 ir_node *new_Rotl (ir_node *op, ir_node *k, ir_mode *mode);
4098 /** Constructor for a Cmp node.
4100 * Adds the node to the block in current_ir_block.
4102 * @param *op1 The first operand.
4103 * @param *op2 The second operand.
4105 ir_node *new_Cmp (ir_node *op1, ir_node *op2);
4107 /** Constructor for a Conv node.
4109 * Adds the node to the block in current_ir_block.
4111 * @param *op The operand.
4112 * @param *mode The mode of this the operand muss be converted.
4114 ir_node *new_Conv (ir_node *op, ir_mode *mode);
4116 /** Constructor for a strict Conv node.
4118 * Adds the node to the block in current_ir_block.
4120 * @param *op The operand.
4121 * @param *mode The mode of this the operand muss be converted.
4123 ir_node *new_strictConv (ir_node *op, ir_mode *mode);
4125 /** Constructor for a Cast node.
4127 * Adds the node to the block in current_ir_block.
4128 * High level type cast
4130 * @param *op The operand.
4131 * @param *to_tp The type of this the operand muss be casted .
4133 ir_node *new_Cast (ir_node *op, ir_type *to_tp);
4135 /** Constructor for a Carry node.
4137 * Adds the node to the block in current_ir_block.
4139 * @param *op1 The first operand.
4140 * @param *op2 The second operand.
4141 * @param *mode The mode of the operands and the result.
4143 ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode);
4145 /** Constructor for a Borrow node.
4147 * Adds the node to the block in current_ir_block.
4149 * @param *op1 The first operand.
4150 * @param *op2 The second operand.
4151 * @param *mode The mode of the operands and the result.
4153 ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode);
4155 /** Constructor for a Phi node.
4157 * Adds the node to the block in current_ir_block.
4159 * @param arity The number of predecessors.
4160 * @param *in Array with predecessors.
4161 * @param *mode The mode of it's inputs and output.
4163 ir_node *new_Phi (int arity, ir_node *in[], ir_mode *mode);
4165 /** Constructor for a Load node.
4167 * @param *store The current memory.
4168 * @param *addr A pointer to the variable to be read in this memory.
4169 * @param *mode The mode of the value to be loaded.
4171 ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode);
4173 /** Constructor for a Store node.
4175 * @param *store The current memory.
4176 * @param *addr A pointer to the variable to be read in this memory.
4177 * @param *val The value to write to this variable.
4179 ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
4181 /** Constructor for a Alloc node.
4183 * The Alloc node extends the memory by space for an entity of type alloc_type.
4184 * Adds the node to the block in current_ir_block.
4186 * @param *store The memory which shall contain the new variable.
4187 * @param *size The number of bytes to allocate.
4188 * @param *alloc_type The type of the allocated variable.
4189 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
4191 ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
4192 ir_where_alloc where);
4194 /** Constructor for a Free node.
4196 * Frees the memory occupied by the entity pointed to by the pointer
4197 * arg. Type indicates the type of the entity the argument points to.
4198 * Adds the node to the block in current_ir_block.
4200 * @param *store The memory which shall contain the new variable.
4201 * @param *ptr The pointer to the object to free.
4202 * @param *size The number of objects of type free_type to free in a sequence.
4203 * @param *free_type The type of the freed variable.
4204 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
4206 ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
4207 ir_type *free_type, ir_where_alloc where);
4209 /** Constructor for a Sync node.
4211 * Merges several memory values. The node assumes that a variable
4212 * either occurs only in one of the memories, or it contains the same
4213 * value in all memories where it occurs.
4214 * Adds the node to the block in current_ir_block.
4216 * @param arity The number of memories to synchronize.
4217 * @param **in An array of pointers to nodes that produce an output of type
4218 * memory. The constructor copies this array.
4220 ir_node *new_Sync (int arity, ir_node *in[]);
4222 /** Constructor for a Proj node.
4224 * Projects a single value out of a tuple. The parameter proj gives the
4225 * position of the value within the tuple.
4226 * Adds the node to the block in current_ir_block.
4228 * @param arg A node producing a tuple.
4229 * @param *mode The mode of the value to project.
4230 * @param proj The position of the value in the tuple.
4232 ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
4234 /** Constructor for a Filter node.
4236 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
4237 * Filter is a node with two views used to construct the interprocedural view.
4238 * In intraprocedural view its semantics are identical to the Proj node.
4239 * In interprocedural view the Filter performs the Phi operation on method
4240 * parameters or results. Other than a Phi a Filter node may not be removed
4241 * if it has only a single input.
4243 * The constructor builds the Filter in intraprocedural view.
4245 * @param *arg The tuple value to project from.
4246 * @param *mode The mode of the projected value.
4247 * @param proj The position in the tuple to project from.
4249 ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj);
4251 /** Constructor for a defaultProj node.
4253 * Represents the default control flow of a Switch-Cond node.
4254 * Adds the node to the block in current_ir_block.
4256 * @param arg A node producing a tuple.
4257 * @param max_proj The end position of the value in the tuple.
4259 ir_node *new_defaultProj (ir_node *arg, long max_proj);
4261 /** Constructor for a Tuple node.
4263 * This is an auxiliary node to replace a node that returns a tuple
4264 * without changing the corresponding Proj nodes.
4265 * Adds the node to the block in current_ir_block.
4267 * @param arity The number of tuple elements.
4268 * @param **in An array containing pointers to the nodes producing the tuple elements.
4270 ir_node *new_Tuple (int arity, ir_node *in[]);
4272 /** Constructor for an Id node.
4274 * This is an auxiliary node to replace a node that returns a single
4275 * value. Adds the node to the block in current_ir_block.
4277 * @param *val The operand to Id.
4278 * @param *mode The mode of *val.
4280 ir_node *new_Id (ir_node *val, ir_mode *mode);
4282 /** Constructor for a Bad node.
4284 * Returns the unique Bad node of the graph. The same as
4287 ir_node *new_Bad (void);
4289 /** Constructor for a Confirm node.
4291 * Specifies constraints for a value. To support dataflow analyses.
4292 * Adds the node to the block in current_ir_block.
4294 * Example: If the value never exceeds '100' this is expressed by placing a
4295 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
4297 * @param *val The value we express a constraint for
4298 * @param *bound The value to compare against. Must be a firm node, typically a constant.
4299 * @param cmp The compare operation.
4301 ir_node *new_Confirm (ir_node *val, ir_node *bound, pn_Cmp cmp);
4303 /** Constructor for an Unknown node.
4305 * Represents an arbitrary value. Places the node in
4308 * @param *m The mode of the unknown value.
4310 ir_node *new_Unknown(ir_mode *m);
4312 /** Constructor for a NoMem node.
4314 * Returns the unique NoMem node of the graph. The same as
4317 ir_node *new_NoMem (void);
4319 /** Constructor for a Mux node.
4321 * Adds the node to the block in current_ir_block.
4323 * @param *sel The ir_node that calculates the boolean select.
4324 * @param *ir_true The ir_node that calculates the true result.
4325 * @param *ir_false The ir_node that calculates the false result.
4326 * @param *mode The mode of the node (and it_true and ir_false).
4328 ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
4330 /** Constructor for a CopyB node.
4332 * Adds the node to the block in current_ir_block.
4334 * @param *store The current memory
4335 * @param *dst The ir_node that represents the destination address.
4336 * @param *src The ir_node that represents the source address.
4337 * @param *data_type The type of the copied data
4339 ir_node *new_CopyB(ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
4341 /** Constructor for a InstOf node.
4343 * A High-Level Type check.
4345 * @param *store The memory in which the object the entity should be selected
4346 * from is allocated.
4347 * @param *objptr A pointer to a object of a class type.
4348 * @param *type The type of which objptr must be.
4350 ir_node *new_InstOf (ir_node *store, ir_node *objptr, ir_type *type);
4352 /**Constructor for a Raise node.
4354 * A High-Level Exception throw.
4356 * @param *store The current memory.
4357 * @param *obj A pointer to the Except variable.
4359 ir_node *new_Raise (ir_node *store, ir_node *obj);
4361 /** Constructor for a Bound node.
4363 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
4365 * Adds the node to the block in current_ir_block.
4367 * @param *store The current memory
4368 * @param *idx The ir_node that represents an index.
4369 * @param *lower The ir_node that represents the lower bound for the index.
4370 * @param *upper The ir_node that represents the upper bound for the index.
4372 ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
4374 /** Constructor for a Pin node.
4376 * @param *node The node which value should be pinned.
4378 ir_node *new_Pin (ir_node *node);
4380 /** Constructor for an ASM pseudo node.
4382 * @param arity The number of data inputs to the node.
4383 * @param *in The array of length arity of data inputs.
4384 * @param *inputs The array of length arity of input constraints.
4385 * @param n_outs The number of data outputs to the node.
4386 * @param *outputs The array of length n_outs of output constraints.
4387 * @param n_clobber The number of clobbered registers.
4388 * @param *clobber The array of length n_clobber of clobbered registers.
4389 * @param *asm_text The assembler text.
4391 ir_node *new_ASM(int arity, ir_node *in[], ir_asm_constraint *inputs,
4392 int n_outs, ir_asm_constraint *outputs,
4393 int n_clobber, ident *clobber[], ident *asm_text);
4395 /*---------------------------------------------------------------------*/
4396 /* The comfortable interface. */
4397 /* Supports automatic Phi node construction. */
4398 /* All routines of the block oriented interface except new_Block are */
4400 /*---------------------------------------------------------------------*/
4402 /** Create an immature Block.
4404 * An immature Block has an unknown number of predecessors. Predecessors
4405 * can be added with add_immBlock_pred(). Once all predecessors are
4406 * added the block must be matured.
4408 * Adds the block to the graph in current_ir_graph. Does set
4409 * current_block. Can be used with automatic Phi node construction.
4410 * This constructor can only be used if the graph is in
4413 ir_node *new_d_immBlock(dbg_info *db);
4414 ir_node *new_immBlock(void);
4416 /** Create an immature PartBlock.
4418 * An immature block has only one Block or PartBlock predecessor.
4419 * A PartBlock forms together with one BLock and possibly other
4420 * PartBlocks a MacroBlock.
4422 * Adds the PartBlock to the graph in current_ir_graph. Does set
4423 * current_block. Can be used with automatic Phi node construction.
4424 * This constructor can only be used if the graph is in
4427 ir_node *new_d_immPartBlock(dbg_info *db, ir_node *pred_jmp);
4428 ir_node *new_immPartBlock(ir_node *pred_jmp);
4430 /** Add a control flow edge to an immature block. */
4431 void add_immBlock_pred(ir_node *immblock, ir_node *jmp);
4433 /** Finalize a Block node, when all control flows are known. */
4434 void mature_immBlock(ir_node *block);
4435 #define mature_cur_block() mature_immBlock(get_cur_block());
4438 /** Get the current value of a local variable.
4440 * Use this function to obtain the last definition of the local variable
4441 * associated with pos. Pos may not exceed the value passed as n_loc
4442 * to new_ir_graph. This call automatically inserts Phi nodes.
4444 * @param *db A pointer for debug information.
4445 * @param pos The position/id of the local variable.
4446 * @param *mode The mode of the value to get.
4448 ir_node *get_d_value(dbg_info *db, int pos, ir_mode *mode);
4449 ir_node *get_value(int pos, ir_mode *mode);
4451 /** Remark a new definition of a variable.
4453 * Use this function to remember a new definition of the value
4454 * associated with pos. Pos may not exceed the value passed as n_loc
4455 * to new_ir_graph. This call is needed to automatically inserts Phi
4458 * @param pos The position/id of the local variable.
4459 * @param *value The new value written to the local variable.
4461 void set_value(int pos, ir_node *value);
4463 /** Find the value number for a node in the current block.
4465 * This function searches all values in the current block for
4466 * a given value and returns its value number if it was found, else
4468 * Note that this does not mean that the value does not exists,
4469 * it's just not equal the node (for instance behind a Phi/Confirm ...)
4471 * @param *value The value to find.
4473 int find_value(ir_node *value);
4475 /** Get the current memory state.
4477 * Use this function to obtain the last definition of the memory
4478 * state. This call automatically inserts Phi nodes for the memory
4481 ir_node *get_store(void);
4483 /** Remark a new definition of the memory state.
4485 * Use this function to remember a new definition of the memory state.
4486 * This call is needed to automatically inserts Phi nodes.
4488 * @param *store The new memory state.
4490 void set_store(ir_node *store);
4492 /** keep this node alive even if End is not control-reachable from it
4494 * @param ka The node to keep alive.
4496 void keep_alive(ir_node *ka);
4498 /** Returns the frame type of the current graph */
4499 ir_type *get_cur_frame_type(void);
4502 /* --- initialize and finalize IR construction --- */
4504 /** Puts the graph into state "phase_high" */
4505 #define irg_finalize_cons(irg) set_irg_phase_state(irg, phase_high)
4507 /** Puts the program and all graphs into state phase_high.
4509 * This also remarks, the construction of types is finished,
4510 * e.g., that no more subtypes will be added. */
4511 void irp_finalize_cons(void);
4513 /* --- Initialization --- */
4516 * This function is called, whenever a local variable is used before definition
4518 * @param irg the IR graph on which this happens
4519 * @param mode the mode of the local var
4520 * @param pos position chosen be the frontend for this variable (n_loc)
4522 * @return a firm node of mode @p mode that initializes the var at position pos
4525 * Do not return NULL!
4526 * If this function is not set, FIRM will create a const node with tarval BAD.
4527 * Use set_irg_loc_description()/get_irg_loc_description() to assign additional
4528 * informations to local variables.
4530 typedef ir_node *uninitialized_local_variable_func_t(ir_graph *irg, ir_mode *mode, int pos);