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