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