- do not use tuple result for builtins, not needed yet
[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   kind    The kind of the called builtin.
1472  * @param   arity   The number of procedure parameters.
1473  * @param   *in[]   An array with the procedure parameters. The constructor copies this array.
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                                     ir_builtin_kind kind, int arity, ir_node *in[], 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 Cast node.
1738  *
1739  * High level type cast.
1740  *
1741  * @param   *db    A pointer for debug information.
1742  * @param   *irg   The IR graph the node  belongs to.
1743  * @param   *block The IR block the node belongs to.
1744  * @param   *op    The operand.
1745  * @param   *to_tp The type of this the operand muss be casted .
1746  */
1747 ir_node *new_rd_Cast   (dbg_info *db, ir_graph *irg, ir_node *block,
1748                         ir_node *op, ir_type *to_tp);
1749
1750 /** Constructor for a Carry node.
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   *op1   The first operand.
1756  * @param   *op2   The second operand.
1757  * @param   *mode  The mode of the operands and the result.
1758  */
1759 ir_node *new_rd_Carry  (dbg_info *db, ir_graph *irg, ir_node *block,
1760                         ir_node *op1, ir_node *op2, ir_mode *mode);
1761
1762 /** Constructor for a Borrow node.
1763  *
1764  * @param   *db    A pointer for debug information.
1765  * @param   *irg   The IR graph the node  belongs to.
1766  * @param   *block The IR block the node belongs to.
1767  * @param   *op1   The first operand.
1768  * @param   *op2   The second operand.
1769  * @param   *mode  The mode of the operands and the result.
1770  */
1771 ir_node *new_rd_Borrow (dbg_info *db, ir_graph *irg, ir_node *block,
1772                         ir_node *op1, ir_node *op2, ir_mode *mode);
1773
1774 /** Constructor for a Phi node.
1775  *
1776  * @param *db    A pointer for debug information.
1777  * @param *irg   The IR graph the node  belongs to.
1778  * @param *block The IR block the node belongs to.
1779  * @param arity  The number of predecessors
1780  * @param *in[]  Array with predecessors.  The constructor copies this array.
1781  * @param *mode  The mode of it's inputs and output.
1782  */
1783 ir_node *new_rd_Phi    (dbg_info *db, ir_graph *irg, ir_node *block, int arity,
1784                         ir_node *in[], ir_mode *mode);
1785
1786 /** Constructor for a Load node.
1787  *
1788  * @param *db    A pointer for debug information.
1789  * @param *irg   The IR graph the node  belongs to.
1790  * @param *block The IR block the node belongs to.
1791  * @param *store The current memory
1792  * @param *adr   A pointer to the variable to be read in this memory.
1793  * @param *mode  The mode of the value to be loaded.
1794  * @param  flags Additional flags for alignment, volatility and pin state.
1795  */
1796 ir_node *new_rd_Load   (dbg_info *db, ir_graph *irg, ir_node *block,
1797                         ir_node *store, ir_node *adr, ir_mode *mode, ir_cons_flags flags);
1798
1799 /** Constructor for a Store node.
1800  *
1801  * @param *db    A pointer for debug information.
1802  * @param *irg   The IR graph the node  belongs to.
1803  * @param *block The IR block the node belongs to.
1804  * @param *store The current memory
1805  * @param *adr   A pointer to the variable to be read in this memory.
1806  * @param *val   The value to write to this variable.
1807  * @param  flags Additional flags for alignment, volatility and pin state.
1808  */
1809 ir_node *new_rd_Store  (dbg_info *db, ir_graph *irg, ir_node *block,
1810                ir_node *store, ir_node *adr, ir_node *val, ir_cons_flags flags);
1811
1812 /** Constructor for a Alloc node.
1813  *
1814  * The Alloc node extends the memory by space for an entity of type alloc_type.
1815  *
1816  * @param *db         A pointer for debug information.
1817  * @param *irg        The IR graph the node  belongs to.
1818  * @param *block      The IR block the node belongs to.
1819  * @param *store      The memory which shall contain the new variable.
1820  * @param *size       The number of bytes to allocate.
1821  * @param *alloc_type The type of the allocated variable.
1822  * @param where       Where to allocate the variable, either heap_alloc or stack_alloc.
1823  */
1824 ir_node *new_rd_Alloc  (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1825                ir_node *size, ir_type *alloc_type, ir_where_alloc where);
1826
1827 /** Constructor for a Free node.
1828  *
1829  * Frees the memory occupied by the entity pointed to by the pointer
1830  * arg.  Type indicates the type of the entity the argument points to.
1831  *
1832  * @param *db         A pointer for debug information.
1833  * @param *irg        The IR graph the node  belongs to.
1834  * @param *block      The IR block the node belongs to.
1835  * @param *store      The memory which shall contain the new variable.
1836  * @param *ptr        The pointer to the object to free.
1837  * @param *size       The number of objects of type free_type to free in a sequence.
1838  * @param *free_type  The type of the freed variable.
1839  * @param where       Where the variable was allocated, either heap_alloc or stack_alloc.
1840  */
1841 ir_node *new_rd_Free   (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1842                         ir_node *ptr, ir_node *size, ir_type *free_type, ir_where_alloc where);
1843
1844 /** Constructor for a Sync node.
1845  *
1846  * Merges several memory values.  The node assumes that a variable
1847  * either occurs only in one of the memories, or it contains the same
1848  * value in all memories where it occurs.
1849  *
1850  * @param *db       A pointer for debug information.
1851  * @param *irg      The IR graph the node  belongs to.
1852  * @param *block    The IR block the node belongs to.
1853  * @param  arity    The number of memories to synchronize.
1854  * @param  *in[]    An array of pointers to nodes that produce an output of type
1855  *                  memory.  The constructor copies this array.
1856  */
1857 ir_node *new_rd_Sync   (dbg_info *db, ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
1858
1859 /** Constructor for a Proj node.
1860  *
1861  * Projects a single value out of a tuple.  The parameter proj gives the
1862  * position of the value within the tuple.
1863  *
1864  * @param *db    A pointer for debug information.
1865  * @param *irg   The IR graph the node  belongs to.
1866  * @param *block The IR block the node belongs to.
1867  * @param arg    A node producing a tuple.  The node must have mode_T.
1868  * @param *mode  The mode of the value to project.
1869  * @param proj   The position of the value in the tuple.
1870  */
1871 ir_node *new_rd_Proj   (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1872                         ir_mode *mode, long proj);
1873
1874 /** Constructor for a defaultProj node.
1875  *
1876  * Represents the default control flow of a Switch-Cond node.
1877  *
1878  * @param *db       A pointer for debug information.
1879  * @param *irg      The IR graph the node  belongs to.
1880  * @param *block    The IR block the node belongs to.
1881  * @param arg       A node producing a tuple.
1882  * @param max_proj  The end position of the value in the tuple.
1883  */
1884 ir_node *new_rd_defaultProj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1885                              long max_proj);
1886
1887 /** Constructor for a Tuple node.
1888  *
1889  * This is an auxiliary node to replace a node that returns a tuple
1890  * without changing the corresponding Proj nodes.
1891  *
1892  * @param *db     A pointer for debug information.
1893  * @param *irg    The IR graph the node  belongs to.
1894  * @param *block  The IR block the node belongs to.
1895  * @param arity   The number of tuple elements.
1896  * @param *in[]   An array containing pointers to the nodes producing the tuple
1897  *                elements. The constructor copies this array.
1898  */
1899 ir_node *new_rd_Tuple  (dbg_info *db, ir_graph *irg, ir_node *block,
1900                         int arity, ir_node *in[]);
1901
1902 /** Constructor for a Id node.
1903  *
1904  * This is an auxiliary node to replace a node that returns a single
1905  * value.
1906  *
1907  * @param *db     A pointer for debug information.
1908  * @param *irg    The IR graph the node  belongs to.
1909  * @param *block  The IR block the node belongs to.
1910  * @param *val    The value
1911  * @param *mode   The mode of *val.
1912  */
1913 ir_node *new_rd_Id     (dbg_info *db, ir_graph *irg, ir_node *block,
1914                         ir_node *val, ir_mode *mode);
1915
1916 /** Constructor for a Confirm node.
1917  *
1918  * Specifies constraints for a value.  To support dataflow analyses.
1919  *
1920  * Example: If the value never exceeds '100' this is expressed by placing a
1921  * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
1922  *
1923  * @param *irg    The IR graph the node belong to.
1924  * @param *block  The IR block the node belong to.
1925  * @param *db     A pointer for debug information.
1926  * @param *val    The value we express a constraint for
1927  * @param *bound  The value to compare against. Must be a firm node, typically a constant.
1928  * @param cmp     The compare operation.
1929  */
1930 ir_node *new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block,
1931              ir_node *val, ir_node *bound, pn_Cmp cmp);
1932
1933 /** Constructor for an Unknown node.
1934  *
1935  * Represents an arbitrary value.  Places the node in the start block.
1936  *
1937  * @param *irg    The IR graph the node  belongs to.
1938  * @param *m      The mode of the unknown value.
1939  */
1940 ir_node *new_rd_Unknown(ir_graph *irg, ir_mode *m);
1941
1942 /** Constructor for a CallBegin node.
1943  *
1944  * CallBegin represents control flow depending of the pointer value
1945  * representing the called method to the called methods.  The
1946  * constructor copies the method pointer input from the passed Call
1947  * node.
1948  *
1949  * @param *db     A pointer for debug information.
1950  * @param *irg    The IR graph the node belong to.
1951  * @param *block  The block the node belong to.
1952  * @param *callee The call node visible in the intra procedural view.
1953  */
1954 ir_node *new_rd_CallBegin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *callee);
1955
1956 /** Constructor for a EndReg node.
1957  *
1958  * Used to represent regular procedure end in interprocedual view.
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  */
1964 ir_node *new_rd_EndReg (dbg_info *db, ir_graph *irg, ir_node *block);
1965
1966 /** Constructor for a EndExcept node.
1967  *
1968  * Used to represent exceptional procedure end in interprocedural view.
1969  *
1970  * @param *db     A pointer for debug information.
1971  * @param *irg    The IR graph the node belong to.
1972  * @param *block  The block the node belong to.
1973  */
1974 ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
1975
1976 /** Constructor for a Filter node.
1977  *
1978  * Adds the node to the block in current_ir_block.  Filter is a node
1979  * with two views used to construct the interprocedural view.  In
1980  * intraprocedural view its semantics are identical to the Proj node.
1981  * In interprocedural view the Filter performs the Phi operation on
1982  * method parameters or results.  Other than a Phi a Filter node may
1983  * not be removed if it has only a single input.
1984  *
1985  * The constructor builds the Filter in intraprocedural view.
1986  *
1987  * @param *db     A pointer for debug information.
1988  * @param *irg    The IR graph the node belong to.
1989  * @param *block  The block the node belong to.
1990  * @param *arg  The tuple value to project from.
1991  * @param *mode The mode of the projected value.
1992  * @param proj  The position in the tuple to project from.
1993  */
1994 ir_node *new_rd_Filter (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1995                         ir_mode *mode, long proj);
1996
1997 /** Constructor for a Mux node.
1998  *
1999  * @param *db       A pointer for debug information.
2000  * @param *irg      The IR graph the node belong to.
2001  * @param *block    The block the node belong to.
2002  * @param *sel      The ir_node that calculates the boolean select.
2003  * @param *ir_true  The ir_node that calculates the true result.
2004  * @param *ir_false The ir_node that calculates the false result.
2005  * @param *mode     The mode of the node (and it_true and ir_false).
2006  */
2007 ir_node *new_rd_Mux  (dbg_info *db, ir_graph *irg, ir_node *block,
2008     ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2009
2010 /** Constructor for a CopyB node.
2011  *
2012  * @param *db         A pointer for debug information.
2013  * @param *irg        The IR graph the node belong to.
2014  * @param *block      The block the node belong to.
2015  * @param *store      The current memory
2016  * @param *dst        The ir_node that represents the destination address.
2017  * @param *src        The ir_node that represents the source address.
2018  * @param *data_type  The type of the copied data
2019  */
2020 ir_node *new_rd_CopyB(dbg_info *db, ir_graph *irg, ir_node *block,
2021     ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
2022
2023 /** Constructor for a InstOf node.
2024  *
2025  * A High-Level Type check.
2026  *
2027  * @param   *db        A pointer for debug information.
2028  * @param   *irg       The IR graph the node  belongs to.
2029  * @param   *block     The IR block the node belongs to.
2030  * @param   *store     The memory in which the object the entity should be selected
2031  *                     from is allocated.
2032  * @param   *objptr    A pointer to a object of a class type.
2033  * @param   *type      The type of which objptr must be.
2034  */
2035 ir_node *new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
2036                         ir_node *objptr, ir_type *type);
2037
2038 /** Constructor for a Raise node.
2039  *
2040  * A High-Level Exception throw.
2041  *
2042  * @param *db    A pointer for debug information.
2043  * @param *irg   The IR graph the node  belongs to.
2044  * @param *block The IR block the node belongs to.
2045  * @param *store The current memory.
2046  * @param *obj   A pointer to the Except variable.
2047  */
2048 ir_node *new_rd_Raise  (dbg_info *db, ir_graph *irg, ir_node *block,
2049                         ir_node *store, ir_node *obj);
2050
2051 /** Constructor for a Bound node.
2052  *
2053  * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2054  *
2055  * @param *db         A pointer for debug information.
2056  * @param *irg        The IR graph the node belong to.
2057  * @param *block      The block the node belong to.
2058  * @param *store      The current memory.
2059  * @param *idx        The ir_node that represents an index.
2060  * @param *lower      The ir_node that represents the lower bound for the index.
2061  * @param *upper      The ir_node that represents the upper bound for the index.
2062  */
2063 ir_node *new_rd_Bound(dbg_info *db, ir_graph *irg, ir_node *block,
2064     ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
2065
2066 /** Constructor for a Pin node.
2067  *
2068  * @param *db         A pointer for debug information.
2069  * @param *irg        The IR graph the node belong to.
2070  * @param *block      The block the node belong to.
2071  * @param *node       The node which value should be pinned.
2072  */
2073 ir_node *new_rd_Pin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *node);
2074
2075 /** Constructor for an ASM pseudo node.
2076  *
2077  * @param *db         A pointer for debug information.
2078  * @param *irg        The IR graph the node belong to.
2079  * @param *block      The block the node belong to.
2080  * @param arity       The number of data inputs to the node.
2081  * @param *in         The array of length arity of data inputs.
2082  * @param *inputs     The array of length arity of input constraints.
2083  * @param n_outs      The number of data outputs to the node.
2084  * @param *outputs    The array of length n_outs of output constraints.
2085  * @param n_clobber   The number of clobbered registers.
2086  * @param *clobber    The array of length n_clobber of clobbered registers.
2087  * @param *asm_text   The assembler text.
2088  */
2089 ir_node *new_rd_ASM(dbg_info *db, ir_graph *irg, ir_node *block,
2090                     int arity, ir_node *in[], ir_asm_constraint *inputs,
2091                     int n_outs, ir_asm_constraint *outputs,
2092                     int n_clobber, ident *clobber[], ident *asm_text);
2093
2094 /*-------------------------------------------------------------------------*/
2095 /* The raw interface without debug support                                 */
2096 /*-------------------------------------------------------------------------*/
2097
2098 /** Constructor for a Block node.
2099  *
2100  * Constructs a mature block with the given predecessors.  Use Unknown
2101  * nodes as predecessors to construct a block if the number of
2102  * predecessors is known, but not the predecessors themselves.  This
2103  * constructor does not set current_block.  It not be used with
2104  * automatic Phi node construction.
2105  *
2106  *
2107  * @param irg    The IR graph the block belongs to.
2108  * @param arity  The number of control predecessors.
2109  * @param in[]   An array of control predecessors.  The length of
2110  *               the array must be 'arity'. The constructor copies this array.
2111  */
2112 ir_node *new_r_Block  (ir_graph *irg,  int arity, ir_node *in[]);
2113
2114 /** Constructor for a Start node.
2115  *
2116  * @param *irg   The IR graph the node belongs to.
2117  * @param *block The IR block the node belongs to.
2118  */
2119 ir_node *new_r_Start  (ir_graph *irg, ir_node *block);
2120
2121 /** Constructor for a End node.
2122  *
2123  * @param *irg   The IR graph the node  belongs to.
2124  * @param *block The IR block the node belongs to.
2125  */
2126 ir_node *new_r_End    (ir_graph *irg, ir_node *block);
2127
2128 /** Constructor for a Jmp node.
2129  *
2130  * Jmp represents control flow to a single control successor.
2131  *
2132  * @param *irg    The IR graph the node belongs to.
2133  * @param *block  The IR block the node belongs to.
2134  */
2135 ir_node *new_r_Jmp    (ir_graph *irg, ir_node *block);
2136
2137 /** Constructor for an IJmp node.
2138  *
2139  * IJmp represents control flow to a single control successor not
2140  * statically known i.e. an indirect Jmp.
2141  *
2142  * @param *irg    The IR graph the node belongs to.
2143  * @param *block  The IR block the node belongs to.
2144  * @param *tgt    The IR node representing the target address.
2145  */
2146 ir_node *new_r_IJmp   (ir_graph *irg, ir_node *block, ir_node *tgt);
2147
2148 /** Constructor for a Cond node.
2149  *
2150  * If c is mode_b represents a conditional branch (if/else). If c is
2151  * mode_Is/mode_Iu (?) represents a switch.  (Allocates dense Cond
2152  * node, default Proj is 0.)
2153  *
2154  * This is not consistent:  Input to Cond is Is, Proj has as proj number
2155  * longs.
2156  *
2157  * @param *irg   The IR graph the node  belongs to.
2158  * @param *block The IR block the node belongs to.
2159  * @param *c     The conditions parameter.Can be of mode b or I_u.
2160  */
2161 ir_node *new_r_Cond   (ir_graph *irg, ir_node *block, ir_node *c);
2162
2163 /** Constructor for a Return node.
2164  *
2165  * Returns the memory and zero or more return values.  Only node that
2166  * can end regular control flow.
2167  *
2168  * @param *irg   The IR graph the node  belongs to.
2169  * @param *block The IR block the node belongs to.
2170  * @param *store The state of memory.
2171  * @param arity  Number of array indices.
2172  * @param *in[]   Array with index inputs to the node. The constructor copies this array.
2173  */
2174 ir_node *new_r_Return (ir_graph *irg, ir_node *block,
2175                        ir_node *store, int arity, ir_node *in[]);
2176
2177 /** Constructor for a Const node.
2178  *
2179  * Adds the node to the start block.
2180  *
2181  * Constructor for a Const node. The constant represents a target
2182  * value.  Sets the type information to type_unknown.  (No more
2183  * supported: If tv is entity derives a somehow useful type.)
2184  * Derives mode from passed tarval.
2185  *
2186  * @param *irg   The IR graph the node  belongs to.
2187  * @param *block The IR block the node belongs to.
2188  * @param *con   Points to an entry in the constant table.
2189  */
2190 ir_node *new_r_Const  (ir_graph *irg, tarval *con);
2191
2192 /** Constructor for a Const node.
2193  *
2194  * Adds the node to the start block.
2195  *
2196  * Constructor for a Const node. The constant represents a target
2197  * value.  Sets the type information to type_unknown.  (No more
2198  * supported: If tv is entity derives a somehow useful type.)
2199  *
2200  * @param *irg   The IR graph the node  belongs to.
2201  * @param *mode  The mode of the operands and the results.
2202  * @param value  A value from which the tarval is made.
2203  */
2204 ir_node *new_r_Const_long(ir_graph *irg,
2205                        ir_mode *mode, long value);
2206
2207 /** Constructor for a Const_type node.
2208  *
2209  * Adds the node to the start block.
2210  *
2211  * The constant represents a target value.  This constructor sets high
2212  * level type information for the constant value.
2213  * Derives mode from passed tarval.
2214  *
2215  * @param *irg   The IR graph the node  belongs to.
2216  * @param *con   Points to an entry in the constant table.
2217  * @param *tp    The type of the constant.
2218  */
2219 ir_node *new_r_Const_type(ir_graph *irg, tarval *con, ir_type *tp);
2220
2221 /** Constructor for a SymConst node.
2222  *
2223  *  This is the constructor for a symbolic constant.
2224  *    There are four kinds of symbolic constants:
2225  *    - type_tag  The symbolic constant represents a type tag.  The type the
2226  *                tag stands for is given explicitly.
2227  *    - size      The symbolic constant represents the size of a type.  The
2228  *                type of which the constant represents the size is given
2229  *                explicitly.
2230  *    - addr_name The symbolic constant represents the address of an entity
2231  *                (variable or method).  The variable is indicated by a name
2232  *                that is valid for linking.
2233  *    - addr_ent   The symbolic constant represents the address of an entity
2234  *                (variable or method).  The variable is given explicitly by
2235  *                a firm entity.
2236  *
2237  *    Inputs to the node:
2238  *      No inputs except the block it belongs to.
2239  *    Outputs of the node.
2240  *      An unsigned integer (I_u) or a pointer (P).
2241  *
2242  * @param *irg    The IR graph the node  belongs to.
2243  * @param *block  The IR block the node belongs to.
2244  * @param mode    The mode for the SymConst.
2245  * @param value   A type, entity or a ident depending on the SymConst kind.
2246  * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
2247  */
2248 ir_node *new_r_SymConst(ir_graph *irg, ir_node *block, ir_mode *mode,
2249                         union symconst_symbol value, symconst_kind symkind);
2250
2251 /** Constructor for a simpleSel node.
2252  *
2253  *  This is a shortcut for the new_d_Sel() constructor.  To be used for
2254  *  Sel nodes that do not select from an array, i.e., have no index
2255  *  inputs.  It adds the two parameters 0, NULL.
2256  *
2257  * @param   *irg       The IR graph the node  belongs to.
2258  * @param   *block     The IR block the node belongs to.
2259  * @param   *store     The memory in which the object the entity should be selected
2260  *                     from is allocated.
2261  * @param   *objptr    The object from that the Sel operation selects a
2262  *                     single attribute out.
2263  * @param   *ent       The entity to select.
2264  */
2265 ir_node *new_r_simpleSel(ir_graph *irg, ir_node *block, ir_node *store,
2266                          ir_node *objptr, ir_entity *ent);
2267
2268 /** Constructor for a Sel node.
2269  *
2270  * The select node selects an entity (field or method) from an entity
2271  * with a compound type.  It explicitly specifies the entity selected.
2272  * Dynamically the node may select entities that overwrite the given
2273  * entity.  If the selected entity is an array element entity the Sel
2274  * node takes the required array indices as inputs.
2275  *
2276  * @param   *irg       The IR graph the node  belongs to.
2277  * @param   *block     The IR block the node belongs to.
2278  * @param   *store     The memory in which the object the entity should be selected
2279  *                     from is allocated.
2280  * @param   *objptr    A pointer to a compound entity the Sel operation selects a
2281  *                     single attribute from.
2282  * @param   *n_index   The number of array indices needed to select an array element entity.
2283  * @param   *index[]   If the compound entity is an array the indices of the selected
2284  *                     element entity.  The constructor copies this array.
2285  * @param   *ent       The entity to select.
2286  */
2287 ir_node *new_r_Sel    (ir_graph *irg, ir_node *block, ir_node *store,
2288                        ir_node *objptr, int n_index, ir_node *index[],
2289                ir_entity *ent);
2290
2291 /** Constructor for a Call node.
2292  *
2293  * Represents all kinds of method and function calls.
2294  *
2295  * @param   *irg    The IR graph the node  belongs to.
2296  * @param   *block  The IR block the node belongs to.
2297  * @param   *store  The actual store.
2298  * @param   *callee A pointer to the called procedure.
2299  * @param   arity   The number of procedure parameters.
2300  * @param   *in[]   An array with the pointers to the parameters. The constructor copies this array.
2301  * @param   *tp     Type information of the procedure called.
2302  */
2303 ir_node *new_r_Call   (ir_graph *irg, ir_node *block, ir_node *store,
2304                        ir_node *callee, int arity, ir_node *in[], ir_type *tp);
2305
2306 /** Constructor for a Builtin node.
2307  *
2308  * Represents a call of a backend-specific builtin..
2309  *
2310  * @param   *irg    The IR graph the node  belongs to.
2311  * @param   *block  The IR block the node belongs to.
2312  * @param   *store  The actual store.
2313  * @param   kind    The kind of the called builtin.
2314  * @param   arity   The number of procedure parameters.
2315  * @param   *in[]   An array with the pointers to the parameters. The constructor copies this array.
2316  * @param   *tp     Type information of the procedure called.
2317  */
2318 ir_node *new_r_Builtin(ir_graph *irg, ir_node *block, ir_node *store,
2319                        ir_builtin_kind kind, int arity, ir_node *in[], ir_type *tp);
2320
2321 /** Constructor for a Add node.
2322  *
2323  * @param   *irg   The IR graph the node  belongs to.
2324  * @param   *block The IR block the node belongs to.
2325  * @param   *op1   The first operand.
2326  * @param   *op2   The second operand.
2327  * @param   *mode  The mode of the operands and the result.
2328  */
2329 ir_node *new_r_Add    (ir_graph *irg, ir_node *block,
2330                ir_node *op1, ir_node *op2, ir_mode *mode);
2331
2332 /**
2333  * Constructor for a Sub node.
2334  *
2335  * @param   *irg   The IR graph the node  belongs to.
2336  * @param   *block The IR block the node belongs to.
2337  * @param   *op1   The first operand.
2338  * @param   *op2   The second operand.
2339  * @param   *mode  The mode of the operands and the results.
2340  */
2341 ir_node *new_r_Sub    (ir_graph *irg, ir_node *block,
2342                ir_node *op1, ir_node *op2, ir_mode *mode);
2343
2344 /** Constructor for a Minus node.
2345  *
2346  * @param   *irg   The IR graph the node  belongs to.
2347  * @param   *block The IR block the node belongs to.
2348  * @param   *op   The operand.
2349  * @param   *mode  The mode of the operand and the result.
2350  */
2351 ir_node *new_r_Minus  (ir_graph *irg, ir_node *block,
2352                ir_node *op,  ir_mode *mode);
2353
2354 /** Constructor for a Mul node.
2355  *
2356  * @param   *irg   The IR graph the node  belongs to.
2357  * @param   *block The IR block the node belongs to.
2358  * @param   *op1   The first operand.
2359  * @param   *op2   The second operand.
2360  * @param   *mode  The mode of the operands and the result.
2361  */
2362 ir_node *new_r_Mul    (ir_graph *irg, ir_node *block,
2363                ir_node *op1, ir_node *op2, ir_mode *mode);
2364
2365 /** Constructor for a Mulh 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_Mulh   (ir_graph *irg, ir_node *block,
2374                ir_node *op1, ir_node *op2, ir_mode *mode);
2375
2376 /** Constructor for a Quot node.
2377  *
2378  * @param   *irg   The IR graph the node  belongs to.
2379  * @param   *block The IR block the node belongs to.
2380  * @param   *memop The store needed to model exceptions
2381  * @param   *op1   The first operand.
2382  * @param   *op2   The second operand.
2383  * @param   *mode  The mode of the result.
2384  * @param   state  The pinned state.
2385  */
2386 ir_node *new_r_Quot   (ir_graph *irg, ir_node *block,
2387                ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2388
2389 /** Constructor for a DivMod node.
2390  *
2391  * @param   *irg   The IR graph the node  belongs to.
2392  * @param   *block The IR block the node belongs to.
2393  * @param   *memop The store needed to model exceptions
2394  * @param   *op1   The first operand.
2395  * @param   *op2   The second operand.
2396  * @param   *mode  The mode of the results.
2397  * @param   state  The pinned state.
2398  */
2399 ir_node *new_r_DivMod (ir_graph *irg, ir_node *block,
2400                ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2401
2402 /** Constructor for a Div node.
2403  *
2404  * @param   *irg   The IR graph the node  belongs to.
2405  * @param   *block The IR block the node belongs to.
2406  * @param   *memop The store needed to model exceptions
2407  * @param   *op1   The first operand.
2408  * @param   *op2   The second operand.
2409  * @param   *mode  The mode of the result.
2410  * @param   state  The pinned state.
2411  */
2412 ir_node *new_r_Div    (ir_graph *irg, ir_node *block,
2413                ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2414
2415 /** Constructor for a remainderless Div node.
2416  *
2417  * @param   *irg   The IR graph the node  belongs to.
2418  * @param   *block The IR block the node belongs to.
2419  * @param   *memop The store needed to model exceptions
2420  * @param   *op1   The first operand.
2421  * @param   *op2   The second operand.
2422  * @param   *mode  The mode of the result.
2423  * @param   state  The pinned state.
2424  */
2425 ir_node *new_r_DivRL  (ir_graph *irg, ir_node *block,
2426                ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2427
2428 /** Constructor for a Mod node.
2429  *
2430  * @param   *irg   The IR graph the node  belongs to.
2431  * @param   *block The IR block the node belongs to.
2432  * @param   *memop The store needed to model exceptions
2433  * @param   *op1   The first operand.
2434  * @param   *op2   The second operand.
2435  * @param   *mode  The mode of the result.
2436  * @param   state  The pinned state.
2437  */
2438 ir_node *new_r_Mod    (ir_graph *irg, ir_node *block,
2439                ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2440
2441 /** Constructor for a Abs node.
2442  *
2443  * @param   *irg   The IR graph the node  belongs to.
2444  * @param   *block The IR block the node belongs to.
2445  * @param   *op    The operand
2446  * @param   *mode  The mode of the operands and the result.
2447  */
2448 ir_node *new_r_Abs    (ir_graph *irg, ir_node *block,
2449                        ir_node *op, ir_mode *mode);
2450
2451 /** Constructor for a And node.
2452  *
2453  * @param   *irg   The IR graph the node  belongs to.
2454  * @param   *block The IR block the node belongs to.
2455  * @param   *op1   The first operand.
2456  * @param   *op2   The second operand.
2457  * @param   *mode  The mode of the operands and the result.
2458  */
2459 ir_node *new_r_And    (ir_graph *irg, ir_node *block,
2460                ir_node *op1, ir_node *op2, ir_mode *mode);
2461
2462 /** Constructor for a Or 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_Or     (ir_graph *irg, ir_node *block,
2471                ir_node *op1, ir_node *op2, ir_mode *mode);
2472
2473 /** Constructor for a Eor 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 results.
2480  */
2481 ir_node *new_r_Eor    (ir_graph *irg, ir_node *block,
2482                ir_node *op1, ir_node *op2, ir_mode *mode);
2483
2484 /** Constructor for a Not node.
2485  *
2486  * @param   *irg   The IR graph the node  belongs to.
2487  * @param   *block The IR block the node belongs to.
2488  * @param   *op    The operand.
2489  * @param   *mode  The mode of the operand and the result.
2490  */
2491 ir_node *new_r_Not    (ir_graph *irg, ir_node *block,
2492                ir_node *op, ir_mode *mode);
2493
2494 /** Constructor for a Cmp node.
2495  *
2496  * @param   *irg   The IR graph the node  belongs to.
2497  * @param   *block The IR block the node belongs to.
2498  * @param   *op1   The first operand.
2499  * @param   *op2   The second operand.
2500  */
2501 ir_node *new_r_Cmp    (ir_graph *irg, ir_node *block,
2502                ir_node *op1, ir_node *op2);
2503
2504 /** Constructor for a Shl node.
2505  *
2506  * @param   *irg   The IR graph the node  belongs to.
2507  * @param   *block The IR block the node belongs to.
2508  * @param   *op    The operand.
2509  * @param   *k     The number of bits to  shift the operand .
2510  * @param   *mode  The mode of the operand and the result.
2511  */
2512 ir_node *new_r_Shl    (ir_graph *irg, ir_node *block,
2513                ir_node *op, ir_node *k, ir_mode *mode);
2514
2515 /** Constructor for a Shr 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_Shr    (ir_graph *irg, ir_node *block,
2524                ir_node *op, ir_node *k, ir_mode *mode);
2525
2526 /**
2527  * Constructor for a Shrs node.
2528  *
2529  * @param   *irg   The IR graph the node  belongs to.
2530  * @param   *block The IR block the node belongs to.
2531  * @param   *op    The operand.
2532  * @param   *k     The number of bits to shift the operand.
2533  * @param   *mode  The mode of the operand and the result.
2534  */
2535 ir_node *new_r_Shrs   (ir_graph *irg, ir_node *block,
2536                ir_node *op, ir_node *k, ir_mode *mode);
2537
2538 /** Constructor for a Rotl 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 rotate the operand.
2544  * @param   *mode  The mode of the operand.
2545  */
2546 ir_node *new_r_Rotl   (ir_graph *irg, ir_node *block,
2547                ir_node *op, ir_node *k, ir_mode *mode);
2548
2549 /** Constructor for a Conv 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   *mode  The mode of this the operand muss be converted .
2555  */
2556 ir_node *new_r_Conv   (ir_graph *irg, ir_node *block,
2557                ir_node *op, ir_mode *mode);
2558
2559 /** Constructor for a Cast node.
2560  *
2561  * High level type cast
2562  *
2563  * @param   *irg   The IR graph the node  belongs to.
2564  * @param   *block The IR block the node belongs to.
2565  * @param   *op    The operand.
2566  * @param   *to_tp The type of this the operand muss be casted .
2567  */
2568 ir_node *new_r_Cast   (ir_graph *irg, ir_node *block,
2569                ir_node *op, ir_type *to_tp);
2570
2571 /** Constructor for a Carry node.
2572  *
2573  * @param   *irg   The IR graph the node  belongs to.
2574  * @param   *block The IR block the node belongs to.
2575  * @param   *op1   The first operand.
2576  * @param   *op2   The second operand.
2577  * @param   *mode  The mode of the operands and the result.
2578  */
2579 ir_node *new_r_Carry  (ir_graph *irg, ir_node *block,
2580                ir_node *op1, ir_node *op2, ir_mode *mode);
2581
2582 /**
2583  * Constructor for a Borrow node.
2584  *
2585  * @param   *irg   The IR graph the node  belongs to.
2586  * @param   *block The IR block the node belongs to.
2587  * @param   *op1   The first operand.
2588  * @param   *op2   The second operand.
2589  * @param   *mode  The mode of the operands and the results.
2590  */
2591 ir_node *new_r_Borrow (ir_graph *irg, ir_node *block,
2592                ir_node *op1, ir_node *op2, ir_mode *mode);
2593
2594 /** Constructor for a Phi node.
2595  *
2596  * @param *irg   The IR graph the node  belongs to.
2597  * @param *block The IR block the node belongs to.
2598  * @param arity  The number of predecessors
2599  * @param *in[]    Array with predecessors. The constructor copies this array.
2600  * @param *mode  The mode of it's inputs and output.
2601  */
2602 ir_node *new_r_Phi    (ir_graph *irg, ir_node *block, int arity,
2603                        ir_node *in[], ir_mode *mode);
2604
2605 /** Constructor for a Load node.
2606  *
2607  * @param *irg   The IR graph the node  belongs to.
2608  * @param *block The IR block the node belongs to.
2609  * @param *store The current memory
2610  * @param *adr   A pointer to the variable to be read in this memory.
2611  * @param *mode  The mode of the value to be loaded.
2612  * @param  flags Additional flags for alignment, volatility and pin state.
2613  */
2614 ir_node *new_r_Load   (ir_graph *irg, ir_node *block,
2615                ir_node *store, ir_node *adr, ir_mode *mode, ir_cons_flags flags);
2616
2617 /** Constructor for a Store node.
2618  *
2619  * @param *irg   The IR graph the node  belongs to.
2620  * @param *block The IR block the node belongs to.
2621  * @param *store The current memory
2622  * @param *adr   A pointer to the variable to be read in this memory.
2623  * @param *val   The value to write to this variable.
2624  * @param  flags Additional flags for alignment, volatility and pin state.
2625  */
2626 ir_node *new_r_Store  (ir_graph *irg, ir_node *block,
2627                        ir_node *store, ir_node *adr, ir_node *val, ir_cons_flags flags);
2628
2629 /** Constructor for a Alloc node.
2630  *
2631  * The Alloc node extends the memory by space for an entity of type alloc_type.
2632  *
2633  * @param *irg        The IR graph the node  belongs to.
2634  * @param *block      The IR block the node belongs to.
2635  * @param *store      The memory which shall contain the new variable.
2636  * @param *size       The number of bytes to allocate.
2637  * @param *alloc_type The type of the allocated variable.
2638  * @param where       Where to allocate the variable, either heap_alloc or stack_alloc.
2639  */
2640 ir_node *new_r_Alloc  (ir_graph *irg, ir_node *block, ir_node *store,
2641                ir_node *size, ir_type *alloc_type, ir_where_alloc where);
2642
2643 /** Constructor for a Free node.
2644  *
2645  * Frees the memory occupied by the entity pointed to by the pointer
2646  * arg.  Type indicates the type of the entity the argument points to.
2647  *
2648  * @param *irg        The IR graph the node  belongs to.
2649  * @param *block      The IR block the node belongs to.
2650  * @param *store      The memory which shall contain the new variable.
2651  * @param *ptr        The pointer to the object to free.
2652  * @param *size       The number of objects of type free_type to free in a sequence.
2653  * @param *free_type  The type of the freed variable.
2654  * @param where       Where the variable was allocated, either heap_alloc or stack_alloc.
2655  */
2656 ir_node *new_r_Free   (ir_graph *irg, ir_node *block, ir_node *store,
2657                ir_node *ptr, ir_node *size, ir_type *free_type, ir_where_alloc where);
2658
2659 /** Constructor for a Sync node.
2660  *
2661  * Merges several memory values.  The node assumes that a variable
2662  * either occurs only in one of the memories, or it contains the same
2663  * value in all memories where it occurs.
2664  *
2665  * @param *irg      The IR graph the node  belongs to.
2666  * @param *block    The IR block the node belongs to.
2667  * @param  arity    The number of memories to synchronize.
2668  * @param  *in[]    An array of pointers to nodes that produce an output of  type memory.
2669  *                  The constructor copies this array.
2670  */
2671 ir_node *new_r_Sync (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2672
2673 /** Constructor for a Proj node.
2674  *
2675  * Projects a single value out of a tuple.  The parameter proj gives the
2676  * position of the value within the tuple.
2677  *
2678  * @param *irg   The IR graph the node  belongs to.
2679  * @param *block The IR block the node belongs to.
2680  * @param arg    A node producing a tuple.
2681  * @param *mode  The mode of the value to project.
2682  * @param proj   The position of the value in the tuple.
2683  */
2684 ir_node *new_r_Proj   (ir_graph *irg, ir_node *block, ir_node *arg,
2685                        ir_mode *mode, long proj);
2686
2687 /** Constructor for a defaultProj node.
2688  *
2689  * Represents the default control flow of a Switch-Cond node.
2690  *
2691  * @param *irg      The IR graph the node  belongs to.
2692  * @param *block    The IR block the node belongs to.
2693  * @param arg       A node producing a tuple.
2694  * @param max_proj  The end  position of the value in the tuple.
2695  */
2696 ir_node *new_r_defaultProj (ir_graph *irg, ir_node *block, ir_node *arg, long max_proj);
2697
2698
2699 /** Constructor for a Tuple node.
2700  *
2701  * This is an auxiliary node to replace a node that returns a tuple
2702  * without changing the corresponding Proj nodes.
2703  *
2704  * @param *irg    The IR graph the node  belongs to.
2705  * @param *block  The IR block the node belongs to.
2706  * @param arity   The number of tuple elements.
2707  * @param *in[]   An array containing pointers to the nodes producing the tuple elements.
2708  *                The constructor copies this array.
2709  */
2710 ir_node *new_r_Tuple  (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2711
2712 /** Constructor for a Id node.
2713  *
2714  * This is an auxiliary node to replace a node that returns a single
2715  * value.
2716  *
2717  * @param *irg    The IR graph the node  belongs to.
2718  * @param *block  The IR block the node belongs to.
2719  * @param *val    The operand to Id.
2720  * @param *mode   The mode of *val.
2721  */
2722 ir_node *new_r_Id     (ir_graph *irg, ir_node *block,
2723                ir_node *val, ir_mode *mode);
2724
2725 /** Constructor for a Bad node.
2726  *
2727  * Returns the unique Bad node of the graph.  The same as
2728  * get_irg_bad().
2729  *
2730  * @param *irg    The IR graph the node  belongs to.
2731  *
2732  */
2733 ir_node *new_r_Bad    (ir_graph *irg);
2734
2735 /** Constructor for a Confirm node.
2736  *
2737  * Specifies constraints for a value.  To support dataflow analyses.
2738  *
2739  * Example: If the value never exceeds '100' this is expressed by placing a
2740  * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
2741  *
2742  * @param *irg    The IR graph the node belong to.
2743  * @param *block  The IR block the node belong to.
2744  * @param *val    The value we express a constraint for
2745  * @param *bound  The value to compare against. Must be a firm node, typically a constant.
2746  * @param cmp     The compare operation.
2747  */
2748 ir_node *new_r_Confirm(ir_graph *irg, ir_node *block,
2749             ir_node *val, ir_node *bound, pn_Cmp cmp);
2750
2751 /** Constructor for a Unknown node.
2752  *
2753  * Represents an arbitrary value.  Places the node in
2754  * the start block.
2755  *
2756  * @param *irg    The IR graph the node  belongs to.
2757  * @param *m      The mode of the unknown value.
2758  */
2759 ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2760
2761 /** Constructor for a CallBegin node.
2762  *
2763  * CallBegin represents control flow depending of the pointer value
2764  * representing the called method to the called methods.  The
2765  * constructor copies the method pointer input from the passed Call
2766  * node.
2767  *
2768  * @param *irg    The IR graph the node belong to.
2769  * @param *block  The block the node belong to.
2770  * @param *callee The call node visible in the  intra procedural view.
2771  */
2772 ir_node *new_r_CallBegin(ir_graph *irg, ir_node *block, ir_node *callee);
2773
2774 /** Constructor for a EndReg node.
2775  *
2776  * Used to represent regular procedure end in interprocedual view.
2777  *
2778  * @param *irg    The IR graph the node belong to.
2779  * @param *block  The block the node belong to.
2780  */
2781 ir_node *new_r_EndReg (ir_graph *irg, ir_node *block);
2782
2783 /** Constructor for a EndExcept node.
2784  *
2785  * Used to represent exceptional procedure end in interprocedural view.
2786  *
2787  * @param *irg    The IR graph the node belong to.
2788  * @param *block  The block the node belong to.
2789  */
2790 ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
2791
2792 /** Constructor for a Break node.
2793  *
2794  * Break represents control flow to a single control successor just as Jmp.
2795  * The blocks separated by a break may not be concatenated by an optimization.
2796  * It is used for the interprocedural representation where blocks are parted
2797  * behind Call nodes to represent the control flow to called procedures.
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_Break  (ir_graph *irg, ir_node *block);
2803
2804 /** Constructor for a Filter node.
2805  *
2806  * Constructor for a Filter node. Adds the node to the block in current_ir_block.
2807  * Filter is a node with two views used to construct the interprocedural view.
2808  * In intraprocedural view its semantics are identical to the Proj node.
2809  * In interprocedural view the Filter performs the Phi operation on method
2810  * parameters or results.  Other than a Phi a Filter node may not be removed
2811  * if it has only a single input.
2812  *
2813  * The constructor builds the Filter in intraprocedural view.
2814  *
2815  * @param *irg    The IR graph the node belong to.
2816  * @param *block  The block the node belong to.
2817  * @param *arg  The tuple value to project from.
2818  * @param *mode The mode of the projected value.
2819  * @param proj  The position in the tuple to project from.
2820  */
2821 ir_node *new_r_Filter (ir_graph *irg, ir_node *block, ir_node *arg,
2822                ir_mode *mode, long proj);
2823
2824 /** Constructor for a NoMem node.
2825  *
2826  * Returns the unique NoMem node of the graph.  The same as
2827  * get_irg_no_mem().
2828  *
2829  * @param *irg    The IR graph the node belongs to.
2830  */
2831 ir_node *new_r_NoMem  (ir_graph *irg);
2832
2833 /** Constructor for a Mux node.
2834  *
2835  * @param *irg      The IR graph the node belong to.
2836  * @param *block    The block the node belong to.
2837  * @param *sel      The ir_node that calculates the boolean select.
2838  * @param *ir_true  The ir_node that calculates the true result.
2839  * @param *ir_false The ir_node that calculates the false result.
2840  * @param *mode     The mode of the node (and it_true and ir_false).
2841  */
2842 ir_node *new_r_Mux  (ir_graph *irg, ir_node *block,
2843     ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2844
2845 /** Constructor for a CopyB node.
2846  *
2847  * @param *irg        The IR graph the node belong to.
2848  * @param *block      The block the node belong to.
2849  * @param *store      The current memory
2850  * @param *dst        The ir_node that represents the destination address.
2851  * @param *src        The ir_node that represents the source address.
2852  * @param *data_type  The type of the copied data
2853  */
2854 ir_node *new_r_CopyB(ir_graph *irg, ir_node *block,
2855     ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
2856
2857 /** Constructor for a InstOf node.
2858  *
2859  * A High-Level Type check.
2860  *
2861  * @param   *irg       The IR graph the node  belongs to.
2862  * @param   *block     The IR block the node belongs to.
2863  * @param   *store     The memory in which the object the entity should be selected
2864  *                     from is allocated.
2865  * @param   *objptr    A pointer to a object of a class type.
2866  * @param   *type      The type of which objptr must be.
2867  */
2868 ir_node *new_r_InstOf(ir_graph *irg, ir_node *block, ir_node *store,
2869                       ir_node *objptr, ir_type *type);
2870
2871 /** Constructor for a Raise node.
2872  *
2873  * A High-Level Exception throw.
2874  *
2875  * @param *irg   The IR graph the node  belongs to.
2876  * @param *block The IR block the node belongs to.
2877  * @param *store The current memory.
2878  * @param *obj   A pointer to the Except variable.
2879  */
2880 ir_node *new_r_Raise(ir_graph *irg, ir_node *block,
2881                      ir_node *store, ir_node *obj);
2882
2883 /** Constructor for a Bound node.
2884  *
2885  * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2886  *
2887  * @param *irg        The IR graph the node belong to.
2888  * @param *block      The block the node belong to.
2889  * @param *store      The current memory.
2890  * @param *idx        The ir_node that represents an index.
2891  * @param *lower      The ir_node that represents the lower bound for the index.
2892  * @param *upper      The ir_node that represents the upper bound for the index.
2893  */
2894 ir_node *new_r_Bound(ir_graph *irg, ir_node *block,
2895     ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
2896
2897 /** Constructor for a Pin node.
2898  *
2899  * @param *irg        The IR graph the node belong to.
2900  * @param *block      The block the node belong to.
2901  * @param *node       The node which value should be pinned.
2902  */
2903 ir_node *new_r_Pin(ir_graph *irg, ir_node *block, ir_node *node);
2904
2905 /** Constructor for an ASM pseudo node.
2906  *
2907  * @param *irg        The IR graph the node belong to.
2908  * @param *block      The block the node belong to.
2909  * @param arity       The number of data inputs to the node.
2910  * @param *in         The array of length arity of data inputs.
2911  * @param *inputs     The array of length arity of input constraints.
2912  * @param n_outs      The number of data outputs to the node.
2913  * @param *outputs    The array of length n_outs of output constraints.
2914  * @param n_clobber   The number of clobbered registers.
2915  * @param *clobber    The array of length n_clobber of clobbered registers.
2916  * @param *asm_text   The assembler text.
2917  */
2918 ir_node *new_r_ASM(ir_graph *irg, ir_node *block,
2919                    int arity, ir_node *in[], ir_asm_constraint *inputs,
2920                    int n_outs, ir_asm_constraint *outputs,
2921                    int n_clobber, ident *clobber[], ident *asm_text);
2922
2923 /*-----------------------------------------------------------------------*/
2924 /* The block oriented interface                                          */
2925 /*-----------------------------------------------------------------------*/
2926
2927 /** Sets the current block in which the following constructors place the
2928  *  nodes they construct.
2929  *
2930  *  @param target  The new current block.
2931  */
2932 void     set_cur_block (ir_node *target);
2933
2934 /** Returns the current block of the current graph. */
2935 ir_node *get_cur_block(void);
2936
2937 /** Returns the fixed nodes  of the current graph. */
2938 #define get_cur_end_block()   get_irg_end_block(current_ir_graph)
2939 #define get_cur_end()         get_irg_end(current_ir_graph)
2940 #define get_cur_start_block() get_irg_start_block(current_ir_graph)
2941 #define get_cur_start()       get_irg_start(current_ir_graph)
2942
2943 /** Constructor for a Block node.
2944  *
2945  * Adds the block to the graph in current_ir_graph. Constructs a Block
2946  * with a fixed number of predecessors.  Does set current_block.  Can
2947  * be used with automatic Phi node construction.
2948  *
2949  * @param *db    A Pointer for debug information.
2950  * @param arity  The number of control predecessors.
2951  * @param in[]   An array of control predecessors.  The length of
2952  *               the array must be 'arity'.
2953  */
2954 ir_node *new_d_Block(dbg_info *db, int arity, ir_node *in[]);
2955
2956 /** Constructor for a Start node.
2957  *
2958  * Adds the node to the block in current_ir_block.
2959  *
2960  * @param *db    A pointer for debug information.
2961  */
2962 ir_node *new_d_Start  (dbg_info *db);
2963
2964 /** Constructor for a End node.
2965  *
2966  * Adds the node to the block in current_ir_block.
2967  *
2968  * @param *db     A pointer for debug information.
2969  */
2970 ir_node *new_d_End    (dbg_info *db);
2971
2972 /** Constructor for a Jmp node.
2973  *
2974  * Adds the node to the block in current_ir_block.
2975  *
2976  * Jmp represents control flow to a single control successor.
2977  *
2978  * @param *db     A pointer for debug information.
2979  */
2980 ir_node *new_d_Jmp    (dbg_info *db);
2981
2982 /** Constructor for an IJmp node.
2983  *
2984  * IJmp represents control flow to a single control successor not
2985  * statically known i.e. an indirect Jmp.
2986  *
2987  * @param *db     A pointer for debug information.
2988  * @param *tgt    The IR node representing the target address.
2989  */
2990 ir_node *new_d_IJmp   (dbg_info *db, ir_node *tgt);
2991
2992 /** Constructor for a Cond node.
2993  *
2994  * Adds the node to the block in current_ir_block.
2995  *
2996  * If c is mode_b represents a conditional branch (if/else). If c is
2997  * mode_Is/mode_Iu (?) represents a switch.  (Allocates dense Cond
2998  * node, default Proj is 0.)
2999  *
3000  * This is not consistent:  Input to Cond is Is, Proj has as proj number
3001  * longs.
3002  *
3003  * @param *db    A pointer for debug information.
3004  * @param *c     The conditions parameter.Can be of mode b or I_u.
3005  */
3006 ir_node *new_d_Cond   (dbg_info *db, ir_node *c);
3007
3008 /** Constructor for a Return node.
3009  *
3010  * Adds the node to the block in current_ir_block.
3011  *
3012  * Returns the memory and zero or more return values.  Only node that
3013  * can end regular control flow.
3014  *
3015  * @param *db    A pointer for debug information.
3016  * @param *store The state of memory.
3017  * @param arity  Number of array indices.
3018  * @param *in    Array with index inputs to the node.
3019  */
3020 ir_node *new_d_Return (dbg_info *db, ir_node *store, int arity, ir_node *in[]);
3021
3022 /** Constructor for a Const_type node.
3023  *
3024  * Adds the node to the start block.
3025  *
3026  * The constant represents a target value.  This constructor sets high
3027  * level type information for the constant value.
3028  * Derives mode from passed tarval.
3029  *
3030  * @param *db    A pointer for debug information.
3031  * @param *con   Points to an entry in the constant table. This pointer is
3032                  added to the attributes of the node.
3033  * @param *tp    The type of the constant.
3034  */
3035 ir_node *new_d_Const_type (dbg_info *db, tarval *con, ir_type *tp);
3036
3037 /** Constructor for a Const node.
3038  *
3039  * Adds the node to the block in current_ir_block.
3040  *
3041  * Constructor for a Const node. The constant represents a target
3042  * value.  Sets the type information to type_unknown.  (No more
3043  * supported: If tv is entity derives a somehow useful type.)
3044  * Derives mode from passed tarval.
3045  *
3046  * @param *db    A pointer for debug information.
3047  * @param *con   Points to an entry in the constant table. This pointer is added
3048  *               to the attributes of the node.
3049  */
3050 ir_node *new_d_Const  (dbg_info *db, tarval *con);
3051
3052 /** Constructor for a SymConst_type node.
3053  *
3054  *  Adds the node to the block in current_ir_block.
3055  *  This is the constructor for a symbolic constant.
3056  *    There are four kinds of symbolic constants:
3057  *    - type_tag  The symbolic constant represents a type tag.  The type the
3058  *                tag stands for is given explicitly.
3059  *    - size      The symbolic constant represents the size of a type.  The
3060  *                type of which the constant represents the size is given
3061  *                explicitly.
3062  *    - addr_name The symbolic constant represents the address of an entity
3063  *                (variable or method).  The variable is indicated by a name
3064  *                that is valid for linking.
3065  *    - addr_ent   The symbolic constant represents the address of an entity
3066  *                (variable or method).  The variable is given explicitly by
3067  *                a firm entity.
3068  *
3069  *    Inputs to the node:
3070  *      No inputs except the block it belongs to.
3071  *    Outputs of the node.
3072  *      An unsigned integer (I_u) or a pointer (P).
3073  *
3074  * @param *db     A pointer for debug information.
3075  * @param mode    The mode for the SymConst.
3076  * @param value   A type, entity or ident depending on the SymConst kind.
3077  * @param kind    The kind of the symbolic constant: symconst_type_tag, symconst_type_size,
3078  *                symconst_type_align, symconst_addr_name or symconst_addr_ent.
3079  * @param tp      The source type of the constant.
3080  */
3081 ir_node *new_d_SymConst_type(dbg_info *db, ir_mode *mode,
3082                              union symconst_symbol value, symconst_kind kind, ir_type *tp);
3083
3084 /** Constructor for a SymConst node.
3085  *
3086  *  Same as new_d_SymConst_type, except that it sets the type to type_unknown.
3087  */
3088 ir_node *new_d_SymConst(dbg_info *db, ir_mode *mode,
3089                         union symconst_symbol value, symconst_kind kind);
3090
3091 /** Constructor for a simpleSel node.
3092  *
3093  *  This is a shortcut for the new_d_Sel() constructor.  To be used for
3094  *  Sel nodes that do not select from an array, i.e., have no index
3095  *  inputs.  It adds the two parameters 0, NULL.
3096  *
3097  * @param   *db        A pointer for debug information.
3098  * @param   *store     The memory in which the object the entity should be
3099  *                     selected from is allocated.
3100  * @param   *objptr    The object from that the Sel operation selects a
3101  *                     single attribute out.
3102  * @param   *ent       The entity to select.
3103  */
3104 ir_node *new_d_simpleSel(dbg_info *db, ir_node *store, ir_node *objptr, ir_entity *ent);
3105
3106 /** Constructor for a Sel node.
3107  *
3108  * The select node selects an entity (field or method) from an entity
3109  * with a compound type.  It explicitly specifies the entity selected.
3110  * Dynamically the node may select entities that overwrite the given
3111  * entity.  If the selected entity is an array element entity the Sel
3112  * node takes the required array indices as inputs.
3113  * Adds the node to the block in current_ir_block.
3114  *
3115  * @param   *db        A pointer for debug information.
3116  * @param   *store     The memory in which the object the entity should be selected
3117  *                     from is allocated.
3118  * @param   *objptr    A pointer to a compound entity the Sel operation selects a
3119  *                     single attribute from.
3120  * @param   arity      The number of array indices needed to select an array element entity.
3121  * @param   *in[]      If the compound entity is an array the indices of the selected
3122  *                     element entity.  The constructor copies this array.
3123  * @param   *ent       The entity to select.
3124  */
3125 ir_node *new_d_Sel    (dbg_info *db, ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3126                        ir_entity *ent);
3127
3128 /** Constructor for a Call node.
3129  *
3130  * Represents all kinds of method and function calls.
3131  * Adds the node to the block in current_ir_block.
3132  *
3133  * @param   *db     A pointer for debug information.
3134  * @param   *store  The actual store.
3135  * @param   *callee A pointer to the called procedure.
3136  * @param   arity   The number of procedure parameters.
3137  * @param   *in[]   An array with the pointers to the parameters. The constructor copies this array.
3138  * @param   *tp     Type information of the procedure called.
3139  */
3140 ir_node *new_d_Call   (dbg_info *db, ir_node *store, ir_node *callee, int arity, ir_node *in[],
3141                        ir_type *tp);
3142
3143 /** Constructor for a Builtin node.
3144  *
3145  * Represents a call of a backend-specific builtin..
3146  * Adds the node to the block in current_ir_block.
3147  *
3148  * @param   *db     A pointer for debug information.
3149  * @param   *store  The actual store.
3150  * @param   kind    The kind of the called builtin.
3151  * @param   arity   The number of procedure parameters.
3152  * @param   *in[]   An array with the pointers to the parameters. The constructor copies this array.
3153  * @param   *tp     Type information of the procedure called.
3154  */
3155 ir_node *new_d_Builtin(dbg_info *db, ir_node *store, ir_builtin_kind kind, int arity, ir_node *in[],
3156                        ir_type *tp);
3157
3158 /** Constructor for a Add node.
3159  *
3160  * Adds the node to the block in current_ir_block.
3161  *
3162  * @param   *db    A pointer for debug information.
3163  * @param   *op1   The first operand.
3164  * @param   *op2   The second operand.
3165  * @param   *mode  The mode of the operands and the result.
3166  */
3167 ir_node *new_d_Add    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3168
3169 /** Constructor for a Sub node.
3170  *
3171  * Adds the node to the block in current_ir_block.
3172  *
3173  * @param   *db    A pointer for debug information.
3174  * @param   *op1   The first operand.
3175  * @param   *op2   The second operand.
3176  * @param   *mode  The mode of the operands and the result.
3177  */
3178 ir_node *new_d_Sub    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3179
3180 /** Constructor for a Minus node.
3181  *
3182  * Adds the node to the block in current_ir_block.
3183  *
3184  * @param   *db    A pointer for debug information.
3185  * @param   *op    The operand .
3186  * @param   *mode  The mode of the operand and the result.
3187  */
3188 ir_node *new_d_Minus  (dbg_info *db, ir_node *op,  ir_mode *mode);
3189
3190 /** Constructor for a Mul node.
3191  *
3192  * Adds the node to the block in current_ir_block.
3193  *
3194  * @param   *db    A pointer for debug information.
3195  * @param   *op1   The first operand.
3196  * @param   *op2   The second operand.
3197  * @param   *mode  The mode of the operands and the result.
3198  */
3199 ir_node *new_d_Mul    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3200
3201 /** Constructor for a Mulh node.
3202  *
3203  * Adds the node to the block in current_ir_block.
3204  *
3205  * @param   *db    A pointer for debug information.
3206  * @param   *op1   The first operand.
3207  * @param   *op2   The second operand.
3208  * @param   *mode  The mode of the operands and the result.
3209  */
3210 ir_node *new_d_Mulh   (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3211
3212 /** Constructor for a Quot node.
3213  *
3214  * Adds the node to the block in current_ir_block.
3215  *
3216  * @param   *db    A pointer for debug information.
3217  * @param   *memop The store needed to model exceptions
3218  * @param   *op1   The first operand.
3219  * @param   *op2   The second operand.
3220  * @param   *mode  The mode of the result.
3221  * @param   state  The pinned state.
3222  */
3223 ir_node *new_d_Quot   (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3224
3225 /** Constructor for a DivMod node.
3226  *
3227  * Adds the node to the block in current_ir_block.
3228  *
3229  * @param   *db    A pointer for debug information.
3230  * @param   *memop The store needed to model exceptions
3231  * @param   *op1   The first operand.
3232  * @param   *op2   The second operand.
3233  * @param   *mode  The mode of the results.
3234  * @param   state  The pinned state.
3235  */
3236 ir_node *new_d_DivMod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3237
3238 /** Constructor for a Div node.
3239  *
3240  * Adds the node to the block in current_ir_block.
3241  *
3242  * @param   *db    A pointer for debug information.
3243  * @param   *memop The store needed to model exceptions
3244  * @param   *op1   The first operand.
3245  * @param   *op2   The second operand.
3246  * @param   *mode  The mode of the result.
3247  * @param   state  The pinned state.
3248  */
3249 ir_node *new_d_Div    (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3250
3251 /** Constructor for a remainderless Div node.
3252  *
3253  * Adds the node to the block in current_ir_block.
3254  *
3255  * @param   *db    A pointer for debug information.
3256  * @param   *memop The store needed to model exceptions
3257  * @param   *op1   The first operand.
3258  * @param   *op2   The second operand.
3259  * @param   *mode  The mode of the result.
3260  * @param   state  The pinned state.
3261  */
3262 ir_node *new_d_DivRL  (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3263
3264 /** Constructor for a Mod node.
3265  *
3266  * Adds the node to the block in current_ir_block.
3267  *
3268  * @param   *db    A pointer for debug information.
3269  * @param   *memop The store needed to model exceptions
3270  * @param   *op1   The first operand.
3271  * @param   *op2   The second operand.
3272  * @param   *mode  The mode of the result.
3273  * @param   state  The pinned state.
3274  */
3275 ir_node *new_d_Mod    (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3276
3277 /** Constructor for a Abs node.
3278  *
3279  * Adds the node to the block in current_ir_block.
3280  *
3281  * @param   *db    A pointer for debug information.
3282  * @param   *op    The operand
3283  * @param   *mode  The mode of the operands and the result.
3284  */
3285 ir_node *new_d_Abs    (dbg_info *db, ir_node *op,                ir_mode *mode);
3286
3287 /** Constructor for a And node.
3288  *
3289  * Adds the node to the block in current_ir_block.
3290  *
3291  * @param   *db    A pointer for debug information.
3292  * @param   *op1   The first operand.
3293  * @param   *op2   The second operand.
3294  * @param   *mode  The mode of the operands and the result.
3295  */
3296 ir_node *new_d_And    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3297
3298 /** Constructor for a Or node.
3299  *
3300  * Adds the node to the block in current_ir_block.
3301  *
3302  * @param   *db    A pointer for debug information.
3303  * @param   *op1   The first operand.
3304  * @param   *op2   The second operand.
3305  * @param   *mode  The mode of the operands and the result.
3306  */
3307 ir_node *new_d_Or     (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3308
3309 /** Constructor for a Eor node.
3310  *
3311  * Adds the node to the block in current_ir_block.
3312  *
3313  * @param   *db    A pointer for debug information.
3314  * @param   *op1   The first operand.
3315  * @param   *op2   The second operand.
3316  * @param   *mode  The mode of the operands and the results.
3317  */
3318 ir_node *new_d_Eor    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3319
3320 /** Constructor for a Not node.
3321  *
3322  * Adds the node to the block in current_ir_block.
3323  *
3324  * @param   *db    A pointer for debug information.
3325  * @param   *op    The operand.
3326  * @param   *mode  The mode of the operand and the result.
3327  */
3328 ir_node *new_d_Not    (dbg_info *db, ir_node *op,                ir_mode *mode);
3329
3330 /** Constructor for a Shl node.
3331  *
3332  * Adds the node to the block in current_ir_block.
3333  *
3334  * @param   *db    A pointer for debug information.
3335  * @param   *op    The operand.
3336  * @param   *k     The number of bits to  shift the operand .
3337  * @param   *mode  The mode of the operand and the result.
3338  */
3339 ir_node *new_d_Shl    (dbg_info *db, ir_node *op,  ir_node *k,   ir_mode *mode);
3340
3341 /** Constructor for a Shr node.
3342  *
3343  * Adds the node to the block in current_ir_block.
3344  *
3345  * @param   *db    A pointer for debug information.
3346  * @param   *op    The operand.
3347  * @param   *k     The number of bits to  shift the operand .
3348  * @param   *mode  The mode of the operand and the result.
3349  */
3350 ir_node *new_d_Shr    (dbg_info *db, ir_node *op,  ir_node *k,   ir_mode *mode);
3351
3352 /** Constructor for a Shrs node.
3353  *
3354  * Adds the node to the block in current_ir_block.
3355  *
3356  * @param   *db    A pointer for debug information.
3357  * @param   *op    The operand.
3358  * @param   *k     The number of bits to  shift the operand .
3359  * @param   *mode  The mode of the operand and the result.
3360  */
3361 ir_node *new_d_Shrs   (dbg_info *db, ir_node *op,  ir_node *k,   ir_mode *mode);
3362
3363 /** Constructor for a Rotl node.
3364  *
3365  * Adds the node to the block in current_ir_block.
3366  *
3367  * @param   *db    A pointer for debug information.
3368  * @param   *op    The operand.
3369  * @param   *k     The number of bits to rotate the operand.
3370  * @param   *mode  The mode of the operand.
3371  */
3372 ir_node *new_d_Rotl   (dbg_info *db, ir_node *op,  ir_node *k,   ir_mode *mode);
3373
3374 /** Constructor for a Cmp node.
3375  *
3376  * Adds the node to the block in current_ir_block.
3377  *
3378  * @param   *db    A pointer for debug information.
3379  * @param   *op1   The first operand.
3380  * @param   *op2   The second operand.
3381  */
3382 ir_node *new_d_Cmp    (dbg_info *db, ir_node *op1, ir_node *op2);
3383
3384 /** Constructor for a Conv node.
3385  *
3386  * Adds the node to the block in current_ir_block.
3387  *
3388  * @param   *db    A pointer for debug information.
3389  * @param   *op    The operand.
3390  * @param   *mode  The mode of this the operand muss be converted .
3391  */
3392 ir_node *new_d_Conv   (dbg_info *db, ir_node *op, ir_mode *mode);
3393
3394 /** Constructor for a strict Conv node.
3395  *
3396  * Adds the node to the block in current_ir_block.
3397  *
3398  * @param   *db    A pointer for debug information.
3399  * @param   *op    The operand.
3400  * @param   *mode  The mode of this the operand muss be converted .
3401  */
3402 ir_node *new_d_strictConv   (dbg_info *db, ir_node *op, ir_mode *mode);
3403
3404 /** Constructor for a Cast node.
3405  *
3406  * High level type cast
3407  * Adds the node to the block in current_ir_block.
3408  *
3409  * @param   *db    A pointer for debug information.
3410  * @param   *op    The operand.
3411  * @param   *to_tp The type of this the operand muss be casted .
3412  */
3413 ir_node *new_d_Cast   (dbg_info *db, ir_node *op, ir_type *to_tp);
3414
3415 /** Constructor for a Carry node.
3416  *
3417  * Adds the node to the block in current_ir_block.
3418  *
3419  * @param   *db    A pointer for debug information.
3420  * @param   *op1   The first operand.
3421  * @param   *op2   The second operand.
3422  * @param   *mode  The mode of the operands and the result.
3423  */
3424 ir_node *new_d_Carry  (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3425
3426 /** Constructor for a Borrow node.
3427  *
3428  * Adds the node to the block in current_ir_block.
3429  *
3430  * @param   *db    A pointer for debug information.
3431  * @param   *op1   The first operand.
3432  * @param   *op2   The second operand.
3433  * @param   *mode  The mode of the operands and the result.
3434  */
3435 ir_node *new_d_Borrow (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3436
3437 /** Constructor for a Phi node.
3438  *
3439  * Adds the node to the block in current_ir_block.
3440  *
3441  * @param *db    A pointer for debug information.
3442  * @param arity  The number of predecessors
3443  * @param *in    Array with predecessors
3444  * @param *mode  The mode of it's inputs and output.
3445  */
3446 ir_node *new_d_Phi    (dbg_info *db, int arity, ir_node *in[], ir_mode *mode);
3447
3448 /** Constructor for a Load node.
3449  *
3450  * Adds the node to the block in current_ir_block.
3451  *
3452  * @param *db    A pointer for debug information.
3453  * @param *store The current memory
3454  * @param *addr  A pointer to the variable to be read in this memory.
3455  * @param *mode  The mode of the value to be loaded.
3456  * @param  flags Additional flags for alignment, volatility and pin state.
3457  */
3458 ir_node *new_d_Load(dbg_info *db, ir_node *store, ir_node *addr, ir_mode *mode, ir_cons_flags flags);
3459
3460 /** Constructor for a Store node.
3461  *
3462  * Adds the node to the block in current_ir_block.
3463  *
3464  * @param *db    A pointer for debug information.
3465  * @param *store The current memory
3466  * @param *addr  A pointer to the variable to be read in this memory.
3467  * @param *val   The value to write to this variable.
3468  * @param  flags Additional flags for alignment, volatility and pin state.
3469  */
3470 ir_node *new_d_Store(dbg_info *db, ir_node *store, ir_node *addr, ir_node *val, ir_cons_flags flags);
3471
3472 /** Constructor for a Alloc node.
3473  *
3474  * The Alloc node extends the memory by space for an entity of type alloc_type.
3475  * Adds the node to the block in current_ir_block.
3476  *
3477  * @param *db         A pointer for debug information.
3478  * @param *store      The memory which shall contain the new variable.
3479  * @param *size       The number of bytes to allocate.
3480  * @param *alloc_type The type of the allocated variable.
3481  * @param where       Where to allocate the variable, either heap_alloc or stack_alloc.
3482  */
3483 ir_node *new_d_Alloc  (dbg_info *db, ir_node *store, ir_node *size, ir_type *alloc_type,
3484                        ir_where_alloc where);
3485
3486  /** Constructor for a Free node.
3487  *
3488  * Frees the memory occupied by the entity pointed to by the pointer
3489  * arg.  Type indicates the type of the entity the argument points to.
3490  * Adds the node to the block in current_ir_block.
3491  *
3492  * @param *db         A pointer for debug information.
3493  * @param *store      The memory which shall contain the new variable.
3494  * @param *ptr        The pointer to the object to free.
3495  * @param *size       The number of objects of type free_type to free in a sequence.
3496  * @param *free_type  The type of the freed variable.
3497  * @param where       Where the variable was allocated, either heap_alloc or stack_alloc.
3498  */
3499 ir_node *new_d_Free   (dbg_info *db, ir_node *store, ir_node *ptr, ir_node *size,
3500              ir_type *free_type, ir_where_alloc where);
3501
3502 /** Constructor for a Sync node.
3503  *
3504  * Merges several memory values.  The node assumes that a variable
3505  * either occurs only in one of the memories, or it contains the same
3506  * value in all memories where it occurs.
3507  * Adds the node to the block in current_ir_block.
3508  *
3509  * @param *db       A pointer for debug information.
3510  * @param  arity    The number of memories to synchronize.
3511  * @param  **in     An array of pointers to nodes that produce an output of type
3512  *                  memory.  The constructor copies this array.
3513  */
3514 ir_node *new_d_Sync   (dbg_info *db, int arity, ir_node *in[]);
3515
3516 /** Constructor for a Proj node.
3517  *
3518  * Projects a single value out of a tuple.  The parameter proj gives the
3519  * position of the value within the tuple.
3520  * Adds the node to the block in current_ir_block.
3521  *
3522  * @param *db    A pointer for deubug information.
3523  * @param arg    A node producing a tuple.
3524  * @param *mode  The mode of the value to project.
3525  * @param proj   The position of the value in the tuple.
3526  */
3527 ir_node *new_d_Proj   (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3528
3529 /** Constructor for a defaultProj node.
3530  *
3531  * Represents the default control flow of a Switch-Cond node.
3532  * Adds the node to the block in current_ir_block.
3533  *
3534  * @param *db       A pointer for debug information.
3535  * @param arg       A node producing a tuple.
3536  * @param max_proj  The end  position of the value in the tuple.
3537  */
3538 ir_node *new_d_defaultProj (dbg_info *db, ir_node *arg, long max_proj);
3539
3540 /** Constructor for a Tuple node.
3541  *
3542  * This is an auxiliary node to replace a node that returns a tuple
3543  * without changing the corresponding Proj nodes.
3544  * Adds the node to the block in current_ir_block.
3545  *
3546  * @param *db     A pointer for debug information.
3547  * @param arity   The number of tuple elements.
3548  * @param **in    An array containing pointers to the nodes producing the tuple elements.
3549  */
3550 ir_node *new_d_Tuple  (dbg_info *db, int arity, ir_node *in[]);
3551
3552 /** Constructor for a Id node.
3553  *
3554  * This is an auxiliary node to replace a node that returns a single
3555  * value. Adds the node to the block in current_ir_block.
3556  *
3557  * @param *db     A pointer for debug information.
3558  * @param *val    The operand to Id.
3559  * @param *mode   The mode of *val.
3560  */
3561 ir_node *new_d_Id     (dbg_info *db, ir_node *val, ir_mode *mode);
3562
3563 /** Constructor for a Confirm node.
3564  *
3565  * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3566  * Specifies constraints for a value.  To support dataflow analyses.
3567  *
3568  * Example: If the value never exceeds '100' this is expressed by placing a
3569  * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
3570  *
3571  * @param *db     A pointer for debug information.
3572  * @param *val    The value we express a constraint for
3573  * @param *bound  The value to compare against. Must be a firm node, typically a constant.
3574  * @param cmp     The compare operation.
3575  */
3576 ir_node *new_d_Confirm (dbg_info *db, ir_node *val, ir_node *bound, pn_Cmp cmp);
3577
3578 /** Constructor for an Unknown node.
3579  *
3580  * Represents an arbitrary value.  Places the node in
3581  * the start block.
3582  *
3583  * @param *m      The mode of the unknown value.
3584  */
3585 ir_node *new_d_Unknown(ir_mode *m);
3586
3587 /** Constructor for a CallBegin node.
3588  *
3589  * CallBegin represents control flow depending of the pointer value
3590  * representing the called method to the called methods.  The
3591  * constructor copies the method pointer input from the passed Call
3592  * node.Adds the node to the block in current_ir_block.
3593  *
3594  * @param *db     A pointer for debug information.
3595  * @param *callee The call node visible in the  intra procedural view.
3596  */
3597 ir_node *new_d_CallBegin(dbg_info *db, ir_node *callee);
3598
3599 /** Constructor for an EndReg node.
3600  *
3601  *Adds the node to the block in current_ir_block.
3602  *
3603  * @param *db     A pointer for debug information.
3604  */
3605 ir_node *new_d_EndReg (dbg_info *db);
3606
3607 /** Constructor for an EndExcept node.
3608  *
3609  * Used to represent regular procedure end in interprocedual view.
3610  * Adds the node to the block in current_ir_block.
3611  *
3612  * @param *db     A pointer for debug information.
3613  */
3614 ir_node *new_d_EndExcept(dbg_info *db);
3615
3616 /** Constructor for a Break node.
3617  *
3618  * Used to represent exceptional procedure end in interprocedural view.
3619  * Adds the node to the block in current_ir_block.
3620  *
3621  * Break represents control flow to a single control successor just as Jmp.
3622  * The blocks separated by a break may not be concatenated by an optimization.
3623  * It is used for the interprocedural representation where blocks are parted
3624  * behind Call nodes to represent the control flow to called procedures.
3625  *
3626  * @param *db     A pointer for debug information.
3627  */
3628 ir_node *new_d_Break (dbg_info *db);
3629
3630 /** Constructor for a Filter node.
3631  *
3632  * Constructor for a Filter node. Adds the node to the block in
3633  * current_ir_block.  Filter is a node with two views used to
3634  * construct the interprocedural view.  In intraprocedural view its
3635  * semantics are identical to the Proj node.  In interprocedural view
3636  * the Filter performs the Phi operation on method parameters or
3637  * results.  Other than a Phi a Filter node may not be removed if it
3638  * has only a single input.
3639  *
3640  * The constructor builds the Filter in intraprocedural view.
3641  *
3642  * @param *db   A pointer for debug information.
3643  * @param *arg  The tuple value to project from.
3644  * @param *mode The mode of the projected value.
3645  * @param proj  The position in the tuple to project from.
3646  */
3647 ir_node *new_d_Filter (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3648
3649 /** Constructor for a Mux node.
3650  *
3651  * @param *db       A pointer for debug information.
3652  * @param *sel      The ir_node that calculates the boolean select.
3653  * @param *ir_true  The ir_node that calculates the true result.
3654  * @param *ir_false The ir_node that calculates the false result.
3655  * @param *mode     The mode of the node (and it_true and ir_false).
3656  */
3657 ir_node *new_d_Mux  (dbg_info *db, ir_node *sel,
3658     ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
3659
3660 /** Constructor for a CopyB node.
3661  *
3662  * @param *db         A pointer for debug information.
3663  * @param *store      The current memory
3664  * @param *dst        The ir_node that represents the destination address.
3665  * @param *src        The ir_node that represents the source address.
3666  * @param *data_type  The type of the copied data
3667  */
3668 ir_node *new_d_CopyB(dbg_info *db, ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
3669
3670 /** Constructor for a InstOf node.
3671  *
3672  * A High-Level Type check.
3673  *
3674  * @param   *db        A pointer for debug information.
3675  * @param   *store     The memory in which the object the entity should be selected
3676  *                     from is allocated.
3677  * @param   *objptr    A pointer to a object of a class type.
3678  * @param   *type      The type of which objptr must be.
3679  */
3680 ir_node *new_d_InstOf (dbg_info *db, ir_node *store, ir_node *objptr, ir_type *type);
3681
3682 /** Constructor for a Raise node.
3683  *
3684  * A High-Level Exception throw.
3685  *
3686  * @param *db    A pointer for debug information.
3687  * @param *store The current memory.
3688  * @param *obj   A pointer to the Except variable.
3689  */
3690 ir_node *new_d_Raise  (dbg_info *db, ir_node *store, ir_node *obj);
3691
3692 /** Constructor for a Bound node.
3693  *
3694  * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
3695  *
3696  * @param *db         A pointer for debug information.
3697  * @param *store      The current memory
3698  * @param *idx        The ir_node that represents an index.
3699  * @param *lower      The ir_node that represents the lower bound for the index.
3700  * @param *upper      The ir_node that represents the upper bound for the index.
3701  */
3702 ir_node *new_d_Bound(dbg_info *db, ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
3703
3704 /** Constructor for a Pin node.
3705  *
3706  * @param *db         A pointer for debug information.
3707  * @param *node       The node which value should be pinned.
3708  */
3709 ir_node *new_d_Pin(dbg_info *db, ir_node *node);
3710
3711 /** Constructor for an ASM pseudo node.
3712  *
3713  * @param *db         A pointer for debug information.
3714  * @param arity       The number of data inputs to the node.
3715  * @param *in         The array of length arity of data inputs.
3716  * @param *inputs     The array of length arity of input constraints.
3717  * @param n_outs      The number of data outputs to the node.
3718  * @param *outputs    The array of length n_outs of output constraints.
3719  * @param n_clobber   The number of clobbered registers.
3720  * @param *clobber    The array of length n_clobber of clobbered registers.
3721  * @param *asm_text   The assembler text.
3722  */
3723 ir_node *new_d_ASM(dbg_info *db, int arity, ir_node *in[], ir_asm_constraint *inputs,
3724                    int n_outs, ir_asm_constraint *outputs,
3725                    int n_clobber, ident *clobber[], ident *asm_text);
3726
3727 /*-----------------------------------------------------------------------*/
3728 /* The block oriented interface without debug support                    */
3729 /*-----------------------------------------------------------------------*/
3730
3731 /* Needed from the interface with debug support:
3732 void set_cur_block (ir_node *target);   */
3733
3734 /** Constructor for a Block node.
3735  *
3736  * Constructor for a Block node. Adds the block to the graph in
3737  * current_ir_graph.  Constructs a Block with a fixed number of
3738  * predecessors.  Does set current_block.  Can be used with automatic
3739  * Phi node construction.
3740  *
3741  * @param arity  The number of control predecessors.
3742  * @param in     An array of control predecessors.  The length of
3743  *               the array must be 'arity'.
3744  */
3745 ir_node *new_Block(int arity, ir_node *in[]);
3746
3747 /** Constructor for a Start node.
3748  *
3749  * Adds the node to the block in current_ir_block.
3750  *
3751  */
3752 ir_node *new_Start  (void);
3753
3754 /** Constructor for an End node.
3755  *
3756  * Adds the node to the block in current_ir_block.
3757  */
3758 ir_node *new_End    (void);
3759
3760 /** Constructor for an EndReg node.
3761  *
3762  * Used to represent regular procedure end in interprocedual view.
3763  * Adds the node to the block in current_ir_block.
3764  */
3765 ir_node *new_EndReg (void);
3766
3767 /** Constructor for an EndExpcept node.
3768  *
3769  *  Used to represent exceptional procedure end in interprocedural view.
3770  *  Adds the node to the block in current_ir_block.
3771  */
3772 ir_node *new_EndExcept(void);
3773
3774 /** Constructor for a Jump node.
3775  *
3776  * Adds the node to the block in current_ir_block.
3777  *
3778  * Jmp represents control flow to a single control successor.
3779  */
3780 ir_node *new_Jmp    (void);
3781
3782 /** Constructor for an IJmp node.
3783  *
3784  * IJmp represents control flow to a single control successor not
3785  * statically known i.e. an indirect Jmp.
3786  *
3787  * @param *tgt    The IR node representing the target address.
3788  */
3789 ir_node *new_IJmp   (ir_node *tgt);
3790
3791 /** Constructor for a Break node.
3792  * Break represents control flow to a single control successor just as Jmp.
3793  * The blocks separated by a break may not be concatenated by an optimization.
3794  * It is used for the interprocedural representation where blocks are parted
3795  * behind Call nodes to represent the control flow to called procedures.
3796  * Adds the node to the block in current_ir_block.
3797  */
3798 ir_node *new_Break  (void);
3799
3800 /** Constructor for a Cond node.
3801  *
3802  * If c is mode_b represents a conditional branch (if/else). If c is
3803  * mode_Is/mode_Iu (?) represents a switch.  (Allocates dense Cond
3804  * node, default Proj is 0.). Adds the node to the block in current_ir_block.
3805  *
3806  * This is not consistent:  Input to Cond is Is, Proj has as proj number
3807  * longs.
3808  *
3809  *
3810  * @param *c     The conditions parameter.Can be of mode b or I_u.
3811  */
3812 ir_node *new_Cond   (ir_node *c);
3813
3814 /** Constructor for a Return node.
3815  *
3816  * Returns the memory and zero or more return values.  Only node that
3817  * can end regular control flow. Adds the node to the block in current_ir_block.
3818  *
3819  * @param *store The state of memory.
3820  * @param arity  Number of array indices.
3821  * @param *in    Array with index inputs to the node.
3822  */
3823 ir_node *new_Return (ir_node *store, int arity, ir_node *in[]);
3824
3825 /** Constructor for a Const node.
3826  *
3827  * Constructor for a Const node. The constant represents a target
3828  * value.  Sets the type information to type_unknown.  (No more
3829  * supported: If tv is entity derives a somehow useful type.)
3830  * Adds the node to the block in current_ir_block.
3831  * Derives mode from passed tarval.
3832  *
3833  * @param *con   Points to an entry in the constant table. This pointer is
3834  *               added to the attributes of  the node.
3835  */
3836 ir_node *new_Const (tarval *con);
3837
3838 /**
3839  * Make a const from a long.
3840  * This is just convenience for the usual
3841  * <code>
3842  * new_Const(mode, tarval_from_long(mode, ...))
3843  * </code>
3844  * pain.
3845  * @param mode The mode for the const.
3846  * @param value The value of the constant.
3847  * @return A new const node.
3848  */
3849 ir_node *new_Const_long(ir_mode *mode, long value);
3850
3851 /** Constructor for a Const node.
3852  *
3853  * Derives mode from passed tarval. */
3854 ir_node *new_Const_type(tarval *con, ir_type *tp);
3855
3856 /** Constructor for a SymConst node.
3857  *
3858  * Adds the node to the block in current_ir_block.
3859  * This is the constructor for a symbolic constant.
3860  * There are four kinds of symbolic constants:
3861  *    -# type_tag  The symbolic constant represents a type tag.  The type the
3862  *                 tag stands for is given explicitly.
3863  *    -# size      The symbolic constant represents the size of a type.  The
3864  *                 type of which the constant represents the size is given
3865  *                 explicitly.
3866  *    -# align     The symbolic constant represents the alignment of a type.  The
3867  *                 type of which the constant represents the size is given
3868  *                 explicitly.
3869  *    -# addr_name The symbolic constant represents the address of an entity
3870  *                 (variable or method).  The variable is indicated by a name
3871  *                 that is valid for linking.
3872  *    -# addr_ent  The symbolic constant represents the address of an entity
3873  *                 (variable or method).  The variable is given explicitly by
3874  *                 a firm entity.
3875  *
3876  *    Inputs to the node:
3877  *      No inputs except the block it belongs to.
3878  *    Outputs of the node.
3879  *      An unsigned integer (I_u) or a pointer (P).
3880  *
3881  * @param mode    The mode for the SymConst.
3882  * @param value   A type or a ident depending on the SymConst kind.
3883  * @param kind    The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3884  *                symconst_type_align, symconst_addr_name or symconst_addr_ent.
3885  * @param tp      The source type of the constant.
3886  */
3887 ir_node *new_SymConst_type(ir_mode *mode, union symconst_symbol value, symconst_kind kind, ir_type *tp);
3888
3889 /** Constructor for a SymConst node.
3890  *
3891  * Adds the node to the block in current_ir_block.
3892  * This is the constructor for a symbolic constant.
3893  * There are four kinds of symbolic constants:
3894  *    -# type_tag  The symbolic constant represents a type tag.  The type the
3895  *                 tag stands for is given explicitly.
3896  *    -# size      The symbolic constant represents the size of a type.  The
3897  *                 type of which the constant represents the size is given
3898  *                 explicitly.
3899  *    -# align     The symbolic constant represents the alignment of a type.  The
3900  *                 type of which the constant represents the size is given
3901  *                 explicitly.
3902  *    -# addr_name The symbolic constant represents the address of an entity
3903  *                 (variable or method).  The variable is indicated by a name
3904  *                 that is valid for linking.
3905  *    -# addr_ent  The symbolic constant represents the address of an entity
3906  *                 (variable or method).  The variable is given explicitly by
3907  *                 a firm entity.
3908  *
3909  *    Inputs to the node:
3910  *      No inputs except the block it belongs to.
3911  *    Outputs of the node.
3912  *      An unsigned integer (I_u) or a pointer (P).
3913  *
3914  * @param mode    The mode for the SymConst.
3915  * @param value   A type or a ident depending on the SymConst kind.
3916  * @param kind    The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3917  *                symconst_type_align, symconst_addr_name or symconst_addr_ent.
3918  */
3919 ir_node *new_SymConst(ir_mode *mode, union symconst_symbol value, symconst_kind kind);
3920
3921 /** Constructor for a simpelSel node.
3922  *
3923  *  This is a shortcut for the new_Sel() constructor.  To be used for
3924  *  Sel nodes that do not select from an array, i.e., have no index
3925  *  inputs.  It adds the two parameters 0, NULL.
3926  *
3927  * @param   *store     The memory in which the object the entity should be selected from is allocated.
3928  * @param   *objptr    The object from that the Sel operation selects a single attribute out.
3929  * @param   *ent       The entity to select.
3930  */
3931 ir_node *new_simpleSel(ir_node *store, ir_node *objptr, ir_entity *ent);
3932
3933 /** Constructor for a Sel node.
3934  *
3935  * The select node selects an entity (field or method) from an entity
3936  * with a compound type.  It explicitly specifies the entity selected.
3937  * Dynamically the node may select entities that overwrite the given
3938  * entity.  If the selected entity is an array element entity the Sel
3939  * node takes the required array indices as inputs.
3940  * Adds the node to the block in current_ir_block.
3941  *
3942  * @param   *store     The memory in which the object the entity should be selected
3943  *                     from is allocated.
3944  * @param   *objptr    A pointer to a compound entity the Sel operation selects a
3945  *                     single attribute from.
3946  * @param   arity      The number of array indices needed to select an array element entity.
3947  * @param   *in[]      If the compound entity is an array the indices of the selected
3948  *                     element entity.  The constructor copies this array.
3949  * @param   *ent       The entity to select.
3950  */
3951 ir_node *new_Sel    (ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3952                      ir_entity *ent);
3953
3954 /** Constructor for a Call node.
3955  *
3956  * Adds the node to the block in current_ir_block.
3957  * Represents all kinds of method and function calls.
3958  *
3959  * @param   *store  The actual store.
3960  * @param   *callee A pointer to the called procedure.
3961  * @param   arity   The number of procedure parameters.
3962  * @param   *in[]   An array with the pointers to the parameters. The constructor copies this array.
3963  * @param   *tp     Type information of the procedure called.
3964  */
3965 ir_node *new_Call   (ir_node *store, ir_node *callee, int arity, ir_node *in[],
3966                      ir_type *tp);
3967
3968 /** Constructor for a Builtin node.
3969  *
3970  * Represents a call of a backend-specific builtin..
3971  * Represents all kinds of method and function calls.
3972  *
3973  * @param   *store  The actual store.
3974  * @param   kind    The kind of the called builtin.
3975  * @param   arity   The number of procedure parameters.
3976  * @param   *in[]   An array with the pointers to the parameters. The constructor copies this array.
3977  * @param   *tp     Type information of the procedure called.
3978  */
3979 ir_node *new_Builtin(ir_node *store, ir_builtin_kind kind, int arity, ir_node *in[],
3980                      ir_type *tp);
3981
3982 /** Constructor for a CallBegin node.
3983  *
3984  * CallBegin represents control flow depending of the pointer value
3985  * representing the called method to the called methods.  The
3986  * constructor copies the method pointer input from the passed Call
3987  * node. Adds the node to the block in current_ir_block.
3988  *
3989  * @param   *callee A pointer to the called procedure.
3990  */
3991 ir_node *new_CallBegin(ir_node *callee);
3992
3993 /** Constructor for a Add node.
3994  *
3995  * Adds the node to the block in current_ir_block.
3996  *
3997  * @param   *op1   The first operand.
3998  * @param   *op2   The second operand.
3999  * @param   *mode  The mode of the operands and the result.
4000  */
4001 ir_node *new_Add    (ir_node *op1, ir_node *op2, ir_mode *mode);
4002
4003 /** Constructor for a Sub node.
4004  *
4005  * Adds the node to the block in current_ir_block.
4006  *
4007  * @param   *op1   The first operand.
4008  * @param   *op2   The second operand.
4009  * @param   *mode  The mode of the operands and the result.
4010  */
4011 ir_node *new_Sub    (ir_node *op1, ir_node *op2, ir_mode *mode);
4012
4013 /** Constructor for a Minus node.
4014  *
4015  * Adds the node to the block in current_ir_block.
4016  *
4017  * @param   *op    The operand .
4018  * @param   *mode  The mode of the operand and the result.
4019  */
4020 ir_node *new_Minus  (ir_node *op,  ir_mode *mode);
4021
4022 /**
4023  * Constructor for a Mul node. Adds the node to the block in current_ir_block.
4024  *
4025  * @param   *op1   The first operand.
4026  * @param   *op2   The second operand.
4027  * @param   *mode  The mode of the operands and the result.
4028  */
4029 ir_node *new_Mul    (ir_node *op1, ir_node *op2, ir_mode *mode);
4030
4031 /**
4032  * Constructor for a Mulh node. Adds the node to the block in current_ir_block.
4033  *
4034  * @param   *op1   The first operand.
4035  * @param   *op2   The second operand.
4036  * @param   *mode  The mode of the operands and the result.
4037  */
4038 ir_node *new_Mulh   (ir_node *op1, ir_node *op2, ir_mode *mode);
4039
4040 /** Constructor for a Quot node.
4041  *
4042  * Adds the node to the block in current_ir_block.
4043  *
4044  * @param   *memop The store needed to model exceptions
4045  * @param   *op1   The first operand.
4046  * @param   *op2   The second operand.
4047  * @param   *mode  The mode of the result.
4048  * @param   state  The pinned state.
4049  */
4050 ir_node *new_Quot   (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
4051
4052 /** Constructor for a DivMod node.
4053  *
4054  * Adds the node to the block in current_ir_block.
4055  *
4056  * @param   *memop The store needed to model exceptions
4057  * @param   *op1   The first operand.
4058  * @param   *op2   The second operand.
4059  * @param   *mode  The mode of the results.
4060  * @param   state  The pinned state.
4061  */
4062 ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
4063
4064 /** Constructor for a Div node.
4065  *
4066  * Adds the node to the block in current_ir_block.
4067  *
4068  * @param   *memop The store needed to model exceptions
4069  * @param   *op1   The first operand.
4070  * @param   *op2   The second operand.
4071  * @param   *mode  The mode of the result.
4072  * @param   state  The pinned state.
4073  */
4074 ir_node *new_Div    (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
4075
4076 /** Constructor for a remainderless Div node.
4077  *
4078  * Adds the node to the block in current_ir_block.
4079  *
4080  * @param   *memop The store needed to model exceptions
4081  * @param   *op1   The first operand.
4082  * @param   *op2   The second operand.
4083  * @param   *mode  The mode of the result.
4084  * @param   state  The pinned state.
4085  */
4086 ir_node *new_DivRL  (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
4087
4088 /** Constructor for a Mod node.
4089  *
4090  * Adds the node to the block in current_ir_block.
4091  *
4092  * @param   *memop The store needed to model exceptions
4093  * @param   *op1   The first operand.
4094  * @param   *op2   The second operand.
4095  * @param   *mode  The mode of the result.
4096  * @param   state  The pinned state.
4097  */
4098 ir_node *new_Mod    (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
4099
4100 /** Constructor for a Abs node.
4101  *
4102  * Adds the node to the block in current_ir_block.
4103  *
4104  * @param   *op    The operand
4105  * @param   *mode  The mode of the operands and the result.
4106  */
4107 ir_node *new_Abs    (ir_node *op,                ir_mode *mode);
4108
4109 /** Constructor for a And node.
4110  *
4111  * Adds the node to the block in current_ir_block.
4112  *
4113  * @param   *op1   The first operand.
4114  * @param   *op2   The second operand.
4115  * @param   *mode  The mode of the operands and the result.
4116  */
4117 ir_node *new_And    (ir_node *op1, ir_node *op2, ir_mode *mode);
4118
4119 /**
4120  * Constructor for a Or node. Adds the node to the block in current_ir_block.
4121  *
4122  * @param   *op1   The first operand.
4123  * @param   *op2   The second operand.
4124  * @param   *mode  The mode of the operands and the result.
4125  */
4126 ir_node *new_Or     (ir_node *op1, ir_node *op2, ir_mode *mode);
4127
4128 /**
4129  * Constructor for a Eor node. Adds the node to the block in current_ir_block.
4130  *
4131  * @param   *op1   The first operand.
4132  * @param   *op2   The second operand.
4133  * @param   *mode  The mode of the operands and the results.
4134  */
4135 ir_node *new_Eor    (ir_node *op1, ir_node *op2, ir_mode *mode);
4136
4137 /** Constructor for a Not node.
4138  *
4139  * Adds the node to the block in current_ir_block.
4140  *
4141  * @param   *op    The operand.
4142  * @param   *mode  The mode of the operand and the result.
4143  */
4144 ir_node *new_Not    (ir_node *op,                ir_mode *mode);
4145
4146 /** Constructor for a Shl node.
4147  *
4148  * Adds the node to the block in current_ir_block.
4149  *
4150  * @param   *op    The operand.
4151  * @param   *k     The number of bits to  shift the operand .
4152  * @param   *mode  The mode of the operand and the result.
4153  */
4154 ir_node *new_Shl    (ir_node *op,  ir_node *k,   ir_mode *mode);
4155
4156 /**
4157  * Constructor for a Shr node. Adds the node to the block in current_ir_block.
4158  *
4159  * @param   *op    The operand.
4160  * @param   *k     The number of bits to  shift the operand .
4161  * @param   *mode  The mode of the operand and the result.
4162  */
4163 ir_node *new_Shr    (ir_node *op,  ir_node *k,   ir_mode *mode);
4164
4165 /** Constructor for a Shrs node.
4166  *
4167  * Adds the node to the block in current_ir_block.
4168  *
4169  * @param   *op    The operand.
4170  * @param   *k     The number of bits to  shift the operand .
4171  * @param   *mode  The mode of the operand and the result.
4172  */
4173 ir_node *new_Shrs   (ir_node *op,  ir_node *k,   ir_mode *mode);
4174
4175 /** Constructor for a Rotl node.
4176  *
4177  * Adds the node to the block in current_ir_block.
4178  *
4179  * @param   *op    The operand.
4180  * @param   *k     The number of bits to rotate the operand.
4181  * @param   *mode  The mode of the operand.
4182  */
4183 ir_node *new_Rotl   (ir_node *op,  ir_node *k,   ir_mode *mode);
4184
4185 /** Constructor for a Cmp node.
4186  *
4187  * Adds the node to the block in current_ir_block.
4188  *
4189  * @param   *op1   The first operand.
4190  * @param   *op2   The second operand.
4191  */
4192 ir_node *new_Cmp    (ir_node *op1, ir_node *op2);
4193
4194 /** Constructor for a Conv node.
4195  *
4196  * Adds the node to the block in current_ir_block.
4197  *
4198  * @param   *op          The operand.
4199  * @param   *mode        The mode of this the operand muss be converted.
4200  */
4201 ir_node *new_Conv   (ir_node *op, ir_mode *mode);
4202
4203 /** Constructor for a strict Conv node.
4204  *
4205  * Adds the node to the block in current_ir_block.
4206  *
4207  * @param   *op          The operand.
4208  * @param   *mode        The mode of this the operand muss be converted.
4209  */
4210 ir_node *new_strictConv   (ir_node *op, ir_mode *mode);
4211
4212 /** Constructor for a Cast node.
4213  *
4214  * Adds the node to the block in current_ir_block.
4215  * High level type cast
4216  *
4217  * @param   *op    The operand.
4218  * @param   *to_tp The type of this the operand muss be casted .
4219  */
4220 ir_node *new_Cast   (ir_node *op, ir_type *to_tp);
4221
4222 /** Constructor for a Carry node.
4223  *
4224  * Adds the node to the block in current_ir_block.
4225  *
4226  * @param   *op1   The first operand.
4227  * @param   *op2   The second operand.
4228  * @param   *mode  The mode of the operands and the result.
4229  */
4230 ir_node *new_Carry  (ir_node *op1, ir_node *op2, ir_mode *mode);
4231
4232 /** Constructor for a Borrow node.
4233  *
4234  * Adds the node to the block in current_ir_block.
4235  *
4236  * @param   *op1   The first operand.
4237  * @param   *op2   The second operand.
4238  * @param   *mode  The mode of the operands and the result.
4239  */
4240 ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode);
4241
4242 /** Constructor for a Phi node.
4243  *
4244  * Adds the node to the block in current_ir_block.
4245  *
4246  * @param arity  The number of predecessors.
4247  * @param *in    Array with predecessors.
4248  * @param *mode  The mode of it's inputs and output.
4249  */
4250 ir_node *new_Phi    (int arity, ir_node *in[], ir_mode *mode);
4251
4252 /** Constructor for a Load node.
4253  *
4254  * @param *store  The current memory.
4255  * @param *addr   A pointer to the variable to be read in this memory.
4256  * @param *mode   The mode of the value to be loaded.
4257  * @param  flags  Additional flags for alignment, volatility and pin state.
4258  */
4259 ir_node *new_Load(ir_node *store, ir_node *addr, ir_mode *mode, ir_cons_flags flags);
4260
4261 /** Constructor for a Store node.
4262  *
4263  * @param *store  The current memory.
4264  * @param *addr   A pointer to the variable to be read in this memory.
4265  * @param *val    The value to write to this variable.
4266  * @param  flags  Additional flags for alignment, volatility and pin state.
4267  */
4268 ir_node *new_Store(ir_node *store, ir_node *addr, ir_node *val, ir_cons_flags flags);
4269
4270 /** Constructor for a Alloc node.
4271  *
4272  * The Alloc node extends the memory by space for an entity of type alloc_type.
4273  * Adds the node to the block in current_ir_block.
4274  *
4275  * @param *store      The memory which shall contain the new variable.
4276  * @param *size       The number of bytes to allocate.
4277  * @param *alloc_type The type of the allocated variable.
4278  * @param where       Where to allocate the variable, either heap_alloc or stack_alloc.
4279  */
4280 ir_node *new_Alloc  (ir_node *store, ir_node *size, ir_type *alloc_type,
4281                      ir_where_alloc where);
4282
4283 /** Constructor for a Free node.
4284  *
4285  * Frees the memory occupied by the entity pointed to by the pointer
4286  * arg.  Type indicates the type of the entity the argument points to.
4287  * Adds the node to the block in current_ir_block.
4288  *
4289  * @param *store      The memory which shall contain the new variable.
4290  * @param *ptr        The pointer to the object to free.
4291  * @param *size       The number of objects of type free_type to free in a sequence.
4292  * @param *free_type  The type of the freed variable.
4293  * @param where       Where the variable was allocated, either heap_alloc or stack_alloc.
4294  */
4295 ir_node *new_Free   (ir_node *store, ir_node *ptr, ir_node *size,
4296                              ir_type *free_type, ir_where_alloc where);
4297
4298 /** Constructor for a Sync node.
4299  *
4300  * Merges several memory values.  The node assumes that a variable
4301  * either occurs only in one of the memories, or it contains the same
4302  * value in all memories where it occurs.
4303  * Adds the node to the block in current_ir_block.
4304  *
4305  * @param  arity    The number of memories to synchronize.
4306  * @param  **in     An array of pointers to nodes that produce an output of type
4307  *                  memory.  The constructor copies this array.
4308  */
4309 ir_node *new_Sync   (int arity, ir_node *in[]);
4310
4311 /** Constructor for a Proj node.
4312  *
4313  * Projects a single value out of a tuple.  The parameter proj gives the
4314  * position of the value within the tuple.
4315  * Adds the node to the block in current_ir_block.
4316  *
4317  * @param arg    A node producing a tuple.
4318  * @param *mode  The mode of the value to project.
4319  * @param proj   The position of the value in the tuple.
4320  */
4321 ir_node *new_Proj   (ir_node *arg, ir_mode *mode, long proj);
4322
4323 /** Constructor for a Filter node.
4324  *
4325  * Constructor for a Filter node. Adds the node to the block in current_ir_block.
4326  * Filter is a node with two views used to construct the interprocedural view.
4327  * In intraprocedural view its semantics are identical to the Proj node.
4328  * In interprocedural view the Filter performs the Phi operation on method
4329  * parameters or results.  Other than a Phi a Filter node may not be removed
4330  * if it has only a single input.
4331  *
4332  * The constructor builds the Filter in intraprocedural view.
4333  *
4334  * @param *arg  The tuple value to project from.
4335  * @param *mode The mode of the projected value.
4336  * @param proj  The position in the tuple to project from.
4337  */
4338 ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj);
4339
4340 /** Constructor for a defaultProj node.
4341  *
4342  * Represents the default control flow of a Switch-Cond node.
4343  * Adds the node to the block in current_ir_block.
4344  *
4345  * @param arg       A node producing a tuple.
4346  * @param max_proj  The end  position of the value in the tuple.
4347  */
4348 ir_node *new_defaultProj (ir_node *arg, long max_proj);
4349
4350 /** Constructor for a Tuple node.
4351  *
4352  * This is an auxiliary node to replace a node that returns a tuple
4353  * without changing the corresponding Proj nodes.
4354  * Adds the node to the block in current_ir_block.
4355  *
4356  * @param arity   The number of tuple elements.
4357  * @param **in    An array containing pointers to the nodes producing the tuple elements.
4358  */
4359 ir_node *new_Tuple  (int arity, ir_node *in[]);
4360
4361 /** Constructor for an Id node.
4362  *
4363  * This is an auxiliary node to replace a node that returns a single
4364  * value. Adds the node to the block in current_ir_block.
4365  *
4366  * @param *val    The operand to Id.
4367  * @param *mode   The mode of *val.
4368  */
4369 ir_node *new_Id     (ir_node *val, ir_mode *mode);
4370
4371 /** Constructor for a Bad node.
4372  *
4373  * Returns the unique Bad node of the graph.  The same as
4374  * get_irg_bad().
4375  */
4376 ir_node *new_Bad    (void);
4377
4378 /** Constructor for a Confirm node.
4379  *
4380  * Specifies constraints for a value.  To support dataflow analyses.
4381  * Adds the node to the block in current_ir_block.
4382  *
4383  * Example: If the value never exceeds '100' this is expressed by placing a
4384  * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
4385  *
4386  * @param *val    The value we express a constraint for
4387  * @param *bound  The value to compare against. Must be a firm node, typically a constant.
4388  * @param cmp     The compare operation.
4389  */
4390 ir_node *new_Confirm (ir_node *val, ir_node *bound, pn_Cmp cmp);
4391
4392 /** Constructor for an Unknown node.
4393  *
4394  * Represents an arbitrary value.  Places the node in
4395  * the start block.
4396  *
4397  * @param *m      The mode of the unknown value.
4398  */
4399 ir_node *new_Unknown(ir_mode *m);
4400
4401 /** Constructor for a NoMem node.
4402  *
4403  * Returns the unique NoMem node of the graph.  The same as
4404  * get_irg_no_mem().
4405  */
4406 ir_node *new_NoMem  (void);
4407
4408 /** Constructor for a Mux node.
4409  *
4410  * Adds the node to the block in current_ir_block.
4411  *
4412  * @param *sel      The ir_node that calculates the boolean select.
4413  * @param *ir_true  The ir_node that calculates the true result.
4414  * @param *ir_false The ir_node that calculates the false result.
4415  * @param *mode     The mode of the node (and it_true and ir_false).
4416  */
4417 ir_node *new_Mux  (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
4418
4419 /** Constructor for a CopyB node.
4420  *
4421  * Adds the node to the block in current_ir_block.
4422  *
4423  * @param *store      The current memory
4424  * @param *dst        The ir_node that represents the destination address.
4425  * @param *src        The ir_node that represents the source address.
4426  * @param *data_type  The type of the copied data
4427  */
4428 ir_node *new_CopyB(ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
4429
4430 /** Constructor for a InstOf node.
4431  *
4432  * A High-Level Type check.
4433  *
4434  * @param   *store     The memory in which the object the entity should be selected
4435  *                     from is allocated.
4436  * @param   *objptr    A pointer to a object of a class type.
4437  * @param   *type      The type of which objptr must be.
4438  */
4439 ir_node *new_InstOf (ir_node *store, ir_node *objptr, ir_type *type);
4440
4441 /**Constructor for a Raise node.
4442  *
4443  * A High-Level Exception throw.
4444  *
4445  * @param *store The current memory.
4446  * @param *obj   A pointer to the Except variable.
4447  */
4448 ir_node *new_Raise  (ir_node *store, ir_node *obj);
4449
4450 /** Constructor for a Bound node.
4451  *
4452  * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
4453  *
4454  * Adds the node to the block in current_ir_block.
4455  *
4456  * @param *store      The current memory
4457  * @param *idx        The ir_node that represents an index.
4458  * @param *lower      The ir_node that represents the lower bound for the index.
4459  * @param *upper      The ir_node that represents the upper bound for the index.
4460  */
4461 ir_node *new_Bound  (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
4462
4463 /** Constructor for a Pin node.
4464  *
4465  * @param *node       The node which value should be pinned.
4466  */
4467 ir_node *new_Pin    (ir_node *node);
4468
4469 /** Constructor for an ASM pseudo node.
4470  *
4471  * @param arity       The number of data inputs to the node.
4472  * @param *in         The array of length arity of data inputs.
4473  * @param *inputs     The array of length arity of input constraints.
4474  * @param n_outs      The number of data outputs to the node.
4475  * @param *outputs    The array of length n_outs of output constraints.
4476  * @param n_clobber   The number of clobbered registers.
4477  * @param *clobber    The array of length n_clobber of clobbered registers.
4478  * @param *asm_text   The assembler text.
4479  */
4480 ir_node *new_ASM(int arity, ir_node *in[], ir_asm_constraint *inputs,
4481                  int n_outs, ir_asm_constraint *outputs,
4482                  int n_clobber, ident *clobber[], ident *asm_text);
4483
4484 /*---------------------------------------------------------------------*/
4485 /* The comfortable interface.                                          */
4486 /* Supports automatic Phi node construction.                           */
4487 /* All routines of the block oriented interface except new_Block are   */
4488 /* needed also.                                                        */
4489 /*---------------------------------------------------------------------*/
4490
4491 /** Create an immature Block.
4492  *
4493  * An immature Block has an unknown number of predecessors.  Predecessors
4494  * can be added with add_immBlock_pred().  Once all predecessors are
4495  * added the block must be matured.
4496  *
4497  * Adds the block to the graph in current_ir_graph. Can be used with automatic
4498  * Phi node construction.
4499  * This constructor can only be used if the graph is in state_building.
4500  */
4501 ir_node *new_d_immBlock(dbg_info *db);
4502 ir_node *new_immBlock(void);
4503
4504 /** Create an immature PartBlock.
4505  *
4506  * An immature block has only one Block or PartBlock predecessor.
4507  * A PartBlock forms together with one BLock and possibly other
4508  * PartBlocks a MacroBlock.
4509  *
4510  * Adds the PartBlock to the graph in current_ir_graph. Does set
4511  * current_block.  Can be used with automatic Phi node construction.
4512  * This constructor can only be used if the graph is in
4513  * state_building.
4514  */
4515 ir_node *new_d_immPartBlock(dbg_info *db, ir_node *pred_jmp);
4516 ir_node *new_immPartBlock(ir_node *pred_jmp);
4517
4518 /** Add a control flow edge to an immature block. */
4519 void add_immBlock_pred(ir_node *immblock, ir_node *jmp);
4520
4521 /** Finalize a Block node, when all control flows are known. */
4522 void mature_immBlock(ir_node *block);
4523 #define mature_cur_block() mature_immBlock(get_cur_block());
4524
4525
4526 /** Get the current value of a local variable.
4527  *
4528  * Use this function to obtain the last definition of the local variable
4529  * associated with pos.  Pos may not exceed the value passed as n_loc
4530  * to new_ir_graph.  This call automatically inserts Phi nodes.
4531  *
4532  * @param *db    A pointer for debug information.
4533  * @param  pos   The position/id of the local variable.
4534  * @param *mode  The mode of the value to get.
4535  */
4536 ir_node *get_d_value(dbg_info *db, int pos, ir_mode *mode);
4537 ir_node *get_value(int pos, ir_mode *mode);
4538
4539 /** Remark a new definition of a variable.
4540  *
4541  * Use this function to remember a new definition of the value
4542  * associated with pos. Pos may not exceed the value passed as n_loc
4543  * to new_ir_graph.  This call is needed to automatically inserts Phi
4544  * nodes.
4545  *
4546  * @param  pos   The position/id of the local variable.
4547  * @param *value The new value written to the local variable.
4548  */
4549 void set_value(int pos, ir_node *value);
4550
4551 /** Find the value number for a node in the current block.
4552  *
4553  * This function searches all values in the current block for
4554  * a given value and returns its value number if it was found, else
4555  * -1.
4556  * Note that this does not mean that the value does not exists,
4557  * it's just not equal the node (for instance behind a Phi/Confirm ...)
4558  *
4559  * @param *value The value to find.
4560  */
4561 int find_value(ir_node *value);
4562
4563 /** Get the current memory state.
4564  *
4565  * Use this function to obtain the last definition of the memory
4566  * state.  This call automatically inserts Phi nodes for the memory
4567  * state value.
4568  */
4569 ir_node *get_store(void);
4570
4571 /** Remark a new definition of the memory state.
4572  *
4573  * Use this function to remember a new definition of the memory state.
4574  * This call is needed to automatically inserts Phi nodes.
4575  *
4576  * @param *store The new memory state.
4577  */
4578 void set_store(ir_node *store);
4579
4580 /** keep this node alive even if End is not control-reachable from it
4581  *
4582  * @param ka The node to keep alive.
4583  */
4584 void keep_alive(ir_node *ka);
4585
4586 /** Returns the frame type of the current graph */
4587 ir_type *get_cur_frame_type(void);
4588
4589
4590 /* --- initialize and finalize IR construction --- */
4591
4592 /** Puts the graph into state "phase_high" */
4593 #define irg_finalize_cons(irg) set_irg_phase_state(irg, phase_high)
4594
4595 /** Puts the program and all graphs into state phase_high.
4596  *
4597  * This also remarks, the construction of types is finished,
4598  * e.g., that no more subtypes will be added.  */
4599 void irp_finalize_cons(void);
4600
4601 /* --- Initialization --- */
4602
4603 #endif