Added FuncCall op
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 4 Feb 2004 15:03:07 +0000 (15:03 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 4 Feb 2004 15:03:07 +0000 (15:03 +0000)
[r2375]

ir/ir/irop.c
ir/ir/irop.h

index 1a250f9..b42ec10 100644 (file)
@@ -79,9 +79,11 @@ ir_op *op_CallBegin;    ir_op *get_op_CallBegin () { return op_CallBegin; }
 ir_op *op_EndReg;         ir_op *get_op_EndReg    () { return op_EndReg;    }
 ir_op *op_EndExcept;      ir_op *get_op_EndExcept () { return op_EndExcept; }
 
+ir_op *op_FuncCall;       ir_op *get_op_FuncCall  () { return op_FuncCall; }
+
 
 ir_op *
-new_ir_op (opcode code, char *name, op_pinned p, int labeled, size_t attr_size)
+new_ir_op (opcode code, const char *name, op_pinned p, int labeled, size_t attr_size)
 {
   ir_op *res;
 
@@ -101,51 +103,50 @@ new_ir_op (opcode code, char *name, op_pinned p, int labeled, size_t attr_size)
 void
 init_op(void)
 {
-  op_Block = new_ir_op (iro_Block, "Block",  pinned, 1, sizeof (block_attr));
-
-  op_Start = new_ir_op (iro_Start, "Start",  pinned, 0, sizeof (start_attr));
-  op_End   = new_ir_op (iro_End,   "End",    pinned, 0, 0);
-  op_Jmp   = new_ir_op (iro_Jmp,   "Jmp",    pinned, 0, 0);
-  op_Cond  = new_ir_op (iro_Cond,  "Cond",   pinned, 1, sizeof(cond_attr));
-  op_Return= new_ir_op (iro_Return,"Return", pinned, 1, 0);
-  op_Raise = new_ir_op (iro_Raise, "Raise",  pinned, 1, 0);
-
-  op_Const = new_ir_op (iro_Const, "Const",  floats, 0, sizeof (const_attr));
-  op_SymConst = new_ir_op (iro_SymConst, "SymConst",
-                                            floats, 0, sizeof (symconst_attr));
-
-  op_Sel   = new_ir_op (iro_Sel,   "Sel",    floats, 1, sizeof (sel_attr));
-  op_InstOf= new_ir_op (iro_InstOf,"InstOf", floats, 1, sizeof (sel_attr));
-
-  op_Call  = new_ir_op (iro_Call,  "Call",   pinned, 1, sizeof (call_attr));
-  op_Add   = new_ir_op (iro_Add,   "Add",    floats, 0, 0);
-  op_Minus = new_ir_op (iro_Minus, "Minus",  floats, 0, 0);
-  op_Sub   = new_ir_op (iro_Sub,   "Sub",    floats, 1, 0);
-  op_Mul   = new_ir_op (iro_Mul,   "Mul",    floats, 0, 0);
-  op_Quot  = new_ir_op (iro_Quot,  "Quot",   pinned, 1, sizeof(struct irnode **));
-  op_DivMod= new_ir_op (iro_DivMod,"DivMod", pinned, 1, sizeof(struct irnode **));
-  op_Div   = new_ir_op (iro_Div,   "Div",    pinned, 1, sizeof(struct irnode **));
-  op_Mod   = new_ir_op (iro_Mod,   "Mod",    pinned, 1, sizeof(struct irnode **));
-  op_Abs   = new_ir_op (iro_Abs,   "Abs",    floats, 0, 0);
-  op_And   = new_ir_op (iro_And,   "And",    floats, 0, 0);
-  op_Or    = new_ir_op (iro_Or,    "Or",     floats, 0, 0);
-  op_Eor   = new_ir_op (iro_Eor,   "Eor",    floats, 0, 0);
-  op_Not   = new_ir_op (iro_Not,   "Not",    floats, 0, 0);
-  op_Cmp   = new_ir_op (iro_Cmp,   "Cmp",    floats, 1, 0);
-  op_Shl   = new_ir_op (iro_Shl,   "Shl",    floats, 1, 0);
-  op_Shr   = new_ir_op (iro_Shr,   "Shr",    floats, 1, 0);
-  op_Shrs  = new_ir_op (iro_Shrs,  "Shrs",   floats, 1, 0);
-  op_Rot   = new_ir_op (iro_Rot,   "Rot",    floats, 1, 0);
-  op_Conv  = new_ir_op (iro_Conv,  "Conv",   floats, 0, 0);
-  op_Cast  = new_ir_op (iro_Cast,  "Cast",   floats, 0, sizeof (cast_attr));
-
-  op_Phi   = new_ir_op (iro_Phi,   "Phi",    pinned, 1, sizeof (int));
-
-  op_Load  = new_ir_op (iro_Load,  "Load",   pinned, 1, sizeof(struct irnode **));
-  op_Store = new_ir_op (iro_Store, "Store",  pinned, 1, sizeof(struct irnode **));
-  op_Alloc = new_ir_op (iro_Alloc, "Alloc",  pinned, 1, sizeof (alloc_attr));
-  op_Free  = new_ir_op (iro_Free,  "Free",   pinned, 1, sizeof (type *));
-  op_Sync  = new_ir_op (iro_Sync,  "Sync",   pinned, 0, 0);
+  op_Block     = new_ir_op (iro_Block,     "Block",     pinned, 1, sizeof (block_attr));
+
+  op_Start     = new_ir_op (iro_Start,     "Start",     pinned, 0, sizeof (start_attr));
+  op_End       = new_ir_op (iro_End,       "End",       pinned, 0, 0);
+  op_Jmp       = new_ir_op (iro_Jmp,       "Jmp",       pinned, 0, 0);
+  op_Cond      = new_ir_op (iro_Cond,      "Cond",      pinned, 1, sizeof(cond_attr));
+  op_Return    = new_ir_op (iro_Return,    "Return",    pinned, 1, 0);
+  op_Raise     = new_ir_op (iro_Raise,     "Raise",     pinned, 1, 0);
+
+  op_Const     = new_ir_op (iro_Const,     "Const",     floats, 0, sizeof (const_attr));
+  op_SymConst  = new_ir_op (iro_SymConst,  "SymConst",  floats, 0, sizeof (symconst_attr));
+
+  op_Sel       = new_ir_op (iro_Sel,       "Sel",       floats, 1, sizeof (sel_attr));
+  op_InstOf    = new_ir_op (iro_InstOf,    "InstOf",    floats, 1, sizeof (sel_attr));
+
+  op_Call      = new_ir_op (iro_Call,      "Call",      pinned, 1, sizeof (call_attr));
+  op_Add       = new_ir_op (iro_Add,       "Add",       floats, 0, 0);
+  op_Minus     = new_ir_op (iro_Minus,     "Minus",     floats, 0, 0);
+  op_Sub       = new_ir_op (iro_Sub,       "Sub",       floats, 1, 0);
+  op_Mul       = new_ir_op (iro_Mul,       "Mul",       floats, 0, 0);
+  op_Quot      = new_ir_op (iro_Quot,      "Quot",      pinned, 1, sizeof(struct irnode **));
+  op_DivMod    = new_ir_op (iro_DivMod,    "DivMod",    pinned, 1, sizeof(struct irnode **));
+  op_Div       = new_ir_op (iro_Div,       "Div",       pinned, 1, sizeof(struct irnode **));
+  op_Mod       = new_ir_op (iro_Mod,       "Mod",       pinned, 1, sizeof(struct irnode **));
+  op_Abs       = new_ir_op (iro_Abs,       "Abs",       floats, 0, 0);
+  op_And       = new_ir_op (iro_And,       "And",       floats, 0, 0);
+  op_Or        = new_ir_op (iro_Or,        "Or",        floats, 0, 0);
+  op_Eor       = new_ir_op (iro_Eor,       "Eor",       floats, 0, 0);
+  op_Not       = new_ir_op (iro_Not,       "Not",       floats, 0, 0);
+  op_Cmp       = new_ir_op (iro_Cmp,       "Cmp",       floats, 1, 0);
+  op_Shl       = new_ir_op (iro_Shl,       "Shl",       floats, 1, 0);
+  op_Shr       = new_ir_op (iro_Shr,       "Shr",       floats, 1, 0);
+  op_Shrs      = new_ir_op (iro_Shrs,      "Shrs",      floats, 1, 0);
+  op_Rot       = new_ir_op (iro_Rot,       "Rot",       floats, 1, 0);
+  op_Conv      = new_ir_op (iro_Conv,      "Conv",      floats, 0, 0);
+  op_Cast      = new_ir_op (iro_Cast,      "Cast",      floats, 0, sizeof (cast_attr));
+
+  op_Phi       = new_ir_op (iro_Phi,       "Phi",       pinned, 1, sizeof (int));
+
+  op_Load      = new_ir_op (iro_Load,      "Load",      pinned, 1, sizeof(struct irnode **));
+  op_Store     = new_ir_op (iro_Store,     "Store",     pinned, 1, sizeof(struct irnode **));
+  op_Alloc     = new_ir_op (iro_Alloc,     "Alloc",     pinned, 1, sizeof (alloc_attr));
+  op_Free      = new_ir_op (iro_Free,      "Free",      pinned, 1, sizeof (type *));
+  op_Sync      = new_ir_op (iro_Sync,      "Sync",      pinned, 0, 0);
 
   op_Proj      = new_ir_op (iro_Proj,      "Proj",      floats, 0, sizeof (long));
   op_Tuple     = new_ir_op (iro_Tuple,     "Tuple",     floats, 1, 0);
@@ -159,14 +160,16 @@ init_op(void)
   op_CallBegin = new_ir_op (iro_CallBegin, "CallBegin", pinned, 0, sizeof(callbegin_attr));
   op_EndReg    = new_ir_op (iro_EndReg,    "EndReg",    pinned, 0, sizeof(end_attr));
   op_EndExcept = new_ir_op (iro_EndExcept, "EndExcept", pinned, 0, sizeof(end_attr));
+
+  op_FuncCall  = new_ir_op (iro_FuncCall,  "FuncCall",  floats, 1, sizeof (call_attr));
 }
 
 /* Returns the string for the opcode. */
-const char  *get_op_name      (ir_op *op) {
+const char *get_op_name (const ir_op *op) {
   return get_id_str(op->name);
 }
 
-opcode get_op_code (ir_op *op){
+opcode get_op_code (const ir_op *op){
   return op->code;
 }
 
@@ -174,7 +177,7 @@ ident *get_op_ident(ir_op *op){
   return op->name;
 }
 
-op_pinned get_op_pinned (ir_op *op){
+op_pinned get_op_pinned (const ir_op *op){
   return op->pinned;
 }
 
@@ -187,11 +190,11 @@ void      set_op_pinned(ir_op *op, op_pinned pinned) {
 
 
 /* returns the attribute size of the operator. */
-int get_op_attr_size (ir_op *op) {
+int get_op_attr_size (const ir_op *op) {
   return op->attr_size;
 }
 
-int is_cfopcode(ir_op *op) {
+int is_cfopcode(const ir_op *op) {
   return ((op == op_Start)
           || (op == op_Jmp)
           || (op == op_Cond)
@@ -208,9 +211,8 @@ int is_cfopcode(ir_op *op) {
 
 /* Returns true if the operation manipulates interprocedural control flow:
    CallBegin, EndReg, EndExcept */
-int is_ip_cfopcode(ir_op *op) {
+int is_ip_cfopcode(const ir_op *op) {
   return ((op == op_CallBegin)
          || (op == op_EndReg)
          || (op == op_EndExcept));
-
 }
index 51923a9..67747b7 100644 (file)
@@ -39,7 +39,8 @@ typedef enum {
   iro_Phi,
   iro_Load, iro_Store, iro_Alloc, iro_Free, iro_Sync,
   iro_Proj, iro_Tuple, iro_Id, iro_Bad, iro_Confirm,
-  iro_Unknown, iro_Filter, iro_Break, iro_CallBegin, iro_EndReg, iro_EndExcept
+  iro_Unknown, iro_Filter, iro_Break, iro_CallBegin, iro_EndReg, iro_EndExcept,
+  iro_FuncCall,
 } opcode;
 
 typedef struct ir_op ir_op;
@@ -102,14 +103,16 @@ extern ir_op *op_CallBegin;       ir_op *get_op_CallBegin (void);
 extern ir_op *op_EndReg;          ir_op *get_op_EndReg    (void);
 extern ir_op *op_EndExcept;       ir_op *get_op_EndExcept (void);
 
+extern ir_op *op_FuncCall;        ir_op *get_op_FuncCall  (void);
 
 /** Returns the ident for the opcode name */
-ident *get_op_ident     (ir_op *op);
+ident *get_op_ident(ir_op *op);
+
 /** Returns the string for the opcode. */
-const char *get_op_name (ir_op *op);
+const char *get_op_name(const ir_op *op);
 
 /** Returns the enum for the opcode */
-opcode get_op_code      (ir_op *op);
+opcode get_op_code(const ir_op *op);
 
 /** pinned states */
 typedef enum {
@@ -117,22 +120,22 @@ typedef enum {
   pinned           /**< Nodes must remain in this basic block. */
 } op_pinned;
 
-/** gets pinned state of an opcoe */
-op_pinned get_op_pinned (ir_op *op);
+/** gets pinned state of an opcode */
+op_pinned get_op_pinned(const ir_op *op);
 
 /** Sets pinned in the opcode.  Setting it to floating has no effect
    for Block, Phi and control flow nodes. */
-void      set_op_pinned(ir_op *op, op_pinned pinned);
+void set_op_pinned(ir_op *op, op_pinned pinned);
 
 /** Returns true if op is one of Start, End, Jmp, Cond, Return, Raise or Bad. */
-int is_cfopcode(ir_op *op);
+int is_cfopcode(const ir_op *op);
 
 /** Returns true if the operation manipulates interprocedural control flow:
    CallBegin, EndReg, EndExcept */
-int is_ip_cfopcode(ir_op *op);
+int is_ip_cfopcode(const ir_op *op);
 
 /** Returns the attribute size of nodes of this opcode.
    @note Use not encouraged, internal feature. */
-int    get_op_attr_size (ir_op *op);
+int get_op_attr_size (const ir_op *op);
 
 # endif /* _IROP_H_ */