X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=scripts%2Fir_spec.py;h=158de80a80aadd986793b029b129be47467fc547;hb=4764ebb82834c3370640980c9299f0dbb1ac598d;hp=f451ae607ecd56ba70c878ee2180c3c47e43f971;hpb=e3717f7120e3c7dc84d33586bfd137d9a2cb7608;p=libfirm diff --git a/scripts/ir_spec.py b/scripts/ir_spec.py index f451ae607..158de80a8 100755 --- a/scripts/ir_spec.py +++ b/scripts/ir_spec.py @@ -27,7 +27,7 @@ class Add(Binop): flags = ["commutative"] class Alloc(Op): - ins = [ "mem", "size" ] + ins = [ "mem", "count" ] outs = [ "M", "X_regular", "X_except", "res" ] flags = [ "fragile", "uses_memory" ] attrs = [ @@ -43,9 +43,7 @@ class Alloc(Op): pinned = "yes" attr_struct = "alloc_attr" d_post = ''' - #if PRECISE_EXC_CONTEXT firm_alloc_frag_arr(res, op_Alloc, &res->attr.alloc.exc.frag_arr); - #endif ''' class Anchor(Op): @@ -63,9 +61,10 @@ class ASM(Op): mode = "mode_T" arity = "variable" flags = [ "keep", "uses_memory" ] - attr_struct = "asm_attr" pinned = "memory" pinned_init = "op_pin_state_pinned" + attr_struct = "asm_attr" + attrs_name = "assem" attrs = [ dict( name = "input_constraints", @@ -74,6 +73,7 @@ class ASM(Op): dict( name = "n_output_constraints", type = "int", + noprop = True, ), dict( name = "output_constraints", @@ -82,6 +82,7 @@ class ASM(Op): dict( name = "n_clobbers", type = "int", + noprop = True, ), dict( name = "clobbers", @@ -132,32 +133,12 @@ class Block(Op): set_Block_matured(res, 1); set_Block_block_visited(res, 0); - ''' - - d_pre = ''' - int i; - int has_unknown = 0; - ''' - d_post = ''' /* Create and initialize array for Phi-node construction. */ - if (get_irg_phase_state(current_ir_graph) == phase_building) { - res->attr.block.graph_arr = NEW_ARR_D(ir_node *, current_ir_graph->obst, - current_ir_graph->n_loc); - memset(res->attr.block.graph_arr, 0, sizeof(ir_node *)*current_ir_graph->n_loc); + if (get_irg_phase_state(irg) == phase_building) { + res->attr.block.graph_arr = NEW_ARR_D(ir_node *, irg->obst, irg->n_loc); + memset(res->attr.block.graph_arr, 0, irg->n_loc * sizeof(ir_node*)); } - - for (i = arity - 1; i >= 0; i--) - if (is_Unknown(in[i])) { - has_unknown = 1; - break; - } - - if (!has_unknown) res = optimize_node(res); - - current_ir_graph->current_block = res; - - IRN_VRFY_IRG(res, current_ir_graph); ''' java_add = ''' @@ -197,10 +178,9 @@ class Bound(Op): pinned = "exception" pinned_init = "op_pin_state_pinned" attr_struct = "bound_attr" + attrs_name = "bound" d_post = ''' - #if PRECISE_EXC_CONTEXT firm_alloc_frag_arr(res, op_Bound, &res->attr.bound.exc.frag_arr); - #endif ''' class Break(Op): @@ -211,7 +191,7 @@ class Break(Op): class Builtin(Op): ins = [ "mem" ] arity = "variable" - outs = [ "M_regular", "X_regular", "X_except", "T_result", "M_except", "P_value_res_base" ] + outs = [ "M", "X_regular", "X_except", "T_result", "P_value_res_base" ] flags = [ "uses_memory" ] attrs = [ dict( @@ -233,12 +213,18 @@ class Builtin(Op): class Call(Op): ins = [ "mem", "ptr" ] arity = "variable" - outs = [ "M_regular", "X_regular", "X_except", "T_result", "M_except", "P_value_res_base" ] + outs = [ "M", "X_regular", "X_except", "T_result", "P_value_res_base" ] flags = [ "fragile", "uses_memory" ] attrs = [ dict( type = "ir_type*", name = "type" + ), + dict( + type = "unsigned", + name = "tail_call", + # the tail call attribute can only be set by analysis + init = "0" ) ] attr_struct = "call_attr" @@ -248,9 +234,7 @@ class Call(Op): assert((get_unknown_type() == type) || is_Method_type(type)); ''' d_post = ''' - #if PRECISE_EXC_CONTEXT firm_alloc_frag_arr(res, op_Call, &res->attr.call.exc.frag_arr); - #endif ''' class CallBegin(Op): @@ -271,11 +255,9 @@ class CallBegin(Op): class Carry(Binop): flags = [ "commutative" ] -class Cast(Op): - ins = [ "op" ] +class Cast(Unop): mode = "get_irn_mode(irn_op)" flags = [ "highlevel" ] - pinned = "no" attrs = [ dict( type = "ir_type*", @@ -286,7 +268,24 @@ class Cast(Op): init = "assert(is_atomic_type(type));" class Cmp(Binop): - outs = [ "False", "Eq", "Lt", "Le", "Gt", "Ge", "Lg", "Leg", "Uo", "Ue", "Ul", "Ule", "Ug", "Uge", "Ne", "True" ] + outs = [ + ("False", "always false"), + ("Eq", "equal"), + ("Lt", "less"), + ("Le", "less or equal"), + ("Gt", "greater"), + ("Ge", "greater or equal"), + ("Lg", "less or greater"), + ("Leg", "less, equal or greater ('not equal' for integer numbers)"), + ("Uo", "unordered"), + ("Ue", "unordered or equal"), + ("Ul", "unordered or less"), + ("Ule", "unordered, less or equal"), + ("Ug", "unordered or greater"), + ("Uge", "onordered, greater or equal"), + ("Ne", "unordered, less, greater or equal ('not equal' for floatingpoint numbers)"), + ("True", "always true"), + ] flags = [] class Cond(Op): @@ -295,11 +294,6 @@ class Cond(Op): flags = [ "cfopcode", "forking" ] pinned = "yes" attrs = [ - dict( - name = "kind", - type = "cond_kind", - init = "dense" - ), dict( name = "default_proj", type = "long", @@ -325,6 +319,7 @@ class Confirm(Op): ), ] attr_struct = "confirm_attr" + attrs_name = "confirm" class Const(Op): mode = "" @@ -354,6 +349,7 @@ class Conv(Unop): ) ] attr_struct = "conv_attr" + attrs_name = "conv" class CopyB(Op): ins = [ "mem", "dst", "src" ] @@ -366,12 +362,11 @@ class CopyB(Op): ) ] attr_struct = "copyb_attr" + attrs_name = "copyb" pinned = "memory" pinned_init = "op_pin_state_pinned" d_post = ''' - #if PRECISE_EXC_CONTEXT firm_alloc_frag_arr(res, op_CopyB, &res->attr.copyb.exc.frag_arr); - #endif ''' class Div(Op): @@ -399,9 +394,7 @@ class Div(Op): op_index = 1 arity_override = "oparity_binary" d_post = ''' - #if PRECISE_EXC_CONTEXT firm_alloc_frag_arr(res, op_Div, &res->attr.except.frag_arr); - #endif ''' class DivMod(Op): @@ -420,9 +413,7 @@ class DivMod(Op): op_index = 1 arity_override = "oparity_binary" d_post = ''' - #if PRECISE_EXC_CONTEXT firm_alloc_frag_arr(res, op_DivMod, &res->attr.except.frag_arr); - #endif ''' class Dummy(Op): @@ -468,6 +459,7 @@ class Filter(Op): ] pinned = "yes" attr_struct = "filter_attr" + attrs_name = "filter" java_noconstr = True class Free(Op): @@ -500,7 +492,7 @@ class IJmp(Op): class InstOf(Op): ins = [ "store", "obj" ] - outs = [ "M", "X_regular", "X_except", "res", "M_except" ] + outs = [ "M", "X_regular", "X_except", "res" ] flags = [ "highlevel" ] attrs = [ dict( @@ -539,9 +531,7 @@ class Load(Op): ), ] d_post = ''' -#if PRECISE_EXC_CONTEXT firm_alloc_frag_arr(res, op_Load, &res->attr.load.exc.frag_arr); -#endif ''' class Minus(Unop): @@ -563,9 +553,7 @@ class Mod(Op): op_index = 1 arity_override = "oparity_binary" d_post = ''' - #if PRECISE_EXC_CONTEXT firm_alloc_frag_arr(res, op_Mod, &res->attr.except.frag_arr); - #endif ''' class Mul(Binop): @@ -593,11 +581,11 @@ class Or(Binop): flags = [ "commutative" ] class Phi(Op): - pinned = "yes" - arity = "variable" - flags = [] - attr_struct = "phi_attr" - custom_is = True + pinned = "yes" + arity = "variable" + flags = [] + attr_struct = "phi_attr" + custom_is = True java_noconstr = True init = ''' /* Memory Phis in endless loops must be kept alive. @@ -613,14 +601,19 @@ class Pin(Op): pinned = "yes" class Proj(Op): - ins = [ "pred" ] - flags = [] - pinned = "no" - attrs = [ + ins = [ "pred" ] + flags = [] + pinned = "no" + knownBlock = True + knownGraph = True + block = "get_nodes_block(irn_pred)" + graph = "get_irn_irg(irn_pred)" + attrs = [ dict( type = "long", name = "proj", - initname = "" + initname = "", + noprop = False, ) ] attr_struct = "long" @@ -642,9 +635,7 @@ class Quot(Op): op_index = 1 arity_override = "oparity_binary" d_post = ''' - #if PRECISE_EXC_CONTEXT firm_alloc_frag_arr(res, op_Quot, &res->attr.except.frag_arr); - #endif ''' class Raise(Op): @@ -706,9 +697,7 @@ class Store(Op): ), ] d_post = ''' -#if PRECISE_EXC_CONTEXT firm_alloc_frag_arr(res, op_Store, &res->attr.store.exc.frag_arr); -#endif ''' class Sub(Binop): @@ -722,7 +711,8 @@ class SymConst(Op): attrs = [ dict( type = "ir_entity*", - name = "entity" + name = "entity", + noprop = True ) ] attr_struct = "symconst_attr"