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