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