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