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