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