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