Add test functions for machine, machine_operand and machine_user bits
[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 _IRCONS_H_
1091 #define _IRCONS_H_
1092
1093 #include "firm_common.h"
1094 #include "irnode.h"
1095 #include "dbginfo.h"
1096
1097 /*-------------------------------------------------------------------------*/
1098 /* The raw interface                                                       */
1099 /*-------------------------------------------------------------------------*/
1100
1101 /** Constructor for a Block node.
1102  *
1103  * Constructs a mature block with the given predecessors.  Use Unknown
1104  * nodes as predecessors to construct a block if the number of
1105  * predecessors is known, but not the predecessors themselves.  This
1106  * constructor does not set current_block.  It not be used with
1107  * automatic Phi node construction.
1108  *
1109  * @param *db    A Pointer for  debug information.
1110  * @param irg    The ir graph the block belongs to.
1111  * @param arity  The number of control predecessors.
1112  * @param in[]   An array of control predecessors.  The length of
1113  *               the array must be 'arity'.  The constructor copies this array.
1114  */
1115 ir_node *new_rd_Block  (dbg_info *db, ir_graph *irg,  int arity, ir_node *in[]);
1116
1117 /** Constructor for a Start node.
1118  *
1119  * @param *db    A pointer for debug information.
1120  * @param *irg   The ir graph the node belongs to.
1121  * @param *block The ir block the node belongs to.
1122  */
1123 ir_node *new_rd_Start  (dbg_info *db, ir_graph *irg, ir_node *block);
1124
1125 /** Constructor for a End node.
1126  *
1127  * @param *db    A pointer for  debug information.
1128  * @param *irg   The ir graph the node  belongs to.
1129  * @param *block The ir block the node belongs to.
1130  */
1131 ir_node *new_rd_End    (dbg_info *db, ir_graph *irg, ir_node *block);
1132
1133 /** Constructor for a Jmp node.
1134  *
1135  * Jmp represents control flow to a single control successor.
1136  *
1137  * @param *db     A pointer for debug information.
1138  * @param *irg    The ir graph the node belongs to.
1139  * @param *block  The ir block the node belongs to.
1140  */
1141 ir_node *new_rd_Jmp    (dbg_info *db, ir_graph *irg, ir_node *block);
1142
1143 /** Constructor for an IJmp node.
1144  *
1145  * IJmp represents control flow to a single control successor not
1146  * statically known i.e. an indirect Jmp.
1147  *
1148  * @param *db     A pointer for debug information.
1149  * @param *irg    The ir graph the node belongs to.
1150  * @param *block  The ir block the node belongs to.
1151  * @param *tgt    The ir node representing the target address.
1152  */
1153 ir_node *new_rd_IJmp   (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *tgt);
1154
1155 /** Constructor for a Break node.
1156  *
1157  * Break represents control flow to a single control successor just as Jmp.
1158  * The blocks separated by a break may not be concatenated by an optimization.
1159  * It is used for the interprocedural representation where blocks are parted
1160  * behind Call nodes to represent the control flow to called procedures.
1161  *
1162  * @param *db     A pointer for debug information.
1163  * @param *irg    The ir graph the node belong to.
1164  * @param *block  The block the node belong to.
1165  */
1166 ir_node *new_rd_Break  (dbg_info *db, ir_graph *irg, ir_node *block);
1167
1168 /** Constructor for a Cond node.
1169  *
1170  * If c is mode_b represents a conditional branch (if/else). If c is
1171  * mode_Is/mode_Iu (?) represents a switch.  (Allocates dense Cond
1172  * node, default Proj is 0.)
1173  *
1174  * This is not consistent:  Input to Cond is Is, Proj has as proj number
1175  * longs.
1176  *
1177  * @param *db    A pointer for debug information.
1178  * @param *irg   The ir graph the node  belongs to.
1179  * @param *block The ir block the node belongs to.
1180  * @param *c     The conditions parameter. Can be of mode b or I_u.
1181  */
1182 ir_node *new_rd_Cond   (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *c);
1183
1184 /** Constructor for a Return node.
1185  *
1186  * Returns the memory an zero or more return values.  Only node that
1187  * can end regular control flow.
1188  *
1189  * @param *db    A pointer for debug information.
1190  * @param *irg   The ir graph the node  belongs to.
1191  * @param *block The ir block the node belongs to.
1192  * @param *store The state of memory.
1193  * @param arity  Number of return values.
1194  * @param *in    Array of length arity with return values.  The constructor copies this array.
1195  */
1196 ir_node *new_rd_Return (dbg_info *db, ir_graph *irg, ir_node *block,
1197                         ir_node *store, int arity, ir_node *in[]);
1198
1199 /** Constructor for a Const_type node.
1200  *
1201  * The constant represents a target value.  This constructor sets high
1202  * level type information for the constant value.
1203  *
1204  * @param *db    A pointer for debug information.
1205  * @param *irg   The ir graph the node  belongs to.
1206  * @param *block The ir block the node belongs to.
1207  * @param *mode  The mode of the operands and results.
1208  * @param *con   Points to an entry in the constant table.
1209  * @param *tp    The type of the constant.
1210  */
1211 ir_node *new_rd_Const_type (dbg_info *db, ir_graph *irg, ir_node *block,
1212                 ir_mode *mode, tarval *con, ir_type *tp);
1213
1214 /** Constructor for a Const node.
1215  *
1216  * Constructor for a Const node. The constant represents a target
1217  * value.  Sets the type information to type_unknown.  (No more
1218  * supported: If tv is entity derives a somehow useful type.)
1219  *
1220  * @param *db    A pointer for debug information.
1221  * @param *irg   The ir graph the node  belongs to.
1222  * @param *block The ir block the node belongs to.
1223  * @param *mode  The mode of the operands and results.
1224  * @param *con   Points to an entry in the constant table.
1225  */
1226 ir_node *new_rd_Const  (dbg_info *db, ir_graph *irg, ir_node *block,
1227                ir_mode *mode, tarval *con);
1228
1229 /** Constructor for a SymConst_type node.
1230  *
1231  *  This is the constructor for a symbolic constant.
1232  *    There are four kinds of symbolic constants:
1233  *    - type_tag  The symbolic constant represents a type tag.  The type the
1234  *                tag stands for is given explicitly.
1235  *    - size      The symbolic constant represents the size of a type.  The
1236  *                type of which the constant represents the size is given
1237  *                explicitly.
1238  *    - addr_name The symbolic constant represents the address of an entity
1239  *                (variable or method).  The variable is indicated by a name
1240  *                that is valid for linking.
1241  *    - addr_ent   The symbolic constant represents the address of an entity
1242  *                (variable or method).  The variable is given explicitly by
1243  *                a firm entity.
1244  *
1245  *    Inputs to the node:
1246  *      No inputs except the block it belongs to.
1247  *    Outputs of the node.
1248  *      An unsigned integer (I_u) or a pointer (P).
1249  *
1250  *    Mention union in declaration so that the firmjni generator recognizes that
1251  *    it can not cast the argument to an int.
1252  *
1253  * @param *db     A pointer for debug information.
1254  * @param *irg    The ir graph the node  belongs to.
1255  * @param *block  The ir block the node belongs to.
1256  * @param symkind The kind of the symbolic constant: type_tag, size, addr_name or addr_ent.
1257  * @param value   A type, entity or a ident depending on the SymConst kind.
1258  * @param tp      The source type of the constant.
1259  */
1260 ir_node *new_rd_SymConst_type (dbg_info *db, ir_graph *irg, ir_node *block, union symconst_symbol value,
1261                                symconst_kind symkind, ir_type *tp);
1262
1263 /** Constructor for a SymConst node.
1264  *
1265  *  Same as new_rd_SymConst_type, except that it sets the type to type_unknown. */
1266 ir_node *new_rd_SymConst (dbg_info *db, ir_graph *irg, ir_node *block,
1267                           union symconst_symbol value, symconst_kind symkind);
1268
1269 /** Constructor for a SymConst addr_ent node.
1270  *
1271  * Same as new_rd_SymConst_type, except that the constructor is tailored for
1272  * symconst_addr_ent.
1273  * Adds the SymConst to the start block of irg. */
1274 ir_node *new_rd_SymConst_addr_ent (dbg_info *db, ir_graph *irg, entity *symbol, ir_type *tp);
1275
1276 /** Constructor for a SymConst addr_name node.
1277  *
1278  * Same as new_rd_SymConst_type, except that the constructor is tailored for
1279  * symconst_addr_ent.
1280  * Adds the SymConst to the start block of irg. */
1281 ir_node *new_rd_SymConst_addr_name (dbg_info *db, ir_graph *irg, ident *symbol, ir_type *tp);
1282
1283 /** Constructor for a SymConst type_tag node.
1284  *
1285  * Same as new_rd_SymConst_type, except that the constructor is tailored for
1286  * symconst_addr_ent.
1287  * Adds the SymConst to the start block of irg. */
1288 ir_node *new_rd_SymConst_type_tag (dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp);
1289
1290 /** Constructor for a SymConst size node.
1291  *
1292  * Same as new_rd_SymConst_type, except that the constructor is tailored for
1293  * symconst_addr_ent.
1294  * Adds the SymConst to the start block of irg. */
1295 ir_node *new_rd_SymConst_size (dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp);
1296
1297 /** Constructor for a simpleSel node.
1298  *
1299  *  This is a shortcut for the new_rd_Sel() constructor.  To be used for
1300  *  Sel nodes that do not select from an array, i.e., have no index
1301  *  inputs.  It adds the two parameters 0, NULL.
1302  *
1303  * @param   *db        A pointer for debug information.
1304  * @param   *irg       The ir graph the node  belongs to.
1305  * @param   *block     The ir block the node belongs to.
1306  * @param   *store     The memory in which the object the entity should be
1307  *                     selected from is allocated.
1308  * @param   *objptr    The object from that the Sel operation selects a
1309  *                     single attribute out.
1310  * @param   *ent       The entity to select.
1311  */
1312 ir_node *new_rd_simpleSel (dbg_info *db, ir_graph *irg, ir_node *block,
1313                   ir_node *store, ir_node *objptr, entity *ent);
1314
1315 /** Constructor for a Sel node.
1316  *
1317  * The select node selects an entity (field or method) from an entity
1318  * with a compound type.  It explicitly specifies the entity selected.
1319  * Dynamically the node may select entities that overwrite the given
1320  * entity.  If the selected entity is an array element entity the Sel
1321  * node takes the required array indices as inputs.
1322  *
1323  * @param   *db        A pointer for debug information.
1324  * @param   *irg       The ir graph the node  belongs to.
1325  * @param   *block     The ir block the node belongs to.
1326  * @param   *store     The memory in which the object the entity should be selected
1327  *                     from is allocated.
1328  * @param   *objptr    A pointer to a compound entity the Sel operation selects a
1329  *                     single attribute from.
1330  * @param   *n_index   The number of array indices needed to select an array element entity.
1331  * @param   *index[]   If the compound entity is an array the indices of the selected
1332  *                     element entity.  The constructor copies this array.
1333  * @param   *ent       The entity to select.
1334  */
1335 ir_node *new_rd_Sel    (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1336                         ir_node *objptr, int n_index, ir_node *index[], entity *ent);
1337
1338 /** Constructor for a Call node.
1339  *
1340  *  Represents all kinds of method and function calls.
1341  *
1342  * @param   *db     A pointer for debug information.
1343  * @param   *irg    The ir graph the node  belongs to.
1344  * @param   *block  The ir block the node belongs to.
1345  * @param   *store  The current memory state.
1346  * @param   *callee A pointer to the called procedure.
1347  * @param   arity   The number of procedure parameters.
1348  * @param   *in[]   An array with the procedure parameters. The constructor copies this array.
1349  * @param   *tp     Type information of the procedure called.
1350  */
1351 ir_node *new_rd_Call   (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1352                         ir_node *callee, int arity, ir_node *in[], ir_type *tp);
1353
1354 /** Constructor for a Add node.
1355  *
1356  * @param   *db    A pointer for debug information.
1357  * @param   *irg   The ir graph the node  belongs to.
1358  * @param   *block The ir block the node belongs to.
1359  * @param   *op1   The first operand.
1360  * @param   *op2   The second operand.
1361  * @param   *mode  The mode of the operands and the result.
1362  */
1363 ir_node *new_rd_Add    (dbg_info *db, ir_graph *irg, ir_node *block,
1364                         ir_node *op1, ir_node *op2, ir_mode *mode);
1365
1366 /** Constructor for a Sub node.
1367  *
1368  * @param   *db    A pointer for debug information.
1369  * @param   *irg   The ir graph the node  belongs to.
1370  * @param   *block The ir block the node belongs to.
1371  * @param   *op1   The first operand.
1372  * @param   *op2   The second operand.
1373  * @param   *mode  The mode of the operands and the result.
1374  */
1375 ir_node *new_rd_Sub    (dbg_info *db, ir_graph *irg, ir_node *block,
1376                         ir_node *op1, ir_node *op2, ir_mode *mode);
1377
1378 /** Constructor for a Minus node.
1379  *
1380  * @param   *db    A pointer for debug information.
1381  * @param   *irg   The ir graph the node  belongs to.
1382  * @param   *block The ir block the node belongs to.
1383  * @param   *op    The operand .
1384  * @param   *mode  The mode of the operand and the result.
1385  */
1386 ir_node *new_rd_Minus  (dbg_info *db, ir_graph *irg, ir_node *block,
1387                         ir_node *op,  ir_mode *mode);
1388
1389 /** Constructor for a Mul node.
1390  *
1391  * @param   *db    A pointer for debug information.
1392  * @param   *irg   The ir graph the node  belongs to.
1393  * @param   *block The ir block the node belongs to.
1394  * @param   *op1   The first operand.
1395  * @param   *op2   The second operand.
1396  * @param   *mode  The mode of the operands and the result.
1397  */
1398 ir_node *new_rd_Mul    (dbg_info *db, ir_graph *irg, ir_node *block,
1399                ir_node *op1, ir_node *op2, ir_mode *mode);
1400
1401 /** Constructor for a Quot node.
1402  *
1403  * @param   *db    A pointer for debug information.
1404  * @param   *irg   The ir graph the node  belongs to.
1405  * @param   *block The ir block the node belongs to.
1406  * @param   *memop The store needed to model exceptions
1407  * @param   *op1   The first operand.
1408  * @param   *op2   The second operand.
1409  */
1410 ir_node *new_rd_Quot   (dbg_info *db, ir_graph *irg, ir_node *block,
1411                ir_node *memop, ir_node *op1, ir_node *op2);
1412
1413 /** Constructor for a DivMod node.
1414  *
1415  * @param   *db    A pointer for debug information.
1416  * @param   *irg   The ir graph the node  belongs to.
1417  * @param   *block The ir block the node belongs to.
1418  * @param   *memop The store needed to model exceptions
1419  * @param   *op1   The first operand.
1420  * @param   *op2   The second operand.
1421  */
1422 ir_node *new_rd_DivMod (dbg_info *db, ir_graph *irg, ir_node *block,
1423                ir_node *memop, ir_node *op1, ir_node *op2);
1424
1425 /** Constructor for a Div node.
1426  *
1427  * @param   *db    A pointer for debug information.
1428  * @param   *irg   The ir graph the node  belongs to.
1429  * @param   *block The ir block the node belongs to.
1430  * @param   *memop The store needed to model exceptions
1431  * @param   *op1   The first operand.
1432  * @param   *op2   The second operand.
1433  */
1434 ir_node *new_rd_Div    (dbg_info *db, ir_graph *irg, ir_node *block,
1435                ir_node *memop, ir_node *op1, ir_node *op2);
1436
1437 /** Constructor for a Mod node.
1438  *
1439  * @param   *db    A pointer for debug information.
1440  * @param   *irg   The ir graph the node  belongs to.
1441  * @param   *block The ir block the node belongs to.
1442  * @param   *memop The store needed to model exceptions
1443  * @param   *op1   The first operand.
1444  * @param   *op2   The second operand.
1445  */
1446 ir_node *new_rd_Mod    (dbg_info *db, ir_graph *irg, ir_node *block,
1447                         ir_node *memop, ir_node *op1, ir_node *op2);
1448
1449 /** Constructor for a Abs node.
1450  *
1451  * @param   *db    A pointer for debug information.
1452  * @param   *irg   The ir graph the node  belongs to.
1453  * @param   *block The ir block the node belongs to.
1454  * @param   *op    The operand
1455  * @param   *mode  The mode of the operands and the result.
1456  */
1457 ir_node *new_rd_Abs    (dbg_info *db, ir_graph *irg, ir_node *block,
1458                        ir_node *op, ir_mode *mode);
1459
1460 /** Constructor for a And node.
1461  *
1462  * @param   *db    A pointer for debug information.
1463  * @param   *irg   The ir graph the node  belongs to.
1464  * @param   *block The ir block the node belongs to.
1465  * @param   *op1   The first operand.
1466  * @param   *op2   The second operand.
1467  * @param   *mode  The mode of the operands and the result.
1468  */
1469 ir_node *new_rd_And    (dbg_info *db, ir_graph *irg, ir_node *block,
1470                         ir_node *op1, ir_node *op2, ir_mode *mode);
1471
1472 /** Constructor for a Or node.
1473  *
1474  * @param   *db    A pointer for debug information.
1475  * @param   *irg   The ir graph the node  belongs to.
1476  * @param   *block The ir block the node belongs to.
1477  * @param   *op1   The first operand.
1478  * @param   *op2   The second operand.
1479  * @param   *mode  The mode of the operands and the result.
1480  */
1481 ir_node *new_rd_Or     (dbg_info *db, ir_graph *irg, ir_node *block,
1482                         ir_node *op1, ir_node *op2, ir_mode *mode);
1483
1484 /** Constructor for a Eor node.
1485  *
1486  * @param   *db    A pointer for debug information.
1487  * @param   *irg   The ir graph the node  belongs to.
1488  * @param   *block The ir block the node belongs to.
1489  * @param   *op1   The first operand.
1490  * @param   *op2   The second operand.
1491  * @param   *mode  The mode of the operands and the results.
1492  */
1493 ir_node *new_rd_Eor    (dbg_info *db, ir_graph *irg, ir_node *block,
1494                         ir_node *op1, ir_node *op2, ir_mode *mode);
1495
1496 /** Constructor for a Not node.
1497  *
1498  * @param   *db    A pointer for debug information.
1499  * @param   *irg   The ir graph the node  belongs to.
1500  * @param   *block The ir block the node belongs to.
1501  * @param   *op    The operand.
1502  * @param   *mode  The mode of the operand and the result.
1503  */
1504 ir_node *new_rd_Not    (dbg_info *db, ir_graph *irg, ir_node *block,
1505                ir_node *op, ir_mode *mode);
1506
1507 /** Constructor for a Cmp node.
1508  *
1509  * @param   *db    A pointer for debug information.
1510  * @param   *irg   The ir graph the node  belongs to.
1511  * @param   *block The ir block the node belongs to.
1512  * @param   *op1   The first operand.
1513  * @param   *op2   The second operand.
1514  */
1515 ir_node *new_rd_Cmp    (dbg_info *db, ir_graph *irg, ir_node *block,
1516                ir_node *op1, ir_node *op2);
1517
1518 /** Constructor for a Shl node.
1519  *
1520  * @param   *db    A pointer for debug information.
1521  * @param   *irg   The ir graph the node  belongs to.
1522  * @param   *block The ir block the node belongs to.
1523  * @param   *op    The operand.
1524  * @param   *k     The number of bits to  shift the operand .
1525  * @param   *mode  The mode of the operand and the result.
1526  */
1527 ir_node *new_rd_Shl    (dbg_info *db, ir_graph *irg, ir_node *block,
1528                ir_node *op, ir_node *k, ir_mode *mode);
1529
1530 /** Constructor for a Shr node.
1531  *
1532  * @param   *db    A pointer for debug information.
1533  * @param   *irg   The ir graph the node  belongs to.
1534  * @param   *block The ir block the node belongs to.
1535  * @param   *op    The operand.
1536  * @param   *k     The number of bits to shift the operand .
1537  * @param   *mode  The mode of the operand and the result.
1538  */
1539 ir_node *new_rd_Shr    (dbg_info *db, ir_graph *irg, ir_node *block,
1540                ir_node *op, ir_node *k, ir_mode *mode);
1541
1542 /** Constructor for a Shrs node.
1543  *
1544  * @param   *db    A pointer for debug information.
1545  * @param   *irg   The ir graph the node  belongs to.
1546  * @param   *block The ir block the node belongs to.
1547  * @param   *op    The operand.
1548  * @param   *k     The number of bits to shift the operand.
1549  * @param   *mode  The mode of the operand and the result.
1550  */
1551 ir_node *new_rd_Shrs   (dbg_info *db, ir_graph *irg, ir_node *block,
1552                ir_node *op, ir_node *k, ir_mode *mode);
1553
1554 /** Constructor for a Rot node.
1555  *
1556  * @param   *db    A pointer for debug information.
1557  * @param   *irg   The ir graph the node  belongs to.
1558  * @param   *block The ir block the node belongs to.
1559  * @param   *op    The operand.
1560  * @param   *k     The number of bits to rotate the operand.
1561  * @param   *mode  The mode of the operand.
1562  */
1563 ir_node *new_rd_Rot    (dbg_info *db, ir_graph *irg, ir_node *block,
1564                ir_node *op, ir_node *k, ir_mode *mode);
1565
1566
1567 /** Constructor for a Conv node.
1568  *
1569  * @param   *db    A pointer for debug information.
1570  * @param   *irg   The ir graph the node  belongs to.
1571  * @param   *block The ir block the node belongs to.
1572  * @param   *op    The operand.
1573  * @param   *mode  The mode of this the operand muss be converted .
1574  */
1575 ir_node *new_rd_Conv   (dbg_info *db, ir_graph *irg, ir_node *block,
1576                ir_node *op, ir_mode *mode);
1577
1578 /** Constructor for a Cast node.
1579  *
1580  * High level type cast.
1581  *
1582  * @param   *db    A pointer for debug information.
1583  * @param   *irg   The ir graph the node  belongs to.
1584  * @param   *block The ir block the node belongs to.
1585  * @param   *op    The operand.
1586  * @param   *to_tp The type of this the operand muss be casted .
1587  */
1588 ir_node *new_rd_Cast   (dbg_info *db, ir_graph *irg, ir_node *block,
1589                         ir_node *op, ir_type *to_tp);
1590
1591 /** Constructor for a Carry node.
1592  *
1593  * @param   *db    A pointer for debug information.
1594  * @param   *irg   The ir graph the node  belongs to.
1595  * @param   *block The ir block the node belongs to.
1596  * @param   *op1   The first operand.
1597  * @param   *op2   The second operand.
1598  * @param   *mode  The mode of the operands and the result.
1599  */
1600 ir_node *new_rd_Carry  (dbg_info *db, ir_graph *irg, ir_node *block,
1601                         ir_node *op1, ir_node *op2, ir_mode *mode);
1602
1603 /** Constructor for a Borrow node.
1604  *
1605  * @param   *db    A pointer for debug information.
1606  * @param   *irg   The ir graph the node  belongs to.
1607  * @param   *block The ir block the node belongs to.
1608  * @param   *op1   The first operand.
1609  * @param   *op2   The second operand.
1610  * @param   *mode  The mode of the operands and the result.
1611  */
1612 ir_node *new_rd_Borrow (dbg_info *db, ir_graph *irg, ir_node *block,
1613                         ir_node *op1, ir_node *op2, ir_mode *mode);
1614
1615 /** Constructor for a Phi node.
1616  *
1617  * @param *db    A pointer for debug information.
1618  * @param *irg   The ir graph the node  belongs to.
1619  * @param *block The ir block the node belongs to.
1620  * @param arity  The number of predecessors
1621  * @param *in[]  Array with predecessors.  The constructor copies this array.
1622  * @param *mode  The mode of it's inputs and output.
1623  */
1624 ir_node *new_rd_Phi    (dbg_info *db, ir_graph *irg, ir_node *block, int arity,
1625                         ir_node *in[], ir_mode *mode);
1626
1627 /** Constructor for a Load node.
1628  *
1629  * @param *db    A pointer for debug information.
1630  * @param *irg   The ir graph the node  belongs to.
1631  * @param *block The ir block the node belongs to.
1632  * @param *store The current memory
1633  * @param *adr   A pointer to the variable to be read in this memory.
1634  * @param *mode  The mode of the value to be loaded.
1635  */
1636 ir_node *new_rd_Load   (dbg_info *db, ir_graph *irg, ir_node *block,
1637                         ir_node *store, ir_node *adr, ir_mode *mode);
1638
1639 /** Constructor for a Store node.
1640  *
1641  * @param *db    A pointer for debug information.
1642  * @param *irg   The ir graph the node  belongs to.
1643  * @param *block The ir block the node belongs to.
1644  * @param *store The current memory
1645  * @param *adr   A pointer to the variable to be read in this memory.
1646  * @param *val   The value to write to this variable.
1647  */
1648 ir_node *new_rd_Store  (dbg_info *db, ir_graph *irg, ir_node *block,
1649                ir_node *store, ir_node *adr, ir_node *val);
1650
1651 /** Constructor for a Alloc node.
1652  *
1653  * The Alloc node extends the memory by space for an entity of type alloc_type.
1654  *
1655  * @param *db         A pointer for debug information.
1656  * @param *irg        The ir graph the node  belongs to.
1657  * @param *block      The ir block the node belongs to.
1658  * @param *store      The memory which shall contain the new variable.
1659  * @param *size       The number of bytes to allocate.
1660  * @param *alloc_type The type of the allocated variable.
1661  * @param where       Where to allocate the variable, either heap_alloc or stack_alloc.
1662  */
1663 ir_node *new_rd_Alloc  (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1664                ir_node *size, ir_type *alloc_type, where_alloc where);
1665
1666 /** Constructor for a Free node.
1667  *
1668  * Frees the memory occupied by the entity pointed to by the pointer
1669  * arg.  Type indicates the type of the entity the argument points to.
1670  *
1671  * @param *db         A pointer for debug information.
1672  * @param *irg        The ir graph the node  belongs to.
1673  * @param *block      The ir block the node belongs to.
1674  * @param *store      The memory which shall contain the new variable.
1675  * @param *ptr        The pointer to the object to free.
1676  * @param *size       The number of objects of type free_type to free in a sequence.
1677  * @param *free_type  The type of the freed variable.
1678  * @param where       Where the variable was allocated, either heap_alloc or stack_alloc.
1679  */
1680 ir_node *new_rd_Free   (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1681                         ir_node *ptr, ir_node *size, ir_type *free_type, where_alloc where);
1682
1683 /** Constructor for a Sync node.
1684  *
1685  * Merges several memory values.  The node assumes that a variable
1686  * either occurs only in one of the memories, or it contains the same
1687  * value in all memories where it occurs.
1688  *
1689  * @param *db       A pointer for debug information.
1690  * @param *irg      The ir graph the node  belongs to.
1691  * @param *block    The ir block the node belongs to.
1692  * @param  arity    The number of memories to synchronize.
1693  * @param  *in[]    An array of pointers to nodes that produce an output of type
1694  *                  memory.  The constructor copies this array.
1695  */
1696 ir_node *new_rd_Sync   (dbg_info *db, ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
1697
1698 /** Constructor for a Proj node.
1699  *
1700  * Projects a single value out of a tuple.  The parameter proj gives the
1701  * position of the value within the tuple.
1702  *
1703  * @param *db    A pointer for debug information.
1704  * @param *irg   The ir graph the node  belongs to.
1705  * @param *block The ir block the node belongs to.
1706  * @param arg    A node producing a tuple.  The node must have mode_T.
1707  * @param *mode  The mode of the value to project.
1708  * @param proj   The position of the value in the tuple.
1709  */
1710 ir_node *new_rd_Proj   (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1711                         ir_mode *mode, long proj);
1712
1713 /** Constructor for a defaultProj node.
1714  *
1715  * Represents the default control flow of a Switch-Cond node.
1716  *
1717  * @param *db       A pointer for debug information.
1718  * @param *irg      The ir graph the node  belongs to.
1719  * @param *block    The ir block the node belongs to.
1720  * @param arg       A node producing a tuple.
1721  * @param max_proj  The end position of the value in the tuple.
1722  */
1723 ir_node *new_rd_defaultProj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1724                              long max_proj);
1725
1726 /** Constructor for a Tuple node.
1727  *
1728  * This is an auxiliary node to replace a node that returns a tuple
1729  * without changing the corresponding Proj nodes.
1730  *
1731  * @param *db     A pointer for debug information.
1732  * @param *irg    The ir graph the node  belongs to.
1733  * @param *block  The ir block the node belongs to.
1734  * @param arity   The number of tuple elements.
1735  * @param *in[]   An array containing pointers to the nodes producing the tuple
1736  *                elements. The constructor copies this array.
1737  */
1738 ir_node *new_rd_Tuple  (dbg_info *db, ir_graph *irg, ir_node *block,
1739                         int arity, ir_node *in[]);
1740
1741 /** Constructor for a Id node.
1742  *
1743  * This is an auxiliary node to replace a node that returns a single
1744  * value.
1745  *
1746  * @param *db     A pointer for debug information.
1747  * @param *irg    The ir graph the node  belongs to.
1748  * @param *block  The ir block the node belongs to.
1749  * @param *val    The value
1750  * @param *mode   The mode of *val.
1751  */
1752 ir_node *new_rd_Id     (dbg_info *db, ir_graph *irg, ir_node *block,
1753                         ir_node *val, ir_mode *mode);
1754
1755 /** Constructor for a Bad node.
1756  *
1757  * Returns the unique Bad node of the graph.  The same as
1758  * get_irg_bad().
1759  *
1760  * @param *irg    The ir graph the node belongs to.
1761  */
1762 ir_node *new_rd_Bad    (ir_graph *irg);
1763
1764 /** Constructor for a Confirm node.
1765  *
1766  * Specifies constraints for a value.  To support dataflow analyses.
1767  *
1768  * Example: If the value never exceeds '100' this is expressed by placing a
1769  * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
1770  *
1771  * @param *irg    The ir graph the node belong to.
1772  * @param *block  The ir block the node belong to.
1773  * @param *db     A pointer for debug information.
1774  * @param *val    The value we express a constraint for
1775  * @param *bound  The value to compare against. Must be a firm node, typically a constant.
1776  * @param cmp     The compare operation.
1777  */
1778 ir_node *new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block,
1779              ir_node *val, ir_node *bound, pn_Cmp cmp);
1780
1781 /** Constructor for an Unknown node.
1782  *
1783  * Represents an arbitrary value.  Places the node in the start block.
1784  *
1785  * @param *irg    The ir graph the node  belongs to.
1786  * @param *m      The mode of the unknown value.
1787  */
1788 ir_node *new_rd_Unknown(ir_graph *irg, ir_mode *m);
1789
1790 /** Constructor for a CallBegin node.
1791  *
1792  * CallBegin represents control flow depending of the pointer value
1793  * representing the called method to the called methods.  The
1794  * constructor copies the method pointer input from the passed Call
1795  * node.
1796  *
1797  * @param *db     A pointer for debug information.
1798  * @param *irg    The ir graph the node belong to.
1799  * @param *block  The block the node belong to.
1800  * @param *callee The call node visible in the intra procedural view.
1801  */
1802 ir_node *new_rd_CallBegin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *callee);
1803
1804 /** Constructor for a EndReg node.
1805  *
1806  * Used to represent regular procedure end in interprocedual view.
1807  *
1808  * @param *db     A pointer for debug information.
1809  * @param *irg    The ir graph the node belong to.
1810  * @param *block  The block the node belong to.
1811  */
1812 ir_node *new_rd_EndReg (dbg_info *db, ir_graph *irg, ir_node *block);
1813
1814 /** Constructor for a EndExcept node.
1815  *
1816  * Used to represent exceptional procedure end in interprocedural view.
1817  *
1818  * @param *db     A pointer for debug information.
1819  * @param *irg    The ir graph the node belong to.
1820  * @param *block  The block the node belong to.
1821  */
1822 ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
1823
1824 /** Constructor for a Filter node.
1825  *
1826  * Adds the node to the block in current_ir_block.  Filter is a node
1827  * with two views used to construct the interprocedural view.  In
1828  * intraprocedural view its semantics are identical to the Proj node.
1829  * In interprocedural view the Filter performs the Phi operation on
1830  * method parameters or results.  Other than a Phi a Filter node may
1831  * not be removed if it has only a single input.
1832  *
1833  * The constructor builds the Filter in intraprocedural view.
1834  *
1835  * @param *db     A pointer for debug information.
1836  * @param *irg    The ir graph the node belong to.
1837  * @param *block  The block the node belong to.
1838  * @param *arg  The tuple value to project from.
1839  * @param *mode The mode of the projected value.
1840  * @param proj  The position in the tuple to project from.
1841  */
1842 ir_node *new_rd_Filter (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1843                         ir_mode *mode, long proj);
1844
1845 /** Constructor for a NoMem node.
1846  *
1847  * Returns the unique NoMem node of the graph.  The same as
1848  * get_irg_no_mem().
1849  *
1850  * @param *irg    The ir graph the node belongs to.
1851  */
1852 ir_node *new_rd_NoMem  (ir_graph *irg);
1853
1854 /** Constructor for a Mux node.
1855  *
1856  * @param *db       A pointer for debug information.
1857  * @param *irg      The ir graph the node belong to.
1858  * @param *block    The block the node belong to.
1859  * @param *sel      The ir_node that calculates the boolean select.
1860  * @param *ir_true  The ir_node that calculates the true result.
1861  * @param *ir_false The ir_node that calculates the false result.
1862  * @param *mode     The mode of the node (and it_true and ir_false).
1863  */
1864 ir_node *new_rd_Mux  (dbg_info *db, ir_graph *irg, ir_node *block,
1865     ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
1866
1867 /** Constructor for a Psi node.
1868  *
1869  * @param *db       A pointer for debug information.
1870  * @param *irg      The ir graph the node belong to.
1871  * @param *block    The block the node belong to.
1872  * @param *arity    The arity of the conditions
1873  * @param *conds    The array of mode_b conditions, length must be equal arity
1874  * @param *vals     The array of mode values, length must be equal arity + 1
1875  * @param *mode     The mode of the node (must be the mode of all vals).
1876  */
1877 ir_node *new_rd_Psi (dbg_info *db, ir_graph *irg, ir_node *block,
1878                      int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
1879
1880 /** Constructor for a CopyB node.
1881  *
1882  * @param *db         A pointer for debug information.
1883  * @param *irg        The ir graph the node belong to.
1884  * @param *block      The block the node belong to.
1885  * @param *store      The current memory
1886  * @param *dst        The ir_node that represents the destination address.
1887  * @param *src        The ir_node that represents the source address.
1888  * @param *data_type  The type of the copied data
1889  */
1890 ir_node *new_rd_CopyB(dbg_info *db, ir_graph *irg, ir_node *block,
1891     ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
1892
1893 /** Constructor for a InstOf node.
1894  *
1895  * A High-Level Type check.
1896  *
1897  * @param   *db        A pointer for debug information.
1898  * @param   *irg       The ir graph the node  belongs to.
1899  * @param   *block     The ir block the node belongs to.
1900  * @param   *store     The memory in which the object the entity should be selected
1901  *                     from is allocated.
1902  * @param   *objptr    A pointer to a object of a class type.
1903  * @param   *type      The type of which objptr must be.
1904  */
1905 ir_node *new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1906                         ir_node *objptr, ir_type *type);
1907
1908 /** Constructor for a Raise node.
1909  *
1910  * A High-Level Exception throw.
1911  *
1912  * @param *db    A pointer for debug information.
1913  * @param *irg   The ir graph the node  belongs to.
1914  * @param *block The ir block the node belongs to.
1915  * @param *store The current memory.
1916  * @param *obj   A pointer to the Except variable.
1917  */
1918 ir_node *new_rd_Raise  (dbg_info *db, ir_graph *irg, ir_node *block,
1919                         ir_node *store, ir_node *obj);
1920
1921 /** Constructor for a Bound node.
1922  *
1923  * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
1924  *
1925  * @param *db         A pointer for debug information.
1926  * @param *irg        The ir graph the node belong to.
1927  * @param *block      The block the node belong to.
1928  * @param *store      The current memory
1929  * @param *idx        The ir_node that represents an index.
1930  * @param *lower      The ir_node that represents the lower bound for the index.
1931  * @param *upper      The ir_node that represents the upper bound for the index.
1932  */
1933 ir_node *new_rd_Bound(dbg_info *db, ir_graph *irg, ir_node *block,
1934     ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
1935
1936 /*-------------------------------------------------------------------------*/
1937 /* The raw interface without debug support                                 */
1938 /*-------------------------------------------------------------------------*/
1939
1940 /** Constructor for a Block node.
1941  *
1942  * Constructs a mature block with the given predecessors.  Use Unknown
1943  * nodes as predecessors to construct a block if the number of
1944  * predecessors is known, but not the predecessors themselves.  This
1945  * constructor does not set current_block.  It not be used with
1946  * automatic Phi node construction.
1947  *
1948  *
1949  * @param irg    The ir graph the block belongs to.
1950  * @param arity  The number of control predecessors.
1951  * @param in[]   An array of control predecessors.  The length of
1952  *               the array must be 'arity'. The constructor copies this array.
1953  */
1954 ir_node *new_r_Block  (ir_graph *irg,  int arity, ir_node *in[]);
1955
1956 /** Constructor for a Start node.
1957  *
1958  * @param *irg   The ir graph the node belongs to.
1959  * @param *block The ir block the node belongs to.
1960  */
1961 ir_node *new_r_Start  (ir_graph *irg, ir_node *block);
1962
1963 /** Constructor for a End node.
1964  *
1965  * @param *irg   The ir graph the node  belongs to.
1966  * @param *block The ir block the node belongs to.
1967  */
1968 ir_node *new_r_End    (ir_graph *irg, ir_node *block);
1969
1970 /** Constructor for a Jmp node.
1971  *
1972  * Jmp represents control flow to a single control successor.
1973  *
1974  * @param *irg    The ir graph the node belongs to.
1975  * @param *block  The ir block the node belongs to.
1976  */
1977 ir_node *new_r_Jmp    (ir_graph *irg, ir_node *block);
1978
1979 /** Constructor for an IJmp node.
1980  *
1981  * IJmp represents control flow to a single control successor not
1982  * statically known i.e. an indirect Jmp.
1983  *
1984  * @param *irg    The ir graph the node belongs to.
1985  * @param *block  The ir block the node belongs to.
1986  * @param *tgt    The ir node representing the target address.
1987  */
1988 ir_node *new_r_IJmp   (ir_graph *irg, ir_node *block, ir_node *tgt);
1989
1990 /** Constructor for a Cond node.
1991  *
1992  * If c is mode_b represents a conditional branch (if/else). If c is
1993  * mode_Is/mode_Iu (?) represents a switch.  (Allocates dense Cond
1994  * node, default Proj is 0.)
1995  *
1996  * This is not consistent:  Input to Cond is Is, Proj has as proj number
1997  * longs.
1998  *
1999  * @param *irg   The ir graph the node  belongs to.
2000  * @param *block The ir block the node belongs to.
2001  * @param *c     The conditions parameter.Can be of mode b or I_u.
2002  */
2003 ir_node *new_r_Cond   (ir_graph *irg, ir_node *block, ir_node *c);
2004
2005 /** Constructor for a Return node.
2006  *
2007  * Returns the memory an zero or more return values.  Only node that
2008  * can end regular control flow.
2009  *
2010  * @param *irg   The ir graph the node  belongs to.
2011  * @param *block The ir block the node belongs to.
2012  * @param *store The state of memory.
2013  * @param arity  Number of array indices.
2014  * @param *in[]   Array with index inputs to the node. The constructor copies this array.
2015  */
2016 ir_node *new_r_Return (ir_graph *irg, ir_node *block,
2017                        ir_node *store, int arity, ir_node *in[]);
2018
2019 /** Constructor for a Const node.
2020  *
2021  * Constructor for a Const node. The constant represents a target
2022  * value.  Sets the type information to type_unknown.  (No more
2023  * supported: If tv is entity derives a somehow useful type.)
2024  *
2025  * @param *irg   The ir graph the node  belongs to.
2026  * @param *block The ir block the node belongs to.
2027  * @param *mode  The mode of the operands and the results.
2028  * @param *con   Points to an entry in the constant table.
2029  */
2030 ir_node *new_r_Const  (ir_graph *irg, ir_node *block,
2031                        ir_mode *mode, tarval *con);
2032
2033 /** Constructor for a Const node.
2034  *
2035  * Constructor for a Const node. The constant represents a target
2036  * value.  Sets the type information to type_unknown.  (No more
2037  * supported: If tv is entity derives a somehow useful type.)
2038  *
2039  * @param *irg   The ir graph the node  belongs to.
2040  * @param *block The ir block the node belongs to.
2041  * @param *mode  The mode of the operands and the results.
2042  * @param value  A value from which the tarval is made.
2043  */
2044 ir_node *new_r_Const_long(ir_graph *irg, ir_node *block,
2045                        ir_mode *mode, long value);
2046
2047 /** Constructor for a Const_type node.
2048  *
2049  * The constant represents a target value.  This constructor sets high
2050  * level type information for the constant value.
2051  *
2052  * @param *irg   The ir graph the node  belongs to.
2053  * @param *block The ir block the node belongs to.
2054  * @param *mode  The mode of the operands and results.
2055  * @param *con   Points to an entry in the constant table.
2056  * @param *tp    The type of the constant.
2057  */
2058 ir_node *new_r_Const_type(ir_graph *irg, ir_node *block,
2059            ir_mode *mode, tarval *con, ir_type *tp);
2060
2061 /** Constructor for a SymConst node.
2062  *
2063  *  This is the constructor for a symbolic constant.
2064  *    There are four kinds of symbolic constants:
2065  *    - type_tag  The symbolic constant represents a type tag.  The type the
2066  *                tag stands for is given explicitly.
2067  *    - size      The symbolic constant represents the size of a type.  The
2068  *                type of which the constant represents the size is given
2069  *                explicitly.
2070  *    - addr_name The symbolic constant represents the address of an entity
2071  *                (variable or method).  The variable is indicated by a name
2072  *                that is valid for linking.
2073  *    - addr_ent   The symbolic constant represents the address of an entity
2074  *                (variable or method).  The variable is given explicitly by
2075  *                a firm entity.
2076  *
2077  *    Inputs to the node:
2078  *      No inputs except the block it belongs to.
2079  *    Outputs of the node.
2080  *      An unsigned integer (I_u) or a pointer (P).
2081  *
2082  * @param *irg    The ir graph the node  belongs to.
2083  * @param *block  The ir block the node belongs to.
2084  * @param value   A type, entity or a ident depending on the SymConst kind.
2085  * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
2086  */
2087 ir_node *new_r_SymConst (ir_graph *irg, ir_node *block,
2088                          union symconst_symbol value, symconst_kind symkind);
2089
2090 /** Constructor for a simpleSel node.
2091  *
2092  *  This is a shortcut for the new_d_Sel() constructor.  To be used for
2093  *  Sel nodes that do not select from an array, i.e., have no index
2094  *  inputs.  It adds the two parameters 0, NULL.
2095  *
2096  * @param   *irg       The ir graph the node  belongs to.
2097  * @param   *block     The ir block the node belongs to.
2098  * @param   *store     The memory in which the object the entity should be selected
2099  *                     from is allocated.
2100  * @param   *objptr    The object from that the Sel operation selects a
2101  *                     single attribute out.
2102  * @param   *ent       The entity to select.
2103  */
2104 ir_node *new_r_simpleSel(ir_graph *irg, ir_node *block, ir_node *store,
2105                          ir_node *objptr, entity *ent);
2106
2107 /** Constructor for a Sel node.
2108  *
2109  * The select node selects an entity (field or method) from an entity
2110  * with a compound type.  It explicitly specifies the entity selected.
2111  * Dynamically the node may select entities that overwrite the given
2112  * entity.  If the selected entity is an array element entity the Sel
2113  * node takes the required array indices as inputs.
2114  *
2115  * @param   *irg       The ir graph the node  belongs to.
2116  * @param   *block     The ir block the node belongs to.
2117  * @param   *store     The memory in which the object the entity should be selected
2118  *                     from is allocated.
2119  * @param   *objptr    A pointer to a compound entity the Sel operation selects a
2120  *                     single attribute from.
2121  * @param   *n_index   The number of array indices needed to select an array element entity.
2122  * @param   *index[]   If the compound entity is an array the indices of the selected
2123  *                     element entity.  The constructor copies this array.
2124  * @param   *ent       The entity to select.
2125  */
2126 ir_node *new_r_Sel    (ir_graph *irg, ir_node *block, ir_node *store,
2127                        ir_node *objptr, int n_index, ir_node *index[],
2128                entity *ent);
2129
2130 /** Constructor for a Call node.
2131  *
2132  *  Represents all kinds of method and function calls.
2133  *
2134  * @param   *irg    The ir graph the node  belongs to.
2135  * @param   *block  The ir block the node belongs to.
2136  * @param   *store  The actual store.
2137  * @param   *callee A pointer to the called procedure.
2138  * @param   arity   The number of procedure parameters.
2139  * @param   *in[]   An array with the pointers to the parameters. The constructor copies this array.
2140  * @param   *tp     Type information of the procedure called.
2141  */
2142 ir_node *new_r_Call   (ir_graph *irg, ir_node *block, ir_node *store,
2143                ir_node *callee, int arity, ir_node *in[],
2144                ir_type *tp);
2145
2146 /** Constructor for a Add node.
2147  *
2148  * @param   *irg   The ir graph the node  belongs to.
2149  * @param   *block The ir block the node belongs to.
2150  * @param   *op1   The first operand.
2151  * @param   *op2   The second operand.
2152  * @param   *mode  The mode of the operands and the result.
2153  */
2154 ir_node *new_r_Add    (ir_graph *irg, ir_node *block,
2155                ir_node *op1, ir_node *op2, ir_mode *mode);
2156
2157 /**
2158  * Constructor for a Sub node.
2159  *
2160  * @param   *irg   The ir graph the node  belongs to.
2161  * @param   *block The ir block the node belongs to.
2162  * @param   *op1   The first operand.
2163  * @param   *op2   The second operand.
2164  * @param   *mode  The mode of the operands and the results.
2165  */
2166 ir_node *new_r_Sub    (ir_graph *irg, ir_node *block,
2167                ir_node *op1, ir_node *op2, ir_mode *mode);
2168
2169 /** Constructor for a Minus node.
2170  *
2171  * @param   *irg   The ir graph the node  belongs to.
2172  * @param   *block The ir block the node belongs to.
2173  * @param   *op   The operand.
2174  * @param   *mode  The mode of the operand and the result.
2175  */
2176 ir_node *new_r_Minus  (ir_graph *irg, ir_node *block,
2177                ir_node *op,  ir_mode *mode);
2178 /** Constructor for a Mul node.
2179  *
2180  * @param   *irg   The ir graph the node  belongs to.
2181  * @param   *block The ir block the node belongs to.
2182  * @param   *op1   The first operand.
2183  * @param   *op2   The second operand.
2184  * @param   *mode  The mode of the operands and the result.
2185  */
2186 ir_node *new_r_Mul    (ir_graph *irg, ir_node *block,
2187                ir_node *op1, ir_node *op2, ir_mode *mode);
2188
2189 /** Constructor for a Quot node.
2190  *
2191  * @param   *irg   The ir graph the node  belongs to.
2192  * @param   *block The ir block the node belongs to.
2193  * @param   *memop The store needed to model exceptions
2194  * @param   *op1   The first operand.
2195  * @param   *op2   The second operand.
2196  */
2197 ir_node *new_r_Quot   (ir_graph *irg, ir_node *block,
2198                ir_node *memop, ir_node *op1, ir_node *op2);
2199
2200 /** Constructor for a DivMod node.
2201  *
2202  * @param   *irg   The ir graph the node  belongs to.
2203  * @param   *block The ir block the node belongs to.
2204  * @param   *memop The store needed to model exceptions
2205  * @param   *op1   The first operand.
2206  * @param   *op2   The second operand.
2207  */
2208 ir_node *new_r_DivMod (ir_graph *irg, ir_node *block,
2209                ir_node *memop, ir_node *op1, ir_node *op2);
2210
2211 /** Constructor for a Div node.
2212  *
2213  * @param   *irg   The ir graph the node  belongs to.
2214  * @param   *block The ir block the node belongs to.
2215  * @param   *memop The store needed to model exceptions
2216  * @param   *op1   The first operand.
2217  * @param   *op2   The second operand.
2218  */
2219 ir_node *new_r_Div    (ir_graph *irg, ir_node *block,
2220                ir_node *memop, ir_node *op1, ir_node *op2);
2221
2222 /** Constructor for a Mod node.
2223  *
2224  * @param   *irg   The ir graph the node  belongs to.
2225  * @param   *block The ir block the node belongs to.
2226  * @param   *memop The store needed to model exceptions
2227  * @param   *op1   The first operand.
2228  * @param   *op2   The second operand.
2229  */
2230 ir_node *new_r_Mod    (ir_graph *irg, ir_node *block,
2231                ir_node *memop, ir_node *op1, ir_node *op2);
2232
2233 /** Constructor for a Abs node.
2234  *
2235  * @param   *irg   The ir graph the node  belongs to.
2236  * @param   *block The ir block the node belongs to.
2237  * @param   *op    The operand
2238  * @param   *mode  The mode of the operands and the result.
2239  */
2240 ir_node *new_r_Abs    (ir_graph *irg, ir_node *block,
2241                        ir_node *op, ir_mode *mode);
2242
2243 /** Constructor for a And node.
2244  *
2245  * @param   *irg   The ir graph the node  belongs to.
2246  * @param   *block The ir block the node belongs to.
2247  * @param   *op1   The first operand.
2248  * @param   *op2   The second operand.
2249  * @param   *mode  The mode of the operands and the result.
2250  */
2251 ir_node *new_r_And    (ir_graph *irg, ir_node *block,
2252                ir_node *op1, ir_node *op2, ir_mode *mode);
2253
2254 /** Constructor for a Or node.
2255  *
2256  * @param   *irg   The ir graph the node  belongs to.
2257  * @param   *block The ir block the node belongs to.
2258  * @param   *op1   The first operand.
2259  * @param   *op2   The second operand.
2260  * @param   *mode  The mode of the operands and the result.
2261  */
2262 ir_node *new_r_Or     (ir_graph *irg, ir_node *block,
2263                ir_node *op1, ir_node *op2, ir_mode *mode);
2264
2265 /** Constructor for a Eor node.
2266  *
2267  * @param   *irg   The ir graph the node  belongs to.
2268  * @param   *block The ir block the node belongs to.
2269  * @param   *op1   The first operand.
2270  * @param   *op2   The second operand.
2271  * @param   *mode  The mode of the operands and the results.
2272  */
2273 ir_node *new_r_Eor    (ir_graph *irg, ir_node *block,
2274                ir_node *op1, ir_node *op2, ir_mode *mode);
2275
2276 /** Constructor for a Not node.
2277  *
2278  * @param   *irg   The ir graph the node  belongs to.
2279  * @param   *block The ir block the node belongs to.
2280  * @param   *op    The operand.
2281  * @param   *mode  The mode of the operand and the result.
2282  */
2283 ir_node *new_r_Not    (ir_graph *irg, ir_node *block,
2284                ir_node *op, ir_mode *mode);
2285
2286 /** Constructor for a Cmp node.
2287  *
2288  * @param   *irg   The ir graph the node  belongs to.
2289  * @param   *block The ir block the node belongs to.
2290  * @param   *op1   The first operand.
2291  * @param   *op2   The second operand.
2292  */
2293 ir_node *new_r_Cmp    (ir_graph *irg, ir_node *block,
2294                ir_node *op1, ir_node *op2);
2295
2296 /** Constructor for a Shl node.
2297  *
2298  * @param   *irg   The ir graph the node  belongs to.
2299  * @param   *block The ir block the node belongs to.
2300  * @param   *op    The operand.
2301  * @param   *k     The number of bits to  shift the operand .
2302  * @param   *mode  The mode of the operand and the result.
2303  */
2304 ir_node *new_r_Shl    (ir_graph *irg, ir_node *block,
2305                ir_node *op, ir_node *k, ir_mode *mode);
2306
2307 /** Constructor for a Shr node.
2308  *
2309  * @param   *irg   The ir graph the node  belongs to.
2310  * @param   *block The ir block the node belongs to.
2311  * @param   *op    The operand.
2312  * @param   *k     The number of bits to shift the operand .
2313  * @param   *mode  The mode of the operand and the result.
2314  */
2315 ir_node *new_r_Shr    (ir_graph *irg, ir_node *block,
2316                ir_node *op, ir_node *k, ir_mode *mode);
2317
2318 /**
2319  * Constructor for a Shrs node.
2320  *
2321  * @param   *irg   The ir graph the node  belongs to.
2322  * @param   *block The ir block the node belongs to.
2323  * @param   *op    The operand.
2324  * @param   *k     The number of bits to shift the operand.
2325  * @param   *mode  The mode of the operand and the result.
2326  */
2327 ir_node *new_r_Shrs   (ir_graph *irg, ir_node *block,
2328                ir_node *op, ir_node *k, ir_mode *mode);
2329
2330 /** Constructor for a Rot node.
2331  *
2332  * @param   *irg   The ir graph the node  belongs to.
2333  * @param   *block The ir block the node belongs to.
2334  * @param   *op    The operand.
2335  * @param   *k     The number of bits to rotate the operand.
2336  * @param   *mode  The mode of the operand.
2337  */
2338 ir_node *new_r_Rot    (ir_graph *irg, ir_node *block,
2339                ir_node *op, ir_node *k, ir_mode *mode);
2340
2341 /** Constructor for a Conv node.
2342  *
2343  * @param   *irg   The ir graph the node  belongs to.
2344  * @param   *block The ir block the node belongs to.
2345  * @param   *op    The operand.
2346  * @param   *mode  The mode of this the operand muss be converted .
2347  */
2348 ir_node *new_r_Conv   (ir_graph *irg, ir_node *block,
2349                ir_node *op, ir_mode *mode);
2350
2351 /** Constructor for a Cast node.
2352  *
2353  * High level type cast
2354  *
2355  * @param   *irg   The ir graph the node  belongs to.
2356  * @param   *block The ir block the node belongs to.
2357  * @param   *op    The operand.
2358  * @param   *to_tp The type of this the operand muss be casted .
2359  */
2360 ir_node *new_r_Cast   (ir_graph *irg, ir_node *block,
2361                ir_node *op, ir_type *to_tp);
2362
2363 /** Constructor for a Carry node.
2364  *
2365  * @param   *irg   The ir graph the node  belongs to.
2366  * @param   *block The ir block the node belongs to.
2367  * @param   *op1   The first operand.
2368  * @param   *op2   The second operand.
2369  * @param   *mode  The mode of the operands and the result.
2370  */
2371 ir_node *new_r_Carry  (ir_graph *irg, ir_node *block,
2372                ir_node *op1, ir_node *op2, ir_mode *mode);
2373
2374 /**
2375  * Constructor for a Borrow node.
2376  *
2377  * @param   *irg   The ir graph the node  belongs to.
2378  * @param   *block The ir block the node belongs to.
2379  * @param   *op1   The first operand.
2380  * @param   *op2   The second operand.
2381  * @param   *mode  The mode of the operands and the results.
2382  */
2383 ir_node *new_r_Borrow (ir_graph *irg, ir_node *block,
2384                ir_node *op1, ir_node *op2, ir_mode *mode);
2385
2386 /** Constructor for a Phi node.
2387  *
2388  * @param *irg   The ir graph the node  belongs to.
2389  * @param *block The ir block the node belongs to.
2390  * @param arity  The number of predecessors
2391  * @param *in[]    Array with predecessors. The constructor copies this array.
2392  * @param *mode  The mode of it's inputs and output.
2393  */
2394 ir_node *new_r_Phi    (ir_graph *irg, ir_node *block, int arity,
2395                        ir_node *in[], ir_mode *mode);
2396
2397 /** Constructor for a Load node.
2398  *
2399  * @param *irg   The ir graph the node  belongs to.
2400  * @param *block The ir block the node belongs to.
2401  * @param *store The current memory
2402  * @param *adr   A pointer to the variable to be read in this memory.
2403  * @param *mode  The mode of the value to be loaded.
2404  */
2405 ir_node *new_r_Load   (ir_graph *irg, ir_node *block,
2406                ir_node *store, ir_node *adr, ir_mode *mode);
2407
2408 /** Constructor for a Store node.
2409  *
2410  * @param *irg   The ir graph the node  belongs to.
2411  * @param *block The ir block the node belongs to.
2412  * @param *store The current memory
2413  * @param *adr   A pointer to the variable to be read in this memory.
2414  * @param *val   The value to write to this variable.
2415  */
2416 ir_node *new_r_Store  (ir_graph *irg, ir_node *block,
2417                        ir_node *store, ir_node *adr, ir_node *val);
2418
2419 /** Constructor for a Alloc node.
2420  *
2421  * The Alloc node extends the memory by space for an entity of type alloc_type.
2422  *
2423  * @param *irg        The ir graph the node  belongs to.
2424  * @param *block      The ir block the node belongs to.
2425  * @param *store      The memory which shall contain the new variable.
2426  * @param *size       The number of bytes to allocate.
2427  * @param *alloc_type The type of the allocated variable.
2428  * @param where       Where to allocate the variable, either heap_alloc or stack_alloc.
2429  */
2430 ir_node *new_r_Alloc  (ir_graph *irg, ir_node *block, ir_node *store,
2431                ir_node *size, ir_type *alloc_type, where_alloc where);
2432
2433 /** Constructor for a Free node.
2434  *
2435  * Frees the memory occupied by the entity pointed to by the pointer
2436  * arg.  Type indicates the type of the entity the argument points to.
2437  *
2438  * @param *irg        The ir graph the node  belongs to.
2439  * @param *block      The ir block the node belongs to.
2440  * @param *store      The memory which shall contain the new variable.
2441  * @param *ptr        The pointer to the object to free.
2442  * @param *size       The number of objects of type free_type to free in a sequence.
2443  * @param *free_type  The type of the freed variable.
2444  * @param where       Where the variable was allocated, either heap_alloc or stack_alloc.
2445  */
2446 ir_node *new_r_Free   (ir_graph *irg, ir_node *block, ir_node *store,
2447                ir_node *ptr, ir_node *size, ir_type *free_type, where_alloc where);
2448
2449 /** Constructor for a  Sync node.
2450  *
2451  * Merges several memory values.  The node assumes that a variable
2452  * either occurs only in one of the memories, or it contains the same
2453  * value in all memories where it occurs.
2454  *
2455  * @param *irg      The ir graph the node  belongs to.
2456  * @param *block    The ir block the node belongs to.
2457  * @param  arity    The number of memories to synchronize.
2458  * @param  *in[]    An array of pointers to nodes that produce an output of  type memory.
2459  *                  The constructor copies this array.
2460  */
2461 ir_node *new_r_Sync   (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2462
2463 /** Constructor for a Proj node.
2464  *
2465  * Projects a single value out of a tuple.  The parameter proj gives the
2466  * position of the value within the tuple.
2467  *
2468  * @param *irg   The ir graph the node  belongs to.
2469  * @param *block The ir block the node belongs to.
2470  * @param arg    A node producing a tuple.
2471  * @param *mode  The mode of the value to project.
2472  * @param proj   The position of the value in the tuple.
2473  */
2474 ir_node *new_r_Proj   (ir_graph *irg, ir_node *block, ir_node *arg,
2475                        ir_mode *mode, long proj);
2476
2477 /** Constructor for a defaultProj node.
2478  *
2479  * Represents the default control flow of a Switch-Cond node.
2480  *
2481  * @param *irg      The ir graph the node  belongs to.
2482  * @param *block    The ir block the node belongs to.
2483  * @param arg       A node producing a tuple.
2484  * @param max_proj  The end  position of the value in the tuple.
2485  */
2486 ir_node *new_r_defaultProj (ir_graph *irg, ir_node *block, ir_node *arg, long max_proj);
2487
2488
2489 /** Constructor for a Tuple node.
2490  *
2491  * This is an auxiliary node to replace a node that returns a tuple
2492  * without changing the corresponding Proj nodes.
2493  *
2494  * @param *irg    The ir graph the node  belongs to.
2495  * @param *block  The ir block the node belongs to.
2496  * @param arity   The number of tuple elements.
2497  * @param *in[]   An array containing pointers to the nodes producing the tuple elements.
2498  *                The constructor copies this array.
2499  */
2500 ir_node *new_r_Tuple  (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2501
2502 /** Constructor for a Id node.
2503  *
2504  * This is an auxiliary node to replace a node that returns a single
2505  * value.
2506  *
2507  * @param *irg    The ir graph the node  belongs to.
2508  * @param *block  The ir block the node belongs to.
2509  * @param *val    The operand to Id.
2510  * @param *mode   The mode of *val.
2511  */
2512 ir_node *new_r_Id     (ir_graph *irg, ir_node *block,
2513                ir_node *val, ir_mode *mode);
2514
2515 /** Constructor for a Bad node.
2516  *
2517  * Returns the unique Bad node of the graph.  The same as
2518  * get_irg_bad().
2519  *
2520  * @param *irg    The ir graph the node  belongs to.
2521  *
2522  */
2523 ir_node *new_r_Bad    (ir_graph *irg);
2524
2525 /** Constructor for a Confirm node.
2526  *
2527  * Specifies constraints for a value.  To support dataflow analyses.
2528  *
2529  * Example: If the value never exceeds '100' this is expressed by placing a
2530  * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
2531  *
2532  * @param *irg    The ir graph the node belong to.
2533  * @param *block  The ir block the node belong to.
2534  * @param *val    The value we express a constraint for
2535  * @param *bound  The value to compare against. Must be a firm node, typically a constant.
2536  * @param cmp     The compare operation.
2537  */
2538 ir_node *new_r_Confirm (ir_graph *irg, ir_node *block,
2539             ir_node *val, ir_node *bound, pn_Cmp cmp);
2540
2541 /** Constructor for a Unknown node.
2542  *
2543  * Represents an arbitrary value.  Places the node in
2544  * the start block.
2545  *
2546  * @param *irg    The ir graph the node  belongs to.
2547  * @param *m      The mode of the unknown value.
2548  */
2549 ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2550
2551 /** Constructor for a CallBegin node.
2552  *
2553  * CallBegin represents control flow depending of the pointer value
2554  * representing the called method to the called methods.  The
2555  * constructor copies the method pointer input from the passed Call
2556  * node.
2557  *
2558  * @param *irg    The ir graph the node belong to.
2559  * @param *block  The block the node belong to.
2560  * @param *callee The call node visible in the  intra procedural view.
2561  */
2562 ir_node *new_r_CallBegin(ir_graph *irg, ir_node *block, ir_node *callee);
2563
2564 /** Constructor for a EndReg node.
2565  *
2566  * Used to represent regular procedure end in interprocedual view.
2567  *
2568  * @param *irg    The ir graph the node belong to.
2569  * @param *block  The block the node belong to.
2570  */
2571 ir_node *new_r_EndReg (ir_graph *irg, ir_node *block);
2572
2573 /** Constructor for a EndExcept node.
2574  *
2575  * Used to represent exceptional procedure end in interprocedural view.
2576  *
2577  * @param *irg    The ir graph the node belong to.
2578  * @param *block  The block the node belong to.
2579  */
2580 ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
2581
2582 /** Constructor for a Break node.
2583  *
2584  * Break represents control flow to a single control successor just as Jmp.
2585  * The blocks separated by a break may not be concatenated by an optimization.
2586  * It is used for the interprocedural representation where blocks are parted
2587  * behind Call nodes to represent the control flow to called procedures.
2588  *
2589  * @param *irg    The ir graph the node belong to.
2590  * @param *block  The block the node belong to.
2591  */
2592 ir_node *new_r_Break  (ir_graph *irg, ir_node *block);
2593
2594 /** Constructor for a Filter node.
2595  *
2596  * Constructor for a Filter node. Adds the node to the block in current_ir_block.
2597  * Filter is a node with two views used to construct the interprocedural view.
2598  * In intraprocedural view its semantics are identical to the Proj node.
2599  * In interprocedural view the Filter performs the Phi operation on method
2600  * parameters or results.  Other than a Phi a Filter node may not be removed
2601  * if it has only a single input.
2602  *
2603  * The constructor builds the Filter in intraprocedural view.
2604  *
2605  * @param *irg    The ir graph the node belong to.
2606  * @param *block  The block the node belong to.
2607  * @param *arg  The tuple value to project from.
2608  * @param *mode The mode of the projected value.
2609  * @param proj  The position in the tuple to project from.
2610  */
2611 ir_node *new_r_Filter (ir_graph *irg, ir_node *block, ir_node *arg,
2612                ir_mode *mode, long proj);
2613
2614 /** Constructor for a NoMem node.
2615  *
2616  * Returns the unique NoMem node of the graph.  The same as
2617  * get_irg_no_mem().
2618  *
2619  * @param *irg    The ir graph the node belongs to.
2620  */
2621 ir_node *new_r_NoMem  (ir_graph *irg);
2622
2623 /** Constructor for a Mux node.
2624  *
2625  * @param *irg      The ir graph the node belong to.
2626  * @param *block    The block the node belong to.
2627  * @param *sel      The ir_node that calculates the boolean select.
2628  * @param *ir_true  The ir_node that calculates the true result.
2629  * @param *ir_false The ir_node that calculates the false result.
2630  * @param *mode     The mode of the node (and it_true and ir_false).
2631  */
2632 ir_node *new_r_Mux  (ir_graph *irg, ir_node *block,
2633     ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2634
2635 /** Constructor for a Psi node.
2636  *
2637  * @param *irg      The ir graph the node belong to.
2638  * @param *block    The block the node belong to.
2639  * @param *arity    The arity of the conditions
2640  * @param *conds    The array of mode_b conditions, length must be equal arity
2641  * @param *vals     The array of mode values, length must be equal arity + 1
2642  * @param *mode     The mode of the node (must be the mode of all vals).
2643  */
2644 ir_node *new_r_Psi (ir_graph *irg, ir_node *block,
2645                     int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
2646
2647 /** Constructor for a CopyB node.
2648  *
2649  * @param *irg        The ir graph the node belong to.
2650  * @param *block      The block the node belong to.
2651  * @param *store      The current memory
2652  * @param *dst        The ir_node that represents the destination address.
2653  * @param *src        The ir_node that represents the source address.
2654  * @param *data_type  The type of the copied data
2655  */
2656 ir_node *new_r_CopyB(ir_graph *irg, ir_node *block,
2657     ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
2658
2659 /** Constructor for a InstOf node.
2660  *
2661  * A High-Level Type check.
2662  *
2663  * @param   *irg       The ir graph the node  belongs to.
2664  * @param   *block     The ir block the node belongs to.
2665  * @param   *store     The memory in which the object the entity should be selected
2666  *                     from is allocated.
2667  * @param   *objptr    A pointer to a object of a class type.
2668  * @param   *type      The type of which objptr must be.
2669  */
2670 ir_node *new_r_InstOf (ir_graph *irg, ir_node *block, ir_node *store,
2671                         ir_node *objptr, ir_type *type);
2672
2673 /** Constructor for a Raise node.
2674  *
2675  * A High-Level Exception throw.
2676  *
2677  * @param *irg   The ir graph the node  belongs to.
2678  * @param *block The ir block the node belongs to.
2679  * @param *store The current memory.
2680  * @param *obj   A pointer to the Except variable.
2681  */
2682 ir_node *new_r_Raise  (ir_graph *irg, ir_node *block,
2683                ir_node *store, ir_node *obj);
2684
2685 /** Constructor for a Bound node.
2686  *
2687  * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2688  *
2689  * @param *irg        The ir graph the node belong to.
2690  * @param *block      The block the node belong to.
2691  * @param *store      The current memory
2692  * @param *idx        The ir_node that represents an index.
2693  * @param *lower      The ir_node that represents the lower bound for the index.
2694  * @param *upper      The ir_node that represents the upper bound for the index.
2695  */
2696 ir_node *new_r_Bound(ir_graph *irg, ir_node *block,
2697     ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
2698
2699 /*-----------------------------------------------------------------------*/
2700 /* The block oriented interface                                          */
2701 /*-----------------------------------------------------------------------*/
2702
2703 /** Sets the current block in which the following constructors place the
2704  *  nodes they construct.
2705  *
2706  *  @param target  The new current block.
2707  */
2708 void     set_cur_block (ir_node *target);
2709
2710 /** Returns the current block of the current graph. */
2711 ir_node *get_cur_block(void);
2712
2713 /** Returns the fixed nodes  of the current graph. */
2714 #define get_cur_end_block()   get_irg_end_block(current_ir_graph)
2715 #define get_cur_end()         get_irg_end(current_ir_graph)
2716 #define get_cur_start_block() get_irg_start_block(current_ir_graph)
2717 #define get_cur_start()       get_irg_start(current_ir_graph)
2718
2719 /** Constructor for a Block node.
2720  *
2721  * Adds the block to the graph in current_ir_graph. Constructs a Block
2722  * with a fixed number of predecessors.  Does set current_block.  Can
2723  * be used with automatic Phi node construction.
2724  *
2725  * @param *db    A Pointer for debug information.
2726  * @param arity  The number of control predecessors.
2727  * @param in[]   An array of control predecessors.  The length of
2728  *               the array must be 'arity'.
2729  */
2730 ir_node *new_d_Block(dbg_info *db, int arity, ir_node *in[]);
2731
2732 /** Constructor for a Start node.
2733  *
2734  * Adds the node to the block in current_ir_block.
2735  *
2736  * @param *db    A pointer for debug information.
2737  */
2738 ir_node *new_d_Start  (dbg_info *db);
2739
2740 /** Constructor for a End node.
2741  *
2742  * Adds the node to the block in current_ir_block.
2743  *
2744  * @param *db     A pointer for debug information.
2745  */
2746 ir_node *new_d_End    (dbg_info *db);
2747
2748 /** Constructor for a Jmp node.
2749  *
2750  * Adds the node to the block in current_ir_block.
2751  *
2752  * Jmp represents control flow to a single control successor.
2753  *
2754  * @param *db     A pointer for debug information.
2755  */
2756 ir_node *new_d_Jmp    (dbg_info *db);
2757
2758 /** Constructor for an IJmp node.
2759  *
2760  * IJmp represents control flow to a single control successor not
2761  * statically known i.e. an indirect Jmp.
2762  *
2763  * @param *db     A pointer for debug information.
2764  * @param *tgt    The ir node representing the target address.
2765  */
2766 ir_node *new_d_IJmp   (dbg_info *db, ir_node *tgt);
2767
2768 /** Constructor for a Cond node.
2769  *
2770  * Adds the node to the block in current_ir_block.
2771  *
2772  * If c is mode_b represents a conditional branch (if/else). If c is
2773  * mode_Is/mode_Iu (?) represents a switch.  (Allocates dense Cond
2774  * node, default Proj is 0.)
2775  *
2776  * This is not consistent:  Input to Cond is Is, Proj has as proj number
2777  * longs.
2778  *
2779  * @param *db    A pointer for debug information.
2780  * @param *c     The conditions parameter.Can be of mode b or I_u.
2781  */
2782 ir_node *new_d_Cond   (dbg_info *db, ir_node *c);
2783
2784 /** Constructor for a Return node.
2785  *
2786  * Adds the node to the block in current_ir_block.
2787  *
2788  * Returns the memory an zero or more return values.  Only node that
2789  * can end regular control flow.
2790  *
2791  * @param *db    A pointer for debug information.
2792  * @param *store The state of memory.
2793  * @param arity  Number of array indices.
2794  * @param *in    Array with index inputs to the node.
2795  */
2796 ir_node *new_d_Return (dbg_info *db, ir_node *store, int arity, ir_node *in[]);
2797
2798 /** Constructor for a Const_type node.
2799  *
2800  * Adds the node to the block in current_ir_block.
2801  *
2802  * The constant represents a target value.  This constructor sets high
2803  * level type information for the constant value.
2804  *
2805  * @param *db    A pointer for debug information.
2806  * @param *mode  The mode of the operands and results.
2807  * @param *con   Points to an entry in the constant table. This pointer is
2808                  added to the attributes of the node.
2809  * @param *tp    The type of the constant.
2810  */
2811 ir_node *new_d_Const_type (dbg_info *db, ir_mode *mode, tarval *con, ir_type *tp);
2812
2813 /** Constructor for a Const node.
2814  *
2815  * Adds the node to the block in current_ir_block.
2816  *
2817  * Constructor for a Const node. The constant represents a target
2818  * value.  Sets the type information to type_unknown.  (No more
2819  * supported: If tv is entity derives a somehow useful type.)
2820  *
2821  * @param *db    A pointer for debug information.
2822  * @param *mode  The mode of the operands and results.
2823  * @param *con   Points to an entry in the constant table. This pointer is added
2824  *               to the attributes of the node.
2825  */
2826 ir_node *new_d_Const  (dbg_info *db, ir_mode *mode, tarval *con);
2827
2828 /** Constructor for a SymConst_type node.
2829  *
2830  *  Adds the node to the block in current_ir_block.
2831  *  This is the constructor for a symbolic constant.
2832  *    There are four kinds of symbolic constants:
2833  *    - type_tag  The symbolic constant represents a type tag.  The type the
2834  *                tag stands for is given explicitly.
2835  *    - size      The symbolic constant represents the size of a type.  The
2836  *                type of which the constant represents the size is given
2837  *                explicitly.
2838  *    - addr_name The symbolic constant represents the address of an entity
2839  *                (variable or method).  The variable is indicated by a name
2840  *                that is valid for linking.
2841  *    - addr_ent   The symbolic constant represents the address of an entity
2842  *                (variable or method).  The variable is given explicitly by
2843  *                a firm entity.
2844  *
2845  *    Inputs to the node:
2846  *      No inputs except the block it belongs to.
2847  *    Outputs of the node.
2848  *      An unsigned integer (I_u) or a pointer (P).
2849  *
2850  * @param *db     A pointer for debug information.
2851  * @param value   A type, entity or ident depending on the SymConst kind.
2852  * @param kind    The kind of the symbolic constant: symconst_type_tag, symconst_size
2853  *                or symconst_addr_name.
2854  * @param tp      The source type of the constant.
2855  */
2856 ir_node *new_d_SymConst_type (dbg_info *db, union symconst_symbol value, symconst_kind kind, ir_type *tp);
2857
2858 /** Constructor for a SymConst node.
2859  *
2860  *  Same as new_d_SymConst_type, except that it sets the type to type_unknown. */
2861 ir_node *new_d_SymConst (dbg_info *db, union symconst_symbol value, symconst_kind kind);
2862
2863 /** Constructor for a simpleSel node.
2864  *
2865  *  This is a shortcut for the new_d_Sel() constructor.  To be used for
2866  *  Sel nodes that do not select from an array, i.e., have no index
2867  *  inputs.  It adds the two parameters 0, NULL.
2868  *
2869  * @param   *db        A pointer for debug information.
2870  * @param   *store     The memory in which the object the entity should be
2871  *                     selected from is allocated.
2872  * @param   *objptr    The object from that the Sel operation selects a
2873  *                     single attribute out.
2874  * @param   *ent       The entity to select.
2875  */
2876 ir_node *new_d_simpleSel(dbg_info *db, ir_node *store, ir_node *objptr, entity *ent);
2877
2878 /** Constructor for a Sel node.
2879  *
2880  * The select node selects an entity (field or method) from an entity
2881  * with a compound type.  It explicitly specifies the entity selected.
2882  * Dynamically the node may select entities that overwrite the given
2883  * entity.  If the selected entity is an array element entity the Sel
2884  * node takes the required array indices as inputs.
2885  * Adds the node to the block in current_ir_block.
2886  *
2887  * @param   *db        A pointer for debug information.
2888  * @param   *store     The memory in which the object the entity should be selected
2889  *                     from is allocated.
2890  * @param   *objptr    A pointer to a compound entity the Sel operation selects a
2891  *                     single attribute from.
2892  * @param   arity      The number of array indices needed to select an array element entity.
2893  * @param   *in[]      If the compound entity is an array the indices of the selected
2894  *                     element entity.  The constructor copies this array.
2895  * @param   *ent       The entity to select.
2896  */
2897 ir_node *new_d_Sel    (dbg_info *db, ir_node *store, ir_node *objptr, int arity, ir_node *in[],
2898                      entity *ent);
2899
2900 /** Constructor for a Call node.
2901  *
2902  *  Represents all kinds of method and function calls.
2903  *  Adds the node to the block in current_ir_block.
2904  *
2905  * @param   *db     A pointer for debug information.
2906  * @param   *store  The actual store.
2907  * @param   *callee A pointer to the called procedure.
2908  * @param   arity   The number of procedure parameters.
2909  * @param   *in[]   An array with the pointers to the parameters. The constructor copies this array.
2910  * @param   *tp     Type information of the procedure called.
2911  */
2912 ir_node *new_d_Call   (dbg_info *db, ir_node *store, ir_node *callee, int arity, ir_node *in[],
2913              ir_type *tp);
2914
2915 /** Constructor for a Add node.
2916  *
2917  * Adds the node to the block in current_ir_block.
2918  *
2919  * @param   *db    A pointer for debug information.
2920  * @param   *op1   The first operand.
2921  * @param   *op2   The second operand.
2922  * @param   *mode  The mode of the operands and the result.
2923  */
2924 ir_node *new_d_Add    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2925
2926 /** Constructor for a Sub node.
2927  *
2928  * Adds the node to the block in current_ir_block.
2929  *
2930  * @param   *db    A pointer for debug information.
2931  * @param   *op1   The first operand.
2932  * @param   *op2   The second operand.
2933  * @param   *mode  The mode of the operands and the result.
2934  */
2935 ir_node *new_d_Sub    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2936
2937 /** Constructor for a Minus node.
2938  *
2939  * Adds the node to the block in current_ir_block.
2940  *
2941  * @param   *db    A pointer for debug information.
2942  * @param   *op    The operand .
2943  * @param   *mode  The mode of the operand and the result.
2944  */
2945 ir_node *new_d_Minus  (dbg_info *db, ir_node *op,  ir_mode *mode);
2946
2947 /** Constructor for a Mul node.
2948  *
2949  * Adds the node to the block in current_ir_block.
2950  *
2951  * @param   *db    A pointer for debug information.
2952  * @param   *op1   The first operand.
2953  * @param   *op2   The second operand.
2954  * @param   *mode  The mode of the operands and the result.
2955  */
2956 ir_node *new_d_Mul    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2957
2958 /** Constructor for a Quot node.
2959  *
2960  * Adds the node to the block in current_ir_block.
2961  *
2962  * @param   *db    A pointer for debug information.
2963  * @param   *memop The store needed to model exceptions
2964  * @param   *op1   The first operand.
2965  * @param   *op2   The second operand.
2966  */
2967 ir_node *new_d_Quot   (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
2968
2969 /** Constructor for a DivMod node.
2970  *
2971  * Adds the node to the block in current_ir_block.
2972  *
2973  * @param   *db    A pointer for debug information.
2974  * @param   *memop The store needed to model exceptions
2975  * @param   *op1   The first operand.
2976  * @param   *op2   The second operand.
2977  */
2978 ir_node *new_d_DivMod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
2979
2980 /** Constructor for a Div node.
2981  *
2982  * Adds the node to the block in current_ir_block.
2983  *
2984  * @param   *db    A pointer for debug information.
2985  * @param   *memop The store needed to model exceptions
2986  * @param   *op1   The first operand.
2987  * @param   *op2   The second operand.
2988  */
2989 ir_node *new_d_Div    (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
2990
2991 /** Constructor for a Mod node.
2992  *
2993  * Adds the node to the block in current_ir_block.
2994  *
2995  * @param   *db    A pointer for debug information.
2996  * @param   *memop The store needed to model exceptions
2997  * @param   *op1   The first operand.
2998  * @param   *op2   The second operand.
2999  */
3000 ir_node *new_d_Mod    (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
3001
3002 /** Constructor for a Abs node.
3003  *
3004  * Adds the node to the block in current_ir_block.
3005  *
3006  * @param   *db    A pointer for debug information.
3007  * @param   *op    The operand
3008  * @param   *mode  The mode of the operands and the result.
3009  */
3010 ir_node *new_d_Abs    (dbg_info *db, ir_node *op,                ir_mode *mode);
3011
3012 /** Constructor for a And node.
3013  *
3014  * Adds the node to the block in current_ir_block.
3015  *
3016  * @param   *db    A pointer for debug information.
3017  * @param   *op1   The first operand.
3018  * @param   *op2   The second operand.
3019  * @param   *mode  The mode of the operands and the result.
3020  */
3021 ir_node *new_d_And    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3022
3023 /** Constructor for a Or node.
3024  *
3025  * Adds the node to the block in current_ir_block.
3026  *
3027  * @param   *db    A pointer for debug information.
3028  * @param   *op1   The first operand.
3029  * @param   *op2   The second operand.
3030  * @param   *mode  The mode of the operands and the result.
3031  */
3032 ir_node *new_d_Or     (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3033
3034 /** Constructor for a Eor node.
3035  *
3036  * Adds the node to the block in current_ir_block.
3037  *
3038  * @param   *db    A pointer for debug information.
3039  * @param   *op1   The first operand.
3040  * @param   *op2   The second operand.
3041  * @param   *mode  The mode of the operands and the results.
3042  */
3043 ir_node *new_d_Eor    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3044
3045 /** Constructor for a Not node.
3046  *
3047  * Adds the node to the block in current_ir_block.
3048  *
3049  * @param   *db    A pointer for debug information.
3050  * @param   *op    The operand.
3051  * @param   *mode  The mode of the operand and the result.
3052  */
3053 ir_node *new_d_Not    (dbg_info *db, ir_node *op,                ir_mode *mode);
3054
3055 /** Constructor for a Shl node.
3056  *
3057  * Adds the node to the block in current_ir_block.
3058  *
3059  * @param   *db    A pointer for debug information.
3060  * @param   *op    The operand.
3061  * @param   *k     The number of bits to  shift the operand .
3062  * @param   *mode  The mode of the operand and the result.
3063  */
3064 ir_node *new_d_Shl    (dbg_info *db, ir_node *op,  ir_node *k,   ir_mode *mode);
3065
3066 /** Constructor for a Shr node.
3067  *
3068  * Adds the node to the block in current_ir_block.
3069  *
3070  * @param   *db    A pointer for debug information.
3071  * @param   *op    The operand.
3072  * @param   *k     The number of bits to  shift the operand .
3073  * @param   *mode  The mode of the operand and the result.
3074  */
3075 ir_node *new_d_Shr    (dbg_info *db, ir_node *op,  ir_node *k,   ir_mode *mode);
3076
3077 /** Constructor for a Shrs node.
3078  *
3079  * Adds the node to the block in current_ir_block.
3080  *
3081  * @param   *db    A pointer for debug information.
3082  * @param   *op    The operand.
3083  * @param   *k     The number of bits to  shift the operand .
3084  * @param   *mode  The mode of the operand and the result.
3085  */
3086 ir_node *new_d_Shrs   (dbg_info *db, ir_node *op,  ir_node *k,   ir_mode *mode);
3087
3088 /** Constructor for a Rot node.
3089  *
3090  * Adds the node to the block in current_ir_block.
3091  *
3092  * @param   *db    A pointer for debug information.
3093  * @param   *op    The operand.
3094  * @param   *k     The number of bits to rotate the operand.
3095  * @param   *mode  The mode of the operand.
3096  */
3097 ir_node *new_d_Rot    (dbg_info *db, ir_node *op,  ir_node *k,   ir_mode *mode);
3098
3099 /** Constructor for a Cmp node.
3100  *
3101  * Adds the node to the block in current_ir_block.
3102  *
3103  * @param   *db    A pointer for debug information.
3104  * @param   *op1   The first operand.
3105  * @param   *op2   The second operand.
3106  */
3107 ir_node *new_d_Cmp    (dbg_info *db, ir_node *op1, ir_node *op2);
3108
3109 /** Constructor for a Conv node.
3110  *
3111  * Adds the node to the block in current_ir_block.
3112  *
3113  * @param   *db    A pointer for debug information.
3114  * @param   *op    The operand.
3115  * @param   *mode  The mode of this the operand muss be converted .
3116  */
3117 ir_node *new_d_Conv   (dbg_info *db, ir_node *op, ir_mode *mode);
3118
3119 /** Constructor for a Cast node.
3120  *
3121  * High level type cast
3122  * Adds the node to the block in current_ir_block.
3123  *
3124  * @param   *db    A pointer for debug information.
3125  * @param   *op    The operand.
3126  * @param   *to_tp The type of this the operand muss be casted .
3127  */
3128 ir_node *new_d_Cast   (dbg_info *db, ir_node *op, ir_type *to_tp);
3129
3130 /** Constructor for a Carry node.
3131  *
3132  * Adds the node to the block in current_ir_block.
3133  *
3134  * @param   *db    A pointer for debug information.
3135  * @param   *op1   The first operand.
3136  * @param   *op2   The second operand.
3137  * @param   *mode  The mode of the operands and the result.
3138  */
3139 ir_node *new_d_Carry  (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3140
3141 /** Constructor for a Borrow node.
3142  *
3143  * Adds the node to the block in current_ir_block.
3144  *
3145  * @param   *db    A pointer for debug information.
3146  * @param   *op1   The first operand.
3147  * @param   *op2   The second operand.
3148  * @param   *mode  The mode of the operands and the result.
3149  */
3150 ir_node *new_d_Borrow (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3151
3152 /** Constructor for a Phi node.
3153  *
3154  * Adds the node to the block in current_ir_block.
3155  *
3156  * @param *db    A pointer for debug information.
3157  * @param arity  The number of predecessors
3158  * @param *in    Array with predecessors
3159  * @param *mode  The mode of it's inputs and output.
3160  */
3161 ir_node *new_d_Phi    (dbg_info *db, int arity, ir_node *in[], ir_mode *mode);
3162
3163 /** Constructor for a Load node.
3164  *
3165  * Adds the node to the block in current_ir_block.
3166  *
3167  * @param *db    A pointer for debug information.
3168  * @param *store The current memory
3169  * @param *addr  A pointer to the variable to be read in this memory.
3170  * @param *mode  The mode of the value to be loaded.
3171  */
3172 ir_node *new_d_Load   (dbg_info *db, ir_node *store, ir_node *addr, ir_mode *mode);
3173
3174 /** Constructor for a Store node.
3175  *
3176  * Adds the node to the block in current_ir_block.
3177  *
3178  * @param *db    A pointer for debug information.
3179  * @param *store The current memory
3180  * @param *addr  A pointer to the variable to be read in this memory.
3181  * @param *val   The value to write to this variable.
3182  */
3183 ir_node *new_d_Store  (dbg_info *db, ir_node *store, ir_node *addr, ir_node *val);
3184
3185 /** Constructor for a Alloc node.
3186  *
3187  * The Alloc node extends the memory by space for an entity of type alloc_type.
3188  * Adds the node to the block in current_ir_block.
3189  *
3190  * @param *db         A pointer for debug information.
3191  * @param *store      The memory which shall contain the new variable.
3192  * @param *size       The number of bytes to allocate.
3193  * @param *alloc_type The type of the allocated variable.
3194  * @param where       Where to allocate the variable, either heap_alloc or stack_alloc.
3195  */
3196 ir_node *new_d_Alloc  (dbg_info *db, ir_node *store, ir_node *size, ir_type *alloc_type,
3197                      where_alloc where);
3198
3199  /** Constructor for a Free node.
3200  *
3201  * Frees the memory occupied by the entity pointed to by the pointer
3202  * arg.  Type indicates the type of the entity the argument points to.
3203  * Adds the node to the block in current_ir_block.
3204  *
3205  * @param *db         A pointer for debug information.
3206  * @param *store      The memory which shall contain the new variable.
3207  * @param *ptr        The pointer to the object to free.
3208  * @param *size       The number of objects of type free_type to free in a sequence.
3209  * @param *free_type  The type of the freed variable.
3210  * @param where       Where the variable was allocated, either heap_alloc or stack_alloc.
3211  */
3212 ir_node *new_d_Free   (dbg_info *db, ir_node *store, ir_node *ptr, ir_node *size,
3213              ir_type *free_type, where_alloc where);
3214
3215 /** Constructor for a Sync node.
3216  *
3217  * Merges several memory values.  The node assumes that a variable
3218  * either occurs only in one of the memories, or it contains the same
3219  * value in all memories where it occurs.
3220  * Adds the node to the block in current_ir_block.
3221  *
3222  * @param *db       A pointer for debug information.
3223  * @param  arity    The number of memories to synchronize.
3224  * @param  **in     An array of pointers to nodes that produce an output of type
3225  *                  memory.  The constructor copies this array.
3226  */
3227 ir_node *new_d_Sync   (dbg_info *db, int arity, ir_node *in[]);
3228
3229 /** Constructor for a Proj node.
3230  *
3231  * Projects a single value out of a tuple.  The parameter proj gives the
3232  * position of the value within the tuple.
3233  * Adds the node to the block in current_ir_block.
3234  *
3235  * @param *db    A pointer for deubug information.
3236  * @param arg    A node producing a tuple.
3237  * @param *mode  The mode of the value to project.
3238  * @param proj   The position of the value in the tuple.
3239  */
3240 ir_node *new_d_Proj   (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3241
3242 /** Constructor for a defaultProj node.
3243  *
3244  * Represents the default control flow of a Switch-Cond node.
3245  * Adds the node to the block in current_ir_block.
3246  *
3247  * @param *db       A pointer for debug information.
3248  * @param arg       A node producing a tuple.
3249  * @param max_proj  The end  position of the value in the tuple.
3250  */
3251 ir_node *new_d_defaultProj (dbg_info *db, ir_node *arg, long max_proj);
3252
3253 /** Constructor for a Tuple node.
3254  *
3255  * This is an auxiliary node to replace a node that returns a tuple
3256  * without changing the corresponding Proj nodes.
3257  * Adds the node to the block in current_ir_block.
3258  *
3259  * @param *db     A pointer for debug information.
3260  * @param arity   The number of tuple elements.
3261  * @param **in    An array containing pointers to the nodes producing the tuple elements.
3262  */
3263 ir_node *new_d_Tuple  (dbg_info *db, int arity, ir_node *in[]);
3264
3265 /** Constructor for a Id node.
3266  *
3267  * This is an auxiliary node to replace a node that returns a single
3268  * value. Adds the node to the block in current_ir_block.
3269  *
3270  * @param *db     A pointer for debug information.
3271  * @param *val    The operand to Id.
3272  * @param *mode   The mode of *val.
3273  */
3274 ir_node *new_d_Id     (dbg_info *db, ir_node *val, ir_mode *mode);
3275
3276 /** Constructor for a Bad node.
3277  *
3278  * Returns the unique Bad node of the graph.  The same as
3279  * get_irg_bad().
3280  */
3281 ir_node *new_d_Bad    (void);
3282
3283 /** Constructor for a Confirm node.
3284  *
3285  * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3286  * Specifies constraints for a value.  To support dataflow analyses.
3287  *
3288  * Example: If the value never exceeds '100' this is expressed by placing a
3289  * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
3290  *
3291  * @param *db     A pointer for debug information.
3292  * @param *val    The value we express a constraint for
3293  * @param *bound  The value to compare against. Must be a firm node, typically a constant.
3294  * @param cmp     The compare operation.
3295  */
3296 ir_node *new_d_Confirm (dbg_info *db, ir_node *val, ir_node *bound, pn_Cmp cmp);
3297
3298 /** Constructor for an Unknown node.
3299  *
3300  * Represents an arbitrary value.  Places the node in
3301  * the start block.
3302  *
3303  * @param *m      The mode of the unknown value.
3304  */
3305 ir_node *new_d_Unknown(ir_mode *m);
3306
3307 /** Constructor for a CallBegin node.
3308  *
3309  * CallBegin represents control flow depending of the pointer value
3310  * representing the called method to the called methods.  The
3311  * constructor copies the method pointer input from the passed Call
3312  * node.Adds the node to the block in current_ir_block.
3313  *
3314  * @param *db     A pointer for debug information.
3315  * @param *callee The call node visible in the  intra procedural view.
3316  */
3317 ir_node *new_d_CallBegin(dbg_info *db, ir_node *callee);
3318
3319 /** Constructor for an EndReg node.
3320  *
3321  *Adds the node to the block in current_ir_block.
3322  *
3323  * @param *db     A pointer for debug information.
3324  */
3325 ir_node *new_d_EndReg (dbg_info *db);
3326
3327 /** Constructor for an EndExcept node.
3328  *
3329  * Used to represent regular procedure end in interprocedual view.
3330  * Adds the node to the block in current_ir_block.
3331  *
3332  * @param *db     A pointer for debug information.
3333  */
3334 ir_node *new_d_EndExcept(dbg_info *db);
3335
3336 /** Constructor for a Break node.
3337  *
3338  * Used to represent exceptional procedure end in interprocedural view.
3339  * Adds the node to the block in current_ir_block.
3340  *
3341  * Break represents control flow to a single control successor just as Jmp.
3342  * The blocks separated by a break may not be concatenated by an optimization.
3343  * It is used for the interprocedural representation where blocks are parted
3344  * behind Call nodes to represent the control flow to called procedures.
3345  *
3346  * @param *db     A pointer for debug information.
3347  */
3348 ir_node *new_d_Break (dbg_info *db);
3349
3350 /** Constructor for a Filter node.
3351  *
3352  * Constructor for a Filter node. Adds the node to the block in
3353  * current_ir_block.  Filter is a node with two views used to
3354  * construct the interprocedural view.  In intraprocedural view its
3355  * semantics are identical to the Proj node.  In interprocedural view
3356  * the Filter performs the Phi operation on method parameters or
3357  * results.  Other than a Phi a Filter node may not be removed if it
3358  * has only a single input.
3359  *
3360  * The constructor builds the Filter in intraprocedural view.
3361  *
3362  * @param *db   A pointer for debug information.
3363  * @param *arg  The tuple value to project from.
3364  * @param *mode The mode of the projected value.
3365  * @param proj  The position in the tuple to project from.
3366  */
3367 ir_node *new_d_Filter (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3368
3369
3370 /** Constructor for a NoMem node.
3371  *
3372  * Returns the unique NoMem node of the graph.  The same as
3373  * get_irg_no_mem().
3374  */
3375 ir_node *new_d_NoMem  (void);
3376
3377 /** Constructor for a Mux node.
3378  *
3379  * @param *db       A pointer for debug information.
3380  * @param *sel      The ir_node that calculates the boolean select.
3381  * @param *ir_true  The ir_node that calculates the true result.
3382  * @param *ir_false The ir_node that calculates the false result.
3383  * @param *mode     The mode of the node (and it_true and ir_false).
3384  */
3385 ir_node *new_d_Mux  (dbg_info *db, ir_node *sel,
3386     ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
3387
3388 /** Constructor for a Psi node.
3389  *
3390  * @param *db       A pointer for debug information.
3391  * @param *arity    The arity of the conditions
3392  * @param *conds    The array of mode_b conditions, length must be equal arity
3393  * @param *vals     The array of mode values, length must be equal arity + 1
3394  * @param *mode     The mode of the node (must be the mode of all vals).
3395  */
3396 ir_node *new_d_Psi (dbg_info *db,
3397                     int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
3398
3399 /** Constructor for a CopyB node.
3400  *
3401  * @param *db         A pointer for debug information.
3402  * @param *store      The current memory
3403  * @param *dst        The ir_node that represents the destination address.
3404  * @param *src        The ir_node that represents the source address.
3405  * @param *data_type  The type of the copied data
3406  */
3407 ir_node *new_d_CopyB(dbg_info *db, ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
3408
3409 /** Constructor for a InstOf node.
3410  *
3411  * A High-Level Type check.
3412  *
3413  * @param   *db        A pointer for debug information.
3414  * @param   *store     The memory in which the object the entity should be selected
3415  *                     from is allocated.
3416  * @param   *objptr    A pointer to a object of a class type.
3417  * @param   *type      The type of which objptr must be.
3418  */
3419 ir_node *new_d_InstOf (dbg_info *db, ir_node *store, ir_node *objptr, ir_type *type);
3420
3421 /** Constructor for a Raise node.
3422  *
3423  * A High-Level Exception throw.
3424  *
3425  * @param *db    A pointer for debug information.
3426  * @param *store The current memory.
3427  * @param *obj   A pointer to the Except variable.
3428  */
3429 ir_node *new_d_Raise  (dbg_info *db, ir_node *store, ir_node *obj);
3430
3431 /** Constructor for a Bound node.
3432  *
3433  * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
3434  *
3435  * @param *db         A pointer for debug information.
3436  * @param *store      The current memory
3437  * @param *idx        The ir_node that represents an index.
3438  * @param *lower      The ir_node that represents the lower bound for the index.
3439  * @param *upper      The ir_node that represents the upper bound for the index.
3440  */
3441 ir_node *new_d_Bound(dbg_info *db, ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
3442
3443 /*-----------------------------------------------------------------------*/
3444 /* The block oriented interface without debug support                    */
3445 /*-----------------------------------------------------------------------*/
3446
3447 /* Needed from the interface with debug support:
3448 void set_cur_block (ir_node *target);   */
3449
3450 /** Constructor for a Block node.
3451  *
3452  * Constructor for a Block node. Adds the block to the graph in
3453  * current_ir_graph.  Constructs a Block with a fixed number of
3454  * predecessors.  Does set current_block.  Can be used with automatic
3455  * Phi node construction.
3456  *
3457  * @param arity  The number of control predecessors.
3458  * @param in     An array of control predecessors.  The length of
3459  *               the array must be 'arity'.
3460  */
3461 ir_node *new_Block(int arity, ir_node *in[]);
3462
3463 /** Constructor for a Start node.
3464  *
3465  * Adds the node to the block in current_ir_block.
3466  *
3467  */
3468 ir_node *new_Start  (void);
3469
3470 /** Constructor for an End node.
3471  *
3472  * Adds the node to the block in current_ir_block.
3473  */
3474 ir_node *new_End    (void);
3475
3476 /** Constructor for an EndReg node.
3477  *
3478  * Used to represent regular procedure end in interprocedual view.
3479  * Adds the node to the block in current_ir_block.
3480  */
3481 ir_node *new_EndReg (void);
3482
3483 /** Constructor for an EndExpcept node.
3484  *
3485  *  Used to represent exceptional procedure end in interprocedural view.
3486  *  Adds the node to the block in current_ir_block.
3487  */
3488 ir_node *new_EndExcept(void);
3489
3490 /** Constructor for a Jump node.
3491  *
3492  * Adds the node to the block in current_ir_block.
3493  *
3494  * Jmp represents control flow to a single control successor.
3495  */
3496 ir_node *new_Jmp    (void);
3497
3498 /** Constructor for an IJmp node.
3499  *
3500  * IJmp represents control flow to a single control successor not
3501  * statically known i.e. an indirect Jmp.
3502  *
3503  * @param *tgt    The ir node representing the target address.
3504  */
3505 ir_node *new_IJmp   (ir_node *tgt);
3506
3507 /** Constructor for a Break node.
3508  * Break represents control flow to a single control successor just as Jmp.
3509  * The blocks separated by a break may not be concatenated by an optimization.
3510  * It is used for the interprocedural representation where blocks are parted
3511  * behind Call nodes to represent the control flow to called procedures.
3512  * Adds the node to the block in current_ir_block.
3513  */
3514 ir_node *new_Break  (void);
3515
3516 /** Constructor for a Cond node.
3517  *
3518  * If c is mode_b represents a conditional branch (if/else). If c is
3519  * mode_Is/mode_Iu (?) represents a switch.  (Allocates dense Cond
3520  * node, default Proj is 0.). Adds the node to the block in current_ir_block.
3521  *
3522  * This is not consistent:  Input to Cond is Is, Proj has as proj number
3523  * longs.
3524  *
3525  *
3526  * @param *c     The conditions parameter.Can be of mode b or I_u.
3527  */
3528 ir_node *new_Cond   (ir_node *c);
3529
3530 /** Constructor for a Return node.
3531  *
3532  * Returns the memory an zero or more return values.  Only node that
3533  * can end regular control flow. Adds the node to the block in current_ir_block.
3534  *
3535  * @param *store The state of memory.
3536  * @param arity  Number of array indices.
3537  * @param *in    Array with index inputs to the node.
3538  */
3539 ir_node *new_Return (ir_node *store, int arity, ir_node *in[]);
3540
3541 /** Constructor for a Const node.
3542  *
3543  * Constructor for a Const node. The constant represents a target
3544  * value.  Sets the type information to type_unknown.  (No more
3545  * supported: If tv is entity derives a somehow useful type.)
3546  * Adds the node to the block in current_ir_block.
3547  *
3548  * @param *mode  The mode of the operands and results.
3549  * @param *con   Points to an entry in the constant table. This pointer is
3550  *               added to the attributes of  the node.
3551  */
3552 ir_node *new_Const  (ir_mode *mode, tarval *con);
3553
3554 /**
3555  * Make a const from a long.
3556  * This is just convenience for the usual
3557  * <code>
3558  * new_Const(mode, tarval_from_long(mode, ...))
3559  * </code>
3560  * pain.
3561  * @param mode The mode for the const.
3562  * @param value The value of the constant.
3563  * @return A new const node.
3564  */
3565 ir_node *new_Const_long(ir_mode *mode, long value);
3566
3567 /** Constructor for a Const node.
3568  *
3569  * Derives mode from passed type. */
3570 ir_node *new_Const_type(tarval *con, ir_type *tp);
3571
3572 /** Constructor for a SymConst node.
3573  *
3574  * Adds the node to the block in current_ir_block.
3575  * This is the constructor for a symbolic constant.
3576  * There are four kinds of symbolic constants:
3577  *    -# type_tag  The symbolic constant represents a type tag.  The type the
3578  *                 tag stands for is given explicitly.
3579  *    -# size      The symbolic constant represents the size of a type.  The
3580  *                 type of which the constant represents the size is given
3581  *                 explicitly.
3582  *    -# addr_name The symbolic constant represents the address of an entity
3583  *                 (variable or method).  The variable is indicated by a name
3584  *                 that is valid for linking.
3585  *    -# addr_ent  The symbolic constant represents the address of an entity
3586  *                 (variable or method).  The variable is given explicitly by
3587  *                 a firm entity.
3588  *
3589  *    Inputs to the node:
3590  *      No inputs except the block it belongs to.
3591  *    Outputs of the node.
3592  *      An unsigned integer (I_u) or a pointer (P).
3593  *
3594  * @param value   A type or a ident depending on the SymConst kind.
3595  * @param kind    The kind of the symbolic constant: symconst_type_tag, symconst_size or symconst_addr_name.
3596  */
3597 ir_node *new_SymConst (union symconst_symbol value, symconst_kind kind);
3598
3599 /** Constructor for a simpelSel node.
3600  *
3601  *  This is a shortcut for the new_Sel() constructor.  To be used for
3602  *  Sel nodes that do not select from an array, i.e., have no index
3603  *  inputs.  It adds the two parameters 0, NULL.
3604  *
3605  * @param   *store     The memory in which the object the entity should be selected from is allocated.
3606  * @param   *objptr    The object from that the Sel operation selects a single attribute out.
3607  * @param   *ent       The entity to select.
3608  */
3609 ir_node *new_simpleSel(ir_node *store, ir_node *objptr, entity *ent);
3610
3611 /** Constructor for a Sel node.
3612  *
3613  * The select node selects an entity (field or method) from an entity
3614  * with a compound type.  It explicitly specifies the entity selected.
3615  * Dynamically the node may select entities that overwrite the given
3616  * entity.  If the selected entity is an array element entity the Sel
3617  * node takes the required array indices as inputs.
3618  * Adds the node to the block in current_ir_block.
3619  *
3620  * @param   *store     The memory in which the object the entity should be selected
3621  *                     from is allocated.
3622  * @param   *objptr    A pointer to a compound entity the Sel operation selects a
3623  *                     single attribute from.
3624  * @param   arity      The number of array indices needed to select an array element entity.
3625  * @param   *in[]      If the compound entity is an array the indices of the selected
3626  *                     element entity.  The constructor copies this array.
3627  * @param   *ent       The entity to select.
3628  */
3629 ir_node *new_Sel    (ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3630                      entity *ent);
3631
3632 /** Constructor for a Call node.
3633  *
3634  *  Adds the node to the block in current_ir_block.
3635  *  Represents all kinds of method and function calls.
3636  *
3637  * @param   *store  The actual store.
3638  * @param   *callee A pointer to the called procedure.
3639  * @param   arity   The number of procedure parameters.
3640  * @param   *in[]   An array with the pointers to the parameters. The constructor copies this array.
3641  * @param   *tp     Type information of the procedure called.
3642  */
3643 ir_node *new_Call   (ir_node *store, ir_node *callee, int arity, ir_node *in[],
3644                      ir_type *tp);
3645
3646 /** Constructor for a CallBegin node.
3647  *
3648  * CallBegin represents control flow depending of the pointer value
3649  * representing the called method to the called methods.  The
3650  * constructor copies the method pointer input from the passed Call
3651  * node. Adds the node to the block in current_ir_block.
3652  *
3653  * @param   *callee A pointer to the called procedure.
3654  */
3655 ir_node *new_CallBegin(ir_node *callee);
3656
3657 /** Constructor for a Add node.
3658  *
3659  * Adds the node to the block in current_ir_block.
3660  *
3661  * @param   *op1   The first operand.
3662  * @param   *op2   The second operand.
3663  * @param   *mode  The mode of the operands and the result.
3664  */
3665 ir_node *new_Add    (ir_node *op1, ir_node *op2, ir_mode *mode);
3666
3667 /** Constructor for a Sub node.
3668  *
3669  * Adds the node to the block in current_ir_block.
3670  *
3671  * @param   *op1   The first operand.
3672  * @param   *op2   The second operand.
3673  * @param   *mode  The mode of the operands and the result.
3674  */
3675 ir_node *new_Sub    (ir_node *op1, ir_node *op2, ir_mode *mode);
3676
3677 /** Constructor for a Minus node.
3678  *
3679  * Adds the node to the block in current_ir_block.
3680  *
3681  * @param   *op    The operand .
3682  * @param   *mode  The mode of the operand and the result.
3683  */
3684 ir_node *new_Minus  (ir_node *op,  ir_mode *mode);
3685
3686 /**
3687  * Constructor for a Mul node. Adds the node to the block in current_ir_block.
3688  *
3689  * @param   *op1   The first operand.
3690  * @param   *op2   The second operand.
3691  * @param   *mode  The mode of the operands and the result.
3692  */
3693 ir_node *new_Mul    (ir_node *op1, ir_node *op2, ir_mode *mode);
3694
3695 /** Constructor for a Quot node.
3696  *
3697  * Adds the node to the block in current_ir_block.
3698  *
3699  * @param   *memop The store needed to model exceptions
3700  * @param   *op1   The first operand.
3701  * @param   *op2   The second operand.
3702  */
3703 ir_node *new_Quot   (ir_node *memop, ir_node *op1, ir_node *op2);
3704
3705 /** Constructor for a DivMod node.
3706  *
3707  * Adds the node to the block in current_ir_block.
3708  *
3709  * @param   *memop The store needed to model exceptions
3710  * @param   *op1   The first operand.
3711  * @param   *op2   The second operand.
3712  */
3713 ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
3714
3715 /** Constructor for a Div node.
3716  *
3717  * Adds the node to the block in current_ir_block.
3718  *
3719  * @param   *memop The store needed to model exceptions
3720  * @param   *op1   The first operand.
3721  * @param   *op2   The second operand.
3722  */
3723 ir_node *new_Div    (ir_node *memop, ir_node *op1, ir_node *op2);
3724
3725 /** Constructor for a Mod node.
3726  *
3727  * Adds the node to the block in current_ir_block.
3728  *
3729  * @param   *memop The store needed to model exceptions
3730  * @param   *op1   The first operand.
3731  * @param   *op2   The second operand.
3732  */
3733 ir_node *new_Mod    (ir_node *memop, ir_node *op1, ir_node *op2);
3734
3735 /** Constructor for a Abs node.
3736  *
3737  * Adds the node to the block in current_ir_block.
3738  *
3739  * @param   *op    The operand
3740  * @param   *mode  The mode of the operands and the result.
3741  */
3742 ir_node *new_Abs    (ir_node *op,                ir_mode *mode);
3743
3744 /** Constructor for a And node.
3745  *
3746  * Adds the node to the block in current_ir_block.
3747  *
3748  * @param   *op1   The first operand.
3749  * @param   *op2   The second operand.
3750  * @param   *mode  The mode of the operands and the result.
3751  */
3752 ir_node *new_And    (ir_node *op1, ir_node *op2, ir_mode *mode);
3753
3754 /**
3755  * Constructor for a Or node. Adds the node to the block in current_ir_block.
3756  *
3757  * @param   *op1   The first operand.
3758  * @param   *op2   The second operand.
3759  * @param   *mode  The mode of the operands and the result.
3760  */
3761 ir_node *new_Or     (ir_node *op1, ir_node *op2, ir_mode *mode);
3762
3763 /**
3764  * Constructor for a Eor node. Adds the node to the block in current_ir_block.
3765  *
3766  * @param   *op1   The first operand.
3767  * @param   *op2   The second operand.
3768  * @param   *mode  The mode of the operands and the results.
3769  */
3770 ir_node *new_Eor    (ir_node *op1, ir_node *op2, ir_mode *mode);
3771
3772 /** Constructor for a Not node.
3773  *
3774  * Adds the node to the block in current_ir_block.
3775  *
3776  * @param   *op    The operand.
3777  * @param   *mode  The mode of the operand and the result.
3778  */
3779 ir_node *new_Not    (ir_node *op,                ir_mode *mode);
3780
3781 /** Constructor for a Shl node.
3782  *
3783  * Adds the node to the block in current_ir_block.
3784  *
3785  * @param   *op    The operand.
3786  * @param   *k     The number of bits to  shift the operand .
3787  * @param   *mode  The mode of the operand and the result.
3788  */
3789 ir_node *new_Shl    (ir_node *op,  ir_node *k,   ir_mode *mode);
3790
3791 /**
3792  * Constructor for a Shr node. Adds the node to the block in current_ir_block.
3793  *
3794  * @param   *op    The operand.
3795  * @param   *k     The number of bits to  shift the operand .
3796  * @param   *mode  The mode of the operand and the result.
3797  */
3798 ir_node *new_Shr    (ir_node *op,  ir_node *k,   ir_mode *mode);
3799
3800 /** Constructor for a Shrs node.
3801  *
3802  * Adds the node to the block in current_ir_block.
3803  *
3804  * @param   *op    The operand.
3805  * @param   *k     The number of bits to  shift the operand .
3806  * @param   *mode  The mode of the operand and the result.
3807  */
3808 ir_node *new_Shrs   (ir_node *op,  ir_node *k,   ir_mode *mode);
3809
3810 /** Constructor for a Rot node.
3811  *
3812  * Adds the node to the block in current_ir_block.
3813  *
3814  * @param   *op    The operand.
3815  * @param   *k     The number of bits to rotate the operand.
3816  * @param   *mode  The mode of the operand.
3817  */
3818 ir_node *new_Rot    (ir_node *op,  ir_node *k,   ir_mode *mode);
3819
3820 /** Constructor for a Cmp node.
3821  *
3822  * Adds the node to the block in current_ir_block.
3823  *
3824  * @param   *op1   The first operand.
3825  * @param   *op2   The second operand.
3826  */
3827 ir_node *new_Cmp    (ir_node *op1, ir_node *op2);
3828
3829 /** Constructor for a Conv node.
3830  *
3831  * Adds the node to the block in current_ir_block.
3832  *
3833  * @param   *op    The operand.
3834  * @param   *mode  The mode of this the operand muss be converted .
3835  */
3836 ir_node *new_Conv   (ir_node *op, ir_mode *mode);
3837
3838 /** Constructor for a Cast node.
3839  *
3840  * Adds the node to the block in current_ir_block.
3841  * High level type cast
3842  *
3843  * @param   *op    The operand.
3844  * @param   *to_tp The type of this the operand muss be casted .
3845  */
3846 ir_node *new_Cast   (ir_node *op, ir_type *to_tp);
3847
3848 /** Constructor for a Carry node.
3849  *
3850  * Adds the node to the block in current_ir_block.
3851  *
3852  * @param   *op1   The first operand.
3853  * @param   *op2   The second operand.
3854  * @param   *mode  The mode of the operands and the result.
3855  */
3856 ir_node *new_Carry  (ir_node *op1, ir_node *op2, ir_mode *mode);
3857
3858 /** Constructor for a Borrow node.
3859  *
3860  * Adds the node to the block in current_ir_block.
3861  *
3862  * @param   *op1   The first operand.
3863  * @param   *op2   The second operand.
3864  * @param   *mode  The mode of the operands and the result.
3865  */
3866 ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode);
3867
3868 /** Constructor for a Phi node.
3869  *
3870  * Adds the node to the block in current_ir_block.
3871  *
3872  * @param arity  The number of predecessors.
3873  * @param *in    Array with predecessors.
3874  * @param *mode  The mode of it's inputs and output.
3875  */
3876 ir_node *new_Phi    (int arity, ir_node *in[], ir_mode *mode);
3877
3878 /** Constructor for a Load node.
3879  *
3880  * @param *store  The current memory.
3881  * @param *addr   A pointer to the variable to be read in this memory.
3882  * @param *mode   The mode of the value to be loaded.
3883  */
3884 ir_node *new_Load   (ir_node *store, ir_node *addr, ir_mode *mode);
3885
3886 /** Constructor for a Store node.
3887  *
3888  * @param *store  The current memory.
3889  * @param *addr   A pointer to the variable to be read in this memory.
3890  * @param *val    The value to write to this variable.
3891  */
3892 ir_node *new_Store  (ir_node *store, ir_node *addr, ir_node *val);
3893
3894 /** Constructor for a Alloc node.
3895  *
3896  * The Alloc node extends the memory by space for an entity of type alloc_type.
3897  * Adds the node to the block in current_ir_block.
3898  *
3899  * @param *store      The memory which shall contain the new variable.
3900  * @param *size       The number of bytes to allocate.
3901  * @param *alloc_type The type of the allocated variable.
3902  * @param where       Where to allocate the variable, either heap_alloc or stack_alloc.
3903  */
3904 ir_node *new_Alloc  (ir_node *store, ir_node *size, ir_type *alloc_type,
3905                      where_alloc where);
3906
3907 /** Constructor for a Free node.
3908  *
3909  * Frees the memory occupied by the entity pointed to by the pointer
3910  * arg.  Type indicates the type of the entity the argument points to.
3911  * Adds the node to the block in current_ir_block.
3912  *
3913  * @param *store      The memory which shall contain the new variable.
3914  * @param *ptr        The pointer to the object to free.
3915  * @param *size       The number of objects of type free_type to free in a sequence.
3916  * @param *free_type  The type of the freed variable.
3917  * @param where       Where the variable was allocated, either heap_alloc or stack_alloc.
3918  */
3919 ir_node *new_Free   (ir_node *store, ir_node *ptr, ir_node *size,
3920                      ir_type *free_type, where_alloc where);
3921
3922 /** Constructor for a  Sync node.
3923  *
3924  * Merges several memory values.  The node assumes that a variable
3925  * either occurs only in one of the memories, or it contains the same
3926  * value in all memories where it occurs.
3927  * Adds the node to the block in current_ir_block.
3928  *
3929  * @param  arity    The number of memories to synchronize.
3930  * @param  **in     An array of pointers to nodes that produce an output of type
3931  *                  memory.  The constructor copies this array.
3932  */
3933 ir_node *new_Sync   (int arity, ir_node *in[]);
3934
3935 /** Constructor for a Proj node.
3936  *
3937  * Projects a single value out of a tuple.  The parameter proj gives the
3938  * position of the value within the tuple.
3939  * Adds the node to the block in current_ir_block.
3940  *
3941  * @param arg    A node producing a tuple.
3942  * @param *mode  The mode of the value to project.
3943  * @param proj   The position of the value in the tuple.
3944  */
3945 ir_node *new_Proj   (ir_node *arg, ir_mode *mode, long proj);
3946
3947 /** Constructor for a Filter node.
3948  *
3949  * Constructor for a Filter node. Adds the node to the block in current_ir_block.
3950  * Filter is a node with two views used to construct the interprocedural view.
3951  * In intraprocedural view its semantics are identical to the Proj node.
3952  * In interprocedural view the Filter performs the Phi operation on method
3953  * parameters or results.  Other than a Phi a Filter node may not be removed
3954  * if it has only a single input.
3955  *
3956  * The constructor builds the Filter in intraprocedural view.
3957  *
3958  * @param *arg  The tuple value to project from.
3959  * @param *mode The mode of the projected value.
3960  * @param proj  The position in the tuple to project from.
3961  */
3962 ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj);
3963
3964 /** Constructor for a defaultProj node.
3965  *
3966  * Represents the default control flow of a Switch-Cond node.
3967  * Adds the node to the block in current_ir_block.
3968  *
3969  * @param arg       A node producing a tuple.
3970  * @param max_proj  The end  position of the value in the tuple.
3971  */
3972 ir_node *new_defaultProj (ir_node *arg, long max_proj);
3973
3974 /** Constructor for a Tuple node.
3975  *
3976  * This is an auxiliary node to replace a node that returns a tuple
3977  * without changing the corresponding Proj nodes.
3978  * Adds the node to the block in current_ir_block.
3979  *
3980  * @param arity   The number of tuple elements.
3981  * @param **in    An array containing pointers to the nodes producing the tuple elements.
3982  */
3983 ir_node *new_Tuple  (int arity, ir_node *in[]);
3984
3985 /** Constructor for an Id node.
3986  *
3987  * This is an auxiliary node to replace a node that returns a single
3988  * value. Adds the node to the block in current_ir_block.
3989  *
3990  * @param *val    The operand to Id.
3991  * @param *mode   The mode of *val.
3992  */
3993 ir_node *new_Id     (ir_node *val, ir_mode *mode);
3994
3995 /** Constructor for a Bad node.
3996  *
3997  * Returns the unique Bad node of the graph.  The same as
3998  * get_irg_bad().
3999  */
4000 ir_node *new_Bad    (void);
4001
4002 /** Constructor for a Confirm node.
4003  *
4004  * Specifies constraints for a value.  To support dataflow analyses.
4005  * Adds the node to the block in current_ir_block.
4006  *
4007  * Example: If the value never exceeds '100' this is expressed by placing a
4008  * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
4009  *
4010  * @param *val    The value we express a constraint for
4011  * @param *bound  The value to compare against. Must be a firm node, typically a constant.
4012  * @param cmp     The compare operation.
4013  */
4014 ir_node *new_Confirm (ir_node *val, ir_node *bound, pn_Cmp cmp);
4015
4016 /** Constructor for an Unknown node.
4017  *
4018  * Represents an arbitrary value.  Places the node in
4019  * the start block.
4020  *
4021  * @param *m      The mode of the unknown value.
4022  */
4023 ir_node *new_Unknown(ir_mode *m);
4024
4025 /** Constructor for a NoMem node.
4026  *
4027  * Returns the unique NoMem node of the graph.  The same as
4028  * get_irg_no_mem().
4029  */
4030 ir_node *new_NoMem  (void);
4031
4032 /** Constructor for a Mux node.
4033  *
4034  * Adds the node to the block in current_ir_block.
4035  *
4036  * @param *sel      The ir_node that calculates the boolean select.
4037  * @param *ir_true  The ir_node that calculates the true result.
4038  * @param *ir_false The ir_node that calculates the false result.
4039  * @param *mode     The mode of the node (and it_true and ir_false).
4040  */
4041 ir_node *new_Mux  (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
4042
4043 /** Constructor for a Psi node.
4044  *
4045  * @param *arity    The arity of the conditions
4046  * @param *conds    The array of mode_b conditions, length must be equal arity
4047  * @param *vals     The array of mode values, length must be equal arity + 1
4048  * @param *mode     The mode of the node (must be the mode of all vals).
4049  */
4050 ir_node *new_Psi (int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
4051
4052 /** Constructor for a CopyB node.
4053  *
4054  * Adds the node to the block in current_ir_block.
4055  *
4056  * @param *store      The current memory
4057  * @param *dst        The ir_node that represents the destination address.
4058  * @param *src        The ir_node that represents the source address.
4059  * @param *data_type  The type of the copied data
4060  */
4061 ir_node *new_CopyB(ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
4062
4063 /** Constructor for a InstOf node.
4064  *
4065  * A High-Level Type check.
4066  *
4067  * @param   *store     The memory in which the object the entity should be selected
4068  *                     from is allocated.
4069  * @param   *objptr    A pointer to a object of a class type.
4070  * @param   *type      The type of which objptr must be.
4071  */
4072 ir_node *new_InstOf (ir_node *store, ir_node *objptr, ir_type *type);
4073
4074 /**Constructor for a Raise node.
4075  *
4076  * A High-Level Exception throw.
4077  *
4078  * @param *store The current memory.
4079  * @param *obj   A pointer to the Except variable.
4080  */
4081 ir_node *new_Raise  (ir_node *store, ir_node *obj);
4082
4083 /** Constructor for a Bound node.
4084  *
4085  * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
4086  *
4087  * Adds the node to the block in current_ir_block.
4088  *
4089  * @param *store      The current memory
4090  * @param *idx        The ir_node that represents an index.
4091  * @param *lower      The ir_node that represents the lower bound for the index.
4092  * @param *upper      The ir_node that represents the upper bound for the index.
4093  */
4094 ir_node *new_Bound(ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
4095
4096 /*---------------------------------------------------------------------*/
4097 /* The comfortable interface.                                          */
4098 /* Supports automatic Phi node construction.                           */
4099 /* All routines of the block oriented interface except new_Block are   */
4100 /* needed also.                                                        */
4101 /*---------------------------------------------------------------------*/
4102
4103 /** Create an immature block.
4104  *
4105  * An immature block has an unknown number of predecessors.  Predecessors
4106  * can be added with add_immBlock_pred().  Once all predecessors are
4107  * added the block must be matured.
4108  *
4109  * Adds the block to the graph in current_ir_graph. Does set
4110  * current_block.  Can be used with automatic Phi node construction.
4111  * This constructor can only be used if the graph is in
4112  * state_building.
4113  */
4114 ir_node *new_d_immBlock (dbg_info *db);
4115 ir_node *new_immBlock (void);
4116
4117 /** Add a control flow edge to an immature block. */
4118 void add_immBlock_pred (ir_node *immblock, ir_node *jmp);
4119
4120 /** Finalize a Block node, when all control flows are known. */
4121 void mature_immBlock (ir_node *block);
4122 #define mature_cur_block() mature_immBlock(get_cur_block());
4123
4124
4125 /** Get the current value of a local variable.
4126  *
4127  * Use this function to obtain the last definition of the local variable
4128  * associated with pos.  Pos may not exceed the value passed as n_loc
4129  * to new_ir_graph.  This call automatically inserts Phi nodes.
4130  *
4131  * @param *db    A pointer for debug information.
4132  * @param  pos   The position/id of the local variable.
4133  * @param *mode  The mode of the value to get.
4134  */
4135 ir_node *get_d_value (dbg_info *db, int pos, ir_mode *mode);
4136 ir_node *get_value (int pos, ir_mode *mode);
4137
4138 /** Remark a new definition of a variable.
4139  *
4140  * Use this function to remember a new definition of the value
4141  * associated with pos. Pos may not exceed the value passed as n_loc
4142  * to new_ir_graph.  This call is needed to automatically inserts Phi
4143  * nodes.
4144  *
4145  * @param  pos   The position/id of the local variable.
4146  * @param *value The new value written to the local variable.
4147  */
4148 void set_value (int pos, ir_node *value);
4149
4150 /** Get the current memory state.
4151  *
4152  * Use this function to obtain the last definition of the memory
4153  * state.  This call automatically inserts Phi nodes for the memory
4154  * state value.
4155  */
4156 ir_node *get_store (void);
4157
4158 /** Remark a new definition of the memory state.
4159  *
4160  * Use this function to remember a new definition of the memory state.
4161  * This call is needed to automatically inserts Phi nodes.
4162  *
4163  * @param *store The new memory state.
4164  */
4165 void set_store (ir_node *store);
4166
4167 /** keep this node alive even if End is not control-reachable from it
4168  *
4169  * @param ka The node to keep alive.
4170  */
4171 void keep_alive (ir_node *ka);
4172
4173 /** Returns the frame type of the current graph */
4174 ir_type *get_cur_frame_type(void);
4175
4176
4177 /* --- initialize and finalize ir construction --- */
4178
4179 /** Puts the graph into state "phase_high" */
4180 void irg_finalize_cons (ir_graph *irg);
4181
4182 /** Puts the program and all graphs into state phase_high.
4183  *
4184  * This also remarks, the construction of types is finished,
4185  * e.g., that no more subtypes will be added.  */
4186 void irp_finalize_cons(void);
4187
4188 /* --- Initialization --- */
4189
4190 /**
4191  * This function is called, whenever a local variable is used before definition
4192  *
4193  * @param irg       the IR graph on which this happens
4194  * @param mode      the mode of the local var
4195  * @param pos       position chosen be the frontend for this variable (n_loc)
4196  *
4197  * @return a firm node of mode @p mode that initializes the var at position pos
4198  *
4199  * @note
4200  *      Do not return NULL!
4201  *      If this function is not set, FIRM will create a const node with tarval BAD.
4202  *      Use set_irg_loc_description()/get_irg_loc_description() to assign additional
4203  *      informations to local variables.
4204  */
4205 typedef ir_node *uninitialized_local_variable_func_t(ir_graph *irg, ir_mode *mode, int pos);
4206
4207 #endif /* _IRCONS_H_ */