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