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