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