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