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