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