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