1 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
2 ** All rights reserved.
4 ** Authors: Christian Schaefer
15 # include "irnode_t.h"
68 new_ir_op (opcode code, char *name, op_pinned p, int labeled, size_t attr_size)
72 res = (ir_op *) xmalloc (sizeof (ir_op));
74 res->name = id_from_str(name, strlen(name));
76 res->attr_size = attr_size;
77 res->labeled = labeled; /* For vcg dumping.
78 Set labeled = 1 if the edges should be
79 enumarated in vcg output, otherwise set
88 op_Block = new_ir_op (iro_Block, "Block", pinned, 1, sizeof (block_attr));
90 op_Start = new_ir_op (iro_Start, "Start", pinned, 0, 0);
91 op_End = new_ir_op (iro_End, "End", pinned, 0, 0);
92 op_Jmp = new_ir_op (iro_Jmp, "Jmp", pinned, 0, 0);
93 op_Cond = new_ir_op (iro_Cond, "Cond", pinned, 1, sizeof(cond_attr));
94 op_Return= new_ir_op (iro_Return,"Return", pinned, 1, 0);
95 op_Raise = new_ir_op (iro_Raise, "Raise", pinned, 1, 0);
97 op_Const = new_ir_op (iro_Const, "Const", floats, 0, sizeof (struct tarval *));
98 op_SymConst = new_ir_op (iro_SymConst, "SymConst",
99 floats, 0, sizeof (symconst_attr));
101 op_Sel = new_ir_op (iro_Sel, "Sel", floats, 1, sizeof (sel_attr));
103 op_Call = new_ir_op (iro_Call, "Call", pinned, 1, sizeof (call_attr));
104 op_Add = new_ir_op (iro_Add, "Add", floats, 0, 0);
105 op_Minus = new_ir_op (iro_Minus, "Minus", floats, 0, 0);
106 op_Sub = new_ir_op (iro_Sub, "Sub", floats, 1, 0);
107 op_Mul = new_ir_op (iro_Mul, "Mul", floats, 0, 0);
108 op_Quot = new_ir_op (iro_Quot, "Quot", pinned, 1, sizeof(struct irnode **));
109 op_DivMod= new_ir_op (iro_DivMod,"DivMod", pinned, 1, sizeof(struct irnode **));
110 op_Div = new_ir_op (iro_Div, "Div", pinned, 1, sizeof(struct irnode **));
111 op_Mod = new_ir_op (iro_Mod, "Mod", pinned, 1, sizeof(struct irnode **));
112 op_Abs = new_ir_op (iro_Abs, "Abs", floats, 0, 0);
113 op_And = new_ir_op (iro_And, "And", floats, 0, 0);
114 op_Or = new_ir_op (iro_Or, "Or", floats, 0, 0);
115 op_Eor = new_ir_op (iro_Eor, "Eor", floats, 0, 0);
116 op_Not = new_ir_op (iro_Not, "Not", floats, 0, 0);
117 op_Cmp = new_ir_op (iro_Cmp, "Cmp", floats, 1, 0);
118 op_Shl = new_ir_op (iro_Shl, "Shl", floats, 1, 0);
119 op_Shr = new_ir_op (iro_Shr, "Shr", floats, 1, 0);
120 op_Shrs = new_ir_op (iro_Shrs, "Shrs", floats, 1, 0);
121 op_Rot = new_ir_op (iro_Rot, "Rot", floats, 1, 0);
122 op_Conv = new_ir_op (iro_Conv, "Conv", floats, 0, 0);
124 op_Phi = new_ir_op (iro_Phi, "Phi", pinned, 1, sizeof (int));
126 op_Load = new_ir_op (iro_Load, "Load", pinned, 1, sizeof(struct irnode **));
127 op_Store = new_ir_op (iro_Store, "Store", pinned, 1, sizeof(struct irnode **));
128 op_Alloc = new_ir_op (iro_Alloc, "Alloc", pinned, 1, sizeof (alloc_attr));
129 op_Free = new_ir_op (iro_Free, "Free", pinned, 1, sizeof (type *));
130 op_Sync = new_ir_op (iro_Sync, "Sync", pinned, 0, 0);
132 op_Proj = new_ir_op (iro_Proj, "Proj", floats, 0, sizeof (long));
133 op_Tuple = new_ir_op (iro_Tuple, "Tuple", floats, 1, 0);
134 op_Id = new_ir_op (iro_Id, "Id", floats, 0, 0);
135 op_Bad = new_ir_op (iro_Bad, "Bad", floats, 0, 0);
138 /* Returns the string for the opcode. */
139 const char *get_op_name (ir_op *op) {
140 return id_to_str(op->name);
143 opcode get_op_code (ir_op *op){
147 ident *get_op_ident(ir_op *op){
151 op_pinned get_op_pinned (ir_op *op){
155 /* Sets pinned in the opcode. Setting it to floating has no effect
156 for Phi, Block and control flow nodes. */
157 void set_op_pinned(ir_op *op, op_pinned pinned) {
158 if (op == op_Block || op == op_Phi || is_cfopcode(op)) return;
163 /* returns the attribute size of the operator. */
164 int get_op_attr_size (ir_op *op) {
165 return op->attr_size;
168 int is_cfopcode(ir_op *op) {
169 return ((op == op_Start)