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