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