missing new_SymConst_type() constructor added
[libfirm] / ir / ir / ircons.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/ir/ircons.h
4  * Purpose:     Various irnode constructors.  Automatic construction
5  *              of SSA representation.
6  * Author:      Martin Trapp, Christian Schaefer
7  * Modified by: Goetz Lindenmaier, Boris Boesler
8  * Created:
9  * CVS-ID:      $Id$
10  * Copyright:   (c) 1998-2003 Universität Karlsruhe
11  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
12  */
13
14 /**
15  @todo
16  Ideas for 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, entity *ent);
259  *    ir_node *new_Sel    (ir_node *store, ir_node *objptr, int arity,
260  *                         ir_node **in, entity *ent);
261  *    ir_node *new_Call   (ir_node *store, ir_node *callee, int arity,
262  *                 ir_node **in, type_method *type);
263  *    ir_node *new_Add    (ir_node *op1, ir_node *op2, ir_mode *mode);
264  *    ir_node *new_Sub    (ir_node *op1, ir_node *op2, ir_mode *mode);
265  *    ir_node *new_Minus  (ir_node *op,  ir_mode *mode);
266  *    ir_node *new_Mul    (ir_node *op1, ir_node *op2, ir_mode *mode);
267  *    ir_node *new_Quot   (ir_node *memop, ir_node *op1, ir_node *op2);
268  *    ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
269  *    ir_node *new_Div    (ir_node *memop, ir_node *op1, ir_node *op2);
270  *    ir_node *new_Mod    (ir_node *memop, ir_node *op1, ir_node *op2);
271  *    ir_node *new_Abs    (ir_node *op,                ir_mode *mode);
272  *    ir_node *new_And    (ir_node *op1, ir_node *op2, ir_mode *mode);
273  *    ir_node *new_Or     (ir_node *op1, ir_node *op2, ir_mode *mode);
274  *    ir_node *new_Eor    (ir_node *op1, ir_node *op2, ir_mode *mode);
275  *    ir_node *new_Not    (ir_node *op,                ir_mode *mode);
276  *    ir_node *new_Shl    (ir_node *op,  ir_node *k,   ir_mode *mode);
277  *    ir_node *new_Shr    (ir_node *op,  ir_node *k,   ir_mode *mode);
278  *    ir_node *new_Shrs   (ir_node *op,  ir_node *k,   ir_mode *mode);
279  *    ir_node *new_Rot    (ir_node *op,  ir_node *k,   ir_mode *mode);
280  *    ir_node *new_Cmp    (ir_node *op1, ir_node *op2);
281  *    ir_node *new_Conv   (ir_node *op, ir_mode *mode);
282  *    ir_node *new_Cast   (ir_node *op, ir_type *to_tp);
283  *    ir_node *new_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, 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  *                      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, entity *symbol, ir_type *tp);
1294
1295 /** Constructor for a SymConst addr_name node.
1296  *
1297  * Same as new_rd_SymConst_type, except that the constructor is tailored for
1298  * symconst_addr_ent.
1299  * Adds the SymConst to the start block of irg. */
1300 ir_node *new_rd_SymConst_addr_name (dbg_info *db, ir_graph *irg, ident *symbol, ir_type *tp);
1301
1302 /** Constructor for a SymConst type_tag 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_type_tag (dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp);
1308
1309 /** Constructor for a SymConst size node.
1310  *
1311  * Same as new_rd_SymConst_type, except that the constructor is tailored for
1312  * symconst_type_size.
1313  * Adds the SymConst to the start block of irg. */
1314 ir_node *new_rd_SymConst_size (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_align.
1320  * Adds the SymConst to the start block of irg. */
1321 ir_node *new_rd_SymConst_align (dbg_info *db, ir_graph *irg, ir_type *symbol, ir_type *tp);
1322
1323 /** Constructor for a simpleSel node.
1324  *
1325  *  This is a shortcut for the new_rd_Sel() constructor.  To be used for
1326  *  Sel nodes that do not select from an array, i.e., have no index
1327  *  inputs.  It adds the two parameters 0, NULL.
1328  *
1329  * @param   *db        A pointer for debug information.
1330  * @param   *irg       The ir graph the node  belongs to.
1331  * @param   *block     The ir block the node belongs to.
1332  * @param   *store     The memory in which the object the entity should be
1333  *                     selected from is allocated.
1334  * @param   *objptr    The object from that the Sel operation selects a
1335  *                     single attribute out.
1336  * @param   *ent       The entity to select.
1337  */
1338 ir_node *new_rd_simpleSel (dbg_info *db, ir_graph *irg, ir_node *block,
1339                   ir_node *store, ir_node *objptr, entity *ent);
1340
1341 /** Constructor for a Sel node.
1342  *
1343  * The select node selects an entity (field or method) from an entity
1344  * with a compound type.  It explicitly specifies the entity selected.
1345  * Dynamically the node may select entities that overwrite the given
1346  * entity.  If the selected entity is an array element entity the Sel
1347  * node takes the required array indices as inputs.
1348  *
1349  * @param   *db        A pointer for debug information.
1350  * @param   *irg       The ir graph the node  belongs to.
1351  * @param   *block     The ir block the node belongs to.
1352  * @param   *store     The memory in which the object the entity should be selected
1353  *                     from is allocated.
1354  * @param   *objptr    A pointer to a compound entity the Sel operation selects a
1355  *                     single attribute from.
1356  * @param   *n_index   The number of array indices needed to select an array element entity.
1357  * @param   *index[]   If the compound entity is an array the indices of the selected
1358  *                     element entity.  The constructor copies this array.
1359  * @param   *ent       The entity to select.
1360  */
1361 ir_node *new_rd_Sel    (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1362                         ir_node *objptr, int n_index, ir_node *index[], entity *ent);
1363
1364 /** Constructor for a Call node.
1365  *
1366  *  Represents all kinds of method and function calls.
1367  *
1368  * @param   *db     A pointer for debug information.
1369  * @param   *irg    The ir graph the node  belongs to.
1370  * @param   *block  The ir block the node belongs to.
1371  * @param   *store  The current memory state.
1372  * @param   *callee A pointer to the called procedure.
1373  * @param   arity   The number of procedure parameters.
1374  * @param   *in[]   An array with the procedure parameters. The constructor copies this array.
1375  * @param   *tp     Type information of the procedure called.
1376  */
1377 ir_node *new_rd_Call   (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1378                         ir_node *callee, int arity, ir_node *in[], ir_type *tp);
1379
1380 /** Constructor for a Add node.
1381  *
1382  * @param   *db    A pointer for debug information.
1383  * @param   *irg   The ir graph the node  belongs to.
1384  * @param   *block The ir block the node belongs to.
1385  * @param   *op1   The first operand.
1386  * @param   *op2   The second operand.
1387  * @param   *mode  The mode of the operands and the result.
1388  */
1389 ir_node *new_rd_Add    (dbg_info *db, ir_graph *irg, ir_node *block,
1390                         ir_node *op1, ir_node *op2, ir_mode *mode);
1391
1392 /** Constructor for a Sub node.
1393  *
1394  * @param   *db    A pointer for debug information.
1395  * @param   *irg   The ir graph the node  belongs to.
1396  * @param   *block The ir block the node belongs to.
1397  * @param   *op1   The first operand.
1398  * @param   *op2   The second operand.
1399  * @param   *mode  The mode of the operands and the result.
1400  */
1401 ir_node *new_rd_Sub    (dbg_info *db, ir_graph *irg, ir_node *block,
1402                         ir_node *op1, ir_node *op2, ir_mode *mode);
1403
1404 /** Constructor for a Minus node.
1405  *
1406  * @param   *db    A pointer for debug information.
1407  * @param   *irg   The ir graph the node  belongs to.
1408  * @param   *block The ir block the node belongs to.
1409  * @param   *op    The operand .
1410  * @param   *mode  The mode of the operand and the result.
1411  */
1412 ir_node *new_rd_Minus  (dbg_info *db, ir_graph *irg, ir_node *block,
1413                         ir_node *op,  ir_mode *mode);
1414
1415 /** Constructor for a Mul node.
1416  *
1417  * @param   *db    A pointer for debug information.
1418  * @param   *irg   The ir graph the node  belongs to.
1419  * @param   *block The ir block the node belongs to.
1420  * @param   *op1   The first operand.
1421  * @param   *op2   The second operand.
1422  * @param   *mode  The mode of the operands and the result.
1423  */
1424 ir_node *new_rd_Mul    (dbg_info *db, ir_graph *irg, ir_node *block,
1425                ir_node *op1, ir_node *op2, ir_mode *mode);
1426
1427 /** Constructor for a Quot node.
1428  *
1429  * @param   *db    A pointer for debug information.
1430  * @param   *irg   The ir graph the node  belongs to.
1431  * @param   *block The ir block the node belongs to.
1432  * @param   *memop The store needed to model exceptions
1433  * @param   *op1   The first operand.
1434  * @param   *op2   The second operand.
1435  */
1436 ir_node *new_rd_Quot   (dbg_info *db, ir_graph *irg, ir_node *block,
1437                ir_node *memop, ir_node *op1, ir_node *op2);
1438
1439 /** Constructor for a DivMod node.
1440  *
1441  * @param   *db    A pointer for debug information.
1442  * @param   *irg   The ir graph the node  belongs to.
1443  * @param   *block The ir block the node belongs to.
1444  * @param   *memop The store needed to model exceptions
1445  * @param   *op1   The first operand.
1446  * @param   *op2   The second operand.
1447  */
1448 ir_node *new_rd_DivMod (dbg_info *db, ir_graph *irg, ir_node *block,
1449                ir_node *memop, ir_node *op1, ir_node *op2);
1450
1451 /** Constructor for a Div node.
1452  *
1453  * @param   *db    A pointer for debug information.
1454  * @param   *irg   The ir graph the node  belongs to.
1455  * @param   *block The ir block the node belongs to.
1456  * @param   *memop The store needed to model exceptions
1457  * @param   *op1   The first operand.
1458  * @param   *op2   The second operand.
1459  */
1460 ir_node *new_rd_Div    (dbg_info *db, ir_graph *irg, ir_node *block,
1461                ir_node *memop, ir_node *op1, ir_node *op2);
1462
1463 /** Constructor for a Mod node.
1464  *
1465  * @param   *db    A pointer for debug information.
1466  * @param   *irg   The ir graph the node  belongs to.
1467  * @param   *block The ir block the node belongs to.
1468  * @param   *memop The store needed to model exceptions
1469  * @param   *op1   The first operand.
1470  * @param   *op2   The second operand.
1471  */
1472 ir_node *new_rd_Mod    (dbg_info *db, ir_graph *irg, ir_node *block,
1473                         ir_node *memop, ir_node *op1, ir_node *op2);
1474
1475 /** Constructor for a Abs node.
1476  *
1477  * @param   *db    A pointer for debug information.
1478  * @param   *irg   The ir graph the node  belongs to.
1479  * @param   *block The ir block the node belongs to.
1480  * @param   *op    The operand
1481  * @param   *mode  The mode of the operands and the result.
1482  */
1483 ir_node *new_rd_Abs    (dbg_info *db, ir_graph *irg, ir_node *block,
1484                        ir_node *op, ir_mode *mode);
1485
1486 /** Constructor for a And node.
1487  *
1488  * @param   *db    A pointer for debug information.
1489  * @param   *irg   The ir graph the node  belongs to.
1490  * @param   *block The ir block the node belongs to.
1491  * @param   *op1   The first operand.
1492  * @param   *op2   The second operand.
1493  * @param   *mode  The mode of the operands and the result.
1494  */
1495 ir_node *new_rd_And    (dbg_info *db, ir_graph *irg, ir_node *block,
1496                         ir_node *op1, ir_node *op2, ir_mode *mode);
1497
1498 /** Constructor for a Or node.
1499  *
1500  * @param   *db    A pointer for debug information.
1501  * @param   *irg   The ir graph the node  belongs to.
1502  * @param   *block The ir block the node belongs to.
1503  * @param   *op1   The first operand.
1504  * @param   *op2   The second operand.
1505  * @param   *mode  The mode of the operands and the result.
1506  */
1507 ir_node *new_rd_Or     (dbg_info *db, ir_graph *irg, ir_node *block,
1508                         ir_node *op1, ir_node *op2, ir_mode *mode);
1509
1510 /** Constructor for a Eor node.
1511  *
1512  * @param   *db    A pointer for debug information.
1513  * @param   *irg   The ir graph the node  belongs to.
1514  * @param   *block The ir block the node belongs to.
1515  * @param   *op1   The first operand.
1516  * @param   *op2   The second operand.
1517  * @param   *mode  The mode of the operands and the results.
1518  */
1519 ir_node *new_rd_Eor    (dbg_info *db, ir_graph *irg, ir_node *block,
1520                         ir_node *op1, ir_node *op2, ir_mode *mode);
1521
1522 /** Constructor for a Not node.
1523  *
1524  * @param   *db    A pointer for debug information.
1525  * @param   *irg   The ir graph the node  belongs to.
1526  * @param   *block The ir block the node belongs to.
1527  * @param   *op    The operand.
1528  * @param   *mode  The mode of the operand and the result.
1529  */
1530 ir_node *new_rd_Not    (dbg_info *db, ir_graph *irg, ir_node *block,
1531                ir_node *op, ir_mode *mode);
1532
1533 /** Constructor for a Cmp node.
1534  *
1535  * @param   *db    A pointer for debug information.
1536  * @param   *irg   The ir graph the node  belongs to.
1537  * @param   *block The ir block the node belongs to.
1538  * @param   *op1   The first operand.
1539  * @param   *op2   The second operand.
1540  */
1541 ir_node *new_rd_Cmp    (dbg_info *db, ir_graph *irg, ir_node *block,
1542                ir_node *op1, ir_node *op2);
1543
1544 /** Constructor for a Shl node.
1545  *
1546  * @param   *db    A pointer for debug information.
1547  * @param   *irg   The ir graph the node  belongs to.
1548  * @param   *block The ir block the node belongs to.
1549  * @param   *op    The operand.
1550  * @param   *k     The number of bits to  shift the operand .
1551  * @param   *mode  The mode of the operand and the result.
1552  */
1553 ir_node *new_rd_Shl    (dbg_info *db, ir_graph *irg, ir_node *block,
1554                ir_node *op, ir_node *k, ir_mode *mode);
1555
1556 /** Constructor for a Shr node.
1557  *
1558  * @param   *db    A pointer for debug information.
1559  * @param   *irg   The ir graph the node  belongs to.
1560  * @param   *block The ir block the node belongs to.
1561  * @param   *op    The operand.
1562  * @param   *k     The number of bits to shift the operand .
1563  * @param   *mode  The mode of the operand and the result.
1564  */
1565 ir_node *new_rd_Shr    (dbg_info *db, ir_graph *irg, ir_node *block,
1566                ir_node *op, ir_node *k, ir_mode *mode);
1567
1568 /** Constructor for a Shrs node.
1569  *
1570  * @param   *db    A pointer for debug information.
1571  * @param   *irg   The ir graph the node  belongs to.
1572  * @param   *block The ir block the node belongs to.
1573  * @param   *op    The operand.
1574  * @param   *k     The number of bits to shift the operand.
1575  * @param   *mode  The mode of the operand and the result.
1576  */
1577 ir_node *new_rd_Shrs   (dbg_info *db, ir_graph *irg, ir_node *block,
1578                ir_node *op, ir_node *k, ir_mode *mode);
1579
1580 /** Constructor for a Rot node.
1581  *
1582  * @param   *db    A pointer for debug information.
1583  * @param   *irg   The ir graph the node  belongs to.
1584  * @param   *block The ir block the node belongs to.
1585  * @param   *op    The operand.
1586  * @param   *k     The number of bits to rotate the operand.
1587  * @param   *mode  The mode of the operand.
1588  */
1589 ir_node *new_rd_Rot    (dbg_info *db, ir_graph *irg, ir_node *block,
1590                ir_node *op, ir_node *k, ir_mode *mode);
1591
1592
1593 /** Constructor for a Conv node.
1594  *
1595  * @param   *db    A pointer for debug information.
1596  * @param   *irg   The ir graph the node  belongs to.
1597  * @param   *block The ir block the node belongs to.
1598  * @param   *op    The operand.
1599  * @param   *mode  The mode of this the operand muss be converted .
1600  */
1601 ir_node *new_rd_Conv   (dbg_info *db, ir_graph *irg, ir_node *block,
1602                ir_node *op, ir_mode *mode);
1603
1604 /** Constructor for a Cast node.
1605  *
1606  * High level type cast.
1607  *
1608  * @param   *db    A pointer for debug information.
1609  * @param   *irg   The ir graph the node  belongs to.
1610  * @param   *block The ir block the node belongs to.
1611  * @param   *op    The operand.
1612  * @param   *to_tp The type of this the operand muss be casted .
1613  */
1614 ir_node *new_rd_Cast   (dbg_info *db, ir_graph *irg, ir_node *block,
1615                         ir_node *op, ir_type *to_tp);
1616
1617 /** Constructor for a Carry node.
1618  *
1619  * @param   *db    A pointer for debug information.
1620  * @param   *irg   The ir graph the node  belongs to.
1621  * @param   *block The ir block the node belongs to.
1622  * @param   *op1   The first operand.
1623  * @param   *op2   The second operand.
1624  * @param   *mode  The mode of the operands and the result.
1625  */
1626 ir_node *new_rd_Carry  (dbg_info *db, ir_graph *irg, ir_node *block,
1627                         ir_node *op1, ir_node *op2, ir_mode *mode);
1628
1629 /** Constructor for a Borrow node.
1630  *
1631  * @param   *db    A pointer for debug information.
1632  * @param   *irg   The ir graph the node  belongs to.
1633  * @param   *block The ir block the node belongs to.
1634  * @param   *op1   The first operand.
1635  * @param   *op2   The second operand.
1636  * @param   *mode  The mode of the operands and the result.
1637  */
1638 ir_node *new_rd_Borrow (dbg_info *db, ir_graph *irg, ir_node *block,
1639                         ir_node *op1, ir_node *op2, ir_mode *mode);
1640
1641 /** Constructor for a Phi node.
1642  *
1643  * @param *db    A pointer for debug information.
1644  * @param *irg   The ir graph the node  belongs to.
1645  * @param *block The ir block the node belongs to.
1646  * @param arity  The number of predecessors
1647  * @param *in[]  Array with predecessors.  The constructor copies this array.
1648  * @param *mode  The mode of it's inputs and output.
1649  */
1650 ir_node *new_rd_Phi    (dbg_info *db, ir_graph *irg, ir_node *block, int arity,
1651                         ir_node *in[], ir_mode *mode);
1652
1653 /** Constructor for a Load node.
1654  *
1655  * @param *db    A pointer for debug information.
1656  * @param *irg   The ir graph the node  belongs to.
1657  * @param *block The ir block the node belongs to.
1658  * @param *store The current memory
1659  * @param *adr   A pointer to the variable to be read in this memory.
1660  * @param *mode  The mode of the value to be loaded.
1661  */
1662 ir_node *new_rd_Load   (dbg_info *db, ir_graph *irg, ir_node *block,
1663                         ir_node *store, ir_node *adr, ir_mode *mode);
1664
1665 /** Constructor for a Store node.
1666  *
1667  * @param *db    A pointer for debug information.
1668  * @param *irg   The ir graph the node  belongs to.
1669  * @param *block The ir block the node belongs to.
1670  * @param *store The current memory
1671  * @param *adr   A pointer to the variable to be read in this memory.
1672  * @param *val   The value to write to this variable.
1673  */
1674 ir_node *new_rd_Store  (dbg_info *db, ir_graph *irg, ir_node *block,
1675                ir_node *store, ir_node *adr, ir_node *val);
1676
1677 /** Constructor for a Alloc node.
1678  *
1679  * The Alloc node extends the memory by space for an entity of type alloc_type.
1680  *
1681  * @param *db         A pointer for debug information.
1682  * @param *irg        The ir graph the node  belongs to.
1683  * @param *block      The ir block the node belongs to.
1684  * @param *store      The memory which shall contain the new variable.
1685  * @param *size       The number of bytes to allocate.
1686  * @param *alloc_type The type of the allocated variable.
1687  * @param where       Where to allocate the variable, either heap_alloc or stack_alloc.
1688  */
1689 ir_node *new_rd_Alloc  (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1690                ir_node *size, ir_type *alloc_type, where_alloc where);
1691
1692 /** Constructor for a Free node.
1693  *
1694  * Frees the memory occupied by the entity pointed to by the pointer
1695  * arg.  Type indicates the type of the entity the argument points to.
1696  *
1697  * @param *db         A pointer for debug information.
1698  * @param *irg        The ir graph the node  belongs to.
1699  * @param *block      The ir block the node belongs to.
1700  * @param *store      The memory which shall contain the new variable.
1701  * @param *ptr        The pointer to the object to free.
1702  * @param *size       The number of objects of type free_type to free in a sequence.
1703  * @param *free_type  The type of the freed variable.
1704  * @param where       Where the variable was allocated, either heap_alloc or stack_alloc.
1705  */
1706 ir_node *new_rd_Free   (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1707                         ir_node *ptr, ir_node *size, ir_type *free_type, where_alloc where);
1708
1709 /** Constructor for a Sync node.
1710  *
1711  * Merges several memory values.  The node assumes that a variable
1712  * either occurs only in one of the memories, or it contains the same
1713  * value in all memories where it occurs.
1714  *
1715  * @param *db       A pointer for debug information.
1716  * @param *irg      The ir graph the node  belongs to.
1717  * @param *block    The ir block the node belongs to.
1718  * @param  arity    The number of memories to synchronize.
1719  * @param  *in[]    An array of pointers to nodes that produce an output of type
1720  *                  memory.  The constructor copies this array.
1721  */
1722 ir_node *new_rd_Sync   (dbg_info *db, ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
1723
1724 /** Constructor for a Proj node.
1725  *
1726  * Projects a single value out of a tuple.  The parameter proj gives the
1727  * position of the value within the tuple.
1728  *
1729  * @param *db    A pointer for debug information.
1730  * @param *irg   The ir graph the node  belongs to.
1731  * @param *block The ir block the node belongs to.
1732  * @param arg    A node producing a tuple.  The node must have mode_T.
1733  * @param *mode  The mode of the value to project.
1734  * @param proj   The position of the value in the tuple.
1735  */
1736 ir_node *new_rd_Proj   (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1737                         ir_mode *mode, long proj);
1738
1739 /** Constructor for a defaultProj node.
1740  *
1741  * Represents the default control flow of a Switch-Cond node.
1742  *
1743  * @param *db       A pointer for debug information.
1744  * @param *irg      The ir graph the node  belongs to.
1745  * @param *block    The ir block the node belongs to.
1746  * @param arg       A node producing a tuple.
1747  * @param max_proj  The end position of the value in the tuple.
1748  */
1749 ir_node *new_rd_defaultProj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1750                              long max_proj);
1751
1752 /** Constructor for a Tuple node.
1753  *
1754  * This is an auxiliary node to replace a node that returns a tuple
1755  * without changing the corresponding Proj nodes.
1756  *
1757  * @param *db     A pointer for debug information.
1758  * @param *irg    The ir graph the node  belongs to.
1759  * @param *block  The ir block the node belongs to.
1760  * @param arity   The number of tuple elements.
1761  * @param *in[]   An array containing pointers to the nodes producing the tuple
1762  *                elements. The constructor copies this array.
1763  */
1764 ir_node *new_rd_Tuple  (dbg_info *db, ir_graph *irg, ir_node *block,
1765                         int arity, ir_node *in[]);
1766
1767 /** Constructor for a Id node.
1768  *
1769  * This is an auxiliary node to replace a node that returns a single
1770  * value.
1771  *
1772  * @param *db     A pointer for debug information.
1773  * @param *irg    The ir graph the node  belongs to.
1774  * @param *block  The ir block the node belongs to.
1775  * @param *val    The value
1776  * @param *mode   The mode of *val.
1777  */
1778 ir_node *new_rd_Id     (dbg_info *db, ir_graph *irg, ir_node *block,
1779                         ir_node *val, ir_mode *mode);
1780
1781 /** Constructor for a Bad node.
1782  *
1783  * Returns the unique Bad node of the graph.  The same as
1784  * get_irg_bad().
1785  *
1786  * @param *irg    The ir graph the node belongs to.
1787  */
1788 ir_node *new_rd_Bad    (ir_graph *irg);
1789
1790 /** Constructor for a Confirm node.
1791  *
1792  * Specifies constraints for a value.  To support dataflow analyses.
1793  *
1794  * Example: If the value never exceeds '100' this is expressed by placing a
1795  * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
1796  *
1797  * @param *irg    The ir graph the node belong to.
1798  * @param *block  The ir block the node belong to.
1799  * @param *db     A pointer for debug information.
1800  * @param *val    The value we express a constraint for
1801  * @param *bound  The value to compare against. Must be a firm node, typically a constant.
1802  * @param cmp     The compare operation.
1803  */
1804 ir_node *new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block,
1805              ir_node *val, ir_node *bound, pn_Cmp cmp);
1806
1807 /** Constructor for an Unknown node.
1808  *
1809  * Represents an arbitrary value.  Places the node in the start block.
1810  *
1811  * @param *irg    The ir graph the node  belongs to.
1812  * @param *m      The mode of the unknown value.
1813  */
1814 ir_node *new_rd_Unknown(ir_graph *irg, ir_mode *m);
1815
1816 /** Constructor for a CallBegin node.
1817  *
1818  * CallBegin represents control flow depending of the pointer value
1819  * representing the called method to the called methods.  The
1820  * constructor copies the method pointer input from the passed Call
1821  * node.
1822  *
1823  * @param *db     A pointer for debug information.
1824  * @param *irg    The ir graph the node belong to.
1825  * @param *block  The block the node belong to.
1826  * @param *callee The call node visible in the intra procedural view.
1827  */
1828 ir_node *new_rd_CallBegin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *callee);
1829
1830 /** Constructor for a EndReg node.
1831  *
1832  * Used to represent regular procedure end in interprocedual view.
1833  *
1834  * @param *db     A pointer for debug information.
1835  * @param *irg    The ir graph the node belong to.
1836  * @param *block  The block the node belong to.
1837  */
1838 ir_node *new_rd_EndReg (dbg_info *db, ir_graph *irg, ir_node *block);
1839
1840 /** Constructor for a EndExcept node.
1841  *
1842  * Used to represent exceptional procedure end in interprocedural view.
1843  *
1844  * @param *db     A pointer for debug information.
1845  * @param *irg    The ir graph the node belong to.
1846  * @param *block  The block the node belong to.
1847  */
1848 ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
1849
1850 /** Constructor for a Filter node.
1851  *
1852  * Adds the node to the block in current_ir_block.  Filter is a node
1853  * with two views used to construct the interprocedural view.  In
1854  * intraprocedural view its semantics are identical to the Proj node.
1855  * In interprocedural view the Filter performs the Phi operation on
1856  * method parameters or results.  Other than a Phi a Filter node may
1857  * not be removed if it has only a single input.
1858  *
1859  * The constructor builds the Filter in intraprocedural view.
1860  *
1861  * @param *db     A pointer for debug information.
1862  * @param *irg    The ir graph the node belong to.
1863  * @param *block  The block the node belong to.
1864  * @param *arg  The tuple value to project from.
1865  * @param *mode The mode of the projected value.
1866  * @param proj  The position in the tuple to project from.
1867  */
1868 ir_node *new_rd_Filter (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1869                         ir_mode *mode, long proj);
1870
1871 /** Constructor for a NoMem node.
1872  *
1873  * Returns the unique NoMem node of the graph.  The same as
1874  * get_irg_no_mem().
1875  *
1876  * @param *irg    The ir graph the node belongs to.
1877  */
1878 ir_node *new_rd_NoMem  (ir_graph *irg);
1879
1880 /** Constructor for a Mux node.
1881  *
1882  * @param *db       A pointer for debug information.
1883  * @param *irg      The ir graph the node belong to.
1884  * @param *block    The block the node belong to.
1885  * @param *sel      The ir_node that calculates the boolean select.
1886  * @param *ir_true  The ir_node that calculates the true result.
1887  * @param *ir_false The ir_node that calculates the false result.
1888  * @param *mode     The mode of the node (and it_true and ir_false).
1889  */
1890 ir_node *new_rd_Mux  (dbg_info *db, ir_graph *irg, ir_node *block,
1891     ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
1892
1893 /** Constructor for a Psi node.
1894  *
1895  * @param *db       A pointer for debug information.
1896  * @param *irg      The ir graph the node belong to.
1897  * @param *block    The block the node belong to.
1898  * @param *arity    The arity of the conditions
1899  * @param *conds    The array of mode_b conditions, length must be equal arity
1900  * @param *vals     The array of mode values, length must be equal arity + 1
1901  * @param *mode     The mode of the node (must be the mode of all vals).
1902  */
1903 ir_node *new_rd_Psi (dbg_info *db, ir_graph *irg, ir_node *block,
1904                      int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
1905
1906 /** Constructor for a CopyB node.
1907  *
1908  * @param *db         A pointer for debug information.
1909  * @param *irg        The ir graph the node belong to.
1910  * @param *block      The block the node belong to.
1911  * @param *store      The current memory
1912  * @param *dst        The ir_node that represents the destination address.
1913  * @param *src        The ir_node that represents the source address.
1914  * @param *data_type  The type of the copied data
1915  */
1916 ir_node *new_rd_CopyB(dbg_info *db, ir_graph *irg, ir_node *block,
1917     ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
1918
1919 /** Constructor for a InstOf node.
1920  *
1921  * A High-Level Type check.
1922  *
1923  * @param   *db        A pointer for debug information.
1924  * @param   *irg       The ir graph the node  belongs to.
1925  * @param   *block     The ir block the node belongs to.
1926  * @param   *store     The memory in which the object the entity should be selected
1927  *                     from is allocated.
1928  * @param   *objptr    A pointer to a object of a class type.
1929  * @param   *type      The type of which objptr must be.
1930  */
1931 ir_node *new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1932                         ir_node *objptr, ir_type *type);
1933
1934 /** Constructor for a Raise node.
1935  *
1936  * A High-Level Exception throw.
1937  *
1938  * @param *db    A pointer for debug information.
1939  * @param *irg   The ir graph the node  belongs to.
1940  * @param *block The ir block the node belongs to.
1941  * @param *store The current memory.
1942  * @param *obj   A pointer to the Except variable.
1943  */
1944 ir_node *new_rd_Raise  (dbg_info *db, ir_graph *irg, ir_node *block,
1945                         ir_node *store, ir_node *obj);
1946
1947 /** Constructor for a Bound node.
1948  *
1949  * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
1950  *
1951  * @param *db         A pointer for debug information.
1952  * @param *irg        The ir graph the node belong to.
1953  * @param *block      The block the node belong to.
1954  * @param *store      The current memory.
1955  * @param *idx        The ir_node that represents an index.
1956  * @param *lower      The ir_node that represents the lower bound for the index.
1957  * @param *upper      The ir_node that represents the upper bound for the index.
1958  */
1959 ir_node *new_rd_Bound(dbg_info *db, ir_graph *irg, ir_node *block,
1960     ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
1961
1962 /** Constructor for a Pin node.
1963  *
1964  * @param *db         A pointer for debug information.
1965  * @param *irg        The ir graph the node belong to.
1966  * @param *block      The block the node belong to.
1967  * @param *node       The node which value should be pinned.
1968  */
1969 ir_node *new_rd_Pin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *node);
1970
1971 /*-------------------------------------------------------------------------*/
1972 /* The raw interface without debug support                                 */
1973 /*-------------------------------------------------------------------------*/
1974
1975 /** Constructor for a Block node.
1976  *
1977  * Constructs a mature block with the given predecessors.  Use Unknown
1978  * nodes as predecessors to construct a block if the number of
1979  * predecessors is known, but not the predecessors themselves.  This
1980  * constructor does not set current_block.  It not be used with
1981  * automatic Phi node construction.
1982  *
1983  *
1984  * @param irg    The ir graph the block belongs to.
1985  * @param arity  The number of control predecessors.
1986  * @param in[]   An array of control predecessors.  The length of
1987  *               the array must be 'arity'. The constructor copies this array.
1988  */
1989 ir_node *new_r_Block  (ir_graph *irg,  int arity, ir_node *in[]);
1990
1991 /** Constructor for a Start node.
1992  *
1993  * @param *irg   The ir graph the node belongs to.
1994  * @param *block The ir block the node belongs to.
1995  */
1996 ir_node *new_r_Start  (ir_graph *irg, ir_node *block);
1997
1998 /** Constructor for a End 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_End    (ir_graph *irg, ir_node *block);
2004
2005 /** Constructor for a Jmp node.
2006  *
2007  * Jmp represents control flow to a single control successor.
2008  *
2009  * @param *irg    The ir graph the node belongs to.
2010  * @param *block  The ir block the node belongs to.
2011  */
2012 ir_node *new_r_Jmp    (ir_graph *irg, ir_node *block);
2013
2014 /** Constructor for an IJmp node.
2015  *
2016  * IJmp represents control flow to a single control successor not
2017  * statically known i.e. an indirect Jmp.
2018  *
2019  * @param *irg    The ir graph the node belongs to.
2020  * @param *block  The ir block the node belongs to.
2021  * @param *tgt    The ir node representing the target address.
2022  */
2023 ir_node *new_r_IJmp   (ir_graph *irg, ir_node *block, ir_node *tgt);
2024
2025 /** Constructor for a Cond node.
2026  *
2027  * If c is mode_b represents a conditional branch (if/else). If c is
2028  * mode_Is/mode_Iu (?) represents a switch.  (Allocates dense Cond
2029  * node, default Proj is 0.)
2030  *
2031  * This is not consistent:  Input to Cond is Is, Proj has as proj number
2032  * longs.
2033  *
2034  * @param *irg   The ir graph the node  belongs to.
2035  * @param *block The ir block the node belongs to.
2036  * @param *c     The conditions parameter.Can be of mode b or I_u.
2037  */
2038 ir_node *new_r_Cond   (ir_graph *irg, ir_node *block, ir_node *c);
2039
2040 /** Constructor for a Return node.
2041  *
2042  * Returns the memory an zero or more return values.  Only node that
2043  * can end regular control flow.
2044  *
2045  * @param *irg   The ir graph the node  belongs to.
2046  * @param *block The ir block the node belongs to.
2047  * @param *store The state of memory.
2048  * @param arity  Number of array indices.
2049  * @param *in[]   Array with index inputs to the node. The constructor copies this array.
2050  */
2051 ir_node *new_r_Return (ir_graph *irg, ir_node *block,
2052                        ir_node *store, int arity, ir_node *in[]);
2053
2054 /** Constructor for a Const node.
2055  *
2056  * Constructor for a Const node. The constant represents a target
2057  * value.  Sets the type information to type_unknown.  (No more
2058  * supported: If tv is entity derives a somehow useful type.)
2059  *
2060  * @param *irg   The ir graph the node  belongs to.
2061  * @param *block The ir block the node belongs to.
2062  * @param *mode  The mode of the operands and the results.
2063  * @param *con   Points to an entry in the constant table.
2064  */
2065 ir_node *new_r_Const  (ir_graph *irg, ir_node *block,
2066                        ir_mode *mode, tarval *con);
2067
2068 /** Constructor for a Const node.
2069  *
2070  * Constructor for a Const node. The constant represents a target
2071  * value.  Sets the type information to type_unknown.  (No more
2072  * supported: If tv is entity derives a somehow useful type.)
2073  *
2074  * @param *irg   The ir graph the node  belongs to.
2075  * @param *block The ir block the node belongs to.
2076  * @param *mode  The mode of the operands and the results.
2077  * @param value  A value from which the tarval is made.
2078  */
2079 ir_node *new_r_Const_long(ir_graph *irg, ir_node *block,
2080                        ir_mode *mode, long value);
2081
2082 /** Constructor for a Const_type node.
2083  *
2084  * The constant represents a target value.  This constructor sets high
2085  * level type information for the constant value.
2086  *
2087  * @param *irg   The ir graph the node  belongs to.
2088  * @param *block The ir block the node belongs to.
2089  * @param *mode  The mode of the operands and results.
2090  * @param *con   Points to an entry in the constant table.
2091  * @param *tp    The type of the constant.
2092  */
2093 ir_node *new_r_Const_type(ir_graph *irg, ir_node *block,
2094            ir_mode *mode, tarval *con, ir_type *tp);
2095
2096 /** Constructor for a SymConst node.
2097  *
2098  *  This is the constructor for a symbolic constant.
2099  *    There are four kinds of symbolic constants:
2100  *    - type_tag  The symbolic constant represents a type tag.  The type the
2101  *                tag stands for is given explicitly.
2102  *    - size      The symbolic constant represents the size of a type.  The
2103  *                type of which the constant represents the size is given
2104  *                explicitly.
2105  *    - addr_name The symbolic constant represents the address of an entity
2106  *                (variable or method).  The variable is indicated by a name
2107  *                that is valid for linking.
2108  *    - addr_ent   The symbolic constant represents the address of an entity
2109  *                (variable or method).  The variable is given explicitly by
2110  *                a firm entity.
2111  *
2112  *    Inputs to the node:
2113  *      No inputs except the block it belongs to.
2114  *    Outputs of the node.
2115  *      An unsigned integer (I_u) or a pointer (P).
2116  *
2117  * @param *irg    The ir graph the node  belongs to.
2118  * @param *block  The ir block the node belongs to.
2119  * @param value   A type, entity or a ident depending on the SymConst kind.
2120  * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
2121  */
2122 ir_node *new_r_SymConst (ir_graph *irg, ir_node *block,
2123                          union symconst_symbol value, symconst_kind symkind);
2124
2125 /** Constructor for a simpleSel node.
2126  *
2127  *  This is a shortcut for the new_d_Sel() constructor.  To be used for
2128  *  Sel nodes that do not select from an array, i.e., have no index
2129  *  inputs.  It adds the two parameters 0, NULL.
2130  *
2131  * @param   *irg       The ir graph the node  belongs to.
2132  * @param   *block     The ir block the node belongs to.
2133  * @param   *store     The memory in which the object the entity should be selected
2134  *                     from is allocated.
2135  * @param   *objptr    The object from that the Sel operation selects a
2136  *                     single attribute out.
2137  * @param   *ent       The entity to select.
2138  */
2139 ir_node *new_r_simpleSel(ir_graph *irg, ir_node *block, ir_node *store,
2140                          ir_node *objptr, entity *ent);
2141
2142 /** Constructor for a Sel node.
2143  *
2144  * The select node selects an entity (field or method) from an entity
2145  * with a compound type.  It explicitly specifies the entity selected.
2146  * Dynamically the node may select entities that overwrite the given
2147  * entity.  If the selected entity is an array element entity the Sel
2148  * node takes the required array indices as inputs.
2149  *
2150  * @param   *irg       The ir graph the node  belongs to.
2151  * @param   *block     The ir block the node belongs to.
2152  * @param   *store     The memory in which the object the entity should be selected
2153  *                     from is allocated.
2154  * @param   *objptr    A pointer to a compound entity the Sel operation selects a
2155  *                     single attribute from.
2156  * @param   *n_index   The number of array indices needed to select an array element entity.
2157  * @param   *index[]   If the compound entity is an array the indices of the selected
2158  *                     element entity.  The constructor copies this array.
2159  * @param   *ent       The entity to select.
2160  */
2161 ir_node *new_r_Sel    (ir_graph *irg, ir_node *block, ir_node *store,
2162                        ir_node *objptr, int n_index, ir_node *index[],
2163                entity *ent);
2164
2165 /** Constructor for a Call node.
2166  *
2167  *  Represents all kinds of method and function calls.
2168  *
2169  * @param   *irg    The ir graph the node  belongs to.
2170  * @param   *block  The ir block the node belongs to.
2171  * @param   *store  The actual store.
2172  * @param   *callee A pointer to the called procedure.
2173  * @param   arity   The number of procedure parameters.
2174  * @param   *in[]   An array with the pointers to the parameters. The constructor copies this array.
2175  * @param   *tp     Type information of the procedure called.
2176  */
2177 ir_node *new_r_Call   (ir_graph *irg, ir_node *block, ir_node *store,
2178                ir_node *callee, int arity, ir_node *in[],
2179                ir_type *tp);
2180
2181 /** Constructor for a Add node.
2182  *
2183  * @param   *irg   The ir graph the node  belongs to.
2184  * @param   *block The ir block the node belongs to.
2185  * @param   *op1   The first operand.
2186  * @param   *op2   The second operand.
2187  * @param   *mode  The mode of the operands and the result.
2188  */
2189 ir_node *new_r_Add    (ir_graph *irg, ir_node *block,
2190                ir_node *op1, ir_node *op2, ir_mode *mode);
2191
2192 /**
2193  * Constructor for a Sub node.
2194  *
2195  * @param   *irg   The ir graph the node  belongs to.
2196  * @param   *block The ir block the node belongs to.
2197  * @param   *op1   The first operand.
2198  * @param   *op2   The second operand.
2199  * @param   *mode  The mode of the operands and the results.
2200  */
2201 ir_node *new_r_Sub    (ir_graph *irg, ir_node *block,
2202                ir_node *op1, ir_node *op2, ir_mode *mode);
2203
2204 /** Constructor for a Minus node.
2205  *
2206  * @param   *irg   The ir graph the node  belongs to.
2207  * @param   *block The ir block the node belongs to.
2208  * @param   *op   The operand.
2209  * @param   *mode  The mode of the operand and the result.
2210  */
2211 ir_node *new_r_Minus  (ir_graph *irg, ir_node *block,
2212                ir_node *op,  ir_mode *mode);
2213 /** Constructor for a Mul node.
2214  *
2215  * @param   *irg   The ir graph the node  belongs to.
2216  * @param   *block The ir block the node belongs to.
2217  * @param   *op1   The first operand.
2218  * @param   *op2   The second operand.
2219  * @param   *mode  The mode of the operands and the result.
2220  */
2221 ir_node *new_r_Mul    (ir_graph *irg, ir_node *block,
2222                ir_node *op1, ir_node *op2, ir_mode *mode);
2223
2224 /** Constructor for a Quot node.
2225  *
2226  * @param   *irg   The ir graph the node  belongs to.
2227  * @param   *block The ir block the node belongs to.
2228  * @param   *memop The store needed to model exceptions
2229  * @param   *op1   The first operand.
2230  * @param   *op2   The second operand.
2231  */
2232 ir_node *new_r_Quot   (ir_graph *irg, ir_node *block,
2233                ir_node *memop, ir_node *op1, ir_node *op2);
2234
2235 /** Constructor for a DivMod node.
2236  *
2237  * @param   *irg   The ir graph the node  belongs to.
2238  * @param   *block The ir block the node belongs to.
2239  * @param   *memop The store needed to model exceptions
2240  * @param   *op1   The first operand.
2241  * @param   *op2   The second operand.
2242  */
2243 ir_node *new_r_DivMod (ir_graph *irg, ir_node *block,
2244                ir_node *memop, ir_node *op1, ir_node *op2);
2245
2246 /** Constructor for a Div node.
2247  *
2248  * @param   *irg   The ir graph the node  belongs to.
2249  * @param   *block The ir block the node belongs to.
2250  * @param   *memop The store needed to model exceptions
2251  * @param   *op1   The first operand.
2252  * @param   *op2   The second operand.
2253  */
2254 ir_node *new_r_Div    (ir_graph *irg, ir_node *block,
2255                ir_node *memop, ir_node *op1, ir_node *op2);
2256
2257 /** Constructor for a Mod node.
2258  *
2259  * @param   *irg   The ir graph the node  belongs to.
2260  * @param   *block The ir block the node belongs to.
2261  * @param   *memop The store needed to model exceptions
2262  * @param   *op1   The first operand.
2263  * @param   *op2   The second operand.
2264  */
2265 ir_node *new_r_Mod    (ir_graph *irg, ir_node *block,
2266                ir_node *memop, ir_node *op1, ir_node *op2);
2267
2268 /** Constructor for a Abs node.
2269  *
2270  * @param   *irg   The ir graph the node  belongs to.
2271  * @param   *block The ir block the node belongs to.
2272  * @param   *op    The operand
2273  * @param   *mode  The mode of the operands and the result.
2274  */
2275 ir_node *new_r_Abs    (ir_graph *irg, ir_node *block,
2276                        ir_node *op, ir_mode *mode);
2277
2278 /** Constructor for a And node.
2279  *
2280  * @param   *irg   The ir graph the node  belongs to.
2281  * @param   *block The ir block the node belongs to.
2282  * @param   *op1   The first operand.
2283  * @param   *op2   The second operand.
2284  * @param   *mode  The mode of the operands and the result.
2285  */
2286 ir_node *new_r_And    (ir_graph *irg, ir_node *block,
2287                ir_node *op1, ir_node *op2, ir_mode *mode);
2288
2289 /** Constructor for a Or node.
2290  *
2291  * @param   *irg   The ir graph the node  belongs to.
2292  * @param   *block The ir block the node belongs to.
2293  * @param   *op1   The first operand.
2294  * @param   *op2   The second operand.
2295  * @param   *mode  The mode of the operands and the result.
2296  */
2297 ir_node *new_r_Or     (ir_graph *irg, ir_node *block,
2298                ir_node *op1, ir_node *op2, ir_mode *mode);
2299
2300 /** Constructor for a Eor node.
2301  *
2302  * @param   *irg   The ir graph the node  belongs to.
2303  * @param   *block The ir block the node belongs to.
2304  * @param   *op1   The first operand.
2305  * @param   *op2   The second operand.
2306  * @param   *mode  The mode of the operands and the results.
2307  */
2308 ir_node *new_r_Eor    (ir_graph *irg, ir_node *block,
2309                ir_node *op1, ir_node *op2, ir_mode *mode);
2310
2311 /** Constructor for a Not node.
2312  *
2313  * @param   *irg   The ir graph the node  belongs to.
2314  * @param   *block The ir block the node belongs to.
2315  * @param   *op    The operand.
2316  * @param   *mode  The mode of the operand and the result.
2317  */
2318 ir_node *new_r_Not    (ir_graph *irg, ir_node *block,
2319                ir_node *op, ir_mode *mode);
2320
2321 /** Constructor for a Cmp node.
2322  *
2323  * @param   *irg   The ir graph the node  belongs to.
2324  * @param   *block The ir block the node belongs to.
2325  * @param   *op1   The first operand.
2326  * @param   *op2   The second operand.
2327  */
2328 ir_node *new_r_Cmp    (ir_graph *irg, ir_node *block,
2329                ir_node *op1, ir_node *op2);
2330
2331 /** Constructor for a Shl node.
2332  *
2333  * @param   *irg   The ir graph the node  belongs to.
2334  * @param   *block The ir block the node belongs to.
2335  * @param   *op    The operand.
2336  * @param   *k     The number of bits to  shift the operand .
2337  * @param   *mode  The mode of the operand and the result.
2338  */
2339 ir_node *new_r_Shl    (ir_graph *irg, ir_node *block,
2340                ir_node *op, ir_node *k, ir_mode *mode);
2341
2342 /** Constructor for a Shr node.
2343  *
2344  * @param   *irg   The ir graph the node  belongs to.
2345  * @param   *block The ir block the node belongs to.
2346  * @param   *op    The operand.
2347  * @param   *k     The number of bits to shift the operand .
2348  * @param   *mode  The mode of the operand and the result.
2349  */
2350 ir_node *new_r_Shr    (ir_graph *irg, ir_node *block,
2351                ir_node *op, ir_node *k, ir_mode *mode);
2352
2353 /**
2354  * Constructor for a Shrs node.
2355  *
2356  * @param   *irg   The ir graph the node  belongs to.
2357  * @param   *block The ir block the node belongs to.
2358  * @param   *op    The operand.
2359  * @param   *k     The number of bits to shift the operand.
2360  * @param   *mode  The mode of the operand and the result.
2361  */
2362 ir_node *new_r_Shrs   (ir_graph *irg, ir_node *block,
2363                ir_node *op, ir_node *k, ir_mode *mode);
2364
2365 /** Constructor for a Rot node.
2366  *
2367  * @param   *irg   The ir graph the node  belongs to.
2368  * @param   *block The ir block the node belongs to.
2369  * @param   *op    The operand.
2370  * @param   *k     The number of bits to rotate the operand.
2371  * @param   *mode  The mode of the operand.
2372  */
2373 ir_node *new_r_Rot    (ir_graph *irg, ir_node *block,
2374                ir_node *op, ir_node *k, ir_mode *mode);
2375
2376 /** Constructor for a Conv node.
2377  *
2378  * @param   *irg   The ir graph the node  belongs to.
2379  * @param   *block The ir block the node belongs to.
2380  * @param   *op    The operand.
2381  * @param   *mode  The mode of this the operand muss be converted .
2382  */
2383 ir_node *new_r_Conv   (ir_graph *irg, ir_node *block,
2384                ir_node *op, ir_mode *mode);
2385
2386 /** Constructor for a Cast node.
2387  *
2388  * High level type cast
2389  *
2390  * @param   *irg   The ir graph the node  belongs to.
2391  * @param   *block The ir block the node belongs to.
2392  * @param   *op    The operand.
2393  * @param   *to_tp The type of this the operand muss be casted .
2394  */
2395 ir_node *new_r_Cast   (ir_graph *irg, ir_node *block,
2396                ir_node *op, ir_type *to_tp);
2397
2398 /** Constructor for a Carry node.
2399  *
2400  * @param   *irg   The ir graph the node  belongs to.
2401  * @param   *block The ir block the node belongs to.
2402  * @param   *op1   The first operand.
2403  * @param   *op2   The second operand.
2404  * @param   *mode  The mode of the operands and the result.
2405  */
2406 ir_node *new_r_Carry  (ir_graph *irg, ir_node *block,
2407                ir_node *op1, ir_node *op2, ir_mode *mode);
2408
2409 /**
2410  * Constructor for a Borrow node.
2411  *
2412  * @param   *irg   The ir graph the node  belongs to.
2413  * @param   *block The ir block the node belongs to.
2414  * @param   *op1   The first operand.
2415  * @param   *op2   The second operand.
2416  * @param   *mode  The mode of the operands and the results.
2417  */
2418 ir_node *new_r_Borrow (ir_graph *irg, ir_node *block,
2419                ir_node *op1, ir_node *op2, ir_mode *mode);
2420
2421 /** Constructor for a Phi node.
2422  *
2423  * @param *irg   The ir graph the node  belongs to.
2424  * @param *block The ir block the node belongs to.
2425  * @param arity  The number of predecessors
2426  * @param *in[]    Array with predecessors. The constructor copies this array.
2427  * @param *mode  The mode of it's inputs and output.
2428  */
2429 ir_node *new_r_Phi    (ir_graph *irg, ir_node *block, int arity,
2430                        ir_node *in[], ir_mode *mode);
2431
2432 /** Constructor for a Load node.
2433  *
2434  * @param *irg   The ir graph the node  belongs to.
2435  * @param *block The ir block the node belongs to.
2436  * @param *store The current memory
2437  * @param *adr   A pointer to the variable to be read in this memory.
2438  * @param *mode  The mode of the value to be loaded.
2439  */
2440 ir_node *new_r_Load   (ir_graph *irg, ir_node *block,
2441                ir_node *store, ir_node *adr, ir_mode *mode);
2442
2443 /** Constructor for a Store node.
2444  *
2445  * @param *irg   The ir graph the node  belongs to.
2446  * @param *block The ir block the node belongs to.
2447  * @param *store The current memory
2448  * @param *adr   A pointer to the variable to be read in this memory.
2449  * @param *val   The value to write to this variable.
2450  */
2451 ir_node *new_r_Store  (ir_graph *irg, ir_node *block,
2452                        ir_node *store, ir_node *adr, ir_node *val);
2453
2454 /** Constructor for a Alloc node.
2455  *
2456  * The Alloc node extends the memory by space for an entity of type alloc_type.
2457  *
2458  * @param *irg        The ir graph the node  belongs to.
2459  * @param *block      The ir block the node belongs to.
2460  * @param *store      The memory which shall contain the new variable.
2461  * @param *size       The number of bytes to allocate.
2462  * @param *alloc_type The type of the allocated variable.
2463  * @param where       Where to allocate the variable, either heap_alloc or stack_alloc.
2464  */
2465 ir_node *new_r_Alloc  (ir_graph *irg, ir_node *block, ir_node *store,
2466                ir_node *size, ir_type *alloc_type, where_alloc where);
2467
2468 /** Constructor for a Free node.
2469  *
2470  * Frees the memory occupied by the entity pointed to by the pointer
2471  * arg.  Type indicates the type of the entity the argument points to.
2472  *
2473  * @param *irg        The ir graph the node  belongs to.
2474  * @param *block      The ir block the node belongs to.
2475  * @param *store      The memory which shall contain the new variable.
2476  * @param *ptr        The pointer to the object to free.
2477  * @param *size       The number of objects of type free_type to free in a sequence.
2478  * @param *free_type  The type of the freed variable.
2479  * @param where       Where the variable was allocated, either heap_alloc or stack_alloc.
2480  */
2481 ir_node *new_r_Free   (ir_graph *irg, ir_node *block, ir_node *store,
2482                ir_node *ptr, ir_node *size, ir_type *free_type, where_alloc where);
2483
2484 /** Constructor for a Sync node.
2485  *
2486  * Merges several memory values.  The node assumes that a variable
2487  * either occurs only in one of the memories, or it contains the same
2488  * value in all memories where it occurs.
2489  *
2490  * @param *irg      The ir graph the node  belongs to.
2491  * @param *block    The ir block the node belongs to.
2492  * @param  arity    The number of memories to synchronize.
2493  * @param  *in[]    An array of pointers to nodes that produce an output of  type memory.
2494  *                  The constructor copies this array.
2495  */
2496 ir_node *new_r_Sync (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2497
2498 /** Constructor for a Proj node.
2499  *
2500  * Projects a single value out of a tuple.  The parameter proj gives the
2501  * position of the value within the tuple.
2502  *
2503  * @param *irg   The ir graph the node  belongs to.
2504  * @param *block The ir block the node belongs to.
2505  * @param arg    A node producing a tuple.
2506  * @param *mode  The mode of the value to project.
2507  * @param proj   The position of the value in the tuple.
2508  */
2509 ir_node *new_r_Proj   (ir_graph *irg, ir_node *block, ir_node *arg,
2510                        ir_mode *mode, long proj);
2511
2512 /** Constructor for a defaultProj node.
2513  *
2514  * Represents the default control flow of a Switch-Cond node.
2515  *
2516  * @param *irg      The ir graph the node  belongs to.
2517  * @param *block    The ir block the node belongs to.
2518  * @param arg       A node producing a tuple.
2519  * @param max_proj  The end  position of the value in the tuple.
2520  */
2521 ir_node *new_r_defaultProj (ir_graph *irg, ir_node *block, ir_node *arg, long max_proj);
2522
2523
2524 /** Constructor for a Tuple node.
2525  *
2526  * This is an auxiliary node to replace a node that returns a tuple
2527  * without changing the corresponding Proj nodes.
2528  *
2529  * @param *irg    The ir graph the node  belongs to.
2530  * @param *block  The ir block the node belongs to.
2531  * @param arity   The number of tuple elements.
2532  * @param *in[]   An array containing pointers to the nodes producing the tuple elements.
2533  *                The constructor copies this array.
2534  */
2535 ir_node *new_r_Tuple  (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2536
2537 /** Constructor for a Id node.
2538  *
2539  * This is an auxiliary node to replace a node that returns a single
2540  * value.
2541  *
2542  * @param *irg    The ir graph the node  belongs to.
2543  * @param *block  The ir block the node belongs to.
2544  * @param *val    The operand to Id.
2545  * @param *mode   The mode of *val.
2546  */
2547 ir_node *new_r_Id     (ir_graph *irg, ir_node *block,
2548                ir_node *val, ir_mode *mode);
2549
2550 /** Constructor for a Bad node.
2551  *
2552  * Returns the unique Bad node of the graph.  The same as
2553  * get_irg_bad().
2554  *
2555  * @param *irg    The ir graph the node  belongs to.
2556  *
2557  */
2558 ir_node *new_r_Bad    (ir_graph *irg);
2559
2560 /** Constructor for a Confirm node.
2561  *
2562  * Specifies constraints for a value.  To support dataflow analyses.
2563  *
2564  * Example: If the value never exceeds '100' this is expressed by placing a
2565  * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
2566  *
2567  * @param *irg    The ir graph the node belong to.
2568  * @param *block  The ir block the node belong to.
2569  * @param *val    The value we express a constraint for
2570  * @param *bound  The value to compare against. Must be a firm node, typically a constant.
2571  * @param cmp     The compare operation.
2572  */
2573 ir_node *new_r_Confirm (ir_graph *irg, ir_node *block,
2574             ir_node *val, ir_node *bound, pn_Cmp cmp);
2575
2576 /** Constructor for a Unknown node.
2577  *
2578  * Represents an arbitrary value.  Places the node in
2579  * the start block.
2580  *
2581  * @param *irg    The ir graph the node  belongs to.
2582  * @param *m      The mode of the unknown value.
2583  */
2584 ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2585
2586 /** Constructor for a CallBegin node.
2587  *
2588  * CallBegin represents control flow depending of the pointer value
2589  * representing the called method to the called methods.  The
2590  * constructor copies the method pointer input from the passed Call
2591  * node.
2592  *
2593  * @param *irg    The ir graph the node belong to.
2594  * @param *block  The block the node belong to.
2595  * @param *callee The call node visible in the  intra procedural view.
2596  */
2597 ir_node *new_r_CallBegin(ir_graph *irg, ir_node *block, ir_node *callee);
2598
2599 /** Constructor for a EndReg node.
2600  *
2601  * Used to represent regular procedure end in interprocedual view.
2602  *
2603  * @param *irg    The ir graph the node belong to.
2604  * @param *block  The block the node belong to.
2605  */
2606 ir_node *new_r_EndReg (ir_graph *irg, ir_node *block);
2607
2608 /** Constructor for a EndExcept node.
2609  *
2610  * Used to represent exceptional procedure end in interprocedural view.
2611  *
2612  * @param *irg    The ir graph the node belong to.
2613  * @param *block  The block the node belong to.
2614  */
2615 ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
2616
2617 /** Constructor for a Break node.
2618  *
2619  * Break represents control flow to a single control successor just as Jmp.
2620  * The blocks separated by a break may not be concatenated by an optimization.
2621  * It is used for the interprocedural representation where blocks are parted
2622  * behind Call nodes to represent the control flow to called procedures.
2623  *
2624  * @param *irg    The ir graph the node belong to.
2625  * @param *block  The block the node belong to.
2626  */
2627 ir_node *new_r_Break  (ir_graph *irg, ir_node *block);
2628
2629 /** Constructor for a Filter node.
2630  *
2631  * Constructor for a Filter node. Adds the node to the block in current_ir_block.
2632  * Filter is a node with two views used to construct the interprocedural view.
2633  * In intraprocedural view its semantics are identical to the Proj node.
2634  * In interprocedural view the Filter performs the Phi operation on method
2635  * parameters or results.  Other than a Phi a Filter node may not be removed
2636  * if it has only a single input.
2637  *
2638  * The constructor builds the Filter in intraprocedural view.
2639  *
2640  * @param *irg    The ir graph the node belong to.
2641  * @param *block  The block the node belong to.
2642  * @param *arg  The tuple value to project from.
2643  * @param *mode The mode of the projected value.
2644  * @param proj  The position in the tuple to project from.
2645  */
2646 ir_node *new_r_Filter (ir_graph *irg, ir_node *block, ir_node *arg,
2647                ir_mode *mode, long proj);
2648
2649 /** Constructor for a NoMem node.
2650  *
2651  * Returns the unique NoMem node of the graph.  The same as
2652  * get_irg_no_mem().
2653  *
2654  * @param *irg    The ir graph the node belongs to.
2655  */
2656 ir_node *new_r_NoMem  (ir_graph *irg);
2657
2658 /** Constructor for a Mux node.
2659  *
2660  * @param *irg      The ir graph the node belong to.
2661  * @param *block    The block the node belong to.
2662  * @param *sel      The ir_node that calculates the boolean select.
2663  * @param *ir_true  The ir_node that calculates the true result.
2664  * @param *ir_false The ir_node that calculates the false result.
2665  * @param *mode     The mode of the node (and it_true and ir_false).
2666  */
2667 ir_node *new_r_Mux  (ir_graph *irg, ir_node *block,
2668     ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2669
2670 /** Constructor for a Psi node.
2671  *
2672  * @param *irg      The ir graph the node belong to.
2673  * @param *block    The block the node belong to.
2674  * @param *arity    The arity of the conditions
2675  * @param *conds    The array of mode_b conditions, length must be equal arity
2676  * @param *vals     The array of mode values, length must be equal arity + 1
2677  * @param *mode     The mode of the node (must be the mode of all vals).
2678  */
2679 ir_node *new_r_Psi (ir_graph *irg, ir_node *block,
2680                     int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
2681
2682 /** Constructor for a CopyB node.
2683  *
2684  * @param *irg        The ir graph the node belong to.
2685  * @param *block      The block the node belong to.
2686  * @param *store      The current memory
2687  * @param *dst        The ir_node that represents the destination address.
2688  * @param *src        The ir_node that represents the source address.
2689  * @param *data_type  The type of the copied data
2690  */
2691 ir_node *new_r_CopyB(ir_graph *irg, ir_node *block,
2692     ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
2693
2694 /** Constructor for a InstOf node.
2695  *
2696  * A High-Level Type check.
2697  *
2698  * @param   *irg       The ir graph the node  belongs to.
2699  * @param   *block     The ir block the node belongs to.
2700  * @param   *store     The memory in which the object the entity should be selected
2701  *                     from is allocated.
2702  * @param   *objptr    A pointer to a object of a class type.
2703  * @param   *type      The type of which objptr must be.
2704  */
2705 ir_node *new_r_InstOf (ir_graph *irg, ir_node *block, ir_node *store,
2706                         ir_node *objptr, ir_type *type);
2707
2708 /** Constructor for a Raise node.
2709  *
2710  * A High-Level Exception throw.
2711  *
2712  * @param *irg   The ir graph the node  belongs to.
2713  * @param *block The ir block the node belongs to.
2714  * @param *store The current memory.
2715  * @param *obj   A pointer to the Except variable.
2716  */
2717 ir_node *new_r_Raise  (ir_graph *irg, ir_node *block,
2718                ir_node *store, ir_node *obj);
2719
2720 /** Constructor for a Bound node.
2721  *
2722  * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2723  *
2724  * @param *irg        The ir graph the node belong to.
2725  * @param *block      The block the node belong to.
2726  * @param *store      The current memory.
2727  * @param *idx        The ir_node that represents an index.
2728  * @param *lower      The ir_node that represents the lower bound for the index.
2729  * @param *upper      The ir_node that represents the upper bound for the index.
2730  */
2731 ir_node *new_r_Bound(ir_graph *irg, ir_node *block,
2732     ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
2733
2734 /** Constructor for a Pin node.
2735  *
2736  * @param *irg        The ir graph the node belong to.
2737  * @param *block      The block the node belong to.
2738  * @param *node       The node which value should be pinned.
2739  */
2740 ir_node *new_r_Pin(ir_graph *irg, ir_node *block, ir_node *node);
2741
2742 /*-----------------------------------------------------------------------*/
2743 /* The block oriented interface                                          */
2744 /*-----------------------------------------------------------------------*/
2745
2746 /** Sets the current block in which the following constructors place the
2747  *  nodes they construct.
2748  *
2749  *  @param target  The new current block.
2750  */
2751 void     set_cur_block (ir_node *target);
2752
2753 /** Returns the current block of the current graph. */
2754 ir_node *get_cur_block(void);
2755
2756 /** Returns the fixed nodes  of the current graph. */
2757 #define get_cur_end_block()   get_irg_end_block(current_ir_graph)
2758 #define get_cur_end()         get_irg_end(current_ir_graph)
2759 #define get_cur_start_block() get_irg_start_block(current_ir_graph)
2760 #define get_cur_start()       get_irg_start(current_ir_graph)
2761
2762 /** Constructor for a Block node.
2763  *
2764  * Adds the block to the graph in current_ir_graph. Constructs a Block
2765  * with a fixed number of predecessors.  Does set current_block.  Can
2766  * be used with automatic Phi node construction.
2767  *
2768  * @param *db    A Pointer for debug information.
2769  * @param arity  The number of control predecessors.
2770  * @param in[]   An array of control predecessors.  The length of
2771  *               the array must be 'arity'.
2772  */
2773 ir_node *new_d_Block(dbg_info *db, int arity, ir_node *in[]);
2774
2775 /** Constructor for a Start node.
2776  *
2777  * Adds the node to the block in current_ir_block.
2778  *
2779  * @param *db    A pointer for debug information.
2780  */
2781 ir_node *new_d_Start  (dbg_info *db);
2782
2783 /** Constructor for a End node.
2784  *
2785  * Adds the node to the block in current_ir_block.
2786  *
2787  * @param *db     A pointer for debug information.
2788  */
2789 ir_node *new_d_End    (dbg_info *db);
2790
2791 /** Constructor for a Jmp node.
2792  *
2793  * Adds the node to the block in current_ir_block.
2794  *
2795  * Jmp represents control flow to a single control successor.
2796  *
2797  * @param *db     A pointer for debug information.
2798  */
2799 ir_node *new_d_Jmp    (dbg_info *db);
2800
2801 /** Constructor for an IJmp node.
2802  *
2803  * IJmp represents control flow to a single control successor not
2804  * statically known i.e. an indirect Jmp.
2805  *
2806  * @param *db     A pointer for debug information.
2807  * @param *tgt    The ir node representing the target address.
2808  */
2809 ir_node *new_d_IJmp   (dbg_info *db, ir_node *tgt);
2810
2811 /** Constructor for a Cond node.
2812  *
2813  * Adds the node to the block in current_ir_block.
2814  *
2815  * If c is mode_b represents a conditional branch (if/else). If c is
2816  * mode_Is/mode_Iu (?) represents a switch.  (Allocates dense Cond
2817  * node, default Proj is 0.)
2818  *
2819  * This is not consistent:  Input to Cond is Is, Proj has as proj number
2820  * longs.
2821  *
2822  * @param *db    A pointer for debug information.
2823  * @param *c     The conditions parameter.Can be of mode b or I_u.
2824  */
2825 ir_node *new_d_Cond   (dbg_info *db, ir_node *c);
2826
2827 /** Constructor for a Return node.
2828  *
2829  * Adds the node to the block in current_ir_block.
2830  *
2831  * Returns the memory an zero or more return values.  Only node that
2832  * can end regular control flow.
2833  *
2834  * @param *db    A pointer for debug information.
2835  * @param *store The state of memory.
2836  * @param arity  Number of array indices.
2837  * @param *in    Array with index inputs to the node.
2838  */
2839 ir_node *new_d_Return (dbg_info *db, ir_node *store, int arity, ir_node *in[]);
2840
2841 /** Constructor for a Const_type node.
2842  *
2843  * Adds the node to the block in current_ir_block.
2844  *
2845  * The constant represents a target value.  This constructor sets high
2846  * level type information for the constant value.
2847  *
2848  * @param *db    A pointer for debug information.
2849  * @param *mode  The mode of the operands and results.
2850  * @param *con   Points to an entry in the constant table. This pointer is
2851                  added to the attributes of the node.
2852  * @param *tp    The type of the constant.
2853  */
2854 ir_node *new_d_Const_type (dbg_info *db, ir_mode *mode, tarval *con, ir_type *tp);
2855
2856 /** Constructor for a Const node.
2857  *
2858  * Adds the node to the block in current_ir_block.
2859  *
2860  * Constructor for a Const node. The constant represents a target
2861  * value.  Sets the type information to type_unknown.  (No more
2862  * supported: If tv is entity derives a somehow useful type.)
2863  *
2864  * @param *db    A pointer for debug information.
2865  * @param *mode  The mode of the operands and results.
2866  * @param *con   Points to an entry in the constant table. This pointer is added
2867  *               to the attributes of the node.
2868  */
2869 ir_node *new_d_Const  (dbg_info *db, ir_mode *mode, tarval *con);
2870
2871 /** Constructor for a SymConst_type node.
2872  *
2873  *  Adds the node to the block in current_ir_block.
2874  *  This is the constructor for a symbolic constant.
2875  *    There are four kinds of symbolic constants:
2876  *    - type_tag  The symbolic constant represents a type tag.  The type the
2877  *                tag stands for is given explicitly.
2878  *    - size      The symbolic constant represents the size of a type.  The
2879  *                type of which the constant represents the size is given
2880  *                explicitly.
2881  *    - addr_name The symbolic constant represents the address of an entity
2882  *                (variable or method).  The variable is indicated by a name
2883  *                that is valid for linking.
2884  *    - addr_ent   The symbolic constant represents the address of an entity
2885  *                (variable or method).  The variable is given explicitly by
2886  *                a firm entity.
2887  *
2888  *    Inputs to the node:
2889  *      No inputs except the block it belongs to.
2890  *    Outputs of the node.
2891  *      An unsigned integer (I_u) or a pointer (P).
2892  *
2893  * @param *db     A pointer for debug information.
2894  * @param value   A type, entity or ident depending on the SymConst kind.
2895  * @param kind    The kind of the symbolic constant: symconst_type_tag, symconst_type_size,
2896  *                symconst_type_align, symconst_addr_name or symconst_addr_ent.
2897  * @param tp      The source type of the constant.
2898  */
2899 ir_node *new_d_SymConst_type (dbg_info *db, union symconst_symbol value, symconst_kind kind, ir_type *tp);
2900
2901 /** Constructor for a SymConst node.
2902  *
2903  *  Same as new_d_SymConst_type, except that it sets the type to type_unknown. */
2904 ir_node *new_d_SymConst (dbg_info *db, union symconst_symbol value, symconst_kind kind);
2905
2906 /** Constructor for a simpleSel node.
2907  *
2908  *  This is a shortcut for the new_d_Sel() constructor.  To be used for
2909  *  Sel nodes that do not select from an array, i.e., have no index
2910  *  inputs.  It adds the two parameters 0, NULL.
2911  *
2912  * @param   *db        A pointer for debug information.
2913  * @param   *store     The memory in which the object the entity should be
2914  *                     selected from is allocated.
2915  * @param   *objptr    The object from that the Sel operation selects a
2916  *                     single attribute out.
2917  * @param   *ent       The entity to select.
2918  */
2919 ir_node *new_d_simpleSel(dbg_info *db, ir_node *store, ir_node *objptr, entity *ent);
2920
2921 /** Constructor for a Sel node.
2922  *
2923  * The select node selects an entity (field or method) from an entity
2924  * with a compound type.  It explicitly specifies the entity selected.
2925  * Dynamically the node may select entities that overwrite the given
2926  * entity.  If the selected entity is an array element entity the Sel
2927  * node takes the required array indices as inputs.
2928  * Adds the node to the block in current_ir_block.
2929  *
2930  * @param   *db        A pointer for debug information.
2931  * @param   *store     The memory in which the object the entity should be selected
2932  *                     from is allocated.
2933  * @param   *objptr    A pointer to a compound entity the Sel operation selects a
2934  *                     single attribute from.
2935  * @param   arity      The number of array indices needed to select an array element entity.
2936  * @param   *in[]      If the compound entity is an array the indices of the selected
2937  *                     element entity.  The constructor copies this array.
2938  * @param   *ent       The entity to select.
2939  */
2940 ir_node *new_d_Sel    (dbg_info *db, ir_node *store, ir_node *objptr, int arity, ir_node *in[],
2941                      entity *ent);
2942
2943 /** Constructor for a Call node.
2944  *
2945  *  Represents all kinds of method and function calls.
2946  *  Adds the node to the block in current_ir_block.
2947  *
2948  * @param   *db     A pointer for debug information.
2949  * @param   *store  The actual store.
2950  * @param   *callee A pointer to the called procedure.
2951  * @param   arity   The number of procedure parameters.
2952  * @param   *in[]   An array with the pointers to the parameters. The constructor copies this array.
2953  * @param   *tp     Type information of the procedure called.
2954  */
2955 ir_node *new_d_Call   (dbg_info *db, ir_node *store, ir_node *callee, int arity, ir_node *in[],
2956              ir_type *tp);
2957
2958 /** Constructor for a Add node.
2959  *
2960  * Adds the node to the block in current_ir_block.
2961  *
2962  * @param   *db    A pointer for debug information.
2963  * @param   *op1   The first operand.
2964  * @param   *op2   The second operand.
2965  * @param   *mode  The mode of the operands and the result.
2966  */
2967 ir_node *new_d_Add    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2968
2969 /** Constructor for a Sub node.
2970  *
2971  * Adds the node to the block in current_ir_block.
2972  *
2973  * @param   *db    A pointer for debug information.
2974  * @param   *op1   The first operand.
2975  * @param   *op2   The second operand.
2976  * @param   *mode  The mode of the operands and the result.
2977  */
2978 ir_node *new_d_Sub    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
2979
2980 /** Constructor for a Minus node.
2981  *
2982  * Adds the node to the block in current_ir_block.
2983  *
2984  * @param   *db    A pointer for debug information.
2985  * @param   *op    The operand .
2986  * @param   *mode  The mode of the operand and the result.
2987  */
2988 ir_node *new_d_Minus  (dbg_info *db, ir_node *op,  ir_mode *mode);
2989
2990 /** Constructor for a Mul node.
2991  *
2992  * Adds the node to the block in current_ir_block.
2993  *
2994  * @param   *db    A pointer for debug information.
2995  * @param   *op1   The first operand.
2996  * @param   *op2   The second operand.
2997  * @param   *mode  The mode of the operands and the result.
2998  */
2999 ir_node *new_d_Mul    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3000
3001 /** Constructor for a Quot node.
3002  *
3003  * Adds the node to the block in current_ir_block.
3004  *
3005  * @param   *db    A pointer for debug information.
3006  * @param   *memop The store needed to model exceptions
3007  * @param   *op1   The first operand.
3008  * @param   *op2   The second operand.
3009  */
3010 ir_node *new_d_Quot   (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
3011
3012 /** Constructor for a DivMod node.
3013  *
3014  * Adds the node to the block in current_ir_block.
3015  *
3016  * @param   *db    A pointer for debug information.
3017  * @param   *memop The store needed to model exceptions
3018  * @param   *op1   The first operand.
3019  * @param   *op2   The second operand.
3020  */
3021 ir_node *new_d_DivMod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
3022
3023 /** Constructor for a Div node.
3024  *
3025  * Adds the node to the block in current_ir_block.
3026  *
3027  * @param   *db    A pointer for debug information.
3028  * @param   *memop The store needed to model exceptions
3029  * @param   *op1   The first operand.
3030  * @param   *op2   The second operand.
3031  */
3032 ir_node *new_d_Div    (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
3033
3034 /** Constructor for a Mod node.
3035  *
3036  * Adds the node to the block in current_ir_block.
3037  *
3038  * @param   *db    A pointer for debug information.
3039  * @param   *memop The store needed to model exceptions
3040  * @param   *op1   The first operand.
3041  * @param   *op2   The second operand.
3042  */
3043 ir_node *new_d_Mod    (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2);
3044
3045 /** Constructor for a Abs node.
3046  *
3047  * Adds the node to the block in current_ir_block.
3048  *
3049  * @param   *db    A pointer for debug information.
3050  * @param   *op    The operand
3051  * @param   *mode  The mode of the operands and the result.
3052  */
3053 ir_node *new_d_Abs    (dbg_info *db, ir_node *op,                ir_mode *mode);
3054
3055 /** Constructor for a And node.
3056  *
3057  * Adds the node to the block in current_ir_block.
3058  *
3059  * @param   *db    A pointer for debug information.
3060  * @param   *op1   The first operand.
3061  * @param   *op2   The second operand.
3062  * @param   *mode  The mode of the operands and the result.
3063  */
3064 ir_node *new_d_And    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3065
3066 /** Constructor for a Or node.
3067  *
3068  * Adds the node to the block in current_ir_block.
3069  *
3070  * @param   *db    A pointer for debug information.
3071  * @param   *op1   The first operand.
3072  * @param   *op2   The second operand.
3073  * @param   *mode  The mode of the operands and the result.
3074  */
3075 ir_node *new_d_Or     (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3076
3077 /** Constructor for a Eor node.
3078  *
3079  * Adds the node to the block in current_ir_block.
3080  *
3081  * @param   *db    A pointer for debug information.
3082  * @param   *op1   The first operand.
3083  * @param   *op2   The second operand.
3084  * @param   *mode  The mode of the operands and the results.
3085  */
3086 ir_node *new_d_Eor    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3087
3088 /** Constructor for a Not node.
3089  *
3090  * Adds the node to the block in current_ir_block.
3091  *
3092  * @param   *db    A pointer for debug information.
3093  * @param   *op    The operand.
3094  * @param   *mode  The mode of the operand and the result.
3095  */
3096 ir_node *new_d_Not    (dbg_info *db, ir_node *op,                ir_mode *mode);
3097
3098 /** Constructor for a Shl node.
3099  *
3100  * Adds the node to the block in current_ir_block.
3101  *
3102  * @param   *db    A pointer for debug information.
3103  * @param   *op    The operand.
3104  * @param   *k     The number of bits to  shift the operand .
3105  * @param   *mode  The mode of the operand and the result.
3106  */
3107 ir_node *new_d_Shl    (dbg_info *db, ir_node *op,  ir_node *k,   ir_mode *mode);
3108
3109 /** Constructor for a Shr node.
3110  *
3111  * Adds the node to the block in current_ir_block.
3112  *
3113  * @param   *db    A pointer for debug information.
3114  * @param   *op    The operand.
3115  * @param   *k     The number of bits to  shift the operand .
3116  * @param   *mode  The mode of the operand and the result.
3117  */
3118 ir_node *new_d_Shr    (dbg_info *db, ir_node *op,  ir_node *k,   ir_mode *mode);
3119
3120 /** Constructor for a Shrs node.
3121  *
3122  * Adds the node to the block in current_ir_block.
3123  *
3124  * @param   *db    A pointer for debug information.
3125  * @param   *op    The operand.
3126  * @param   *k     The number of bits to  shift the operand .
3127  * @param   *mode  The mode of the operand and the result.
3128  */
3129 ir_node *new_d_Shrs   (dbg_info *db, ir_node *op,  ir_node *k,   ir_mode *mode);
3130
3131 /** Constructor for a Rot node.
3132  *
3133  * Adds the node to the block in current_ir_block.
3134  *
3135  * @param   *db    A pointer for debug information.
3136  * @param   *op    The operand.
3137  * @param   *k     The number of bits to rotate the operand.
3138  * @param   *mode  The mode of the operand.
3139  */
3140 ir_node *new_d_Rot    (dbg_info *db, ir_node *op,  ir_node *k,   ir_mode *mode);
3141
3142 /** Constructor for a Cmp node.
3143  *
3144  * Adds the node to the block in current_ir_block.
3145  *
3146  * @param   *db    A pointer for debug information.
3147  * @param   *op1   The first operand.
3148  * @param   *op2   The second operand.
3149  */
3150 ir_node *new_d_Cmp    (dbg_info *db, ir_node *op1, ir_node *op2);
3151
3152 /** Constructor for a Conv node.
3153  *
3154  * Adds the node to the block in current_ir_block.
3155  *
3156  * @param   *db    A pointer for debug information.
3157  * @param   *op    The operand.
3158  * @param   *mode  The mode of this the operand muss be converted .
3159  */
3160 ir_node *new_d_Conv   (dbg_info *db, ir_node *op, ir_mode *mode);
3161
3162 /** Constructor for a strict Conv node.
3163  *
3164  * Adds the node to the block in current_ir_block.
3165  *
3166  * @param   *db    A pointer for debug information.
3167  * @param   *op    The operand.
3168  * @param   *mode  The mode of this the operand muss be converted .
3169  */
3170 ir_node *new_d_strictConv   (dbg_info *db, ir_node *op, ir_mode *mode);
3171
3172 /** Constructor for a Cast node.
3173  *
3174  * High level type cast
3175  * Adds the node to the block in current_ir_block.
3176  *
3177  * @param   *db    A pointer for debug information.
3178  * @param   *op    The operand.
3179  * @param   *to_tp The type of this the operand muss be casted .
3180  */
3181 ir_node *new_d_Cast   (dbg_info *db, ir_node *op, ir_type *to_tp);
3182
3183 /** Constructor for a Carry node.
3184  *
3185  * Adds the node to the block in current_ir_block.
3186  *
3187  * @param   *db    A pointer for debug information.
3188  * @param   *op1   The first operand.
3189  * @param   *op2   The second operand.
3190  * @param   *mode  The mode of the operands and the result.
3191  */
3192 ir_node *new_d_Carry  (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3193
3194 /** Constructor for a Borrow node.
3195  *
3196  * Adds the node to the block in current_ir_block.
3197  *
3198  * @param   *db    A pointer for debug information.
3199  * @param   *op1   The first operand.
3200  * @param   *op2   The second operand.
3201  * @param   *mode  The mode of the operands and the result.
3202  */
3203 ir_node *new_d_Borrow (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3204
3205 /** Constructor for a Phi node.
3206  *
3207  * Adds the node to the block in current_ir_block.
3208  *
3209  * @param *db    A pointer for debug information.
3210  * @param arity  The number of predecessors
3211  * @param *in    Array with predecessors
3212  * @param *mode  The mode of it's inputs and output.
3213  */
3214 ir_node *new_d_Phi    (dbg_info *db, int arity, ir_node *in[], ir_mode *mode);
3215
3216 /** Constructor for a Load node.
3217  *
3218  * Adds the node to the block in current_ir_block.
3219  *
3220  * @param *db    A pointer for debug information.
3221  * @param *store The current memory
3222  * @param *addr  A pointer to the variable to be read in this memory.
3223  * @param *mode  The mode of the value to be loaded.
3224  */
3225 ir_node *new_d_Load   (dbg_info *db, ir_node *store, ir_node *addr, ir_mode *mode);
3226
3227 /** Constructor for a Store node.
3228  *
3229  * Adds the node to the block in current_ir_block.
3230  *
3231  * @param *db    A pointer for debug information.
3232  * @param *store The current memory
3233  * @param *addr  A pointer to the variable to be read in this memory.
3234  * @param *val   The value to write to this variable.
3235  */
3236 ir_node *new_d_Store  (dbg_info *db, ir_node *store, ir_node *addr, ir_node *val);
3237
3238 /** Constructor for a Alloc node.
3239  *
3240  * The Alloc node extends the memory by space for an entity of type alloc_type.
3241  * Adds the node to the block in current_ir_block.
3242  *
3243  * @param *db         A pointer for debug information.
3244  * @param *store      The memory which shall contain the new variable.
3245  * @param *size       The number of bytes to allocate.
3246  * @param *alloc_type The type of the allocated variable.
3247  * @param where       Where to allocate the variable, either heap_alloc or stack_alloc.
3248  */
3249 ir_node *new_d_Alloc  (dbg_info *db, ir_node *store, ir_node *size, ir_type *alloc_type,
3250                      where_alloc where);
3251
3252  /** Constructor for a Free node.
3253  *
3254  * Frees the memory occupied by the entity pointed to by the pointer
3255  * arg.  Type indicates the type of the entity the argument points to.
3256  * Adds the node to the block in current_ir_block.
3257  *
3258  * @param *db         A pointer for debug information.
3259  * @param *store      The memory which shall contain the new variable.
3260  * @param *ptr        The pointer to the object to free.
3261  * @param *size       The number of objects of type free_type to free in a sequence.
3262  * @param *free_type  The type of the freed variable.
3263  * @param where       Where the variable was allocated, either heap_alloc or stack_alloc.
3264  */
3265 ir_node *new_d_Free   (dbg_info *db, ir_node *store, ir_node *ptr, ir_node *size,
3266              ir_type *free_type, where_alloc where);
3267
3268 /** Constructor for a Sync node.
3269  *
3270  * Merges several memory values.  The node assumes that a variable
3271  * either occurs only in one of the memories, or it contains the same
3272  * value in all memories where it occurs.
3273  * Adds the node to the block in current_ir_block.
3274  *
3275  * @param *db       A pointer for debug information.
3276  * @param  arity    The number of memories to synchronize.
3277  * @param  **in     An array of pointers to nodes that produce an output of type
3278  *                  memory.  The constructor copies this array.
3279  */
3280 ir_node *new_d_Sync   (dbg_info *db, int arity, ir_node *in[]);
3281
3282 /** Constructor for a Proj node.
3283  *
3284  * Projects a single value out of a tuple.  The parameter proj gives the
3285  * position of the value within the tuple.
3286  * Adds the node to the block in current_ir_block.
3287  *
3288  * @param *db    A pointer for deubug information.
3289  * @param arg    A node producing a tuple.
3290  * @param *mode  The mode of the value to project.
3291  * @param proj   The position of the value in the tuple.
3292  */
3293 ir_node *new_d_Proj   (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3294
3295 /** Constructor for a defaultProj node.
3296  *
3297  * Represents the default control flow of a Switch-Cond node.
3298  * Adds the node to the block in current_ir_block.
3299  *
3300  * @param *db       A pointer for debug information.
3301  * @param arg       A node producing a tuple.
3302  * @param max_proj  The end  position of the value in the tuple.
3303  */
3304 ir_node *new_d_defaultProj (dbg_info *db, ir_node *arg, long max_proj);
3305
3306 /** Constructor for a Tuple node.
3307  *
3308  * This is an auxiliary node to replace a node that returns a tuple
3309  * without changing the corresponding Proj nodes.
3310  * Adds the node to the block in current_ir_block.
3311  *
3312  * @param *db     A pointer for debug information.
3313  * @param arity   The number of tuple elements.
3314  * @param **in    An array containing pointers to the nodes producing the tuple elements.
3315  */
3316 ir_node *new_d_Tuple  (dbg_info *db, int arity, ir_node *in[]);
3317
3318 /** Constructor for a Id node.
3319  *
3320  * This is an auxiliary node to replace a node that returns a single
3321  * value. Adds the node to the block in current_ir_block.
3322  *
3323  * @param *db     A pointer for debug information.
3324  * @param *val    The operand to Id.
3325  * @param *mode   The mode of *val.
3326  */
3327 ir_node *new_d_Id     (dbg_info *db, ir_node *val, ir_mode *mode);
3328
3329 /** Constructor for a Bad node.
3330  *
3331  * Returns the unique Bad node of the graph.  The same as
3332  * get_irg_bad().
3333  */
3334 ir_node *new_d_Bad    (void);
3335
3336 /** Constructor for a Confirm node.
3337  *
3338  * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3339  * Specifies constraints for a value.  To support dataflow analyses.
3340  *
3341  * Example: If the value never exceeds '100' this is expressed by placing a
3342  * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
3343  *
3344  * @param *db     A pointer for debug information.
3345  * @param *val    The value we express a constraint for
3346  * @param *bound  The value to compare against. Must be a firm node, typically a constant.
3347  * @param cmp     The compare operation.
3348  */
3349 ir_node *new_d_Confirm (dbg_info *db, ir_node *val, ir_node *bound, pn_Cmp cmp);
3350
3351 /** Constructor for an Unknown node.
3352  *
3353  * Represents an arbitrary value.  Places the node in
3354  * the start block.
3355  *
3356  * @param *m      The mode of the unknown value.
3357  */
3358 ir_node *new_d_Unknown(ir_mode *m);
3359
3360 /** Constructor for a CallBegin node.
3361  *
3362  * CallBegin represents control flow depending of the pointer value
3363  * representing the called method to the called methods.  The
3364  * constructor copies the method pointer input from the passed Call
3365  * node.Adds the node to the block in current_ir_block.
3366  *
3367  * @param *db     A pointer for debug information.
3368  * @param *callee The call node visible in the  intra procedural view.
3369  */
3370 ir_node *new_d_CallBegin(dbg_info *db, ir_node *callee);
3371
3372 /** Constructor for an EndReg node.
3373  *
3374  *Adds the node to the block in current_ir_block.
3375  *
3376  * @param *db     A pointer for debug information.
3377  */
3378 ir_node *new_d_EndReg (dbg_info *db);
3379
3380 /** Constructor for an EndExcept node.
3381  *
3382  * Used to represent regular procedure end in interprocedual view.
3383  * Adds the node to the block in current_ir_block.
3384  *
3385  * @param *db     A pointer for debug information.
3386  */
3387 ir_node *new_d_EndExcept(dbg_info *db);
3388
3389 /** Constructor for a Break node.
3390  *
3391  * Used to represent exceptional procedure end in interprocedural view.
3392  * Adds the node to the block in current_ir_block.
3393  *
3394  * Break represents control flow to a single control successor just as Jmp.
3395  * The blocks separated by a break may not be concatenated by an optimization.
3396  * It is used for the interprocedural representation where blocks are parted
3397  * behind Call nodes to represent the control flow to called procedures.
3398  *
3399  * @param *db     A pointer for debug information.
3400  */
3401 ir_node *new_d_Break (dbg_info *db);
3402
3403 /** Constructor for a Filter node.
3404  *
3405  * Constructor for a Filter node. Adds the node to the block in
3406  * current_ir_block.  Filter is a node with two views used to
3407  * construct the interprocedural view.  In intraprocedural view its
3408  * semantics are identical to the Proj node.  In interprocedural view
3409  * the Filter performs the Phi operation on method parameters or
3410  * results.  Other than a Phi a Filter node may not be removed if it
3411  * has only a single input.
3412  *
3413  * The constructor builds the Filter in intraprocedural view.
3414  *
3415  * @param *db   A pointer for debug information.
3416  * @param *arg  The tuple value to project from.
3417  * @param *mode The mode of the projected value.
3418  * @param proj  The position in the tuple to project from.
3419  */
3420 ir_node *new_d_Filter (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3421
3422
3423 /** Constructor for a NoMem node.
3424  *
3425  * Returns the unique NoMem node of the graph.  The same as
3426  * get_irg_no_mem().
3427  */
3428 ir_node *new_d_NoMem  (void);
3429
3430 /** Constructor for a Mux node.
3431  *
3432  * @param *db       A pointer for debug information.
3433  * @param *sel      The ir_node that calculates the boolean select.
3434  * @param *ir_true  The ir_node that calculates the true result.
3435  * @param *ir_false The ir_node that calculates the false result.
3436  * @param *mode     The mode of the node (and it_true and ir_false).
3437  */
3438 ir_node *new_d_Mux  (dbg_info *db, ir_node *sel,
3439     ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
3440
3441 /** Constructor for a Psi node.
3442  *
3443  * @param *db       A pointer for debug information.
3444  * @param *arity    The arity of the conditions
3445  * @param *conds    The array of mode_b conditions, length must be equal arity
3446  * @param *vals     The array of mode values, length must be equal arity + 1
3447  * @param *mode     The mode of the node (must be the mode of all vals).
3448  */
3449 ir_node *new_d_Psi (dbg_info *db,
3450                     int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
3451
3452 /** Constructor for a CopyB node.
3453  *
3454  * @param *db         A pointer for debug information.
3455  * @param *store      The current memory
3456  * @param *dst        The ir_node that represents the destination address.
3457  * @param *src        The ir_node that represents the source address.
3458  * @param *data_type  The type of the copied data
3459  */
3460 ir_node *new_d_CopyB(dbg_info *db, ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
3461
3462 /** Constructor for a InstOf node.
3463  *
3464  * A High-Level Type check.
3465  *
3466  * @param   *db        A pointer for debug information.
3467  * @param   *store     The memory in which the object the entity should be selected
3468  *                     from is allocated.
3469  * @param   *objptr    A pointer to a object of a class type.
3470  * @param   *type      The type of which objptr must be.
3471  */
3472 ir_node *new_d_InstOf (dbg_info *db, ir_node *store, ir_node *objptr, ir_type *type);
3473
3474 /** Constructor for a Raise node.
3475  *
3476  * A High-Level Exception throw.
3477  *
3478  * @param *db    A pointer for debug information.
3479  * @param *store The current memory.
3480  * @param *obj   A pointer to the Except variable.
3481  */
3482 ir_node *new_d_Raise  (dbg_info *db, ir_node *store, ir_node *obj);
3483
3484 /** Constructor for a Bound node.
3485  *
3486  * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
3487  *
3488  * @param *db         A pointer for debug information.
3489  * @param *store      The current memory
3490  * @param *idx        The ir_node that represents an index.
3491  * @param *lower      The ir_node that represents the lower bound for the index.
3492  * @param *upper      The ir_node that represents the upper bound for the index.
3493  */
3494 ir_node *new_d_Bound(dbg_info *db, ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
3495
3496 /** Constructor for a Pin node.
3497  *
3498  * @param *db         A pointer for debug information.
3499  * @param *node       The node which value should be pinned.
3500  */
3501 ir_node *new_d_Pin(dbg_info *db, ir_node *node);
3502
3503 /*-----------------------------------------------------------------------*/
3504 /* The block oriented interface without debug support                    */
3505 /*-----------------------------------------------------------------------*/
3506
3507 /* Needed from the interface with debug support:
3508 void set_cur_block (ir_node *target);   */
3509
3510 /** Constructor for a Block node.
3511  *
3512  * Constructor for a Block node. Adds the block to the graph in
3513  * current_ir_graph.  Constructs a Block with a fixed number of
3514  * predecessors.  Does set current_block.  Can be used with automatic
3515  * Phi node construction.
3516  *
3517  * @param arity  The number of control predecessors.
3518  * @param in     An array of control predecessors.  The length of
3519  *               the array must be 'arity'.
3520  */
3521 ir_node *new_Block(int arity, ir_node *in[]);
3522
3523 /** Constructor for a Start node.
3524  *
3525  * Adds the node to the block in current_ir_block.
3526  *
3527  */
3528 ir_node *new_Start  (void);
3529
3530 /** Constructor for an End node.
3531  *
3532  * Adds the node to the block in current_ir_block.
3533  */
3534 ir_node *new_End    (void);
3535
3536 /** Constructor for an EndReg node.
3537  *
3538  * Used to represent regular procedure end in interprocedual view.
3539  * Adds the node to the block in current_ir_block.
3540  */
3541 ir_node *new_EndReg (void);
3542
3543 /** Constructor for an EndExpcept node.
3544  *
3545  *  Used to represent exceptional procedure end in interprocedural view.
3546  *  Adds the node to the block in current_ir_block.
3547  */
3548 ir_node *new_EndExcept(void);
3549
3550 /** Constructor for a Jump node.
3551  *
3552  * Adds the node to the block in current_ir_block.
3553  *
3554  * Jmp represents control flow to a single control successor.
3555  */
3556 ir_node *new_Jmp    (void);
3557
3558 /** Constructor for an IJmp node.
3559  *
3560  * IJmp represents control flow to a single control successor not
3561  * statically known i.e. an indirect Jmp.
3562  *
3563  * @param *tgt    The ir node representing the target address.
3564  */
3565 ir_node *new_IJmp   (ir_node *tgt);
3566
3567 /** Constructor for a Break node.
3568  * Break represents control flow to a single control successor just as Jmp.
3569  * The blocks separated by a break may not be concatenated by an optimization.
3570  * It is used for the interprocedural representation where blocks are parted
3571  * behind Call nodes to represent the control flow to called procedures.
3572  * Adds the node to the block in current_ir_block.
3573  */
3574 ir_node *new_Break  (void);
3575
3576 /** Constructor for a Cond node.
3577  *
3578  * If c is mode_b represents a conditional branch (if/else). If c is
3579  * mode_Is/mode_Iu (?) represents a switch.  (Allocates dense Cond
3580  * node, default Proj is 0.). Adds the node to the block in current_ir_block.
3581  *
3582  * This is not consistent:  Input to Cond is Is, Proj has as proj number
3583  * longs.
3584  *
3585  *
3586  * @param *c     The conditions parameter.Can be of mode b or I_u.
3587  */
3588 ir_node *new_Cond   (ir_node *c);
3589
3590 /** Constructor for a Return node.
3591  *
3592  * Returns the memory an zero or more return values.  Only node that
3593  * can end regular control flow. Adds the node to the block in current_ir_block.
3594  *
3595  * @param *store The state of memory.
3596  * @param arity  Number of array indices.
3597  * @param *in    Array with index inputs to the node.
3598  */
3599 ir_node *new_Return (ir_node *store, int arity, ir_node *in[]);
3600
3601 /** Constructor for a Const node.
3602  *
3603  * Constructor for a Const node. The constant represents a target
3604  * value.  Sets the type information to type_unknown.  (No more
3605  * supported: If tv is entity derives a somehow useful type.)
3606  * Adds the node to the block in current_ir_block.
3607  *
3608  * @param *mode  The mode of the operands and results.
3609  * @param *con   Points to an entry in the constant table. This pointer is
3610  *               added to the attributes of  the node.
3611  */
3612 ir_node *new_Const  (ir_mode *mode, tarval *con);
3613
3614 /**
3615  * Make a const from a long.
3616  * This is just convenience for the usual
3617  * <code>
3618  * new_Const(mode, tarval_from_long(mode, ...))
3619  * </code>
3620  * pain.
3621  * @param mode The mode for the const.
3622  * @param value The value of the constant.
3623  * @return A new const node.
3624  */
3625 ir_node *new_Const_long(ir_mode *mode, long value);
3626
3627 /** Constructor for a Const node.
3628  *
3629  * Derives mode from passed type. */
3630 ir_node *new_Const_type(tarval *con, ir_type *tp);
3631
3632 /** Constructor for a SymConst node.
3633  *
3634  * Adds the node to the block in current_ir_block.
3635  * This is the constructor for a symbolic constant.
3636  * There are four kinds of symbolic constants:
3637  *    -# type_tag  The symbolic constant represents a type tag.  The type the
3638  *                 tag stands for is given explicitly.
3639  *    -# size      The symbolic constant represents the size of a type.  The
3640  *                 type of which the constant represents the size is given
3641  *                 explicitly.
3642  *    -# align     The symbolic constant represents the alignment of a type.  The
3643  *                 type of which the constant represents the size is given
3644  *                 explicitly.
3645  *    -# addr_name The symbolic constant represents the address of an entity
3646  *                 (variable or method).  The variable is indicated by a name
3647  *                 that is valid for linking.
3648  *    -# addr_ent  The symbolic constant represents the address of an entity
3649  *                 (variable or method).  The variable is given explicitly by
3650  *                 a firm entity.
3651  *
3652  *    Inputs to the node:
3653  *      No inputs except the block it belongs to.
3654  *    Outputs of the node.
3655  *      An unsigned integer (I_u) or a pointer (P).
3656  *
3657  * @param value   A type or a ident depending on the SymConst kind.
3658  * @param kind    The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3659  *                symconst_type_align, symconst_addr_name or symconst_addr_ent.
3660  * @param tp      The source type of the constant.
3661  */
3662 ir_node *new_SymConst_type (union symconst_symbol value, symconst_kind kind, ir_type *tp);
3663
3664 /** Constructor for a SymConst node.
3665  *
3666  * Adds the node to the block in current_ir_block.
3667  * This is the constructor for a symbolic constant.
3668  * There are four kinds of symbolic constants:
3669  *    -# type_tag  The symbolic constant represents a type tag.  The type the
3670  *                 tag stands for is given explicitly.
3671  *    -# size      The symbolic constant represents the size of a type.  The
3672  *                 type of which the constant represents the size is given
3673  *                 explicitly.
3674  *    -# align     The symbolic constant represents the alignment of a type.  The
3675  *                 type of which the constant represents the size is given
3676  *                 explicitly.
3677  *    -# addr_name The symbolic constant represents the address of an entity
3678  *                 (variable or method).  The variable is indicated by a name
3679  *                 that is valid for linking.
3680  *    -# addr_ent  The symbolic constant represents the address of an entity
3681  *                 (variable or method).  The variable is given explicitly by
3682  *                 a firm entity.
3683  *
3684  *    Inputs to the node:
3685  *      No inputs except the block it belongs to.
3686  *    Outputs of the node.
3687  *      An unsigned integer (I_u) or a pointer (P).
3688  *
3689  * @param value   A type or a ident depending on the SymConst kind.
3690  * @param kind    The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3691  *                symconst_type_align, symconst_addr_name or symconst_addr_ent.
3692  */
3693 ir_node *new_SymConst (union symconst_symbol value, symconst_kind kind);
3694
3695 /** Constructor for a simpelSel node.
3696  *
3697  *  This is a shortcut for the new_Sel() constructor.  To be used for
3698  *  Sel nodes that do not select from an array, i.e., have no index
3699  *  inputs.  It adds the two parameters 0, NULL.
3700  *
3701  * @param   *store     The memory in which the object the entity should be selected from is allocated.
3702  * @param   *objptr    The object from that the Sel operation selects a single attribute out.
3703  * @param   *ent       The entity to select.
3704  */
3705 ir_node *new_simpleSel(ir_node *store, ir_node *objptr, entity *ent);
3706
3707 /** Constructor for a Sel node.
3708  *
3709  * The select node selects an entity (field or method) from an entity
3710  * with a compound type.  It explicitly specifies the entity selected.
3711  * Dynamically the node may select entities that overwrite the given
3712  * entity.  If the selected entity is an array element entity the Sel
3713  * node takes the required array indices as inputs.
3714  * Adds the node to the block in current_ir_block.
3715  *
3716  * @param   *store     The memory in which the object the entity should be selected
3717  *                     from is allocated.
3718  * @param   *objptr    A pointer to a compound entity the Sel operation selects a
3719  *                     single attribute from.
3720  * @param   arity      The number of array indices needed to select an array element entity.
3721  * @param   *in[]      If the compound entity is an array the indices of the selected
3722  *                     element entity.  The constructor copies this array.
3723  * @param   *ent       The entity to select.
3724  */
3725 ir_node *new_Sel    (ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3726                      entity *ent);
3727
3728 /** Constructor for a Call node.
3729  *
3730  *  Adds the node to the block in current_ir_block.
3731  *  Represents all kinds of method and function calls.
3732  *
3733  * @param   *store  The actual store.
3734  * @param   *callee A pointer to the called procedure.
3735  * @param   arity   The number of procedure parameters.
3736  * @param   *in[]   An array with the pointers to the parameters. The constructor copies this array.
3737  * @param   *tp     Type information of the procedure called.
3738  */
3739 ir_node *new_Call   (ir_node *store, ir_node *callee, int arity, ir_node *in[],
3740                      ir_type *tp);
3741
3742 /** Constructor for a CallBegin node.
3743  *
3744  * CallBegin represents control flow depending of the pointer value
3745  * representing the called method to the called methods.  The
3746  * constructor copies the method pointer input from the passed Call
3747  * node. Adds the node to the block in current_ir_block.
3748  *
3749  * @param   *callee A pointer to the called procedure.
3750  */
3751 ir_node *new_CallBegin(ir_node *callee);
3752
3753 /** Constructor for a Add node.
3754  *
3755  * Adds the node to the block in current_ir_block.
3756  *
3757  * @param   *op1   The first operand.
3758  * @param   *op2   The second operand.
3759  * @param   *mode  The mode of the operands and the result.
3760  */
3761 ir_node *new_Add    (ir_node *op1, ir_node *op2, ir_mode *mode);
3762
3763 /** Constructor for a Sub node.
3764  *
3765  * Adds the node to the block in current_ir_block.
3766  *
3767  * @param   *op1   The first operand.
3768  * @param   *op2   The second operand.
3769  * @param   *mode  The mode of the operands and the result.
3770  */
3771 ir_node *new_Sub    (ir_node *op1, ir_node *op2, ir_mode *mode);
3772
3773 /** Constructor for a Minus node.
3774  *
3775  * Adds the node to the block in current_ir_block.
3776  *
3777  * @param   *op    The operand .
3778  * @param   *mode  The mode of the operand and the result.
3779  */
3780 ir_node *new_Minus  (ir_node *op,  ir_mode *mode);
3781
3782 /**
3783  * Constructor for a Mul node. Adds the node to the block in current_ir_block.
3784  *
3785  * @param   *op1   The first operand.
3786  * @param   *op2   The second operand.
3787  * @param   *mode  The mode of the operands and the result.
3788  */
3789 ir_node *new_Mul    (ir_node *op1, ir_node *op2, ir_mode *mode);
3790
3791 /** Constructor for a Quot node.
3792  *
3793  * Adds the node to the block in current_ir_block.
3794  *
3795  * @param   *memop The store needed to model exceptions
3796  * @param   *op1   The first operand.
3797  * @param   *op2   The second operand.
3798  */
3799 ir_node *new_Quot   (ir_node *memop, ir_node *op1, ir_node *op2);
3800
3801 /** Constructor for a DivMod node.
3802  *
3803  * Adds the node to the block in current_ir_block.
3804  *
3805  * @param   *memop The store needed to model exceptions
3806  * @param   *op1   The first operand.
3807  * @param   *op2   The second operand.
3808  */
3809 ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
3810
3811 /** Constructor for a Div node.
3812  *
3813  * Adds the node to the block in current_ir_block.
3814  *
3815  * @param   *memop The store needed to model exceptions
3816  * @param   *op1   The first operand.
3817  * @param   *op2   The second operand.
3818  */
3819 ir_node *new_Div    (ir_node *memop, ir_node *op1, ir_node *op2);
3820
3821 /** Constructor for a Mod node.
3822  *
3823  * Adds the node to the block in current_ir_block.
3824  *
3825  * @param   *memop The store needed to model exceptions
3826  * @param   *op1   The first operand.
3827  * @param   *op2   The second operand.
3828  */
3829 ir_node *new_Mod    (ir_node *memop, ir_node *op1, ir_node *op2);
3830
3831 /** Constructor for a Abs node.
3832  *
3833  * Adds the node to the block in current_ir_block.
3834  *
3835  * @param   *op    The operand
3836  * @param   *mode  The mode of the operands and the result.
3837  */
3838 ir_node *new_Abs    (ir_node *op,                ir_mode *mode);
3839
3840 /** Constructor for a And node.
3841  *
3842  * Adds the node to the block in current_ir_block.
3843  *
3844  * @param   *op1   The first operand.
3845  * @param   *op2   The second operand.
3846  * @param   *mode  The mode of the operands and the result.
3847  */
3848 ir_node *new_And    (ir_node *op1, ir_node *op2, ir_mode *mode);
3849
3850 /**
3851  * Constructor for a Or node. Adds the node to the block in current_ir_block.
3852  *
3853  * @param   *op1   The first operand.
3854  * @param   *op2   The second operand.
3855  * @param   *mode  The mode of the operands and the result.
3856  */
3857 ir_node *new_Or     (ir_node *op1, ir_node *op2, ir_mode *mode);
3858
3859 /**
3860  * Constructor for a Eor node. Adds the node to the block in current_ir_block.
3861  *
3862  * @param   *op1   The first operand.
3863  * @param   *op2   The second operand.
3864  * @param   *mode  The mode of the operands and the results.
3865  */
3866 ir_node *new_Eor    (ir_node *op1, ir_node *op2, ir_mode *mode);
3867
3868 /** Constructor for a Not node.
3869  *
3870  * Adds the node to the block in current_ir_block.
3871  *
3872  * @param   *op    The operand.
3873  * @param   *mode  The mode of the operand and the result.
3874  */
3875 ir_node *new_Not    (ir_node *op,                ir_mode *mode);
3876
3877 /** Constructor for a Shl node.
3878  *
3879  * Adds the node to the block in current_ir_block.
3880  *
3881  * @param   *op    The operand.
3882  * @param   *k     The number of bits to  shift the operand .
3883  * @param   *mode  The mode of the operand and the result.
3884  */
3885 ir_node *new_Shl    (ir_node *op,  ir_node *k,   ir_mode *mode);
3886
3887 /**
3888  * Constructor for a Shr node. Adds the node to the block in current_ir_block.
3889  *
3890  * @param   *op    The operand.
3891  * @param   *k     The number of bits to  shift the operand .
3892  * @param   *mode  The mode of the operand and the result.
3893  */
3894 ir_node *new_Shr    (ir_node *op,  ir_node *k,   ir_mode *mode);
3895
3896 /** Constructor for a Shrs node.
3897  *
3898  * Adds the node to the block in current_ir_block.
3899  *
3900  * @param   *op    The operand.
3901  * @param   *k     The number of bits to  shift the operand .
3902  * @param   *mode  The mode of the operand and the result.
3903  */
3904 ir_node *new_Shrs   (ir_node *op,  ir_node *k,   ir_mode *mode);
3905
3906 /** Constructor for a Rot node.
3907  *
3908  * Adds the node to the block in current_ir_block.
3909  *
3910  * @param   *op    The operand.
3911  * @param   *k     The number of bits to rotate the operand.
3912  * @param   *mode  The mode of the operand.
3913  */
3914 ir_node *new_Rot    (ir_node *op,  ir_node *k,   ir_mode *mode);
3915
3916 /** Constructor for a Cmp node.
3917  *
3918  * Adds the node to the block in current_ir_block.
3919  *
3920  * @param   *op1   The first operand.
3921  * @param   *op2   The second operand.
3922  */
3923 ir_node *new_Cmp    (ir_node *op1, ir_node *op2);
3924
3925 /** Constructor for a Conv node.
3926  *
3927  * Adds the node to the block in current_ir_block.
3928  *
3929  * @param   *op          The operand.
3930  * @param   *mode        The mode of this the operand muss be converted.
3931  */
3932 ir_node *new_Conv   (ir_node *op, ir_mode *mode);
3933
3934 /** Constructor for a strict Conv node.
3935  *
3936  * Adds the node to the block in current_ir_block.
3937  *
3938  * @param   *op          The operand.
3939  * @param   *mode        The mode of this the operand muss be converted.
3940  */
3941 ir_node *new_strictConv   (ir_node *op, ir_mode *mode);
3942
3943 /** Constructor for a Cast node.
3944  *
3945  * Adds the node to the block in current_ir_block.
3946  * High level type cast
3947  *
3948  * @param   *op    The operand.
3949  * @param   *to_tp The type of this the operand muss be casted .
3950  */
3951 ir_node *new_Cast   (ir_node *op, ir_type *to_tp);
3952
3953 /** Constructor for a Carry node.
3954  *
3955  * Adds the node to the block in current_ir_block.
3956  *
3957  * @param   *op1   The first operand.
3958  * @param   *op2   The second operand.
3959  * @param   *mode  The mode of the operands and the result.
3960  */
3961 ir_node *new_Carry  (ir_node *op1, ir_node *op2, ir_mode *mode);
3962
3963 /** Constructor for a Borrow node.
3964  *
3965  * Adds the node to the block in current_ir_block.
3966  *
3967  * @param   *op1   The first operand.
3968  * @param   *op2   The second operand.
3969  * @param   *mode  The mode of the operands and the result.
3970  */
3971 ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode);
3972
3973 /** Constructor for a Phi node.
3974  *
3975  * Adds the node to the block in current_ir_block.
3976  *
3977  * @param arity  The number of predecessors.
3978  * @param *in    Array with predecessors.
3979  * @param *mode  The mode of it's inputs and output.
3980  */
3981 ir_node *new_Phi    (int arity, ir_node *in[], ir_mode *mode);
3982
3983 /** Constructor for a Load node.
3984  *
3985  * @param *store  The current memory.
3986  * @param *addr   A pointer to the variable to be read in this memory.
3987  * @param *mode   The mode of the value to be loaded.
3988  */
3989 ir_node *new_Load   (ir_node *store, ir_node *addr, ir_mode *mode);
3990
3991 /** Constructor for a Store node.
3992  *
3993  * @param *store  The current memory.
3994  * @param *addr   A pointer to the variable to be read in this memory.
3995  * @param *val    The value to write to this variable.
3996  */
3997 ir_node *new_Store  (ir_node *store, ir_node *addr, ir_node *val);
3998
3999 /** Constructor for a Alloc node.
4000  *
4001  * The Alloc node extends the memory by space for an entity of type alloc_type.
4002  * Adds the node to the block in current_ir_block.
4003  *
4004  * @param *store      The memory which shall contain the new variable.
4005  * @param *size       The number of bytes to allocate.
4006  * @param *alloc_type The type of the allocated variable.
4007  * @param where       Where to allocate the variable, either heap_alloc or stack_alloc.
4008  */
4009 ir_node *new_Alloc  (ir_node *store, ir_node *size, ir_type *alloc_type,
4010                      where_alloc where);
4011
4012 /** Constructor for a Free node.
4013  *
4014  * Frees the memory occupied by the entity pointed to by the pointer
4015  * arg.  Type indicates the type of the entity the argument points to.
4016  * Adds the node to the block in current_ir_block.
4017  *
4018  * @param *store      The memory which shall contain the new variable.
4019  * @param *ptr        The pointer to the object to free.
4020  * @param *size       The number of objects of type free_type to free in a sequence.
4021  * @param *free_type  The type of the freed variable.
4022  * @param where       Where the variable was allocated, either heap_alloc or stack_alloc.
4023  */
4024 ir_node *new_Free   (ir_node *store, ir_node *ptr, ir_node *size,
4025                      ir_type *free_type, where_alloc where);
4026
4027 /** Constructor for a Sync node.
4028  *
4029  * Merges several memory values.  The node assumes that a variable
4030  * either occurs only in one of the memories, or it contains the same
4031  * value in all memories where it occurs.
4032  * Adds the node to the block in current_ir_block.
4033  *
4034  * @param  arity    The number of memories to synchronize.
4035  * @param  **in     An array of pointers to nodes that produce an output of type
4036  *                  memory.  The constructor copies this array.
4037  */
4038 ir_node *new_Sync   (int arity, ir_node *in[]);
4039
4040 /** Constructor for a Proj node.
4041  *
4042  * Projects a single value out of a tuple.  The parameter proj gives the
4043  * position of the value within the tuple.
4044  * Adds the node to the block in current_ir_block.
4045  *
4046  * @param arg    A node producing a tuple.
4047  * @param *mode  The mode of the value to project.
4048  * @param proj   The position of the value in the tuple.
4049  */
4050 ir_node *new_Proj   (ir_node *arg, ir_mode *mode, long proj);
4051
4052 /** Constructor for a Filter node.
4053  *
4054  * Constructor for a Filter node. Adds the node to the block in current_ir_block.
4055  * Filter is a node with two views used to construct the interprocedural view.
4056  * In intraprocedural view its semantics are identical to the Proj node.
4057  * In interprocedural view the Filter performs the Phi operation on method
4058  * parameters or results.  Other than a Phi a Filter node may not be removed
4059  * if it has only a single input.
4060  *
4061  * The constructor builds the Filter in intraprocedural view.
4062  *
4063  * @param *arg  The tuple value to project from.
4064  * @param *mode The mode of the projected value.
4065  * @param proj  The position in the tuple to project from.
4066  */
4067 ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj);
4068
4069 /** Constructor for a defaultProj node.
4070  *
4071  * Represents the default control flow of a Switch-Cond node.
4072  * Adds the node to the block in current_ir_block.
4073  *
4074  * @param arg       A node producing a tuple.
4075  * @param max_proj  The end  position of the value in the tuple.
4076  */
4077 ir_node *new_defaultProj (ir_node *arg, long max_proj);
4078
4079 /** Constructor for a Tuple node.
4080  *
4081  * This is an auxiliary node to replace a node that returns a tuple
4082  * without changing the corresponding Proj nodes.
4083  * Adds the node to the block in current_ir_block.
4084  *
4085  * @param arity   The number of tuple elements.
4086  * @param **in    An array containing pointers to the nodes producing the tuple elements.
4087  */
4088 ir_node *new_Tuple  (int arity, ir_node *in[]);
4089
4090 /** Constructor for an Id node.
4091  *
4092  * This is an auxiliary node to replace a node that returns a single
4093  * value. Adds the node to the block in current_ir_block.
4094  *
4095  * @param *val    The operand to Id.
4096  * @param *mode   The mode of *val.
4097  */
4098 ir_node *new_Id     (ir_node *val, ir_mode *mode);
4099
4100 /** Constructor for a Bad node.
4101  *
4102  * Returns the unique Bad node of the graph.  The same as
4103  * get_irg_bad().
4104  */
4105 ir_node *new_Bad    (void);
4106
4107 /** Constructor for a Confirm node.
4108  *
4109  * Specifies constraints for a value.  To support dataflow analyses.
4110  * Adds the node to the block in current_ir_block.
4111  *
4112  * Example: If the value never exceeds '100' this is expressed by placing a
4113  * Confirm node val = new_d_Confirm(db, val, 100, '<') on the dataflow edge.
4114  *
4115  * @param *val    The value we express a constraint for
4116  * @param *bound  The value to compare against. Must be a firm node, typically a constant.
4117  * @param cmp     The compare operation.
4118  */
4119 ir_node *new_Confirm (ir_node *val, ir_node *bound, pn_Cmp cmp);
4120
4121 /** Constructor for an Unknown node.
4122  *
4123  * Represents an arbitrary value.  Places the node in
4124  * the start block.
4125  *
4126  * @param *m      The mode of the unknown value.
4127  */
4128 ir_node *new_Unknown(ir_mode *m);
4129
4130 /** Constructor for a NoMem node.
4131  *
4132  * Returns the unique NoMem node of the graph.  The same as
4133  * get_irg_no_mem().
4134  */
4135 ir_node *new_NoMem  (void);
4136
4137 /** Constructor for a Mux node.
4138  *
4139  * Adds the node to the block in current_ir_block.
4140  *
4141  * @param *sel      The ir_node that calculates the boolean select.
4142  * @param *ir_true  The ir_node that calculates the true result.
4143  * @param *ir_false The ir_node that calculates the false result.
4144  * @param *mode     The mode of the node (and it_true and ir_false).
4145  */
4146 ir_node *new_Mux  (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
4147
4148 /** Constructor for a Psi node.
4149  *
4150  * @param *arity    The arity of the conditions
4151  * @param *conds    The array of mode_b conditions, length must be equal arity
4152  * @param *vals     The array of mode values, length must be equal arity + 1
4153  * @param *mode     The mode of the node (must be the mode of all vals).
4154  */
4155 ir_node *new_Psi (int arity, ir_node *conds[], ir_node *vals[], ir_mode *mode);
4156
4157 /** Constructor for a CopyB node.
4158  *
4159  * Adds the node to the block in current_ir_block.
4160  *
4161  * @param *store      The current memory
4162  * @param *dst        The ir_node that represents the destination address.
4163  * @param *src        The ir_node that represents the source address.
4164  * @param *data_type  The type of the copied data
4165  */
4166 ir_node *new_CopyB(ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
4167
4168 /** Constructor for a InstOf node.
4169  *
4170  * A High-Level Type check.
4171  *
4172  * @param   *store     The memory in which the object the entity should be selected
4173  *                     from is allocated.
4174  * @param   *objptr    A pointer to a object of a class type.
4175  * @param   *type      The type of which objptr must be.
4176  */
4177 ir_node *new_InstOf (ir_node *store, ir_node *objptr, ir_type *type);
4178
4179 /**Constructor for a Raise node.
4180  *
4181  * A High-Level Exception throw.
4182  *
4183  * @param *store The current memory.
4184  * @param *obj   A pointer to the Except variable.
4185  */
4186 ir_node *new_Raise  (ir_node *store, ir_node *obj);
4187
4188 /** Constructor for a Bound node.
4189  *
4190  * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
4191  *
4192  * Adds the node to the block in current_ir_block.
4193  *
4194  * @param *store      The current memory
4195  * @param *idx        The ir_node that represents an index.
4196  * @param *lower      The ir_node that represents the lower bound for the index.
4197  * @param *upper      The ir_node that represents the upper bound for the index.
4198  */
4199 ir_node *new_Bound(ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
4200
4201 /** Constructor for a Pin node.
4202  *
4203  * @param *node       The node which value should be pinned.
4204  */
4205 ir_node *new_Pin(ir_node *node);
4206
4207 /*---------------------------------------------------------------------*/
4208 /* The comfortable interface.                                          */
4209 /* Supports automatic Phi node construction.                           */
4210 /* All routines of the block oriented interface except new_Block are   */
4211 /* needed also.                                                        */
4212 /*---------------------------------------------------------------------*/
4213
4214 /** Create an immature block.
4215  *
4216  * An immature block has an unknown number of predecessors.  Predecessors
4217  * can be added with add_immBlock_pred().  Once all predecessors are
4218  * added the block must be matured.
4219  *
4220  * Adds the block to the graph in current_ir_graph. Does set
4221  * current_block.  Can be used with automatic Phi node construction.
4222  * This constructor can only be used if the graph is in
4223  * state_building.
4224  */
4225 ir_node *new_d_immBlock (dbg_info *db);
4226 ir_node *new_immBlock (void);
4227
4228 /** Add a control flow edge to an immature block. */
4229 void add_immBlock_pred (ir_node *immblock, ir_node *jmp);
4230
4231 /** Finalize a Block node, when all control flows are known. */
4232 void mature_immBlock (ir_node *block);
4233 #define mature_cur_block() mature_immBlock(get_cur_block());
4234
4235
4236 /** Get the current value of a local variable.
4237  *
4238  * Use this function to obtain the last definition of the local variable
4239  * associated with pos.  Pos may not exceed the value passed as n_loc
4240  * to new_ir_graph.  This call automatically inserts Phi nodes.
4241  *
4242  * @param *db    A pointer for debug information.
4243  * @param  pos   The position/id of the local variable.
4244  * @param *mode  The mode of the value to get.
4245  */
4246 ir_node *get_d_value (dbg_info *db, int pos, ir_mode *mode);
4247 ir_node *get_value (int pos, ir_mode *mode);
4248
4249 /** Remark a new definition of a variable.
4250  *
4251  * Use this function to remember a new definition of the value
4252  * associated with pos. Pos may not exceed the value passed as n_loc
4253  * to new_ir_graph.  This call is needed to automatically inserts Phi
4254  * nodes.
4255  *
4256  * @param  pos   The position/id of the local variable.
4257  * @param *value The new value written to the local variable.
4258  */
4259 void set_value (int pos, ir_node *value);
4260
4261 /** Get the current memory state.
4262  *
4263  * Use this function to obtain the last definition of the memory
4264  * state.  This call automatically inserts Phi nodes for the memory
4265  * state value.
4266  */
4267 ir_node *get_store (void);
4268
4269 /** Remark a new definition of the memory state.
4270  *
4271  * Use this function to remember a new definition of the memory state.
4272  * This call is needed to automatically inserts Phi nodes.
4273  *
4274  * @param *store The new memory state.
4275  */
4276 void set_store (ir_node *store);
4277
4278 /** keep this node alive even if End is not control-reachable from it
4279  *
4280  * @param ka The node to keep alive.
4281  */
4282 void keep_alive (ir_node *ka);
4283
4284 /** Returns the frame type of the current graph */
4285 ir_type *get_cur_frame_type(void);
4286
4287
4288 /* --- initialize and finalize ir construction --- */
4289
4290 /** Puts the graph into state "phase_high" */
4291 #define irg_finalize_cons(irg) set_irg_phase_state(irg, phase_high)
4292
4293 /** Puts the program and all graphs into state phase_high.
4294  *
4295  * This also remarks, the construction of types is finished,
4296  * e.g., that no more subtypes will be added.  */
4297 void irp_finalize_cons(void);
4298
4299 /* --- Initialization --- */
4300
4301 /**
4302  * This function is called, whenever a local variable is used before definition
4303  *
4304  * @param irg       the IR graph on which this happens
4305  * @param mode      the mode of the local var
4306  * @param pos       position chosen be the frontend for this variable (n_loc)
4307  *
4308  * @return a firm node of mode @p mode that initializes the var at position pos
4309  *
4310  * @note
4311  *      Do not return NULL!
4312  *      If this function is not set, FIRM will create a const node with tarval BAD.
4313  *      Use set_irg_loc_description()/get_irg_loc_description() to assign additional
4314  *      informations to local variables.
4315  */
4316 typedef ir_node *uninitialized_local_variable_func_t(ir_graph *irg, ir_mode *mode, int pos);
4317
4318 #endif /* _FIRM_IR_IRCONS_H_ */