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