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