- C99 feature removed
[libfirm] / include / libfirm / ircons.h
1 /*
2  * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
6  * This file may be distributed and/or modified under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation and appearing in the file LICENSE.GPL included in the
9  * packaging of this file.
10  *
11  * Licensees holding valid libFirm Professional Edition licenses may use
12  * this file in accordance with the libFirm Commercial License.
13  * Agreement provided with the Software.
14  *
15  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief   Various irnode constructors. Automatic construction of SSA
23  *          representation.
24  * @author  Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Boris Boesler,
25  *          Michael Beck
26  * @version $Id$
27  */
28
29 /**@todo
30  Ideas for improvement:
31  -# Handle construction of exceptions more comfortable:
32     Add new constructors that pass the exception region (or better the
33     Phi for the memories, the ex. region can be found from there) as parameter,
34     constructor then adds all Proj nodes and returns the pointer
35     to the Proj node that selects the result of the arithmetic operation.
36  -# Maybe hide the exception region in a global variable, especially if
37     it is always unambiguous.
38 */
39
40 /**
41  *  @file
42  *
43  *  documentation no more supported since 2001
44  *
45  *  IR node construction.
46  *
47  *    This file documents all datatypes and constructors needed to
48  *    build a FIRM representation of a procedure.  The constructors are
49  *    also implemented in this file.
50  *
51  *    The documentation also gives a short manual how to use the library.
52  *
53  *    For extensive documentation of FIRM see UKA Techreport 1999-14.
54  *
55  *
56  *    Three kinds of nodes
57  *    --------------------
58  *
59  *      There are three kinds of nodes known to the IR:  entities,
60  *      types, and ir_nodes
61  *
62  *      + ir_nodes are the actual nodes of the FIRM intermediate representation.
63  *        They represent operations on the data of the program and control flow
64  *        operations.
65  *
66  *      + entity ==> implemented in entity.h
67  *        Refers to a single entity of the compiled program, e.g. a field of a
68  *        class or a method.  If a method or variable can not be assigned to
69  *        a method or class or the like, it is a global object.
70  *
71  *      + types ==> implemented in type.h
72  *        With types type information is represented.  There are several type
73  *       nodes.
74  *
75  *    Implementation of the FIRM operations: ir_node
76  *    ----------------------------------------------
77  *
78  *      Ir_nodes represent operations on the data of the program and control flow
79  *      operations.  Examples of ir_nodes:  Add, Jmp, Cmp
80  *
81  *      FIRM is a dataflow graph.  A dataflow graph is a directed graph,
82  *      so that every node has incoming and outgoing edges.  A node is
83  *      executable if every input at it's incoming edges is available.
84  *      Execution of the dataflow graph is started at the Start node which
85  *      has no incoming edges and ends when the End node executes, even if
86  *      there are still executable or not executed nodes.  (Is this true,
87  *      or must all executable nodes be executed?)  (There are exceptions
88  *      to the dataflow paradigma that all inputs have to be available
89  *      before a node can execute: Phi, Block.  See UKA Techreport
90  *      1999-14.)
91  *
92  *      The implementation of FIRM differs from the view as a dataflow
93  *      graph.  To allow fast traversion of the graph edges are
94  *      implemented as C-pointers.  Inputs to nodes are not ambiguous, the
95  *      results can be used by several other nodes.  Each input can be
96  *      implemented as a single pointer to a predecessor node, outputs
97  *      need to be lists of pointers to successors.  Therefore a node
98  *      contains pointers to it's predecessor so that the implementation is a
99  *      dataflow graph with reversed edges.  It has to be traversed bottom
100  *      up.
101  *
102  *      All nodes of the IR have the same basic structure.  They are
103  *      distinguished by a field containing the opcode.
104  *
105  *      The fields of an ir_node:
106  *
107  *      kind             A firm_kind tag containing k_ir_node.  This is useful for
108  *                       dynamically checking the type of a node.
109  *
110  *      *op              This ir_op gives the opcode as a tag and a string
111  *                       and the number of attributes of an ir_node.  There is
112  *                       one statically allocated struct ir_op for each opcode.
113  *
114  *      *mode            The ir_mode of the operation represented by this firm
115  *                      node.  The mode of the operation is the mode of it's
116  *                       result.  A Firm mode is a datatype as known to the target,
117  *               not a type of the source language.
118  *
119  *      visit            A flag for traversing the IR.
120  *
121  *      **in             An array with pointers to the node's predecessors.
122  *
123  *      *link            A pointer to an ir_node.  With this pointer all Phi nodes
124  *                       are attached to a Block, i.e., a Block points to it's
125  *                       first Phi node, this node points to the second Phi node
126  *                       in the Block and so fourth.  Used in mature_immBlock
127  *                       to find all Phi nodes to be matured.  It's also used to
128  *               annotate a node with a better, optimized version of it.
129  *
130  *      attr             An attr struct containing the attributes of the nodes. The
131  *                       attributes depend on the opcode of the node.  The number
132  *               of these attributes is given in op.
133  *
134  *    The struct ir_op
135  *    ----------------
136  *                       Not yet documented. See irop.h.
137  *
138  *    The struct ir_mode
139  *    ------------------
140  *                       Not yet documented. See irmode.h.
141  *
142  *    GLOBAL VARIABLES -- now also fields of ir_graph.
143  *    ================
144  *
145  *    current_ir_graph   Points to the current ir_graph.  All constructors for
146  *                      nodes add nodes to this graph.
147  *
148  *    ir_visited         An int used as flag to traverse the ir_graph.
149  *
150  *    block_visited      An int used as a flag to traverse block nodes in the
151  *                       graph.
152  *
153  *                       Others not yet documented.
154  *
155  *
156  *
157  *    CONSTRUCTOR FOR IR_GRAPH --> see irgraph.h
158  *    ========================
159  *
160  *
161  *    PROCEDURE TO CONSTRUCT AN IR GRAPH --> see also Firm tutorial
162  *    ==================================
163  *
164  *    This library supplies several interfaces to construct a FIRM graph for
165  *    a program:
166  *    - A "comfortable" interface generating SSA automatically.  Automatically
167  *      computed predecessors of nodes need not be specified in the constructors.
168  *      (new_<Node> constructurs and a set of additional routines.)
169  *    - A less comfortable interface where all predecessors except the block
170  *      an operation belongs to need to be specified.  SSA must be constructed
171  *      by hand.  (new_<Node> constructors and set_cur_block()).  This interface
172  *      is called "block oriented".  It automatically calles the local optimizations
173  *      for each new node.
174  *    - An even less comfortable interface where the block needs to be specified
175  *      explicitly.  This is called the "raw" interface. (new_r_<Node>
176  *      constructors).  These nodes are not optimized.
177  *
178  *    To use the functionality of the comfortable interface correctly the Front
179  *    End needs to follow certain protocols.  This is explained in the following.
180  *    To build a correct IR with the other interfaces study the semantics of
181  *    the firm node (See tech-reprot UKA 1999-14).  For the construction of
182  *    types and entities see the documentation in those modules.
183  *
184  *    First the Frontend needs to decide which variables and values used in
185  *    a procedure can be represented by dataflow edges.  These are variables
186  *    that need not be saved to memory as they cause no side effects visible
187  *    out of the procedure.  Often these are all compiler generated
188  *    variables and simple local variables of the procedure as integers,
189  *    reals and pointers.  The frontend has to count and number these variables.
190  *
191  *    First an ir_graph needs to be constructed with new_ir_graph.  The
192  *    constructor gets the number of local variables.  The graph is hold in the
193  *    global variable irg.
194  *
195  *    Now the construction of the procedure can start.  Several basic blocks can
196  *    be constructed in parallel, but the code within each block needs to
197  *    be constructed (almost) in program order.
198  *
199  *    A global variable holds the current basic block.  All (non block) nodes
200  *    generated are added to this block.  The current block can be set with
201  *    set_cur_block(block).  If several blocks are constructed in parallel block
202  *    switches need to be performed constantly.
203  *
204  *    To generate a Block node (with the comfortable interface), 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 *irg    The IR graph the node belongs to.
1201  * @param *block  The IR block the node belongs to.
1202  */
1203 ir_node *new_rd_Jmp    (dbg_info *db, ir_graph *irg, ir_node *block);
1204
1205 /** Constructor for an IJmp node.
1206  *
1207  * IJmp represents control flow to a single control successor not
1208  * statically known i.e. an indirect Jmp.
1209  *
1210  * @param *db     A pointer for debug information.
1211  * @param *irg    The IR graph the node belongs to.
1212  * @param *block  The IR block the node belongs to.
1213  * @param *tgt    The IR node representing the target address.
1214  */
1215 ir_node *new_rd_IJmp   (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *tgt);
1216
1217 /** Constructor for a Break node.
1218  *
1219  * Break represents control flow to a single control successor just as Jmp.
1220  * The blocks separated by a break may not be concatenated by an optimization.
1221  * It is used for the interprocedural representation where blocks are parted
1222  * behind Call nodes to represent the control flow to called procedures.
1223  *
1224  * @param *db     A pointer for debug information.
1225  * @param *irg    The IR graph the node belong to.
1226  * @param *block  The block the node belong to.
1227  */
1228 ir_node *new_rd_Break  (dbg_info *db, ir_graph *irg, ir_node *block);
1229
1230 /** Constructor for a Cond node.
1231  *
1232  * If c is mode_b represents a conditional branch (if/else). If c is
1233  * mode_Is/mode_Iu (?) represents a switch.  (Allocates dense Cond
1234  * node, default Proj is 0.)
1235  *
1236  * This is not consistent:  Input to Cond is Is, Proj has as proj number
1237  * longs.
1238  *
1239  * @param *db    A pointer for debug information.
1240  * @param *irg   The IR graph the node  belongs to.
1241  * @param *block The IR block the node belongs to.
1242  * @param *c     The conditions parameter. Can be of mode b or I_u.
1243  */
1244 ir_node *new_rd_Cond   (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *c);
1245
1246 /** Constructor for a Return node.
1247  *
1248  * Returns the memory and zero or more return values.  Only node that
1249  * can end regular control flow.
1250  *
1251  * @param *db    A pointer for debug information.
1252  * @param *irg   The IR graph the node  belongs to.
1253  * @param *block The IR block the node belongs to.
1254  * @param *store The state of memory.
1255  * @param arity  Number of return values.
1256  * @param *in    Array of length arity with return values.  The constructor copies this array.
1257  */
1258 ir_node *new_rd_Return (dbg_info *db, ir_graph *irg, ir_node *block,
1259                         ir_node *store, int arity, ir_node *in[]);
1260
1261 /** Constructor for a Const_type node.
1262  *
1263  * Adds the node to the start block.
1264  *
1265  * The constant represents a target value.  This constructor sets high
1266  * level type information for the constant value.
1267  * Derives mode from passed tarval.
1268  *
1269  * @param *db    A pointer for debug information.
1270  * @param *irg   The IR graph the node  belongs to.
1271  * @param *con   Points to an entry in the constant table.
1272  * @param *tp    The type of the constant.
1273  */
1274 ir_node *new_rd_Const_type (dbg_info *db, ir_graph *irg,
1275                             tarval *con, ir_type *tp);
1276
1277 /** Constructor for a Const node.
1278  *
1279  * Adds the node to the start block.
1280  *
1281  * Constructor for a Const node. The constant represents a target
1282  * value.  Sets the type information to type_unknown.  (No more
1283  * supported: If tv is entity derives a somehow useful type.)
1284  * Derives mode from passed tarval.
1285  *
1286  * @param *db    A pointer for debug information.
1287  * @param *irg   The IR graph the node  belongs to.
1288  * @param *con   Points to an entry in the constant table.
1289  */
1290 ir_node *new_rd_Const  (dbg_info *db, ir_graph *irg, tarval *con);
1291
1292 /** Constructor for a Const node.
1293  *
1294  * Adds the node to the start block.
1295  *
1296  * Constructor for a Const node. The constant represents a target
1297  * value.  Sets the type information to type_unknown.  (No more
1298  * supported: If tv is entity derives a somehow useful type.)
1299  *
1300  * @param *db    A pointer for debug information.
1301  * @param *irg   The IR graph the node  belongs to.
1302  * @param *mode  The mode of the operands and results.
1303  * @param value  A value from which the tarval is made.
1304  */
1305 ir_node *new_rd_Const_long (dbg_info *db, ir_graph *irg,
1306                                     ir_mode *mode, long value);
1307
1308 /** Constructor for a SymConst_type node.
1309  *
1310  *  This is the constructor for a symbolic constant.
1311  *    There are four kinds of symbolic constants:
1312  *    - type_tag   The symbolic constant represents a type tag.  The type the
1313  *                 tag stands for is given explicitly.
1314  *    - type_size  The symbolic constant represents the size of a type.  The
1315  *                 type of which the constant represents the size is given
1316  *                 explicitly.
1317  *    - type_align The symbolic constant represents the alignment of a type.  The
1318  *                 type of which the constant represents the size is given
1319  *                 explicitly.
1320  *    - addr_name  The symbolic constant represents the address of an entity
1321  *                 (variable or method).  The variable is indicated by a name
1322  *                 that is valid for linking.
1323  *    - addr_ent   The symbolic constant represents the address of an entity
1324  *                 (variable or method).  The variable is given explicitly by
1325  *                 a firm entity.
1326  *
1327  *    Inputs to the node:
1328  *      No inputs except the block it belongs to.
1329  *    Outputs of the node.
1330  *      An unsigned integer (I_u) or a pointer (P).
1331  *
1332  *    Mention union in declaration so that the firmjni generator recognizes that
1333  *    it can not cast the argument to an int.
1334  *
1335  * @param *db     A pointer for debug information.
1336  * @param *irg    The IR graph the node  belongs to.
1337  * @param *block  The IR block the node belongs to.
1338  * @param mode    The mode for the SymConst.
1339  * @param symkind The kind of the symbolic constant: type_tag, size, addr_name or addr_ent.
1340  * @param value   A type, entity or a ident depending on the SymConst kind.
1341  * @param tp      The source type of the constant.
1342  */
1343 ir_node *new_rd_SymConst_type(dbg_info *db, ir_graph *irg, ir_node *block, ir_mode *mode,
1344                               union symconst_symbol value,
1345                               symconst_kind symkind, ir_type *tp);
1346
1347 /** Constructor for a SymConst node.
1348  *
1349  *  Same as new_rd_SymConst_type, except that it sets the type to type_unknown.
1350  */
1351 ir_node *new_rd_SymConst(dbg_info *db, ir_graph *irg, ir_node *block, ir_mode *mode,
1352                          union symconst_symbol value, symconst_kind symkind);
1353
1354 /** Constructor for a SymConst addr_ent node.
1355  *
1356  * Same as new_rd_SymConst_type, except that the constructor is tailored for
1357  * symconst_addr_ent.
1358  * Adds the SymConst to the start block of irg. */
1359 ir_node *new_rd_SymConst_addr_ent(dbg_info *db, ir_graph *irg, ir_mode *mode,
1360                                   ir_entity *symbol, ir_type *tp);
1361
1362 /** Constructor for a SymConst ofs_ent node.
1363  *
1364  * Same as new_rd_SymConst_type, except that the constructor is tailored for
1365  * symconst_ofs_ent.
1366  * Adds the SymConst to the start block of irg.
1367  */
1368 ir_node *new_rd_SymConst_ofs_ent(dbg_info *db, ir_graph *irg, ir_mode *mode,
1369                                  ir_entity *symbol, ir_type *tp);
1370
1371 /** Constructor for a SymConst addr_name node.
1372  *
1373  * Same as new_rd_SymConst_type, except that the constructor is tailored for
1374  * symconst_addr_ent.
1375  * Adds the SymConst to the start block of irg.
1376  */
1377 ir_node *new_rd_SymConst_addr_name(dbg_info *db, ir_graph *irg, ir_mode *mode,
1378                                    ident *symbol, ir_type *tp);
1379
1380 /** Constructor for a SymConst type_tag node.
1381  *
1382  * Same as new_rd_SymConst_type, except that the constructor is tailored for
1383  * symconst_addr_ent.
1384  * Adds the SymConst to the start block of irg.
1385  */
1386 ir_node *new_rd_SymConst_type_tag(dbg_info *db, ir_graph *irg, ir_mode *mode,
1387                                   ir_type *symbol, ir_type *tp);
1388
1389 /** Constructor for a SymConst size node.
1390  *
1391  * Same as new_rd_SymConst_type, except that the constructor is tailored for
1392  * symconst_type_size.
1393  * Adds the SymConst to the start block of irg. */
1394 ir_node *new_rd_SymConst_size(dbg_info *db, ir_graph *irg, ir_mode *mode,
1395                               ir_type *symbol, ir_type *tp);
1396
1397 /** Constructor for a SymConst size node.
1398  *
1399  * Same as new_rd_SymConst_type, except that the constructor is tailored for
1400  * symconst_type_align.
1401  * Adds the SymConst to the start block of irg.
1402  */
1403 ir_node *new_rd_SymConst_align(dbg_info *db, ir_graph *irg, ir_mode *mode,
1404                                ir_type *symbol, ir_type *tp);
1405
1406 /** Constructor for a simpleSel node.
1407  *
1408  *  This is a shortcut for the new_rd_Sel() constructor.  To be used for
1409  *  Sel nodes that do not select from an array, i.e., have no index
1410  *  inputs.  It adds the two parameters 0, NULL.
1411  *
1412  * @param   *db        A pointer for debug information.
1413  * @param   *irg       The IR graph the node  belongs to.
1414  * @param   *block     The IR block the node belongs to.
1415  * @param   *store     The memory in which the object the entity should be
1416  *                     selected from is allocated.
1417  * @param   *objptr    The object from that the Sel operation selects a
1418  *                     single attribute out.
1419  * @param   *ent       The entity to select.
1420  */
1421 ir_node *new_rd_simpleSel (dbg_info *db, ir_graph *irg, ir_node *block,
1422                            ir_node *store, ir_node *objptr, ir_entity *ent);
1423
1424 /** Constructor for a Sel node.
1425  *
1426  * The select node selects an entity (field or method) from an entity
1427  * with a compound type.  It explicitly specifies the entity selected.
1428  * Dynamically the node may select entities that overwrite the given
1429  * entity.  If the selected entity is an array element entity the Sel
1430  * node takes the required array indices as inputs.
1431  *
1432  * @param   *db        A pointer for debug information.
1433  * @param   *irg       The IR graph the node  belongs to.
1434  * @param   *block     The IR block the node belongs to.
1435  * @param   *store     The memory in which the object the entity should be selected
1436  *                     from is allocated.
1437  * @param   *objptr    A pointer to a compound entity the Sel operation selects a
1438  *                     single attribute from.
1439  * @param   *n_index   The number of array indices needed to select an array element entity.
1440  * @param   *index[]   If the compound entity is an array the indices of the selected
1441  *                     element entity.  The constructor copies this array.
1442  * @param   *ent       The entity to select.
1443  */
1444 ir_node *new_rd_Sel    (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1445                                     ir_node *objptr, int n_index, ir_node *index[], ir_entity *ent);
1446
1447 /** Constructor for a Call node.
1448  *
1449  * Represents all kinds of method and function calls.
1450  *
1451  * @param   *db     A pointer for debug information.
1452  * @param   *irg    The IR graph the node  belongs to.
1453  * @param   *block  The IR block the node belongs to.
1454  * @param   *store  The current memory state.
1455  * @param   *callee A pointer to the called procedure.
1456  * @param   arity   The number of procedure parameters.
1457  * @param   *in[]   An array with the procedure parameters. The constructor copies this array.
1458  * @param   *tp     Type information of the procedure called.
1459  */
1460 ir_node *new_rd_Call   (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1461                                     ir_node *callee, int arity, ir_node *in[], ir_type *tp);
1462
1463 /** Constructor for a Â´Builtin node.
1464  *
1465  * Represents a call of a backend-specific builtin..
1466  *
1467  * @param   *db     A pointer for debug information.
1468  * @param   *irg    The IR graph the node  belongs to.
1469  * @param   *block  The IR block the node belongs to.
1470  * @param   *store  The current memory state.
1471  * @param   kind    The kind of the called builtin.
1472  * @param   arity   The number of procedure parameters.
1473  * @param   *in[]   An array with the procedure parameters. The constructor copies this array.
1474  * @param   *tp     Type information of the procedure called.
1475  */
1476 ir_node *new_rd_Builtin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1477                                     ir_builtin_kind kind, int arity, ir_node *in[], ir_type *tp);
1478
1479 /** Constructor for a Add node.
1480  *
1481  * @param   *db    A pointer for debug information.
1482  * @param   *irg   The IR graph the node  belongs to.
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_Add    (dbg_info *db, ir_graph *irg, ir_node *block,
1489                                     ir_node *op1, ir_node *op2, ir_mode *mode);
1490
1491 /** Constructor for a Sub node.
1492  *
1493  * @param   *db    A pointer for debug information.
1494  * @param   *irg   The IR graph the node  belongs to.
1495  * @param   *block The IR block the node belongs to.
1496  * @param   *op1   The first operand.
1497  * @param   *op2   The second operand.
1498  * @param   *mode  The mode of the operands and the result.
1499  */
1500 ir_node *new_rd_Sub    (dbg_info *db, ir_graph *irg, ir_node *block,
1501                                     ir_node *op1, ir_node *op2, ir_mode *mode);
1502
1503 /** Constructor for a Minus node.
1504  *
1505  * @param   *db    A pointer for debug information.
1506  * @param   *irg   The IR graph the node  belongs to.
1507  * @param   *block The IR block the node belongs to.
1508  * @param   *op    The operand .
1509  * @param   *mode  The mode of the operand and the result.
1510  */
1511 ir_node *new_rd_Minus  (dbg_info *db, ir_graph *irg, ir_node *block,
1512                         ir_node *op,  ir_mode *mode);
1513
1514 /** Constructor for a Mul node.
1515  *
1516  * @param   *db    A pointer for debug information.
1517  * @param   *irg   The IR graph the node  belongs to.
1518  * @param   *block The IR block the node belongs to.
1519  * @param   *op1   The first operand.
1520  * @param   *op2   The second operand.
1521  * @param   *mode  The mode of the operands and the result.
1522  */
1523 ir_node *new_rd_Mul    (dbg_info *db, ir_graph *irg, ir_node *block,
1524                ir_node *op1, ir_node *op2, ir_mode *mode);
1525
1526 /** Constructor for a Mulh node.
1527  *
1528  * @param   *db    A pointer for debug information.
1529  * @param   *irg   The IR graph the node  belongs to.
1530  * @param   *block The IR block the node belongs to.
1531  * @param   *op1   The first operand.
1532  * @param   *op2   The second operand.
1533  * @param   *mode  The mode of the operands and the result.
1534  */
1535 ir_node *new_rd_Mulh   (dbg_info *db, ir_graph *irg, ir_node *block,
1536                ir_node *op1, ir_node *op2, ir_mode *mode);
1537
1538 /** Constructor for a Quot node.
1539  *
1540  * @param   *db    A pointer for debug information.
1541  * @param   *irg   The IR graph the node  belongs to.
1542  * @param   *block The IR block the node belongs to.
1543  * @param   *memop The store needed to model exceptions
1544  * @param   *op1   The first operand.
1545  * @param   *op2   The second operand.
1546  * @param   *mode  The mode of the result.
1547  * @param   state  The pinned state.
1548  */
1549 ir_node *new_rd_Quot   (dbg_info *db, ir_graph *irg, ir_node *block,
1550                ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1551
1552 /** Constructor for a DivMod node.
1553  *
1554  * @param   *db    A pointer for debug information.
1555  * @param   *irg   The IR graph the node  belongs to.
1556  * @param   *block The IR block the node belongs to.
1557  * @param   *memop The store needed to model exceptions
1558  * @param   *op1   The first operand.
1559  * @param   *op2   The second operand.
1560  * @param   *mode  The mode of the results.
1561  * @param   state  The pinned state.
1562  */
1563 ir_node *new_rd_DivMod (dbg_info *db, ir_graph *irg, ir_node *block,
1564                ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1565
1566 /** Constructor for a Div node.
1567  *
1568  * @param   *db    A pointer for debug information.
1569  * @param   *irg   The IR graph the node  belongs to.
1570  * @param   *block The IR block the node belongs to.
1571  * @param   *memop The store needed to model exceptions
1572  * @param   *op1   The first operand.
1573  * @param   *op2   The second operand.
1574  * @param   *mode  The mode of the result.
1575  * @param   state  The pinned state.
1576  */
1577 ir_node *new_rd_Div    (dbg_info *db, ir_graph *irg, ir_node *block,
1578                ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1579
1580 /** Constructor for a remainderless Div node.
1581  *
1582  * @param   *db    A pointer for debug information.
1583  * @param   *irg   The IR graph the node  belongs to.
1584  * @param   *block The IR block the node belongs to.
1585  * @param   *memop The store needed to model exceptions
1586  * @param   *op1   The first operand.
1587  * @param   *op2   The second operand.
1588  * @param   *mode  The mode of the result.
1589  * @param   state  The pinned state.
1590  */
1591 ir_node *new_rd_DivRL  (dbg_info *db, ir_graph *irg, ir_node *block,
1592                ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1593
1594 /** Constructor for a Mod node.
1595  *
1596  * @param   *db    A pointer for debug information.
1597  * @param   *irg   The IR graph the node  belongs to.
1598  * @param   *block The IR block the node belongs to.
1599  * @param   *memop The store needed to model exceptions
1600  * @param   *op1   The first operand.
1601  * @param   *op2   The second operand.
1602  * @param   *mode  The mode of the result.
1603  * @param   state  The pinned state.
1604  */
1605 ir_node *new_rd_Mod    (dbg_info *db, ir_graph *irg, ir_node *block,
1606                         ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
1607
1608 /** Constructor for a Abs node.
1609  *
1610  * @param   *db    A pointer for debug information.
1611  * @param   *irg   The IR graph the node  belongs to.
1612  * @param   *block The IR block the node belongs to.
1613  * @param   *op    The operand
1614  * @param   *mode  The mode of the operands and the result.
1615  */
1616 ir_node *new_rd_Abs    (dbg_info *db, ir_graph *irg, ir_node *block,
1617                        ir_node *op, ir_mode *mode);
1618
1619 /** Constructor for a And node.
1620  *
1621  * @param   *db    A pointer for debug information.
1622  * @param   *irg   The IR graph the node  belongs to.
1623  * @param   *block The IR block the node belongs to.
1624  * @param   *op1   The first operand.
1625  * @param   *op2   The second operand.
1626  * @param   *mode  The mode of the operands and the result.
1627  */
1628 ir_node *new_rd_And    (dbg_info *db, ir_graph *irg, ir_node *block,
1629                         ir_node *op1, ir_node *op2, ir_mode *mode);
1630
1631 /** Constructor for a Or node.
1632  *
1633  * @param   *db    A pointer for debug information.
1634  * @param   *irg   The IR graph the node  belongs to.
1635  * @param   *block The IR block the node belongs to.
1636  * @param   *op1   The first operand.
1637  * @param   *op2   The second operand.
1638  * @param   *mode  The mode of the operands and the result.
1639  */
1640 ir_node *new_rd_Or     (dbg_info *db, ir_graph *irg, ir_node *block,
1641                         ir_node *op1, ir_node *op2, ir_mode *mode);
1642
1643 /** Constructor for a Eor node.
1644  *
1645  * @param   *db    A pointer for debug information.
1646  * @param   *irg   The IR graph the node  belongs to.
1647  * @param   *block The IR block the node belongs to.
1648  * @param   *op1   The first operand.
1649  * @param   *op2   The second operand.
1650  * @param   *mode  The mode of the operands and the results.
1651  */
1652 ir_node *new_rd_Eor    (dbg_info *db, ir_graph *irg, ir_node *block,
1653                         ir_node *op1, ir_node *op2, ir_mode *mode);
1654
1655 /** Constructor for a Not node.
1656  *
1657  * @param   *db    A pointer for debug information.
1658  * @param   *irg   The IR graph the node  belongs to.
1659  * @param   *block The IR block the node belongs to.
1660  * @param   *op    The operand.
1661  * @param   *mode  The mode of the operand and the result.
1662  */
1663 ir_node *new_rd_Not    (dbg_info *db, ir_graph *irg, ir_node *block,
1664                ir_node *op, ir_mode *mode);
1665
1666 /** Constructor for a Cmp node.
1667  *
1668  * @param   *db    A pointer for debug information.
1669  * @param   *irg   The IR graph the node  belongs to.
1670  * @param   *block The IR block the node belongs to.
1671  * @param   *op1   The first operand.
1672  * @param   *op2   The second operand.
1673  */
1674 ir_node *new_rd_Cmp    (dbg_info *db, ir_graph *irg, ir_node *block,
1675                ir_node *op1, ir_node *op2);
1676
1677 /** Constructor for a Shl node.
1678  *
1679  * @param   *db    A pointer for debug information.
1680  * @param   *irg   The IR graph the node  belongs to.
1681  * @param   *block The IR block the node belongs to.
1682  * @param   *op    The operand.
1683  * @param   *k     The number of bits to  shift the operand .
1684  * @param   *mode  The mode of the operand and the result.
1685  */
1686 ir_node *new_rd_Shl    (dbg_info *db, ir_graph *irg, ir_node *block,
1687                ir_node *op, ir_node *k, ir_mode *mode);
1688
1689 /** Constructor for a Shr node.
1690  *
1691  * @param   *db    A pointer for debug information.
1692  * @param   *irg   The IR graph the node  belongs to.
1693  * @param   *block The IR block the node belongs to.
1694  * @param   *op    The operand.
1695  * @param   *k     The number of bits to shift the operand .
1696  * @param   *mode  The mode of the operand and the result.
1697  */
1698 ir_node *new_rd_Shr    (dbg_info *db, ir_graph *irg, ir_node *block,
1699                ir_node *op, ir_node *k, ir_mode *mode);
1700
1701 /** Constructor for a Shrs node.
1702  *
1703  * @param   *db    A pointer for debug information.
1704  * @param   *irg   The IR graph the node  belongs to.
1705  * @param   *block The IR block the node belongs to.
1706  * @param   *op    The operand.
1707  * @param   *k     The number of bits to shift the operand.
1708  * @param   *mode  The mode of the operand and the result.
1709  */
1710 ir_node *new_rd_Shrs   (dbg_info *db, ir_graph *irg, ir_node *block,
1711                ir_node *op, ir_node *k, ir_mode *mode);
1712
1713 /** Constructor for a Rotl node.
1714  *
1715  * @param   *db    A pointer for debug information.
1716  * @param   *irg   The IR graph the node  belongs to.
1717  * @param   *block The IR block the node belongs to.
1718  * @param   *op    The operand.
1719  * @param   *k     The number of bits to rotate the operand.
1720  * @param   *mode  The mode of the operand.
1721  */
1722 ir_node *new_rd_Rotl    (dbg_info *db, ir_graph *irg, ir_node *block,
1723                ir_node *op, ir_node *k, ir_mode *mode);
1724
1725
1726 /** Constructor for a Conv node.
1727  *
1728  * @param   *db    A pointer for debug information.
1729  * @param   *irg   The IR graph the node  belongs to.
1730  * @param   *block The IR block the node belongs to.
1731  * @param   *op    The operand.
1732  * @param   *mode  The mode of this the operand muss be converted .
1733  */
1734 ir_node *new_rd_Conv   (dbg_info *db, ir_graph *irg, ir_node *block,
1735                ir_node *op, ir_mode *mode);
1736
1737 /** Constructor for a strictConv node.
1738  *
1739  * @param   *db    A pointer for debug information.
1740  * @param   *irg   The IR graph the node  belongs to.
1741  * @param   *block The IR block the node belongs to.
1742  * @param   *op    The operand.
1743  * @param   *mode  The mode of this the operand muss be converted .
1744  */
1745 ir_node *new_rd_strictConv   (dbg_info *db, ir_graph *irg, ir_node *block,
1746                ir_node *op, ir_mode *mode);
1747
1748 /** Constructor for a Cast node.
1749  *
1750  * High level type cast.
1751  *
1752  * @param   *db    A pointer for debug information.
1753  * @param   *irg   The IR graph the node  belongs to.
1754  * @param   *block The IR block the node belongs to.
1755  * @param   *op    The operand.
1756  * @param   *to_tp The type of this the operand muss be casted .
1757  */
1758 ir_node *new_rd_Cast   (dbg_info *db, ir_graph *irg, ir_node *block,
1759                         ir_node *op, ir_type *to_tp);
1760
1761 /** Constructor for a Carry node.
1762  *
1763  * @param   *db    A pointer for debug information.
1764  * @param   *irg   The IR graph the node  belongs to.
1765  * @param   *block The IR block the node belongs to.
1766  * @param   *op1   The first operand.
1767  * @param   *op2   The second operand.
1768  * @param   *mode  The mode of the operands and the result.
1769  */
1770 ir_node *new_rd_Carry  (dbg_info *db, ir_graph *irg, ir_node *block,
1771                         ir_node *op1, ir_node *op2, ir_mode *mode);
1772
1773 /** Constructor for a Borrow node.
1774  *
1775  * @param   *db    A pointer for debug information.
1776  * @param   *irg   The IR graph the node  belongs to.
1777  * @param   *block The IR block the node belongs to.
1778  * @param   *op1   The first operand.
1779  * @param   *op2   The second operand.
1780  * @param   *mode  The mode of the operands and the result.
1781  */
1782 ir_node *new_rd_Borrow (dbg_info *db, ir_graph *irg, ir_node *block,
1783                         ir_node *op1, ir_node *op2, ir_mode *mode);
1784
1785 /** Constructor for a Phi node.
1786  *
1787  * @param *db    A pointer for debug information.
1788  * @param *irg   The IR graph the node  belongs to.
1789  * @param *block The IR block the node belongs to.
1790  * @param arity  The number of predecessors
1791  * @param *in[]  Array with predecessors.  The constructor copies this array.
1792  * @param *mode  The mode of it's inputs and output.
1793  */
1794 ir_node *new_rd_Phi    (dbg_info *db, ir_graph *irg, ir_node *block, int arity,
1795                         ir_node *in[], ir_mode *mode);
1796
1797 /** Constructor for a Load node.
1798  *
1799  * @param *db    A pointer for debug information.
1800  * @param *irg   The IR graph the node  belongs to.
1801  * @param *block The IR block the node belongs to.
1802  * @param *store The current memory
1803  * @param *adr   A pointer to the variable to be read in this memory.
1804  * @param *mode  The mode of the value to be loaded.
1805  * @param  flags Additional flags for alignment, volatility and pin state.
1806  */
1807 ir_node *new_rd_Load   (dbg_info *db, ir_graph *irg, ir_node *block,
1808                         ir_node *store, ir_node *adr, ir_mode *mode, ir_cons_flags flags);
1809
1810 /** Constructor for a Store node.
1811  *
1812  * @param *db    A pointer for debug information.
1813  * @param *irg   The IR graph the node  belongs to.
1814  * @param *block The IR block the node belongs to.
1815  * @param *store The current memory
1816  * @param *adr   A pointer to the variable to be read in this memory.
1817  * @param *val   The value to write to this variable.
1818  * @param  flags Additional flags for alignment, volatility and pin state.
1819  */
1820 ir_node *new_rd_Store  (dbg_info *db, ir_graph *irg, ir_node *block,
1821                ir_node *store, ir_node *adr, ir_node *val, ir_cons_flags flags);
1822
1823 /** Constructor for a Alloc node.
1824  *
1825  * The Alloc node extends the memory by space for an entity of type alloc_type.
1826  *
1827  * @param *db         A pointer for debug information.
1828  * @param *irg        The IR graph the node  belongs to.
1829  * @param *block      The IR block the node belongs to.
1830  * @param *store      The memory which shall contain the new variable.
1831  * @param *size       The number of bytes to allocate.
1832  * @param *alloc_type The type of the allocated variable.
1833  * @param where       Where to allocate the variable, either heap_alloc or stack_alloc.
1834  */
1835 ir_node *new_rd_Alloc  (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1836                ir_node *size, ir_type *alloc_type, ir_where_alloc where);
1837
1838 /** Constructor for a Free node.
1839  *
1840  * Frees the memory occupied by the entity pointed to by the pointer
1841  * arg.  Type indicates the type of the entity the argument points to.
1842  *
1843  * @param *db         A pointer for debug information.
1844  * @param *irg        The IR graph the node  belongs to.
1845  * @param *block      The IR block the node belongs to.
1846  * @param *store      The memory which shall contain the new variable.
1847  * @param *ptr        The pointer to the object to free.
1848  * @param *size       The number of objects of type free_type to free in a sequence.
1849  * @param *free_type  The type of the freed variable.
1850  * @param where       Where the variable was allocated, either heap_alloc or stack_alloc.
1851  */
1852 ir_node *new_rd_Free   (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
1853                         ir_node *ptr, ir_node *size, ir_type *free_type, ir_where_alloc where);
1854
1855 /** Constructor for a Sync node.
1856  *
1857  * Merges several memory values.  The node assumes that a variable
1858  * either occurs only in one of the memories, or it contains the same
1859  * value in all memories where it occurs.
1860  *
1861  * @param *db       A pointer for debug information.
1862  * @param *irg      The IR graph the node  belongs to.
1863  * @param *block    The IR block the node belongs to.
1864  * @param  arity    The number of memories to synchronize.
1865  * @param  *in[]    An array of pointers to nodes that produce an output of type
1866  *                  memory.  The constructor copies this array.
1867  */
1868 ir_node *new_rd_Sync   (dbg_info *db, ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
1869
1870 /** Constructor for a Proj node.
1871  *
1872  * Projects a single value out of a tuple.  The parameter proj gives the
1873  * position of the value within the tuple.
1874  *
1875  * @param *db    A pointer for debug information.
1876  * @param *irg   The IR graph the node  belongs to.
1877  * @param *block The IR block the node belongs to.
1878  * @param arg    A node producing a tuple.  The node must have mode_T.
1879  * @param *mode  The mode of the value to project.
1880  * @param proj   The position of the value in the tuple.
1881  */
1882 ir_node *new_rd_Proj   (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1883                         ir_mode *mode, long proj);
1884
1885 /** Constructor for a defaultProj node.
1886  *
1887  * Represents the default control flow of a Switch-Cond node.
1888  *
1889  * @param *db       A pointer for debug information.
1890  * @param *irg      The IR graph the node  belongs to.
1891  * @param *block    The IR block the node belongs to.
1892  * @param arg       A node producing a tuple.
1893  * @param max_proj  The end position of the value in the tuple.
1894  */
1895 ir_node *new_rd_defaultProj (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
1896                              long max_proj);
1897
1898 /** Constructor for a Tuple node.
1899  *
1900  * This is an auxiliary node to replace a node that returns a tuple
1901  * without changing the corresponding Proj nodes.
1902  *
1903  * @param *db     A pointer for debug information.
1904  * @param *irg    The IR graph the node  belongs to.
1905  * @param *block  The IR block the node belongs to.
1906  * @param arity   The number of tuple elements.
1907  * @param *in[]   An array containing pointers to the nodes producing the tuple
1908  *                elements. The constructor copies this array.
1909  */
1910 ir_node *new_rd_Tuple  (dbg_info *db, ir_graph *irg, ir_node *block,
1911                         int arity, ir_node *in[]);
1912
1913 /** Constructor for a Id node.
1914  *
1915  * This is an auxiliary node to replace a node that returns a single
1916  * value.
1917  *
1918  * @param *db     A pointer for debug information.
1919  * @param *irg    The IR graph the node  belongs to.
1920  * @param *block  The IR block the node belongs to.
1921  * @param *val    The value
1922  * @param *mode   The mode of *val.
1923  */
1924 ir_node *new_rd_Id     (dbg_info *db, ir_graph *irg, ir_node *block,
1925                         ir_node *val, ir_mode *mode);
1926
1927 /** Constructor for a Confirm node.
1928  *
1929  * Specifies constraints for a value.  To support dataflow analyses.
1930  *
1931  * Example: If the value never exceeds '100' this is expressed by placing a
1932  * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
1933  *
1934  * @param *irg    The IR graph the node belong to.
1935  * @param *block  The IR block the node belong to.
1936  * @param *db     A pointer for debug information.
1937  * @param *val    The value we express a constraint for
1938  * @param *bound  The value to compare against. Must be a firm node, typically a constant.
1939  * @param cmp     The compare operation.
1940  */
1941 ir_node *new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block,
1942              ir_node *val, ir_node *bound, pn_Cmp cmp);
1943
1944 /** Constructor for an Unknown node.
1945  *
1946  * Represents an arbitrary value.  Places the node in the start block.
1947  *
1948  * @param *irg    The IR graph the node  belongs to.
1949  * @param *m      The mode of the unknown value.
1950  */
1951 ir_node *new_rd_Unknown(ir_graph *irg, ir_mode *m);
1952
1953 /** Constructor for a CallBegin node.
1954  *
1955  * CallBegin represents control flow depending of the pointer value
1956  * representing the called method to the called methods.  The
1957  * constructor copies the method pointer input from the passed Call
1958  * node.
1959  *
1960  * @param *db     A pointer for debug information.
1961  * @param *irg    The IR graph the node belong to.
1962  * @param *block  The block the node belong to.
1963  * @param *callee The call node visible in the intra procedural view.
1964  */
1965 ir_node *new_rd_CallBegin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *callee);
1966
1967 /** Constructor for a EndReg node.
1968  *
1969  * Used to represent regular procedure end in interprocedual view.
1970  *
1971  * @param *db     A pointer for debug information.
1972  * @param *irg    The IR graph the node belong to.
1973  * @param *block  The block the node belong to.
1974  */
1975 ir_node *new_rd_EndReg (dbg_info *db, ir_graph *irg, ir_node *block);
1976
1977 /** Constructor for a EndExcept node.
1978  *
1979  * Used to represent exceptional procedure end in interprocedural view.
1980  *
1981  * @param *db     A pointer for debug information.
1982  * @param *irg    The IR graph the node belong to.
1983  * @param *block  The block the node belong to.
1984  */
1985 ir_node *new_rd_EndExcept(dbg_info *db, ir_graph *irg, ir_node *block);
1986
1987 /** Constructor for a Filter node.
1988  *
1989  * Adds the node to the block in current_ir_block.  Filter is a node
1990  * with two views used to construct the interprocedural view.  In
1991  * intraprocedural view its semantics are identical to the Proj node.
1992  * In interprocedural view the Filter performs the Phi operation on
1993  * method parameters or results.  Other than a Phi a Filter node may
1994  * not be removed if it has only a single input.
1995  *
1996  * The constructor builds the Filter in intraprocedural view.
1997  *
1998  * @param *db     A pointer for debug information.
1999  * @param *irg    The IR graph the node belong to.
2000  * @param *block  The block the node belong to.
2001  * @param *arg  The tuple value to project from.
2002  * @param *mode The mode of the projected value.
2003  * @param proj  The position in the tuple to project from.
2004  */
2005 ir_node *new_rd_Filter (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
2006                         ir_mode *mode, long proj);
2007
2008 /** Constructor for a Mux node.
2009  *
2010  * @param *db       A pointer for debug information.
2011  * @param *irg      The IR graph the node belong to.
2012  * @param *block    The block the node belong to.
2013  * @param *sel      The ir_node that calculates the boolean select.
2014  * @param *ir_true  The ir_node that calculates the true result.
2015  * @param *ir_false The ir_node that calculates the false result.
2016  * @param *mode     The mode of the node (and it_true and ir_false).
2017  */
2018 ir_node *new_rd_Mux  (dbg_info *db, ir_graph *irg, ir_node *block,
2019     ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2020
2021 /** Constructor for a CopyB node.
2022  *
2023  * @param *db         A pointer for debug information.
2024  * @param *irg        The IR graph the node belong to.
2025  * @param *block      The block the node belong to.
2026  * @param *store      The current memory
2027  * @param *dst        The ir_node that represents the destination address.
2028  * @param *src        The ir_node that represents the source address.
2029  * @param *data_type  The type of the copied data
2030  */
2031 ir_node *new_rd_CopyB(dbg_info *db, ir_graph *irg, ir_node *block,
2032     ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
2033
2034 /** Constructor for a InstOf node.
2035  *
2036  * A High-Level Type check.
2037  *
2038  * @param   *db        A pointer for debug information.
2039  * @param   *irg       The IR graph the node  belongs to.
2040  * @param   *block     The IR block the node belongs to.
2041  * @param   *store     The memory in which the object the entity should be selected
2042  *                     from is allocated.
2043  * @param   *objptr    A pointer to a object of a class type.
2044  * @param   *type      The type of which objptr must be.
2045  */
2046 ir_node *new_rd_InstOf (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
2047                         ir_node *objptr, ir_type *type);
2048
2049 /** Constructor for a Raise node.
2050  *
2051  * A High-Level Exception throw.
2052  *
2053  * @param *db    A pointer for debug information.
2054  * @param *irg   The IR graph the node  belongs to.
2055  * @param *block The IR block the node belongs to.
2056  * @param *store The current memory.
2057  * @param *obj   A pointer to the Except variable.
2058  */
2059 ir_node *new_rd_Raise  (dbg_info *db, ir_graph *irg, ir_node *block,
2060                         ir_node *store, ir_node *obj);
2061
2062 /** Constructor for a Bound node.
2063  *
2064  * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2065  *
2066  * @param *db         A pointer for debug information.
2067  * @param *irg        The IR graph the node belong to.
2068  * @param *block      The block the node belong to.
2069  * @param *store      The current memory.
2070  * @param *idx        The ir_node that represents an index.
2071  * @param *lower      The ir_node that represents the lower bound for the index.
2072  * @param *upper      The ir_node that represents the upper bound for the index.
2073  */
2074 ir_node *new_rd_Bound(dbg_info *db, ir_graph *irg, ir_node *block,
2075     ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
2076
2077 /** Constructor for a Pin node.
2078  *
2079  * @param *db         A pointer for debug information.
2080  * @param *irg        The IR graph the node belong to.
2081  * @param *block      The block the node belong to.
2082  * @param *node       The node which value should be pinned.
2083  */
2084 ir_node *new_rd_Pin(dbg_info *db, ir_graph *irg, ir_node *block, ir_node *node);
2085
2086 /** Constructor for an ASM pseudo node.
2087  *
2088  * @param *db         A pointer for debug information.
2089  * @param *irg        The IR graph the node belong to.
2090  * @param *block      The block the node belong to.
2091  * @param arity       The number of data inputs to the node.
2092  * @param *in         The array of length arity of data inputs.
2093  * @param *inputs     The array of length arity of input constraints.
2094  * @param n_outs      The number of data outputs to the node.
2095  * @param *outputs    The array of length n_outs of output constraints.
2096  * @param n_clobber   The number of clobbered registers.
2097  * @param *clobber    The array of length n_clobber of clobbered registers.
2098  * @param *asm_text   The assembler text.
2099  */
2100 ir_node *new_rd_ASM(dbg_info *db, ir_graph *irg, ir_node *block,
2101                     int arity, ir_node *in[], ir_asm_constraint *inputs,
2102                     int n_outs, ir_asm_constraint *outputs,
2103                     int n_clobber, ident *clobber[], ident *asm_text);
2104
2105 /*-------------------------------------------------------------------------*/
2106 /* The raw interface without debug support                                 */
2107 /*-------------------------------------------------------------------------*/
2108
2109 /** Constructor for a Block node.
2110  *
2111  * Constructs a mature block with the given predecessors.  Use Unknown
2112  * nodes as predecessors to construct a block if the number of
2113  * predecessors is known, but not the predecessors themselves.  This
2114  * constructor does not set current_block.  It not be used with
2115  * automatic Phi node construction.
2116  *
2117  *
2118  * @param irg    The IR graph the block belongs to.
2119  * @param arity  The number of control predecessors.
2120  * @param in[]   An array of control predecessors.  The length of
2121  *               the array must be 'arity'. The constructor copies this array.
2122  */
2123 ir_node *new_r_Block  (ir_graph *irg,  int arity, ir_node *in[]);
2124
2125 /** Constructor for a Start node.
2126  *
2127  * @param *irg   The IR graph the node belongs to.
2128  * @param *block The IR block the node belongs to.
2129  */
2130 ir_node *new_r_Start  (ir_graph *irg, ir_node *block);
2131
2132 /** Constructor for a End node.
2133  *
2134  * @param *irg   The IR graph the node  belongs to.
2135  * @param *block The IR block the node belongs to.
2136  */
2137 ir_node *new_r_End    (ir_graph *irg, ir_node *block);
2138
2139 /** Constructor for a Jmp node.
2140  *
2141  * Jmp represents control flow to a single control successor.
2142  *
2143  * @param *irg    The IR graph the node belongs to.
2144  * @param *block  The IR block the node belongs to.
2145  */
2146 ir_node *new_r_Jmp    (ir_graph *irg, ir_node *block);
2147
2148 /** Constructor for an IJmp node.
2149  *
2150  * IJmp represents control flow to a single control successor not
2151  * statically known i.e. an indirect Jmp.
2152  *
2153  * @param *irg    The IR graph the node belongs to.
2154  * @param *block  The IR block the node belongs to.
2155  * @param *tgt    The IR node representing the target address.
2156  */
2157 ir_node *new_r_IJmp   (ir_graph *irg, ir_node *block, ir_node *tgt);
2158
2159 /** Constructor for a Cond node.
2160  *
2161  * If c is mode_b represents a conditional branch (if/else). If c is
2162  * mode_Is/mode_Iu (?) represents a switch.  (Allocates dense Cond
2163  * node, default Proj is 0.)
2164  *
2165  * This is not consistent:  Input to Cond is Is, Proj has as proj number
2166  * longs.
2167  *
2168  * @param *irg   The IR graph the node  belongs to.
2169  * @param *block The IR block the node belongs to.
2170  * @param *c     The conditions parameter.Can be of mode b or I_u.
2171  */
2172 ir_node *new_r_Cond   (ir_graph *irg, ir_node *block, ir_node *c);
2173
2174 /** Constructor for a Return node.
2175  *
2176  * Returns the memory and zero or more return values.  Only node that
2177  * can end regular control flow.
2178  *
2179  * @param *irg   The IR graph the node  belongs to.
2180  * @param *block The IR block the node belongs to.
2181  * @param *store The state of memory.
2182  * @param arity  Number of array indices.
2183  * @param *in[]   Array with index inputs to the node. The constructor copies this array.
2184  */
2185 ir_node *new_r_Return (ir_graph *irg, ir_node *block,
2186                        ir_node *store, int arity, ir_node *in[]);
2187
2188 /** Constructor for a Const node.
2189  *
2190  * Adds the node to the start block.
2191  *
2192  * Constructor for a Const node. The constant represents a target
2193  * value.  Sets the type information to type_unknown.  (No more
2194  * supported: If tv is entity derives a somehow useful type.)
2195  * Derives mode from passed tarval.
2196  *
2197  * @param *irg   The IR graph the node  belongs to.
2198  * @param *block The IR block the node belongs to.
2199  * @param *con   Points to an entry in the constant table.
2200  */
2201 ir_node *new_r_Const  (ir_graph *irg, tarval *con);
2202
2203 /** Constructor for a Const node.
2204  *
2205  * Adds the node to the start block.
2206  *
2207  * Constructor for a Const node. The constant represents a target
2208  * value.  Sets the type information to type_unknown.  (No more
2209  * supported: If tv is entity derives a somehow useful type.)
2210  *
2211  * @param *irg   The IR graph the node  belongs to.
2212  * @param *mode  The mode of the operands and the results.
2213  * @param value  A value from which the tarval is made.
2214  */
2215 ir_node *new_r_Const_long(ir_graph *irg,
2216                        ir_mode *mode, long value);
2217
2218 /** Constructor for a Const_type node.
2219  *
2220  * Adds the node to the start block.
2221  *
2222  * The constant represents a target value.  This constructor sets high
2223  * level type information for the constant value.
2224  * Derives mode from passed tarval.
2225  *
2226  * @param *irg   The IR graph the node  belongs to.
2227  * @param *con   Points to an entry in the constant table.
2228  * @param *tp    The type of the constant.
2229  */
2230 ir_node *new_r_Const_type(ir_graph *irg, tarval *con, ir_type *tp);
2231
2232 /** Constructor for a SymConst node.
2233  *
2234  *  This is the constructor for a symbolic constant.
2235  *    There are four kinds of symbolic constants:
2236  *    - type_tag  The symbolic constant represents a type tag.  The type the
2237  *                tag stands for is given explicitly.
2238  *    - size      The symbolic constant represents the size of a type.  The
2239  *                type of which the constant represents the size is given
2240  *                explicitly.
2241  *    - addr_name The symbolic constant represents the address of an entity
2242  *                (variable or method).  The variable is indicated by a name
2243  *                that is valid for linking.
2244  *    - addr_ent   The symbolic constant represents the address of an entity
2245  *                (variable or method).  The variable is given explicitly by
2246  *                a firm entity.
2247  *
2248  *    Inputs to the node:
2249  *      No inputs except the block it belongs to.
2250  *    Outputs of the node.
2251  *      An unsigned integer (I_u) or a pointer (P).
2252  *
2253  * @param *irg    The IR graph the node  belongs to.
2254  * @param *block  The IR block the node belongs to.
2255  * @param mode    The mode for the SymConst.
2256  * @param value   A type, entity or a ident depending on the SymConst kind.
2257  * @param symkind The kind of the symbolic constant: type_tag, size or link_info.
2258  */
2259 ir_node *new_r_SymConst(ir_graph *irg, ir_node *block, ir_mode *mode,
2260                         union symconst_symbol value, symconst_kind symkind);
2261
2262 /** Constructor for a simpleSel node.
2263  *
2264  *  This is a shortcut for the new_d_Sel() constructor.  To be used for
2265  *  Sel nodes that do not select from an array, i.e., have no index
2266  *  inputs.  It adds the two parameters 0, NULL.
2267  *
2268  * @param   *irg       The IR graph the node  belongs to.
2269  * @param   *block     The IR block the node belongs to.
2270  * @param   *store     The memory in which the object the entity should be selected
2271  *                     from is allocated.
2272  * @param   *objptr    The object from that the Sel operation selects a
2273  *                     single attribute out.
2274  * @param   *ent       The entity to select.
2275  */
2276 ir_node *new_r_simpleSel(ir_graph *irg, ir_node *block, ir_node *store,
2277                          ir_node *objptr, ir_entity *ent);
2278
2279 /** Constructor for a Sel node.
2280  *
2281  * The select node selects an entity (field or method) from an entity
2282  * with a compound type.  It explicitly specifies the entity selected.
2283  * Dynamically the node may select entities that overwrite the given
2284  * entity.  If the selected entity is an array element entity the Sel
2285  * node takes the required array indices as inputs.
2286  *
2287  * @param   *irg       The IR graph the node  belongs to.
2288  * @param   *block     The IR block the node belongs to.
2289  * @param   *store     The memory in which the object the entity should be selected
2290  *                     from is allocated.
2291  * @param   *objptr    A pointer to a compound entity the Sel operation selects a
2292  *                     single attribute from.
2293  * @param   *n_index   The number of array indices needed to select an array element entity.
2294  * @param   *index[]   If the compound entity is an array the indices of the selected
2295  *                     element entity.  The constructor copies this array.
2296  * @param   *ent       The entity to select.
2297  */
2298 ir_node *new_r_Sel    (ir_graph *irg, ir_node *block, ir_node *store,
2299                        ir_node *objptr, int n_index, ir_node *index[],
2300                ir_entity *ent);
2301
2302 /** Constructor for a Call node.
2303  *
2304  * Represents all kinds of method and function calls.
2305  *
2306  * @param   *irg    The IR graph the node  belongs to.
2307  * @param   *block  The IR block the node belongs to.
2308  * @param   *store  The actual store.
2309  * @param   *callee A pointer to the called procedure.
2310  * @param   arity   The number of procedure parameters.
2311  * @param   *in[]   An array with the pointers to the parameters. The constructor copies this array.
2312  * @param   *tp     Type information of the procedure called.
2313  */
2314 ir_node *new_r_Call   (ir_graph *irg, ir_node *block, ir_node *store,
2315                        ir_node *callee, int arity, ir_node *in[], ir_type *tp);
2316
2317 /** Constructor for a Builtin node.
2318  *
2319  * Represents a call of a backend-specific builtin..
2320  *
2321  * @param   *irg    The IR graph the node  belongs to.
2322  * @param   *block  The IR block the node belongs to.
2323  * @param   *store  The actual store.
2324  * @param   kind    The kind of the called builtin.
2325  * @param   arity   The number of procedure parameters.
2326  * @param   *in[]   An array with the pointers to the parameters. The constructor copies this array.
2327  * @param   *tp     Type information of the procedure called.
2328  */
2329 ir_node *new_r_Builtin(ir_graph *irg, ir_node *block, ir_node *store,
2330                        ir_builtin_kind kind, int arity, ir_node *in[], ir_type *tp);
2331
2332 /** Constructor for a Add node.
2333  *
2334  * @param   *irg   The IR graph the node  belongs to.
2335  * @param   *block The IR block the node belongs to.
2336  * @param   *op1   The first operand.
2337  * @param   *op2   The second operand.
2338  * @param   *mode  The mode of the operands and the result.
2339  */
2340 ir_node *new_r_Add    (ir_graph *irg, ir_node *block,
2341                ir_node *op1, ir_node *op2, ir_mode *mode);
2342
2343 /**
2344  * Constructor for a Sub node.
2345  *
2346  * @param   *irg   The IR graph the node  belongs to.
2347  * @param   *block The IR block the node belongs to.
2348  * @param   *op1   The first operand.
2349  * @param   *op2   The second operand.
2350  * @param   *mode  The mode of the operands and the results.
2351  */
2352 ir_node *new_r_Sub    (ir_graph *irg, ir_node *block,
2353                ir_node *op1, ir_node *op2, ir_mode *mode);
2354
2355 /** Constructor for a Minus node.
2356  *
2357  * @param   *irg   The IR graph the node  belongs to.
2358  * @param   *block The IR block the node belongs to.
2359  * @param   *op   The operand.
2360  * @param   *mode  The mode of the operand and the result.
2361  */
2362 ir_node *new_r_Minus  (ir_graph *irg, ir_node *block,
2363                ir_node *op,  ir_mode *mode);
2364
2365 /** Constructor for a Mul node.
2366  *
2367  * @param   *irg   The IR graph the node  belongs to.
2368  * @param   *block The IR block the node belongs to.
2369  * @param   *op1   The first operand.
2370  * @param   *op2   The second operand.
2371  * @param   *mode  The mode of the operands and the result.
2372  */
2373 ir_node *new_r_Mul    (ir_graph *irg, ir_node *block,
2374                ir_node *op1, ir_node *op2, ir_mode *mode);
2375
2376 /** Constructor for a Mulh node.
2377  *
2378  * @param   *irg   The IR graph the node  belongs to.
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_Mulh   (ir_graph *irg, ir_node *block,
2385                ir_node *op1, ir_node *op2, ir_mode *mode);
2386
2387 /** Constructor for a Quot node.
2388  *
2389  * @param   *irg   The IR graph the node  belongs to.
2390  * @param   *block The IR block the node belongs to.
2391  * @param   *memop The store needed to model exceptions
2392  * @param   *op1   The first operand.
2393  * @param   *op2   The second operand.
2394  * @param   *mode  The mode of the result.
2395  * @param   state  The pinned state.
2396  */
2397 ir_node *new_r_Quot   (ir_graph *irg, ir_node *block,
2398                ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2399
2400 /** Constructor for a DivMod node.
2401  *
2402  * @param   *irg   The IR graph the node  belongs to.
2403  * @param   *block The IR block the node belongs to.
2404  * @param   *memop The store needed to model exceptions
2405  * @param   *op1   The first operand.
2406  * @param   *op2   The second operand.
2407  * @param   *mode  The mode of the results.
2408  * @param   state  The pinned state.
2409  */
2410 ir_node *new_r_DivMod (ir_graph *irg, ir_node *block,
2411                ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2412
2413 /** Constructor for a Div node.
2414  *
2415  * @param   *irg   The IR graph the node  belongs to.
2416  * @param   *block The IR block the node belongs to.
2417  * @param   *memop The store needed to model exceptions
2418  * @param   *op1   The first operand.
2419  * @param   *op2   The second operand.
2420  * @param   *mode  The mode of the result.
2421  * @param   state  The pinned state.
2422  */
2423 ir_node *new_r_Div    (ir_graph *irg, ir_node *block,
2424                ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2425
2426 /** Constructor for a remainderless Div node.
2427  *
2428  * @param   *irg   The IR graph the node  belongs to.
2429  * @param   *block The IR block the node belongs to.
2430  * @param   *memop The store needed to model exceptions
2431  * @param   *op1   The first operand.
2432  * @param   *op2   The second operand.
2433  * @param   *mode  The mode of the result.
2434  * @param   state  The pinned state.
2435  */
2436 ir_node *new_r_DivRL  (ir_graph *irg, ir_node *block,
2437                ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2438
2439 /** Constructor for a Mod node.
2440  *
2441  * @param   *irg   The IR graph the node  belongs to.
2442  * @param   *block The IR block the node belongs to.
2443  * @param   *memop The store needed to model exceptions
2444  * @param   *op1   The first operand.
2445  * @param   *op2   The second operand.
2446  * @param   *mode  The mode of the result.
2447  * @param   state  The pinned state.
2448  */
2449 ir_node *new_r_Mod    (ir_graph *irg, ir_node *block,
2450                ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
2451
2452 /** Constructor for a Abs node.
2453  *
2454  * @param   *irg   The IR graph the node  belongs to.
2455  * @param   *block The IR block the node belongs to.
2456  * @param   *op    The operand
2457  * @param   *mode  The mode of the operands and the result.
2458  */
2459 ir_node *new_r_Abs    (ir_graph *irg, ir_node *block,
2460                        ir_node *op, ir_mode *mode);
2461
2462 /** Constructor for a And node.
2463  *
2464  * @param   *irg   The IR graph the node  belongs to.
2465  * @param   *block The IR block the node belongs to.
2466  * @param   *op1   The first operand.
2467  * @param   *op2   The second operand.
2468  * @param   *mode  The mode of the operands and the result.
2469  */
2470 ir_node *new_r_And    (ir_graph *irg, ir_node *block,
2471                ir_node *op1, ir_node *op2, ir_mode *mode);
2472
2473 /** Constructor for a Or node.
2474  *
2475  * @param   *irg   The IR graph the node  belongs to.
2476  * @param   *block The IR block the node belongs to.
2477  * @param   *op1   The first operand.
2478  * @param   *op2   The second operand.
2479  * @param   *mode  The mode of the operands and the result.
2480  */
2481 ir_node *new_r_Or     (ir_graph *irg, ir_node *block,
2482                ir_node *op1, ir_node *op2, ir_mode *mode);
2483
2484 /** Constructor for a Eor node.
2485  *
2486  * @param   *irg   The IR graph the node  belongs to.
2487  * @param   *block The IR block the node belongs to.
2488  * @param   *op1   The first operand.
2489  * @param   *op2   The second operand.
2490  * @param   *mode  The mode of the operands and the results.
2491  */
2492 ir_node *new_r_Eor    (ir_graph *irg, ir_node *block,
2493                ir_node *op1, ir_node *op2, ir_mode *mode);
2494
2495 /** Constructor for a Not node.
2496  *
2497  * @param   *irg   The IR graph the node  belongs to.
2498  * @param   *block The IR block the node belongs to.
2499  * @param   *op    The operand.
2500  * @param   *mode  The mode of the operand and the result.
2501  */
2502 ir_node *new_r_Not    (ir_graph *irg, ir_node *block,
2503                ir_node *op, ir_mode *mode);
2504
2505 /** Constructor for a Cmp node.
2506  *
2507  * @param   *irg   The IR graph the node  belongs to.
2508  * @param   *block The IR block the node belongs to.
2509  * @param   *op1   The first operand.
2510  * @param   *op2   The second operand.
2511  */
2512 ir_node *new_r_Cmp    (ir_graph *irg, ir_node *block,
2513                ir_node *op1, ir_node *op2);
2514
2515 /** Constructor for a Shl node.
2516  *
2517  * @param   *irg   The IR graph the node  belongs to.
2518  * @param   *block The IR block the node belongs to.
2519  * @param   *op    The operand.
2520  * @param   *k     The number of bits to  shift the operand .
2521  * @param   *mode  The mode of the operand and the result.
2522  */
2523 ir_node *new_r_Shl    (ir_graph *irg, ir_node *block,
2524                ir_node *op, ir_node *k, ir_mode *mode);
2525
2526 /** Constructor for a Shr node.
2527  *
2528  * @param   *irg   The IR graph the node  belongs to.
2529  * @param   *block The IR block the node belongs to.
2530  * @param   *op    The operand.
2531  * @param   *k     The number of bits to shift the operand .
2532  * @param   *mode  The mode of the operand and the result.
2533  */
2534 ir_node *new_r_Shr    (ir_graph *irg, ir_node *block,
2535                ir_node *op, ir_node *k, ir_mode *mode);
2536
2537 /**
2538  * Constructor for a Shrs node.
2539  *
2540  * @param   *irg   The IR graph the node  belongs to.
2541  * @param   *block The IR block the node belongs to.
2542  * @param   *op    The operand.
2543  * @param   *k     The number of bits to shift the operand.
2544  * @param   *mode  The mode of the operand and the result.
2545  */
2546 ir_node *new_r_Shrs   (ir_graph *irg, ir_node *block,
2547                ir_node *op, ir_node *k, ir_mode *mode);
2548
2549 /** Constructor for a Rotl node.
2550  *
2551  * @param   *irg   The IR graph the node  belongs to.
2552  * @param   *block The IR block the node belongs to.
2553  * @param   *op    The operand.
2554  * @param   *k     The number of bits to rotate the operand.
2555  * @param   *mode  The mode of the operand.
2556  */
2557 ir_node *new_r_Rotl   (ir_graph *irg, ir_node *block,
2558                ir_node *op, ir_node *k, ir_mode *mode);
2559
2560 /** Constructor for a Conv node.
2561  *
2562  * @param   *irg   The IR graph the node  belongs to.
2563  * @param   *block The IR block the node belongs to.
2564  * @param   *op    The operand.
2565  * @param   *mode  The mode of this the operand muss be converted .
2566  */
2567 ir_node *new_r_Conv   (ir_graph *irg, ir_node *block,
2568                ir_node *op, ir_mode *mode);
2569
2570 /** Constructor for a strict Conv node.
2571  *
2572  * @param   *irg   The IR graph the node  belongs to.
2573  * @param   *block The IR block the node belongs to.
2574  * @param   *op    The operand.
2575  * @param   *mode  The mode of this the operand muss be converted .
2576  */
2577 ir_node *new_r_strictConv   (ir_graph *irg, ir_node *block,
2578                ir_node *op, ir_mode *mode);
2579
2580 /** Constructor for a Cast node.
2581  *
2582  * High level type cast
2583  *
2584  * @param   *irg   The IR graph the node  belongs to.
2585  * @param   *block The IR block the node belongs to.
2586  * @param   *op    The operand.
2587  * @param   *to_tp The type of this the operand muss be casted .
2588  */
2589 ir_node *new_r_Cast   (ir_graph *irg, ir_node *block,
2590                ir_node *op, ir_type *to_tp);
2591
2592 /** Constructor for a Carry node.
2593  *
2594  * @param   *irg   The IR graph the node  belongs to.
2595  * @param   *block The IR block the node belongs to.
2596  * @param   *op1   The first operand.
2597  * @param   *op2   The second operand.
2598  * @param   *mode  The mode of the operands and the result.
2599  */
2600 ir_node *new_r_Carry  (ir_graph *irg, ir_node *block,
2601                ir_node *op1, ir_node *op2, ir_mode *mode);
2602
2603 /**
2604  * Constructor for a Borrow node.
2605  *
2606  * @param   *irg   The IR graph the node  belongs to.
2607  * @param   *block The IR block the node belongs to.
2608  * @param   *op1   The first operand.
2609  * @param   *op2   The second operand.
2610  * @param   *mode  The mode of the operands and the results.
2611  */
2612 ir_node *new_r_Borrow (ir_graph *irg, ir_node *block,
2613                ir_node *op1, ir_node *op2, ir_mode *mode);
2614
2615 /** Constructor for a Phi node.
2616  *
2617  * @param *irg   The IR graph the node  belongs to.
2618  * @param *block The IR block the node belongs to.
2619  * @param arity  The number of predecessors
2620  * @param *in[]    Array with predecessors. The constructor copies this array.
2621  * @param *mode  The mode of it's inputs and output.
2622  */
2623 ir_node *new_r_Phi    (ir_graph *irg, ir_node *block, int arity,
2624                        ir_node *in[], ir_mode *mode);
2625
2626 /** Constructor for a Load node.
2627  *
2628  * @param *irg   The IR graph the node  belongs to.
2629  * @param *block The IR block the node belongs to.
2630  * @param *store The current memory
2631  * @param *adr   A pointer to the variable to be read in this memory.
2632  * @param *mode  The mode of the value to be loaded.
2633  * @param  flags Additional flags for alignment, volatility and pin state.
2634  */
2635 ir_node *new_r_Load   (ir_graph *irg, ir_node *block,
2636                ir_node *store, ir_node *adr, ir_mode *mode, ir_cons_flags flags);
2637
2638 /** Constructor for a Store node.
2639  *
2640  * @param *irg   The IR graph the node  belongs to.
2641  * @param *block The IR block the node belongs to.
2642  * @param *store The current memory
2643  * @param *adr   A pointer to the variable to be read in this memory.
2644  * @param *val   The value to write to this variable.
2645  * @param  flags Additional flags for alignment, volatility and pin state.
2646  */
2647 ir_node *new_r_Store  (ir_graph *irg, ir_node *block,
2648                        ir_node *store, ir_node *adr, ir_node *val, ir_cons_flags flags);
2649
2650 /** Constructor for a Alloc node.
2651  *
2652  * The Alloc node extends the memory by space for an entity of type alloc_type.
2653  *
2654  * @param *irg        The IR graph the node  belongs to.
2655  * @param *block      The IR block the node belongs to.
2656  * @param *store      The memory which shall contain the new variable.
2657  * @param *size       The number of bytes to allocate.
2658  * @param *alloc_type The type of the allocated variable.
2659  * @param where       Where to allocate the variable, either heap_alloc or stack_alloc.
2660  */
2661 ir_node *new_r_Alloc  (ir_graph *irg, ir_node *block, ir_node *store,
2662                ir_node *size, ir_type *alloc_type, ir_where_alloc where);
2663
2664 /** Constructor for a Free node.
2665  *
2666  * Frees the memory occupied by the entity pointed to by the pointer
2667  * arg.  Type indicates the type of the entity the argument points to.
2668  *
2669  * @param *irg        The IR graph the node  belongs to.
2670  * @param *block      The IR block the node belongs to.
2671  * @param *store      The memory which shall contain the new variable.
2672  * @param *ptr        The pointer to the object to free.
2673  * @param *size       The number of objects of type free_type to free in a sequence.
2674  * @param *free_type  The type of the freed variable.
2675  * @param where       Where the variable was allocated, either heap_alloc or stack_alloc.
2676  */
2677 ir_node *new_r_Free   (ir_graph *irg, ir_node *block, ir_node *store,
2678                ir_node *ptr, ir_node *size, ir_type *free_type, ir_where_alloc where);
2679
2680 /** Constructor for a Sync node.
2681  *
2682  * Merges several memory values.  The node assumes that a variable
2683  * either occurs only in one of the memories, or it contains the same
2684  * value in all memories where it occurs.
2685  *
2686  * @param *irg      The IR graph the node  belongs to.
2687  * @param *block    The IR block the node belongs to.
2688  * @param  arity    The number of memories to synchronize.
2689  * @param  *in[]    An array of pointers to nodes that produce an output of  type memory.
2690  *                  The constructor copies this array.
2691  */
2692 ir_node *new_r_Sync (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2693
2694 /** Constructor for a Proj node.
2695  *
2696  * Projects a single value out of a tuple.  The parameter proj gives the
2697  * position of the value within the tuple.
2698  *
2699  * @param *irg   The IR graph the node  belongs to.
2700  * @param *block The IR block the node belongs to.
2701  * @param arg    A node producing a tuple.
2702  * @param *mode  The mode of the value to project.
2703  * @param proj   The position of the value in the tuple.
2704  */
2705 ir_node *new_r_Proj   (ir_graph *irg, ir_node *block, ir_node *arg,
2706                        ir_mode *mode, long proj);
2707
2708 /** Constructor for a defaultProj node.
2709  *
2710  * Represents the default control flow of a Switch-Cond node.
2711  *
2712  * @param *irg      The IR graph the node  belongs to.
2713  * @param *block    The IR block the node belongs to.
2714  * @param arg       A node producing a tuple.
2715  * @param max_proj  The end  position of the value in the tuple.
2716  */
2717 ir_node *new_r_defaultProj (ir_graph *irg, ir_node *block, ir_node *arg, long max_proj);
2718
2719
2720 /** Constructor for a Tuple node.
2721  *
2722  * This is an auxiliary node to replace a node that returns a tuple
2723  * without changing the corresponding Proj nodes.
2724  *
2725  * @param *irg    The IR graph the node  belongs to.
2726  * @param *block  The IR block the node belongs to.
2727  * @param arity   The number of tuple elements.
2728  * @param *in[]   An array containing pointers to the nodes producing the tuple elements.
2729  *                The constructor copies this array.
2730  */
2731 ir_node *new_r_Tuple  (ir_graph *irg, ir_node *block, int arity, ir_node *in[]);
2732
2733 /** Constructor for a Id node.
2734  *
2735  * This is an auxiliary node to replace a node that returns a single
2736  * value.
2737  *
2738  * @param *irg    The IR graph the node  belongs to.
2739  * @param *block  The IR block the node belongs to.
2740  * @param *val    The operand to Id.
2741  * @param *mode   The mode of *val.
2742  */
2743 ir_node *new_r_Id     (ir_graph *irg, ir_node *block,
2744                ir_node *val, ir_mode *mode);
2745
2746 /** Constructor for a Bad node.
2747  *
2748  * Returns the unique Bad node of the graph.  The same as
2749  * get_irg_bad().
2750  *
2751  * @param *irg    The IR graph the node  belongs to.
2752  *
2753  */
2754 ir_node *new_r_Bad    (ir_graph *irg);
2755
2756 /** Constructor for a Confirm node.
2757  *
2758  * Specifies constraints for a value.  To support dataflow analyses.
2759  *
2760  * Example: If the value never exceeds '100' this is expressed by placing a
2761  * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
2762  *
2763  * @param *irg    The IR graph the node belong to.
2764  * @param *block  The IR block the node belong to.
2765  * @param *val    The value we express a constraint for
2766  * @param *bound  The value to compare against. Must be a firm node, typically a constant.
2767  * @param cmp     The compare operation.
2768  */
2769 ir_node *new_r_Confirm(ir_graph *irg, ir_node *block,
2770             ir_node *val, ir_node *bound, pn_Cmp cmp);
2771
2772 /** Constructor for a Unknown node.
2773  *
2774  * Represents an arbitrary value.  Places the node in
2775  * the start block.
2776  *
2777  * @param *irg    The IR graph the node  belongs to.
2778  * @param *m      The mode of the unknown value.
2779  */
2780 ir_node *new_r_Unknown(ir_graph *irg, ir_mode *m);
2781
2782 /** Constructor for a CallBegin node.
2783  *
2784  * CallBegin represents control flow depending of the pointer value
2785  * representing the called method to the called methods.  The
2786  * constructor copies the method pointer input from the passed Call
2787  * node.
2788  *
2789  * @param *irg    The IR graph the node belong to.
2790  * @param *block  The block the node belong to.
2791  * @param *callee The call node visible in the  intra procedural view.
2792  */
2793 ir_node *new_r_CallBegin(ir_graph *irg, ir_node *block, ir_node *callee);
2794
2795 /** Constructor for a EndReg node.
2796  *
2797  * Used to represent regular procedure end in interprocedual view.
2798  *
2799  * @param *irg    The IR graph the node belong to.
2800  * @param *block  The block the node belong to.
2801  */
2802 ir_node *new_r_EndReg (ir_graph *irg, ir_node *block);
2803
2804 /** Constructor for a EndExcept node.
2805  *
2806  * Used to represent exceptional procedure end in interprocedural view.
2807  *
2808  * @param *irg    The IR graph the node belong to.
2809  * @param *block  The block the node belong to.
2810  */
2811 ir_node *new_r_EndExcept(ir_graph *irg, ir_node *block);
2812
2813 /** Constructor for a Break node.
2814  *
2815  * Break represents control flow to a single control successor just as Jmp.
2816  * The blocks separated by a break may not be concatenated by an optimization.
2817  * It is used for the interprocedural representation where blocks are parted
2818  * behind Call nodes to represent the control flow to called procedures.
2819  *
2820  * @param *irg    The IR graph the node belong to.
2821  * @param *block  The block the node belong to.
2822  */
2823 ir_node *new_r_Break  (ir_graph *irg, ir_node *block);
2824
2825 /** Constructor for a Filter node.
2826  *
2827  * Constructor for a Filter node. Adds the node to the block in current_ir_block.
2828  * Filter is a node with two views used to construct the interprocedural view.
2829  * In intraprocedural view its semantics are identical to the Proj node.
2830  * In interprocedural view the Filter performs the Phi operation on method
2831  * parameters or results.  Other than a Phi a Filter node may not be removed
2832  * if it has only a single input.
2833  *
2834  * The constructor builds the Filter in intraprocedural view.
2835  *
2836  * @param *irg    The IR graph the node belong to.
2837  * @param *block  The block the node belong to.
2838  * @param *arg  The tuple value to project from.
2839  * @param *mode The mode of the projected value.
2840  * @param proj  The position in the tuple to project from.
2841  */
2842 ir_node *new_r_Filter (ir_graph *irg, ir_node *block, ir_node *arg,
2843                ir_mode *mode, long proj);
2844
2845 /** Constructor for a NoMem node.
2846  *
2847  * Returns the unique NoMem node of the graph.  The same as
2848  * get_irg_no_mem().
2849  *
2850  * @param *irg    The IR graph the node belongs to.
2851  */
2852 ir_node *new_r_NoMem  (ir_graph *irg);
2853
2854 /** Constructor for a Mux node.
2855  *
2856  * @param *irg      The IR graph the node belong to.
2857  * @param *block    The block the node belong to.
2858  * @param *sel      The ir_node that calculates the boolean select.
2859  * @param *ir_true  The ir_node that calculates the true result.
2860  * @param *ir_false The ir_node that calculates the false result.
2861  * @param *mode     The mode of the node (and it_true and ir_false).
2862  */
2863 ir_node *new_r_Mux  (ir_graph *irg, ir_node *block,
2864     ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
2865
2866 /** Constructor for a CopyB node.
2867  *
2868  * @param *irg        The IR graph the node belong to.
2869  * @param *block      The block the node belong to.
2870  * @param *store      The current memory
2871  * @param *dst        The ir_node that represents the destination address.
2872  * @param *src        The ir_node that represents the source address.
2873  * @param *data_type  The type of the copied data
2874  */
2875 ir_node *new_r_CopyB(ir_graph *irg, ir_node *block,
2876     ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
2877
2878 /** Constructor for a InstOf node.
2879  *
2880  * A High-Level Type check.
2881  *
2882  * @param   *irg       The IR graph the node  belongs to.
2883  * @param   *block     The IR block the node belongs to.
2884  * @param   *store     The memory in which the object the entity should be selected
2885  *                     from is allocated.
2886  * @param   *objptr    A pointer to a object of a class type.
2887  * @param   *type      The type of which objptr must be.
2888  */
2889 ir_node *new_r_InstOf(ir_graph *irg, ir_node *block, ir_node *store,
2890                       ir_node *objptr, ir_type *type);
2891
2892 /** Constructor for a Raise node.
2893  *
2894  * A High-Level Exception throw.
2895  *
2896  * @param *irg   The IR graph the node  belongs to.
2897  * @param *block The IR block the node belongs to.
2898  * @param *store The current memory.
2899  * @param *obj   A pointer to the Except variable.
2900  */
2901 ir_node *new_r_Raise(ir_graph *irg, ir_node *block,
2902                      ir_node *store, ir_node *obj);
2903
2904 /** Constructor for a Bound node.
2905  *
2906  * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
2907  *
2908  * @param *irg        The IR graph the node belong to.
2909  * @param *block      The block the node belong to.
2910  * @param *store      The current memory.
2911  * @param *idx        The ir_node that represents an index.
2912  * @param *lower      The ir_node that represents the lower bound for the index.
2913  * @param *upper      The ir_node that represents the upper bound for the index.
2914  */
2915 ir_node *new_r_Bound(ir_graph *irg, ir_node *block,
2916     ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
2917
2918 /** Constructor for a Pin node.
2919  *
2920  * @param *irg        The IR graph the node belong to.
2921  * @param *block      The block the node belong to.
2922  * @param *node       The node which value should be pinned.
2923  */
2924 ir_node *new_r_Pin(ir_graph *irg, ir_node *block, ir_node *node);
2925
2926 /** Constructor for an ASM pseudo node.
2927  *
2928  * @param *irg        The IR graph the node belong to.
2929  * @param *block      The block the node belong to.
2930  * @param arity       The number of data inputs to the node.
2931  * @param *in         The array of length arity of data inputs.
2932  * @param *inputs     The array of length arity of input constraints.
2933  * @param n_outs      The number of data outputs to the node.
2934  * @param *outputs    The array of length n_outs of output constraints.
2935  * @param n_clobber   The number of clobbered registers.
2936  * @param *clobber    The array of length n_clobber of clobbered registers.
2937  * @param *asm_text   The assembler text.
2938  */
2939 ir_node *new_r_ASM(ir_graph *irg, ir_node *block,
2940                    int arity, ir_node *in[], ir_asm_constraint *inputs,
2941                    int n_outs, ir_asm_constraint *outputs,
2942                    int n_clobber, ident *clobber[], ident *asm_text);
2943
2944 /*-----------------------------------------------------------------------*/
2945 /* The block oriented interface                                          */
2946 /*-----------------------------------------------------------------------*/
2947
2948 /** Sets the current block in which the following constructors place the
2949  *  nodes they construct.
2950  *
2951  *  @param target  The new current block.
2952  */
2953 void     set_cur_block (ir_node *target);
2954
2955 /** Returns the current block of the current graph. */
2956 ir_node *get_cur_block(void);
2957
2958 /** Returns the fixed nodes  of the current graph. */
2959 #define get_cur_end_block()   get_irg_end_block(current_ir_graph)
2960 #define get_cur_end()         get_irg_end(current_ir_graph)
2961 #define get_cur_start_block() get_irg_start_block(current_ir_graph)
2962 #define get_cur_start()       get_irg_start(current_ir_graph)
2963
2964 /** Constructor for a Block node.
2965  *
2966  * Adds the block to the graph in current_ir_graph. Constructs a Block
2967  * with a fixed number of predecessors.  Does set current_block.  Can
2968  * be used with automatic Phi node construction.
2969  *
2970  * @param *db    A Pointer for debug information.
2971  * @param arity  The number of control predecessors.
2972  * @param in[]   An array of control predecessors.  The length of
2973  *               the array must be 'arity'.
2974  */
2975 ir_node *new_d_Block(dbg_info *db, int arity, ir_node *in[]);
2976
2977 /** Constructor for a Start node.
2978  *
2979  * Adds the node to the block in current_ir_block.
2980  *
2981  * @param *db    A pointer for debug information.
2982  */
2983 ir_node *new_d_Start  (dbg_info *db);
2984
2985 /** Constructor for a End node.
2986  *
2987  * Adds the node to the block in current_ir_block.
2988  *
2989  * @param *db     A pointer for debug information.
2990  */
2991 ir_node *new_d_End    (dbg_info *db);
2992
2993 /** Constructor for a Jmp node.
2994  *
2995  * Adds the node to the block in current_ir_block.
2996  *
2997  * Jmp represents control flow to a single control successor.
2998  *
2999  * @param *db     A pointer for debug information.
3000  */
3001 ir_node *new_d_Jmp    (dbg_info *db);
3002
3003 /** Constructor for an IJmp node.
3004  *
3005  * IJmp represents control flow to a single control successor not
3006  * statically known i.e. an indirect Jmp.
3007  *
3008  * @param *db     A pointer for debug information.
3009  * @param *tgt    The IR node representing the target address.
3010  */
3011 ir_node *new_d_IJmp   (dbg_info *db, ir_node *tgt);
3012
3013 /** Constructor for a Cond node.
3014  *
3015  * Adds the node to the block in current_ir_block.
3016  *
3017  * If c is mode_b represents a conditional branch (if/else). If c is
3018  * mode_Is/mode_Iu (?) represents a switch.  (Allocates dense Cond
3019  * node, default Proj is 0.)
3020  *
3021  * This is not consistent:  Input to Cond is Is, Proj has as proj number
3022  * longs.
3023  *
3024  * @param *db    A pointer for debug information.
3025  * @param *c     The conditions parameter.Can be of mode b or I_u.
3026  */
3027 ir_node *new_d_Cond   (dbg_info *db, ir_node *c);
3028
3029 /** Constructor for a Return node.
3030  *
3031  * Adds the node to the block in current_ir_block.
3032  *
3033  * Returns the memory and zero or more return values.  Only node that
3034  * can end regular control flow.
3035  *
3036  * @param *db    A pointer for debug information.
3037  * @param *store The state of memory.
3038  * @param arity  Number of array indices.
3039  * @param *in    Array with index inputs to the node.
3040  */
3041 ir_node *new_d_Return (dbg_info *db, ir_node *store, int arity, ir_node *in[]);
3042
3043 /** Constructor for a Const_type node.
3044  *
3045  * Adds the node to the start block.
3046  *
3047  * The constant represents a target value.  This constructor sets high
3048  * level type information for the constant value.
3049  * Derives mode from passed tarval.
3050  *
3051  * @param *db    A pointer for debug information.
3052  * @param *con   Points to an entry in the constant table. This pointer is
3053                  added to the attributes of the node.
3054  * @param *tp    The type of the constant.
3055  */
3056 ir_node *new_d_Const_type (dbg_info *db, tarval *con, ir_type *tp);
3057
3058 /** Constructor for a Const node.
3059  *
3060  * Adds the node to the block in current_ir_block.
3061  *
3062  * Constructor for a Const node. The constant represents a target
3063  * value.  Sets the type information to type_unknown.  (No more
3064  * supported: If tv is entity derives a somehow useful type.)
3065  * Derives mode from passed tarval.
3066  *
3067  * @param *db    A pointer for debug information.
3068  * @param *con   Points to an entry in the constant table. This pointer is added
3069  *               to the attributes of the node.
3070  */
3071 ir_node *new_d_Const  (dbg_info *db, tarval *con);
3072
3073 /** Constructor for a SymConst_type node.
3074  *
3075  *  Adds the node to the block in current_ir_block.
3076  *  This is the constructor for a symbolic constant.
3077  *    There are four kinds of symbolic constants:
3078  *    - type_tag  The symbolic constant represents a type tag.  The type the
3079  *                tag stands for is given explicitly.
3080  *    - size      The symbolic constant represents the size of a type.  The
3081  *                type of which the constant represents the size is given
3082  *                explicitly.
3083  *    - addr_name The symbolic constant represents the address of an entity
3084  *                (variable or method).  The variable is indicated by a name
3085  *                that is valid for linking.
3086  *    - addr_ent   The symbolic constant represents the address of an entity
3087  *                (variable or method).  The variable is given explicitly by
3088  *                a firm entity.
3089  *
3090  *    Inputs to the node:
3091  *      No inputs except the block it belongs to.
3092  *    Outputs of the node.
3093  *      An unsigned integer (I_u) or a pointer (P).
3094  *
3095  * @param *db     A pointer for debug information.
3096  * @param mode    The mode for the SymConst.
3097  * @param value   A type, entity or ident depending on the SymConst kind.
3098  * @param kind    The kind of the symbolic constant: symconst_type_tag, symconst_type_size,
3099  *                symconst_type_align, symconst_addr_name or symconst_addr_ent.
3100  * @param tp      The source type of the constant.
3101  */
3102 ir_node *new_d_SymConst_type(dbg_info *db, ir_mode *mode,
3103                              union symconst_symbol value, symconst_kind kind, ir_type *tp);
3104
3105 /** Constructor for a SymConst node.
3106  *
3107  *  Same as new_d_SymConst_type, except that it sets the type to type_unknown.
3108  */
3109 ir_node *new_d_SymConst(dbg_info *db, ir_mode *mode,
3110                         union symconst_symbol value, symconst_kind kind);
3111
3112 /** Constructor for a simpleSel node.
3113  *
3114  *  This is a shortcut for the new_d_Sel() constructor.  To be used for
3115  *  Sel nodes that do not select from an array, i.e., have no index
3116  *  inputs.  It adds the two parameters 0, NULL.
3117  *
3118  * @param   *db        A pointer for debug information.
3119  * @param   *store     The memory in which the object the entity should be
3120  *                     selected from is allocated.
3121  * @param   *objptr    The object from that the Sel operation selects a
3122  *                     single attribute out.
3123  * @param   *ent       The entity to select.
3124  */
3125 ir_node *new_d_simpleSel(dbg_info *db, ir_node *store, ir_node *objptr, ir_entity *ent);
3126
3127 /** Constructor for a Sel node.
3128  *
3129  * The select node selects an entity (field or method) from an entity
3130  * with a compound type.  It explicitly specifies the entity selected.
3131  * Dynamically the node may select entities that overwrite the given
3132  * entity.  If the selected entity is an array element entity the Sel
3133  * node takes the required array indices as inputs.
3134  * Adds the node to the block in current_ir_block.
3135  *
3136  * @param   *db        A pointer for debug information.
3137  * @param   *store     The memory in which the object the entity should be selected
3138  *                     from is allocated.
3139  * @param   *objptr    A pointer to a compound entity the Sel operation selects a
3140  *                     single attribute from.
3141  * @param   arity      The number of array indices needed to select an array element entity.
3142  * @param   *in[]      If the compound entity is an array the indices of the selected
3143  *                     element entity.  The constructor copies this array.
3144  * @param   *ent       The entity to select.
3145  */
3146 ir_node *new_d_Sel    (dbg_info *db, ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3147                        ir_entity *ent);
3148
3149 /** Constructor for a Call node.
3150  *
3151  * Represents all kinds of method and function calls.
3152  * Adds the node to the block in current_ir_block.
3153  *
3154  * @param   *db     A pointer for debug information.
3155  * @param   *store  The actual store.
3156  * @param   *callee A pointer to the called procedure.
3157  * @param   arity   The number of procedure parameters.
3158  * @param   *in[]   An array with the pointers to the parameters. The constructor copies this array.
3159  * @param   *tp     Type information of the procedure called.
3160  */
3161 ir_node *new_d_Call   (dbg_info *db, ir_node *store, ir_node *callee, int arity, ir_node *in[],
3162                        ir_type *tp);
3163
3164 /** Constructor for a Builtin node.
3165  *
3166  * Represents a call of a backend-specific builtin..
3167  * Adds the node to the block in current_ir_block.
3168  *
3169  * @param   *db     A pointer for debug information.
3170  * @param   *store  The actual store.
3171  * @param   kind    The kind of the called builtin.
3172  * @param   arity   The number of procedure parameters.
3173  * @param   *in[]   An array with the pointers to the parameters. The constructor copies this array.
3174  * @param   *tp     Type information of the procedure called.
3175  */
3176 ir_node *new_d_Builtin(dbg_info *db, ir_node *store, ir_builtin_kind kind, int arity, ir_node *in[],
3177                        ir_type *tp);
3178
3179 /** Constructor for a Add node.
3180  *
3181  * Adds the node to the block in current_ir_block.
3182  *
3183  * @param   *db    A pointer for debug information.
3184  * @param   *op1   The first operand.
3185  * @param   *op2   The second operand.
3186  * @param   *mode  The mode of the operands and the result.
3187  */
3188 ir_node *new_d_Add    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3189
3190 /** Constructor for a Sub node.
3191  *
3192  * Adds the node to the block in current_ir_block.
3193  *
3194  * @param   *db    A pointer for debug information.
3195  * @param   *op1   The first operand.
3196  * @param   *op2   The second operand.
3197  * @param   *mode  The mode of the operands and the result.
3198  */
3199 ir_node *new_d_Sub    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3200
3201 /** Constructor for a Minus node.
3202  *
3203  * Adds the node to the block in current_ir_block.
3204  *
3205  * @param   *db    A pointer for debug information.
3206  * @param   *op    The operand .
3207  * @param   *mode  The mode of the operand and the result.
3208  */
3209 ir_node *new_d_Minus  (dbg_info *db, ir_node *op,  ir_mode *mode);
3210
3211 /** Constructor for a Mul node.
3212  *
3213  * Adds the node to the block in current_ir_block.
3214  *
3215  * @param   *db    A pointer for debug information.
3216  * @param   *op1   The first operand.
3217  * @param   *op2   The second operand.
3218  * @param   *mode  The mode of the operands and the result.
3219  */
3220 ir_node *new_d_Mul    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3221
3222 /** Constructor for a Mulh node.
3223  *
3224  * Adds the node to the block in current_ir_block.
3225  *
3226  * @param   *db    A pointer for debug information.
3227  * @param   *op1   The first operand.
3228  * @param   *op2   The second operand.
3229  * @param   *mode  The mode of the operands and the result.
3230  */
3231 ir_node *new_d_Mulh   (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3232
3233 /** Constructor for a Quot node.
3234  *
3235  * Adds the node to the block in current_ir_block.
3236  *
3237  * @param   *db    A pointer for debug information.
3238  * @param   *memop The store needed to model exceptions
3239  * @param   *op1   The first operand.
3240  * @param   *op2   The second operand.
3241  * @param   *mode  The mode of the result.
3242  * @param   state  The pinned state.
3243  */
3244 ir_node *new_d_Quot   (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3245
3246 /** Constructor for a DivMod node.
3247  *
3248  * Adds the node to the block in current_ir_block.
3249  *
3250  * @param   *db    A pointer for debug information.
3251  * @param   *memop The store needed to model exceptions
3252  * @param   *op1   The first operand.
3253  * @param   *op2   The second operand.
3254  * @param   *mode  The mode of the results.
3255  * @param   state  The pinned state.
3256  */
3257 ir_node *new_d_DivMod (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3258
3259 /** Constructor for a Div node.
3260  *
3261  * Adds the node to the block in current_ir_block.
3262  *
3263  * @param   *db    A pointer for debug information.
3264  * @param   *memop The store needed to model exceptions
3265  * @param   *op1   The first operand.
3266  * @param   *op2   The second operand.
3267  * @param   *mode  The mode of the result.
3268  * @param   state  The pinned state.
3269  */
3270 ir_node *new_d_Div    (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3271
3272 /** Constructor for a remainderless Div node.
3273  *
3274  * Adds the node to the block in current_ir_block.
3275  *
3276  * @param   *db    A pointer for debug information.
3277  * @param   *memop The store needed to model exceptions
3278  * @param   *op1   The first operand.
3279  * @param   *op2   The second operand.
3280  * @param   *mode  The mode of the result.
3281  * @param   state  The pinned state.
3282  */
3283 ir_node *new_d_DivRL  (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3284
3285 /** Constructor for a Mod node.
3286  *
3287  * Adds the node to the block in current_ir_block.
3288  *
3289  * @param   *db    A pointer for debug information.
3290  * @param   *memop The store needed to model exceptions
3291  * @param   *op1   The first operand.
3292  * @param   *op2   The second operand.
3293  * @param   *mode  The mode of the result.
3294  * @param   state  The pinned state.
3295  */
3296 ir_node *new_d_Mod    (dbg_info *db, ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
3297
3298 /** Constructor for a Abs node.
3299  *
3300  * Adds the node to the block in current_ir_block.
3301  *
3302  * @param   *db    A pointer for debug information.
3303  * @param   *op    The operand
3304  * @param   *mode  The mode of the operands and the result.
3305  */
3306 ir_node *new_d_Abs    (dbg_info *db, ir_node *op,                ir_mode *mode);
3307
3308 /** Constructor for a And node.
3309  *
3310  * Adds the node to the block in current_ir_block.
3311  *
3312  * @param   *db    A pointer for debug information.
3313  * @param   *op1   The first operand.
3314  * @param   *op2   The second operand.
3315  * @param   *mode  The mode of the operands and the result.
3316  */
3317 ir_node *new_d_And    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3318
3319 /** Constructor for a Or node.
3320  *
3321  * Adds the node to the block in current_ir_block.
3322  *
3323  * @param   *db    A pointer for debug information.
3324  * @param   *op1   The first operand.
3325  * @param   *op2   The second operand.
3326  * @param   *mode  The mode of the operands and the result.
3327  */
3328 ir_node *new_d_Or     (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3329
3330 /** Constructor for a Eor node.
3331  *
3332  * Adds the node to the block in current_ir_block.
3333  *
3334  * @param   *db    A pointer for debug information.
3335  * @param   *op1   The first operand.
3336  * @param   *op2   The second operand.
3337  * @param   *mode  The mode of the operands and the results.
3338  */
3339 ir_node *new_d_Eor    (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3340
3341 /** Constructor for a Not node.
3342  *
3343  * Adds the node to the block in current_ir_block.
3344  *
3345  * @param   *db    A pointer for debug information.
3346  * @param   *op    The operand.
3347  * @param   *mode  The mode of the operand and the result.
3348  */
3349 ir_node *new_d_Not    (dbg_info *db, ir_node *op,                ir_mode *mode);
3350
3351 /** Constructor for a Shl node.
3352  *
3353  * Adds the node to the block in current_ir_block.
3354  *
3355  * @param   *db    A pointer for debug information.
3356  * @param   *op    The operand.
3357  * @param   *k     The number of bits to  shift the operand .
3358  * @param   *mode  The mode of the operand and the result.
3359  */
3360 ir_node *new_d_Shl    (dbg_info *db, ir_node *op,  ir_node *k,   ir_mode *mode);
3361
3362 /** Constructor for a Shr node.
3363  *
3364  * Adds the node to the block in current_ir_block.
3365  *
3366  * @param   *db    A pointer for debug information.
3367  * @param   *op    The operand.
3368  * @param   *k     The number of bits to  shift the operand .
3369  * @param   *mode  The mode of the operand and the result.
3370  */
3371 ir_node *new_d_Shr    (dbg_info *db, ir_node *op,  ir_node *k,   ir_mode *mode);
3372
3373 /** Constructor for a Shrs node.
3374  *
3375  * Adds the node to the block in current_ir_block.
3376  *
3377  * @param   *db    A pointer for debug information.
3378  * @param   *op    The operand.
3379  * @param   *k     The number of bits to  shift the operand .
3380  * @param   *mode  The mode of the operand and the result.
3381  */
3382 ir_node *new_d_Shrs   (dbg_info *db, ir_node *op,  ir_node *k,   ir_mode *mode);
3383
3384 /** Constructor for a Rotl node.
3385  *
3386  * Adds the node to the block in current_ir_block.
3387  *
3388  * @param   *db    A pointer for debug information.
3389  * @param   *op    The operand.
3390  * @param   *k     The number of bits to rotate the operand.
3391  * @param   *mode  The mode of the operand.
3392  */
3393 ir_node *new_d_Rotl   (dbg_info *db, ir_node *op,  ir_node *k,   ir_mode *mode);
3394
3395 /** Constructor for a Cmp node.
3396  *
3397  * Adds the node to the block in current_ir_block.
3398  *
3399  * @param   *db    A pointer for debug information.
3400  * @param   *op1   The first operand.
3401  * @param   *op2   The second operand.
3402  */
3403 ir_node *new_d_Cmp    (dbg_info *db, ir_node *op1, ir_node *op2);
3404
3405 /** Constructor for a Conv node.
3406  *
3407  * Adds the node to the block in current_ir_block.
3408  *
3409  * @param   *db    A pointer for debug information.
3410  * @param   *op    The operand.
3411  * @param   *mode  The mode of this the operand muss be converted .
3412  */
3413 ir_node *new_d_Conv   (dbg_info *db, ir_node *op, ir_mode *mode);
3414
3415 /** Constructor for a strict Conv node.
3416  *
3417  * Adds the node to the block in current_ir_block.
3418  *
3419  * @param   *db    A pointer for debug information.
3420  * @param   *op    The operand.
3421  * @param   *mode  The mode of this the operand muss be converted .
3422  */
3423 ir_node *new_d_strictConv   (dbg_info *db, ir_node *op, ir_mode *mode);
3424
3425 /** Constructor for a Cast node.
3426  *
3427  * High level type cast
3428  * Adds the node to the block in current_ir_block.
3429  *
3430  * @param   *db    A pointer for debug information.
3431  * @param   *op    The operand.
3432  * @param   *to_tp The type of this the operand muss be casted .
3433  */
3434 ir_node *new_d_Cast   (dbg_info *db, ir_node *op, ir_type *to_tp);
3435
3436 /** Constructor for a Carry node.
3437  *
3438  * Adds the node to the block in current_ir_block.
3439  *
3440  * @param   *db    A pointer for debug information.
3441  * @param   *op1   The first operand.
3442  * @param   *op2   The second operand.
3443  * @param   *mode  The mode of the operands and the result.
3444  */
3445 ir_node *new_d_Carry  (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3446
3447 /** Constructor for a Borrow node.
3448  *
3449  * Adds the node to the block in current_ir_block.
3450  *
3451  * @param   *db    A pointer for debug information.
3452  * @param   *op1   The first operand.
3453  * @param   *op2   The second operand.
3454  * @param   *mode  The mode of the operands and the result.
3455  */
3456 ir_node *new_d_Borrow (dbg_info *db, ir_node *op1, ir_node *op2, ir_mode *mode);
3457
3458 /** Constructor for a Phi node.
3459  *
3460  * Adds the node to the block in current_ir_block.
3461  *
3462  * @param *db    A pointer for debug information.
3463  * @param arity  The number of predecessors
3464  * @param *in    Array with predecessors
3465  * @param *mode  The mode of it's inputs and output.
3466  */
3467 ir_node *new_d_Phi    (dbg_info *db, int arity, ir_node *in[], ir_mode *mode);
3468
3469 /** Constructor for a Load node.
3470  *
3471  * Adds the node to the block in current_ir_block.
3472  *
3473  * @param *db    A pointer for debug information.
3474  * @param *store The current memory
3475  * @param *addr  A pointer to the variable to be read in this memory.
3476  * @param *mode  The mode of the value to be loaded.
3477  * @param  flags Additional flags for alignment, volatility and pin state.
3478  */
3479 ir_node *new_d_Load(dbg_info *db, ir_node *store, ir_node *addr, ir_mode *mode, ir_cons_flags flags);
3480
3481 /** Constructor for a Store node.
3482  *
3483  * Adds the node to the block in current_ir_block.
3484  *
3485  * @param *db    A pointer for debug information.
3486  * @param *store The current memory
3487  * @param *addr  A pointer to the variable to be read in this memory.
3488  * @param *val   The value to write to this variable.
3489  * @param  flags Additional flags for alignment, volatility and pin state.
3490  */
3491 ir_node *new_d_Store(dbg_info *db, ir_node *store, ir_node *addr, ir_node *val, ir_cons_flags flags);
3492
3493 /** Constructor for a Alloc node.
3494  *
3495  * The Alloc node extends the memory by space for an entity of type alloc_type.
3496  * Adds the node to the block in current_ir_block.
3497  *
3498  * @param *db         A pointer for debug information.
3499  * @param *store      The memory which shall contain the new variable.
3500  * @param *size       The number of bytes to allocate.
3501  * @param *alloc_type The type of the allocated variable.
3502  * @param where       Where to allocate the variable, either heap_alloc or stack_alloc.
3503  */
3504 ir_node *new_d_Alloc  (dbg_info *db, ir_node *store, ir_node *size, ir_type *alloc_type,
3505                        ir_where_alloc where);
3506
3507  /** Constructor for a Free node.
3508  *
3509  * Frees the memory occupied by the entity pointed to by the pointer
3510  * arg.  Type indicates the type of the entity the argument points to.
3511  * Adds the node to the block in current_ir_block.
3512  *
3513  * @param *db         A pointer for debug information.
3514  * @param *store      The memory which shall contain the new variable.
3515  * @param *ptr        The pointer to the object to free.
3516  * @param *size       The number of objects of type free_type to free in a sequence.
3517  * @param *free_type  The type of the freed variable.
3518  * @param where       Where the variable was allocated, either heap_alloc or stack_alloc.
3519  */
3520 ir_node *new_d_Free   (dbg_info *db, ir_node *store, ir_node *ptr, ir_node *size,
3521              ir_type *free_type, ir_where_alloc where);
3522
3523 /** Constructor for a Sync node.
3524  *
3525  * Merges several memory values.  The node assumes that a variable
3526  * either occurs only in one of the memories, or it contains the same
3527  * value in all memories where it occurs.
3528  * Adds the node to the block in current_ir_block.
3529  *
3530  * @param *db       A pointer for debug information.
3531  * @param  arity    The number of memories to synchronize.
3532  * @param  **in     An array of pointers to nodes that produce an output of type
3533  *                  memory.  The constructor copies this array.
3534  */
3535 ir_node *new_d_Sync   (dbg_info *db, int arity, ir_node *in[]);
3536
3537 /** Constructor for a Proj node.
3538  *
3539  * Projects a single value out of a tuple.  The parameter proj gives the
3540  * position of the value within the tuple.
3541  * Adds the node to the block in current_ir_block.
3542  *
3543  * @param *db    A pointer for deubug information.
3544  * @param arg    A node producing a tuple.
3545  * @param *mode  The mode of the value to project.
3546  * @param proj   The position of the value in the tuple.
3547  */
3548 ir_node *new_d_Proj   (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3549
3550 /** Constructor for a defaultProj node.
3551  *
3552  * Represents the default control flow of a Switch-Cond node.
3553  * Adds the node to the block in current_ir_block.
3554  *
3555  * @param *db       A pointer for debug information.
3556  * @param arg       A node producing a tuple.
3557  * @param max_proj  The end  position of the value in the tuple.
3558  */
3559 ir_node *new_d_defaultProj (dbg_info *db, ir_node *arg, long max_proj);
3560
3561 /** Constructor for a Tuple node.
3562  *
3563  * This is an auxiliary node to replace a node that returns a tuple
3564  * without changing the corresponding Proj nodes.
3565  * Adds the node to the block in current_ir_block.
3566  *
3567  * @param *db     A pointer for debug information.
3568  * @param arity   The number of tuple elements.
3569  * @param **in    An array containing pointers to the nodes producing the tuple elements.
3570  */
3571 ir_node *new_d_Tuple  (dbg_info *db, int arity, ir_node *in[]);
3572
3573 /** Constructor for a Id node.
3574  *
3575  * This is an auxiliary node to replace a node that returns a single
3576  * value. Adds the node to the block in current_ir_block.
3577  *
3578  * @param *db     A pointer for debug information.
3579  * @param *val    The operand to Id.
3580  * @param *mode   The mode of *val.
3581  */
3582 ir_node *new_d_Id     (dbg_info *db, ir_node *val, ir_mode *mode);
3583
3584 /** Constructor for a Confirm node.
3585  *
3586  * Constructor for a Confirm node. Adds the node to the block in current_ir_block.
3587  * Specifies constraints for a value.  To support dataflow analyses.
3588  *
3589  * Example: If the value never exceeds '100' this is expressed by placing a
3590  * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
3591  *
3592  * @param *db     A pointer for debug information.
3593  * @param *val    The value we express a constraint for
3594  * @param *bound  The value to compare against. Must be a firm node, typically a constant.
3595  * @param cmp     The compare operation.
3596  */
3597 ir_node *new_d_Confirm (dbg_info *db, ir_node *val, ir_node *bound, pn_Cmp cmp);
3598
3599 /** Constructor for an Unknown node.
3600  *
3601  * Represents an arbitrary value.  Places the node in
3602  * the start block.
3603  *
3604  * @param *m      The mode of the unknown value.
3605  */
3606 ir_node *new_d_Unknown(ir_mode *m);
3607
3608 /** Constructor for a CallBegin node.
3609  *
3610  * CallBegin represents control flow depending of the pointer value
3611  * representing the called method to the called methods.  The
3612  * constructor copies the method pointer input from the passed Call
3613  * node.Adds the node to the block in current_ir_block.
3614  *
3615  * @param *db     A pointer for debug information.
3616  * @param *callee The call node visible in the  intra procedural view.
3617  */
3618 ir_node *new_d_CallBegin(dbg_info *db, ir_node *callee);
3619
3620 /** Constructor for an EndReg node.
3621  *
3622  *Adds the node to the block in current_ir_block.
3623  *
3624  * @param *db     A pointer for debug information.
3625  */
3626 ir_node *new_d_EndReg (dbg_info *db);
3627
3628 /** Constructor for an EndExcept node.
3629  *
3630  * Used to represent regular procedure end in interprocedual view.
3631  * Adds the node to the block in current_ir_block.
3632  *
3633  * @param *db     A pointer for debug information.
3634  */
3635 ir_node *new_d_EndExcept(dbg_info *db);
3636
3637 /** Constructor for a Break node.
3638  *
3639  * Used to represent exceptional procedure end in interprocedural view.
3640  * Adds the node to the block in current_ir_block.
3641  *
3642  * Break represents control flow to a single control successor just as Jmp.
3643  * The blocks separated by a break may not be concatenated by an optimization.
3644  * It is used for the interprocedural representation where blocks are parted
3645  * behind Call nodes to represent the control flow to called procedures.
3646  *
3647  * @param *db     A pointer for debug information.
3648  */
3649 ir_node *new_d_Break (dbg_info *db);
3650
3651 /** Constructor for a Filter node.
3652  *
3653  * Constructor for a Filter node. Adds the node to the block in
3654  * current_ir_block.  Filter is a node with two views used to
3655  * construct the interprocedural view.  In intraprocedural view its
3656  * semantics are identical to the Proj node.  In interprocedural view
3657  * the Filter performs the Phi operation on method parameters or
3658  * results.  Other than a Phi a Filter node may not be removed if it
3659  * has only a single input.
3660  *
3661  * The constructor builds the Filter in intraprocedural view.
3662  *
3663  * @param *db   A pointer for debug information.
3664  * @param *arg  The tuple value to project from.
3665  * @param *mode The mode of the projected value.
3666  * @param proj  The position in the tuple to project from.
3667  */
3668 ir_node *new_d_Filter (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
3669
3670 /** Constructor for a Mux node.
3671  *
3672  * @param *db       A pointer for debug information.
3673  * @param *sel      The ir_node that calculates the boolean select.
3674  * @param *ir_true  The ir_node that calculates the true result.
3675  * @param *ir_false The ir_node that calculates the false result.
3676  * @param *mode     The mode of the node (and it_true and ir_false).
3677  */
3678 ir_node *new_d_Mux  (dbg_info *db, ir_node *sel,
3679     ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
3680
3681 /** Constructor for a CopyB node.
3682  *
3683  * @param *db         A pointer for debug information.
3684  * @param *store      The current memory
3685  * @param *dst        The ir_node that represents the destination address.
3686  * @param *src        The ir_node that represents the source address.
3687  * @param *data_type  The type of the copied data
3688  */
3689 ir_node *new_d_CopyB(dbg_info *db, ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
3690
3691 /** Constructor for a InstOf node.
3692  *
3693  * A High-Level Type check.
3694  *
3695  * @param   *db        A pointer for debug information.
3696  * @param   *store     The memory in which the object the entity should be selected
3697  *                     from is allocated.
3698  * @param   *objptr    A pointer to a object of a class type.
3699  * @param   *type      The type of which objptr must be.
3700  */
3701 ir_node *new_d_InstOf (dbg_info *db, ir_node *store, ir_node *objptr, ir_type *type);
3702
3703 /** Constructor for a Raise node.
3704  *
3705  * A High-Level Exception throw.
3706  *
3707  * @param *db    A pointer for debug information.
3708  * @param *store The current memory.
3709  * @param *obj   A pointer to the Except variable.
3710  */
3711 ir_node *new_d_Raise  (dbg_info *db, ir_node *store, ir_node *obj);
3712
3713 /** Constructor for a Bound node.
3714  *
3715  * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
3716  *
3717  * @param *db         A pointer for debug information.
3718  * @param *store      The current memory
3719  * @param *idx        The ir_node that represents an index.
3720  * @param *lower      The ir_node that represents the lower bound for the index.
3721  * @param *upper      The ir_node that represents the upper bound for the index.
3722  */
3723 ir_node *new_d_Bound(dbg_info *db, ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
3724
3725 /** Constructor for a Pin node.
3726  *
3727  * @param *db         A pointer for debug information.
3728  * @param *node       The node which value should be pinned.
3729  */
3730 ir_node *new_d_Pin(dbg_info *db, ir_node *node);
3731
3732 /** Constructor for an ASM pseudo node.
3733  *
3734  * @param *db         A pointer for debug information.
3735  * @param arity       The number of data inputs to the node.
3736  * @param *in         The array of length arity of data inputs.
3737  * @param *inputs     The array of length arity of input constraints.
3738  * @param n_outs      The number of data outputs to the node.
3739  * @param *outputs    The array of length n_outs of output constraints.
3740  * @param n_clobber   The number of clobbered registers.
3741  * @param *clobber    The array of length n_clobber of clobbered registers.
3742  * @param *asm_text   The assembler text.
3743  */
3744 ir_node *new_d_ASM(dbg_info *db, int arity, ir_node *in[], ir_asm_constraint *inputs,
3745                    int n_outs, ir_asm_constraint *outputs,
3746                    int n_clobber, ident *clobber[], ident *asm_text);
3747
3748 /*-----------------------------------------------------------------------*/
3749 /* The block oriented interface without debug support                    */
3750 /*-----------------------------------------------------------------------*/
3751
3752 /* Needed from the interface with debug support:
3753 void set_cur_block (ir_node *target);   */
3754
3755 /** Constructor for a Block node.
3756  *
3757  * Constructor for a Block node. Adds the block to the graph in
3758  * current_ir_graph.  Constructs a Block with a fixed number of
3759  * predecessors.  Does set current_block.  Can be used with automatic
3760  * Phi node construction.
3761  *
3762  * @param arity  The number of control predecessors.
3763  * @param in     An array of control predecessors.  The length of
3764  *               the array must be 'arity'.
3765  */
3766 ir_node *new_Block(int arity, ir_node *in[]);
3767
3768 /** Constructor for a Start node.
3769  *
3770  * Adds the node to the block in current_ir_block.
3771  *
3772  */
3773 ir_node *new_Start  (void);
3774
3775 /** Constructor for an End node.
3776  *
3777  * Adds the node to the block in current_ir_block.
3778  */
3779 ir_node *new_End    (void);
3780
3781 /** Constructor for an EndReg node.
3782  *
3783  * Used to represent regular procedure end in interprocedual view.
3784  * Adds the node to the block in current_ir_block.
3785  */
3786 ir_node *new_EndReg (void);
3787
3788 /** Constructor for an EndExpcept node.
3789  *
3790  *  Used to represent exceptional procedure end in interprocedural view.
3791  *  Adds the node to the block in current_ir_block.
3792  */
3793 ir_node *new_EndExcept(void);
3794
3795 /** Constructor for a Jump node.
3796  *
3797  * Adds the node to the block in current_ir_block.
3798  *
3799  * Jmp represents control flow to a single control successor.
3800  */
3801 ir_node *new_Jmp    (void);
3802
3803 /** Constructor for an IJmp node.
3804  *
3805  * IJmp represents control flow to a single control successor not
3806  * statically known i.e. an indirect Jmp.
3807  *
3808  * @param *tgt    The IR node representing the target address.
3809  */
3810 ir_node *new_IJmp   (ir_node *tgt);
3811
3812 /** Constructor for a Break node.
3813  * Break represents control flow to a single control successor just as Jmp.
3814  * The blocks separated by a break may not be concatenated by an optimization.
3815  * It is used for the interprocedural representation where blocks are parted
3816  * behind Call nodes to represent the control flow to called procedures.
3817  * Adds the node to the block in current_ir_block.
3818  */
3819 ir_node *new_Break  (void);
3820
3821 /** Constructor for a Cond node.
3822  *
3823  * If c is mode_b represents a conditional branch (if/else). If c is
3824  * mode_Is/mode_Iu (?) represents a switch.  (Allocates dense Cond
3825  * node, default Proj is 0.). Adds the node to the block in current_ir_block.
3826  *
3827  * This is not consistent:  Input to Cond is Is, Proj has as proj number
3828  * longs.
3829  *
3830  *
3831  * @param *c     The conditions parameter.Can be of mode b or I_u.
3832  */
3833 ir_node *new_Cond   (ir_node *c);
3834
3835 /** Constructor for a Return node.
3836  *
3837  * Returns the memory and zero or more return values.  Only node that
3838  * can end regular control flow. Adds the node to the block in current_ir_block.
3839  *
3840  * @param *store The state of memory.
3841  * @param arity  Number of array indices.
3842  * @param *in    Array with index inputs to the node.
3843  */
3844 ir_node *new_Return (ir_node *store, int arity, ir_node *in[]);
3845
3846 /** Constructor for a Const node.
3847  *
3848  * Constructor for a Const node. The constant represents a target
3849  * value.  Sets the type information to type_unknown.  (No more
3850  * supported: If tv is entity derives a somehow useful type.)
3851  * Adds the node to the block in current_ir_block.
3852  * Derives mode from passed tarval.
3853  *
3854  * @param *con   Points to an entry in the constant table. This pointer is
3855  *               added to the attributes of  the node.
3856  */
3857 ir_node *new_Const (tarval *con);
3858
3859 /**
3860  * Make a const from a long.
3861  * This is just convenience for the usual
3862  * <code>
3863  * new_Const(mode, tarval_from_long(mode, ...))
3864  * </code>
3865  * pain.
3866  * @param mode The mode for the const.
3867  * @param value The value of the constant.
3868  * @return A new const node.
3869  */
3870 ir_node *new_Const_long(ir_mode *mode, long value);
3871
3872 /** Constructor for a Const node.
3873  *
3874  * Derives mode from passed tarval. */
3875 ir_node *new_Const_type(tarval *con, ir_type *tp);
3876
3877 /** Constructor for a SymConst node.
3878  *
3879  * Adds the node to the block in current_ir_block.
3880  * This is the constructor for a symbolic constant.
3881  * There are four kinds of symbolic constants:
3882  *    -# type_tag  The symbolic constant represents a type tag.  The type the
3883  *                 tag stands for is given explicitly.
3884  *    -# size      The symbolic constant represents the size of a type.  The
3885  *                 type of which the constant represents the size is given
3886  *                 explicitly.
3887  *    -# align     The symbolic constant represents the alignment of a type.  The
3888  *                 type of which the constant represents the size is given
3889  *                 explicitly.
3890  *    -# addr_name The symbolic constant represents the address of an entity
3891  *                 (variable or method).  The variable is indicated by a name
3892  *                 that is valid for linking.
3893  *    -# addr_ent  The symbolic constant represents the address of an entity
3894  *                 (variable or method).  The variable is given explicitly by
3895  *                 a firm entity.
3896  *
3897  *    Inputs to the node:
3898  *      No inputs except the block it belongs to.
3899  *    Outputs of the node.
3900  *      An unsigned integer (I_u) or a pointer (P).
3901  *
3902  * @param mode    The mode for the SymConst.
3903  * @param value   A type or a ident depending on the SymConst kind.
3904  * @param kind    The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3905  *                symconst_type_align, symconst_addr_name or symconst_addr_ent.
3906  * @param tp      The source type of the constant.
3907  */
3908 ir_node *new_SymConst_type(ir_mode *mode, union symconst_symbol value, symconst_kind kind, ir_type *tp);
3909
3910 /** Constructor for a SymConst node.
3911  *
3912  * Adds the node to the block in current_ir_block.
3913  * This is the constructor for a symbolic constant.
3914  * There are four kinds of symbolic constants:
3915  *    -# type_tag  The symbolic constant represents a type tag.  The type the
3916  *                 tag stands for is given explicitly.
3917  *    -# size      The symbolic constant represents the size of a type.  The
3918  *                 type of which the constant represents the size is given
3919  *                 explicitly.
3920  *    -# align     The symbolic constant represents the alignment of a type.  The
3921  *                 type of which the constant represents the size is given
3922  *                 explicitly.
3923  *    -# addr_name The symbolic constant represents the address of an entity
3924  *                 (variable or method).  The variable is indicated by a name
3925  *                 that is valid for linking.
3926  *    -# addr_ent  The symbolic constant represents the address of an entity
3927  *                 (variable or method).  The variable is given explicitly by
3928  *                 a firm entity.
3929  *
3930  *    Inputs to the node:
3931  *      No inputs except the block it belongs to.
3932  *    Outputs of the node.
3933  *      An unsigned integer (I_u) or a pointer (P).
3934  *
3935  * @param mode    The mode for the SymConst.
3936  * @param value   A type or a ident depending on the SymConst kind.
3937  * @param kind    The kind of the symbolic constant: symconst_type_tag, symconst_type_size
3938  *                symconst_type_align, symconst_addr_name or symconst_addr_ent.
3939  */
3940 ir_node *new_SymConst(ir_mode *mode, union symconst_symbol value, symconst_kind kind);
3941
3942 /** Constructor for a simpelSel node.
3943  *
3944  *  This is a shortcut for the new_Sel() constructor.  To be used for
3945  *  Sel nodes that do not select from an array, i.e., have no index
3946  *  inputs.  It adds the two parameters 0, NULL.
3947  *
3948  * @param   *store     The memory in which the object the entity should be selected from is allocated.
3949  * @param   *objptr    The object from that the Sel operation selects a single attribute out.
3950  * @param   *ent       The entity to select.
3951  */
3952 ir_node *new_simpleSel(ir_node *store, ir_node *objptr, ir_entity *ent);
3953
3954 /** Constructor for a Sel node.
3955  *
3956  * The select node selects an entity (field or method) from an entity
3957  * with a compound type.  It explicitly specifies the entity selected.
3958  * Dynamically the node may select entities that overwrite the given
3959  * entity.  If the selected entity is an array element entity the Sel
3960  * node takes the required array indices as inputs.
3961  * Adds the node to the block in current_ir_block.
3962  *
3963  * @param   *store     The memory in which the object the entity should be selected
3964  *                     from is allocated.
3965  * @param   *objptr    A pointer to a compound entity the Sel operation selects a
3966  *                     single attribute from.
3967  * @param   arity      The number of array indices needed to select an array element entity.
3968  * @param   *in[]      If the compound entity is an array the indices of the selected
3969  *                     element entity.  The constructor copies this array.
3970  * @param   *ent       The entity to select.
3971  */
3972 ir_node *new_Sel    (ir_node *store, ir_node *objptr, int arity, ir_node *in[],
3973                      ir_entity *ent);
3974
3975 /** Constructor for a Call node.
3976  *
3977  * Adds the node to the block in current_ir_block.
3978  * Represents all kinds of method and function calls.
3979  *
3980  * @param   *store  The actual store.
3981  * @param   *callee A pointer to the called procedure.
3982  * @param   arity   The number of procedure parameters.
3983  * @param   *in[]   An array with the pointers to the parameters. The constructor copies this array.
3984  * @param   *tp     Type information of the procedure called.
3985  */
3986 ir_node *new_Call   (ir_node *store, ir_node *callee, int arity, ir_node *in[],
3987                      ir_type *tp);
3988
3989 /** Constructor for a Builtin node.
3990  *
3991  * Represents a call of a backend-specific builtin..
3992  * Represents all kinds of method and function calls.
3993  *
3994  * @param   *store  The actual store.
3995  * @param   kind    The kind of the called builtin.
3996  * @param   arity   The number of procedure parameters.
3997  * @param   *in[]   An array with the pointers to the parameters. The constructor copies this array.
3998  * @param   *tp     Type information of the procedure called.
3999  */
4000 ir_node *new_Builtin(ir_node *store, ir_builtin_kind kind, int arity, ir_node *in[],
4001                      ir_type *tp);
4002
4003 /** Constructor for a CallBegin node.
4004  *
4005  * CallBegin represents control flow depending of the pointer value
4006  * representing the called method to the called methods.  The
4007  * constructor copies the method pointer input from the passed Call
4008  * node. Adds the node to the block in current_ir_block.
4009  *
4010  * @param   *callee A pointer to the called procedure.
4011  */
4012 ir_node *new_CallBegin(ir_node *callee);
4013
4014 /** Constructor for a Add node.
4015  *
4016  * Adds the node to the block in current_ir_block.
4017  *
4018  * @param   *op1   The first operand.
4019  * @param   *op2   The second operand.
4020  * @param   *mode  The mode of the operands and the result.
4021  */
4022 ir_node *new_Add    (ir_node *op1, ir_node *op2, ir_mode *mode);
4023
4024 /** Constructor for a Sub node.
4025  *
4026  * Adds the node to the block in current_ir_block.
4027  *
4028  * @param   *op1   The first operand.
4029  * @param   *op2   The second operand.
4030  * @param   *mode  The mode of the operands and the result.
4031  */
4032 ir_node *new_Sub    (ir_node *op1, ir_node *op2, ir_mode *mode);
4033
4034 /** Constructor for a Minus node.
4035  *
4036  * Adds the node to the block in current_ir_block.
4037  *
4038  * @param   *op    The operand .
4039  * @param   *mode  The mode of the operand and the result.
4040  */
4041 ir_node *new_Minus  (ir_node *op,  ir_mode *mode);
4042
4043 /**
4044  * Constructor for a Mul node. Adds the node to the block in current_ir_block.
4045  *
4046  * @param   *op1   The first operand.
4047  * @param   *op2   The second operand.
4048  * @param   *mode  The mode of the operands and the result.
4049  */
4050 ir_node *new_Mul    (ir_node *op1, ir_node *op2, ir_mode *mode);
4051
4052 /**
4053  * Constructor for a Mulh node. Adds the node to the block in current_ir_block.
4054  *
4055  * @param   *op1   The first operand.
4056  * @param   *op2   The second operand.
4057  * @param   *mode  The mode of the operands and the result.
4058  */
4059 ir_node *new_Mulh   (ir_node *op1, ir_node *op2, ir_mode *mode);
4060
4061 /** Constructor for a Quot node.
4062  *
4063  * Adds the node to the block in current_ir_block.
4064  *
4065  * @param   *memop The store needed to model exceptions
4066  * @param   *op1   The first operand.
4067  * @param   *op2   The second operand.
4068  * @param   *mode  The mode of the result.
4069  * @param   state  The pinned state.
4070  */
4071 ir_node *new_Quot   (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
4072
4073 /** Constructor for a DivMod node.
4074  *
4075  * Adds the node to the block in current_ir_block.
4076  *
4077  * @param   *memop The store needed to model exceptions
4078  * @param   *op1   The first operand.
4079  * @param   *op2   The second operand.
4080  * @param   *mode  The mode of the results.
4081  * @param   state  The pinned state.
4082  */
4083 ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
4084
4085 /** Constructor for a Div node.
4086  *
4087  * Adds the node to the block in current_ir_block.
4088  *
4089  * @param   *memop The store needed to model exceptions
4090  * @param   *op1   The first operand.
4091  * @param   *op2   The second operand.
4092  * @param   *mode  The mode of the result.
4093  * @param   state  The pinned state.
4094  */
4095 ir_node *new_Div    (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
4096
4097 /** Constructor for a remainderless Div node.
4098  *
4099  * Adds the node to the block in current_ir_block.
4100  *
4101  * @param   *memop The store needed to model exceptions
4102  * @param   *op1   The first operand.
4103  * @param   *op2   The second operand.
4104  * @param   *mode  The mode of the result.
4105  * @param   state  The pinned state.
4106  */
4107 ir_node *new_DivRL  (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
4108
4109 /** Constructor for a Mod node.
4110  *
4111  * Adds the node to the block in current_ir_block.
4112  *
4113  * @param   *memop The store needed to model exceptions
4114  * @param   *op1   The first operand.
4115  * @param   *op2   The second operand.
4116  * @param   *mode  The mode of the result.
4117  * @param   state  The pinned state.
4118  */
4119 ir_node *new_Mod    (ir_node *memop, ir_node *op1, ir_node *op2, ir_mode *mode, op_pin_state state);
4120
4121 /** Constructor for a Abs node.
4122  *
4123  * Adds the node to the block in current_ir_block.
4124  *
4125  * @param   *op    The operand
4126  * @param   *mode  The mode of the operands and the result.
4127  */
4128 ir_node *new_Abs    (ir_node *op,                ir_mode *mode);
4129
4130 /** Constructor for a And node.
4131  *
4132  * Adds the node to the block in current_ir_block.
4133  *
4134  * @param   *op1   The first operand.
4135  * @param   *op2   The second operand.
4136  * @param   *mode  The mode of the operands and the result.
4137  */
4138 ir_node *new_And    (ir_node *op1, ir_node *op2, ir_mode *mode);
4139
4140 /**
4141  * Constructor for a Or node. Adds the node to the block in current_ir_block.
4142  *
4143  * @param   *op1   The first operand.
4144  * @param   *op2   The second operand.
4145  * @param   *mode  The mode of the operands and the result.
4146  */
4147 ir_node *new_Or     (ir_node *op1, ir_node *op2, ir_mode *mode);
4148
4149 /**
4150  * Constructor for a Eor node. Adds the node to the block in current_ir_block.
4151  *
4152  * @param   *op1   The first operand.
4153  * @param   *op2   The second operand.
4154  * @param   *mode  The mode of the operands and the results.
4155  */
4156 ir_node *new_Eor    (ir_node *op1, ir_node *op2, ir_mode *mode);
4157
4158 /** Constructor for a Not node.
4159  *
4160  * Adds the node to the block in current_ir_block.
4161  *
4162  * @param   *op    The operand.
4163  * @param   *mode  The mode of the operand and the result.
4164  */
4165 ir_node *new_Not    (ir_node *op,                ir_mode *mode);
4166
4167 /** Constructor for a Shl node.
4168  *
4169  * Adds the node to the block in current_ir_block.
4170  *
4171  * @param   *op    The operand.
4172  * @param   *k     The number of bits to  shift the operand .
4173  * @param   *mode  The mode of the operand and the result.
4174  */
4175 ir_node *new_Shl    (ir_node *op,  ir_node *k,   ir_mode *mode);
4176
4177 /**
4178  * Constructor for a Shr node. Adds the node to the block in current_ir_block.
4179  *
4180  * @param   *op    The operand.
4181  * @param   *k     The number of bits to  shift the operand .
4182  * @param   *mode  The mode of the operand and the result.
4183  */
4184 ir_node *new_Shr    (ir_node *op,  ir_node *k,   ir_mode *mode);
4185
4186 /** Constructor for a Shrs node.
4187  *
4188  * Adds the node to the block in current_ir_block.
4189  *
4190  * @param   *op    The operand.
4191  * @param   *k     The number of bits to  shift the operand .
4192  * @param   *mode  The mode of the operand and the result.
4193  */
4194 ir_node *new_Shrs   (ir_node *op,  ir_node *k,   ir_mode *mode);
4195
4196 /** Constructor for a Rotl node.
4197  *
4198  * Adds the node to the block in current_ir_block.
4199  *
4200  * @param   *op    The operand.
4201  * @param   *k     The number of bits to rotate the operand.
4202  * @param   *mode  The mode of the operand.
4203  */
4204 ir_node *new_Rotl   (ir_node *op,  ir_node *k,   ir_mode *mode);
4205
4206 /** Constructor for a Cmp node.
4207  *
4208  * Adds the node to the block in current_ir_block.
4209  *
4210  * @param   *op1   The first operand.
4211  * @param   *op2   The second operand.
4212  */
4213 ir_node *new_Cmp    (ir_node *op1, ir_node *op2);
4214
4215 /** Constructor for a Conv node.
4216  *
4217  * Adds the node to the block in current_ir_block.
4218  *
4219  * @param   *op          The operand.
4220  * @param   *mode        The mode of this the operand muss be converted.
4221  */
4222 ir_node *new_Conv   (ir_node *op, ir_mode *mode);
4223
4224 /** Constructor for a strict Conv node.
4225  *
4226  * Adds the node to the block in current_ir_block.
4227  *
4228  * @param   *op          The operand.
4229  * @param   *mode        The mode of this the operand muss be converted.
4230  */
4231 ir_node *new_strictConv   (ir_node *op, ir_mode *mode);
4232
4233 /** Constructor for a Cast node.
4234  *
4235  * Adds the node to the block in current_ir_block.
4236  * High level type cast
4237  *
4238  * @param   *op    The operand.
4239  * @param   *to_tp The type of this the operand muss be casted .
4240  */
4241 ir_node *new_Cast   (ir_node *op, ir_type *to_tp);
4242
4243 /** Constructor for a Carry node.
4244  *
4245  * Adds the node to the block in current_ir_block.
4246  *
4247  * @param   *op1   The first operand.
4248  * @param   *op2   The second operand.
4249  * @param   *mode  The mode of the operands and the result.
4250  */
4251 ir_node *new_Carry  (ir_node *op1, ir_node *op2, ir_mode *mode);
4252
4253 /** Constructor for a Borrow node.
4254  *
4255  * Adds the node to the block in current_ir_block.
4256  *
4257  * @param   *op1   The first operand.
4258  * @param   *op2   The second operand.
4259  * @param   *mode  The mode of the operands and the result.
4260  */
4261 ir_node *new_Borrow (ir_node *op1, ir_node *op2, ir_mode *mode);
4262
4263 /** Constructor for a Phi node.
4264  *
4265  * Adds the node to the block in current_ir_block.
4266  *
4267  * @param arity  The number of predecessors.
4268  * @param *in    Array with predecessors.
4269  * @param *mode  The mode of it's inputs and output.
4270  */
4271 ir_node *new_Phi    (int arity, ir_node *in[], ir_mode *mode);
4272
4273 /** Constructor for a Load node.
4274  *
4275  * @param *store  The current memory.
4276  * @param *addr   A pointer to the variable to be read in this memory.
4277  * @param *mode   The mode of the value to be loaded.
4278  * @param  flags  Additional flags for alignment, volatility and pin state.
4279  */
4280 ir_node *new_Load(ir_node *store, ir_node *addr, ir_mode *mode, ir_cons_flags flags);
4281
4282 /** Constructor for a Store node.
4283  *
4284  * @param *store  The current memory.
4285  * @param *addr   A pointer to the variable to be read in this memory.
4286  * @param *val    The value to write to this variable.
4287  * @param  flags  Additional flags for alignment, volatility and pin state.
4288  */
4289 ir_node *new_Store(ir_node *store, ir_node *addr, ir_node *val, ir_cons_flags flags);
4290
4291 /** Constructor for a Alloc node.
4292  *
4293  * The Alloc node extends the memory by space for an entity of type alloc_type.
4294  * Adds the node to the block in current_ir_block.
4295  *
4296  * @param *store      The memory which shall contain the new variable.
4297  * @param *size       The number of bytes to allocate.
4298  * @param *alloc_type The type of the allocated variable.
4299  * @param where       Where to allocate the variable, either heap_alloc or stack_alloc.
4300  */
4301 ir_node *new_Alloc  (ir_node *store, ir_node *size, ir_type *alloc_type,
4302                      ir_where_alloc where);
4303
4304 /** Constructor for a Free node.
4305  *
4306  * Frees the memory occupied by the entity pointed to by the pointer
4307  * arg.  Type indicates the type of the entity the argument points to.
4308  * Adds the node to the block in current_ir_block.
4309  *
4310  * @param *store      The memory which shall contain the new variable.
4311  * @param *ptr        The pointer to the object to free.
4312  * @param *size       The number of objects of type free_type to free in a sequence.
4313  * @param *free_type  The type of the freed variable.
4314  * @param where       Where the variable was allocated, either heap_alloc or stack_alloc.
4315  */
4316 ir_node *new_Free   (ir_node *store, ir_node *ptr, ir_node *size,
4317                              ir_type *free_type, ir_where_alloc where);
4318
4319 /** Constructor for a Sync node.
4320  *
4321  * Merges several memory values.  The node assumes that a variable
4322  * either occurs only in one of the memories, or it contains the same
4323  * value in all memories where it occurs.
4324  * Adds the node to the block in current_ir_block.
4325  *
4326  * @param  arity    The number of memories to synchronize.
4327  * @param  **in     An array of pointers to nodes that produce an output of type
4328  *                  memory.  The constructor copies this array.
4329  */
4330 ir_node *new_Sync   (int arity, ir_node *in[]);
4331
4332 /** Constructor for a Proj node.
4333  *
4334  * Projects a single value out of a tuple.  The parameter proj gives the
4335  * position of the value within the tuple.
4336  * Adds the node to the block in current_ir_block.
4337  *
4338  * @param arg    A node producing a tuple.
4339  * @param *mode  The mode of the value to project.
4340  * @param proj   The position of the value in the tuple.
4341  */
4342 ir_node *new_Proj   (ir_node *arg, ir_mode *mode, long proj);
4343
4344 /** Constructor for a Filter node.
4345  *
4346  * Constructor for a Filter node. Adds the node to the block in current_ir_block.
4347  * Filter is a node with two views used to construct the interprocedural view.
4348  * In intraprocedural view its semantics are identical to the Proj node.
4349  * In interprocedural view the Filter performs the Phi operation on method
4350  * parameters or results.  Other than a Phi a Filter node may not be removed
4351  * if it has only a single input.
4352  *
4353  * The constructor builds the Filter in intraprocedural view.
4354  *
4355  * @param *arg  The tuple value to project from.
4356  * @param *mode The mode of the projected value.
4357  * @param proj  The position in the tuple to project from.
4358  */
4359 ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj);
4360
4361 /** Constructor for a defaultProj node.
4362  *
4363  * Represents the default control flow of a Switch-Cond node.
4364  * Adds the node to the block in current_ir_block.
4365  *
4366  * @param arg       A node producing a tuple.
4367  * @param max_proj  The end  position of the value in the tuple.
4368  */
4369 ir_node *new_defaultProj (ir_node *arg, long max_proj);
4370
4371 /** Constructor for a Tuple node.
4372  *
4373  * This is an auxiliary node to replace a node that returns a tuple
4374  * without changing the corresponding Proj nodes.
4375  * Adds the node to the block in current_ir_block.
4376  *
4377  * @param arity   The number of tuple elements.
4378  * @param **in    An array containing pointers to the nodes producing the tuple elements.
4379  */
4380 ir_node *new_Tuple  (int arity, ir_node *in[]);
4381
4382 /** Constructor for an Id node.
4383  *
4384  * This is an auxiliary node to replace a node that returns a single
4385  * value. Adds the node to the block in current_ir_block.
4386  *
4387  * @param *val    The operand to Id.
4388  * @param *mode   The mode of *val.
4389  */
4390 ir_node *new_Id     (ir_node *val, ir_mode *mode);
4391
4392 /** Constructor for a Bad node.
4393  *
4394  * Returns the unique Bad node of the graph.  The same as
4395  * get_irg_bad().
4396  */
4397 ir_node *new_Bad    (void);
4398
4399 /** Constructor for a Confirm node.
4400  *
4401  * Specifies constraints for a value.  To support dataflow analyses.
4402  * Adds the node to the block in current_ir_block.
4403  *
4404  * Example: If the value never exceeds '100' this is expressed by placing a
4405  * Confirm node val = new_d_Confirm(db, val, 100, '<=') on the dataflow edge.
4406  *
4407  * @param *val    The value we express a constraint for
4408  * @param *bound  The value to compare against. Must be a firm node, typically a constant.
4409  * @param cmp     The compare operation.
4410  */
4411 ir_node *new_Confirm (ir_node *val, ir_node *bound, pn_Cmp cmp);
4412
4413 /** Constructor for an Unknown node.
4414  *
4415  * Represents an arbitrary value.  Places the node in
4416  * the start block.
4417  *
4418  * @param *m      The mode of the unknown value.
4419  */
4420 ir_node *new_Unknown(ir_mode *m);
4421
4422 /** Constructor for a NoMem node.
4423  *
4424  * Returns the unique NoMem node of the graph.  The same as
4425  * get_irg_no_mem().
4426  */
4427 ir_node *new_NoMem  (void);
4428
4429 /** Constructor for a Mux node.
4430  *
4431  * Adds the node to the block in current_ir_block.
4432  *
4433  * @param *sel      The ir_node that calculates the boolean select.
4434  * @param *ir_true  The ir_node that calculates the true result.
4435  * @param *ir_false The ir_node that calculates the false result.
4436  * @param *mode     The mode of the node (and it_true and ir_false).
4437  */
4438 ir_node *new_Mux  (ir_node *sel, ir_node *ir_false, ir_node *ir_true, ir_mode *mode);
4439
4440 /** Constructor for a CopyB node.
4441  *
4442  * Adds the node to the block in current_ir_block.
4443  *
4444  * @param *store      The current memory
4445  * @param *dst        The ir_node that represents the destination address.
4446  * @param *src        The ir_node that represents the source address.
4447  * @param *data_type  The type of the copied data
4448  */
4449 ir_node *new_CopyB(ir_node *store, ir_node *dst, ir_node *src, ir_type *data_type);
4450
4451 /** Constructor for a InstOf node.
4452  *
4453  * A High-Level Type check.
4454  *
4455  * @param   *store     The memory in which the object the entity should be selected
4456  *                     from is allocated.
4457  * @param   *objptr    A pointer to a object of a class type.
4458  * @param   *type      The type of which objptr must be.
4459  */
4460 ir_node *new_InstOf (ir_node *store, ir_node *objptr, ir_type *type);
4461
4462 /**Constructor for a Raise node.
4463  *
4464  * A High-Level Exception throw.
4465  *
4466  * @param *store The current memory.
4467  * @param *obj   A pointer to the Except variable.
4468  */
4469 ir_node *new_Raise  (ir_node *store, ir_node *obj);
4470
4471 /** Constructor for a Bound node.
4472  *
4473  * A High-Level bounds check. Checks whether lower <= idx && idx < upper.
4474  *
4475  * Adds the node to the block in current_ir_block.
4476  *
4477  * @param *store      The current memory
4478  * @param *idx        The ir_node that represents an index.
4479  * @param *lower      The ir_node that represents the lower bound for the index.
4480  * @param *upper      The ir_node that represents the upper bound for the index.
4481  */
4482 ir_node *new_Bound  (ir_node *store, ir_node *idx, ir_node *lower, ir_node *upper);
4483
4484 /** Constructor for a Pin node.
4485  *
4486  * @param *node       The node which value should be pinned.
4487  */
4488 ir_node *new_Pin    (ir_node *node);
4489
4490 /** Constructor for an ASM pseudo node.
4491  *
4492  * @param arity       The number of data inputs to the node.
4493  * @param *in         The array of length arity of data inputs.
4494  * @param *inputs     The array of length arity of input constraints.
4495  * @param n_outs      The number of data outputs to the node.
4496  * @param *outputs    The array of length n_outs of output constraints.
4497  * @param n_clobber   The number of clobbered registers.
4498  * @param *clobber    The array of length n_clobber of clobbered registers.
4499  * @param *asm_text   The assembler text.
4500  */
4501 ir_node *new_ASM(int arity, ir_node *in[], ir_asm_constraint *inputs,
4502                  int n_outs, ir_asm_constraint *outputs,
4503                  int n_clobber, ident *clobber[], ident *asm_text);
4504
4505 /** Constructor for a Dummy node.
4506  *
4507  * @param *mode     The mode of the node.
4508  */
4509 ir_node *new_Dummy(ir_mode *mode);
4510
4511 /*---------------------------------------------------------------------*/
4512 /* The comfortable interface.                                          */
4513 /* Supports automatic Phi node construction.                           */
4514 /* All routines of the block oriented interface except new_Block are   */
4515 /* needed also.                                                        */
4516 /*---------------------------------------------------------------------*/
4517
4518 /** Create an immature Block.
4519  *
4520  * An immature Block has an unknown number of predecessors.  Predecessors
4521  * can be added with add_immBlock_pred().  Once all predecessors are
4522  * added the block must be matured.
4523  *
4524  * Adds the block to the graph in current_ir_graph. Can be used with automatic
4525  * Phi node construction.
4526  * This constructor can only be used if the graph is in state_building.
4527  */
4528 ir_node *new_d_immBlock(dbg_info *db);
4529 ir_node *new_immBlock(void);
4530
4531 /** Create an immature PartBlock.
4532  *
4533  * An immature block has only one Block or PartBlock predecessor.
4534  * A PartBlock forms together with one BLock and possibly other
4535  * PartBlocks a MacroBlock.
4536  *
4537  * Adds the PartBlock to the graph in current_ir_graph. Does set
4538  * current_block.  Can be used with automatic Phi node construction.
4539  * This constructor can only be used if the graph is in
4540  * state_building.
4541  */
4542 ir_node *new_d_immPartBlock(dbg_info *db, ir_node *pred_jmp);
4543 ir_node *new_immPartBlock(ir_node *pred_jmp);
4544
4545 /** Add a control flow edge to an immature block. */
4546 void add_immBlock_pred(ir_node *immblock, ir_node *jmp);
4547
4548 /** Finalize a Block node, when all control flows are known. */
4549 void mature_immBlock(ir_node *block);
4550 #define mature_cur_block() mature_immBlock(get_cur_block());
4551
4552
4553 /** Get the current value of a local variable.
4554  *
4555  * Use this function to obtain the last definition of the local variable
4556  * associated with pos.  Pos may not exceed the value passed as n_loc
4557  * to new_ir_graph.  This call automatically inserts Phi nodes.
4558  *
4559  * @param *db    A pointer for debug information.
4560  * @param  pos   The position/id of the local variable.
4561  * @param *mode  The mode of the value to get.
4562  */
4563 ir_node *get_d_value(dbg_info *db, int pos, ir_mode *mode);
4564 ir_node *get_value(int pos, ir_mode *mode);
4565
4566 /** Remark a new definition of a variable.
4567  *
4568  * Use this function to remember a new definition of the value
4569  * associated with pos. Pos may not exceed the value passed as n_loc
4570  * to new_ir_graph.  This call is needed to automatically inserts Phi
4571  * nodes.
4572  *
4573  * @param  pos   The position/id of the local variable.
4574  * @param *value The new value written to the local variable.
4575  */
4576 void set_value(int pos, ir_node *value);
4577
4578 /** Find the value number for a node in the current block.
4579  *
4580  * This function searches all values in the current block for
4581  * a given value and returns its value number if it was found, else
4582  * -1.
4583  * Note that this does not mean that the value does not exists,
4584  * it's just not equal the node (for instance behind a Phi/Confirm ...)
4585  *
4586  * @param *value The value to find.
4587  */
4588 int find_value(ir_node *value);
4589
4590 /** Get the current memory state.
4591  *
4592  * Use this function to obtain the last definition of the memory
4593  * state.  This call automatically inserts Phi nodes for the memory
4594  * state value.
4595  */
4596 ir_node *get_store(void);
4597
4598 /** Remark a new definition of the memory state.
4599  *
4600  * Use this function to remember a new definition of the memory state.
4601  * This call is needed to automatically inserts Phi nodes.
4602  *
4603  * @param *store The new memory state.
4604  */
4605 void set_store(ir_node *store);
4606
4607 /** keep this node alive even if End is not control-reachable from it
4608  *
4609  * @param ka The node to keep alive.
4610  */
4611 void keep_alive(ir_node *ka);
4612
4613 /** Returns the frame type of the current graph */
4614 ir_type *get_cur_frame_type(void);
4615
4616
4617 /* --- initialize and finalize IR construction --- */
4618
4619 /** Puts the graph into state "phase_high" */
4620 #define irg_finalize_cons(irg) set_irg_phase_state(irg, phase_high)
4621
4622 /** Puts the program and all graphs into state phase_high.
4623  *
4624  * This also remarks, the construction of types is finished,
4625  * e.g., that no more subtypes will be added.  */
4626 void irp_finalize_cons(void);
4627
4628 /* --- Initialization --- */
4629
4630 #endif