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