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