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 (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 (tarval *con)
516 * -----------------------------------------------
518 * Creates a constant in the constant table and adds a Const node
519 * returning this value to the start block. The mode is derived
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 * Adds the node to the start block.
1229 * The constant represents a target value. This constructor sets high
1230 * level type information for the constant value.
1231 * Derives mode from passed tarval.
1233 * @param *db A pointer for debug information.
1234 * @param *irg The IR graph the node belongs to.
1235 * @param *con Points to an entry in the constant table.
1236 * @param *tp The type of the constant.
1238 ir_node *new_rd_Const_type (dbg_info *db, ir_graph *irg,
1239 tarval *con, ir_type *tp);
1241 /** Constructor for a Const node.
1243 * Adds the node to the start block.
1245 * Constructor for a Const node. The constant represents a target
1246 * value. Sets the type information to type_unknown. (No more
1247 * supported: If tv is entity derives a somehow useful type.)
1248 * Derives mode from passed tarval.
1250 * @param *db A pointer for debug information.
1251 * @param *irg The IR graph the node belongs to.
1252 * @param *con Points to an entry in the constant table.
1254 ir_node *new_rd_Const (dbg_info *db, ir_graph *irg, tarval *con);
1256 /** Constructor for a Const node.
1258 * Adds the node to the start block.
1260 * Constructor for a Const node. The constant represents a target
1261 * value. Sets the type information to type_unknown. (No more
1262 * supported: If tv is entity derives a somehow useful type.)
1264 * @param *db A pointer for debug information.
1265 * @param *irg The IR graph the node belongs to.
1266 * @param *mode The mode of the operands and results.
1267 * @param value A value from which the tarval is made.
1269 ir_node *new_rd_Const_long (dbg_info *db, ir_graph *irg,
1270 ir_mode *mode, long value);
1272 /** Constructor for a SymConst_type node.
1274 * This is the constructor for a symbolic constant.
1275 * There are four kinds of symbolic constants:
1276 * - type_tag The symbolic constant represents a type tag. The type the
1277 * tag stands for is given explicitly.
1278 * - type_size The symbolic constant represents the size of a type. The
1279 * type of which the constant represents the size is given
1281 * - type_align The symbolic constant represents the alignment of a type. The
1282 * type of which the constant represents the size is given
1284 * - addr_name The symbolic constant represents the address of an entity
1285 * (variable or method). The variable is indicated by a name
1286 * that is valid for linking.
1287 * - addr_ent The symbolic constant represents the address of an entity
1288 * (variable or method). The variable is given explicitly by
1291 * Inputs to the node:
1292 * No inputs except the block it belongs to.
1293 * Outputs of the node.
1294 * An unsigned integer (I_u) or a pointer (P).
1296 * Mention union in declaration so that the firmjni generator recognizes that
1297 * it can not cast the argument to an int.
1299 * @param *db A pointer for debug information.
1300 * @param *irg The IR graph the node belongs to.
1301 * @param *block The IR block the node belongs to.
1302 * @param mode The mode for the SymConst.
1303 * @param symkind The kind of the symbolic constant: type_tag, size, addr_name or addr_ent.
1304 * @param value A type, entity or a ident depending on the SymConst kind.
1305 * @param tp The source type of the constant.
1307 ir_node *new_rd_SymConst_type(dbg_info *db, ir_graph *irg, ir_node *block, ir_mode *mode,
1308 union symconst_symbol value,
1309 symconst_kind symkind, ir_type *tp);
1311 /** Constructor for a SymConst node.
1313 * Same as new_rd_SymConst_type, except that it sets the type to type_unknown.
1315 ir_node *new_rd_SymConst(dbg_info *db, ir_graph *irg, ir_node *block, ir_mode *mode,
1316 union symconst_symbol value, symconst_kind symkind);
1318 /** Constructor for a SymConst addr_ent 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. */
1323 ir_node *new_rd_SymConst_addr_ent(dbg_info *db, ir_graph *irg, ir_mode *mode,
1324 ir_entity *symbol, ir_type *tp);
1326 /** Constructor for a SymConst ofs_ent node.
1328 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1330 * Adds the SymConst to the start block of irg.
1332 ir_node *new_rd_SymConst_ofs_ent(dbg_info *db, ir_graph *irg, ir_mode *mode,
1333 ir_entity *symbol, ir_type *tp);
1335 /** Constructor for a SymConst addr_name node.
1337 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1338 * symconst_addr_ent.
1339 * Adds the SymConst to the start block of irg.
1341 ir_node *new_rd_SymConst_addr_name(dbg_info *db, ir_graph *irg, ir_mode *mode,
1342 ident *symbol, ir_type *tp);
1344 /** Constructor for a SymConst type_tag node.
1346 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1347 * symconst_addr_ent.
1348 * Adds the SymConst to the start block of irg.
1350 ir_node *new_rd_SymConst_type_tag(dbg_info *db, ir_graph *irg, ir_mode *mode,
1351 ir_type *symbol, ir_type *tp);
1353 /** Constructor for a SymConst size node.
1355 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1356 * symconst_type_size.
1357 * Adds the SymConst to the start block of irg. */
1358 ir_node *new_rd_SymConst_size(dbg_info *db, ir_graph *irg, ir_mode *mode,
1359 ir_type *symbol, ir_type *tp);
1361 /** Constructor for a SymConst size node.
1363 * Same as new_rd_SymConst_type, except that the constructor is tailored for
1364 * symconst_type_align.
1365 * Adds the SymConst to the start block of irg.
1367 ir_node *new_rd_SymConst_align(dbg_info *db, ir_graph *irg, ir_mode *mode,
1368 ir_type *symbol, ir_type *tp);
1370 /** Constructor for a simpleSel node.
1372 * This is a shortcut for the new_rd_Sel() constructor. To be used for
1373 * Sel nodes that do not select from an array, i.e., have no index
1374 * inputs. It adds the two parameters 0, NULL.
1376 * @param *db A pointer for debug information.
1377 * @param *irg The IR graph the node belongs to.
1378 * @param *block The IR block the node belongs to.
1379 * @param *store The memory in which the object the entity should be
1380 * selected from is allocated.
1381 * @param *objptr The object from that the Sel operation selects a
1382 * single attribute out.
1383 * @param *ent The entity to select.
1385 ir_node *new_rd_simpleSel (dbg_info *db, ir_graph *irg, ir_node *block,
1386 ir_node *store, ir_node *objptr, ir_entity *ent);
1388 /** Constructor for a Sel node.
1390 * The select node selects an entity (field or method) from an entity
1391 * with a compound type. It explicitly specifies the entity selected.
1392 * Dynamically the node may select entities that overwrite the given
1393 * entity. If the selected entity is an array element entity the Sel
1394 * node takes the required array indices as inputs.
1396 * @param *db A pointer for debug information.
1397 * @param *irg The IR graph the node belongs to.
1398 * @param *block The IR block the node belongs to.
1399 * @param *store The memory in which the object the entity should be selected
1400 * from is allocated.
1401 * @param *objptr A pointer to a compound entity the Sel operation selects a
1402 * single attribute from.
1403 * @param *n_index The number of array indices needed to select an array element entity.
1404 * @param *index[] If the compound entity is an array the indices of the selected
1405 * element entity. The constructor copies this array.
1406 * @param *ent The entity to select.
1408 ir_node *new_rd_Sel (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1409 ir_node *objptr, int n_index, ir_node *index[], ir_entity *ent);
1411 /** Constructor for a Call node.
1413 * Represents all kinds of method and function calls.
1415 * @param *db A pointer for debug information.
1416 * @param *irg The IR graph the node belongs to.
1417 * @param *block The IR block the node belongs to.
1418 * @param *store The current memory state.
1419 * @param *callee A pointer to the called procedure.
1420 * @param arity The number of procedure parameters.
1421 * @param *in[] An array with the procedure parameters. The constructor copies this array.
1422 * @param *tp Type information of the procedure called.
1424 ir_node *new_rd_Call (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1425 ir_node *callee, int arity, ir_node *in[], ir_type *tp);
1427 /** Constructor for a Add node.
1429 * @param *db A pointer for debug information.
1430 * @param *irg The IR graph the node belongs to.
1431 * @param *block The IR block the node belongs to.
1432 * @param *op1 The first operand.
1433 * @param *op2 The second operand.
1434 * @param *mode The mode of the operands and the result.
1436 ir_node *new_rd_Add (dbg_info *db, ir_graph *irg, ir_node *block,
1437 ir_node *op1, ir_node *op2, ir_mode *mode);
1439 /** Constructor for a Sub node.
1441 * @param *db A pointer for debug information.
1442 * @param *irg The IR graph the node belongs to.
1443 * @param *block The IR block the node belongs to.
1444 * @param *op1 The first operand.
1445 * @param *op2 The second operand.
1446 * @param *mode The mode of the operands and the result.
1448 ir_node *new_rd_Sub (dbg_info *db, ir_graph *irg, ir_node *block,
1449 ir_node *op1, ir_node *op2, ir_mode *mode);
1451 /** Constructor for a Minus node.
1453 * @param *db A pointer for debug information.
1454 * @param *irg The IR graph the node belongs to.
1455 * @param *block The IR block the node belongs to.
1456 * @param *op The operand .
1457 * @param *mode The mode of the operand and the result.
1459 ir_node *new_rd_Minus (dbg_info *db, ir_graph *irg, ir_node *block,
1460 ir_node *op, ir_mode *mode);
1462 /** Constructor for a Mul node.
1464 * @param *db A pointer for debug information.
1465 * @param *irg The IR graph the node belongs to.
1466 * @param *block The IR block the node belongs to.
1467 * @param *op1 The first operand.
1468 * @param *op2 The second operand.
1469 * @param *mode The mode of the operands and the result.
1471 ir_node *new_rd_Mul (dbg_info *db, ir_graph *irg, ir_node *block,
1472 ir_node *op1, ir_node *op2, ir_mode *mode);
1474 /** Constructor for a Mulh node.
1476 * @param *db A pointer for debug information.
1477 * @param *irg The IR graph the node belongs to.
1478 * @param *block The IR block the node belongs to.
1479 * @param *op1 The first operand.
1480 * @param *op2 The second operand.
1481 * @param *mode The mode of the operands and the result.
1483 ir_node *new_rd_Mulh (dbg_info *db, ir_graph *irg, ir_node *block,
1484 ir_node *op1, ir_node *op2, ir_mode *mode);
1486 /** Constructor for a Quot node.
1488 * @param *db A pointer for debug information.
1489 * @param *irg The IR graph the node belongs to.
1490 * @param *block The IR block the node belongs to.
1491 * @param *memop The store needed to model exceptions
1492 * @param *op1 The first operand.
1493 * @param *op2 The second operand.
1494 * @param *mode The mode of the result.
1495 * @param state The pinned state.
1497 ir_node *new_rd_Quot (dbg_info *db, ir_graph *irg, ir_node *block,
1498 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1500 /** Constructor for a DivMod node.
1502 * @param *db A pointer for debug information.
1503 * @param *irg The IR graph the node belongs to.
1504 * @param *block The IR block the node belongs to.
1505 * @param *memop The store needed to model exceptions
1506 * @param *op1 The first operand.
1507 * @param *op2 The second operand.
1508 * @param *mode The mode of the results.
1509 * @param state The pinned state.
1511 ir_node *new_rd_DivMod (dbg_info *db, ir_graph *irg, ir_node *block,
1512 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1514 /** Constructor for a Div node.
1516 * @param *db A pointer for debug information.
1517 * @param *irg The IR graph the node belongs to.
1518 * @param *block The IR block the node belongs to.
1519 * @param *memop The store needed to model exceptions
1520 * @param *op1 The first operand.
1521 * @param *op2 The second operand.
1522 * @param *mode The mode of the result.
1523 * @param state The pinned state.
1525 ir_node *new_rd_Div (dbg_info *db, ir_graph *irg, ir_node *block,
1526 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1528 /** Constructor for a remainderless Div node.
1530 * @param *db A pointer for debug information.
1531 * @param *irg The IR graph the node belongs to.
1532 * @param *block The IR block the node belongs to.
1533 * @param *memop The store needed to model exceptions
1534 * @param *op1 The first operand.
1535 * @param *op2 The second operand.
1536 * @param *mode The mode of the result.
1537 * @param state The pinned state.
1539 ir_node *new_rd_DivRL (dbg_info *db, ir_graph *irg, ir_node *block,
1540 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1542 /** Constructor for a Mod node.
1544 * @param *db A pointer for debug information.
1545 * @param *irg The IR graph the node belongs to.
1546 * @param *block The IR block the node belongs to.
1547 * @param *memop The store needed to model exceptions
1548 * @param *op1 The first operand.
1549 * @param *op2 The second operand.
1550 * @param *mode The mode of the result.
1551 * @param state The pinned state.
1553 ir_node *new_rd_Mod (dbg_info *db, ir_graph *irg, ir_node *block,
1554 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1556 /** Constructor for a Abs node.
1558 * @param *db A pointer for debug information.
1559 * @param *irg The IR graph the node belongs to.
1560 * @param *block The IR block the node belongs to.
1561 * @param *op The operand
1562 * @param *mode The mode of the operands and the result.
1564 ir_node *new_rd_Abs (dbg_info *db, ir_graph *irg, ir_node *block,
1565 ir_node *op, ir_mode *mode);
1567 /** Constructor for a And node.
1569 * @param *db A pointer for debug information.
1570 * @param *irg The IR graph the node belongs to.
1571 * @param *block The IR block the node belongs to.
1572 * @param *op1 The first operand.
1573 * @param *op2 The second operand.
1574 * @param *mode The mode of the operands and the result.
1576 ir_node *new_rd_And (dbg_info *db, ir_graph *irg, ir_node *block,
1577 ir_node *op1, ir_node *op2, ir_mode *mode);
1579 /** Constructor for a Or node.
1581 * @param *db A pointer for debug information.
1582 * @param *irg The IR graph the node belongs to.
1583 * @param *block The IR block the node belongs to.
1584 * @param *op1 The first operand.
1585 * @param *op2 The second operand.
1586 * @param *mode The mode of the operands and the result.
1588 ir_node *new_rd_Or (dbg_info *db, ir_graph *irg, ir_node *block,
1589 ir_node *op1, ir_node *op2, ir_mode *mode);
1591 /** Constructor for a Eor node.
1593 * @param *db A pointer for debug information.
1594 * @param *irg The IR graph the node belongs to.
1595 * @param *block The IR block the node belongs to.
1596 * @param *op1 The first operand.
1597 * @param *op2 The second operand.
1598 * @param *mode The mode of the operands and the results.
1600 ir_node *new_rd_Eor (dbg_info *db, ir_graph *irg, ir_node *block,
1601 ir_node *op1, ir_node *op2, ir_mode *mode);
1603 /** Constructor for a Not node.
1605 * @param *db A pointer for debug information.
1606 * @param *irg The IR graph the node belongs to.
1607 * @param *block The IR block the node belongs to.
1608 * @param *op The operand.
1609 * @param *mode The mode of the operand and the result.
1611 ir_node *new_rd_Not (dbg_info *db, ir_graph *irg, ir_node *block,
1612 ir_node *op, ir_mode *mode);
1614 /** Constructor for a Cmp node.
1616 * @param *db A pointer for debug information.
1617 * @param *irg The IR graph the node belongs to.
1618 * @param *block The IR block the node belongs to.
1619 * @param *op1 The first operand.
1620 * @param *op2 The second operand.
1622 ir_node *new_rd_Cmp (dbg_info *db, ir_graph *irg, ir_node *block,
1623 ir_node *op1, ir_node *op2);
1625 /** Constructor for a Shl node.
1627 * @param *db A pointer for debug information.
1628 * @param *irg The IR graph the node belongs to.
1629 * @param *block The IR block the node belongs to.
1630 * @param *op The operand.
1631 * @param *k The number of bits to shift the operand .
1632 * @param *mode The mode of the operand and the result.
1634 ir_node *new_rd_Shl (dbg_info *db, ir_graph *irg, ir_node *block,
1635 ir_node *op, ir_node *k, ir_mode *mode);
1637 /** Constructor for a Shr node.
1639 * @param *db A pointer for debug information.
1640 * @param *irg The IR graph the node belongs to.
1641 * @param *block The IR block the node belongs to.
1642 * @param *op The operand.
1643 * @param *k The number of bits to shift the operand .
1644 * @param *mode The mode of the operand and the result.
1646 ir_node *new_rd_Shr (dbg_info *db, ir_graph *irg, ir_node *block,
1647 ir_node *op, ir_node *k, ir_mode *mode);
1649 /** Constructor for a Shrs node.
1651 * @param *db A pointer for debug information.
1652 * @param *irg The IR graph the node belongs to.
1653 * @param *block The IR block the node belongs to.
1654 * @param *op The operand.
1655 * @param *k The number of bits to shift the operand.
1656 * @param *mode The mode of the operand and the result.
1658 ir_node *new_rd_Shrs (dbg_info *db, ir_graph *irg, ir_node *block,
1659 ir_node *op, ir_node *k, ir_mode *mode);
1661 /** Constructor for a Rotl node.
1663 * @param *db A pointer for debug information.
1664 * @param *irg The IR graph the node belongs to.
1665 * @param *block The IR block the node belongs to.
1666 * @param *op The operand.
1667 * @param *k The number of bits to rotate the operand.
1668 * @param *mode The mode of the operand.
1670 ir_node *new_rd_Rotl (dbg_info *db, ir_graph *irg, ir_node *block,
1671 ir_node *op, ir_node *k, ir_mode *mode);
1674 /** Constructor for a Conv node.
1676 * @param *db A pointer for debug information.
1677 * @param *irg The IR graph the node belongs to.
1678 * @param *block The IR block the node belongs to.
1679 * @param *op The operand.
1680 * @param *mode The mode of this the operand muss be converted .
1682 ir_node *new_rd_Conv (dbg_info *db, ir_graph *irg, ir_node *block,
1683 ir_node *op, ir_mode *mode);
1685 /** Constructor for a Cast node.
1687 * High level type cast.
1689 * @param *db A pointer for debug information.
1690 * @param *irg The IR graph the node belongs to.
1691 * @param *block The IR block the node belongs to.
1692 * @param *op The operand.
1693 * @param *to_tp The type of this the operand muss be casted .
1695 ir_node *new_rd_Cast (dbg_info *db, ir_graph *irg, ir_node *block,
1696 ir_node *op, ir_type *to_tp);
1698 /** Constructor for a Carry node.
1700 * @param *db A pointer for debug information.
1701 * @param *irg The IR graph the node belongs to.
1702 * @param *block The IR block the node belongs to.
1703 * @param *op1 The first operand.
1704 * @param *op2 The second operand.
1705 * @param *mode The mode of the operands and the result.
1707 ir_node *new_rd_Carry (dbg_info *db, ir_graph *irg, ir_node *block,
1708 ir_node *op1, ir_node *op2, ir_mode *mode);
1710 /** Constructor for a Borrow node.
1712 * @param *db A pointer for debug information.
1713 * @param *irg The IR graph the node belongs to.
1714 * @param *block The IR block the node belongs to.
1715 * @param *op1 The first operand.
1716 * @param *op2 The second operand.
1717 * @param *mode The mode of the operands and the result.
1719 ir_node *new_rd_Borrow (dbg_info *db, ir_graph *irg, ir_node *block,
1720 ir_node *op1, ir_node *op2, ir_mode *mode);
1722 /** Constructor for a Phi node.
1724 * @param *db A pointer for debug information.
1725 * @param *irg The IR graph the node belongs to.
1726 * @param *block The IR block the node belongs to.
1727 * @param arity The number of predecessors
1728 * @param *in[] Array with predecessors. The constructor copies this array.
1729 * @param *mode The mode of it's inputs and output.
1731 ir_node *new_rd_Phi (dbg_info *db, ir_graph *irg, ir_node *block, int arity,
1732 ir_node *in[], ir_mode *mode);
1734 /** Constructor for a Load node.
1736 * @param *db A pointer for debug information.
1737 * @param *irg The IR graph the node belongs to.
1738 * @param *block The IR block the node belongs to.
1739 * @param *store The current memory
1740 * @param *adr A pointer to the variable to be read in this memory.
1741 * @param *mode The mode of the value to be loaded.
1743 ir_node *new_rd_Load (dbg_info *db, ir_graph *irg, ir_node *block,
1744 ir_node *store, ir_node *adr, ir_mode *mode);
1746 /** Constructor for a Store node.
1748 * @param *db A pointer for debug information.
1749 * @param *irg The IR graph the node belongs to.
1750 * @param *block The IR block the node belongs to.
1751 * @param *store The current memory
1752 * @param *adr A pointer to the variable to be read in this memory.
1753 * @param *val The value to write to this variable.
1755 ir_node *new_rd_Store (dbg_info *db, ir_graph *irg, ir_node *block,
1756 ir_node *store, ir_node *adr, ir_node *val);
1758 /** Constructor for a Alloc node.
1760 * The Alloc node extends the memory by space for an entity of type alloc_type.
1762 * @param *db A pointer for debug information.
1763 * @param *irg The IR graph the node belongs to.
1764 * @param *block The IR block the node belongs to.
1765 * @param *store The memory which shall contain the new variable.
1766 * @param *size The number of bytes to allocate.
1767 * @param *alloc_type The type of the allocated variable.
1768 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
1770 ir_node *new_rd_Alloc (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1771 ir_node *size, ir_type *alloc_type, ir_where_alloc where);
1773 /** Constructor for a Free node.
1775 * Frees the memory occupied by the entity pointed to by the pointer
1776 * arg. Type indicates the type of the entity the argument points to.
1778 * @param *db A pointer for debug information.
1779 * @param *irg The IR graph the node belongs to.
1780 * @param *block The IR block the node belongs to.
1781 * @param *store The memory which shall contain the new variable.
1782 * @param *ptr The pointer to the object to free.
1783 * @param *size The number of objects of type free_type to free in a sequence.
1784 * @param *free_type The type of the freed variable.
1785 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
1787 ir_node *new_rd_Free (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1788 ir_node *ptr, ir_node *size, ir_type *free_type, ir_where_alloc where);
1790 /** Constructor for a Sync node.
1792 * Merges several memory values. The node assumes that a variable
1793 * either occurs only in one of the memories, or it contains the same
1794 * value in all memories where it occurs.
1796 * @param *db A pointer for debug information.
1797 * @param *irg The IR graph the node belongs to.
1798 * @param *block The IR block the node belongs to.
1799 * @param arity The number of memories to synchronize.
1800 * @param *in[] An array of pointers to nodes that produce an output of type
1801 * memory. The constructor copies this array.
1803 ir_node *new_rd_Sync (dbg_info *db, ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
1805 /** Constructor for a Proj node.
1807 * Projects a single value out of a tuple. The parameter proj gives the
1808 * position of the value within the tuple.
1810 * @param *db A pointer for debug information.
1811 * @param *irg The IR graph the node belongs to.
1812 * @param *block The IR block the node belongs to.
1813 * @param arg A node producing a tuple. The node must have mode_T.
1814 * @param *mode The mode of the value to project.
1815 * @param proj The position of the value in the tuple.
1817 ir_node *new_rd_Proj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1818 ir_mode *mode, long proj);
1820 /** Constructor for a defaultProj node.
1822 * Represents the default control flow of a Switch-Cond node.
1824 * @param *db A pointer for debug information.
1825 * @param *irg The IR graph the node belongs to.
1826 * @param *block The IR block the node belongs to.
1827 * @param arg A node producing a tuple.
1828 * @param max_proj The end position of the value in the tuple.
1830 ir_node *new_rd_defaultProj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1833 /** Constructor for a Tuple node.
1835 * This is an auxiliary node to replace a node that returns a tuple
1836 * without changing the corresponding Proj nodes.
1838 * @param *db A pointer for debug information.
1839 * @param *irg The IR graph the node belongs to.
1840 * @param *block The IR block the node belongs to.
1841 * @param arity The number of tuple elements.
1842 * @param *in[] An array containing pointers to the nodes producing the tuple
1843 * elements. The constructor copies this array.
1845 ir_node *new_rd_Tuple (dbg_info *db, ir_graph *irg, ir_node *block,
1846 int arity, ir_node *in[]);
1848 /** Constructor for a Id node.
1850 * This is an auxiliary node to replace a node that returns a single
1853 * @param *db A pointer for debug information.
1854 * @param *irg The IR graph the node belongs to.
1855 * @param *block The IR block the node belongs to.
1856 * @param *val The value
1857 * @param *mode The mode of *val.
1859 ir_node *new_rd_Id (dbg_info *db, ir_graph *irg, ir_node *block,
1860 ir_node *val, ir_mode *mode);
1862 /** Constructor for a Confirm node.
1864 * Specifies constraints for a value. To support dataflow analyses.
1866 * Example: If the value never exceeds '100' this is expressed by placing a
1867 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
1869 * @param *irg The IR graph the node belong to.
1870 * @param *block The IR block the node belong to.
1871 * @param *db A pointer for debug information.
1872 * @param *val The value we express a constraint for
1873 * @param *bound The value to compare against. Must be a firm node, typically a constant.
1874 * @param cmp The compare operation.
1876 ir_node *new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block,
1877 ir_node *val, ir_node *bound, pn_Cmp cmp);
1879 /** Constructor for an Unknown node.
1881 * Represents an arbitrary value. Places the node in the start block.
1883 * @param *irg The IR graph the node belongs to.
1884 * @param *m The mode of the unknown value.
1886 ir_node *new_rd_Unknown(ir_graph *irg, ir_mode *m);
1888 /** Constructor for a CallBegin node.
1890 * CallBegin represents control flow depending of the pointer value
1891 * representing the called method to the called methods. The
1892 * constructor copies the method pointer input from the passed Call
1895 * @param *db A pointer for debug information.
1896 * @param *irg The IR graph the node belong to.
1897 * @param *block The block the node belong to.
1898 * @param *callee The call node visible in the intra procedural view.
1900 ir_node *new_rd_CallBegin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *callee);
1902 /** Constructor for a EndReg node.
1904 * Used to represent regular procedure end in interprocedual view.
1906 * @param *db A pointer for debug information.
1907 * @param *irg The IR graph the node belong to.
1908 * @param *block The block the node belong to.
1910 ir_node *new_rd_EndReg (dbg_info *db, ir_graph *irg, ir_node *block);
1912 /** Constructor for a EndExcept node.
1914 * Used to represent exceptional procedure end in interprocedural view.
1916 * @param *db A pointer for debug information.
1917 * @param *irg The IR graph the node belong to.
1918 * @param *block The block the node belong to.
1920 ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
1922 /** Constructor for a Filter node.
1924 * Adds the node to the block in current_ir_block. Filter is a node
1925 * with two views used to construct the interprocedural view. In
1926 * intraprocedural view its semantics are identical to the Proj node.
1927 * In interprocedural view the Filter performs the Phi operation on
1928 * method parameters or results. Other than a Phi a Filter node may
1929 * not be removed if it has only a single input.
1931 * The constructor builds the Filter in intraprocedural view.
1933 * @param *db A pointer for debug information.
1934 * @param *irg The IR graph the node belong to.
1935 * @param *block The block the node belong to.
1936 * @param *arg The tuple value to project from.
1937 * @param *mode The mode of the projected value.
1938 * @param proj The position in the tuple to project from.
1940 ir_node *new_rd_Filter (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1941 ir_mode *mode, long proj);
1943 /** Constructor for a Mux node.
1945 * @param *db A pointer for debug information.
1946 * @param *irg The IR graph the node belong to.
1947 * @param *block The block the node belong to.
1948 * @param *sel The ir_node that calculates the boolean select.
1949 * @param *ir_true The ir_node that calculates the true result.
1950 * @param *ir_false The ir_node that calculates the false result.
1951 * @param *mode The mode of the node (and it_true and ir_false).
1953 ir_node *new_rd_Mux (dbg_info *db, ir_graph *irg, ir_node *block,
1954 ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
1956 /** Constructor for a CopyB node.
1958 * @param *db A pointer for debug information.
1959 * @param *irg The IR graph the node belong to.
1960 * @param *block The block the node belong to.
1961 * @param *store The current memory
1962 * @param *dst The ir_node that represents the destination address.
1963 * @param *src The ir_node that represents the source address.
1964 * @param *data_type The type of the copied data
1966 ir_node *new_rd_CopyB(dbg_info *db, ir_graph *irg, ir_node *block,
1967 ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
1969 /** Constructor for a InstOf node.
1971 * A High-Level Type check.
1973 * @param *db A pointer for debug information.
1974 * @param *irg The IR graph the node belongs to.
1975 * @param *block The IR block the node belongs to.
1976 * @param *store The memory in which the object the entity should be selected
1977 * from is allocated.
1978 * @param *objptr A pointer to a object of a class type.
1979 * @param *type The type of which objptr must be.
1981 ir_node *new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1982 ir_node *objptr, ir_type *type);
1984 /** Constructor for a Raise node.
1986 * A High-Level Exception throw.
1988 * @param *db A pointer for debug information.
1989 * @param *irg The IR graph the node belongs to.
1990 * @param *block The IR block the node belongs to.
1991 * @param *store The current memory.
1992 * @param *obj A pointer to the Except variable.
1994 ir_node *new_rd_Raise (dbg_info *db, ir_graph *irg, ir_node *block,
1995 ir_node *store, ir_node *obj);
1997 /** Constructor for a Bound node.
1999 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2001 * @param *db A pointer for debug information.
2002 * @param *irg The IR graph the node belong to.
2003 * @param *block The block the node belong to.
2004 * @param *store The current memory.
2005 * @param *idx The ir_node that represents an index.
2006 * @param *lower The ir_node that represents the lower bound for the index.
2007 * @param *upper The ir_node that represents the upper bound for the index.
2009 ir_node *new_rd_Bound(dbg_info *db, ir_graph *irg, ir_node *block,
2010 ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
2012 /** Constructor for a Pin node.
2014 * @param *db A pointer for debug information.
2015 * @param *irg The IR graph the node belong to.
2016 * @param *block The block the node belong to.
2017 * @param *node The node which value should be pinned.
2019 ir_node *new_rd_Pin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *node);
2021 /** Constructor for an ASM pseudo node.
2023 * @param *db A pointer for debug information.
2024 * @param *irg The IR graph the node belong to.
2025 * @param *block The block the node belong to.
2026 * @param arity The number of data inputs to the node.
2027 * @param *in The array of length arity of data inputs.
2028 * @param *inputs The array of length arity of input constraints.
2029 * @param n_outs The number of data outputs to the node.
2030 * @param *outputs The array of length n_outs of output constraints.
2031 * @param n_clobber The number of clobbered registers.
2032 * @param *clobber The array of length n_clobber of clobbered registers.
2033 * @param *asm_text The assembler text.
2035 ir_node *new_rd_ASM(dbg_info *db, ir_graph *irg, ir_node *block,
2036 int arity, ir_node *in[], ir_asm_constraint *inputs,
2037 int n_outs, ir_asm_constraint *outputs,
2038 int n_clobber, ident *clobber[], ident *asm_text);
2040 /*-------------------------------------------------------------------------*/
2041 /* The raw interface without debug support */
2042 /*-------------------------------------------------------------------------*/
2044 /** Constructor for a Block node.
2046 * Constructs a mature block with the given predecessors. Use Unknown
2047 * nodes as predecessors to construct a block if the number of
2048 * predecessors is known, but not the predecessors themselves. This
2049 * constructor does not set current_block. It not be used with
2050 * automatic Phi node construction.
2053 * @param irg The IR graph the block belongs to.
2054 * @param arity The number of control predecessors.
2055 * @param in[] An array of control predecessors. The length of
2056 * the array must be 'arity'. The constructor copies this array.
2058 ir_node *new_r_Block (ir_graph *irg, int arity, ir_node *in[]);
2060 /** Constructor for a Start node.
2062 * @param *irg The IR graph the node belongs to.
2063 * @param *block The IR block the node belongs to.
2065 ir_node *new_r_Start (ir_graph *irg, ir_node *block);
2067 /** Constructor for a End node.
2069 * @param *irg The IR graph the node belongs to.
2070 * @param *block The IR block the node belongs to.
2072 ir_node *new_r_End (ir_graph *irg, ir_node *block);
2074 /** Constructor for a Jmp node.
2076 * Jmp represents control flow to a single control successor.
2078 * @param *irg The IR graph the node belongs to.
2079 * @param *block The IR block the node belongs to.
2081 ir_node *new_r_Jmp (ir_graph *irg, ir_node *block);
2083 /** Constructor for an IJmp node.
2085 * IJmp represents control flow to a single control successor not
2086 * statically known i.e. an indirect Jmp.
2088 * @param *irg The IR graph the node belongs to.
2089 * @param *block The IR block the node belongs to.
2090 * @param *tgt The IR node representing the target address.
2092 ir_node *new_r_IJmp (ir_graph *irg, ir_node *block, ir_node *tgt);
2094 /** Constructor for a Cond node.
2096 * If c is mode_b represents a conditional branch (if/else). If c is
2097 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2098 * node, default Proj is 0.)
2100 * This is not consistent: Input to Cond is Is, Proj has as proj number
2103 * @param *irg The IR graph the node belongs to.
2104 * @param *block The IR block the node belongs to.
2105 * @param *c The conditions parameter.Can be of mode b or I_u.
2107 ir_node *new_r_Cond (ir_graph *irg, ir_node *block, ir_node *c);
2109 /** Constructor for a Return node.
2111 * Returns the memory and zero or more return values. Only node that
2112 * can end regular control flow.
2114 * @param *irg The IR graph the node belongs to.
2115 * @param *block The IR block the node belongs to.
2116 * @param *store The state of memory.
2117 * @param arity Number of array indices.
2118 * @param *in[] Array with index inputs to the node. The constructor copies this array.
2120 ir_node *new_r_Return (ir_graph *irg, ir_node *block,
2121 ir_node *store, int arity, ir_node *in[]);
2123 /** Constructor for a Const node.
2125 * Adds the node to the start block.
2127 * Constructor for a Const node. The constant represents a target
2128 * value. Sets the type information to type_unknown. (No more
2129 * supported: If tv is entity derives a somehow useful type.)
2130 * Derives mode from passed tarval.
2132 * @param *irg The IR graph the node belongs to.
2133 * @param *block The IR block the node belongs to.
2134 * @param *con Points to an entry in the constant table.
2136 ir_node *new_r_Const (ir_graph *irg, tarval *con);
2138 /** Constructor for a Const node.
2140 * Adds the node to the start block.
2142 * Constructor for a Const node. The constant represents a target
2143 * value. Sets the type information to type_unknown. (No more
2144 * supported: If tv is entity derives a somehow useful type.)
2146 * @param *irg The IR graph the node belongs to.
2147 * @param *mode The mode of the operands and the results.
2148 * @param value A value from which the tarval is made.
2150 ir_node *new_r_Const_long(ir_graph *irg,
2151 ir_mode *mode, long value);
2153 /** Constructor for a Const_type node.
2155 * Adds the node to the start block.
2157 * The constant represents a target value. This constructor sets high
2158 * level type information for the constant value.
2159 * Derives mode from passed tarval.
2161 * @param *irg The IR graph the node belongs to.
2162 * @param *con Points to an entry in the constant table.
2163 * @param *tp The type of the constant.
2165 ir_node *new_r_Const_type(ir_graph *irg, tarval *con, ir_type *tp);
2167 /** Constructor for a SymConst node.
2169 * This is the constructor for a symbolic constant.
2170 * There are four kinds of symbolic constants:
2171 * - type_tag The symbolic constant represents a type tag. The type the
2172 * tag stands for is given explicitly.
2173 * - size The symbolic constant represents the size of a type. The
2174 * type of which the constant represents the size is given
2176 * - addr_name The symbolic constant represents the address of an entity
2177 * (variable or method). The variable is indicated by a name
2178 * that is valid for linking.
2179 * - addr_ent The symbolic constant represents the address of an entity
2180 * (variable or method). The variable is given explicitly by
2183 * Inputs to the node:
2184 * No inputs except the block it belongs to.
2185 * Outputs of the node.
2186 * An unsigned integer (I_u) or a pointer (P).
2188 * @param *irg The IR graph the node belongs to.
2189 * @param *block The IR block the node belongs to.
2190 * @param mode The mode for the SymConst.
2191 * @param value A type, entity or a ident depending on the SymConst kind.
2192 * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
2194 ir_node *new_r_SymConst(ir_graph *irg, ir_node *block, ir_mode *mode,
2195 union symconst_symbol value, symconst_kind symkind);
2197 /** Constructor for a simpleSel node.
2199 * This is a shortcut for the new_d_Sel() constructor. To be used for
2200 * Sel nodes that do not select from an array, i.e., have no index
2201 * inputs. It adds the two parameters 0, NULL.
2203 * @param *irg The IR graph the node belongs to.
2204 * @param *block The IR block the node belongs to.
2205 * @param *store The memory in which the object the entity should be selected
2206 * from is allocated.
2207 * @param *objptr The object from that the Sel operation selects a
2208 * single attribute out.
2209 * @param *ent The entity to select.
2211 ir_node *new_r_simpleSel(ir_graph *irg, ir_node *block, ir_node *store,
2212 ir_node *objptr, ir_entity *ent);
2214 /** Constructor for a Sel node.
2216 * The select node selects an entity (field or method) from an entity
2217 * with a compound type. It explicitly specifies the entity selected.
2218 * Dynamically the node may select entities that overwrite the given
2219 * entity. If the selected entity is an array element entity the Sel
2220 * node takes the required array indices as inputs.
2222 * @param *irg The IR graph the node belongs to.
2223 * @param *block The IR block the node belongs to.
2224 * @param *store The memory in which the object the entity should be selected
2225 * from is allocated.
2226 * @param *objptr A pointer to a compound entity the Sel operation selects a
2227 * single attribute from.
2228 * @param *n_index The number of array indices needed to select an array element entity.
2229 * @param *index[] If the compound entity is an array the indices of the selected
2230 * element entity. The constructor copies this array.
2231 * @param *ent The entity to select.
2233 ir_node *new_r_Sel (ir_graph *irg, ir_node *block, ir_node *store,
2234 ir_node *objptr, int n_index, ir_node *index[],
2237 /** Constructor for a Call node.
2239 * Represents all kinds of method and function calls.
2241 * @param *irg The IR graph the node belongs to.
2242 * @param *block The IR block the node belongs to.
2243 * @param *store The actual store.
2244 * @param *callee A pointer to the called procedure.
2245 * @param arity The number of procedure parameters.
2246 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
2247 * @param *tp Type information of the procedure called.
2249 ir_node *new_r_Call (ir_graph *irg, ir_node *block, ir_node *store,
2250 ir_node *callee, int arity, ir_node *in[],
2253 /** Constructor for a Add node.
2255 * @param *irg The IR graph the node belongs to.
2256 * @param *block The IR block the node belongs to.
2257 * @param *op1 The first operand.
2258 * @param *op2 The second operand.
2259 * @param *mode The mode of the operands and the result.
2261 ir_node *new_r_Add (ir_graph *irg, ir_node *block,
2262 ir_node *op1, ir_node *op2, ir_mode *mode);
2265 * Constructor for a Sub node.
2267 * @param *irg The IR graph the node belongs to.
2268 * @param *block The IR block the node belongs to.
2269 * @param *op1 The first operand.
2270 * @param *op2 The second operand.
2271 * @param *mode The mode of the operands and the results.
2273 ir_node *new_r_Sub (ir_graph *irg, ir_node *block,
2274 ir_node *op1, ir_node *op2, ir_mode *mode);
2276 /** Constructor for a Minus node.
2278 * @param *irg The IR graph the node belongs to.
2279 * @param *block The IR block the node belongs to.
2280 * @param *op The operand.
2281 * @param *mode The mode of the operand and the result.
2283 ir_node *new_r_Minus (ir_graph *irg, ir_node *block,
2284 ir_node *op, ir_mode *mode);
2286 /** Constructor for a Mul node.
2288 * @param *irg The IR graph the node belongs to.
2289 * @param *block The IR block the node belongs to.
2290 * @param *op1 The first operand.
2291 * @param *op2 The second operand.
2292 * @param *mode The mode of the operands and the result.
2294 ir_node *new_r_Mul (ir_graph *irg, ir_node *block,
2295 ir_node *op1, ir_node *op2, ir_mode *mode);
2297 /** Constructor for a Mulh node.
2299 * @param *irg The IR graph the node belongs to.
2300 * @param *block The IR block the node belongs to.
2301 * @param *op1 The first operand.
2302 * @param *op2 The second operand.
2303 * @param *mode The mode of the operands and the result.
2305 ir_node *new_r_Mulh (ir_graph *irg, ir_node *block,
2306 ir_node *op1, ir_node *op2, ir_mode *mode);
2308 /** Constructor for a Quot node.
2310 * @param *irg The IR graph the node belongs to.
2311 * @param *block The IR block the node belongs to.
2312 * @param *memop The store needed to model exceptions
2313 * @param *op1 The first operand.
2314 * @param *op2 The second operand.
2315 * @param *mode The mode of the result.
2316 * @param state The pinned state.
2318 ir_node *new_r_Quot (ir_graph *irg, ir_node *block,
2319 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2321 /** Constructor for a DivMod node.
2323 * @param *irg The IR graph the node belongs to.
2324 * @param *block The IR block the node belongs to.
2325 * @param *memop The store needed to model exceptions
2326 * @param *op1 The first operand.
2327 * @param *op2 The second operand.
2328 * @param *mode The mode of the results.
2329 * @param state The pinned state.
2331 ir_node *new_r_DivMod (ir_graph *irg, ir_node *block,
2332 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2334 /** Constructor for a Div node.
2336 * @param *irg The IR graph the node belongs to.
2337 * @param *block The IR block the node belongs to.
2338 * @param *memop The store needed to model exceptions
2339 * @param *op1 The first operand.
2340 * @param *op2 The second operand.
2341 * @param *mode The mode of the result.
2342 * @param state The pinned state.
2344 ir_node *new_r_Div (ir_graph *irg, ir_node *block,
2345 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2347 /** Constructor for a remainderless Div node.
2349 * @param *irg The IR graph the node belongs to.
2350 * @param *block The IR block the node belongs to.
2351 * @param *memop The store needed to model exceptions
2352 * @param *op1 The first operand.
2353 * @param *op2 The second operand.
2354 * @param *mode The mode of the result.
2355 * @param state The pinned state.
2357 ir_node *new_r_DivRL (ir_graph *irg, ir_node *block,
2358 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2360 /** Constructor for a Mod node.
2362 * @param *irg The IR graph the node belongs to.
2363 * @param *block The IR block the node belongs to.
2364 * @param *memop The store needed to model exceptions
2365 * @param *op1 The first operand.
2366 * @param *op2 The second operand.
2367 * @param *mode The mode of the result.
2368 * @param state The pinned state.
2370 ir_node *new_r_Mod (ir_graph *irg, ir_node *block,
2371 ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2373 /** Constructor for a Abs node.
2375 * @param *irg The IR graph the node belongs to.
2376 * @param *block The IR block the node belongs to.
2377 * @param *op The operand
2378 * @param *mode The mode of the operands and the result.
2380 ir_node *new_r_Abs (ir_graph *irg, ir_node *block,
2381 ir_node *op, ir_mode *mode);
2383 /** Constructor for a And node.
2385 * @param *irg The IR graph the node belongs to.
2386 * @param *block The IR block the node belongs to.
2387 * @param *op1 The first operand.
2388 * @param *op2 The second operand.
2389 * @param *mode The mode of the operands and the result.
2391 ir_node *new_r_And (ir_graph *irg, ir_node *block,
2392 ir_node *op1, ir_node *op2, ir_mode *mode);
2394 /** Constructor for a Or node.
2396 * @param *irg The IR graph the node belongs to.
2397 * @param *block The IR block the node belongs to.
2398 * @param *op1 The first operand.
2399 * @param *op2 The second operand.
2400 * @param *mode The mode of the operands and the result.
2402 ir_node *new_r_Or (ir_graph *irg, ir_node *block,
2403 ir_node *op1, ir_node *op2, ir_mode *mode);
2405 /** Constructor for a Eor node.
2407 * @param *irg The IR graph the node belongs to.
2408 * @param *block The IR block the node belongs to.
2409 * @param *op1 The first operand.
2410 * @param *op2 The second operand.
2411 * @param *mode The mode of the operands and the results.
2413 ir_node *new_r_Eor (ir_graph *irg, ir_node *block,
2414 ir_node *op1, ir_node *op2, ir_mode *mode);
2416 /** Constructor for a Not node.
2418 * @param *irg The IR graph the node belongs to.
2419 * @param *block The IR block the node belongs to.
2420 * @param *op The operand.
2421 * @param *mode The mode of the operand and the result.
2423 ir_node *new_r_Not (ir_graph *irg, ir_node *block,
2424 ir_node *op, ir_mode *mode);
2426 /** Constructor for a Cmp node.
2428 * @param *irg The IR graph the node belongs to.
2429 * @param *block The IR block the node belongs to.
2430 * @param *op1 The first operand.
2431 * @param *op2 The second operand.
2433 ir_node *new_r_Cmp (ir_graph *irg, ir_node *block,
2434 ir_node *op1, ir_node *op2);
2436 /** Constructor for a Shl node.
2438 * @param *irg The IR graph the node belongs to.
2439 * @param *block The IR block the node belongs to.
2440 * @param *op The operand.
2441 * @param *k The number of bits to shift the operand .
2442 * @param *mode The mode of the operand and the result.
2444 ir_node *new_r_Shl (ir_graph *irg, ir_node *block,
2445 ir_node *op, ir_node *k, ir_mode *mode);
2447 /** Constructor for a Shr node.
2449 * @param *irg The IR graph the node belongs to.
2450 * @param *block The IR block the node belongs to.
2451 * @param *op The operand.
2452 * @param *k The number of bits to shift the operand .
2453 * @param *mode The mode of the operand and the result.
2455 ir_node *new_r_Shr (ir_graph *irg, ir_node *block,
2456 ir_node *op, ir_node *k, ir_mode *mode);
2459 * Constructor for a Shrs node.
2461 * @param *irg The IR graph the node belongs to.
2462 * @param *block The IR block the node belongs to.
2463 * @param *op The operand.
2464 * @param *k The number of bits to shift the operand.
2465 * @param *mode The mode of the operand and the result.
2467 ir_node *new_r_Shrs (ir_graph *irg, ir_node *block,
2468 ir_node *op, ir_node *k, ir_mode *mode);
2470 /** Constructor for a Rotl node.
2472 * @param *irg The IR graph the node belongs to.
2473 * @param *block The IR block the node belongs to.
2474 * @param *op The operand.
2475 * @param *k The number of bits to rotate the operand.
2476 * @param *mode The mode of the operand.
2478 ir_node *new_r_Rotl (ir_graph *irg, ir_node *block,
2479 ir_node *op, ir_node *k, ir_mode *mode);
2481 /** Constructor for a Conv node.
2483 * @param *irg The IR graph the node belongs to.
2484 * @param *block The IR block the node belongs to.
2485 * @param *op The operand.
2486 * @param *mode The mode of this the operand muss be converted .
2488 ir_node *new_r_Conv (ir_graph *irg, ir_node *block,
2489 ir_node *op, ir_mode *mode);
2491 /** Constructor for a Cast node.
2493 * High level type cast
2495 * @param *irg The IR graph the node belongs to.
2496 * @param *block The IR block the node belongs to.
2497 * @param *op The operand.
2498 * @param *to_tp The type of this the operand muss be casted .
2500 ir_node *new_r_Cast (ir_graph *irg, ir_node *block,
2501 ir_node *op, ir_type *to_tp);
2503 /** Constructor for a Carry node.
2505 * @param *irg The IR graph the node belongs to.
2506 * @param *block The IR block the node belongs to.
2507 * @param *op1 The first operand.
2508 * @param *op2 The second operand.
2509 * @param *mode The mode of the operands and the result.
2511 ir_node *new_r_Carry (ir_graph *irg, ir_node *block,
2512 ir_node *op1, ir_node *op2, ir_mode *mode);
2515 * Constructor for a Borrow node.
2517 * @param *irg The IR graph the node belongs to.
2518 * @param *block The IR block the node belongs to.
2519 * @param *op1 The first operand.
2520 * @param *op2 The second operand.
2521 * @param *mode The mode of the operands and the results.
2523 ir_node *new_r_Borrow (ir_graph *irg, ir_node *block,
2524 ir_node *op1, ir_node *op2, ir_mode *mode);
2526 /** Constructor for a Phi node.
2528 * @param *irg The IR graph the node belongs to.
2529 * @param *block The IR block the node belongs to.
2530 * @param arity The number of predecessors
2531 * @param *in[] Array with predecessors. The constructor copies this array.
2532 * @param *mode The mode of it's inputs and output.
2534 ir_node *new_r_Phi (ir_graph *irg, ir_node *block, int arity,
2535 ir_node *in[], ir_mode *mode);
2537 /** Constructor for a Load node.
2539 * @param *irg The IR graph the node belongs to.
2540 * @param *block The IR block the node belongs to.
2541 * @param *store The current memory
2542 * @param *adr A pointer to the variable to be read in this memory.
2543 * @param *mode The mode of the value to be loaded.
2545 ir_node *new_r_Load (ir_graph *irg, ir_node *block,
2546 ir_node *store, ir_node *adr, ir_mode *mode);
2548 /** Constructor for a Store node.
2550 * @param *irg The IR graph the node belongs to.
2551 * @param *block The IR block the node belongs to.
2552 * @param *store The current memory
2553 * @param *adr A pointer to the variable to be read in this memory.
2554 * @param *val The value to write to this variable.
2556 ir_node *new_r_Store (ir_graph *irg, ir_node *block,
2557 ir_node *store, ir_node *adr, ir_node *val);
2559 /** Constructor for a Alloc node.
2561 * The Alloc node extends the memory by space for an entity of type alloc_type.
2563 * @param *irg The IR graph the node belongs to.
2564 * @param *block The IR block the node belongs to.
2565 * @param *store The memory which shall contain the new variable.
2566 * @param *size The number of bytes to allocate.
2567 * @param *alloc_type The type of the allocated variable.
2568 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
2570 ir_node *new_r_Alloc (ir_graph *irg, ir_node *block, ir_node *store,
2571 ir_node *size, ir_type *alloc_type, ir_where_alloc where);
2573 /** Constructor for a Free node.
2575 * Frees the memory occupied by the entity pointed to by the pointer
2576 * arg. Type indicates the type of the entity the argument points to.
2578 * @param *irg The IR graph the node belongs to.
2579 * @param *block The IR block the node belongs to.
2580 * @param *store The memory which shall contain the new variable.
2581 * @param *ptr The pointer to the object to free.
2582 * @param *size The number of objects of type free_type to free in a sequence.
2583 * @param *free_type The type of the freed variable.
2584 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
2586 ir_node *new_r_Free (ir_graph *irg, ir_node *block, ir_node *store,
2587 ir_node *ptr, ir_node *size, ir_type *free_type, ir_where_alloc where);
2589 /** Constructor for a Sync node.
2591 * Merges several memory values. The node assumes that a variable
2592 * either occurs only in one of the memories, or it contains the same
2593 * value in all memories where it occurs.
2595 * @param *irg The IR graph the node belongs to.
2596 * @param *block The IR block the node belongs to.
2597 * @param arity The number of memories to synchronize.
2598 * @param *in[] An array of pointers to nodes that produce an output of type memory.
2599 * The constructor copies this array.
2601 ir_node *new_r_Sync (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2603 /** Constructor for a Proj node.
2605 * Projects a single value out of a tuple. The parameter proj gives the
2606 * position of the value within the tuple.
2608 * @param *irg The IR graph the node belongs to.
2609 * @param *block The IR block the node belongs to.
2610 * @param arg A node producing a tuple.
2611 * @param *mode The mode of the value to project.
2612 * @param proj The position of the value in the tuple.
2614 ir_node *new_r_Proj (ir_graph *irg, ir_node *block, ir_node *arg,
2615 ir_mode *mode, long proj);
2617 /** Constructor for a defaultProj node.
2619 * Represents the default control flow of a Switch-Cond node.
2621 * @param *irg The IR graph the node belongs to.
2622 * @param *block The IR block the node belongs to.
2623 * @param arg A node producing a tuple.
2624 * @param max_proj The end position of the value in the tuple.
2626 ir_node *new_r_defaultProj (ir_graph *irg, ir_node *block, ir_node *arg, long max_proj);
2629 /** Constructor for a Tuple node.
2631 * This is an auxiliary node to replace a node that returns a tuple
2632 * without changing the corresponding Proj nodes.
2634 * @param *irg The IR graph the node belongs to.
2635 * @param *block The IR block the node belongs to.
2636 * @param arity The number of tuple elements.
2637 * @param *in[] An array containing pointers to the nodes producing the tuple elements.
2638 * The constructor copies this array.
2640 ir_node *new_r_Tuple (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2642 /** Constructor for a Id node.
2644 * This is an auxiliary node to replace a node that returns a single
2647 * @param *irg The IR graph the node belongs to.
2648 * @param *block The IR block the node belongs to.
2649 * @param *val The operand to Id.
2650 * @param *mode The mode of *val.
2652 ir_node *new_r_Id (ir_graph *irg, ir_node *block,
2653 ir_node *val, ir_mode *mode);
2655 /** Constructor for a Bad node.
2657 * Returns the unique Bad node of the graph. The same as
2660 * @param *irg The IR graph the node belongs to.
2663 ir_node *new_r_Bad (ir_graph *irg);
2665 /** Constructor for a Confirm node.
2667 * Specifies constraints for a value. To support dataflow analyses.
2669 * Example: If the value never exceeds '100' this is expressed by placing a
2670 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
2672 * @param *irg The IR graph the node belong to.
2673 * @param *block The IR block the node belong to.
2674 * @param *val The value we express a constraint for
2675 * @param *bound The value to compare against. Must be a firm node, typically a constant.
2676 * @param cmp The compare operation.
2678 ir_node *new_r_Confirm(ir_graph *irg, ir_node *block,
2679 ir_node *val, ir_node *bound, pn_Cmp cmp);
2681 /** Constructor for a Unknown node.
2683 * Represents an arbitrary value. Places the node in
2686 * @param *irg The IR graph the node belongs to.
2687 * @param *m The mode of the unknown value.
2689 ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2691 /** Constructor for a CallBegin node.
2693 * CallBegin represents control flow depending of the pointer value
2694 * representing the called method to the called methods. The
2695 * constructor copies the method pointer input from the passed Call
2698 * @param *irg The IR graph the node belong to.
2699 * @param *block The block the node belong to.
2700 * @param *callee The call node visible in the intra procedural view.
2702 ir_node *new_r_CallBegin(ir_graph *irg, ir_node *block, ir_node *callee);
2704 /** Constructor for a EndReg node.
2706 * Used to represent regular procedure end in interprocedual view.
2708 * @param *irg The IR graph the node belong to.
2709 * @param *block The block the node belong to.
2711 ir_node *new_r_EndReg (ir_graph *irg, ir_node *block);
2713 /** Constructor for a EndExcept node.
2715 * Used to represent exceptional procedure end in interprocedural view.
2717 * @param *irg The IR graph the node belong to.
2718 * @param *block The block the node belong to.
2720 ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
2722 /** Constructor for a Break node.
2724 * Break represents control flow to a single control successor just as Jmp.
2725 * The blocks separated by a break may not be concatenated by an optimization.
2726 * It is used for the interprocedural representation where blocks are parted
2727 * behind Call nodes to represent the control flow to called procedures.
2729 * @param *irg The IR graph the node belong to.
2730 * @param *block The block the node belong to.
2732 ir_node *new_r_Break (ir_graph *irg, ir_node *block);
2734 /** Constructor for a Filter node.
2736 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
2737 * Filter is a node with two views used to construct the interprocedural view.
2738 * In intraprocedural view its semantics are identical to the Proj node.
2739 * In interprocedural view the Filter performs the Phi operation on method
2740 * parameters or results. Other than a Phi a Filter node may not be removed
2741 * if it has only a single input.
2743 * The constructor builds the Filter in intraprocedural view.
2745 * @param *irg The IR graph the node belong to.
2746 * @param *block The block the node belong to.
2747 * @param *arg The tuple value to project from.
2748 * @param *mode The mode of the projected value.
2749 * @param proj The position in the tuple to project from.
2751 ir_node *new_r_Filter (ir_graph *irg, ir_node *block, ir_node *arg,
2752 ir_mode *mode, long proj);
2754 /** Constructor for a NoMem node.
2756 * Returns the unique NoMem node of the graph. The same as
2759 * @param *irg The IR graph the node belongs to.
2761 ir_node *new_r_NoMem (ir_graph *irg);
2763 /** Constructor for a Mux node.
2765 * @param *irg The IR graph the node belong to.
2766 * @param *block The block the node belong to.
2767 * @param *sel The ir_node that calculates the boolean select.
2768 * @param *ir_true The ir_node that calculates the true result.
2769 * @param *ir_false The ir_node that calculates the false result.
2770 * @param *mode The mode of the node (and it_true and ir_false).
2772 ir_node *new_r_Mux (ir_graph *irg, ir_node *block,
2773 ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2775 /** Constructor for a CopyB node.
2777 * @param *irg The IR graph the node belong to.
2778 * @param *block The block the node belong to.
2779 * @param *store The current memory
2780 * @param *dst The ir_node that represents the destination address.
2781 * @param *src The ir_node that represents the source address.
2782 * @param *data_type The type of the copied data
2784 ir_node *new_r_CopyB(ir_graph *irg, ir_node *block,
2785 ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
2787 /** Constructor for a InstOf node.
2789 * A High-Level Type check.
2791 * @param *irg The IR graph the node belongs to.
2792 * @param *block The IR block the node belongs to.
2793 * @param *store The memory in which the object the entity should be selected
2794 * from is allocated.
2795 * @param *objptr A pointer to a object of a class type.
2796 * @param *type The type of which objptr must be.
2798 ir_node *new_r_InstOf(ir_graph *irg, ir_node *block, ir_node *store,
2799 ir_node *objptr, ir_type *type);
2801 /** Constructor for a Raise node.
2803 * A High-Level Exception throw.
2805 * @param *irg The IR graph the node belongs to.
2806 * @param *block The IR block the node belongs to.
2807 * @param *store The current memory.
2808 * @param *obj A pointer to the Except variable.
2810 ir_node *new_r_Raise(ir_graph *irg, ir_node *block,
2811 ir_node *store, ir_node *obj);
2813 /** Constructor for a Bound node.
2815 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2817 * @param *irg The IR graph the node belong to.
2818 * @param *block The block the node belong to.
2819 * @param *store The current memory.
2820 * @param *idx The ir_node that represents an index.
2821 * @param *lower The ir_node that represents the lower bound for the index.
2822 * @param *upper The ir_node that represents the upper bound for the index.
2824 ir_node *new_r_Bound(ir_graph *irg, ir_node *block,
2825 ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
2827 /** Constructor for a Pin node.
2829 * @param *irg The IR graph the node belong to.
2830 * @param *block The block the node belong to.
2831 * @param *node The node which value should be pinned.
2833 ir_node *new_r_Pin(ir_graph *irg, ir_node *block, ir_node *node);
2835 /** Constructor for an ASM pseudo node.
2837 * @param *irg The IR graph the node belong to.
2838 * @param *block The block the node belong to.
2839 * @param arity The number of data inputs to the node.
2840 * @param *in The array of length arity of data inputs.
2841 * @param *inputs The array of length arity of input constraints.
2842 * @param n_outs The number of data outputs to the node.
2843 * @param *outputs The array of length n_outs of output constraints.
2844 * @param n_clobber The number of clobbered registers.
2845 * @param *clobber The array of length n_clobber of clobbered registers.
2846 * @param *asm_text The assembler text.
2848 ir_node *new_r_ASM(ir_graph *irg, ir_node *block,
2849 int arity, ir_node *in[], ir_asm_constraint *inputs,
2850 int n_outs, ir_asm_constraint *outputs,
2851 int n_clobber, ident *clobber[], ident *asm_text);
2853 /*-----------------------------------------------------------------------*/
2854 /* The block oriented interface */
2855 /*-----------------------------------------------------------------------*/
2857 /** Sets the current block in which the following constructors place the
2858 * nodes they construct.
2860 * @param target The new current block.
2862 void set_cur_block (ir_node *target);
2864 /** Returns the current block of the current graph. */
2865 ir_node *get_cur_block(void);
2867 /** Returns the fixed nodes of the current graph. */
2868 #define get_cur_end_block() get_irg_end_block(current_ir_graph)
2869 #define get_cur_end() get_irg_end(current_ir_graph)
2870 #define get_cur_start_block() get_irg_start_block(current_ir_graph)
2871 #define get_cur_start() get_irg_start(current_ir_graph)
2873 /** Constructor for a Block node.
2875 * Adds the block to the graph in current_ir_graph. Constructs a Block
2876 * with a fixed number of predecessors. Does set current_block. Can
2877 * be used with automatic Phi node construction.
2879 * @param *db A Pointer for debug information.
2880 * @param arity The number of control predecessors.
2881 * @param in[] An array of control predecessors. The length of
2882 * the array must be 'arity'.
2884 ir_node *new_d_Block(dbg_info *db, int arity, ir_node *in[]);
2886 /** Constructor for a Start node.
2888 * Adds the node to the block in current_ir_block.
2890 * @param *db A pointer for debug information.
2892 ir_node *new_d_Start (dbg_info *db);
2894 /** Constructor for a End node.
2896 * Adds the node to the block in current_ir_block.
2898 * @param *db A pointer for debug information.
2900 ir_node *new_d_End (dbg_info *db);
2902 /** Constructor for a Jmp node.
2904 * Adds the node to the block in current_ir_block.
2906 * Jmp represents control flow to a single control successor.
2908 * @param *db A pointer for debug information.
2910 ir_node *new_d_Jmp (dbg_info *db);
2912 /** Constructor for an IJmp node.
2914 * IJmp represents control flow to a single control successor not
2915 * statically known i.e. an indirect Jmp.
2917 * @param *db A pointer for debug information.
2918 * @param *tgt The IR node representing the target address.
2920 ir_node *new_d_IJmp (dbg_info *db, ir_node *tgt);
2922 /** Constructor for a Cond node.
2924 * Adds the node to the block in current_ir_block.
2926 * If c is mode_b represents a conditional branch (if/else). If c is
2927 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
2928 * node, default Proj is 0.)
2930 * This is not consistent: Input to Cond is Is, Proj has as proj number
2933 * @param *db A pointer for debug information.
2934 * @param *c The conditions parameter.Can be of mode b or I_u.
2936 ir_node *new_d_Cond (dbg_info *db, ir_node *c);
2938 /** Constructor for a Return node.
2940 * Adds the node to the block in current_ir_block.
2942 * Returns the memory and zero or more return values. Only node that
2943 * can end regular control flow.
2945 * @param *db A pointer for debug information.
2946 * @param *store The state of memory.
2947 * @param arity Number of array indices.
2948 * @param *in Array with index inputs to the node.
2950 ir_node *new_d_Return (dbg_info *db, ir_node *store, int arity, ir_node *in[]);
2952 /** Constructor for a Const_type node.
2954 * Adds the node to the start block.
2956 * The constant represents a target value. This constructor sets high
2957 * level type information for the constant value.
2958 * Derives mode from passed tarval.
2960 * @param *db A pointer for debug information.
2961 * @param *con Points to an entry in the constant table. This pointer is
2962 added to the attributes of the node.
2963 * @param *tp The type of the constant.
2965 ir_node *new_d_Const_type (dbg_info *db, tarval *con, ir_type *tp);
2967 /** Constructor for a Const node.
2969 * Adds the node to the block in current_ir_block.
2971 * Constructor for a Const node. The constant represents a target
2972 * value. Sets the type information to type_unknown. (No more
2973 * supported: If tv is entity derives a somehow useful type.)
2974 * Derives mode from passed tarval.
2976 * @param *db A pointer for debug information.
2977 * @param *con Points to an entry in the constant table. This pointer is added
2978 * to the attributes of the node.
2980 ir_node *new_d_Const (dbg_info *db, tarval *con);
2982 /** Constructor for a SymConst_type node.
2984 * Adds the node to the block in current_ir_block.
2985 * This is the constructor for a symbolic constant.
2986 * There are four kinds of symbolic constants:
2987 * - type_tag The symbolic constant represents a type tag. The type the
2988 * tag stands for is given explicitly.
2989 * - size The symbolic constant represents the size of a type. The
2990 * type of which the constant represents the size is given
2992 * - addr_name The symbolic constant represents the address of an entity
2993 * (variable or method). The variable is indicated by a name
2994 * that is valid for linking.
2995 * - addr_ent The symbolic constant represents the address of an entity
2996 * (variable or method). The variable is given explicitly by
2999 * Inputs to the node:
3000 * No inputs except the block it belongs to.
3001 * Outputs of the node.
3002 * An unsigned integer (I_u) or a pointer (P).
3004 * @param *db A pointer for debug information.
3005 * @param mode The mode for the SymConst.
3006 * @param value A type, entity or ident depending on the SymConst kind.
3007 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size,
3008 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
3009 * @param tp The source type of the constant.
3011 ir_node *new_d_SymConst_type(dbg_info *db, ir_mode *mode,
3012 union symconst_symbol value, symconst_kind kind, ir_type *tp);
3014 /** Constructor for a SymConst node.
3016 * Same as new_d_SymConst_type, except that it sets the type to type_unknown.
3018 ir_node *new_d_SymConst(dbg_info *db, ir_mode *mode,
3019 union symconst_symbol value, symconst_kind kind);
3021 /** Constructor for a simpleSel node.
3023 * This is a shortcut for the new_d_Sel() constructor. To be used for
3024 * Sel nodes that do not select from an array, i.e., have no index
3025 * inputs. It adds the two parameters 0, NULL.
3027 * @param *db A pointer for debug information.
3028 * @param *store The memory in which the object the entity should be
3029 * selected from is allocated.
3030 * @param *objptr The object from that the Sel operation selects a
3031 * single attribute out.
3032 * @param *ent The entity to select.
3034 ir_node *new_d_simpleSel(dbg_info *db, ir_node *store, ir_node *objptr, ir_entity *ent);
3036 /** Constructor for a Sel node.
3038 * The select node selects an entity (field or method) from an entity
3039 * with a compound type. It explicitly specifies the entity selected.
3040 * Dynamically the node may select entities that overwrite the given
3041 * entity. If the selected entity is an array element entity the Sel
3042 * node takes the required array indices as inputs.
3043 * Adds the node to the block in current_ir_block.
3045 * @param *db A pointer for debug information.
3046 * @param *store The memory in which the object the entity should be selected
3047 * from is allocated.
3048 * @param *objptr A pointer to a compound entity the Sel operation selects a
3049 * single attribute from.
3050 * @param arity The number of array indices needed to select an array element entity.
3051 * @param *in[] If the compound entity is an array the indices of the selected
3052 * element entity. The constructor copies this array.
3053 * @param *ent The entity to select.
3055 ir_node *new_d_Sel (dbg_info *db, ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3058 /** Constructor for a Call node.
3060 * Represents all kinds of method and function calls.
3061 * Adds the node to the block in current_ir_block.
3063 * @param *db A pointer for debug information.
3064 * @param *store The actual store.
3065 * @param *callee A pointer to the called procedure.
3066 * @param arity The number of procedure parameters.
3067 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3068 * @param *tp Type information of the procedure called.
3070 ir_node *new_d_Call (dbg_info *db, ir_node *store, ir_node *callee, int arity, ir_node *in[],
3073 /** Constructor for a Add node.
3075 * Adds the node to the block in current_ir_block.
3077 * @param *db A pointer for debug information.
3078 * @param *op1 The first operand.
3079 * @param *op2 The second operand.
3080 * @param *mode The mode of the operands and the result.
3082 ir_node *new_d_Add (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3084 /** Constructor for a Sub node.
3086 * Adds the node to the block in current_ir_block.
3088 * @param *db A pointer for debug information.
3089 * @param *op1 The first operand.
3090 * @param *op2 The second operand.
3091 * @param *mode The mode of the operands and the result.
3093 ir_node *new_d_Sub (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3095 /** Constructor for a Minus node.
3097 * Adds the node to the block in current_ir_block.
3099 * @param *db A pointer for debug information.
3100 * @param *op The operand .
3101 * @param *mode The mode of the operand and the result.
3103 ir_node *new_d_Minus (dbg_info *db, ir_node *op, ir_mode *mode);
3105 /** Constructor for a Mul node.
3107 * Adds the node to the block in current_ir_block.
3109 * @param *db A pointer for debug information.
3110 * @param *op1 The first operand.
3111 * @param *op2 The second operand.
3112 * @param *mode The mode of the operands and the result.
3114 ir_node *new_d_Mul (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3116 /** Constructor for a Mulh node.
3118 * Adds the node to the block in current_ir_block.
3120 * @param *db A pointer for debug information.
3121 * @param *op1 The first operand.
3122 * @param *op2 The second operand.
3123 * @param *mode The mode of the operands and the result.
3125 ir_node *new_d_Mulh (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3127 /** Constructor for a Quot node.
3129 * Adds the node to the block in current_ir_block.
3131 * @param *db A pointer for debug information.
3132 * @param *memop The store needed to model exceptions
3133 * @param *op1 The first operand.
3134 * @param *op2 The second operand.
3135 * @param *mode The mode of the result.
3136 * @param state The pinned state.
3138 ir_node *new_d_Quot (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3140 /** Constructor for a DivMod node.
3142 * Adds the node to the block in current_ir_block.
3144 * @param *db A pointer for debug information.
3145 * @param *memop The store needed to model exceptions
3146 * @param *op1 The first operand.
3147 * @param *op2 The second operand.
3148 * @param *mode The mode of the results.
3149 * @param state The pinned state.
3151 ir_node *new_d_DivMod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3153 /** Constructor for a Div node.
3155 * Adds the node to the block in current_ir_block.
3157 * @param *db A pointer for debug information.
3158 * @param *memop The store needed to model exceptions
3159 * @param *op1 The first operand.
3160 * @param *op2 The second operand.
3161 * @param *mode The mode of the result.
3162 * @param state The pinned state.
3164 ir_node *new_d_Div (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3166 /** Constructor for a remainderless Div node.
3168 * Adds the node to the block in current_ir_block.
3170 * @param *db A pointer for debug information.
3171 * @param *memop The store needed to model exceptions
3172 * @param *op1 The first operand.
3173 * @param *op2 The second operand.
3174 * @param *mode The mode of the result.
3175 * @param state The pinned state.
3177 ir_node *new_d_DivRL (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3179 /** Constructor for a Mod node.
3181 * Adds the node to the block in current_ir_block.
3183 * @param *db A pointer for debug information.
3184 * @param *memop The store needed to model exceptions
3185 * @param *op1 The first operand.
3186 * @param *op2 The second operand.
3187 * @param *mode The mode of the result.
3188 * @param state The pinned state.
3190 ir_node *new_d_Mod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3192 /** Constructor for a Abs node.
3194 * Adds the node to the block in current_ir_block.
3196 * @param *db A pointer for debug information.
3197 * @param *op The operand
3198 * @param *mode The mode of the operands and the result.
3200 ir_node *new_d_Abs (dbg_info *db, ir_node *op, ir_mode *mode);
3202 /** Constructor for a And node.
3204 * Adds the node to the block in current_ir_block.
3206 * @param *db A pointer for debug information.
3207 * @param *op1 The first operand.
3208 * @param *op2 The second operand.
3209 * @param *mode The mode of the operands and the result.
3211 ir_node *new_d_And (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3213 /** Constructor for a Or node.
3215 * Adds the node to the block in current_ir_block.
3217 * @param *db A pointer for debug information.
3218 * @param *op1 The first operand.
3219 * @param *op2 The second operand.
3220 * @param *mode The mode of the operands and the result.
3222 ir_node *new_d_Or (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3224 /** Constructor for a Eor node.
3226 * Adds the node to the block in current_ir_block.
3228 * @param *db A pointer for debug information.
3229 * @param *op1 The first operand.
3230 * @param *op2 The second operand.
3231 * @param *mode The mode of the operands and the results.
3233 ir_node *new_d_Eor (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3235 /** Constructor for a Not node.
3237 * Adds the node to the block in current_ir_block.
3239 * @param *db A pointer for debug information.
3240 * @param *op The operand.
3241 * @param *mode The mode of the operand and the result.
3243 ir_node *new_d_Not (dbg_info *db, ir_node *op, ir_mode *mode);
3245 /** Constructor for a Shl node.
3247 * Adds the node to the block in current_ir_block.
3249 * @param *db A pointer for debug information.
3250 * @param *op The operand.
3251 * @param *k The number of bits to shift the operand .
3252 * @param *mode The mode of the operand and the result.
3254 ir_node *new_d_Shl (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3256 /** Constructor for a Shr node.
3258 * Adds the node to the block in current_ir_block.
3260 * @param *db A pointer for debug information.
3261 * @param *op The operand.
3262 * @param *k The number of bits to shift the operand .
3263 * @param *mode The mode of the operand and the result.
3265 ir_node *new_d_Shr (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3267 /** Constructor for a Shrs node.
3269 * Adds the node to the block in current_ir_block.
3271 * @param *db A pointer for debug information.
3272 * @param *op The operand.
3273 * @param *k The number of bits to shift the operand .
3274 * @param *mode The mode of the operand and the result.
3276 ir_node *new_d_Shrs (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3278 /** Constructor for a Rotl node.
3280 * Adds the node to the block in current_ir_block.
3282 * @param *db A pointer for debug information.
3283 * @param *op The operand.
3284 * @param *k The number of bits to rotate the operand.
3285 * @param *mode The mode of the operand.
3287 ir_node *new_d_Rotl (dbg_info *db, ir_node *op, ir_node *k, ir_mode *mode);
3289 /** Constructor for a Cmp node.
3291 * Adds the node to the block in current_ir_block.
3293 * @param *db A pointer for debug information.
3294 * @param *op1 The first operand.
3295 * @param *op2 The second operand.
3297 ir_node *new_d_Cmp (dbg_info *db, ir_node *op1, ir_node *op2);
3299 /** Constructor for a Conv node.
3301 * Adds the node to the block in current_ir_block.
3303 * @param *db A pointer for debug information.
3304 * @param *op The operand.
3305 * @param *mode The mode of this the operand muss be converted .
3307 ir_node *new_d_Conv (dbg_info *db, ir_node *op, ir_mode *mode);
3309 /** Constructor for a strict Conv node.
3311 * Adds the node to the block in current_ir_block.
3313 * @param *db A pointer for debug information.
3314 * @param *op The operand.
3315 * @param *mode The mode of this the operand muss be converted .
3317 ir_node *new_d_strictConv (dbg_info *db, ir_node *op, ir_mode *mode);
3319 /** Constructor for a Cast node.
3321 * High level type cast
3322 * Adds the node to the block in current_ir_block.
3324 * @param *db A pointer for debug information.
3325 * @param *op The operand.
3326 * @param *to_tp The type of this the operand muss be casted .
3328 ir_node *new_d_Cast (dbg_info *db, ir_node *op, ir_type *to_tp);
3330 /** Constructor for a Carry node.
3332 * Adds the node to the block in current_ir_block.
3334 * @param *db A pointer for debug information.
3335 * @param *op1 The first operand.
3336 * @param *op2 The second operand.
3337 * @param *mode The mode of the operands and the result.
3339 ir_node *new_d_Carry (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3341 /** Constructor for a Borrow node.
3343 * Adds the node to the block in current_ir_block.
3345 * @param *db A pointer for debug information.
3346 * @param *op1 The first operand.
3347 * @param *op2 The second operand.
3348 * @param *mode The mode of the operands and the result.
3350 ir_node *new_d_Borrow (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3352 /** Constructor for a Phi node.
3354 * Adds the node to the block in current_ir_block.
3356 * @param *db A pointer for debug information.
3357 * @param arity The number of predecessors
3358 * @param *in Array with predecessors
3359 * @param *mode The mode of it's inputs and output.
3361 ir_node *new_d_Phi (dbg_info *db, int arity, ir_node *in[], ir_mode *mode);
3363 /** Constructor for a Load node.
3365 * Adds the node to the block in current_ir_block.
3367 * @param *db A pointer for debug information.
3368 * @param *store The current memory
3369 * @param *addr A pointer to the variable to be read in this memory.
3370 * @param *mode The mode of the value to be loaded.
3372 ir_node *new_d_Load (dbg_info *db, ir_node *store, ir_node *addr, ir_mode *mode);
3374 /** Constructor for a Store node.
3376 * Adds the node to the block in current_ir_block.
3378 * @param *db A pointer for debug information.
3379 * @param *store The current memory
3380 * @param *addr A pointer to the variable to be read in this memory.
3381 * @param *val The value to write to this variable.
3383 ir_node *new_d_Store (dbg_info *db, ir_node *store, ir_node *addr, ir_node *val);
3385 /** Constructor for a Alloc node.
3387 * The Alloc node extends the memory by space for an entity of type alloc_type.
3388 * Adds the node to the block in current_ir_block.
3390 * @param *db A pointer for debug information.
3391 * @param *store The memory which shall contain the new variable.
3392 * @param *size The number of bytes to allocate.
3393 * @param *alloc_type The type of the allocated variable.
3394 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
3396 ir_node *new_d_Alloc (dbg_info *db, ir_node *store, ir_node *size, ir_type *alloc_type,
3397 ir_where_alloc where);
3399 /** Constructor for a Free node.
3401 * Frees the memory occupied by the entity pointed to by the pointer
3402 * arg. Type indicates the type of the entity the argument points to.
3403 * Adds the node to the block in current_ir_block.
3405 * @param *db A pointer for debug information.
3406 * @param *store The memory which shall contain the new variable.
3407 * @param *ptr The pointer to the object to free.
3408 * @param *size The number of objects of type free_type to free in a sequence.
3409 * @param *free_type The type of the freed variable.
3410 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
3412 ir_node *new_d_Free (dbg_info *db, ir_node *store, ir_node *ptr, ir_node *size,
3413 ir_type *free_type, ir_where_alloc where);
3415 /** Constructor for a Sync node.
3417 * Merges several memory values. The node assumes that a variable
3418 * either occurs only in one of the memories, or it contains the same
3419 * value in all memories where it occurs.
3420 * Adds the node to the block in current_ir_block.
3422 * @param *db A pointer for debug information.
3423 * @param arity The number of memories to synchronize.
3424 * @param **in An array of pointers to nodes that produce an output of type
3425 * memory. The constructor copies this array.
3427 ir_node *new_d_Sync (dbg_info *db, int arity, ir_node *in[]);
3429 /** Constructor for a Proj node.
3431 * Projects a single value out of a tuple. The parameter proj gives the
3432 * position of the value within the tuple.
3433 * Adds the node to the block in current_ir_block.
3435 * @param *db A pointer for deubug information.
3436 * @param arg A node producing a tuple.
3437 * @param *mode The mode of the value to project.
3438 * @param proj The position of the value in the tuple.
3440 ir_node *new_d_Proj (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3442 /** Constructor for a defaultProj node.
3444 * Represents the default control flow of a Switch-Cond node.
3445 * Adds the node to the block in current_ir_block.
3447 * @param *db A pointer for debug information.
3448 * @param arg A node producing a tuple.
3449 * @param max_proj The end position of the value in the tuple.
3451 ir_node *new_d_defaultProj (dbg_info *db, ir_node *arg, long max_proj);
3453 /** Constructor for a Tuple node.
3455 * This is an auxiliary node to replace a node that returns a tuple
3456 * without changing the corresponding Proj nodes.
3457 * Adds the node to the block in current_ir_block.
3459 * @param *db A pointer for debug information.
3460 * @param arity The number of tuple elements.
3461 * @param **in An array containing pointers to the nodes producing the tuple elements.
3463 ir_node *new_d_Tuple (dbg_info *db, int arity, ir_node *in[]);
3465 /** Constructor for a Id node.
3467 * This is an auxiliary node to replace a node that returns a single
3468 * value. Adds the node to the block in current_ir_block.
3470 * @param *db A pointer for debug information.
3471 * @param *val The operand to Id.
3472 * @param *mode The mode of *val.
3474 ir_node *new_d_Id (dbg_info *db, ir_node *val, ir_mode *mode);
3476 /** Constructor for a Confirm node.
3478 * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3479 * Specifies constraints for a value. To support dataflow analyses.
3481 * Example: If the value never exceeds '100' this is expressed by placing a
3482 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
3484 * @param *db A pointer for debug information.
3485 * @param *val The value we express a constraint for
3486 * @param *bound The value to compare against. Must be a firm node, typically a constant.
3487 * @param cmp The compare operation.
3489 ir_node *new_d_Confirm (dbg_info *db, ir_node *val, ir_node *bound, pn_Cmp cmp);
3491 /** Constructor for an Unknown node.
3493 * Represents an arbitrary value. Places the node in
3496 * @param *m The mode of the unknown value.
3498 ir_node *new_d_Unknown(ir_mode *m);
3500 /** Constructor for a CallBegin node.
3502 * CallBegin represents control flow depending of the pointer value
3503 * representing the called method to the called methods. The
3504 * constructor copies the method pointer input from the passed Call
3505 * node.Adds the node to the block in current_ir_block.
3507 * @param *db A pointer for debug information.
3508 * @param *callee The call node visible in the intra procedural view.
3510 ir_node *new_d_CallBegin(dbg_info *db, ir_node *callee);
3512 /** Constructor for an EndReg node.
3514 *Adds the node to the block in current_ir_block.
3516 * @param *db A pointer for debug information.
3518 ir_node *new_d_EndReg (dbg_info *db);
3520 /** Constructor for an EndExcept node.
3522 * Used to represent regular procedure end in interprocedual view.
3523 * Adds the node to the block in current_ir_block.
3525 * @param *db A pointer for debug information.
3527 ir_node *new_d_EndExcept(dbg_info *db);
3529 /** Constructor for a Break node.
3531 * Used to represent exceptional procedure end in interprocedural view.
3532 * Adds the node to the block in current_ir_block.
3534 * Break represents control flow to a single control successor just as Jmp.
3535 * The blocks separated by a break may not be concatenated by an optimization.
3536 * It is used for the interprocedural representation where blocks are parted
3537 * behind Call nodes to represent the control flow to called procedures.
3539 * @param *db A pointer for debug information.
3541 ir_node *new_d_Break (dbg_info *db);
3543 /** Constructor for a Filter node.
3545 * Constructor for a Filter node. Adds the node to the block in
3546 * current_ir_block. Filter is a node with two views used to
3547 * construct the interprocedural view. In intraprocedural view its
3548 * semantics are identical to the Proj node. In interprocedural view
3549 * the Filter performs the Phi operation on method parameters or
3550 * results. Other than a Phi a Filter node may not be removed if it
3551 * has only a single input.
3553 * The constructor builds the Filter in intraprocedural view.
3555 * @param *db A pointer for debug information.
3556 * @param *arg The tuple value to project from.
3557 * @param *mode The mode of the projected value.
3558 * @param proj The position in the tuple to project from.
3560 ir_node *new_d_Filter (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3562 /** Constructor for a Mux node.
3564 * @param *db A pointer for debug information.
3565 * @param *sel The ir_node that calculates the boolean select.
3566 * @param *ir_true The ir_node that calculates the true result.
3567 * @param *ir_false The ir_node that calculates the false result.
3568 * @param *mode The mode of the node (and it_true and ir_false).
3570 ir_node *new_d_Mux (dbg_info *db, ir_node *sel,
3571 ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
3573 /** Constructor for a CopyB node.
3575 * @param *db A pointer for debug information.
3576 * @param *store The current memory
3577 * @param *dst The ir_node that represents the destination address.
3578 * @param *src The ir_node that represents the source address.
3579 * @param *data_type The type of the copied data
3581 ir_node *new_d_CopyB(dbg_info *db, ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
3583 /** Constructor for a InstOf node.
3585 * A High-Level Type check.
3587 * @param *db A pointer for debug information.
3588 * @param *store The memory in which the object the entity should be selected
3589 * from is allocated.
3590 * @param *objptr A pointer to a object of a class type.
3591 * @param *type The type of which objptr must be.
3593 ir_node *new_d_InstOf (dbg_info *db, ir_node *store, ir_node *objptr, ir_type *type);
3595 /** Constructor for a Raise node.
3597 * A High-Level Exception throw.
3599 * @param *db A pointer for debug information.
3600 * @param *store The current memory.
3601 * @param *obj A pointer to the Except variable.
3603 ir_node *new_d_Raise (dbg_info *db, ir_node *store, ir_node *obj);
3605 /** Constructor for a Bound node.
3607 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
3609 * @param *db A pointer for debug information.
3610 * @param *store The current memory
3611 * @param *idx The ir_node that represents an index.
3612 * @param *lower The ir_node that represents the lower bound for the index.
3613 * @param *upper The ir_node that represents the upper bound for the index.
3615 ir_node *new_d_Bound(dbg_info *db, ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
3617 /** Constructor for a Pin node.
3619 * @param *db A pointer for debug information.
3620 * @param *node The node which value should be pinned.
3622 ir_node *new_d_Pin(dbg_info *db, ir_node *node);
3624 /** Constructor for an ASM pseudo node.
3626 * @param *db A pointer for debug information.
3627 * @param arity The number of data inputs to the node.
3628 * @param *in The array of length arity of data inputs.
3629 * @param *inputs The array of length arity of input constraints.
3630 * @param n_outs The number of data outputs to the node.
3631 * @param *outputs The array of length n_outs of output constraints.
3632 * @param n_clobber The number of clobbered registers.
3633 * @param *clobber The array of length n_clobber of clobbered registers.
3634 * @param *asm_text The assembler text.
3636 ir_node *new_d_ASM(dbg_info *db, int arity, ir_node *in[], ir_asm_constraint *inputs,
3637 int n_outs, ir_asm_constraint *outputs,
3638 int n_clobber, ident *clobber[], ident *asm_text);
3640 /*-----------------------------------------------------------------------*/
3641 /* The block oriented interface without debug support */
3642 /*-----------------------------------------------------------------------*/
3644 /* Needed from the interface with debug support:
3645 void set_cur_block (ir_node *target); */
3647 /** Constructor for a Block node.
3649 * Constructor for a Block node. Adds the block to the graph in
3650 * current_ir_graph. Constructs a Block with a fixed number of
3651 * predecessors. Does set current_block. Can be used with automatic
3652 * Phi node construction.
3654 * @param arity The number of control predecessors.
3655 * @param in An array of control predecessors. The length of
3656 * the array must be 'arity'.
3658 ir_node *new_Block(int arity, ir_node *in[]);
3660 /** Constructor for a Start node.
3662 * Adds the node to the block in current_ir_block.
3665 ir_node *new_Start (void);
3667 /** Constructor for an End node.
3669 * Adds the node to the block in current_ir_block.
3671 ir_node *new_End (void);
3673 /** Constructor for an EndReg node.
3675 * Used to represent regular procedure end in interprocedual view.
3676 * Adds the node to the block in current_ir_block.
3678 ir_node *new_EndReg (void);
3680 /** Constructor for an EndExpcept node.
3682 * Used to represent exceptional procedure end in interprocedural view.
3683 * Adds the node to the block in current_ir_block.
3685 ir_node *new_EndExcept(void);
3687 /** Constructor for a Jump node.
3689 * Adds the node to the block in current_ir_block.
3691 * Jmp represents control flow to a single control successor.
3693 ir_node *new_Jmp (void);
3695 /** Constructor for an IJmp node.
3697 * IJmp represents control flow to a single control successor not
3698 * statically known i.e. an indirect Jmp.
3700 * @param *tgt The IR node representing the target address.
3702 ir_node *new_IJmp (ir_node *tgt);
3704 /** Constructor for a Break node.
3705 * Break represents control flow to a single control successor just as Jmp.
3706 * The blocks separated by a break may not be concatenated by an optimization.
3707 * It is used for the interprocedural representation where blocks are parted
3708 * behind Call nodes to represent the control flow to called procedures.
3709 * Adds the node to the block in current_ir_block.
3711 ir_node *new_Break (void);
3713 /** Constructor for a Cond node.
3715 * If c is mode_b represents a conditional branch (if/else). If c is
3716 * mode_Is/mode_Iu (?) represents a switch. (Allocates dense Cond
3717 * node, default Proj is 0.). Adds the node to the block in current_ir_block.
3719 * This is not consistent: Input to Cond is Is, Proj has as proj number
3723 * @param *c The conditions parameter.Can be of mode b or I_u.
3725 ir_node *new_Cond (ir_node *c);
3727 /** Constructor for a Return node.
3729 * Returns the memory and zero or more return values. Only node that
3730 * can end regular control flow. Adds the node to the block in current_ir_block.
3732 * @param *store The state of memory.
3733 * @param arity Number of array indices.
3734 * @param *in Array with index inputs to the node.
3736 ir_node *new_Return (ir_node *store, int arity, ir_node *in[]);
3738 /** Constructor for a Const node.
3740 * Constructor for a Const node. The constant represents a target
3741 * value. Sets the type information to type_unknown. (No more
3742 * supported: If tv is entity derives a somehow useful type.)
3743 * Adds the node to the block in current_ir_block.
3744 * Derives mode from passed tarval.
3746 * @param *con Points to an entry in the constant table. This pointer is
3747 * added to the attributes of the node.
3749 ir_node *new_Const (tarval *con);
3752 * Make a const from a long.
3753 * This is just convenience for the usual
3755 * new_Const(mode, tarval_from_long(mode, ...))
3758 * @param mode The mode for the const.
3759 * @param value The value of the constant.
3760 * @return A new const node.
3762 ir_node *new_Const_long(ir_mode *mode, long value);
3764 /** Constructor for a Const node.
3766 * Derives mode from passed tarval. */
3767 ir_node *new_Const_type(tarval *con, ir_type *tp);
3769 /** Constructor for a SymConst node.
3771 * Adds the node to the block in current_ir_block.
3772 * This is the constructor for a symbolic constant.
3773 * There are four kinds of symbolic constants:
3774 * -# type_tag The symbolic constant represents a type tag. The type the
3775 * tag stands for is given explicitly.
3776 * -# size The symbolic constant represents the size of a type. The
3777 * type of which the constant represents the size is given
3779 * -# align The symbolic constant represents the alignment of a type. The
3780 * type of which the constant represents the size is given
3782 * -# addr_name The symbolic constant represents the address of an entity
3783 * (variable or method). The variable is indicated by a name
3784 * that is valid for linking.
3785 * -# addr_ent The symbolic constant represents the address of an entity
3786 * (variable or method). The variable is given explicitly by
3789 * Inputs to the node:
3790 * No inputs except the block it belongs to.
3791 * Outputs of the node.
3792 * An unsigned integer (I_u) or a pointer (P).
3794 * @param mode The mode for the SymConst.
3795 * @param value A type or a ident depending on the SymConst kind.
3796 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3797 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
3798 * @param tp The source type of the constant.
3800 ir_node *new_SymConst_type(ir_mode *mode, union symconst_symbol value, symconst_kind kind, ir_type *tp);
3802 /** Constructor for a SymConst node.
3804 * Adds the node to the block in current_ir_block.
3805 * This is the constructor for a symbolic constant.
3806 * There are four kinds of symbolic constants:
3807 * -# type_tag The symbolic constant represents a type tag. The type the
3808 * tag stands for is given explicitly.
3809 * -# size The symbolic constant represents the size of a type. The
3810 * type of which the constant represents the size is given
3812 * -# align The symbolic constant represents the alignment of a type. The
3813 * type of which the constant represents the size is given
3815 * -# addr_name The symbolic constant represents the address of an entity
3816 * (variable or method). The variable is indicated by a name
3817 * that is valid for linking.
3818 * -# addr_ent The symbolic constant represents the address of an entity
3819 * (variable or method). The variable is given explicitly by
3822 * Inputs to the node:
3823 * No inputs except the block it belongs to.
3824 * Outputs of the node.
3825 * An unsigned integer (I_u) or a pointer (P).
3827 * @param mode The mode for the SymConst.
3828 * @param value A type or a ident depending on the SymConst kind.
3829 * @param kind The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3830 * symconst_type_align, symconst_addr_name or symconst_addr_ent.
3832 ir_node *new_SymConst(ir_mode *mode, union symconst_symbol value, symconst_kind kind);
3834 /** Constructor for a simpelSel node.
3836 * This is a shortcut for the new_Sel() constructor. To be used for
3837 * Sel nodes that do not select from an array, i.e., have no index
3838 * inputs. It adds the two parameters 0, NULL.
3840 * @param *store The memory in which the object the entity should be selected from is allocated.
3841 * @param *objptr The object from that the Sel operation selects a single attribute out.
3842 * @param *ent The entity to select.
3844 ir_node *new_simpleSel(ir_node *store, ir_node *objptr, ir_entity *ent);
3846 /** Constructor for a Sel node.
3848 * The select node selects an entity (field or method) from an entity
3849 * with a compound type. It explicitly specifies the entity selected.
3850 * Dynamically the node may select entities that overwrite the given
3851 * entity. If the selected entity is an array element entity the Sel
3852 * node takes the required array indices as inputs.
3853 * Adds the node to the block in current_ir_block.
3855 * @param *store The memory in which the object the entity should be selected
3856 * from is allocated.
3857 * @param *objptr A pointer to a compound entity the Sel operation selects a
3858 * single attribute from.
3859 * @param arity The number of array indices needed to select an array element entity.
3860 * @param *in[] If the compound entity is an array the indices of the selected
3861 * element entity. The constructor copies this array.
3862 * @param *ent The entity to select.
3864 ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3867 /** Constructor for a Call node.
3869 * Adds the node to the block in current_ir_block.
3870 * Represents all kinds of method and function calls.
3872 * @param *store The actual store.
3873 * @param *callee A pointer to the called procedure.
3874 * @param arity The number of procedure parameters.
3875 * @param *in[] An array with the pointers to the parameters. The constructor copies this array.
3876 * @param *tp Type information of the procedure called.
3878 ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node *in[],
3881 /** Constructor for a CallBegin node.
3883 * CallBegin represents control flow depending of the pointer value
3884 * representing the called method to the called methods. The
3885 * constructor copies the method pointer input from the passed Call
3886 * node. Adds the node to the block in current_ir_block.
3888 * @param *callee A pointer to the called procedure.
3890 ir_node *new_CallBegin(ir_node *callee);
3892 /** Constructor for a Add node.
3894 * Adds the node to the block in current_ir_block.
3896 * @param *op1 The first operand.
3897 * @param *op2 The second operand.
3898 * @param *mode The mode of the operands and the result.
3900 ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
3902 /** Constructor for a Sub node.
3904 * Adds the node to the block in current_ir_block.
3906 * @param *op1 The first operand.
3907 * @param *op2 The second operand.
3908 * @param *mode The mode of the operands and the result.
3910 ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
3912 /** Constructor for a Minus node.
3914 * Adds the node to the block in current_ir_block.
3916 * @param *op The operand .
3917 * @param *mode The mode of the operand and the result.
3919 ir_node *new_Minus (ir_node *op, ir_mode *mode);
3922 * Constructor for a Mul node. Adds the node to the block in current_ir_block.
3924 * @param *op1 The first operand.
3925 * @param *op2 The second operand.
3926 * @param *mode The mode of the operands and the result.
3928 ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
3931 * Constructor for a Mulh node. Adds the node to the block in current_ir_block.
3933 * @param *op1 The first operand.
3934 * @param *op2 The second operand.
3935 * @param *mode The mode of the operands and the result.
3937 ir_node *new_Mulh (ir_node *op1, ir_node *op2, ir_mode *mode);
3939 /** Constructor for a Quot node.
3941 * Adds the node to the block in current_ir_block.
3943 * @param *memop The store needed to model exceptions
3944 * @param *op1 The first operand.
3945 * @param *op2 The second operand.
3946 * @param *mode The mode of the result.
3947 * @param state The pinned state.
3949 ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3951 /** Constructor for a DivMod node.
3953 * Adds the node to the block in current_ir_block.
3955 * @param *memop The store needed to model exceptions
3956 * @param *op1 The first operand.
3957 * @param *op2 The second operand.
3958 * @param *mode The mode of the results.
3959 * @param state The pinned state.
3961 ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3963 /** Constructor for a Div node.
3965 * Adds the node to the block in current_ir_block.
3967 * @param *memop The store needed to model exceptions
3968 * @param *op1 The first operand.
3969 * @param *op2 The second operand.
3970 * @param *mode The mode of the result.
3971 * @param state The pinned state.
3973 ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3975 /** Constructor for a remainderless Div node.
3977 * Adds the node to the block in current_ir_block.
3979 * @param *memop The store needed to model exceptions
3980 * @param *op1 The first operand.
3981 * @param *op2 The second operand.
3982 * @param *mode The mode of the result.
3983 * @param state The pinned state.
3985 ir_node *new_DivRL (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3987 /** Constructor for a Mod node.
3989 * Adds the node to the block in current_ir_block.
3991 * @param *memop The store needed to model exceptions
3992 * @param *op1 The first operand.
3993 * @param *op2 The second operand.
3994 * @param *mode The mode of the result.
3995 * @param state The pinned state.
3997 ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3999 /** Constructor for a Abs node.
4001 * Adds the node to the block in current_ir_block.
4003 * @param *op The operand
4004 * @param *mode The mode of the operands and the result.
4006 ir_node *new_Abs (ir_node *op, ir_mode *mode);
4008 /** Constructor for a And node.
4010 * Adds the node to the block in current_ir_block.
4012 * @param *op1 The first operand.
4013 * @param *op2 The second operand.
4014 * @param *mode The mode of the operands and the result.
4016 ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
4019 * Constructor for a Or node. Adds the node to the block in current_ir_block.
4021 * @param *op1 The first operand.
4022 * @param *op2 The second operand.
4023 * @param *mode The mode of the operands and the result.
4025 ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
4028 * Constructor for a Eor node. Adds the node to the block in current_ir_block.
4030 * @param *op1 The first operand.
4031 * @param *op2 The second operand.
4032 * @param *mode The mode of the operands and the results.
4034 ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
4036 /** Constructor for a Not node.
4038 * Adds the node to the block in current_ir_block.
4040 * @param *op The operand.
4041 * @param *mode The mode of the operand and the result.
4043 ir_node *new_Not (ir_node *op, ir_mode *mode);
4045 /** Constructor for a Shl node.
4047 * Adds the node to the block in current_ir_block.
4049 * @param *op The operand.
4050 * @param *k The number of bits to shift the operand .
4051 * @param *mode The mode of the operand and the result.
4053 ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
4056 * Constructor for a Shr node. Adds the node to the block in current_ir_block.
4058 * @param *op The operand.
4059 * @param *k The number of bits to shift the operand .
4060 * @param *mode The mode of the operand and the result.
4062 ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
4064 /** Constructor for a Shrs node.
4066 * Adds the node to the block in current_ir_block.
4068 * @param *op The operand.
4069 * @param *k The number of bits to shift the operand .
4070 * @param *mode The mode of the operand and the result.
4072 ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
4074 /** Constructor for a Rotl node.
4076 * Adds the node to the block in current_ir_block.
4078 * @param *op The operand.
4079 * @param *k The number of bits to rotate the operand.
4080 * @param *mode The mode of the operand.
4082 ir_node *new_Rotl (ir_node *op, ir_node *k, ir_mode *mode);
4084 /** Constructor for a Cmp node.
4086 * Adds the node to the block in current_ir_block.
4088 * @param *op1 The first operand.
4089 * @param *op2 The second operand.
4091 ir_node *new_Cmp (ir_node *op1, ir_node *op2);
4093 /** Constructor for a Conv node.
4095 * Adds the node to the block in current_ir_block.
4097 * @param *op The operand.
4098 * @param *mode The mode of this the operand muss be converted.
4100 ir_node *new_Conv (ir_node *op, ir_mode *mode);
4102 /** Constructor for a strict Conv node.
4104 * Adds the node to the block in current_ir_block.
4106 * @param *op The operand.
4107 * @param *mode The mode of this the operand muss be converted.
4109 ir_node *new_strictConv (ir_node *op, ir_mode *mode);
4111 /** Constructor for a Cast node.
4113 * Adds the node to the block in current_ir_block.
4114 * High level type cast
4116 * @param *op The operand.
4117 * @param *to_tp The type of this the operand muss be casted .
4119 ir_node *new_Cast (ir_node *op, ir_type *to_tp);
4121 /** Constructor for a Carry node.
4123 * Adds the node to the block in current_ir_block.
4125 * @param *op1 The first operand.
4126 * @param *op2 The second operand.
4127 * @param *mode The mode of the operands and the result.
4129 ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode);
4131 /** Constructor for a Borrow node.
4133 * Adds the node to the block in current_ir_block.
4135 * @param *op1 The first operand.
4136 * @param *op2 The second operand.
4137 * @param *mode The mode of the operands and the result.
4139 ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode);
4141 /** Constructor for a Phi node.
4143 * Adds the node to the block in current_ir_block.
4145 * @param arity The number of predecessors.
4146 * @param *in Array with predecessors.
4147 * @param *mode The mode of it's inputs and output.
4149 ir_node *new_Phi (int arity, ir_node *in[], ir_mode *mode);
4151 /** Constructor for a Load node.
4153 * @param *store The current memory.
4154 * @param *addr A pointer to the variable to be read in this memory.
4155 * @param *mode The mode of the value to be loaded.
4157 ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode);
4159 /** Constructor for a Store node.
4161 * @param *store The current memory.
4162 * @param *addr A pointer to the variable to be read in this memory.
4163 * @param *val The value to write to this variable.
4165 ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
4167 /** Constructor for a Alloc node.
4169 * The Alloc node extends the memory by space for an entity of type alloc_type.
4170 * Adds the node to the block in current_ir_block.
4172 * @param *store The memory which shall contain the new variable.
4173 * @param *size The number of bytes to allocate.
4174 * @param *alloc_type The type of the allocated variable.
4175 * @param where Where to allocate the variable, either heap_alloc or stack_alloc.
4177 ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
4178 ir_where_alloc where);
4180 /** Constructor for a Free node.
4182 * Frees the memory occupied by the entity pointed to by the pointer
4183 * arg. Type indicates the type of the entity the argument points to.
4184 * Adds the node to the block in current_ir_block.
4186 * @param *store The memory which shall contain the new variable.
4187 * @param *ptr The pointer to the object to free.
4188 * @param *size The number of objects of type free_type to free in a sequence.
4189 * @param *free_type The type of the freed variable.
4190 * @param where Where the variable was allocated, either heap_alloc or stack_alloc.
4192 ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
4193 ir_type *free_type, ir_where_alloc where);
4195 /** Constructor for a Sync node.
4197 * Merges several memory values. The node assumes that a variable
4198 * either occurs only in one of the memories, or it contains the same
4199 * value in all memories where it occurs.
4200 * Adds the node to the block in current_ir_block.
4202 * @param arity The number of memories to synchronize.
4203 * @param **in An array of pointers to nodes that produce an output of type
4204 * memory. The constructor copies this array.
4206 ir_node *new_Sync (int arity, ir_node *in[]);
4208 /** Constructor for a Proj node.
4210 * Projects a single value out of a tuple. The parameter proj gives the
4211 * position of the value within the tuple.
4212 * Adds the node to the block in current_ir_block.
4214 * @param arg A node producing a tuple.
4215 * @param *mode The mode of the value to project.
4216 * @param proj The position of the value in the tuple.
4218 ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
4220 /** Constructor for a Filter node.
4222 * Constructor for a Filter node. Adds the node to the block in current_ir_block.
4223 * Filter is a node with two views used to construct the interprocedural view.
4224 * In intraprocedural view its semantics are identical to the Proj node.
4225 * In interprocedural view the Filter performs the Phi operation on method
4226 * parameters or results. Other than a Phi a Filter node may not be removed
4227 * if it has only a single input.
4229 * The constructor builds the Filter in intraprocedural view.
4231 * @param *arg The tuple value to project from.
4232 * @param *mode The mode of the projected value.
4233 * @param proj The position in the tuple to project from.
4235 ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj);
4237 /** Constructor for a defaultProj node.
4239 * Represents the default control flow of a Switch-Cond node.
4240 * Adds the node to the block in current_ir_block.
4242 * @param arg A node producing a tuple.
4243 * @param max_proj The end position of the value in the tuple.
4245 ir_node *new_defaultProj (ir_node *arg, long max_proj);
4247 /** Constructor for a Tuple node.
4249 * This is an auxiliary node to replace a node that returns a tuple
4250 * without changing the corresponding Proj nodes.
4251 * Adds the node to the block in current_ir_block.
4253 * @param arity The number of tuple elements.
4254 * @param **in An array containing pointers to the nodes producing the tuple elements.
4256 ir_node *new_Tuple (int arity, ir_node *in[]);
4258 /** Constructor for an Id node.
4260 * This is an auxiliary node to replace a node that returns a single
4261 * value. Adds the node to the block in current_ir_block.
4263 * @param *val The operand to Id.
4264 * @param *mode The mode of *val.
4266 ir_node *new_Id (ir_node *val, ir_mode *mode);
4268 /** Constructor for a Bad node.
4270 * Returns the unique Bad node of the graph. The same as
4273 ir_node *new_Bad (void);
4275 /** Constructor for a Confirm node.
4277 * Specifies constraints for a value. To support dataflow analyses.
4278 * Adds the node to the block in current_ir_block.
4280 * Example: If the value never exceeds '100' this is expressed by placing a
4281 * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
4283 * @param *val The value we express a constraint for
4284 * @param *bound The value to compare against. Must be a firm node, typically a constant.
4285 * @param cmp The compare operation.
4287 ir_node *new_Confirm (ir_node *val, ir_node *bound, pn_Cmp cmp);
4289 /** Constructor for an Unknown node.
4291 * Represents an arbitrary value. Places the node in
4294 * @param *m The mode of the unknown value.
4296 ir_node *new_Unknown(ir_mode *m);
4298 /** Constructor for a NoMem node.
4300 * Returns the unique NoMem node of the graph. The same as
4303 ir_node *new_NoMem (void);
4305 /** Constructor for a Mux node.
4307 * Adds the node to the block in current_ir_block.
4309 * @param *sel The ir_node that calculates the boolean select.
4310 * @param *ir_true The ir_node that calculates the true result.
4311 * @param *ir_false The ir_node that calculates the false result.
4312 * @param *mode The mode of the node (and it_true and ir_false).
4314 ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
4316 /** Constructor for a CopyB node.
4318 * Adds the node to the block in current_ir_block.
4320 * @param *store The current memory
4321 * @param *dst The ir_node that represents the destination address.
4322 * @param *src The ir_node that represents the source address.
4323 * @param *data_type The type of the copied data
4325 ir_node *new_CopyB(ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
4327 /** Constructor for a InstOf node.
4329 * A High-Level Type check.
4331 * @param *store The memory in which the object the entity should be selected
4332 * from is allocated.
4333 * @param *objptr A pointer to a object of a class type.
4334 * @param *type The type of which objptr must be.
4336 ir_node *new_InstOf (ir_node *store, ir_node *objptr, ir_type *type);
4338 /**Constructor for a Raise node.
4340 * A High-Level Exception throw.
4342 * @param *store The current memory.
4343 * @param *obj A pointer to the Except variable.
4345 ir_node *new_Raise (ir_node *store, ir_node *obj);
4347 /** Constructor for a Bound node.
4349 * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
4351 * Adds the node to the block in current_ir_block.
4353 * @param *store The current memory
4354 * @param *idx The ir_node that represents an index.
4355 * @param *lower The ir_node that represents the lower bound for the index.
4356 * @param *upper The ir_node that represents the upper bound for the index.
4358 ir_node *new_Bound (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
4360 /** Constructor for a Pin node.
4362 * @param *node The node which value should be pinned.
4364 ir_node *new_Pin (ir_node *node);
4366 /** Constructor for an ASM pseudo node.
4368 * @param arity The number of data inputs to the node.
4369 * @param *in The array of length arity of data inputs.
4370 * @param *inputs The array of length arity of input constraints.
4371 * @param n_outs The number of data outputs to the node.
4372 * @param *outputs The array of length n_outs of output constraints.
4373 * @param n_clobber The number of clobbered registers.
4374 * @param *clobber The array of length n_clobber of clobbered registers.
4375 * @param *asm_text The assembler text.
4377 ir_node *new_ASM(int arity, ir_node *in[], ir_asm_constraint *inputs,
4378 int n_outs, ir_asm_constraint *outputs,
4379 int n_clobber, ident *clobber[], ident *asm_text);
4381 /*---------------------------------------------------------------------*/
4382 /* The comfortable interface. */
4383 /* Supports automatic Phi node construction. */
4384 /* All routines of the block oriented interface except new_Block are */
4386 /*---------------------------------------------------------------------*/
4388 /** Create an immature Block.
4390 * An immature Block has an unknown number of predecessors. Predecessors
4391 * can be added with add_immBlock_pred(). Once all predecessors are
4392 * added the block must be matured.
4394 * Adds the block to the graph in current_ir_graph. Does set
4395 * current_block. Can be used with automatic Phi node construction.
4396 * This constructor can only be used if the graph is in
4399 ir_node *new_d_immBlock(dbg_info *db);
4400 ir_node *new_immBlock(void);
4402 /** Create an immature PartBlock.
4404 * An immature block has only one Block or PartBlock predecessor.
4405 * A PartBlock forms together with one BLock and possibly other
4406 * PartBlocks a MacroBlock.
4408 * Adds the PartBlock 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_immPartBlock(dbg_info *db, ir_node *pred_jmp);
4414 ir_node *new_immPartBlock(ir_node *pred_jmp);
4416 /** Add a control flow edge to an immature block. */
4417 void add_immBlock_pred(ir_node *immblock, ir_node *jmp);
4419 /** Finalize a Block node, when all control flows are known. */
4420 void mature_immBlock(ir_node *block);
4421 #define mature_cur_block() mature_immBlock(get_cur_block());
4424 /** Get the current value of a local variable.
4426 * Use this function to obtain the last definition of the local variable
4427 * associated with pos. Pos may not exceed the value passed as n_loc
4428 * to new_ir_graph. This call automatically inserts Phi nodes.
4430 * @param *db A pointer for debug information.
4431 * @param pos The position/id of the local variable.
4432 * @param *mode The mode of the value to get.
4434 ir_node *get_d_value(dbg_info *db, int pos, ir_mode *mode);
4435 ir_node *get_value(int pos, ir_mode *mode);
4437 /** Remark a new definition of a variable.
4439 * Use this function to remember a new definition of the value
4440 * associated with pos. Pos may not exceed the value passed as n_loc
4441 * to new_ir_graph. This call is needed to automatically inserts Phi
4444 * @param pos The position/id of the local variable.
4445 * @param *value The new value written to the local variable.
4447 void set_value(int pos, ir_node *value);
4449 /** Find the value number for a node in the current block.
4451 * This function searches all values in the current block for
4452 * a given value and returns its value number if it was found, else
4454 * Note that this does not mean that the value does not exists,
4455 * it's just not equal the node (for instance behind a Phi/Confirm ...)
4457 * @param *value The value to find.
4459 int find_value(ir_node *value);
4461 /** Get the current memory state.
4463 * Use this function to obtain the last definition of the memory
4464 * state. This call automatically inserts Phi nodes for the memory
4467 ir_node *get_store(void);
4469 /** Remark a new definition of the memory state.
4471 * Use this function to remember a new definition of the memory state.
4472 * This call is needed to automatically inserts Phi nodes.
4474 * @param *store The new memory state.
4476 void set_store(ir_node *store);
4478 /** keep this node alive even if End is not control-reachable from it
4480 * @param ka The node to keep alive.
4482 void keep_alive(ir_node *ka);
4484 /** Returns the frame type of the current graph */
4485 ir_type *get_cur_frame_type(void);
4488 /* --- initialize and finalize IR construction --- */
4490 /** Puts the graph into state "phase_high" */
4491 #define irg_finalize_cons(irg) set_irg_phase_state(irg, phase_high)
4493 /** Puts the program and all graphs into state phase_high.
4495 * This also remarks, the construction of types is finished,
4496 * e.g., that no more subtypes will be added. */
4497 void irp_finalize_cons(void);
4499 /* --- Initialization --- */
4502 * This function is called, whenever a local variable is used before definition
4504 * @param irg the IR graph on which this happens
4505 * @param mode the mode of the local var
4506 * @param pos position chosen be the frontend for this variable (n_loc)
4508 * @return a firm node of mode @p mode that initializes the var at position pos
4511 * Do not return NULL!
4512 * If this function is not set, FIRM will create a const node with tarval BAD.
4513 * Use set_irg_loc_description()/get_irg_loc_description() to assign additional
4514 * informations to local variables.
4516 typedef ir_node *uninitialized_local_variable_func_t(ir_graph *irg, ir_mode *mode, int pos);