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