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