1 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
2 ** All rights reserved.
4 ** Authors: Martin Trapp, Christian Schaefer,
7 ** ircons.h ir node construction
12 *** Ideas for improvement:
14 Handle construction of exceptions more comfortable:
15 Add new constructors that pass the exception region (or better the
16 Phi for the memories, the ex. region can be found from there) as parameter,
17 constructor then adds all Proj nodes and returns the pointer
18 to the Proj node that selects the result of the arithmetic operation.
20 Maybe hide the exception region in a global variable, especially if
21 it is always unambiguous.
28 This file documents all datatypes and constructors needed to
29 build a FIRM representation of a pocedure. The constructors are
30 also implemented in this file.
32 The documentation also gives a short manual how to use the library.
34 For extensive documentation of FIRM see UKA Techreport 1999-14.
42 This struct contains all information about a procedure.
43 It's allocated directly to memory.
45 The fields of ir_graph:
47 *ent The entity describing this procedure.
49 The beginning and end of a graph:
51 *start_block This ir_node is the block that contains the unique
52 start node of the procedure. With it it contains
53 the Proj's on starts results.
54 Further all Const nodes are placed in the start block.
55 *start This ir_node is the unique start node of the procedure.
57 *end_block This ir_node is the block that contains the unique
58 end node of the procedure. This block contains no
60 *end This ir_node is the unique end node of the procedure.
62 The following nodes are Projs from the start node, held in ir_graph for
65 *frame The ir_node producing the pointer to the stack frame of the
66 procedure as output. This is the Proj node on the third
67 output of the start node. This output of the start node
68 is tagged as pns_frame_base. In FIRM most lokal
69 variables are modeled as data flow edges. Static
70 allocated arrays can not be represented as dataflow
71 edges. Therefore FIRM has to represent them in the stack
74 *globals This models a pointer to a space in the memory where _all_
75 global things are held. Select from this pointer with a Sel
76 node the pointer to a global variable / procedure / compiler
79 *args The ir_node that produces the arguments of the method as it's
80 result. This is a Proj node on the fourth output of the start
81 node. This output is tagged as pns_args.
83 *bad The bad node is an auxiliary node. It is needed only once,
84 so there is this globally reachable node.
86 Datastructures that are private to a graph:
88 *obst An obstack that contains all nodes.
90 *current_block A pointer to the current block. Any node created with one
91 of the node constructors (new_<opcode>) are assigned to this
92 block. It can be set with switch_block(block). Only needed
95 params/n_loc An int giving the number of local variables in this procedure.
96 This is neede for ir construction. Name will be changed.
98 *value_table This pset is used for global value numbering for optimizing
101 *Phi_in_stack; a stack needed for automatic Phi construction, needed only
102 during ir construction.
108 There are three kinds of nodes known to the ir: enties,
111 + ir_nodes are the actual nodes of the FIRM intermediate representation.
112 They represent operations on the data of the program and control flow
115 + entity ==> implemented in entity.h
116 Refers to a single entity of the compiled program, e.g. a field of a class or
119 + types ==> implemented in type.h
120 With types type information is represented. There are several type nodes.
122 Implementation of the FIRM operations: ir_node
123 ----------------------------------------------
125 Ir_nodes represent operations on the data of the program and control flow
126 operations. Examples of ir_nodes: Add, Jmp, Cmp
128 FIRM is a dataflow graph. A dataflow graph is a directed graph,
129 so that every node has incoming and outgoing edges. A node is
130 executable if every input at it's incoming edges is available.
131 Execution of the dataflow graph is started at the Start node which
132 has no incoming edges and ends when the End node executes, even if
133 there are still executable or not executed nodes. (Is this true,
134 or must all executable nodes be executed?) (There are exceptions
135 to the dataflow paradigma that all inputs have to be available
136 before a node can execute: Phi, Block. See UKA Techreport
139 The implementation of FIRM differs from the view as a dataflow
140 graph. To allow fast traversion of the graph edges are
141 implemented as C-pointers. Inputs to nodes are not ambiguous, the
142 results can be used by several other nodes. Each input can be
143 implemented as a single pointer to a predecessor node, outputs
144 need to be lists of pointers to successors. Therefore a node
145 contains pointers to it's predecessor so that the implementation is a
146 dataflow graph with reversed edges. It has to be traversed bottom
149 All nodes of the ir have the same basic structure. They are
150 distinguished by a field containing the opcode.
152 The fields of an ir_node:
154 kind A firm_kind tag containing k_ir_node. This is useful for
155 dynamically checking the type of a node.
157 *op This ir_op gives the opcode as a tag and a string
158 and the number of attributes of an ir_node. There is
159 one statically allocated struct ir_op for each opcode.
161 *mode The ir_mode of the operation represented by this firm node.
162 The mode of the operation is the mode of it's result. A Firm
163 mode is a datatype as known to the target, not a type of the
166 visit A flag for traversing the ir.
168 **in An array with pointers to the node's predecessors.
170 *link A pointer to an ir_node. With this pointer all Phi nodes
171 are attached to a Block, i.e., a Block points to it's
172 first Phi node, this node points to the second Phi node
173 in the Block and so fourth. Used in mature_block
174 to find all Phi nodes to be matured. It's also used to
175 annotate a node with a better, optimized version of it.
177 attr An attr struct containing the attributes of the nodes. The
178 attributes depend on the opcode of the node. The number of
179 these attributes is given in op.
183 Not yet documented. See irop.h.
187 Not yet documented. See irmode.h.
192 current_ir_graph Points to the current ir_graph. All constructors for nodes
193 add nodes to this graph.
195 ir_visited A int used as flag to traverse the ir_graph.
197 block_visited A int used as a flag to traverse block nodes in the graph.
199 Others not yet documented.
204 CONSTRUCTOR FOR IR_GRAPH
205 ========================
207 ir_graph *new_ir_graph (entity *ent, int params);
208 -------------------------------------------------
210 This constructor generates the basic infrastructure needed to
211 represent a procedure in FIRM.
213 The parameters of new_ir_graph are:
215 *ent A pointer to an entity representing the procedure.
217 params An integer giving the number of local variables in the
220 It allocates an ir_graph and sets current_ir_graph to point to this
221 graph. Further it allocates the following nodes needed for every
224 * The start block containing a start node and Proj nodes for it's
225 four results (X, M, P, T).
226 * The end block containing an end node. This block is not matured
227 after executing new_ir_graph as predecessors need to be added to it.
228 (Maturing a block means fixing it's number of predecessors.)
229 * The current block, which is empty and also not matured.
231 Further it enters the global store into the datastructure of the start
232 block that contanis all valid values in this block (set_store()). This
233 datastructure is used to build the Phi nodes and removed after completion
235 There is no path from end to start in the graph after calling ir_graph.
238 IR_NODES AND CONSTRUCTORS FOR IR_NODES
239 =======================================
241 All ir_nodes are defined by a common data structure. They are distinguished
242 by their opcode and differ in the number of their attributes.
244 The constructor for the block node sets current_block to itself.
245 Const nodes are always added to the start block.
246 All other constructors add the created node to the current_block.
247 swich_block(block) allows to set the current block to block.
249 Watch for my inconsistent use of input and predecessor (dataflow view)
250 and `the node points to' (implementation view).
252 The following description of the nodes lists four properties them if these are
254 - the parameters to the constructor
255 - the inputs of the Firm node
256 - the outputs of the Firm node
257 - attributes to the node
263 ir_node *new_Block (void)
264 --------------------------
266 Creates a new block. Sets current_block to itself. When a new block is
267 created it cannot be known how many predecessors this block will have in the
268 control flow graph. Therefore the list of inputs can not be fixed at
269 creation. Predecessors can be added with add_in_edge (block, control flow
270 operation). With every added predecessor the number of inputs to Phi nodes
273 The block can be completed by mature_block(block) if all predecessors are
274 known. If several blocks are built at once, mature_block can only be called
275 after set_value has been called for all values that are life at the end
276 of the block. This is necessary so that Phi nodes created by mature_block
277 get the right predecessors in case of cyclic dependencies. If all set_values
278 of this block are called after maturing it and before calling get_value
279 in some block that is control flow dependent on this block, the construction
281 Example for faulty ir construction:
282 block_before_loop = new_block();
284 mature_block(block_before_loop);
285 before2header = new_Jmp;
287 loop_header = new_block ();
288 header2body - new_Jmp();
290 loop_body = new_block ();
291 body2header = new_Jmp();
293 add_in_edge(loop_header, before2header);
294 add_in_edge(loop_header, body2header);
295 add_in_edge(loop_body, header2body);
297 mature_block(loop_header);
298 mature_block(loop_body);
300 get_value(loop_body, x); // gets the Phi in loop_header
301 set_value(loop_header, x); // sets the value the above get_value should
303 Mature_block also fixes the number of inputs to the Phi nodes. Mature_block
304 should be called as early as possible, as afterwards the generation of Phi
305 nodes is more efficient.
308 There is an input for each control flow predecessor of the block.
309 The input points to an instruction producing an output of type X.
310 Possible predecessors: Start, Jmp, Cond, Raise or Return or any node
311 possibly causing an exception. (Often the real predecessors are Projs.)
313 Mode R, all nodes belonging to this block should consume this output.
314 As they are strict (except Block and Phi node) it is a necessary condition
315 that the block node executed before any other node in this block
318 block.matured Indicates whether the block is mature.
321 This attribute contains all local values valid in this
322 block. This is needed to build the Phi nodes and removed
323 if the graph is complete.
326 CONTROL FLOW OPERATIONS
327 -----------------------
329 In each block there must be exactly one of the control flow
330 operations Start, End, Jmp, Cond, Return or Raise. The output of a
331 control flow operation points to the block to be executed next.
333 ir_node *new_Start (void)
334 -------------------------
336 Creates a start node. Not actually needed public. Created
340 No inputs except the block it belogns to.
342 A tuple of 4 (5, 6) distinct values. These are labeled by the following
343 projection numbers (pns_number):
345 mode X, points to the first block to be executed.
347 mode M, the global store
348 * pns_frame_base mode P, a pointer to the base of the procedures stack frame.
349 * pns_globals mode P, a pointer to the part of the memory containing _all_
351 * pns_args mode T, a tuple containing all arguments of the procedure.
354 ir_node *new_End (void)
355 -----------------------
357 Creates an end node. Not actually needed public. Created by
361 No inputs except the block it belogns to.
365 ir_node *new_Jmp (void)
366 -----------------------
371 The block the node belongs to
373 Control flow to the next block.
375 ir_node *new_Cond (ir_node *c)
376 ------------------------------
378 Creates a Cond node. There are two versions of this node.
384 A tuple of two control flows. The first is taken if the input is
385 false, the second if it is true.
389 A value of mode I_u. (i)
391 A tuple of n control flows. If the Cond's input is i, control
392 flow will procede along output i. If the input is >= n control
393 flow proceeds along output n.
395 ir_node *new_Return (in_node *store, int arity, ir_node **in)
396 -------------------------------------------------------------
398 The return node has as inputs the results of the procedure. It
399 passes the control flow to the end_block.
405 Control flow to the end block.
407 ir_node *new_Raise (ir_node *store, ir_node *obj)
408 -------------------------------------------------
410 Raises an exception. Unconditional change of control flow. Writes
411 an explicit Except variable to memory to pass it to the exception
412 handler. See TechReport 1999-14, chapter Exceptions.
416 A pointer to the Except variable.
418 A tuple of control flow and the changed memory state. The control flow
419 points to the exception handler if it is definied in this procedure,
420 else it points to the end_block.
426 ir_node *new_Const (ir_mode *mode, tarval *con)
427 -----------------------------------------------
429 Creates a constant in the constant table and adds a Const node
430 returning this value to the start block.
433 *mode The mode of the constant.
434 *con Points to an entry in the constant table.
435 This pointer is added to the attributes of
436 the node (self->attr.con)
438 No inputs except the block it belogns to.
442 attr.con A tarval* pointer to the proper entry in the constant
445 ir_node *new_SymConst (type *type, symconst_kind kind)
446 ------------------------------------------------------------
448 There are two kinds of symbolic constants:
449 type_tag The symbolic constant represents a type tag.
450 size The symbolic constant represents the size of a class.
451 link_info Information for the linker.
454 kind The kind of the symbolic constant: type_tag or size.
455 *type Points to the type the tag stands for or to the type
456 whose size is represented by the constant.
459 No inputs except the block it belogns to.
461 An unsigned integer (I_u) or a pointer (P).
464 attr.i.num The symconst_kind, i.e. one of
468 If the attr.i.num is type_tag of size, the node contains an attribute
469 attr.i.*type A pointer to a type_class.
470 if it is linkage_ptr_info it contains
471 attr.i.*ptrinfo A ident holding information for the linker.
476 ir_node *new_simpleSel (ir_node *store, ir_node *frame, entity *sel)
477 --------------------------------------------------------------------
480 Selects an entity from a compound type. This entity can be a field or
484 *store The memory in which the object the entity should be selected from
486 *frame The pointer to the object.
487 *sel The entity to select.
490 The memory containing the object.
491 A pointer to the object.
494 A pointer to the selected entity.
496 attr.sel Pointer to the entity
499 ir_node *new_Sel (ir_node *store, ir_node *frame, int arity, ir_node **in,
500 --------------------------------------------------------------------------
504 Selects a field from an array type. The entity has as owner the array, as
505 type the arrays element type. The indexes to access an array element are
509 *store The memory in which the object the entity should be selected from
511 *frame The pointer to the object.
512 *arity number of array indexes.
513 *in array with index inputs to the node.
514 *sel The entity to select.
517 The memory containing the object.
518 A pointer to the object.
519 As much unsigned integer as there are array expressions.
521 A pointer to the selected entity.
523 attr.sel Pointer to the entity
525 The constructors new_Sel and new_simpleSel generate the same ir nodes.
526 simpleSel just sets the arity of the index inputs to zero.
529 ARITHMETIC OPERATIONS
530 ---------------------
532 ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node **in,
533 ----------------------------------------------------------------------------
537 Creates a procedure call.
540 *store The actual store. Why not also the stack frame?
541 *callee A pointer to the called procedure.
542 arity The number of procedure parameters.
543 **in An array with the pointers to the parameters.
544 This array is copied in the constructor.
545 *type Type information of the procedure called.
548 The store, the callee and the parameters.
550 A tuple containing the eventually changed store and the procedure
553 attr.call Contains the type information for the procedure.
555 ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode)
556 ------------------------------------------------------------
560 ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode)
561 ------------------------------------------------------------
565 ir_node *new_Minus (ir_node *op, ir_mode *mode)
566 -----------------------------------------------
568 This constructor is for unary Minus operations on floating point
569 values. Such a Minus can trap if it is implemented as a Sub from
570 zero due to rounding errors.
572 ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode)
573 ------------------------------------------------------------
577 ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2)
578 --------------------------------------------------------------
580 Quot performs exact division of floating point numbers. It's mode
581 is Tuple, the mode of the result must be annotated to the Proj
582 that extracts the result of the arithmetic operations.
585 The store needed to model exceptions and the two operands.
587 A tuple contaning a memory and a execution for modeling exceptions
588 and the result of the arithmetic operation.
590 ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2)
591 ----------------------------------------------------------------
593 Performs Div and Mod on interger values.
596 A tuple contaning a memory and a execution for modeling exceptions
597 and the two result of the arithmetic operations.
599 ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2)
600 -------------------------------------------------------------
604 ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2)
605 -------------------------------------------------------------
609 ir_node *new_Abs (ir_node *op, ir_mode *mode)
610 ---------------------------------------------
614 ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode)
615 ------------------------------------------------------------
619 ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode)
620 -----------------------------------------------------------
624 ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode)
625 ------------------------------------------------------------
629 ir_node *new_Not (ir_node *op, ir_mode *mode)
630 ---------------------------------------------
632 This node constructs a constant where all bits are set to one
633 and a Eor of this constant and the operator. This simulates a
636 ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode)
637 ---------------------------------------------------------
641 ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode)
642 ---------------------------------------------------------
644 Logic shift right, i.e., zero extended.
647 ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode)
648 ----------------------------------------------------------
650 Arithmetic shift right, i.e., sign extended.
652 ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode)
653 ---------------------------------------------------------
655 Rotates the operand to the (right??) by k bits.
657 ir_node *new_Conv (ir_node *op, ir_mode *mode)
658 ---------------------------------------------
660 Mode conversion. For allowed conversions see UKA Tech Report
663 ir_node *new_Cmp (ir_node *op1, ir_node *op2)
664 ---------------------------------------------
667 The two values to be compared.
669 A 16-tuple containing the results of the 16 different comparisons.
670 The following is a list giving the comparisons and a projection
671 number (pnc_number) to use in Proj nodes to extract the proper result.
679 Leg less, equal or greater = ordered
681 Ue unordered or equal
683 Ule unordered, less or equal
684 Ug unordered or greater
685 Uge unordered, greater or equal
686 Ne unordered, less or greater = not equal
694 In general, Phi nodes are automaitcally inserted. In some cases, if
695 all predecessors of a block are known, an explicit Phi node constructor
696 is needed. E.g., to construct a FIRM graph for a statement as
699 ir_node *new_Phi (int arity, ir_node **in, ir_mode *mode)
700 ---------------------------------------------------------
702 Creates a Phi node. The in's order has to correspond to the order
703 of in's of current_block. This is not checked by the library!
706 arity number of predecessors
707 **in array with predecessors
708 *mode The mode of it's inputs and output.
710 A Phi node has as many inputs as the block it belongs to.
711 Each input points to a definition of the same value on a
712 different path in the control flow.
714 The definition valid in this block.
717 OPERATIONS TO MANAGE MEMORY EXPLICITLY
718 --------------------------------------
720 ir_node *new_Load (ir_node *store, ir_node *addr)
721 ----------------------------------------------------------------
723 The Load operation reads a value from memory.
726 *store The current memory.
727 *addr A pointer to the variable to be read in this memory.
728 *mode The mode of the loaded value.
731 The memory and a pointer to a variable in this memory.
733 A tuple of the memory, a control flow to be taken in case of
734 an exception and the loaded value.
736 ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val)
737 ----------------------------------------------------------------
739 The Store operation writes a value to a variable in memory.
742 The memory, a pointer to a variable in this memory and the value
743 to write to this variable.
745 A tuple of the changed memory and a control flow to be taken in
746 case of an exception.
748 ir_node *new_Alloc (ir_node *store, ir_node *size, type *alloc_type,
749 --------------------------------------------------------------------
753 The Alloc node allocates a new variable. It can be specified whether the
754 variable should be allocated to the stack or to the heap.
757 *store The memory which shall contain the new variable.
758 ** *size The number of bytes to allocate. Old. **
759 *size We decided that the size easily can be derived from the type.
760 This field is for allocating arrays, i.e., it gives the multiple
761 of the size of alloc_type to allocate memory for.
762 *alloc_type The type of the allocated variable.
763 where Where to allocate the variable, either heap_alloc or stack_alloc.
766 A memory and an unsigned integer.
768 A tuple of the changed memory, a control flow to be taken in
769 case of an exception and the pointer to the new variable.
771 a.where Indicates where the variable is allocated.
772 a.*type A pointer to the class the allocated data object
775 ir_node *new_Free (ir_node *store, ir_node *ptr, type *free_type)
776 ------------------------------------------------------------------
778 The Free node frees memory of the given variable.
781 *store The memory which shall contain the new variable.
782 *ptr The pointer to the object to free.
783 *size The number of objects of type free_type to free in a sequence.
784 *free_type The type of the freed variable.
787 A memory, a pointer and an unsigned integer.
791 f.*type A pointer to the type information of the freed data object.
795 ir_node *new_Sync (int arity, ir_node **in)
796 -------------------------------------------
798 The Sync operation unifies several partial memory blocks. These blocks
799 have to be pairwise disjunct or the values in common locations have to
800 be identical. This operation allows to specify all operations that eventually
801 need several partial memory blocks as input with a single entrance by
802 unifying the memories with a preceding Sync operation.
805 arity The number of memories to syncronize.
806 **in An array of pointers to nodes that produce an output of
817 ir_node *new_Bad (void)
818 -----------------------
820 Returns the unique Bad node current_ir_graph->bad.
821 This node is used to express results of dead code elimination.
823 ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj)
824 ----------------------------------------------------------
826 Selects one entry of a tuple. This is a hidden `fat edge'.
829 *arg A node producing a tuple.
830 *mode The mode of the value to project.
831 proj The position of the value in the tuple.
837 ir_node *new_Tuple (int arity, ir_node **in)
838 --------------------------------------------
840 Builds a Tuple from single values. This is needed to implement
841 optimizations that remove a node that produced a tuple. The node can be
842 replaced by the Tuple operation so that the following Proj nodes have not to
843 be changed. (They are hard to find due to the implementation with pointers
844 in only one direction.) The Tuple node is smaller than any other
845 node, so that a node can be changed into a Tuple by just changing it's
846 opcode and giving it a new in array.
849 arity The number of tuple elements.
850 **in An array containing pointers to the nodes producing the
853 ir_node *new_Id (ir_node *val, ir_mode *mode)
854 ---------------------------------------------
856 The single output of the Id operation is it's input. Also needed
860 COPING WITH DATA OBJECTS
861 ========================
863 Two kinds of data objects have to be distinguished for generating
864 FIRM. First there are local variables other than arrays that are
865 known to be alias free. Second there are all other data objects.
866 For the first a common SSA representation is built, the second
867 are modeled by saving them to memory. The memory is treated as
868 a single local variable, the alias problem is hidden in the
869 content of this variable.
871 All values known in a Block are listed in the block's attribute,
872 block.**graph_arr which is used to automatically insert Phi nodes.
873 The following two funcions can be used to add a newly computed value
874 to the array, or to get the producer of a value, i.e., the current
877 inline void set_value (int pos, ir_node *value)
878 -----------------------------------------------
880 Has to be called for every assignment to a local variable. It
881 adds the value to the array of used values at position pos. Pos
882 has to be a unique identifier for an entry in the procedure's
883 definition table. It can be used to access the value again.
885 ir_node *get_value (int pos, ir_mode *mode)
886 -------------------------------------------
888 Returns the node defining the value referred to by pos. If the
889 value is not defined in this block a Phi node is generated and
890 all definitions reaching this Phi node are collected. It can
891 happen that the algorithm allocates an unnecessary Phi node,
892 e.g. if there is only one definition of this value, but this
893 definition reaches the currend block on several different
894 paths. This Phi node will be eliminated if optimizations are
895 turned on right after it's creation.
898 There are two special routines for the global store:
900 inline void set_store (ir_node *store)
901 --------------------------------------
903 Adds the store to the array of known values at a reserved
906 inline ir_node *get_store (void)
907 --------------------------------
909 Returns the node defining the actual store.
923 # include "irgraph.h"
928 /* irnode constructor */
929 /* Create a new irnode in irg, with an op, mode, arity and */
930 /* some incoming irnodes. */
931 /* If arity is negative, a node with a dynamic array is created. */
932 inline ir_node *new_ir_node (ir_graph *irg, ir_node *block, ir_op *op,
933 ir_mode *mode, int arity, ir_node **in);
935 /** These headers need not to be here. They are never used by the
937 That's not completely true. They need not be seen by a frontend,
938 but they might be useful for optimizations changing the IR. **/
940 #if USE_EXPICIT_PHI_IN_STACK
941 /* A stack needed for the automatic Phi node construction in constructor
943 typedef struct Phi_in_stack {
949 /* privat interfaces */
950 /* more detailed construction */
952 ir_node *new_r_Jmp (ir_graph *irg, ir_node *block);
953 ir_node *new_r_Cond (ir_graph *irg, ir_node *block, ir_node *c);
954 ir_node *new_r_Return (ir_graph *irg, ir_node *block,
955 ir_node *store, int arity, ir_node **in);
956 ir_node *new_r_Raise (ir_graph *irg, ir_node *block,
957 ir_node *store, ir_node *obj);
958 ir_node *new_r_Const (ir_graph *irg, ir_node *block,
959 ir_mode *mode, tarval *con);
960 ir_node *new_r_SymConst (ir_graph *irg, ir_node *block,
961 type_or_id *value, symconst_kind symkind);
962 ir_node *new_r_Sel (ir_graph *irg, ir_node *block, ir_node *store,
963 ir_node *objptr, int n_index, ir_node **index,
965 ir_node *new_r_Call (ir_graph *irg, ir_node *block, ir_node *store,
966 ir_node *callee, int arity, ir_node **in, type_method *type);
967 ir_node *new_r_Add (ir_graph *irg, ir_node *block,
968 ir_node *op1, ir_node *op2, ir_mode *mode);
969 ir_node *new_r_Sub (ir_graph *irg, ir_node *block,
970 ir_node *op1, ir_node *op2, ir_mode *mode);
971 ir_node *new_r_Minus (ir_graph *irg, ir_node *block,
972 ir_node *op, ir_mode *mode);
973 ir_node *new_r_Mul (ir_graph *irg, ir_node *block,
974 ir_node *op1, ir_node *op2, ir_mode *mode);
975 ir_node *new_r_Quot (ir_graph *irg, ir_node *block, ir_node *memop,
976 ir_node *op1, ir_node *op2);
977 ir_node *new_r_DivMod (ir_graph *irg, ir_node *block,
978 ir_node *memop, ir_node *op1, ir_node *op2);
979 ir_node *new_r_Div (ir_graph *irg, ir_node *block, ir_node *memop,
980 ir_node *op1, ir_node *op2);
981 ir_node *new_r_Mod (ir_graph *irg, ir_node *block, ir_node *memop,
982 ir_node *op1, ir_node *op2);
983 ir_node *new_r_Abs (ir_graph *irg, ir_node *block,
984 ir_node *op, ir_mode *mode);
985 ir_node *new_r_And (ir_graph *irg, ir_node *block,
986 ir_node *op1, ir_node *op2, ir_mode *mode);
987 ir_node *new_r_Or (ir_graph *irg, ir_node *block,
988 ir_node *op1, ir_node *op2, ir_mode *mode);
989 ir_node *new_r_Eor (ir_graph *irg, ir_node *block,
990 ir_node *op1, ir_node *op2, ir_mode *mode);
991 ir_node *new_r_Not (ir_graph *irg, ir_node *block,
992 ir_node *op, ir_mode *mode);
993 ir_node *new_r_Shl (ir_graph *irg, ir_node *block,
994 ir_node *op, ir_node *k, ir_mode *mode);
995 ir_node *new_r_Shr (ir_graph *irg, ir_node *block,
996 ir_node *op, ir_node *k, ir_mode *mode);
997 ir_node *new_r_Shrs (ir_graph *irg, ir_node *block,
998 ir_node *op, ir_node *k, ir_mode *mode);
999 ir_node *new_r_Rot (ir_graph *irg, ir_node *block,
1000 ir_node *op, ir_node *k, ir_mode *mode);
1001 ir_node *new_r_Cmp (ir_graph *irg, ir_node *block,
1002 ir_node *op1, ir_node *op2);
1003 ir_node *new_r_Conv (ir_graph *irg, ir_node *block,
1004 ir_node *op, ir_mode *mode);
1005 ir_node *new_r_Phi (ir_graph *irg, ir_node *block, int arity,
1006 ir_node **in, ir_mode *mode);
1007 ir_node *new_r_Load (ir_graph *irg, ir_node *block,
1008 ir_node *store, ir_node *adr);
1009 ir_node *new_r_Store (ir_graph *irg, ir_node *block,
1010 ir_node *store, ir_node *adr, ir_node *val);
1011 ir_node *new_r_Alloc (ir_graph *irg, ir_node *block, ir_node *store,
1012 ir_node *size, type *alloc_type, where_alloc where);
1013 ir_node *new_r_Free (ir_graph *irg, ir_node *block, ir_node *store,
1014 ir_node *ptr, ir_node *size, type *free_type);
1015 ir_node *new_r_Sync (ir_graph *irg, ir_node *block, int arity, ir_node **in);
1016 ir_node *new_r_Proj (ir_graph *irg, ir_node *block, ir_node *arg,
1017 ir_mode *mode, long proj);
1018 ir_node *new_r_Tuple (ir_graph *irg, ir_node *block,
1019 int arity, ir_node **in);
1020 ir_node *new_r_Id (ir_graph *irg, ir_node *block,
1021 ir_node *val, ir_mode *mode);
1022 ir_node *new_r_Bad (ir_node *block);
1026 /* public interfaces */
1027 /* normal constructors */
1029 ir_node *new_Block (void);
1030 ir_node *new_Start (void);
1031 ir_node *new_End (void);
1032 ir_node *new_Jmp (void);
1033 ir_node *new_Cond (ir_node *c);
1034 ir_node *new_Return (ir_node *store, int arity, ir_node **in);
1035 ir_node *new_Raise (ir_node *store, ir_node *obj);
1036 ir_node *new_Const (ir_mode *mode, tarval *con);
1037 ir_node *new_SymConst (type_or_id *value, symconst_kind kind);
1038 ir_node *new_simpleSel (ir_node *store, ir_node *objptr, entity *ent);
1039 ir_node *new_Sel (ir_node *store, ir_node *objptr, int arity, ir_node **in,
1041 ir_node *new_Call (ir_node *store, ir_node *callee, int arity, ir_node **in,
1043 ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode);
1044 ir_node *new_Sub (ir_node *op1, ir_node *op2, ir_mode *mode);
1045 ir_node *new_Minus (ir_node *op, ir_mode *mode);
1046 ir_node *new_Mul (ir_node *op1, ir_node *op2, ir_mode *mode);
1047 ir_node *new_Quot (ir_node *memop, ir_node *op1, ir_node *op2);
1048 ir_node *new_DivMod (ir_node *memop, ir_node *op1, ir_node *op2);
1049 ir_node *new_Div (ir_node *memop, ir_node *op1, ir_node *op2);
1050 ir_node *new_Mod (ir_node *memop, ir_node *op1, ir_node *op2);
1051 ir_node *new_Abs (ir_node *op, ir_mode *mode);
1052 ir_node *new_And (ir_node *op1, ir_node *op2, ir_mode *mode);
1053 ir_node *new_Or (ir_node *op1, ir_node *op2, ir_mode *mode);
1054 ir_node *new_Eor (ir_node *op1, ir_node *op2, ir_mode *mode);
1055 ir_node *new_Not (ir_node *op, ir_mode *mode);
1056 ir_node *new_Shl (ir_node *op, ir_node *k, ir_mode *mode);
1057 ir_node *new_Shr (ir_node *op, ir_node *k, ir_mode *mode);
1058 ir_node *new_Shrs (ir_node *op, ir_node *k, ir_mode *mode);
1059 ir_node *new_Rot (ir_node *op, ir_node *k, ir_mode *mode);
1060 ir_node *new_Cmp (ir_node *op1, ir_node *op2);
1061 ir_node *new_Conv (ir_node *op, ir_mode *mode);
1062 ir_node *new_Phi (int arity, ir_node **in, ir_mode *mode);
1063 ir_node *new_Load (ir_node *store, ir_node *addr);
1064 ir_node *new_Store (ir_node *store, ir_node *addr, ir_node *val);
1065 ir_node *new_Alloc (ir_node *store, ir_node *size, type *alloc_type,
1067 ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
1069 ir_node *new_Sync (int arity, ir_node **in);
1070 ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
1071 ir_node *new_Tuple (int arity, ir_node **in);
1072 ir_node *new_Id (ir_node *val, ir_mode *mode);
1073 ir_node *new_Bad (void);
1076 #if USE_EXPICIT_PHI_IN_STACK
1077 Phi_in_stack *new_Phi_in_stack();
1080 /* initialize ir construction */
1081 void init_cons (void);
1084 # endif /* _IRCONS_H_ */