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