Fixed typos, improved docu
[libfirm] / ir / ir / ircons.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/ir/ircons.h
4  * Purpose:     Various irnode constructors.  Automatic construction
5  *              of SSA representation.
6  * Author:      Martin Trapp, Christian Schaefer
7  * Modified by: Goetz Lindenmaier, Boris Boesler
8  * Created:
9  * CVS-ID:      $Id$
10  * Copyright:   (c) 1998-2003 Universität Karlsruhe
11  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
12  */
13
14 /**
15  @todo
16  Ideas for imrovement:
17  -# Handle construction of exceptions more comfortable:
18     Add new constructors that pass the exception region (or better the
19     Phi for the memories, the ex. region can be found from there) as parameter,
20     constructor then adds all Proj nodes and returns the pointer
21     to the Proj node that selects the result of the arithmetic operation.
22  -# Maybe hide the exception region in a global variable, especially if
23     it is always unambiguous.
24 */
25
26 /**
27  *  @file ircons.h
28  *
29  *  documentation no more supported since 2001
30  *
31  *  ir node construction.
32  *
33  *  @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier
34  *
35  *    This file documents all datatypes and constructors needed to
36  *    build a FIRM representation of a procedure.  The constructors are
37  *    also implemented in this file.
38  *
39  *    The documentation also gives a short manual how to use the library.
40  *
41  *    For extensive documentation of FIRM see UKA Techreport 1999-14.
42  *
43  *
44  *    Three kinds of nodes
45  *    --------------------
46  *
47  *      There are three kinds of nodes known to the ir:  entities,
48  *      types, and ir_nodes
49  *
50  *      + ir_nodes are the actual nodes of the FIRM intermediate representation.
51  *        They represent operations on the data of the program and control flow
52  *        operations.
53  *
54  *      + entity ==> implemented in entity.h
55  *        Refers to a single entity of the compiled program, e.g. a field of a
56  *        class or a method.  If a method or variable can not be assigned to
57  *        a method or class or the like, it is a global object.
58  *
59  *      + types ==> implemented in type.h
60  *        With types type information is represented.  There are several type
61  *       nodes.
62  *
63  *    Implementation of the FIRM operations: ir_node
64  *    ----------------------------------------------
65  *
66  *      Ir_nodes represent operations on the data of the program and control flow
67  *      operations.  Examples of ir_nodes:  Add, Jmp, Cmp
68  *
69  *      FIRM is a dataflow graph.  A dataflow graph is a directed graph,
70  *      so that every node has incoming and outgoing edges.  A node is
71  *      executable if every input at it's incoming edges is available.
72  *      Execution of the dataflow graph is started at the Start node which
73  *      has no incoming edges and ends when the End node executes, even if
74  *      there are still executable or not executed nodes.  (Is this true,
75  *      or must all executable nodes be executed?)  (There are exceptions
76  *      to the dataflow paradigma that all inputs have to be available
77  *      before a node can execute: Phi, Block.  See UKA Techreport
78  *      1999-14.)
79  *
80  *      The implementation of FIRM differs from the view as a dataflow
81  *      graph.  To allow fast traversion of the graph edges are
82  *      implemented as C-pointers.  Inputs to nodes are not ambiguous, the
83  *      results can be used by several other nodes.  Each input can be
84  *      implemented as a single pointer to a predecessor node, outputs
85  *      need to be lists of pointers to successors.  Therefore a node
86  *      contains pointers to it's predecessor so that the implementation is a
87  *      dataflow graph with reversed edges.  It has to be traversed bottom
88  *      up.
89  *
90  *      All nodes of the ir have the same basic structure.  They are
91  *      distinguished by a field containing the opcode.
92  *
93  *      The fields of an ir_node:
94  *
95  *      kind             A firm_kind tag containing k_ir_node.  This is useful for
96  *                       dynamically checking the type of a node.
97  *
98  *      *op              This ir_op gives the opcode as a tag and a string
99  *                       and the number of attributes of an ir_node.  There is
100  *                       one statically allocated struct ir_op for each opcode.
101  *
102  *      *mode            The ir_mode of the operation represented by this firm
103  *                      node.  The mode of the operation is the mode of it's
104  *                       result.  A Firm mode is a datatype as known to the target,
105  *               not a type of the source language.
106  *
107  *      visit            A flag for traversing the ir.
108  *
109  *      **in             An array with pointers to the node's predecessors.
110  *
111  *      *link            A pointer to an ir_node.  With this pointer all Phi nodes
112  *                       are attached to a Block, i.e., a Block points to it's
113  *                       first Phi node, this node points to the second Phi node
114  *                       in the Block and so fourth.  Used in mature_immBlock
115  *                       to find all Phi nodes to be matured.  It's also used to
116  *               annotate a node with a better, optimized version of it.
117  *
118  *      attr             An attr struct containing the attributes of the nodes. The
119  *                       attributes depend on the opcode of the node.  The number
120  *               of these attributes is given in op.
121  *
122  *    The struct ir_op
123  *    ----------------
124  *                       Not yet documented. See irop.h.
125  *
126  *    The struct ir_mode
127  *    ------------------
128  *                       Not yet documented. See irmode.h.
129  *
130  *    GLOBAL VARIABLES -- now also fields of ir_graph.
131  *    ================
132  *
133  *    current_ir_graph   Points to the current ir_graph.  All constructors for
134  *                      nodes add nodes to this graph.
135  *
136  *    ir_visited         An int used as flag to traverse the ir_graph.
137  *
138  *    block_visited      An int used as a flag to traverse block nodes in the
139  *                       graph.
140  *
141  *                       Others not yet documented.
142  *
143  *
144  *
145  *    CONSTRUCTOR FOR IR_GRAPH --> see irgraph.h
146  *    ========================
147  *
148  *
149  *    PROCEDURE TO CONSTRUCT AN IR GRAPH --> see also Firm tutorial
150  *    ==================================
151  *
152  *    This library supplies several interfaces to construct a FIRM graph for
153  *    a program:
154  *    - A "comfortable" interface generating SSA automatically.  Automatically
155  *      computed predecessors of nodes need not be specified in the constructors.
156  *      (new_<Node> constructurs and a set of additional routines.)
157  *    - A less comfortable interface where all predecessors except the block
158  *      an operation belongs to need to be specified.  SSA must be constructed
159  *      by hand.  (new_<Node> constructors and set_cur_block()).  This interface
160  *      is called "block oriented".  It automatically calles the local optimizations
161  *      for each new node.
162  *    - An even less comfortable interface where the block needs to be specified
163  *      explicitly.  This is called the "raw" interface. (new_r_<Node>
164  *      constructors).  These nodes are not optimized.
165  *
166  *    To use the functionality of the comfortable interface correctly the Front
167  *    End needs to follow certain protocols.  This is explained in the following.
168  *    To build a correct IR with the other interfaces study the semantics of
169  *    the firm node (See tech-reprot UKA 1999-14).  For the construction of
170  *    types and entities see the documentation in those modules.
171  *
172  *    First the Frontend needs to decide which variables and values used in
173  *    a procedure can be represented by dataflow edges.  These are variables
174  *    that need not be saved to memory as they cause no side effects visible
175  *    out of the procedure.  Often these are all compiler generated
176  *    variables and simple local variables of the procedure as integers,
177  *    reals and pointers.  The frontend has to count and number these variables.
178  *
179  *    First an ir_graph needs to be constructed with new_ir_graph.  The
180  *    constructor gets the number of local variables.  The graph is hold in the
181  *    global variable irg.
182  *
183  *    Now the construction of the procedure can start.  Several basic blocks can
184  *    be constructed in parallel, but the code within each block needs to
185  *    be constructed (almost) in program order.
186  *
187  *    A global variable holds the current basic block.  All (non block) nodes
188  *    generated are added to this block.  The current block can be set with
189  *    set_cur_block(block).  If several blocks are constructed in parallel block
190  *    switches need to be performed constantly.
191  *
192  *    To generate a Block node (with the comfortable interface) it's predecessor
193  *    control flow nodes need not be known.  In case of cyclic control flow these
194  *    can not be known when the block is constructed.  With add_immBlock_pred(block,
195  *    cfnode) predecessors can be added to the block.  If all predecessors are
196  *    added to the block mature_immBlock(b) needs to be called.  Calling mature_immBlock
197  *    early improves the efficiency of the Phi node construction algorithm.
198  *    But if several  blocks are constructed at once, mature_immBlock must only
199  *    be called after performing all set_values and set_stores in the block!
200  *    (See documentation of new_immBlock constructor.)
201  *
202  *    The constructors of arithmetic nodes require that their predecessors
203  *    are mentioned.  Sometimes these are available in the Frontend as the
204  *    predecessors have just been generated by the frontend.  If they are local
205  *    values the predecessors can be obtained from the library with a call to
206  *    get_value(local_val_nr).  (local_val_nr needs to be administered by
207  *    the Frontend.)  A call to get_value triggers the generation of Phi nodes.
208  *    If an arithmetic operation produces a local value this value needs to be
209  *    passed to the library by set_value(node, local_val_nr).
210  *    In straight line code these two operations just remember and return the
211  *    pointer to nodes producing the value.  If the value passes block boundaries
212  *    Phi nodes can be inserted.
213  *    Similar routines exist to manage the Memory operands: set_store and
214  *    get_store.
215  *
216  *    Several nodes produce more than one result.  An example is the Div node.
217  *    Such nodes return tuples of values.  From these individual values can be
218  *    extracted by proj nodes.
219  *
220  *    The following example illustrates the construction of a simple basic block
221  *    with two predecessors stored in variables cf_pred1 and cf_pred2, containing
222  *    the code
223  *      a = a div a;
224  *    and finally jumping to an other block.  The variable a got the local_val_nr
225  *    42 by the frontend.
226  *
227  *    ir_node *this_block, *cf_pred1, *cf_pred2, *a_val, *mem, *div, *res, *cf_op;
228  *
229  *    this_block = new_immBlock();
230  *    add_immBlock_pred(this_block, cf_pred1);
231  *    add_immBlock_pred(this_block, cf_pred2);
232  *    mature_immBlock(this_block);
233  *    a_val = get_value(42, mode_Iu);
234  *    mem = get_store();
235  *    div = new_Div(mem, a_val, a_val);
236  *    mem = new_Proj(div, mode_M, 0);   * for the numbers for Proj see docu *
237  *    res = new_Proj(div, mode_Iu, 2);
238  *    set_store(mem);
239  *    set_value(res, 42);
240  *    cf_op = new_Jmp();
241  *
242  *    For further information look at the documentation of the nodes and
243  *    constructors and at the paragraph COPING WITH DATA OBJECTS at the
244  *    end of this documentation.
245  *
246  *    The comfortable interface contains the following routines further explained
247  *    below:
248  *
249  *    ir_node *new_immBlock (void);
250  *    ir_node *new_Start    (void);
251  *    ir_node *new_End      (void);
252  *    ir_node *new_Jmp      (void);
253  *    ir_node *new_IJmp     (ir_node *tgt);
254  *    ir_node *new_Cond     (ir_node *c);
255  *    ir_node *new_Return   (ir_node *store, int arity, ir_node **in);
256  *    ir_node *new_Const    (ir_mode *mode, tarval *con);
257  *    ir_node *new_SymConst (symconst_symbol value, symconst_kind kind);
258  *    ir_node *new_simpleSel (ir_node *store, ir_node *objptr, entity *ent);
259  *    ir_node *new_Sel    (ir_node *store, ir_node *objptr, int arity,
260  *                         ir_node **in, entity *ent);
261  *    ir_node *new_Call   (ir_node *store, ir_node *callee, int arity,
262  *                 ir_node **in, type_method *type);
263  *    ir_node *new_Add    (ir_node *op1, ir_node *op2, ir_mode *mode);
264  *    ir_node *new_Sub    (ir_node *op1, ir_node *op2, ir_mode *mode);
265  *    ir_node *new_Minus  (ir_node *op,  ir_mode *mode);
266  *    ir_node *new_Mul    (ir_node *op1, ir_node *op2, ir_mode *mode);
267  *    ir_node *new_Quot   (ir_node *memop, ir_node *op1, ir_node *op2);
268  *    ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
269  *    ir_node *new_Div    (ir_node *memop, ir_node *op1, ir_node *op2);
270  *    ir_node *new_Mod    (ir_node *memop, ir_node *op1, ir_node *op2);
271  *    ir_node *new_Abs    (ir_node *op,                ir_mode *mode);
272  *    ir_node *new_And    (ir_node *op1, ir_node *op2, ir_mode *mode);
273  *    ir_node *new_Or     (ir_node *op1, ir_node *op2, ir_mode *mode);
274  *    ir_node *new_Eor    (ir_node *op1, ir_node *op2, ir_mode *mode);
275  *    ir_node *new_Not    (ir_node *op,                ir_mode *mode);
276  *    ir_node *new_Shl    (ir_node *op,  ir_node *k,   ir_mode *mode);
277  *    ir_node *new_Shr    (ir_node *op,  ir_node *k,   ir_mode *mode);
278  *    ir_node *new_Shrs   (ir_node *op,  ir_node *k,   ir_mode *mode);
279  *    ir_node *new_Rot    (ir_node *op,  ir_node *k,   ir_mode *mode);
280  *    ir_node *new_Cmp    (ir_node *op1, ir_node *op2);
281  *    ir_node *new_Conv   (ir_node *op, ir_mode *mode);
282  *    ir_node *new_Cast   (ir_node *op, ir_type *to_tp);
283  *    ir_node *new_Carry  (ir_node *op1, ir_node *op2, ir_mode *mode);
284  *    ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode);
285  *    ir_node *new_Load   (ir_node *store, ir_node *addr, ir_mode *mode);
286  *    ir_node *new_Store  (ir_node *store, ir_node *addr, ir_node *val);
287  *    ir_node *new_Alloc  (ir_node *store, ir_node *size, ir_type *alloc_type,
288  *                         where_alloc where);
289  *    ir_node *new_Free   (ir_node *store, ir_node *ptr, ir_node *size,
290  *               ir_type *free_type, where_alloc where);
291  *    ir_node *new_Proj   (ir_node *arg, ir_mode *mode, long proj);
292  *    ir_node *new_NoMem  (void);
293  *    ir_node *new_Mux    (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
294  *    ir_node *new_Psi    (int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
295  *    ir_node *new_CopyB  (ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
296  *    ir_node *new_InstOf (ir_node *store, ir_node obj, ir_type *ent);
297  *    ir_node *new_Raise  (ir_node *store, ir_node *obj);
298  *    ir_node *new_Bound  (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
299  *
300  *    void add_immBlock_pred (ir_node *block, ir_node *jmp);
301  *    void mature_immBlock (ir_node *block);
302  *    void set_cur_block (ir_node *target);
303  *    ir_node *get_value (int pos, ir_mode *mode);
304  *    void set_value (int pos, ir_node *value);
305  *    ir_node *get_store (void);
306  *    void set_store (ir_node *store);
307  *    keep_alive (ir_node ka)
308  *
309  *    IR_NODES AND CONSTRUCTORS FOR IR_NODES
310  *    =======================================
311  *
312  *    All ir_nodes are defined by a common data structure.  They are distinguished
313  *    by their opcode and differ in the number of their attributes.
314  *
315  *    The constructor for the block node sets current_block to itself.
316  *    Const nodes are always added to the start block.
317  *    All other constructors add the created node to the current_block.
318  *    swich_block(block) allows to set the current block to block.
319  *
320  *    Watch for my inconsistent use of input and predecessor (dataflow view)
321  *    and `the node points to' (implementation view).
322  *
323  *    The following description of the nodes lists four properties them if these
324  *    are of interest:
325  *     - the parameters to the constructor
326  *     - the inputs of the Firm node
327  *     - the outputs of the Firm node
328  *     - attributes to the node
329  *
330  *    ------------
331  *
332  *    ir_node *new_immBlock (void)
333  *    ----------------------------
334  *
335  *    Creates a new block.  Sets current_block to itself.  When a new block is
336  *    created it cannot be known how many predecessors this block will have in the
337  *    control flow graph. Therefore the list of inputs can not be fixed at
338  *    creation.  Predecessors can be added with add_immBlock_pred (block, control flow
339  *    operation).  With every added predecessor the number of inputs to Phi nodes
340  *    also changes.
341  *
342  *    The block can be completed by mature_immBlock(block) if all predecessors are
343  *    known.  If several blocks are built at once, mature_immBlock can only be called
344  *    after set_value has been called for all values that are life at the end
345  *    of the block.  This is necessary so that Phi nodes created mature_immBlock
346  *    get the right predecessors in case of cyclic dependencies.  If all set_values
347  *    of this block are called after maturing it and before calling get_value
348  *    in some block that is control flow dependent on this block, the construction
349  *    is correct.
350  *
351  *    Example for faulty ir construction:  (draw the graph on a paper and you'll
352  *                                          get it ;-)
353  *
354  *      block_before_loop = new_block();
355  *      set_value(x);
356  *      mature_immBlock(block_before_loop);
357  *      before2header = new_Jmp;
358  *
359  *      loop_header = new_block ();
360  *      header2body - new_Jmp();
361  *
362  *      loop_body = new_block ();
363  *      body2header = new_Jmp();
364  *
365  *      add_immBlock_pred(loop_header, before2header);
366  *      add_immBlock_pred(loop_header, body2header);
367  *      add_immBlock_pred(loop_body, header2body);
368  *
369  *      mature_immBlock(loop_header);
370  *      mature_immBlock(loop_body);
371  *
372  *      get_value(loop_body, x);   //  gets the Phi in loop_header
373  *      set_value(loop_header, x); //  sets the value the above get_value should
374  *                                 //  have returned!!!
375  *
376  *    Mature_immBlock also fixes the number of inputs to the Phi nodes.  Mature_immBlock
377  *    should be called as early as possible, as afterwards the generation of Phi
378  *   nodes is more efficient.
379  *
380  *    Inputs:
381  *      There is an input for each control flow predecessor of the block.
382  *      The input points to an instruction producing an output of type X.
383  *      Possible predecessors:  Start, Jmp, Cond, Raise or Return or any node
384  *      possibly causing an exception.  (Often the real predecessors are Projs.)
385  *    Output:
386  *      Mode BB (R), all nodes belonging to this block should consume this output.
387  *      As they are strict (except Block and Phi node) it is a necessary condition
388  *      that the block node executed before any other node in this block executes.
389  *    Attributes:
390  *      block.matured  Indicates whether the block is mature.
391  *      block.**graph_arr
392  *                      This attribute contains all local values valid in this
393  *                      block. This is needed to build the Phi nodes and removed
394  *                      if the graph is complete.  This field is used by the
395  *              internal construction algorithm and should not be accessed
396  *              from outside.
397  *
398  *
399  *    ir_node *new_Block (int arity, ir_node **in)
400  *    --------------------------------------------
401  *
402  *    Creates a new Block with the given list of predecessors.  This block
403  *    is mature.  As other constructors calls optimization and vrfy for the
404  *    block.  If one of the predecessors is Unknown (as it has to be filled in
405  *    later) optimizations are skipped.  This is necessary to
406  *    construct Blocks in loops.  Leaving Unknown in the Block after finishing
407  *    the construction may have strange effects, especially for interprocedural
408  *    representation and analysis.
409  *
410  *
411  *    CONTROL FLOW OPERATIONS
412  *    -----------------------
413  *
414  *    In each block there must be exactly one of the control flow
415  *    operations Start, End, Jmp, Cond, Return or Raise.  The output of a
416  *    control flow operation points to the block to be executed next.
417  *
418  *    ir_node *new_Start (void)
419  *    -------------------------
420  *
421  *    Creates a start node.  Not actually needed public.  There is only one such
422  *   node in each procedure which is automatically created by new_ir_graph.
423  *
424  *    Inputs:
425  *      No inputs except the block it belogns to.
426  *    Output:
427  *      A tuple of 4 (5, 6) distinct values. These are labeled by the following
428  *      projection numbers (pn_Start):
429  *      * pn_Start_X_initial_exec    mode X, points to the first block to be exe *                                   cuted.
430  *      * pn_Start_M                 mode M, the global store
431  *      * pn_Start_P_frame_base      mode P, a pointer to the base of the proce  *                                   dures stack frame.
432  *      * pn_Start_P_globals         mode P, a pointer to the part of the memory *                                   containing_all_ global things.
433  *      * pn_Start_T_args            mode T, a tuple containing all arguments of *                                   the procedure.
434  *
435  *
436  *    ir_node *new_End (void)
437  *    -----------------------
438  *
439  *    Creates an end node.  Not actually needed public.  There is only one such
440  *   node in each procedure which is automatically created by new_ir_graph.
441  *
442  *    Inputs:
443  *      No inputs except the block it belongs to.
444  *    Output:
445  *      No output.
446  *
447  *    ir_node *new_Jmp (void)
448  *    -----------------------
449  *
450  *    Creates a Jmp node.
451  *
452  *    Inputs:
453  *      The block the node belongs to
454  *    Output:
455  *      Control flow to the next block.
456  *
457  *    ir_node *new_IJmp (ir_node *tgt)
458  *    -----------------------
459  *
460  *    Creates an IJmp node.
461  *
462  *    Inputs:
463  *      The node that represents the target jump address
464  *    Output:
465  *      Control flow to an unknown target, must be pinned by
466  *      the End node.
467  *
468  *    ir_node *new_Cond (ir_node *c)
469  *    ------------------------------
470  *
471  *    Creates a Cond node.  There are two versions of this node.
472  *
473  *    The Boolean Cond:
474  *    Input:
475  *      A value of mode b.
476  *    Output:
477  *      A tuple of two control flows.  The first is taken if the input is
478  *      false, the second if it is true.
479  *
480  *    The Switch Cond:
481  *    Input:
482  *      A value of mode I_u. (i)
483  *    Output:
484  *      A tuple of n control flows.  If the Cond's input is i, control
485  *      flow will procede along output i. If the input is >= n control
486  *      flow proceeds along output n.
487  *
488  *    ir_node *new_Return (ir_node *store, int arity, ir_node **in)
489  *    -------------------------------------------------------------
490  *
491  *    The return node has as inputs the results of the procedure.  It
492  *    passes the control flow to the end_block.
493  *
494  *    Inputs:
495  *      The memory state.
496  *      All results.
497  *    Output
498  *      Control flow to the end block.
499  *
500  *    ---------
501  *
502  *    ir_node *new_Const (ir_mode *mode, tarval *con)
503  *    -----------------------------------------------
504  *
505  *    Creates a constant in the constant table and adds a Const node
506  *    returning this value to the start block.
507  *
508  *    Parameters:
509  *      *mode            The mode of the constant.
510  *      *con             Points to an entry in the constant table.
511  *                       This pointer is added to the attributes of
512  *                       the node (self->attr.con)
513  *    Inputs:
514  *      No inputs except the block it belogns to.
515  *    Output:
516  *      The constant value.
517  *    Attribute:
518  *      attr.con   A tarval* pointer to the proper entry in the constant
519  *                 table.
520  *
521  *    ir_node *new_SymConst (union symconst_symbol value, symconst_addr_ent kind)
522  *    ---------------------------------------------------------------------------
523  *
524  *    There are three kinds of symbolic constants:
525  *     symconst_type_tag  The symbolic constant represents a type tag.
526  *     symconst_size      The symbolic constant represents the size of a class.
527  *     symconst_addr_name Information for the linker, e.g. the name of a global
528  *                variable.
529  *    To represent a pointer to an entity that is represented by an entity
530  *    datastructure don't use
531  *      new_SymConst((type_or_id*)get_entity_ld_ident(ent), symconst_addr_name);.
532  *    Use a real const instead:
533  *      new_SymConst(mode_P_mach, tarval_p_from_entity(ent));
534  *    This makes the Constant independent of name changes of the entity due to
535  *    mangling.
536  *
537  *    Parameters
538  *      kind        The kind of the symbolic constant: type_tag, size or link_info.
539  *      *type_or_id Points to the type the tag stands for or to the type
540  *                  whose size is represented by the constant or to an ident
541  *                  representing the linkage info.
542  *
543  *    Inputs:
544  *      No inputs except the block it belogns to.
545  *    Output:
546  *      An unsigned integer (I_u) or a pointer (P).
547  *
548  *    Attributes:
549  *      attr.i.num       The symconst_addr_ent, i.e. one of
550  *                        -symconst_type_tag
551  *                        -symconst_size
552  *                - symconst_addr_name
553  *        If the attr.i.num is symconst_type_tag or symconst_size, the node contains an attribute
554  *      attr.i.*type,    a pointer to a type_class.  The mode of the node is mode_Is.
555  *        if it is linkage_ptr_info it contains
556  *      attr.i.*ptrinfo,  an ident holding information for the linker.  The mode
557  *        of the node is mode_P_mach.
558  *
559  *    ---------------
560  *
561  *    ir_node *new_simpleSel (ir_node *store, ir_node *frame, entity *sel)
562  *    --------------------------------------------------------------------
563  *
564  *
565  *    Selects an entity from a compound type. This entity can be a field or
566  *    a method.
567  *
568  *    Parameters:
569  *      *store     The memory in which the object the entity should be selected
570  *                 from is allocated.
571  *      *frame     The pointer to the object.
572  *      *sel       The entity to select.
573  *
574  *    Inputs:
575  *      The memory containing the object.
576  *      A pointer to the object.
577  *      An unsigned integer.
578  *    Output:
579  *      A pointer to the selected entity.
580  *    Attributes:
581  *      attr.sel   Pointer to the entity
582  *
583  *
584  *    ir_node *new_Sel (ir_node *store, ir_node *frame, int arity, ir_node **in,
585  *    --------------------------------------------------------------------------
586  *                      entity *sel)
587  *                      ------------
588  *
589  *    Selects a field from an array type.  The entity has as owner the array, as
590  *    type the arrays element type.  The indices to access an array element are
591  *    given also.
592  *
593  *    Parameters:
594  *      *store     The memory in which the object the entity should be selected from
595  *                 is allocated.
596  *      *frame     The pointer to the object.
597  *      *arity     number of array indices.
598  *      *in        array with index inputs to the node.
599  *      *sel       The entity to select.
600  *
601  *    Inputs:
602  *      The memory containing the object.
603  *      A pointer to the object.
604  *      As much unsigned integer as there are array expressions.
605  *    Output:
606  *      A pointer to the selected entity.
607  *    Attributes:
608  *      attr.sel   Pointer to the entity
609  *
610  *    The constructors new_Sel and new_simpleSel generate the same ir nodes.
611  *    simpleSel just sets the arity of the index inputs to zero.
612  *
613  *
614  *    ARITHMETIC OPERATIONS
615  *    ---------------------
616  *
617  *    ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node **in,
618  *    ----------------------------------------------------------------------------
619  *                       type_method *type)
620  *                       ------------------
621  *
622  *    Creates a procedure call.
623  *
624  *    Parameters
625  *      *store           The actual store.
626  *      *callee          A pointer to the called procedure.
627  *      arity            The number of procedure parameters.
628  *      **in             An array with the pointers to the parameters.
629  *                       The constructor copies this array.
630  *      *type            Type information of the procedure called.
631  *
632  *    Inputs:
633  *      The store, the callee and the parameters.
634  *    Output:
635  *      A tuple containing the eventually changed store and the procedure
636  *      results.
637  *    Attributes:
638  *      attr.call        Contains the type information for the procedure.
639  *
640  *
641  *    ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode)
642  *    ------------------------------------------------------------
643  *
644  *    Trivial.
645  *
646  *    ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode)
647  *    ------------------------------------------------------------
648  *
649  *    Trivial.
650  *
651  *    ir_node *new_Minus (ir_node *op, ir_mode *mode)
652  *    -----------------------------------------------
653  *
654  *    Unary Minus operations on integer and floating point values.
655  *
656  *    ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode)
657  *    ------------------------------------------------------------
658  *
659  *    Trivial.
660  *
661  *    ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2)
662  *    --------------------------------------------------------------
663  *
664  *    Quot performs exact division of floating point numbers.  It's mode
665  *    is Tuple, the mode of the result must be annotated to the Proj
666  *    that extracts the result of the arithmetic operations.
667  *
668  *    Inputs:
669  *      The store needed to model exceptions and the two operands.
670  *    Output:
671  *      A tuple contaning a memory and a execution for modeling exceptions
672  *      and the result of the arithmetic operation.
673  *
674  *    ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2)
675  *    ----------------------------------------------------------------
676  *
677  *    Performs Div and Mod on interger values.
678  *
679  *    Output:
680  *      A tuple contaning a memory and a execution for modeling exceptions
681  *      and the two result of the arithmetic operations.
682  *
683  *    ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2)
684  *    -------------------------------------------------------------
685  *
686  *    Trivial.
687  *
688  *    ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2)
689  *    -------------------------------------------------------------
690  *
691  *    Trivial.
692  *
693  *    ir_node *new_Abs (ir_node *op, ir_mode *mode)
694  *    ---------------------------------------------
695  *
696  *    Trivial.
697  *
698  *    ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode)
699  *    ------------------------------------------------------------
700  *
701  *    Trivial.
702  *
703  *    ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode)
704  *    -----------------------------------------------------------
705  *
706  *    Trivial.
707  *
708  *    ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode)
709  *    ------------------------------------------------------------
710  *
711  *    Trivial.
712  *
713  *    ir_node *new_Not (ir_node *op, ir_mode *mode)
714  *    ---------------------------------------------
715  *
716  *    This node constructs a constant where all bits are set to one
717  *    and a Eor of this constant and the operator.  This simulates a
718  *    Not operation.
719  *
720  *    ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode)
721  *    ---------------------------------------------------------
722  *
723  *    Trivial.
724  *
725  *    ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode)
726  *    ---------------------------------------------------------
727  *
728  *    Logic shift right, i.e., zero extended.
729  *
730  *
731  *    ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode)
732  *    ----------------------------------------------------------
733  *
734  *    Arithmetic shift right, i.e., sign extended.
735  *
736  *    ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode)
737  *    ---------------------------------------------------------
738  *
739  *    Rotates the operand to the (right??) by k bits.
740  *
741  *    ir_node *new_Carry (ir_node *op1, ir_node *op2, ir_mode *mode)
742  *    ------------------------------------------------------------
743  *
744  *    Calculates the Carry value for integer addition. Used only
745  *    in lowering code.
746  *
747  *    ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode)
748  *    ------------------------------------------------------------
749  *
750  *    Calculates the Borrow value for integer substraction. Used only
751  *    in lowering code.
752  *
753  *    ir_node *new_Conv (ir_node *op, ir_mode *mode)
754  *    ---------------------------------------------
755  *
756  *    Mode conversion.  For allowed conversions see UKA Tech Report
757  *    1999-14.
758  *
759  *    ir_node *new_Cmp (ir_node *op1, ir_node *op2)
760  *    ---------------------------------------------
761  *
762  *    Input:
763  *      The two values to be compared.
764  *    Output:
765  *      A 16-tuple containing the results of the 16 different comparisons.
766  *      The following is a list giving the comparisons and a projection
767  *      number (pn_Cmp) to use in Proj nodes to extract the proper result.
768  *        pn_Cmp_False false
769  *        pn_Cmp_Eq    equal
770  *        pn_Cmp_Lt    less
771  *        pn_Cmp_Le    less or equal
772  *        pn_Cmp_Gt    greater
773  *        pn_Cmp_Ge    greater of equal
774  *        pn_Cmp_Lg    less or greater
775  *        pn_Cmp_Leg   less, equal or greater = ordered
776  *        pn_Cmp_Uo    unordered
777  *        pn_Cmp_Ue    unordered or equal
778  *        pn_Cmp_Ul    unordered or less
779  *        pn_Cmp_Ule   unordered, less or equal
780  *        pn_Cmp_Ug    unordered or greater
781  *        pn_Cmp_Uge   unordered, greater or equal
782  *        pn_Cmp_Ne    unordered, less or greater = not equal
783  *        pn_Cmp_True  true
784  *
785  *
786  *
787  *    ------------
788  *
789  *    In general, Phi nodes are automaitcally inserted.  In some cases, if
790  *    all predecessors of a block are known, an explicit Phi node constructor
791  *    is needed.  E.g., to construct a FIRM graph for a statement as
792  *      a = (b==c) ? 2 : 5;
793  *
794  *    ir_node *new_Phi (int arity, ir_node **in, ir_mode *mode)
795  *    ---------------------------------------------------------
796  *
797  *    Creates a Phi node. The in's order has to correspond to the order
798  *    of in's of current_block.  This is not checked by the library!
799  *    If one of the predecessors is Unknown (as it has to be filled in
800  *    later) optimizations are skipped.  This is necessary to
801  *    construct Phi nodes in loops.  Leaving Unknown in the Phi after finishing
802  *    the construction may have strange effects, especially for interprocedural
803  *    representation and analysis.
804  *
805  *    Parameter
806  *      arity            number of predecessors
807  *      **in             array with predecessors
808  *      *mode            The mode of it's inputs and output.
809  *    Inputs:
810  *      A Phi node has as many inputs as the block it belongs to.
811  *      Each input points to a definition of the same value on a
812  *      different path in the control flow.
813  *    Output
814  *      The definition valid in this block.
815  *
816  *    ir_node *new_Mux (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode)
817  *    -----------------------------------------------------------------------------
818  *
819  *    Creates a Mux node. This node implements the following semantic:
820  *    If the sel node (which must be of mode_b) evaluates to true, its value is
821  *    ir_true, else ir_false;
822  *
823  *
824  *    ir_node *new_Psi (int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode)
825  *    -----------------------------------------------------------------------------
826  *
827  *    Creates a Psi node. This node implements the following semantic:
828  *    Enter it here!!!
829  *
830  *
831  *    OPERATIONS TO MANAGE MEMORY EXPLICITLY
832  *    --------------------------------------
833  *
834  *    ir_node *new_Load (ir_node *store, ir_node *addr, ir_mode *mode)
835  *    ----------------------------------------------------------------
836  *
837  *    The Load operation reads a value from memory.
838  *
839  *    Parameters:
840  *    *store        The current memory.
841  *    *addr         A pointer to the variable to be read in this memory.
842  *    *mode         The mode of the value to be loaded.
843  *
844  *    Inputs:
845  *      The memory and a pointer to a variable in this memory.
846  *    Output:
847  *      A tuple of the memory, a control flow to be taken in case of
848  *      an exception and the loaded value.
849  *
850  *    ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val)
851  *    ----------------------------------------------------------------
852  *
853  *    The Store operation writes a value to a variable in memory.
854  *
855  *    Inputs:
856  *      The memory, a pointer to a variable in this memory and the value
857  *      to write to this variable.
858  *    Output:
859  *      A tuple of the changed memory and a control flow to be taken in
860  *      case of an exception.
861  *
862  *    ir_node *new_Alloc (ir_node *store, ir_node *size, ir_type *alloc_type,
863  *    -----------------------------------------------------------------------
864  *                        where_alloc where)
865  *                        ------------------
866  *
867  *    The Alloc node allocates a new variable.  It can be specified whether the
868  *    variable should be allocated to the stack or to the heap.
869  *
870  *    Parameters:
871  *      *store       The memory which shall contain the new variable.
872  *      **    *size        The number of bytes to allocate. Old. **
873  *      *size        We decided that the size easily can be derived from the type.
874  *                   This field is for allocating arrays, i.e., it gives the multiple
875  *           of the size of alloc_type to allocate memory for.
876  *      *alloc_type  The type of the allocated variable.
877  *      where        Where to allocate the variable, either heap_alloc or stack_alloc.
878  *
879  *    Inputs:
880  *      A memory and an unsigned integer.
881  *    Output:
882  *      A tuple of the changed memory, a control flow to be taken in
883  *      case of an exception and the pointer to the new variable.
884  *    Attributes:
885  *      a.where          Indicates where the variable is allocated.
886  *      a.*type          A pointer to the class the allocated data object
887  *                       belongs to.
888  *
889  *    ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size, ir_type *free_type,
890  *    -----------------------------------------------------------------------------------
891  *                        where_alloc where)
892  *                        ------------------
893  *
894  *    The Free node frees memory of the given variable.
895  *
896  *    Parameters:
897  *      *store       The memory which shall contain the new variable.
898  *      *ptr         The pointer to the object to free.
899  *      *size        The number of objects of type free_type to free in a sequence.
900  *      *free_type   The type of the freed variable.
901  *      where        Where the variable was allocated, either heap_alloc or stack_alloc.
902  *
903  *    Inputs:
904  *      A memory, a pointer and an unsigned integer.
905  *    Output:
906  *      The changed memory.
907  *    Attributes:
908  *      f.*type          A pointer to the type information of the freed data object.
909  *
910  *    Not Implemented!
911  *
912  *    ir_node *new_Sync (int arity, ir_node **in)
913  *    -------------------------------------------
914  *
915  *    The Sync operation unifies several partial memory blocks.  These blocks
916  *    have to be pairwise disjunct or the values in common locations have to
917  *    be identical.  This operation allows to specify all operations that eventually
918  *    need several partial memory blocks as input with a single entrance by
919  *    unifying the memories with a preceding Sync operation.
920  *
921  *    Parameters
922  *      arity    The number of memories to synchronize.
923  *      **in     An array of pointers to nodes that produce an output of
924  *               type memory.
925  *    Inputs
926  *      Several memories.
927  *    Output
928  *      The unified memory.
929  *
930  *
931  *    SPECIAL OPERATIONS
932  *    ------------------
933  *
934  *    ir_node *new_Bad (void)
935  *    -----------------------
936  *
937  *    Returns the unique Bad node current_ir_graph->bad.
938  *    This node is used to express results of dead code elimination.
939  *
940  *    ir_node *new_NoMem (void)
941  *    -----------------------------------------------------------------------------------
942  *
943  *    Returns the unique NoMem node current_ir_graph->no_mem.
944  *    This node is used as input for operations that need a Memory, but do not
945  *    change it like Div by const != 0, analyzed calls etc.
946  *
947  *    ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj)
948  *    ----------------------------------------------------------
949  *
950  *    Selects one entry of a tuple.  This is a hidden edge with attributes.
951  *
952  *    Parameters
953  *      *arg      A node producing a tuple.
954  *      *mode     The mode of the value to project.
955  *      proj      The position of the value in the tuple.
956  *    Input:
957  *      The tuple.
958  *    Output:
959  *      The value.
960  *
961  *    ir_node *new_Tuple (int arity, ir_node **in)
962  *    --------------------------------------------
963  *
964  *    Builds a Tuple from single values.  This is needed to implement
965  *    optimizations that remove a node that produced a tuple.  The node can be
966  *    replaced by the Tuple operation so that the following Proj nodes have not to
967  *    be changed.  (They are hard to find due to the implementation with pointers
968  *    in only one direction.)  The Tuple node is smaller than any other
969  *    node, so that a node can be changed into a Tuple by just changing it's
970  *    opcode and giving it a new in array.
971  *
972  *    Parameters
973  *      arity    The number of tuple elements.
974  *      **in     An array containing pointers to the nodes producing the
975  *               tuple elements.
976  *
977  *    ir_node *new_Id (ir_node *val, ir_mode *mode)
978  *    ---------------------------------------------
979  *
980  *    The single output of the Id operation is it's input.  Also needed
981  *    for optimizations.
982  *
983  *
984  *    HIGH LEVEL OPERATIONS
985  *    ---------------------
986  *
987  *    ir_node *new_CopyB (ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type)
988  *    -----------------------------------------------------------------------------------
989  *
990  *    Describes a high level block copy of a compound type from address src to
991  *    address dst. Must be lowered to a Call to a runtime memory copy function.
992  *
993  *
994  *    HIGH LEVEL OPERATIONS: Exception Support
995  *    ----------------------------------------
996  *    See TechReport 1999-14, chapter Exceptions.
997  *
998  *    ir_node *new_InstOf(ir_node *store, ir_node *ptr, ir_type *type);
999  *    -----------------------------------------------------------------------------------
1000  *
1001  *    Describes a high level type check. Must be lowered to a Call to a runtime check
1002  *    function.
1003  *
1004  *    ir_node *new_Raise (ir_node *store, ir_node *obj)
1005  *    -------------------------------------------------
1006  *
1007  *    Raises an exception.  Unconditional change of control flow.  Writes
1008  *    an explicit Except variable to memory to pass it to the exception
1009  *    handler.  Must be lowered to a Call to a runtime check
1010  *    function.
1011  *
1012  *    Inputs:
1013  *      The memory state.
1014  *      A pointer to the Except variable.
1015  *    Output:
1016  *      A tuple of control flow and the changed memory state.  The control flow
1017  *      points to the exception handler if it is definied in this procedure,
1018  *      else it points to the end_block.
1019  *
1020  *    ir_node *new_Bound  (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
1021  *    -----------------------------------------------------------------------------------
1022  *
1023  *    Describes a high level bounds check. Must be lowered to a Call to a runtime check
1024  *    function.
1025  *
1026  *
1027  *    COPING WITH DATA OBJECTS
1028  *    ========================
1029  *
1030  *    Two kinds of data objects have to be distinguished for generating
1031  *    FIRM.  First there are local variables other than arrays that are
1032  *    known to be alias free.  Second there are all other data objects.
1033  *    For the first a common SSA representation is built, the second
1034  *    are modeled by saving them to memory.  The memory is treated as
1035  *    a single local variable, the alias problem is hidden in the
1036  *    content of this variable.
1037  *
1038  *    All values known in a Block are listed in the block's attribute,
1039  *    block.**graph_arr which is used to automatically insert Phi nodes.
1040  *    The following two funcions can be used to add a newly computed value
1041  *    to the array, or to get the producer of a value, i.e., the current
1042  *    live value.
1043  *
1044  *    inline void set_value (int pos, ir_node *value)
1045  *    -----------------------------------------------
1046  *
1047  *    Has to be called for every assignment to a local variable.  It
1048  *    adds the value to the array of used values at position pos.  Pos
1049  *    has to be a unique identifier for an entry in the procedure's
1050  *    definition table.  It can be used to access the value again.
1051  *    Requires current_block to be set correctly.
1052  *
1053  *    ir_node *get_value (int pos, ir_mode *mode)
1054  *    -------------------------------------------
1055  *
1056  *    Returns the node defining the value referred to by pos. If the
1057  *    value is not defined in this block a Phi node is generated and
1058  *    all definitions reaching this Phi node are collected.  It can
1059  *    happen that the algorithm allocates an unnecessary Phi node,
1060  *    e.g. if there is only one definition of this value, but this
1061  *    definition reaches the currend block on several different
1062  *    paths.  This Phi node will be eliminated if optimizations are
1063  *    turned on right after it's creation.
1064  *    Requires current_block to be set correctly.
1065  *
1066  *    There are two special routines for the global store:
1067  *
1068  *    void set_store (ir_node *store)
1069  *    -------------------------------
1070  *
1071  *    Adds the store to the array of known values at a reserved
1072  *    position.
1073  *    Requires current_block to be set correctly.
1074  *
1075  *    ir_node *get_store (void)
1076  *    -------------------------
1077  *
1078  *    Returns the node defining the actual store.
1079  *    Requires current_block to be set correctly.
1080  *
1081  *
1082  *    inline void keep_alive (ir_node *ka)
1083  *    ------------------------------------
1084  *
1085  *    Keep this node alive because it is (might be) not in the control
1086  *    flow from Start to End.  Adds the node to the list in the end
1087  *   node.
1088  *
1089  */
1090 #ifndef _FIRM_IR_IRCONS_H_
1091 #define _FIRM_IR_IRCONS_H_
1092
1093 #include "firm_common.h"
1094 #include "irnode.h"
1095 #include "irgraph.h"
1096 #include "dbginfo.h"
1097
1098 /*-------------------------------------------------------------------------*/
1099 /* The raw interface                                                       */
1100 /*-------------------------------------------------------------------------*/
1101
1102 /** Constructor for a Block node.
1103  *
1104  * Constructs a mature block with the given predecessors.  Use Unknown
1105  * nodes as predecessors to construct a block if the number of
1106  * predecessors is known, but not the predecessors themselves.  This
1107  * constructor does not set current_block.  It not be used with
1108  * automatic Phi node construction.
1109  *
1110  * @param *db    A Pointer for  debug information.
1111  * @param irg    The ir graph the block belongs to.
1112  * @param arity  The number of control predecessors.
1113  * @param in[]   An array of control predecessors.  The length of
1114  *               the array must be 'arity'.  The constructor copies this array.
1115  */
1116 ir_node *new_rd_Block  (dbg_info *db, ir_graph *irg,  int arity, ir_node *in[]);
1117
1118 /** Constructor for a Start node.
1119  *
1120  * @param *db    A pointer for debug information.
1121  * @param *irg   The ir graph the node belongs to.
1122  * @param *block The ir block the node belongs to.
1123  */
1124 ir_node *new_rd_Start  (dbg_info *db, ir_graph *irg, ir_node *block);
1125
1126 /** Constructor for a End node.
1127  *
1128  * @param *db    A pointer for  debug information.
1129  * @param *irg   The ir graph the node  belongs to.
1130  * @param *block The ir block the node belongs to.
1131  */
1132 ir_node *new_rd_End    (dbg_info *db, ir_graph *irg, ir_node *block);
1133
1134 /** Constructor for a Jmp node.
1135  *
1136  * Jmp represents control flow to a single control successor.
1137  *
1138  * @param *db     A pointer for debug information.
1139  * @param *irg    The ir graph the node belongs to.
1140  * @param *block  The ir block the node belongs to.
1141  */
1142 ir_node *new_rd_Jmp    (dbg_info *db, ir_graph *irg, ir_node *block);
1143
1144 /** Constructor for an IJmp node.
1145  *
1146  * IJmp represents control flow to a single control successor not
1147  * statically known i.e. an indirect Jmp.
1148  *
1149  * @param *db     A pointer for debug information.
1150  * @param *irg    The ir graph the node belongs to.
1151  * @param *block  The ir block the node belongs to.
1152  * @param *tgt    The ir node representing the target address.
1153  */
1154 ir_node *new_rd_IJmp   (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *tgt);
1155
1156 /** Constructor for a Break node.
1157  *
1158  * Break represents control flow to a single control successor just as Jmp.
1159  * The blocks separated by a break may not be concatenated by an optimization.
1160  * It is used for the interprocedural representation where blocks are parted
1161  * behind Call nodes to represent the control flow to called procedures.
1162  *
1163  * @param *db     A pointer for debug information.
1164  * @param *irg    The ir graph the node belong to.
1165  * @param *block  The block the node belong to.
1166  */
1167 ir_node *new_rd_Break  (dbg_info *db, ir_graph *irg, ir_node *block);
1168
1169 /** Constructor for a Cond node.
1170  *
1171  * If c is mode_b represents a conditional branch (if/else). If c is
1172  * mode_Is/mode_Iu (?) represents a switch.  (Allocates dense Cond
1173  * node, default Proj is 0.)
1174  *
1175  * This is not consistent:  Input to Cond is Is, Proj has as proj number
1176  * longs.
1177  *
1178  * @param *db    A pointer for debug information.
1179  * @param *irg   The ir graph the node  belongs to.
1180  * @param *block The ir block the node belongs to.
1181  * @param *c     The conditions parameter. Can be of mode b or I_u.
1182  */
1183 ir_node *new_rd_Cond   (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *c);
1184
1185 /** Constructor for a Return node.
1186  *
1187  * Returns the memory an zero or more return values.  Only node that
1188  * can end regular control flow.
1189  *
1190  * @param *db    A pointer for debug information.
1191  * @param *irg   The ir graph the node  belongs to.
1192  * @param *block The ir block the node belongs to.
1193  * @param *store The state of memory.
1194  * @param arity  Number of return values.
1195  * @param *in    Array of length arity with return values.  The constructor copies this array.
1196  */
1197 ir_node *new_rd_Return (dbg_info *db, ir_graph *irg, ir_node *block,
1198                         ir_node *store, int arity, ir_node *in[]);
1199
1200 /** Constructor for a Const_type node.
1201  *
1202  * The constant represents a target value.  This constructor sets high
1203  * level type information for the constant value.
1204  *
1205  * @param *db    A pointer for debug information.
1206  * @param *irg   The ir graph the node  belongs to.
1207  * @param *block The ir block the node belongs to.
1208  * @param *mode  The mode of the operands and results.
1209  * @param *con   Points to an entry in the constant table.
1210  * @param *tp    The type of the constant.
1211  */
1212 ir_node *new_rd_Const_type (dbg_info *db, ir_graph *irg, ir_node *block,
1213                 ir_mode *mode, tarval *con, ir_type *tp);
1214
1215 /** Constructor for a Const node.
1216  *
1217  * Constructor for a Const node. The constant represents a target
1218  * value.  Sets the type information to type_unknown.  (No more
1219  * supported: If tv is entity derives a somehow useful type.)
1220  *
1221  * @param *db    A pointer for debug information.
1222  * @param *irg   The ir graph the node  belongs to.
1223  * @param *block The ir block the node belongs to.
1224  * @param *mode  The mode of the operands and results.
1225  * @param *con   Points to an entry in the constant table.
1226  */
1227 ir_node *new_rd_Const  (dbg_info *db, ir_graph *irg, ir_node *block,
1228                ir_mode *mode, tarval *con);
1229
1230 /** Constructor for a SymConst_type node.
1231  *
1232  *  This is the constructor for a symbolic constant.
1233  *    There are four kinds of symbolic constants:
1234  *    - type_tag  The symbolic constant represents a type tag.  The type the
1235  *                tag stands for is given explicitly.
1236  *    - size      The symbolic constant represents the size of a type.  The
1237  *                type of which the constant represents the size is given
1238  *                explicitly.
1239  *    - addr_name The symbolic constant represents the address of an entity
1240  *                (variable or method).  The variable is indicated by a name
1241  *                that is valid for linking.
1242  *    - addr_ent   The symbolic constant represents the address of an entity
1243  *                (variable or method).  The variable is given explicitly by
1244  *                a firm entity.
1245  *
1246  *    Inputs to the node:
1247  *      No inputs except the block it belongs to.
1248  *    Outputs of the node.
1249  *      An unsigned integer (I_u) or a pointer (P).
1250  *
1251  *    Mention union in declaration so that the firmjni generator recognizes that
1252  *    it can not cast the argument to an int.
1253  *
1254  * @param *db     A pointer for debug information.
1255  * @param *irg    The ir graph the node  belongs to.
1256  * @param *block  The ir block the node belongs to.
1257  * @param symkind The kind of the symbolic constant: type_tag, size, addr_name or addr_ent.
1258  * @param value   A type, entity or a ident depending on the SymConst kind.
1259  * @param tp      The source type of the constant.
1260  */
1261 ir_node *new_rd_SymConst_type (dbg_info *db, ir_graph *irg, ir_node *block, union symconst_symbol value,
1262                                symconst_kind symkind, ir_type *tp);
1263
1264 /** Constructor for a SymConst node.
1265  *
1266  *  Same as new_rd_SymConst_type, except that it sets the type to type_unknown. */
1267 ir_node *new_rd_SymConst (dbg_info *db, ir_graph *irg, ir_node *block,
1268                           union symconst_symbol value, symconst_kind symkind);
1269
1270 /** Constructor for a SymConst addr_ent node.
1271  *
1272  * Same as new_rd_SymConst_type, except that the constructor is tailored for
1273  * symconst_addr_ent.
1274  * Adds the SymConst to the start block of irg. */
1275 ir_node *new_rd_SymConst_addr_ent (dbg_info *db, ir_graph *irg, entity *symbol, ir_type *tp);
1276
1277 /** Constructor for a SymConst addr_name node.
1278  *
1279  * Same as new_rd_SymConst_type, except that the constructor is tailored for
1280  * symconst_addr_ent.
1281  * Adds the SymConst to the start block of irg. */
1282 ir_node *new_rd_SymConst_addr_name (dbg_info *db, ir_graph *irg, ident *symbol, ir_type *tp);
1283
1284 /** Constructor for a SymConst type_tag node.
1285  *
1286  * Same as new_rd_SymConst_type, except that the constructor is tailored for
1287  * symconst_addr_ent.
1288  * Adds the SymConst to the start block of irg. */
1289 ir_node *new_rd_SymConst_type_tag (dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp);
1290
1291 /** Constructor for a SymConst size node.
1292  *
1293  * Same as new_rd_SymConst_type, except that the constructor is tailored for
1294  * symconst_addr_ent.
1295  * Adds the SymConst to the start block of irg. */
1296 ir_node *new_rd_SymConst_size (dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp);
1297
1298 /** Constructor for a simpleSel node.
1299  *
1300  *  This is a shortcut for the new_rd_Sel() constructor.  To be used for
1301  *  Sel nodes that do not select from an array, i.e., have no index
1302  *  inputs.  It adds the two parameters 0, NULL.
1303  *
1304  * @param   *db        A pointer for debug information.
1305  * @param   *irg       The ir graph the node  belongs to.
1306  * @param   *block     The ir block the node belongs to.
1307  * @param   *store     The memory in which the object the entity should be
1308  *                     selected from is allocated.
1309  * @param   *objptr    The object from that the Sel operation selects a
1310  *                     single attribute out.
1311  * @param   *ent       The entity to select.
1312  */
1313 ir_node *new_rd_simpleSel (dbg_info *db, ir_graph *irg, ir_node *block,
1314                   ir_node *store, ir_node *objptr, entity *ent);
1315
1316 /** Constructor for a Sel node.
1317  *
1318  * The select node selects an entity (field or method) from an entity
1319  * with a compound type.  It explicitly specifies the entity selected.
1320  * Dynamically the node may select entities that overwrite the given
1321  * entity.  If the selected entity is an array element entity the Sel
1322  * node takes the required array indices as inputs.
1323  *
1324  * @param   *db        A pointer for debug information.
1325  * @param   *irg       The ir graph the node  belongs to.
1326  * @param   *block     The ir block the node belongs to.
1327  * @param   *store     The memory in which the object the entity should be selected
1328  *                     from is allocated.
1329  * @param   *objptr    A pointer to a compound entity the Sel operation selects a
1330  *                     single attribute from.
1331  * @param   *n_index   The number of array indices needed to select an array element entity.
1332  * @param   *index[]   If the compound entity is an array the indices of the selected
1333  *                     element entity.  The constructor copies this array.
1334  * @param   *ent       The entity to select.
1335  */
1336 ir_node *new_rd_Sel    (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1337                         ir_node *objptr, int n_index, ir_node *index[], entity *ent);
1338
1339 /** Constructor for a Call node.
1340  *
1341  *  Represents all kinds of method and function calls.
1342  *
1343  * @param   *db     A pointer for debug information.
1344  * @param   *irg    The ir graph the node  belongs to.
1345  * @param   *block  The ir block the node belongs to.
1346  * @param   *store  The current memory state.
1347  * @param   *callee A pointer to the called procedure.
1348  * @param   arity   The number of procedure parameters.
1349  * @param   *in[]   An array with the procedure parameters. The constructor copies this array.
1350  * @param   *tp     Type information of the procedure called.
1351  */
1352 ir_node *new_rd_Call   (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1353                         ir_node *callee, int arity, ir_node *in[], ir_type *tp);
1354
1355 /** Constructor for a Add node.
1356  *
1357  * @param   *db    A pointer for debug information.
1358  * @param   *irg   The ir graph the node  belongs to.
1359  * @param   *block The ir block the node belongs to.
1360  * @param   *op1   The first operand.
1361  * @param   *op2   The second operand.
1362  * @param   *mode  The mode of the operands and the result.
1363  */
1364 ir_node *new_rd_Add    (dbg_info *db, ir_graph *irg, ir_node *block,
1365                         ir_node *op1, ir_node *op2, ir_mode *mode);
1366
1367 /** Constructor for a Sub node.
1368  *
1369  * @param   *db    A pointer for debug information.
1370  * @param   *irg   The ir graph the node  belongs to.
1371  * @param   *block The ir block the node belongs to.
1372  * @param   *op1   The first operand.
1373  * @param   *op2   The second operand.
1374  * @param   *mode  The mode of the operands and the result.
1375  */
1376 ir_node *new_rd_Sub    (dbg_info *db, ir_graph *irg, ir_node *block,
1377                         ir_node *op1, ir_node *op2, ir_mode *mode);
1378
1379 /** Constructor for a Minus node.
1380  *
1381  * @param   *db    A pointer for debug information.
1382  * @param   *irg   The ir graph the node  belongs to.
1383  * @param   *block The ir block the node belongs to.
1384  * @param   *op    The operand .
1385  * @param   *mode  The mode of the operand and the result.
1386  */
1387 ir_node *new_rd_Minus  (dbg_info *db, ir_graph *irg, ir_node *block,
1388                         ir_node *op,  ir_mode *mode);
1389
1390 /** Constructor for a Mul node.
1391  *
1392  * @param   *db    A pointer for debug information.
1393  * @param   *irg   The ir graph the node  belongs to.
1394  * @param   *block The ir block the node belongs to.
1395  * @param   *op1   The first operand.
1396  * @param   *op2   The second operand.
1397  * @param   *mode  The mode of the operands and the result.
1398  */
1399 ir_node *new_rd_Mul    (dbg_info *db, ir_graph *irg, ir_node *block,
1400                ir_node *op1, ir_node *op2, ir_mode *mode);
1401
1402 /** Constructor for a Quot node.
1403  *
1404  * @param   *db    A pointer for debug information.
1405  * @param   *irg   The ir graph the node  belongs to.
1406  * @param   *block The ir block the node belongs to.
1407  * @param   *memop The store needed to model exceptions
1408  * @param   *op1   The first operand.
1409  * @param   *op2   The second operand.
1410  */
1411 ir_node *new_rd_Quot   (dbg_info *db, ir_graph *irg, ir_node *block,
1412                ir_node *memop, ir_node *op1, ir_node *op2);
1413
1414 /** Constructor for a DivMod node.
1415  *
1416  * @param   *db    A pointer for debug information.
1417  * @param   *irg   The ir graph the node  belongs to.
1418  * @param   *block The ir block the node belongs to.
1419  * @param   *memop The store needed to model exceptions
1420  * @param   *op1   The first operand.
1421  * @param   *op2   The second operand.
1422  */
1423 ir_node *new_rd_DivMod (dbg_info *db, ir_graph *irg, ir_node *block,
1424                ir_node *memop, ir_node *op1, ir_node *op2);
1425
1426 /** Constructor for a Div node.
1427  *
1428  * @param   *db    A pointer for debug information.
1429  * @param   *irg   The ir graph the node  belongs to.
1430  * @param   *block The ir block the node belongs to.
1431  * @param   *memop The store needed to model exceptions
1432  * @param   *op1   The first operand.
1433  * @param   *op2   The second operand.
1434  */
1435 ir_node *new_rd_Div    (dbg_info *db, ir_graph *irg, ir_node *block,
1436                ir_node *memop, ir_node *op1, ir_node *op2);
1437
1438 /** Constructor for a Mod node.
1439  *
1440  * @param   *db    A pointer for debug information.
1441  * @param   *irg   The ir graph the node  belongs to.
1442  * @param   *block The ir block the node belongs to.
1443  * @param   *memop The store needed to model exceptions
1444  * @param   *op1   The first operand.
1445  * @param   *op2   The second operand.
1446  */
1447 ir_node *new_rd_Mod    (dbg_info *db, ir_graph *irg, ir_node *block,
1448                         ir_node *memop, ir_node *op1, ir_node *op2);
1449
1450 /** Constructor for a Abs node.
1451  *
1452  * @param   *db    A pointer for debug information.
1453  * @param   *irg   The ir graph the node  belongs to.
1454  * @param   *block The ir block the node belongs to.
1455  * @param   *op    The operand
1456  * @param   *mode  The mode of the operands and the result.
1457  */
1458 ir_node *new_rd_Abs    (dbg_info *db, ir_graph *irg, ir_node *block,
1459                        ir_node *op, ir_mode *mode);
1460
1461 /** Constructor for a And node.
1462  *
1463  * @param   *db    A pointer for debug information.
1464  * @param   *irg   The ir graph the node  belongs to.
1465  * @param   *block The ir block the node belongs to.
1466  * @param   *op1   The first operand.
1467  * @param   *op2   The second operand.
1468  * @param   *mode  The mode of the operands and the result.
1469  */
1470 ir_node *new_rd_And    (dbg_info *db, ir_graph *irg, ir_node *block,
1471                         ir_node *op1, ir_node *op2, ir_mode *mode);
1472
1473 /** Constructor for a Or node.
1474  *
1475  * @param   *db    A pointer for debug information.
1476  * @param   *irg   The ir graph the node  belongs to.
1477  * @param   *block The ir block the node belongs to.
1478  * @param   *op1   The first operand.
1479  * @param   *op2   The second operand.
1480  * @param   *mode  The mode of the operands and the result.
1481  */
1482 ir_node *new_rd_Or     (dbg_info *db, ir_graph *irg, ir_node *block,
1483                         ir_node *op1, ir_node *op2, ir_mode *mode);
1484
1485 /** Constructor for a Eor node.
1486  *
1487  * @param   *db    A pointer for debug information.
1488  * @param   *irg   The ir graph the node  belongs to.
1489  * @param   *block The ir block the node belongs to.
1490  * @param   *op1   The first operand.
1491  * @param   *op2   The second operand.
1492  * @param   *mode  The mode of the operands and the results.
1493  */
1494 ir_node *new_rd_Eor    (dbg_info *db, ir_graph *irg, ir_node *block,
1495                         ir_node *op1, ir_node *op2, ir_mode *mode);
1496
1497 /** Constructor for a Not node.
1498  *
1499  * @param   *db    A pointer for debug information.
1500  * @param   *irg   The ir graph the node  belongs to.
1501  * @param   *block The ir block the node belongs to.
1502  * @param   *op    The operand.
1503  * @param   *mode  The mode of the operand and the result.
1504  */
1505 ir_node *new_rd_Not    (dbg_info *db, ir_graph *irg, ir_node *block,
1506                ir_node *op, ir_mode *mode);
1507
1508 /** Constructor for a Cmp node.
1509  *
1510  * @param   *db    A pointer for debug information.
1511  * @param   *irg   The ir graph the node  belongs to.
1512  * @param   *block The ir block the node belongs to.
1513  * @param   *op1   The first operand.
1514  * @param   *op2   The second operand.
1515  */
1516 ir_node *new_rd_Cmp    (dbg_info *db, ir_graph *irg, ir_node *block,
1517                ir_node *op1, ir_node *op2);
1518
1519 /** Constructor for a Shl node.
1520  *
1521  * @param   *db    A pointer for debug information.
1522  * @param   *irg   The ir graph the node  belongs to.
1523  * @param   *block The ir block the node belongs to.
1524  * @param   *op    The operand.
1525  * @param   *k     The number of bits to  shift the operand .
1526  * @param   *mode  The mode of the operand and the result.
1527  */
1528 ir_node *new_rd_Shl    (dbg_info *db, ir_graph *irg, ir_node *block,
1529                ir_node *op, ir_node *k, ir_mode *mode);
1530
1531 /** Constructor for a Shr node.
1532  *
1533  * @param   *db    A pointer for debug information.
1534  * @param   *irg   The ir graph the node  belongs to.
1535  * @param   *block The ir block the node belongs to.
1536  * @param   *op    The operand.
1537  * @param   *k     The number of bits to shift the operand .
1538  * @param   *mode  The mode of the operand and the result.
1539  */
1540 ir_node *new_rd_Shr    (dbg_info *db, ir_graph *irg, ir_node *block,
1541                ir_node *op, ir_node *k, ir_mode *mode);
1542
1543 /** Constructor for a Shrs node.
1544  *
1545  * @param   *db    A pointer for debug information.
1546  * @param   *irg   The ir graph the node  belongs to.
1547  * @param   *block The ir block the node belongs to.
1548  * @param   *op    The operand.
1549  * @param   *k     The number of bits to shift the operand.
1550  * @param   *mode  The mode of the operand and the result.
1551  */
1552 ir_node *new_rd_Shrs   (dbg_info *db, ir_graph *irg, ir_node *block,
1553                ir_node *op, ir_node *k, ir_mode *mode);
1554
1555 /** Constructor for a Rot node.
1556  *
1557  * @param   *db    A pointer for debug information.
1558  * @param   *irg   The ir graph the node  belongs to.
1559  * @param   *block The ir block the node belongs to.
1560  * @param   *op    The operand.
1561  * @param   *k     The number of bits to rotate the operand.
1562  * @param   *mode  The mode of the operand.
1563  */
1564 ir_node *new_rd_Rot    (dbg_info *db, ir_graph *irg, ir_node *block,
1565                ir_node *op, ir_node *k, ir_mode *mode);
1566
1567
1568 /** Constructor for a Conv node.
1569  *
1570  * @param   *db    A pointer for debug information.
1571  * @param   *irg   The ir graph the node  belongs to.
1572  * @param   *block The ir block the node belongs to.
1573  * @param   *op    The operand.
1574  * @param   *mode  The mode of this the operand muss be converted .
1575  */
1576 ir_node *new_rd_Conv   (dbg_info *db, ir_graph *irg, ir_node *block,
1577                ir_node *op, ir_mode *mode);
1578
1579 /** Constructor for a Cast node.
1580  *
1581  * High level type cast.
1582  *
1583  * @param   *db    A pointer for debug information.
1584  * @param   *irg   The ir graph the node  belongs to.
1585  * @param   *block The ir block the node belongs to.
1586  * @param   *op    The operand.
1587  * @param   *to_tp The type of this the operand muss be casted .
1588  */
1589 ir_node *new_rd_Cast   (dbg_info *db, ir_graph *irg, ir_node *block,
1590                         ir_node *op, ir_type *to_tp);
1591
1592 /** Constructor for a Carry node.
1593  *
1594  * @param   *db    A pointer for debug information.
1595  * @param   *irg   The ir graph the node  belongs to.
1596  * @param   *block The ir block the node belongs to.
1597  * @param   *op1   The first operand.
1598  * @param   *op2   The second operand.
1599  * @param   *mode  The mode of the operands and the result.
1600  */
1601 ir_node *new_rd_Carry  (dbg_info *db, ir_graph *irg, ir_node *block,
1602                         ir_node *op1, ir_node *op2, ir_mode *mode);
1603
1604 /** Constructor for a Borrow node.
1605  *
1606  * @param   *db    A pointer for debug information.
1607  * @param   *irg   The ir graph the node  belongs to.
1608  * @param   *block The ir block the node belongs to.
1609  * @param   *op1   The first operand.
1610  * @param   *op2   The second operand.
1611  * @param   *mode  The mode of the operands and the result.
1612  */
1613 ir_node *new_rd_Borrow (dbg_info *db, ir_graph *irg, ir_node *block,
1614                         ir_node *op1, ir_node *op2, ir_mode *mode);
1615
1616 /** Constructor for a Phi node.
1617  *
1618  * @param *db    A pointer for debug information.
1619  * @param *irg   The ir graph the node  belongs to.
1620  * @param *block The ir block the node belongs to.
1621  * @param arity  The number of predecessors
1622  * @param *in[]  Array with predecessors.  The constructor copies this array.
1623  * @param *mode  The mode of it's inputs and output.
1624  */
1625 ir_node *new_rd_Phi    (dbg_info *db, ir_graph *irg, ir_node *block, int arity,
1626                         ir_node *in[], ir_mode *mode);
1627
1628 /** Constructor for a Load node.
1629  *
1630  * @param *db    A pointer for debug information.
1631  * @param *irg   The ir graph the node  belongs to.
1632  * @param *block The ir block the node belongs to.
1633  * @param *store The current memory
1634  * @param *adr   A pointer to the variable to be read in this memory.
1635  * @param *mode  The mode of the value to be loaded.
1636  */
1637 ir_node *new_rd_Load   (dbg_info *db, ir_graph *irg, ir_node *block,
1638                         ir_node *store, ir_node *adr, ir_mode *mode);
1639
1640 /** Constructor for a Store node.
1641  *
1642  * @param *db    A pointer for debug information.
1643  * @param *irg   The ir graph the node  belongs to.
1644  * @param *block The ir block the node belongs to.
1645  * @param *store The current memory
1646  * @param *adr   A pointer to the variable to be read in this memory.
1647  * @param *val   The value to write to this variable.
1648  */
1649 ir_node *new_rd_Store  (dbg_info *db, ir_graph *irg, ir_node *block,
1650                ir_node *store, ir_node *adr, ir_node *val);
1651
1652 /** Constructor for a Alloc node.
1653  *
1654  * The Alloc node extends the memory by space for an entity of type alloc_type.
1655  *
1656  * @param *db         A pointer for debug information.
1657  * @param *irg        The ir graph the node  belongs to.
1658  * @param *block      The ir block the node belongs to.
1659  * @param *store      The memory which shall contain the new variable.
1660  * @param *size       The number of bytes to allocate.
1661  * @param *alloc_type The type of the allocated variable.
1662  * @param where       Where to allocate the variable, either heap_alloc or stack_alloc.
1663  */
1664 ir_node *new_rd_Alloc  (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1665                ir_node *size, ir_type *alloc_type, where_alloc where);
1666
1667 /** Constructor for a Free node.
1668  *
1669  * Frees the memory occupied by the entity pointed to by the pointer
1670  * arg.  Type indicates the type of the entity the argument points to.
1671  *
1672  * @param *db         A pointer for debug information.
1673  * @param *irg        The ir graph the node  belongs to.
1674  * @param *block      The ir block the node belongs to.
1675  * @param *store      The memory which shall contain the new variable.
1676  * @param *ptr        The pointer to the object to free.
1677  * @param *size       The number of objects of type free_type to free in a sequence.
1678  * @param *free_type  The type of the freed variable.
1679  * @param where       Where the variable was allocated, either heap_alloc or stack_alloc.
1680  */
1681 ir_node *new_rd_Free   (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1682                         ir_node *ptr, ir_node *size, ir_type *free_type, where_alloc where);
1683
1684 /** Constructor for a Sync node.
1685  *
1686  * Merges several memory values.  The node assumes that a variable
1687  * either occurs only in one of the memories, or it contains the same
1688  * value in all memories where it occurs.
1689  *
1690  * @param *db       A pointer for debug information.
1691  * @param *irg      The ir graph the node  belongs to.
1692  * @param *block    The ir block the node belongs to.
1693  * @param  arity    The number of memories to synchronize.
1694  * @param  *in[]    An array of pointers to nodes that produce an output of type
1695  *                  memory.  The constructor copies this array.
1696  */
1697 ir_node *new_rd_Sync   (dbg_info *db, ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
1698
1699 /** Constructor for a Proj node.
1700  *
1701  * Projects a single value out of a tuple.  The parameter proj gives the
1702  * position of the value within the tuple.
1703  *
1704  * @param *db    A pointer for debug information.
1705  * @param *irg   The ir graph the node  belongs to.
1706  * @param *block The ir block the node belongs to.
1707  * @param arg    A node producing a tuple.  The node must have mode_T.
1708  * @param *mode  The mode of the value to project.
1709  * @param proj   The position of the value in the tuple.
1710  */
1711 ir_node *new_rd_Proj   (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1712                         ir_mode *mode, long proj);
1713
1714 /** Constructor for a defaultProj node.
1715  *
1716  * Represents the default control flow of a Switch-Cond node.
1717  *
1718  * @param *db       A pointer for debug information.
1719  * @param *irg      The ir graph the node  belongs to.
1720  * @param *block    The ir block the node belongs to.
1721  * @param arg       A node producing a tuple.
1722  * @param max_proj  The end position of the value in the tuple.
1723  */
1724 ir_node *new_rd_defaultProj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1725                              long max_proj);
1726
1727 /** Constructor for a Tuple node.
1728  *
1729  * This is an auxiliary node to replace a node that returns a tuple
1730  * without changing the corresponding Proj nodes.
1731  *
1732  * @param *db     A pointer for debug information.
1733  * @param *irg    The ir graph the node  belongs to.
1734  * @param *block  The ir block the node belongs to.
1735  * @param arity   The number of tuple elements.
1736  * @param *in[]   An array containing pointers to the nodes producing the tuple
1737  *                elements. The constructor copies this array.
1738  */
1739 ir_node *new_rd_Tuple  (dbg_info *db, ir_graph *irg, ir_node *block,
1740                         int arity, ir_node *in[]);
1741
1742 /** Constructor for a Id node.
1743  *
1744  * This is an auxiliary node to replace a node that returns a single
1745  * value.
1746  *
1747  * @param *db     A pointer for debug information.
1748  * @param *irg    The ir graph the node  belongs to.
1749  * @param *block  The ir block the node belongs to.
1750  * @param *val    The value
1751  * @param *mode   The mode of *val.
1752  */
1753 ir_node *new_rd_Id     (dbg_info *db, ir_graph *irg, ir_node *block,
1754                         ir_node *val, ir_mode *mode);
1755
1756 /** Constructor for a Bad node.
1757  *
1758  * Returns the unique Bad node of the graph.  The same as
1759  * get_irg_bad().
1760  *
1761  * @param *irg    The ir graph the node belongs to.
1762  */
1763 ir_node *new_rd_Bad    (ir_graph *irg);
1764
1765 /** Constructor for a Confirm node.
1766  *
1767  * Specifies constraints for a value.  To support dataflow analyses.
1768  *
1769  * Example: If the value never exceeds '100' this is expressed by placing a
1770  * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
1771  *
1772  * @param *irg    The ir graph the node belong to.
1773  * @param *block  The ir block the node belong to.
1774  * @param *db     A pointer for debug information.
1775  * @param *val    The value we express a constraint for
1776  * @param *bound  The value to compare against. Must be a firm node, typically a constant.
1777  * @param cmp     The compare operation.
1778  */
1779 ir_node *new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block,
1780              ir_node *val, ir_node *bound, pn_Cmp cmp);
1781
1782 /** Constructor for an Unknown node.
1783  *
1784  * Represents an arbitrary value.  Places the node in the start block.
1785  *
1786  * @param *irg    The ir graph the node  belongs to.
1787  * @param *m      The mode of the unknown value.
1788  */
1789 ir_node *new_rd_Unknown(ir_graph *irg, ir_mode *m);
1790
1791 /** Constructor for a CallBegin node.
1792  *
1793  * CallBegin represents control flow depending of the pointer value
1794  * representing the called method to the called methods.  The
1795  * constructor copies the method pointer input from the passed Call
1796  * node.
1797  *
1798  * @param *db     A pointer for debug information.
1799  * @param *irg    The ir graph the node belong to.
1800  * @param *block  The block the node belong to.
1801  * @param *callee The call node visible in the intra procedural view.
1802  */
1803 ir_node *new_rd_CallBegin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *callee);
1804
1805 /** Constructor for a EndReg node.
1806  *
1807  * Used to represent regular procedure end in interprocedual view.
1808  *
1809  * @param *db     A pointer for debug information.
1810  * @param *irg    The ir graph the node belong to.
1811  * @param *block  The block the node belong to.
1812  */
1813 ir_node *new_rd_EndReg (dbg_info *db, ir_graph *irg, ir_node *block);
1814
1815 /** Constructor for a EndExcept node.
1816  *
1817  * Used to represent exceptional procedure end in interprocedural view.
1818  *
1819  * @param *db     A pointer for debug information.
1820  * @param *irg    The ir graph the node belong to.
1821  * @param *block  The block the node belong to.
1822  */
1823 ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
1824
1825 /** Constructor for a Filter node.
1826  *
1827  * Adds the node to the block in current_ir_block.  Filter is a node
1828  * with two views used to construct the interprocedural view.  In
1829  * intraprocedural view its semantics are identical to the Proj node.
1830  * In interprocedural view the Filter performs the Phi operation on
1831  * method parameters or results.  Other than a Phi a Filter node may
1832  * not be removed if it has only a single input.
1833  *
1834  * The constructor builds the Filter in intraprocedural view.
1835  *
1836  * @param *db     A pointer for debug information.
1837  * @param *irg    The ir graph the node belong to.
1838  * @param *block  The block the node belong to.
1839  * @param *arg  The tuple value to project from.
1840  * @param *mode The mode of the projected value.
1841  * @param proj  The position in the tuple to project from.
1842  */
1843 ir_node *new_rd_Filter (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1844                         ir_mode *mode, long proj);
1845
1846 /** Constructor for a NoMem node.
1847  *
1848  * Returns the unique NoMem node of the graph.  The same as
1849  * get_irg_no_mem().
1850  *
1851  * @param *irg    The ir graph the node belongs to.
1852  */
1853 ir_node *new_rd_NoMem  (ir_graph *irg);
1854
1855 /** Constructor for a Mux node.
1856  *
1857  * @param *db       A pointer for debug information.
1858  * @param *irg      The ir graph the node belong to.
1859  * @param *block    The block the node belong to.
1860  * @param *sel      The ir_node that calculates the boolean select.
1861  * @param *ir_true  The ir_node that calculates the true result.
1862  * @param *ir_false The ir_node that calculates the false result.
1863  * @param *mode     The mode of the node (and it_true and ir_false).
1864  */
1865 ir_node *new_rd_Mux  (dbg_info *db, ir_graph *irg, ir_node *block,
1866     ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
1867
1868 /** Constructor for a Psi node.
1869  *
1870  * @param *db       A pointer for debug information.
1871  * @param *irg      The ir graph the node belong to.
1872  * @param *block    The block the node belong to.
1873  * @param *arity    The arity of the conditions
1874  * @param *conds    The array of mode_b conditions, length must be equal arity
1875  * @param *vals     The array of mode values, length must be equal arity + 1
1876  * @param *mode     The mode of the node (must be the mode of all vals).
1877  */
1878 ir_node *new_rd_Psi (dbg_info *db, ir_graph *irg, ir_node *block,
1879                      int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
1880
1881 /** Constructor for a CopyB node.
1882  *
1883  * @param *db         A pointer for debug information.
1884  * @param *irg        The ir graph the node belong to.
1885  * @param *block      The block the node belong to.
1886  * @param *store      The current memory
1887  * @param *dst        The ir_node that represents the destination address.
1888  * @param *src        The ir_node that represents the source address.
1889  * @param *data_type  The type of the copied data
1890  */
1891 ir_node *new_rd_CopyB(dbg_info *db, ir_graph *irg, ir_node *block,
1892     ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
1893
1894 /** Constructor for a InstOf node.
1895  *
1896  * A High-Level Type check.
1897  *
1898  * @param   *db        A pointer for debug information.
1899  * @param   *irg       The ir graph the node  belongs to.
1900  * @param   *block     The ir block the node belongs to.
1901  * @param   *store     The memory in which the object the entity should be selected
1902  *                     from is allocated.
1903  * @param   *objptr    A pointer to a object of a class type.
1904  * @param   *type      The type of which objptr must be.
1905  */
1906 ir_node *new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1907                         ir_node *objptr, ir_type *type);
1908
1909 /** Constructor for a Raise node.
1910  *
1911  * A High-Level Exception throw.
1912  *
1913  * @param *db    A pointer for debug information.
1914  * @param *irg   The ir graph the node  belongs to.
1915  * @param *block The ir block the node belongs to.
1916  * @param *store The current memory.
1917  * @param *obj   A pointer to the Except variable.
1918  */
1919 ir_node *new_rd_Raise  (dbg_info *db, ir_graph *irg, ir_node *block,
1920                         ir_node *store, ir_node *obj);
1921
1922 /** Constructor for a Bound node.
1923  *
1924  * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
1925  *
1926  * @param *db         A pointer for debug information.
1927  * @param *irg        The ir graph the node belong to.
1928  * @param *block      The block the node belong to.
1929  * @param *store      The current memory
1930  * @param *idx        The ir_node that represents an index.
1931  * @param *lower      The ir_node that represents the lower bound for the index.
1932  * @param *upper      The ir_node that represents the upper bound for the index.
1933  */
1934 ir_node *new_rd_Bound(dbg_info *db, ir_graph *irg, ir_node *block,
1935     ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
1936
1937 /*-------------------------------------------------------------------------*/
1938 /* The raw interface without debug support                                 */
1939 /*-------------------------------------------------------------------------*/
1940
1941 /** Constructor for a Block node.
1942  *
1943  * Constructs a mature block with the given predecessors.  Use Unknown
1944  * nodes as predecessors to construct a block if the number of
1945  * predecessors is known, but not the predecessors themselves.  This
1946  * constructor does not set current_block.  It not be used with
1947  * automatic Phi node construction.
1948  *
1949  *
1950  * @param irg    The ir graph the block belongs to.
1951  * @param arity  The number of control predecessors.
1952  * @param in[]   An array of control predecessors.  The length of
1953  *               the array must be 'arity'. The constructor copies this array.
1954  */
1955 ir_node *new_r_Block  (ir_graph *irg,  int arity, ir_node *in[]);
1956
1957 /** Constructor for a Start node.
1958  *
1959  * @param *irg   The ir graph the node belongs to.
1960  * @param *block The ir block the node belongs to.
1961  */
1962 ir_node *new_r_Start  (ir_graph *irg, ir_node *block);
1963
1964 /** Constructor for a End node.
1965  *
1966  * @param *irg   The ir graph the node  belongs to.
1967  * @param *block The ir block the node belongs to.
1968  */
1969 ir_node *new_r_End    (ir_graph *irg, ir_node *block);
1970
1971 /** Constructor for a Jmp node.
1972  *
1973  * Jmp represents control flow to a single control successor.
1974  *
1975  * @param *irg    The ir graph the node belongs to.
1976  * @param *block  The ir block the node belongs to.
1977  */
1978 ir_node *new_r_Jmp    (ir_graph *irg, ir_node *block);
1979
1980 /** Constructor for an IJmp node.
1981  *
1982  * IJmp represents control flow to a single control successor not
1983  * statically known i.e. an indirect Jmp.
1984  *
1985  * @param *irg    The ir graph the node belongs to.
1986  * @param *block  The ir block the node belongs to.
1987  * @param *tgt    The ir node representing the target address.
1988  */
1989 ir_node *new_r_IJmp   (ir_graph *irg, ir_node *block, ir_node *tgt);
1990
1991 /** Constructor for a Cond node.
1992  *
1993  * If c is mode_b represents a conditional branch (if/else). If c is
1994  * mode_Is/mode_Iu (?) represents a switch.  (Allocates dense Cond
1995  * node, default Proj is 0.)
1996  *
1997  * This is not consistent:  Input to Cond is Is, Proj has as proj number
1998  * longs.
1999  *
2000  * @param *irg   The ir graph the node  belongs to.
2001  * @param *block The ir block the node belongs to.
2002  * @param *c     The conditions parameter.Can be of mode b or I_u.
2003  */
2004 ir_node *new_r_Cond   (ir_graph *irg, ir_node *block, ir_node *c);
2005
2006 /** Constructor for a Return node.
2007  *
2008  * Returns the memory an zero or more return values.  Only node that
2009  * can end regular control flow.
2010  *
2011  * @param *irg   The ir graph the node  belongs to.
2012  * @param *block The ir block the node belongs to.
2013  * @param *store The state of memory.
2014  * @param arity  Number of array indices.
2015  * @param *in[]   Array with index inputs to the node. The constructor copies this array.
2016  */
2017 ir_node *new_r_Return (ir_graph *irg, ir_node *block,
2018                        ir_node *store, int arity, ir_node *in[]);
2019
2020 /** Constructor for a Const node.
2021  *
2022  * Constructor for a Const node. The constant represents a target
2023  * value.  Sets the type information to type_unknown.  (No more
2024  * supported: If tv is entity derives a somehow useful type.)
2025  *
2026  * @param *irg   The ir graph the node  belongs to.
2027  * @param *block The ir block the node belongs to.
2028  * @param *mode  The mode of the operands and the results.
2029  * @param *con   Points to an entry in the constant table.
2030  */
2031 ir_node *new_r_Const  (ir_graph *irg, ir_node *block,
2032                        ir_mode *mode, tarval *con);
2033
2034 /** Constructor for a Const node.
2035  *
2036  * Constructor for a Const node. The constant represents a target
2037  * value.  Sets the type information to type_unknown.  (No more
2038  * supported: If tv is entity derives a somehow useful type.)
2039  *
2040  * @param *irg   The ir graph the node  belongs to.
2041  * @param *block The ir block the node belongs to.
2042  * @param *mode  The mode of the operands and the results.
2043  * @param value  A value from which the tarval is made.
2044  */
2045 ir_node *new_r_Const_long(ir_graph *irg, ir_node *block,
2046                        ir_mode *mode, long value);
2047
2048 /** Constructor for a Const_type node.
2049  *
2050  * The constant represents a target value.  This constructor sets high
2051  * level type information for the constant value.
2052  *
2053  * @param *irg   The ir graph the node  belongs to.
2054  * @param *block The ir block the node belongs to.
2055  * @param *mode  The mode of the operands and results.
2056  * @param *con   Points to an entry in the constant table.
2057  * @param *tp    The type of the constant.
2058  */
2059 ir_node *new_r_Const_type(ir_graph *irg, ir_node *block,
2060            ir_mode *mode, tarval *con, ir_type *tp);
2061
2062 /** Constructor for a SymConst node.
2063  *
2064  *  This is the constructor for a symbolic constant.
2065  *    There are four kinds of symbolic constants:
2066  *    - type_tag  The symbolic constant represents a type tag.  The type the
2067  *                tag stands for is given explicitly.
2068  *    - size      The symbolic constant represents the size of a type.  The
2069  *                type of which the constant represents the size is given
2070  *                explicitly.
2071  *    - addr_name The symbolic constant represents the address of an entity
2072  *                (variable or method).  The variable is indicated by a name
2073  *                that is valid for linking.
2074  *    - addr_ent   The symbolic constant represents the address of an entity
2075  *                (variable or method).  The variable is given explicitly by
2076  *                a firm entity.
2077  *
2078  *    Inputs to the node:
2079  *      No inputs except the block it belongs to.
2080  *    Outputs of the node.
2081  *      An unsigned integer (I_u) or a pointer (P).
2082  *
2083  * @param *irg    The ir graph the node  belongs to.
2084  * @param *block  The ir block the node belongs to.
2085  * @param value   A type, entity or a ident depending on the SymConst kind.
2086  * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
2087  */
2088 ir_node *new_r_SymConst (ir_graph *irg, ir_node *block,
2089                          union symconst_symbol value, symconst_kind symkind);
2090
2091 /** Constructor for a simpleSel node.
2092  *
2093  *  This is a shortcut for the new_d_Sel() constructor.  To be used for
2094  *  Sel nodes that do not select from an array, i.e., have no index
2095  *  inputs.  It adds the two parameters 0, NULL.
2096  *
2097  * @param   *irg       The ir graph the node  belongs to.
2098  * @param   *block     The ir block the node belongs to.
2099  * @param   *store     The memory in which the object the entity should be selected
2100  *                     from is allocated.
2101  * @param   *objptr    The object from that the Sel operation selects a
2102  *                     single attribute out.
2103  * @param   *ent       The entity to select.
2104  */
2105 ir_node *new_r_simpleSel(ir_graph *irg, ir_node *block, ir_node *store,
2106                          ir_node *objptr, entity *ent);
2107
2108 /** Constructor for a Sel node.
2109  *
2110  * The select node selects an entity (field or method) from an entity
2111  * with a compound type.  It explicitly specifies the entity selected.
2112  * Dynamically the node may select entities that overwrite the given
2113  * entity.  If the selected entity is an array element entity the Sel
2114  * node takes the required array indices as inputs.
2115  *
2116  * @param   *irg       The ir graph the node  belongs to.
2117  * @param   *block     The ir block the node belongs to.
2118  * @param   *store     The memory in which the object the entity should be selected
2119  *                     from is allocated.
2120  * @param   *objptr    A pointer to a compound entity the Sel operation selects a
2121  *                     single attribute from.
2122  * @param   *n_index   The number of array indices needed to select an array element entity.
2123  * @param   *index[]   If the compound entity is an array the indices of the selected
2124  *                     element entity.  The constructor copies this array.
2125  * @param   *ent       The entity to select.
2126  */
2127 ir_node *new_r_Sel    (ir_graph *irg, ir_node *block, ir_node *store,
2128                        ir_node *objptr, int n_index, ir_node *index[],
2129                entity *ent);
2130
2131 /** Constructor for a Call node.
2132  *
2133  *  Represents all kinds of method and function calls.
2134  *
2135  * @param   *irg    The ir graph the node  belongs to.
2136  * @param   *block  The ir block the node belongs to.
2137  * @param   *store  The actual store.
2138  * @param   *callee A pointer to the called procedure.
2139  * @param   arity   The number of procedure parameters.
2140  * @param   *in[]   An array with the pointers to the parameters. The constructor copies this array.
2141  * @param   *tp     Type information of the procedure called.
2142  */
2143 ir_node *new_r_Call   (ir_graph *irg, ir_node *block, ir_node *store,
2144                ir_node *callee, int arity, ir_node *in[],
2145                ir_type *tp);
2146
2147 /** Constructor for a Add node.
2148  *
2149  * @param   *irg   The ir graph the node  belongs to.
2150  * @param   *block The ir block the node belongs to.
2151  * @param   *op1   The first operand.
2152  * @param   *op2   The second operand.
2153  * @param   *mode  The mode of the operands and the result.
2154  */
2155 ir_node *new_r_Add    (ir_graph *irg, ir_node *block,
2156                ir_node *op1, ir_node *op2, ir_mode *mode);
2157
2158 /**
2159  * Constructor for a Sub node.
2160  *
2161  * @param   *irg   The ir graph the node  belongs to.
2162  * @param   *block The ir block the node belongs to.
2163  * @param   *op1   The first operand.
2164  * @param   *op2   The second operand.
2165  * @param   *mode  The mode of the operands and the results.
2166  */
2167 ir_node *new_r_Sub    (ir_graph *irg, ir_node *block,
2168                ir_node *op1, ir_node *op2, ir_mode *mode);
2169
2170 /** Constructor for a Minus node.
2171  *
2172  * @param   *irg   The ir graph the node  belongs to.
2173  * @param   *block The ir block the node belongs to.
2174  * @param   *op   The operand.
2175  * @param   *mode  The mode of the operand and the result.
2176  */
2177 ir_node *new_r_Minus  (ir_graph *irg, ir_node *block,
2178                ir_node *op,  ir_mode *mode);
2179 /** Constructor for a Mul node.
2180  *
2181  * @param   *irg   The ir graph the node  belongs to.
2182  * @param   *block The ir block the node belongs to.
2183  * @param   *op1   The first operand.
2184  * @param   *op2   The second operand.
2185  * @param   *mode  The mode of the operands and the result.
2186  */
2187 ir_node *new_r_Mul    (ir_graph *irg, ir_node *block,
2188                ir_node *op1, ir_node *op2, ir_mode *mode);
2189
2190 /** Constructor for a Quot node.
2191  *
2192  * @param   *irg   The ir graph the node  belongs to.
2193  * @param   *block The ir block the node belongs to.
2194  * @param   *memop The store needed to model exceptions
2195  * @param   *op1   The first operand.
2196  * @param   *op2   The second operand.
2197  */
2198 ir_node *new_r_Quot   (ir_graph *irg, ir_node *block,
2199                ir_node *memop, ir_node *op1, ir_node *op2);
2200
2201 /** Constructor for a DivMod node.
2202  *
2203  * @param   *irg   The ir graph the node  belongs to.
2204  * @param   *block The ir block the node belongs to.
2205  * @param   *memop The store needed to model exceptions
2206  * @param   *op1   The first operand.
2207  * @param   *op2   The second operand.
2208  */
2209 ir_node *new_r_DivMod (ir_graph *irg, ir_node *block,
2210                ir_node *memop, ir_node *op1, ir_node *op2);
2211
2212 /** Constructor for a Div node.
2213  *
2214  * @param   *irg   The ir graph the node  belongs to.
2215  * @param   *block The ir block the node belongs to.
2216  * @param   *memop The store needed to model exceptions
2217  * @param   *op1   The first operand.
2218  * @param   *op2   The second operand.
2219  */
2220 ir_node *new_r_Div    (ir_graph *irg, ir_node *block,
2221                ir_node *memop, ir_node *op1, ir_node *op2);
2222
2223 /** Constructor for a Mod node.
2224  *
2225  * @param   *irg   The ir graph the node  belongs to.
2226  * @param   *block The ir block the node belongs to.
2227  * @param   *memop The store needed to model exceptions
2228  * @param   *op1   The first operand.
2229  * @param   *op2   The second operand.
2230  */
2231 ir_node *new_r_Mod    (ir_graph *irg, ir_node *block,
2232                ir_node *memop, ir_node *op1, ir_node *op2);
2233
2234 /** Constructor for a Abs node.
2235  *
2236  * @param   *irg   The ir graph the node  belongs to.
2237  * @param   *block The ir block the node belongs to.
2238  * @param   *op    The operand
2239  * @param   *mode  The mode of the operands and the result.
2240  */
2241 ir_node *new_r_Abs    (ir_graph *irg, ir_node *block,
2242                        ir_node *op, ir_mode *mode);
2243
2244 /** Constructor for a And node.
2245  *
2246  * @param   *irg   The ir graph the node  belongs to.
2247  * @param   *block The ir block the node belongs to.
2248  * @param   *op1   The first operand.
2249  * @param   *op2   The second operand.
2250  * @param   *mode  The mode of the operands and the result.
2251  */
2252 ir_node *new_r_And    (ir_graph *irg, ir_node *block,
2253                ir_node *op1, ir_node *op2, ir_mode *mode);
2254
2255 /** Constructor for a Or node.
2256  *
2257  * @param   *irg   The ir graph the node  belongs to.
2258  * @param   *block The ir block the node belongs to.
2259  * @param   *op1   The first operand.
2260  * @param   *op2   The second operand.
2261  * @param   *mode  The mode of the operands and the result.
2262  */
2263 ir_node *new_r_Or     (ir_graph *irg, ir_node *block,
2264                ir_node *op1, ir_node *op2, ir_mode *mode);
2265
2266 /** Constructor for a Eor node.
2267  *
2268  * @param   *irg   The ir graph the node  belongs to.
2269  * @param   *block The ir block the node belongs to.
2270  * @param   *op1   The first operand.
2271  * @param   *op2   The second operand.
2272  * @param   *mode  The mode of the operands and the results.
2273  */
2274 ir_node *new_r_Eor    (ir_graph *irg, ir_node *block,
2275                ir_node *op1, ir_node *op2, ir_mode *mode);
2276
2277 /** Constructor for a Not node.
2278  *
2279  * @param   *irg   The ir graph the node  belongs to.
2280  * @param   *block The ir block the node belongs to.
2281  * @param   *op    The operand.
2282  * @param   *mode  The mode of the operand and the result.
2283  */
2284 ir_node *new_r_Not    (ir_graph *irg, ir_node *block,
2285                ir_node *op, ir_mode *mode);
2286
2287 /** Constructor for a Cmp node.
2288  *
2289  * @param   *irg   The ir graph the node  belongs to.
2290  * @param   *block The ir block the node belongs to.
2291  * @param   *op1   The first operand.
2292  * @param   *op2   The second operand.
2293  */
2294 ir_node *new_r_Cmp    (ir_graph *irg, ir_node *block,
2295                ir_node *op1, ir_node *op2);
2296
2297 /** Constructor for a Shl node.
2298  *
2299  * @param   *irg   The ir graph the node  belongs to.
2300  * @param   *block The ir block the node belongs to.
2301  * @param   *op    The operand.
2302  * @param   *k     The number of bits to  shift the operand .
2303  * @param   *mode  The mode of the operand and the result.
2304  */
2305 ir_node *new_r_Shl    (ir_graph *irg, ir_node *block,
2306                ir_node *op, ir_node *k, ir_mode *mode);
2307
2308 /** Constructor for a Shr node.
2309  *
2310  * @param   *irg   The ir graph the node  belongs to.
2311  * @param   *block The ir block the node belongs to.
2312  * @param   *op    The operand.
2313  * @param   *k     The number of bits to shift the operand .
2314  * @param   *mode  The mode of the operand and the result.
2315  */
2316 ir_node *new_r_Shr    (ir_graph *irg, ir_node *block,
2317                ir_node *op, ir_node *k, ir_mode *mode);
2318
2319 /**
2320  * Constructor for a Shrs node.
2321  *
2322  * @param   *irg   The ir graph the node  belongs to.
2323  * @param   *block The ir block the node belongs to.
2324  * @param   *op    The operand.
2325  * @param   *k     The number of bits to shift the operand.
2326  * @param   *mode  The mode of the operand and the result.
2327  */
2328 ir_node *new_r_Shrs   (ir_graph *irg, ir_node *block,
2329                ir_node *op, ir_node *k, ir_mode *mode);
2330
2331 /** Constructor for a Rot node.
2332  *
2333  * @param   *irg   The ir graph the node  belongs to.
2334  * @param   *block The ir block the node belongs to.
2335  * @param   *op    The operand.
2336  * @param   *k     The number of bits to rotate the operand.
2337  * @param   *mode  The mode of the operand.
2338  */
2339 ir_node *new_r_Rot    (ir_graph *irg, ir_node *block,
2340                ir_node *op, ir_node *k, ir_mode *mode);
2341
2342 /** Constructor for a Conv node.
2343  *
2344  * @param   *irg   The ir graph the node  belongs to.
2345  * @param   *block The ir block the node belongs to.
2346  * @param   *op    The operand.
2347  * @param   *mode  The mode of this the operand muss be converted .
2348  */
2349 ir_node *new_r_Conv   (ir_graph *irg, ir_node *block,
2350                ir_node *op, ir_mode *mode);
2351
2352 /** Constructor for a Cast node.
2353  *
2354  * High level type cast
2355  *
2356  * @param   *irg   The ir graph the node  belongs to.
2357  * @param   *block The ir block the node belongs to.
2358  * @param   *op    The operand.
2359  * @param   *to_tp The type of this the operand muss be casted .
2360  */
2361 ir_node *new_r_Cast   (ir_graph *irg, ir_node *block,
2362                ir_node *op, ir_type *to_tp);
2363
2364 /** Constructor for a Carry node.
2365  *
2366  * @param   *irg   The ir graph the node  belongs to.
2367  * @param   *block The ir block the node belongs to.
2368  * @param   *op1   The first operand.
2369  * @param   *op2   The second operand.
2370  * @param   *mode  The mode of the operands and the result.
2371  */
2372 ir_node *new_r_Carry  (ir_graph *irg, ir_node *block,
2373                ir_node *op1, ir_node *op2, ir_mode *mode);
2374
2375 /**
2376  * Constructor for a Borrow node.
2377  *
2378  * @param   *irg   The ir graph the node  belongs to.
2379  * @param   *block The ir block the node belongs to.
2380  * @param   *op1   The first operand.
2381  * @param   *op2   The second operand.
2382  * @param   *mode  The mode of the operands and the results.
2383  */
2384 ir_node *new_r_Borrow (ir_graph *irg, ir_node *block,
2385                ir_node *op1, ir_node *op2, ir_mode *mode);
2386
2387 /** Constructor for a Phi node.
2388  *
2389  * @param *irg   The ir graph the node  belongs to.
2390  * @param *block The ir block the node belongs to.
2391  * @param arity  The number of predecessors
2392  * @param *in[]    Array with predecessors. The constructor copies this array.
2393  * @param *mode  The mode of it's inputs and output.
2394  */
2395 ir_node *new_r_Phi    (ir_graph *irg, ir_node *block, int arity,
2396                        ir_node *in[], ir_mode *mode);
2397
2398 /** Constructor for a Load node.
2399  *
2400  * @param *irg   The ir graph the node  belongs to.
2401  * @param *block The ir block the node belongs to.
2402  * @param *store The current memory
2403  * @param *adr   A pointer to the variable to be read in this memory.
2404  * @param *mode  The mode of the value to be loaded.
2405  */
2406 ir_node *new_r_Load   (ir_graph *irg, ir_node *block,
2407                ir_node *store, ir_node *adr, ir_mode *mode);
2408
2409 /** Constructor for a Store node.
2410  *
2411  * @param *irg   The ir graph the node  belongs to.
2412  * @param *block The ir block the node belongs to.
2413  * @param *store The current memory
2414  * @param *adr   A pointer to the variable to be read in this memory.
2415  * @param *val   The value to write to this variable.
2416  */
2417 ir_node *new_r_Store  (ir_graph *irg, ir_node *block,
2418                        ir_node *store, ir_node *adr, ir_node *val);
2419
2420 /** Constructor for a Alloc node.
2421  *
2422  * The Alloc node extends the memory by space for an entity of type alloc_type.
2423  *
2424  * @param *irg        The ir graph the node  belongs to.
2425  * @param *block      The ir block the node belongs to.
2426  * @param *store      The memory which shall contain the new variable.
2427  * @param *size       The number of bytes to allocate.
2428  * @param *alloc_type The type of the allocated variable.
2429  * @param where       Where to allocate the variable, either heap_alloc or stack_alloc.
2430  */
2431 ir_node *new_r_Alloc  (ir_graph *irg, ir_node *block, ir_node *store,
2432                ir_node *size, ir_type *alloc_type, where_alloc where);
2433
2434 /** Constructor for a Free node.
2435  *
2436  * Frees the memory occupied by the entity pointed to by the pointer
2437  * arg.  Type indicates the type of the entity the argument points to.
2438  *
2439  * @param *irg        The ir graph the node  belongs to.
2440  * @param *block      The ir block the node belongs to.
2441  * @param *store      The memory which shall contain the new variable.
2442  * @param *ptr        The pointer to the object to free.
2443  * @param *size       The number of objects of type free_type to free in a sequence.
2444  * @param *free_type  The type of the freed variable.
2445  * @param where       Where the variable was allocated, either heap_alloc or stack_alloc.
2446  */
2447 ir_node *new_r_Free   (ir_graph *irg, ir_node *block, ir_node *store,
2448                ir_node *ptr, ir_node *size, ir_type *free_type, where_alloc where);
2449
2450 /** Constructor for a Sync node.
2451  *
2452  * Merges several memory values.  The node assumes that a variable
2453  * either occurs only in one of the memories, or it contains the same
2454  * value in all memories where it occurs.
2455  *
2456  * @param *irg      The ir graph the node  belongs to.
2457  * @param *block    The ir block the node belongs to.
2458  * @param  arity    The number of memories to synchronize.
2459  * @param  *in[]    An array of pointers to nodes that produce an output of  type memory.
2460  *                  The constructor copies this array.
2461  */
2462 ir_node *new_r_Sync (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2463
2464 /** Constructor for a Proj node.
2465  *
2466  * Projects a single value out of a tuple.  The parameter proj gives the
2467  * position of the value within the tuple.
2468  *
2469  * @param *irg   The ir graph the node  belongs to.
2470  * @param *block The ir block the node belongs to.
2471  * @param arg    A node producing a tuple.
2472  * @param *mode  The mode of the value to project.
2473  * @param proj   The position of the value in the tuple.
2474  */
2475 ir_node *new_r_Proj   (ir_graph *irg, ir_node *block, ir_node *arg,
2476                        ir_mode *mode, long proj);
2477
2478 /** Constructor for a defaultProj node.
2479  *
2480  * Represents the default control flow of a Switch-Cond node.
2481  *
2482  * @param *irg      The ir graph the node  belongs to.
2483  * @param *block    The ir block the node belongs to.
2484  * @param arg       A node producing a tuple.
2485  * @param max_proj  The end  position of the value in the tuple.
2486  */
2487 ir_node *new_r_defaultProj (ir_graph *irg, ir_node *block, ir_node *arg, long max_proj);
2488
2489
2490 /** Constructor for a Tuple node.
2491  *
2492  * This is an auxiliary node to replace a node that returns a tuple
2493  * without changing the corresponding Proj nodes.
2494  *
2495  * @param *irg    The ir graph the node  belongs to.
2496  * @param *block  The ir block the node belongs to.
2497  * @param arity   The number of tuple elements.
2498  * @param *in[]   An array containing pointers to the nodes producing the tuple elements.
2499  *                The constructor copies this array.
2500  */
2501 ir_node *new_r_Tuple  (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2502
2503 /** Constructor for a Id node.
2504  *
2505  * This is an auxiliary node to replace a node that returns a single
2506  * value.
2507  *
2508  * @param *irg    The ir graph the node  belongs to.
2509  * @param *block  The ir block the node belongs to.
2510  * @param *val    The operand to Id.
2511  * @param *mode   The mode of *val.
2512  */
2513 ir_node *new_r_Id     (ir_graph *irg, ir_node *block,
2514                ir_node *val, ir_mode *mode);
2515
2516 /** Constructor for a Bad node.
2517  *
2518  * Returns the unique Bad node of the graph.  The same as
2519  * get_irg_bad().
2520  *
2521  * @param *irg    The ir graph the node  belongs to.
2522  *
2523  */
2524 ir_node *new_r_Bad    (ir_graph *irg);
2525
2526 /** Constructor for a Confirm node.
2527  *
2528  * Specifies constraints for a value.  To support dataflow analyses.
2529  *
2530  * Example: If the value never exceeds '100' this is expressed by placing a
2531  * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
2532  *
2533  * @param *irg    The ir graph the node belong to.
2534  * @param *block  The ir block the node belong to.
2535  * @param *val    The value we express a constraint for
2536  * @param *bound  The value to compare against. Must be a firm node, typically a constant.
2537  * @param cmp     The compare operation.
2538  */
2539 ir_node *new_r_Confirm (ir_graph *irg, ir_node *block,
2540             ir_node *val, ir_node *bound, pn_Cmp cmp);
2541
2542 /** Constructor for a Unknown node.
2543  *
2544  * Represents an arbitrary value.  Places the node in
2545  * the start block.
2546  *
2547  * @param *irg    The ir graph the node  belongs to.
2548  * @param *m      The mode of the unknown value.
2549  */
2550 ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2551
2552 /** Constructor for a CallBegin node.
2553  *
2554  * CallBegin represents control flow depending of the pointer value
2555  * representing the called method to the called methods.  The
2556  * constructor copies the method pointer input from the passed Call
2557  * node.
2558  *
2559  * @param *irg    The ir graph the node belong to.
2560  * @param *block  The block the node belong to.
2561  * @param *callee The call node visible in the  intra procedural view.
2562  */
2563 ir_node *new_r_CallBegin(ir_graph *irg, ir_node *block, ir_node *callee);
2564
2565 /** Constructor for a EndReg node.
2566  *
2567  * Used to represent regular procedure end in interprocedual view.
2568  *
2569  * @param *irg    The ir graph the node belong to.
2570  * @param *block  The block the node belong to.
2571  */
2572 ir_node *new_r_EndReg (ir_graph *irg, ir_node *block);
2573
2574 /** Constructor for a EndExcept node.
2575  *
2576  * Used to represent exceptional procedure end in interprocedural view.
2577  *
2578  * @param *irg    The ir graph the node belong to.
2579  * @param *block  The block the node belong to.
2580  */
2581 ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
2582
2583 /** Constructor for a Break node.
2584  *
2585  * Break represents control flow to a single control successor just as Jmp.
2586  * The blocks separated by a break may not be concatenated by an optimization.
2587  * It is used for the interprocedural representation where blocks are parted
2588  * behind Call nodes to represent the control flow to called procedures.
2589  *
2590  * @param *irg    The ir graph the node belong to.
2591  * @param *block  The block the node belong to.
2592  */
2593 ir_node *new_r_Break  (ir_graph *irg, ir_node *block);
2594
2595 /** Constructor for a Filter node.
2596  *
2597  * Constructor for a Filter node. Adds the node to the block in current_ir_block.
2598  * Filter is a node with two views used to construct the interprocedural view.
2599  * In intraprocedural view its semantics are identical to the Proj node.
2600  * In interprocedural view the Filter performs the Phi operation on method
2601  * parameters or results.  Other than a Phi a Filter node may not be removed
2602  * if it has only a single input.
2603  *
2604  * The constructor builds the Filter in intraprocedural view.
2605  *
2606  * @param *irg    The ir graph the node belong to.
2607  * @param *block  The block the node belong to.
2608  * @param *arg  The tuple value to project from.
2609  * @param *mode The mode of the projected value.
2610  * @param proj  The position in the tuple to project from.
2611  */
2612 ir_node *new_r_Filter (ir_graph *irg, ir_node *block, ir_node *arg,
2613                ir_mode *mode, long proj);
2614
2615 /** Constructor for a NoMem node.
2616  *
2617  * Returns the unique NoMem node of the graph.  The same as
2618  * get_irg_no_mem().
2619  *
2620  * @param *irg    The ir graph the node belongs to.
2621  */
2622 ir_node *new_r_NoMem  (ir_graph *irg);
2623
2624 /** Constructor for a Mux node.
2625  *
2626  * @param *irg      The ir graph the node belong to.
2627  * @param *block    The block the node belong to.
2628  * @param *sel      The ir_node that calculates the boolean select.
2629  * @param *ir_true  The ir_node that calculates the true result.
2630  * @param *ir_false The ir_node that calculates the false result.
2631  * @param *mode     The mode of the node (and it_true and ir_false).
2632  */
2633 ir_node *new_r_Mux  (ir_graph *irg, ir_node *block,
2634     ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2635
2636 /** Constructor for a Psi node.
2637  *
2638  * @param *irg      The ir graph the node belong to.
2639  * @param *block    The block the node belong to.
2640  * @param *arity    The arity of the conditions
2641  * @param *conds    The array of mode_b conditions, length must be equal arity
2642  * @param *vals     The array of mode values, length must be equal arity + 1
2643  * @param *mode     The mode of the node (must be the mode of all vals).
2644  */
2645 ir_node *new_r_Psi (ir_graph *irg, ir_node *block,
2646                     int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
2647
2648 /** Constructor for a CopyB node.
2649  *
2650  * @param *irg        The ir graph the node belong to.
2651  * @param *block      The block the node belong to.
2652  * @param *store      The current memory
2653  * @param *dst        The ir_node that represents the destination address.
2654  * @param *src        The ir_node that represents the source address.
2655  * @param *data_type  The type of the copied data
2656  */
2657 ir_node *new_r_CopyB(ir_graph *irg, ir_node *block,
2658     ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
2659
2660 /** Constructor for a InstOf node.
2661  *
2662  * A High-Level Type check.
2663  *
2664  * @param   *irg       The ir graph the node  belongs to.
2665  * @param   *block     The ir block the node belongs to.
2666  * @param   *store     The memory in which the object the entity should be selected
2667  *                     from is allocated.
2668  * @param   *objptr    A pointer to a object of a class type.
2669  * @param   *type      The type of which objptr must be.
2670  */
2671 ir_node *new_r_InstOf (ir_graph *irg, ir_node *block, ir_node *store,
2672                         ir_node *objptr, ir_type *type);
2673
2674 /** Constructor for a Raise node.
2675  *
2676  * A High-Level Exception throw.
2677  *
2678  * @param *irg   The ir graph the node  belongs to.
2679  * @param *block The ir block the node belongs to.
2680  * @param *store The current memory.
2681  * @param *obj   A pointer to the Except variable.
2682  */
2683 ir_node *new_r_Raise  (ir_graph *irg, ir_node *block,
2684                ir_node *store, ir_node *obj);
2685
2686 /** Constructor for a Bound node.
2687  *
2688  * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2689  *
2690  * @param *irg        The ir graph the node belong to.
2691  * @param *block      The block the node belong to.
2692  * @param *store      The current memory
2693  * @param *idx        The ir_node that represents an index.
2694  * @param *lower      The ir_node that represents the lower bound for the index.
2695  * @param *upper      The ir_node that represents the upper bound for the index.
2696  */
2697 ir_node *new_r_Bound(ir_graph *irg, ir_node *block,
2698     ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
2699
2700 /*-----------------------------------------------------------------------*/
2701 /* The block oriented interface                                          */
2702 /*-----------------------------------------------------------------------*/
2703
2704 /** Sets the current block in which the following constructors place the
2705  *  nodes they construct.
2706  *
2707  *  @param target  The new current block.
2708  */
2709 void     set_cur_block (ir_node *target);
2710
2711 /** Returns the current block of the current graph. */
2712 ir_node *get_cur_block(void);
2713
2714 /** Returns the fixed nodes  of the current graph. */
2715 #define get_cur_end_block()   get_irg_end_block(current_ir_graph)
2716 #define get_cur_end()         get_irg_end(current_ir_graph)
2717 #define get_cur_start_block() get_irg_start_block(current_ir_graph)
2718 #define get_cur_start()       get_irg_start(current_ir_graph)
2719
2720 /** Constructor for a Block node.
2721  *
2722  * Adds the block to the graph in current_ir_graph. Constructs a Block
2723  * with a fixed number of predecessors.  Does set current_block.  Can
2724  * be used with automatic Phi node construction.
2725  *
2726  * @param *db    A Pointer for debug information.
2727  * @param arity  The number of control predecessors.
2728  * @param in[]   An array of control predecessors.  The length of
2729  *               the array must be 'arity'.
2730  */
2731 ir_node *new_d_Block(dbg_info *db, int arity, ir_node *in[]);
2732
2733 /** Constructor for a Start node.
2734  *
2735  * Adds the node to the block in current_ir_block.
2736  *
2737  * @param *db    A pointer for debug information.
2738  */
2739 ir_node *new_d_Start  (dbg_info *db);
2740
2741 /** Constructor for a End node.
2742  *
2743  * Adds the node to the block in current_ir_block.
2744  *
2745  * @param *db     A pointer for debug information.
2746  */
2747 ir_node *new_d_End    (dbg_info *db);
2748
2749 /** Constructor for a Jmp node.
2750  *
2751  * Adds the node to the block in current_ir_block.
2752  *
2753  * Jmp represents control flow to a single control successor.
2754  *
2755  * @param *db     A pointer for debug information.
2756  */
2757 ir_node *new_d_Jmp    (dbg_info *db);
2758
2759 /** Constructor for an IJmp node.
2760  *
2761  * IJmp represents control flow to a single control successor not
2762  * statically known i.e. an indirect Jmp.
2763  *
2764  * @param *db     A pointer for debug information.
2765  * @param *tgt    The ir node representing the target address.
2766  */
2767 ir_node *new_d_IJmp   (dbg_info *db, ir_node *tgt);
2768
2769 /** Constructor for a Cond node.
2770  *
2771  * Adds the node to the block in current_ir_block.
2772  *
2773  * If c is mode_b represents a conditional branch (if/else). If c is
2774  * mode_Is/mode_Iu (?) represents a switch.  (Allocates dense Cond
2775  * node, default Proj is 0.)
2776  *
2777  * This is not consistent:  Input to Cond is Is, Proj has as proj number
2778  * longs.
2779  *
2780  * @param *db    A pointer for debug information.
2781  * @param *c     The conditions parameter.Can be of mode b or I_u.
2782  */
2783 ir_node *new_d_Cond   (dbg_info *db, ir_node *c);
2784
2785 /** Constructor for a Return node.
2786  *
2787  * Adds the node to the block in current_ir_block.
2788  *
2789  * Returns the memory an zero or more return values.  Only node that
2790  * can end regular control flow.
2791  *
2792  * @param *db    A pointer for debug information.
2793  * @param *store The state of memory.
2794  * @param arity  Number of array indices.
2795  * @param *in    Array with index inputs to the node.
2796  */
2797 ir_node *new_d_Return (dbg_info *db, ir_node *store, int arity, ir_node *in[]);
2798
2799 /** Constructor for a Const_type node.
2800  *
2801  * Adds the node to the block in current_ir_block.
2802  *
2803  * The constant represents a target value.  This constructor sets high
2804  * level type information for the constant value.
2805  *
2806  * @param *db    A pointer for debug information.
2807  * @param *mode  The mode of the operands and results.
2808  * @param *con   Points to an entry in the constant table. This pointer is
2809                  added to the attributes of the node.
2810  * @param *tp    The type of the constant.
2811  */
2812 ir_node *new_d_Const_type (dbg_info *db, ir_mode *mode, tarval *con, ir_type *tp);
2813
2814 /** Constructor for a Const node.
2815  *
2816  * Adds the node to the block in current_ir_block.
2817  *
2818  * Constructor for a Const node. The constant represents a target
2819  * value.  Sets the type information to type_unknown.  (No more
2820  * supported: If tv is entity derives a somehow useful type.)
2821  *
2822  * @param *db    A pointer for debug information.
2823  * @param *mode  The mode of the operands and results.
2824  * @param *con   Points to an entry in the constant table. This pointer is added
2825  *               to the attributes of the node.
2826  */
2827 ir_node *new_d_Const  (dbg_info *db, ir_mode *mode, tarval *con);
2828
2829 /** Constructor for a SymConst_type node.
2830  *
2831  *  Adds the node to the block in current_ir_block.
2832  *  This is the constructor for a symbolic constant.
2833  *    There are four kinds of symbolic constants:
2834  *    - type_tag  The symbolic constant represents a type tag.  The type the
2835  *                tag stands for is given explicitly.
2836  *    - size      The symbolic constant represents the size of a type.  The
2837  *                type of which the constant represents the size is given
2838  *                explicitly.
2839  *    - addr_name The symbolic constant represents the address of an entity
2840  *                (variable or method).  The variable is indicated by a name
2841  *                that is valid for linking.
2842  *    - addr_ent   The symbolic constant represents the address of an entity
2843  *                (variable or method).  The variable is given explicitly by
2844  *                a firm entity.
2845  *
2846  *    Inputs to the node:
2847  *      No inputs except the block it belongs to.
2848  *    Outputs of the node.
2849  *      An unsigned integer (I_u) or a pointer (P).
2850  *
2851  * @param *db     A pointer for debug information.
2852  * @param value   A type, entity or ident depending on the SymConst kind.
2853  * @param kind    The kind of the symbolic constant: symconst_type_tag, symconst_size
2854  *                or symconst_addr_name.
2855  * @param tp      The source type of the constant.
2856  */
2857 ir_node *new_d_SymConst_type (dbg_info *db, union symconst_symbol value, symconst_kind kind, ir_type *tp);
2858
2859 /** Constructor for a SymConst node.
2860  *
2861  *  Same as new_d_SymConst_type, except that it sets the type to type_unknown. */
2862 ir_node *new_d_SymConst (dbg_info *db, union symconst_symbol value, symconst_kind kind);
2863
2864 /** Constructor for a simpleSel node.
2865  *
2866  *  This is a shortcut for the new_d_Sel() constructor.  To be used for
2867  *  Sel nodes that do not select from an array, i.e., have no index
2868  *  inputs.  It adds the two parameters 0, NULL.
2869  *
2870  * @param   *db        A pointer for debug information.
2871  * @param   *store     The memory in which the object the entity should be
2872  *                     selected from is allocated.
2873  * @param   *objptr    The object from that the Sel operation selects a
2874  *                     single attribute out.
2875  * @param   *ent       The entity to select.
2876  */
2877 ir_node *new_d_simpleSel(dbg_info *db, ir_node *store, ir_node *objptr, entity *ent);
2878
2879 /** Constructor for a Sel node.
2880  *
2881  * The select node selects an entity (field or method) from an entity
2882  * with a compound type.  It explicitly specifies the entity selected.
2883  * Dynamically the node may select entities that overwrite the given
2884  * entity.  If the selected entity is an array element entity the Sel
2885  * node takes the required array indices as inputs.
2886  * Adds the node to the block in current_ir_block.
2887  *
2888  * @param   *db        A pointer for debug information.
2889  * @param   *store     The memory in which the object the entity should be selected
2890  *                     from is allocated.
2891  * @param   *objptr    A pointer to a compound entity the Sel operation selects a
2892  *                     single attribute from.
2893  * @param   arity      The number of array indices needed to select an array element entity.
2894  * @param   *in[]      If the compound entity is an array the indices of the selected
2895  *                     element entity.  The constructor copies this array.
2896  * @param   *ent       The entity to select.
2897  */
2898 ir_node *new_d_Sel    (dbg_info *db, ir_node *store, ir_node *objptr, int arity, ir_node *in[],
2899                      entity *ent);
2900
2901 /** Constructor for a Call node.
2902  *
2903  *  Represents all kinds of method and function calls.
2904  *  Adds the node to the block in current_ir_block.
2905  *
2906  * @param   *db     A pointer for debug information.
2907  * @param   *store  The actual store.
2908  * @param   *callee A pointer to the called procedure.
2909  * @param   arity   The number of procedure parameters.
2910  * @param   *in[]   An array with the pointers to the parameters. The constructor copies this array.
2911  * @param   *tp     Type information of the procedure called.
2912  */
2913 ir_node *new_d_Call   (dbg_info *db, ir_node *store, ir_node *callee, int arity, ir_node *in[],
2914              ir_type *tp);
2915
2916 /** Constructor for a Add node.
2917  *
2918  * Adds the node to the block in current_ir_block.
2919  *
2920  * @param   *db    A pointer for debug information.
2921  * @param   *op1   The first operand.
2922  * @param   *op2   The second operand.
2923  * @param   *mode  The mode of the operands and the result.
2924  */
2925 ir_node *new_d_Add    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2926
2927 /** Constructor for a Sub node.
2928  *
2929  * Adds the node to the block in current_ir_block.
2930  *
2931  * @param   *db    A pointer for debug information.
2932  * @param   *op1   The first operand.
2933  * @param   *op2   The second operand.
2934  * @param   *mode  The mode of the operands and the result.
2935  */
2936 ir_node *new_d_Sub    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2937
2938 /** Constructor for a Minus node.
2939  *
2940  * Adds the node to the block in current_ir_block.
2941  *
2942  * @param   *db    A pointer for debug information.
2943  * @param   *op    The operand .
2944  * @param   *mode  The mode of the operand and the result.
2945  */
2946 ir_node *new_d_Minus  (dbg_info *db, ir_node *op,  ir_mode *mode);
2947
2948 /** Constructor for a Mul node.
2949  *
2950  * Adds the node to the block in current_ir_block.
2951  *
2952  * @param   *db    A pointer for debug information.
2953  * @param   *op1   The first operand.
2954  * @param   *op2   The second operand.
2955  * @param   *mode  The mode of the operands and the result.
2956  */
2957 ir_node *new_d_Mul    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2958
2959 /** Constructor for a Quot node.
2960  *
2961  * Adds the node to the block in current_ir_block.
2962  *
2963  * @param   *db    A pointer for debug information.
2964  * @param   *memop The store needed to model exceptions
2965  * @param   *op1   The first operand.
2966  * @param   *op2   The second operand.
2967  */
2968 ir_node *new_d_Quot   (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
2969
2970 /** Constructor for a DivMod node.
2971  *
2972  * Adds the node to the block in current_ir_block.
2973  *
2974  * @param   *db    A pointer for debug information.
2975  * @param   *memop The store needed to model exceptions
2976  * @param   *op1   The first operand.
2977  * @param   *op2   The second operand.
2978  */
2979 ir_node *new_d_DivMod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
2980
2981 /** Constructor for a Div node.
2982  *
2983  * Adds the node to the block in current_ir_block.
2984  *
2985  * @param   *db    A pointer for debug information.
2986  * @param   *memop The store needed to model exceptions
2987  * @param   *op1   The first operand.
2988  * @param   *op2   The second operand.
2989  */
2990 ir_node *new_d_Div    (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
2991
2992 /** Constructor for a Mod node.
2993  *
2994  * Adds the node to the block in current_ir_block.
2995  *
2996  * @param   *db    A pointer for debug information.
2997  * @param   *memop The store needed to model exceptions
2998  * @param   *op1   The first operand.
2999  * @param   *op2   The second operand.
3000  */
3001 ir_node *new_d_Mod    (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
3002
3003 /** Constructor for a Abs node.
3004  *
3005  * Adds the node to the block in current_ir_block.
3006  *
3007  * @param   *db    A pointer for debug information.
3008  * @param   *op    The operand
3009  * @param   *mode  The mode of the operands and the result.
3010  */
3011 ir_node *new_d_Abs    (dbg_info *db, ir_node *op,                ir_mode *mode);
3012
3013 /** Constructor for a And node.
3014  *
3015  * Adds the node to the block in current_ir_block.
3016  *
3017  * @param   *db    A pointer for debug information.
3018  * @param   *op1   The first operand.
3019  * @param   *op2   The second operand.
3020  * @param   *mode  The mode of the operands and the result.
3021  */
3022 ir_node *new_d_And    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3023
3024 /** Constructor for a Or node.
3025  *
3026  * Adds the node to the block in current_ir_block.
3027  *
3028  * @param   *db    A pointer for debug information.
3029  * @param   *op1   The first operand.
3030  * @param   *op2   The second operand.
3031  * @param   *mode  The mode of the operands and the result.
3032  */
3033 ir_node *new_d_Or     (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3034
3035 /** Constructor for a Eor node.
3036  *
3037  * Adds the node to the block in current_ir_block.
3038  *
3039  * @param   *db    A pointer for debug information.
3040  * @param   *op1   The first operand.
3041  * @param   *op2   The second operand.
3042  * @param   *mode  The mode of the operands and the results.
3043  */
3044 ir_node *new_d_Eor    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3045
3046 /** Constructor for a Not node.
3047  *
3048  * Adds the node to the block in current_ir_block.
3049  *
3050  * @param   *db    A pointer for debug information.
3051  * @param   *op    The operand.
3052  * @param   *mode  The mode of the operand and the result.
3053  */
3054 ir_node *new_d_Not    (dbg_info *db, ir_node *op,                ir_mode *mode);
3055
3056 /** Constructor for a Shl node.
3057  *
3058  * Adds the node to the block in current_ir_block.
3059  *
3060  * @param   *db    A pointer for debug information.
3061  * @param   *op    The operand.
3062  * @param   *k     The number of bits to  shift the operand .
3063  * @param   *mode  The mode of the operand and the result.
3064  */
3065 ir_node *new_d_Shl    (dbg_info *db, ir_node *op,  ir_node *k,   ir_mode *mode);
3066
3067 /** Constructor for a Shr node.
3068  *
3069  * Adds the node to the block in current_ir_block.
3070  *
3071  * @param   *db    A pointer for debug information.
3072  * @param   *op    The operand.
3073  * @param   *k     The number of bits to  shift the operand .
3074  * @param   *mode  The mode of the operand and the result.
3075  */
3076 ir_node *new_d_Shr    (dbg_info *db, ir_node *op,  ir_node *k,   ir_mode *mode);
3077
3078 /** Constructor for a Shrs node.
3079  *
3080  * Adds the node to the block in current_ir_block.
3081  *
3082  * @param   *db    A pointer for debug information.
3083  * @param   *op    The operand.
3084  * @param   *k     The number of bits to  shift the operand .
3085  * @param   *mode  The mode of the operand and the result.
3086  */
3087 ir_node *new_d_Shrs   (dbg_info *db, ir_node *op,  ir_node *k,   ir_mode *mode);
3088
3089 /** Constructor for a Rot node.
3090  *
3091  * Adds the node to the block in current_ir_block.
3092  *
3093  * @param   *db    A pointer for debug information.
3094  * @param   *op    The operand.
3095  * @param   *k     The number of bits to rotate the operand.
3096  * @param   *mode  The mode of the operand.
3097  */
3098 ir_node *new_d_Rot    (dbg_info *db, ir_node *op,  ir_node *k,   ir_mode *mode);
3099
3100 /** Constructor for a Cmp node.
3101  *
3102  * Adds the node to the block in current_ir_block.
3103  *
3104  * @param   *db    A pointer for debug information.
3105  * @param   *op1   The first operand.
3106  * @param   *op2   The second operand.
3107  */
3108 ir_node *new_d_Cmp    (dbg_info *db, ir_node *op1, ir_node *op2);
3109
3110 /** Constructor for a Conv node.
3111  *
3112  * Adds the node to the block in current_ir_block.
3113  *
3114  * @param   *db    A pointer for debug information.
3115  * @param   *op    The operand.
3116  * @param   *mode  The mode of this the operand muss be converted .
3117  */
3118 ir_node *new_d_Conv   (dbg_info *db, ir_node *op, ir_mode *mode);
3119
3120 /** Constructor for a Cast node.
3121  *
3122  * High level type cast
3123  * Adds the node to the block in current_ir_block.
3124  *
3125  * @param   *db    A pointer for debug information.
3126  * @param   *op    The operand.
3127  * @param   *to_tp The type of this the operand muss be casted .
3128  */
3129 ir_node *new_d_Cast   (dbg_info *db, ir_node *op, ir_type *to_tp);
3130
3131 /** Constructor for a Carry node.
3132  *
3133  * Adds the node to the block in current_ir_block.
3134  *
3135  * @param   *db    A pointer for debug information.
3136  * @param   *op1   The first operand.
3137  * @param   *op2   The second operand.
3138  * @param   *mode  The mode of the operands and the result.
3139  */
3140 ir_node *new_d_Carry  (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3141
3142 /** Constructor for a Borrow node.
3143  *
3144  * Adds the node to the block in current_ir_block.
3145  *
3146  * @param   *db    A pointer for debug information.
3147  * @param   *op1   The first operand.
3148  * @param   *op2   The second operand.
3149  * @param   *mode  The mode of the operands and the result.
3150  */
3151 ir_node *new_d_Borrow (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3152
3153 /** Constructor for a Phi node.
3154  *
3155  * Adds the node to the block in current_ir_block.
3156  *
3157  * @param *db    A pointer for debug information.
3158  * @param arity  The number of predecessors
3159  * @param *in    Array with predecessors
3160  * @param *mode  The mode of it's inputs and output.
3161  */
3162 ir_node *new_d_Phi    (dbg_info *db, int arity, ir_node *in[], ir_mode *mode);
3163
3164 /** Constructor for a Load node.
3165  *
3166  * Adds the node to the block in current_ir_block.
3167  *
3168  * @param *db    A pointer for debug information.
3169  * @param *store The current memory
3170  * @param *addr  A pointer to the variable to be read in this memory.
3171  * @param *mode  The mode of the value to be loaded.
3172  */
3173 ir_node *new_d_Load   (dbg_info *db, ir_node *store, ir_node *addr, ir_mode *mode);
3174
3175 /** Constructor for a Store node.
3176  *
3177  * Adds the node to the block in current_ir_block.
3178  *
3179  * @param *db    A pointer for debug information.
3180  * @param *store The current memory
3181  * @param *addr  A pointer to the variable to be read in this memory.
3182  * @param *val   The value to write to this variable.
3183  */
3184 ir_node *new_d_Store  (dbg_info *db, ir_node *store, ir_node *addr, ir_node *val);
3185
3186 /** Constructor for a Alloc node.
3187  *
3188  * The Alloc node extends the memory by space for an entity of type alloc_type.
3189  * Adds the node to the block in current_ir_block.
3190  *
3191  * @param *db         A pointer for debug information.
3192  * @param *store      The memory which shall contain the new variable.
3193  * @param *size       The number of bytes to allocate.
3194  * @param *alloc_type The type of the allocated variable.
3195  * @param where       Where to allocate the variable, either heap_alloc or stack_alloc.
3196  */
3197 ir_node *new_d_Alloc  (dbg_info *db, ir_node *store, ir_node *size, ir_type *alloc_type,
3198                      where_alloc where);
3199
3200  /** Constructor for a Free node.
3201  *
3202  * Frees the memory occupied by the entity pointed to by the pointer
3203  * arg.  Type indicates the type of the entity the argument points to.
3204  * Adds the node to the block in current_ir_block.
3205  *
3206  * @param *db         A pointer for debug information.
3207  * @param *store      The memory which shall contain the new variable.
3208  * @param *ptr        The pointer to the object to free.
3209  * @param *size       The number of objects of type free_type to free in a sequence.
3210  * @param *free_type  The type of the freed variable.
3211  * @param where       Where the variable was allocated, either heap_alloc or stack_alloc.
3212  */
3213 ir_node *new_d_Free   (dbg_info *db, ir_node *store, ir_node *ptr, ir_node *size,
3214              ir_type *free_type, where_alloc where);
3215
3216 /** Constructor for a Sync node.
3217  *
3218  * Merges several memory values.  The node assumes that a variable
3219  * either occurs only in one of the memories, or it contains the same
3220  * value in all memories where it occurs.
3221  * Adds the node to the block in current_ir_block.
3222  *
3223  * @param *db       A pointer for debug information.
3224  * @param  arity    The number of memories to synchronize.
3225  * @param  **in     An array of pointers to nodes that produce an output of type
3226  *                  memory.  The constructor copies this array.
3227  */
3228 ir_node *new_d_Sync   (dbg_info *db, int arity, ir_node *in[]);
3229
3230 /** Constructor for a Proj node.
3231  *
3232  * Projects a single value out of a tuple.  The parameter proj gives the
3233  * position of the value within the tuple.
3234  * Adds the node to the block in current_ir_block.
3235  *
3236  * @param *db    A pointer for deubug information.
3237  * @param arg    A node producing a tuple.
3238  * @param *mode  The mode of the value to project.
3239  * @param proj   The position of the value in the tuple.
3240  */
3241 ir_node *new_d_Proj   (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3242
3243 /** Constructor for a defaultProj node.
3244  *
3245  * Represents the default control flow of a Switch-Cond node.
3246  * Adds the node to the block in current_ir_block.
3247  *
3248  * @param *db       A pointer for debug information.
3249  * @param arg       A node producing a tuple.
3250  * @param max_proj  The end  position of the value in the tuple.
3251  */
3252 ir_node *new_d_defaultProj (dbg_info *db, ir_node *arg, long max_proj);
3253
3254 /** Constructor for a Tuple node.
3255  *
3256  * This is an auxiliary node to replace a node that returns a tuple
3257  * without changing the corresponding Proj nodes.
3258  * Adds the node to the block in current_ir_block.
3259  *
3260  * @param *db     A pointer for debug information.
3261  * @param arity   The number of tuple elements.
3262  * @param **in    An array containing pointers to the nodes producing the tuple elements.
3263  */
3264 ir_node *new_d_Tuple  (dbg_info *db, int arity, ir_node *in[]);
3265
3266 /** Constructor for a Id node.
3267  *
3268  * This is an auxiliary node to replace a node that returns a single
3269  * value. Adds the node to the block in current_ir_block.
3270  *
3271  * @param *db     A pointer for debug information.
3272  * @param *val    The operand to Id.
3273  * @param *mode   The mode of *val.
3274  */
3275 ir_node *new_d_Id     (dbg_info *db, ir_node *val, ir_mode *mode);
3276
3277 /** Constructor for a Bad node.
3278  *
3279  * Returns the unique Bad node of the graph.  The same as
3280  * get_irg_bad().
3281  */
3282 ir_node *new_d_Bad    (void);
3283
3284 /** Constructor for a Confirm node.
3285  *
3286  * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3287  * Specifies constraints for a value.  To support dataflow analyses.
3288  *
3289  * Example: If the value never exceeds '100' this is expressed by placing a
3290  * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
3291  *
3292  * @param *db     A pointer for debug information.
3293  * @param *val    The value we express a constraint for
3294  * @param *bound  The value to compare against. Must be a firm node, typically a constant.
3295  * @param cmp     The compare operation.
3296  */
3297 ir_node *new_d_Confirm (dbg_info *db, ir_node *val, ir_node *bound, pn_Cmp cmp);
3298
3299 /** Constructor for an Unknown node.
3300  *
3301  * Represents an arbitrary value.  Places the node in
3302  * the start block.
3303  *
3304  * @param *m      The mode of the unknown value.
3305  */
3306 ir_node *new_d_Unknown(ir_mode *m);
3307
3308 /** Constructor for a CallBegin node.
3309  *
3310  * CallBegin represents control flow depending of the pointer value
3311  * representing the called method to the called methods.  The
3312  * constructor copies the method pointer input from the passed Call
3313  * node.Adds the node to the block in current_ir_block.
3314  *
3315  * @param *db     A pointer for debug information.
3316  * @param *callee The call node visible in the  intra procedural view.
3317  */
3318 ir_node *new_d_CallBegin(dbg_info *db, ir_node *callee);
3319
3320 /** Constructor for an EndReg node.
3321  *
3322  *Adds the node to the block in current_ir_block.
3323  *
3324  * @param *db     A pointer for debug information.
3325  */
3326 ir_node *new_d_EndReg (dbg_info *db);
3327
3328 /** Constructor for an EndExcept node.
3329  *
3330  * Used to represent regular procedure end in interprocedual view.
3331  * Adds the node to the block in current_ir_block.
3332  *
3333  * @param *db     A pointer for debug information.
3334  */
3335 ir_node *new_d_EndExcept(dbg_info *db);
3336
3337 /** Constructor for a Break node.
3338  *
3339  * Used to represent exceptional procedure end in interprocedural view.
3340  * Adds the node to the block in current_ir_block.
3341  *
3342  * Break represents control flow to a single control successor just as Jmp.
3343  * The blocks separated by a break may not be concatenated by an optimization.
3344  * It is used for the interprocedural representation where blocks are parted
3345  * behind Call nodes to represent the control flow to called procedures.
3346  *
3347  * @param *db     A pointer for debug information.
3348  */
3349 ir_node *new_d_Break (dbg_info *db);
3350
3351 /** Constructor for a Filter node.
3352  *
3353  * Constructor for a Filter node. Adds the node to the block in
3354  * current_ir_block.  Filter is a node with two views used to
3355  * construct the interprocedural view.  In intraprocedural view its
3356  * semantics are identical to the Proj node.  In interprocedural view
3357  * the Filter performs the Phi operation on method parameters or
3358  * results.  Other than a Phi a Filter node may not be removed if it
3359  * has only a single input.
3360  *
3361  * The constructor builds the Filter in intraprocedural view.
3362  *
3363  * @param *db   A pointer for debug information.
3364  * @param *arg  The tuple value to project from.
3365  * @param *mode The mode of the projected value.
3366  * @param proj  The position in the tuple to project from.
3367  */
3368 ir_node *new_d_Filter (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3369
3370
3371 /** Constructor for a NoMem node.
3372  *
3373  * Returns the unique NoMem node of the graph.  The same as
3374  * get_irg_no_mem().
3375  */
3376 ir_node *new_d_NoMem  (void);
3377
3378 /** Constructor for a Mux node.
3379  *
3380  * @param *db       A pointer for debug information.
3381  * @param *sel      The ir_node that calculates the boolean select.
3382  * @param *ir_true  The ir_node that calculates the true result.
3383  * @param *ir_false The ir_node that calculates the false result.
3384  * @param *mode     The mode of the node (and it_true and ir_false).
3385  */
3386 ir_node *new_d_Mux  (dbg_info *db, ir_node *sel,
3387     ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
3388
3389 /** Constructor for a Psi node.
3390  *
3391  * @param *db       A pointer for debug information.
3392  * @param *arity    The arity of the conditions
3393  * @param *conds    The array of mode_b conditions, length must be equal arity
3394  * @param *vals     The array of mode values, length must be equal arity + 1
3395  * @param *mode     The mode of the node (must be the mode of all vals).
3396  */
3397 ir_node *new_d_Psi (dbg_info *db,
3398                     int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
3399
3400 /** Constructor for a CopyB node.
3401  *
3402  * @param *db         A pointer for debug information.
3403  * @param *store      The current memory
3404  * @param *dst        The ir_node that represents the destination address.
3405  * @param *src        The ir_node that represents the source address.
3406  * @param *data_type  The type of the copied data
3407  */
3408 ir_node *new_d_CopyB(dbg_info *db, ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
3409
3410 /** Constructor for a InstOf node.
3411  *
3412  * A High-Level Type check.
3413  *
3414  * @param   *db        A pointer for debug information.
3415  * @param   *store     The memory in which the object the entity should be selected
3416  *                     from is allocated.
3417  * @param   *objptr    A pointer to a object of a class type.
3418  * @param   *type      The type of which objptr must be.
3419  */
3420 ir_node *new_d_InstOf (dbg_info *db, ir_node *store, ir_node *objptr, ir_type *type);
3421
3422 /** Constructor for a Raise node.
3423  *
3424  * A High-Level Exception throw.
3425  *
3426  * @param *db    A pointer for debug information.
3427  * @param *store The current memory.
3428  * @param *obj   A pointer to the Except variable.
3429  */
3430 ir_node *new_d_Raise  (dbg_info *db, ir_node *store, ir_node *obj);
3431
3432 /** Constructor for a Bound node.
3433  *
3434  * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
3435  *
3436  * @param *db         A pointer for debug information.
3437  * @param *store      The current memory
3438  * @param *idx        The ir_node that represents an index.
3439  * @param *lower      The ir_node that represents the lower bound for the index.
3440  * @param *upper      The ir_node that represents the upper bound for the index.
3441  */
3442 ir_node *new_d_Bound(dbg_info *db, ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
3443
3444 /*-----------------------------------------------------------------------*/
3445 /* The block oriented interface without debug support                    */
3446 /*-----------------------------------------------------------------------*/
3447
3448 /* Needed from the interface with debug support:
3449 void set_cur_block (ir_node *target);   */
3450
3451 /** Constructor for a Block node.
3452  *
3453  * Constructor for a Block node. Adds the block to the graph in
3454  * current_ir_graph.  Constructs a Block with a fixed number of
3455  * predecessors.  Does set current_block.  Can be used with automatic
3456  * Phi node construction.
3457  *
3458  * @param arity  The number of control predecessors.
3459  * @param in     An array of control predecessors.  The length of
3460  *               the array must be 'arity'.
3461  */
3462 ir_node *new_Block(int arity, ir_node *in[]);
3463
3464 /** Constructor for a Start node.
3465  *
3466  * Adds the node to the block in current_ir_block.
3467  *
3468  */
3469 ir_node *new_Start  (void);
3470
3471 /** Constructor for an End node.
3472  *
3473  * Adds the node to the block in current_ir_block.
3474  */
3475 ir_node *new_End    (void);
3476
3477 /** Constructor for an EndReg node.
3478  *
3479  * Used to represent regular procedure end in interprocedual view.
3480  * Adds the node to the block in current_ir_block.
3481  */
3482 ir_node *new_EndReg (void);
3483
3484 /** Constructor for an EndExpcept node.
3485  *
3486  *  Used to represent exceptional procedure end in interprocedural view.
3487  *  Adds the node to the block in current_ir_block.
3488  */
3489 ir_node *new_EndExcept(void);
3490
3491 /** Constructor for a Jump node.
3492  *
3493  * Adds the node to the block in current_ir_block.
3494  *
3495  * Jmp represents control flow to a single control successor.
3496  */
3497 ir_node *new_Jmp    (void);
3498
3499 /** Constructor for an IJmp node.
3500  *
3501  * IJmp represents control flow to a single control successor not
3502  * statically known i.e. an indirect Jmp.
3503  *
3504  * @param *tgt    The ir node representing the target address.
3505  */
3506 ir_node *new_IJmp   (ir_node *tgt);
3507
3508 /** Constructor for a Break node.
3509  * Break represents control flow to a single control successor just as Jmp.
3510  * The blocks separated by a break may not be concatenated by an optimization.
3511  * It is used for the interprocedural representation where blocks are parted
3512  * behind Call nodes to represent the control flow to called procedures.
3513  * Adds the node to the block in current_ir_block.
3514  */
3515 ir_node *new_Break  (void);
3516
3517 /** Constructor for a Cond node.
3518  *
3519  * If c is mode_b represents a conditional branch (if/else). If c is
3520  * mode_Is/mode_Iu (?) represents a switch.  (Allocates dense Cond
3521  * node, default Proj is 0.). Adds the node to the block in current_ir_block.
3522  *
3523  * This is not consistent:  Input to Cond is Is, Proj has as proj number
3524  * longs.
3525  *
3526  *
3527  * @param *c     The conditions parameter.Can be of mode b or I_u.
3528  */
3529 ir_node *new_Cond   (ir_node *c);
3530
3531 /** Constructor for a Return node.
3532  *
3533  * Returns the memory an zero or more return values.  Only node that
3534  * can end regular control flow. Adds the node to the block in current_ir_block.
3535  *
3536  * @param *store The state of memory.
3537  * @param arity  Number of array indices.
3538  * @param *in    Array with index inputs to the node.
3539  */
3540 ir_node *new_Return (ir_node *store, int arity, ir_node *in[]);
3541
3542 /** Constructor for a Const node.
3543  *
3544  * Constructor for a Const node. The constant represents a target
3545  * value.  Sets the type information to type_unknown.  (No more
3546  * supported: If tv is entity derives a somehow useful type.)
3547  * Adds the node to the block in current_ir_block.
3548  *
3549  * @param *mode  The mode of the operands and results.
3550  * @param *con   Points to an entry in the constant table. This pointer is
3551  *               added to the attributes of  the node.
3552  */
3553 ir_node *new_Const  (ir_mode *mode, tarval *con);
3554
3555 /**
3556  * Make a const from a long.
3557  * This is just convenience for the usual
3558  * <code>
3559  * new_Const(mode, tarval_from_long(mode, ...))
3560  * </code>
3561  * pain.
3562  * @param mode The mode for the const.
3563  * @param value The value of the constant.
3564  * @return A new const node.
3565  */
3566 ir_node *new_Const_long(ir_mode *mode, long value);
3567
3568 /** Constructor for a Const node.
3569  *
3570  * Derives mode from passed type. */
3571 ir_node *new_Const_type(tarval *con, ir_type *tp);
3572
3573 /** Constructor for a SymConst node.
3574  *
3575  * Adds the node to the block in current_ir_block.
3576  * This is the constructor for a symbolic constant.
3577  * There are four kinds of symbolic constants:
3578  *    -# type_tag  The symbolic constant represents a type tag.  The type the
3579  *                 tag stands for is given explicitly.
3580  *    -# size      The symbolic constant represents the size of a type.  The
3581  *                 type of which the constant represents the size is given
3582  *                 explicitly.
3583  *    -# addr_name The symbolic constant represents the address of an entity
3584  *                 (variable or method).  The variable is indicated by a name
3585  *                 that is valid for linking.
3586  *    -# addr_ent  The symbolic constant represents the address of an entity
3587  *                 (variable or method).  The variable is given explicitly by
3588  *                 a firm entity.
3589  *
3590  *    Inputs to the node:
3591  *      No inputs except the block it belongs to.
3592  *    Outputs of the node.
3593  *      An unsigned integer (I_u) or a pointer (P).
3594  *
3595  * @param value   A type or a ident depending on the SymConst kind.
3596  * @param kind    The kind of the symbolic constant: symconst_type_tag, symconst_size or symconst_addr_name.
3597  */
3598 ir_node *new_SymConst (union symconst_symbol value, symconst_kind kind);
3599
3600 /** Constructor for a simpelSel node.
3601  *
3602  *  This is a shortcut for the new_Sel() constructor.  To be used for
3603  *  Sel nodes that do not select from an array, i.e., have no index
3604  *  inputs.  It adds the two parameters 0, NULL.
3605  *
3606  * @param   *store     The memory in which the object the entity should be selected from is allocated.
3607  * @param   *objptr    The object from that the Sel operation selects a single attribute out.
3608  * @param   *ent       The entity to select.
3609  */
3610 ir_node *new_simpleSel(ir_node *store, ir_node *objptr, entity *ent);
3611
3612 /** Constructor for a Sel node.
3613  *
3614  * The select node selects an entity (field or method) from an entity
3615  * with a compound type.  It explicitly specifies the entity selected.
3616  * Dynamically the node may select entities that overwrite the given
3617  * entity.  If the selected entity is an array element entity the Sel
3618  * node takes the required array indices as inputs.
3619  * Adds the node to the block in current_ir_block.
3620  *
3621  * @param   *store     The memory in which the object the entity should be selected
3622  *                     from is allocated.
3623  * @param   *objptr    A pointer to a compound entity the Sel operation selects a
3624  *                     single attribute from.
3625  * @param   arity      The number of array indices needed to select an array element entity.
3626  * @param   *in[]      If the compound entity is an array the indices of the selected
3627  *                     element entity.  The constructor copies this array.
3628  * @param   *ent       The entity to select.
3629  */
3630 ir_node *new_Sel    (ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3631                      entity *ent);
3632
3633 /** Constructor for a Call node.
3634  *
3635  *  Adds the node to the block in current_ir_block.
3636  *  Represents all kinds of method and function calls.
3637  *
3638  * @param   *store  The actual store.
3639  * @param   *callee A pointer to the called procedure.
3640  * @param   arity   The number of procedure parameters.
3641  * @param   *in[]   An array with the pointers to the parameters. The constructor copies this array.
3642  * @param   *tp     Type information of the procedure called.
3643  */
3644 ir_node *new_Call   (ir_node *store, ir_node *callee, int arity, ir_node *in[],
3645                      ir_type *tp);
3646
3647 /** Constructor for a CallBegin node.
3648  *
3649  * CallBegin represents control flow depending of the pointer value
3650  * representing the called method to the called methods.  The
3651  * constructor copies the method pointer input from the passed Call
3652  * node. Adds the node to the block in current_ir_block.
3653  *
3654  * @param   *callee A pointer to the called procedure.
3655  */
3656 ir_node *new_CallBegin(ir_node *callee);
3657
3658 /** Constructor for a Add node.
3659  *
3660  * Adds the node to the block in current_ir_block.
3661  *
3662  * @param   *op1   The first operand.
3663  * @param   *op2   The second operand.
3664  * @param   *mode  The mode of the operands and the result.
3665  */
3666 ir_node *new_Add    (ir_node *op1, ir_node *op2, ir_mode *mode);
3667
3668 /** Constructor for a Sub node.
3669  *
3670  * Adds the node to the block in current_ir_block.
3671  *
3672  * @param   *op1   The first operand.
3673  * @param   *op2   The second operand.
3674  * @param   *mode  The mode of the operands and the result.
3675  */
3676 ir_node *new_Sub    (ir_node *op1, ir_node *op2, ir_mode *mode);
3677
3678 /** Constructor for a Minus node.
3679  *
3680  * Adds the node to the block in current_ir_block.
3681  *
3682  * @param   *op    The operand .
3683  * @param   *mode  The mode of the operand and the result.
3684  */
3685 ir_node *new_Minus  (ir_node *op,  ir_mode *mode);
3686
3687 /**
3688  * Constructor for a Mul node. Adds the node to the block in current_ir_block.
3689  *
3690  * @param   *op1   The first operand.
3691  * @param   *op2   The second operand.
3692  * @param   *mode  The mode of the operands and the result.
3693  */
3694 ir_node *new_Mul    (ir_node *op1, ir_node *op2, ir_mode *mode);
3695
3696 /** Constructor for a Quot node.
3697  *
3698  * Adds the node to the block in current_ir_block.
3699  *
3700  * @param   *memop The store needed to model exceptions
3701  * @param   *op1   The first operand.
3702  * @param   *op2   The second operand.
3703  */
3704 ir_node *new_Quot   (ir_node *memop, ir_node *op1, ir_node *op2);
3705
3706 /** Constructor for a DivMod node.
3707  *
3708  * Adds the node to the block in current_ir_block.
3709  *
3710  * @param   *memop The store needed to model exceptions
3711  * @param   *op1   The first operand.
3712  * @param   *op2   The second operand.
3713  */
3714 ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
3715
3716 /** Constructor for a Div node.
3717  *
3718  * Adds the node to the block in current_ir_block.
3719  *
3720  * @param   *memop The store needed to model exceptions
3721  * @param   *op1   The first operand.
3722  * @param   *op2   The second operand.
3723  */
3724 ir_node *new_Div    (ir_node *memop, ir_node *op1, ir_node *op2);
3725
3726 /** Constructor for a Mod node.
3727  *
3728  * Adds the node to the block in current_ir_block.
3729  *
3730  * @param   *memop The store needed to model exceptions
3731  * @param   *op1   The first operand.
3732  * @param   *op2   The second operand.
3733  */
3734 ir_node *new_Mod    (ir_node *memop, ir_node *op1, ir_node *op2);
3735
3736 /** Constructor for a Abs node.
3737  *
3738  * Adds the node to the block in current_ir_block.
3739  *
3740  * @param   *op    The operand
3741  * @param   *mode  The mode of the operands and the result.
3742  */
3743 ir_node *new_Abs    (ir_node *op,                ir_mode *mode);
3744
3745 /** Constructor for a And node.
3746  *
3747  * Adds the node to the block in current_ir_block.
3748  *
3749  * @param   *op1   The first operand.
3750  * @param   *op2   The second operand.
3751  * @param   *mode  The mode of the operands and the result.
3752  */
3753 ir_node *new_And    (ir_node *op1, ir_node *op2, ir_mode *mode);
3754
3755 /**
3756  * Constructor for a Or node. Adds the node to the block in current_ir_block.
3757  *
3758  * @param   *op1   The first operand.
3759  * @param   *op2   The second operand.
3760  * @param   *mode  The mode of the operands and the result.
3761  */
3762 ir_node *new_Or     (ir_node *op1, ir_node *op2, ir_mode *mode);
3763
3764 /**
3765  * Constructor for a Eor node. Adds the node to the block in current_ir_block.
3766  *
3767  * @param   *op1   The first operand.
3768  * @param   *op2   The second operand.
3769  * @param   *mode  The mode of the operands and the results.
3770  */
3771 ir_node *new_Eor    (ir_node *op1, ir_node *op2, ir_mode *mode);
3772
3773 /** Constructor for a Not node.
3774  *
3775  * Adds the node to the block in current_ir_block.
3776  *
3777  * @param   *op    The operand.
3778  * @param   *mode  The mode of the operand and the result.
3779  */
3780 ir_node *new_Not    (ir_node *op,                ir_mode *mode);
3781
3782 /** Constructor for a Shl node.
3783  *
3784  * Adds the node to the block in current_ir_block.
3785  *
3786  * @param   *op    The operand.
3787  * @param   *k     The number of bits to  shift the operand .
3788  * @param   *mode  The mode of the operand and the result.
3789  */
3790 ir_node *new_Shl    (ir_node *op,  ir_node *k,   ir_mode *mode);
3791
3792 /**
3793  * Constructor for a Shr node. Adds the node to the block in current_ir_block.
3794  *
3795  * @param   *op    The operand.
3796  * @param   *k     The number of bits to  shift the operand .
3797  * @param   *mode  The mode of the operand and the result.
3798  */
3799 ir_node *new_Shr    (ir_node *op,  ir_node *k,   ir_mode *mode);
3800
3801 /** Constructor for a Shrs node.
3802  *
3803  * Adds the node to the block in current_ir_block.
3804  *
3805  * @param   *op    The operand.
3806  * @param   *k     The number of bits to  shift the operand .
3807  * @param   *mode  The mode of the operand and the result.
3808  */
3809 ir_node *new_Shrs   (ir_node *op,  ir_node *k,   ir_mode *mode);
3810
3811 /** Constructor for a Rot node.
3812  *
3813  * Adds the node to the block in current_ir_block.
3814  *
3815  * @param   *op    The operand.
3816  * @param   *k     The number of bits to rotate the operand.
3817  * @param   *mode  The mode of the operand.
3818  */
3819 ir_node *new_Rot    (ir_node *op,  ir_node *k,   ir_mode *mode);
3820
3821 /** Constructor for a Cmp node.
3822  *
3823  * Adds the node to the block in current_ir_block.
3824  *
3825  * @param   *op1   The first operand.
3826  * @param   *op2   The second operand.
3827  */
3828 ir_node *new_Cmp    (ir_node *op1, ir_node *op2);
3829
3830 /** Constructor for a Conv node.
3831  *
3832  * Adds the node to the block in current_ir_block.
3833  *
3834  * @param   *op    The operand.
3835  * @param   *mode  The mode of this the operand muss be converted .
3836  */
3837 ir_node *new_Conv   (ir_node *op, ir_mode *mode);
3838
3839 /** Constructor for a Cast node.
3840  *
3841  * Adds the node to the block in current_ir_block.
3842  * High level type cast
3843  *
3844  * @param   *op    The operand.
3845  * @param   *to_tp The type of this the operand muss be casted .
3846  */
3847 ir_node *new_Cast   (ir_node *op, ir_type *to_tp);
3848
3849 /** Constructor for a Carry node.
3850  *
3851  * Adds the node to the block in current_ir_block.
3852  *
3853  * @param   *op1   The first operand.
3854  * @param   *op2   The second operand.
3855  * @param   *mode  The mode of the operands and the result.
3856  */
3857 ir_node *new_Carry  (ir_node *op1, ir_node *op2, ir_mode *mode);
3858
3859 /** Constructor for a Borrow node.
3860  *
3861  * Adds the node to the block in current_ir_block.
3862  *
3863  * @param   *op1   The first operand.
3864  * @param   *op2   The second operand.
3865  * @param   *mode  The mode of the operands and the result.
3866  */
3867 ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode);
3868
3869 /** Constructor for a Phi node.
3870  *
3871  * Adds the node to the block in current_ir_block.
3872  *
3873  * @param arity  The number of predecessors.
3874  * @param *in    Array with predecessors.
3875  * @param *mode  The mode of it's inputs and output.
3876  */
3877 ir_node *new_Phi    (int arity, ir_node *in[], ir_mode *mode);
3878
3879 /** Constructor for a Load node.
3880  *
3881  * @param *store  The current memory.
3882  * @param *addr   A pointer to the variable to be read in this memory.
3883  * @param *mode   The mode of the value to be loaded.
3884  */
3885 ir_node *new_Load   (ir_node *store, ir_node *addr, ir_mode *mode);
3886
3887 /** Constructor for a Store node.
3888  *
3889  * @param *store  The current memory.
3890  * @param *addr   A pointer to the variable to be read in this memory.
3891  * @param *val    The value to write to this variable.
3892  */
3893 ir_node *new_Store  (ir_node *store, ir_node *addr, ir_node *val);
3894
3895 /** Constructor for a Alloc node.
3896  *
3897  * The Alloc node extends the memory by space for an entity of type alloc_type.
3898  * Adds the node to the block in current_ir_block.
3899  *
3900  * @param *store      The memory which shall contain the new variable.
3901  * @param *size       The number of bytes to allocate.
3902  * @param *alloc_type The type of the allocated variable.
3903  * @param where       Where to allocate the variable, either heap_alloc or stack_alloc.
3904  */
3905 ir_node *new_Alloc  (ir_node *store, ir_node *size, ir_type *alloc_type,
3906                      where_alloc where);
3907
3908 /** Constructor for a Free node.
3909  *
3910  * Frees the memory occupied by the entity pointed to by the pointer
3911  * arg.  Type indicates the type of the entity the argument points to.
3912  * Adds the node to the block in current_ir_block.
3913  *
3914  * @param *store      The memory which shall contain the new variable.
3915  * @param *ptr        The pointer to the object to free.
3916  * @param *size       The number of objects of type free_type to free in a sequence.
3917  * @param *free_type  The type of the freed variable.
3918  * @param where       Where the variable was allocated, either heap_alloc or stack_alloc.
3919  */
3920 ir_node *new_Free   (ir_node *store, ir_node *ptr, ir_node *size,
3921                      ir_type *free_type, where_alloc where);
3922
3923 /** Constructor for a Sync node.
3924  *
3925  * Merges several memory values.  The node assumes that a variable
3926  * either occurs only in one of the memories, or it contains the same
3927  * value in all memories where it occurs.
3928  * Adds the node to the block in current_ir_block.
3929  *
3930  * @param  arity    The number of memories to synchronize.
3931  * @param  **in     An array of pointers to nodes that produce an output of type
3932  *                  memory.  The constructor copies this array.
3933  */
3934 ir_node *new_Sync   (int arity, ir_node *in[]);
3935
3936 /** Constructor for a Proj node.
3937  *
3938  * Projects a single value out of a tuple.  The parameter proj gives the
3939  * position of the value within the tuple.
3940  * Adds the node to the block in current_ir_block.
3941  *
3942  * @param arg    A node producing a tuple.
3943  * @param *mode  The mode of the value to project.
3944  * @param proj   The position of the value in the tuple.
3945  */
3946 ir_node *new_Proj   (ir_node *arg, ir_mode *mode, long proj);
3947
3948 /** Constructor for a Filter node.
3949  *
3950  * Constructor for a Filter node. Adds the node to the block in current_ir_block.
3951  * Filter is a node with two views used to construct the interprocedural view.
3952  * In intraprocedural view its semantics are identical to the Proj node.
3953  * In interprocedural view the Filter performs the Phi operation on method
3954  * parameters or results.  Other than a Phi a Filter node may not be removed
3955  * if it has only a single input.
3956  *
3957  * The constructor builds the Filter in intraprocedural view.
3958  *
3959  * @param *arg  The tuple value to project from.
3960  * @param *mode The mode of the projected value.
3961  * @param proj  The position in the tuple to project from.
3962  */
3963 ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj);
3964
3965 /** Constructor for a defaultProj node.
3966  *
3967  * Represents the default control flow of a Switch-Cond node.
3968  * Adds the node to the block in current_ir_block.
3969  *
3970  * @param arg       A node producing a tuple.
3971  * @param max_proj  The end  position of the value in the tuple.
3972  */
3973 ir_node *new_defaultProj (ir_node *arg, long max_proj);
3974
3975 /** Constructor for a Tuple node.
3976  *
3977  * This is an auxiliary node to replace a node that returns a tuple
3978  * without changing the corresponding Proj nodes.
3979  * Adds the node to the block in current_ir_block.
3980  *
3981  * @param arity   The number of tuple elements.
3982  * @param **in    An array containing pointers to the nodes producing the tuple elements.
3983  */
3984 ir_node *new_Tuple  (int arity, ir_node *in[]);
3985
3986 /** Constructor for an Id node.
3987  *
3988  * This is an auxiliary node to replace a node that returns a single
3989  * value. Adds the node to the block in current_ir_block.
3990  *
3991  * @param *val    The operand to Id.
3992  * @param *mode   The mode of *val.
3993  */
3994 ir_node *new_Id     (ir_node *val, ir_mode *mode);
3995
3996 /** Constructor for a Bad node.
3997  *
3998  * Returns the unique Bad node of the graph.  The same as
3999  * get_irg_bad().
4000  */
4001 ir_node *new_Bad    (void);
4002
4003 /** Constructor for a Confirm node.
4004  *
4005  * Specifies constraints for a value.  To support dataflow analyses.
4006  * Adds the node to the block in current_ir_block.
4007  *
4008  * Example: If the value never exceeds '100' this is expressed by placing a
4009  * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
4010  *
4011  * @param *val    The value we express a constraint for
4012  * @param *bound  The value to compare against. Must be a firm node, typically a constant.
4013  * @param cmp     The compare operation.
4014  */
4015 ir_node *new_Confirm (ir_node *val, ir_node *bound, pn_Cmp cmp);
4016
4017 /** Constructor for an Unknown node.
4018  *
4019  * Represents an arbitrary value.  Places the node in
4020  * the start block.
4021  *
4022  * @param *m      The mode of the unknown value.
4023  */
4024 ir_node *new_Unknown(ir_mode *m);
4025
4026 /** Constructor for a NoMem node.
4027  *
4028  * Returns the unique NoMem node of the graph.  The same as
4029  * get_irg_no_mem().
4030  */
4031 ir_node *new_NoMem  (void);
4032
4033 /** Constructor for a Mux node.
4034  *
4035  * Adds the node to the block in current_ir_block.
4036  *
4037  * @param *sel      The ir_node that calculates the boolean select.
4038  * @param *ir_true  The ir_node that calculates the true result.
4039  * @param *ir_false The ir_node that calculates the false result.
4040  * @param *mode     The mode of the node (and it_true and ir_false).
4041  */
4042 ir_node *new_Mux  (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
4043
4044 /** Constructor for a Psi node.
4045  *
4046  * @param *arity    The arity of the conditions
4047  * @param *conds    The array of mode_b conditions, length must be equal arity
4048  * @param *vals     The array of mode values, length must be equal arity + 1
4049  * @param *mode     The mode of the node (must be the mode of all vals).
4050  */
4051 ir_node *new_Psi (int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
4052
4053 /** Constructor for a CopyB node.
4054  *
4055  * Adds the node to the block in current_ir_block.
4056  *
4057  * @param *store      The current memory
4058  * @param *dst        The ir_node that represents the destination address.
4059  * @param *src        The ir_node that represents the source address.
4060  * @param *data_type  The type of the copied data
4061  */
4062 ir_node *new_CopyB(ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
4063
4064 /** Constructor for a InstOf node.
4065  *
4066  * A High-Level Type check.
4067  *
4068  * @param   *store     The memory in which the object the entity should be selected
4069  *                     from is allocated.
4070  * @param   *objptr    A pointer to a object of a class type.
4071  * @param   *type      The type of which objptr must be.
4072  */
4073 ir_node *new_InstOf (ir_node *store, ir_node *objptr, ir_type *type);
4074
4075 /**Constructor for a Raise node.
4076  *
4077  * A High-Level Exception throw.
4078  *
4079  * @param *store The current memory.
4080  * @param *obj   A pointer to the Except variable.
4081  */
4082 ir_node *new_Raise  (ir_node *store, ir_node *obj);
4083
4084 /** Constructor for a Bound node.
4085  *
4086  * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
4087  *
4088  * Adds the node to the block in current_ir_block.
4089  *
4090  * @param *store      The current memory
4091  * @param *idx        The ir_node that represents an index.
4092  * @param *lower      The ir_node that represents the lower bound for the index.
4093  * @param *upper      The ir_node that represents the upper bound for the index.
4094  */
4095 ir_node *new_Bound(ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
4096
4097 /*---------------------------------------------------------------------*/
4098 /* The comfortable interface.                                          */
4099 /* Supports automatic Phi node construction.                           */
4100 /* All routines of the block oriented interface except new_Block are   */
4101 /* needed also.                                                        */
4102 /*---------------------------------------------------------------------*/
4103
4104 /** Create an immature block.
4105  *
4106  * An immature block has an unknown number of predecessors.  Predecessors
4107  * can be added with add_immBlock_pred().  Once all predecessors are
4108  * added the block must be matured.
4109  *
4110  * Adds the block to the graph in current_ir_graph. Does set
4111  * current_block.  Can be used with automatic Phi node construction.
4112  * This constructor can only be used if the graph is in
4113  * state_building.
4114  */
4115 ir_node *new_d_immBlock (dbg_info *db);
4116 ir_node *new_immBlock (void);
4117
4118 /** Add a control flow edge to an immature block. */
4119 void add_immBlock_pred (ir_node *immblock, ir_node *jmp);
4120
4121 /** Finalize a Block node, when all control flows are known. */
4122 void mature_immBlock (ir_node *block);
4123 #define mature_cur_block() mature_immBlock(get_cur_block());
4124
4125
4126 /** Get the current value of a local variable.
4127  *
4128  * Use this function to obtain the last definition of the local variable
4129  * associated with pos.  Pos may not exceed the value passed as n_loc
4130  * to new_ir_graph.  This call automatically inserts Phi nodes.
4131  *
4132  * @param *db    A pointer for debug information.
4133  * @param  pos   The position/id of the local variable.
4134  * @param *mode  The mode of the value to get.
4135  */
4136 ir_node *get_d_value (dbg_info *db, int pos, ir_mode *mode);
4137 ir_node *get_value (int pos, ir_mode *mode);
4138
4139 /** Remark a new definition of a variable.
4140  *
4141  * Use this function to remember a new definition of the value
4142  * associated with pos. Pos may not exceed the value passed as n_loc
4143  * to new_ir_graph.  This call is needed to automatically inserts Phi
4144  * nodes.
4145  *
4146  * @param  pos   The position/id of the local variable.
4147  * @param *value The new value written to the local variable.
4148  */
4149 void set_value (int pos, ir_node *value);
4150
4151 /** Get the current memory state.
4152  *
4153  * Use this function to obtain the last definition of the memory
4154  * state.  This call automatically inserts Phi nodes for the memory
4155  * state value.
4156  */
4157 ir_node *get_store (void);
4158
4159 /** Remark a new definition of the memory state.
4160  *
4161  * Use this function to remember a new definition of the memory state.
4162  * This call is needed to automatically inserts Phi nodes.
4163  *
4164  * @param *store The new memory state.
4165  */
4166 void set_store (ir_node *store);
4167
4168 /** keep this node alive even if End is not control-reachable from it
4169  *
4170  * @param ka The node to keep alive.
4171  */
4172 void keep_alive (ir_node *ka);
4173
4174 /** Returns the frame type of the current graph */
4175 ir_type *get_cur_frame_type(void);
4176
4177
4178 /* --- initialize and finalize ir construction --- */
4179
4180 /** Puts the graph into state "phase_high" */
4181 #define irg_finalize_cons(irg) set_irg_phase_state(irg, phase_high)
4182
4183 /** Puts the program and all graphs into state phase_high.
4184  *
4185  * This also remarks, the construction of types is finished,
4186  * e.g., that no more subtypes will be added.  */
4187 void irp_finalize_cons(void);
4188
4189 /* --- Initialization --- */
4190
4191 /**
4192  * This function is called, whenever a local variable is used before definition
4193  *
4194  * @param irg       the IR graph on which this happens
4195  * @param mode      the mode of the local var
4196  * @param pos       position chosen be the frontend for this variable (n_loc)
4197  *
4198  * @return a firm node of mode @p mode that initializes the var at position pos
4199  *
4200  * @note
4201  *      Do not return NULL!
4202  *      If this function is not set, FIRM will create a const node with tarval BAD.
4203  *      Use set_irg_loc_description()/get_irg_loc_description() to assign additional
4204  *      informations to local variables.
4205  */
4206 typedef ir_node *uninitialized_local_variable_func_t(ir_graph *irg, ir_mode *mode, int pos);
4207
4208 #endif /* _FIRM_IR_IRCONS_H_ */