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