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