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