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