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