X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Farm%2Farm_spec.pl;h=f4746d44cb62973892962fc2c5f7541710ef7d3d;hb=ce6161a7e42a48f7422b7babcc64d8ace18e2687;hp=42410f42621890f921044a1be340856d749907db;hpb=fd5331da46a1c09e53d010f7594a17c08c7a1e41;p=libfirm diff --git a/ir/be/arm/arm_spec.pl b/ir/be/arm/arm_spec.pl index 42410f426..f4746d44c 100644 --- a/ir/be/arm/arm_spec.pl +++ b/ir/be/arm/arm_spec.pl @@ -12,48 +12,40 @@ $mode_gp = "mode_Iu"; $mode_flags = "mode_Bu"; $mode_fp = "mode_E"; -# register types: -$normal = 0; # no special type -$caller_save = 1; # caller save (register must be saved by the caller of a function) -$callee_save = 2; # callee save (register must be saved by the called function) -$ignore = 4; # ignore (do not assign this register) -$arbitrary = 8; # emitter can choose an arbitrary register of this class -$virtual = 16; # the register is a virtual one -$state = 32; # register represents a state # NOTE: Last entry of each class is the largest Firm-Mode a register can hold %reg_classes = ( gp => [ - { name => "r0", type => $caller_save }, - { name => "r1", type => $caller_save }, - { name => "r2", type => $caller_save }, - { name => "r3", type => $caller_save }, - { name => "r4", type => $callee_save }, - { name => "r5", type => $callee_save }, - { name => "r6", type => $callee_save }, - { name => "r7", type => $callee_save }, - { name => "r8", type => $callee_save }, - { name => "r9", type => $callee_save }, - { name => "r10", type => $callee_save }, - { name => "r11", type => $callee_save }, - { name => "r12", type => $ignore }, # reserved for linker/immediate fixups - { name => "sp", type => $ignore }, # this is our stack pointer - { name => "lr", type => $callee_save | $caller_save }, # this is our return address - { name => "pc", type => $ignore }, # this is our program counter + { name => "r0" }, + { name => "r1" }, + { name => "r2" }, + { name => "r3" }, + { name => "r4" }, + { name => "r5" }, + { name => "r6" }, + { name => "r7" }, + { name => "r8" }, + { name => "r9" }, + { name => "r10" }, + { name => "r11" }, + { name => "r12" }, + { name => "sp" }, + { name => "lr" }, + { name => "pc" }, { mode => $mode_gp } ], fpa => [ - { name => "f0", type => $caller_save }, - { name => "f1", type => $caller_save }, - { name => "f2", type => $caller_save }, - { name => "f3", type => $caller_save }, - { name => "f4", type => $caller_save }, - { name => "f5", type => $caller_save }, - { name => "f6", type => $caller_save }, - { name => "f7", type => $caller_save }, + { name => "f0" }, + { name => "f1" }, + { name => "f2" }, + { name => "f3" }, + { name => "f4" }, + { name => "f5" }, + { name => "f6" }, + { name => "f7" }, { mode => $mode_fp } ], flags => [ - { name => "fl", type => 0 }, + { name => "fl" }, { mode => $mode_flags, flags => "manual_ra" } ], ); @@ -202,7 +194,7 @@ my %cmp_shifter_operand_constructors = ( %nodes = ( Add => { - irn_flags => "R", + irn_flags => [ "rematerializable" ], emit => '. add %D0, %S0, %SO', mode => $mode_gp, attr_type => "arm_shifter_operand_t", @@ -210,21 +202,21 @@ Add => { }, Mul => { - irn_flags => "R", + irn_flags => [ "rematerializable" ], reg_req => { in => [ "gp", "gp" ], out => [ "!in_r1" ] }, emit =>'. mul %D0, %S0, %S1', mode => $mode_gp, }, Smull => { - irn_flags => "R", + irn_flags => [ "rematerializable" ], reg_req => { in => [ "gp", "gp" ], out => [ "gp", "gp" ] }, emit =>'. smull %D0, %D1, %S0, %S1', outs => [ "low", "high" ], }, Umull => { - irn_flags => "R", + irn_flags => [ "rematerializable" ], reg_req => { in => [ "gp", "gp" ], out => [ "gp", "gp" ] }, emit =>'. umull %D0, %D1, %S0, %S1', outs => [ "low", "high" ], @@ -232,14 +224,14 @@ Umull => { }, Mla => { - irn_flags => "R", + irn_flags => [ "rematerializable" ], reg_req => { in => [ "gp", "gp", "gp" ], out => [ "!in_r1" ] }, emit =>'. mla %D0, %S0, %S1, %S2', mode => $mode_gp, }, And => { - irn_flags => "R", + irn_flags => [ "rematerializable" ], emit => '. and %D0, %S0, %SO', mode => $mode_gp, attr_type => "arm_shifter_operand_t", @@ -247,7 +239,7 @@ And => { }, Or => { - irn_flags => "R", + irn_flags => [ "rematerializable" ], emit => '. orr %D0, %S0, %SO', mode => $mode_gp, attr_type => "arm_shifter_operand_t", @@ -255,7 +247,7 @@ Or => { }, Eor => { - irn_flags => "R", + irn_flags => [ "rematerializable" ], emit => '. eor %D0, %S0, %SO', mode => $mode_gp, attr_type => "arm_shifter_operand_t", @@ -263,7 +255,7 @@ Eor => { }, Bic => { - irn_flags => "R", + irn_flags => [ "rematerializable" ], emit => '. bic %D0, %S0, %SO', mode => $mode_gp, attr_type => "arm_shifter_operand_t", @@ -271,7 +263,7 @@ Bic => { }, Sub => { - irn_flags => "R", + irn_flags => [ "rematerializable" ], emit => '. sub %D0, %S0, %SO', mode => $mode_gp, attr_type => "arm_shifter_operand_t", @@ -279,7 +271,7 @@ Sub => { }, Rsb => { - irn_flags => "R", + irn_flags => [ "rematerializable" ], emit => '. rsb %D0, %S0, %SO', mode => $mode_gp, attr_type => "arm_shifter_operand_t", @@ -287,7 +279,7 @@ Rsb => { }, Mov => { - irn_flags => "R", + irn_flags => [ "rematerializable" ], arity => "variable", emit => '. mov %D0, %SO', mode => $mode_gp, @@ -296,7 +288,7 @@ Mov => { }, Mvn => { - irn_flags => "R", + irn_flags => [ "rematerializable" ], attr_type => "arm_shifter_operand_t", arity => "variable", emit => '. mvn %D0, %SO', @@ -304,6 +296,13 @@ Mvn => { constructors => \%unop_shifter_operand_constructors, }, +Clz => { + irn_flags => [ "rematerializable" ], + reg_req => { in => [ "gp" ], out => [ "gp" ] }, + emit =>'. clz %D0, %S0', + mode => $mode_gp, +}, + # mov lr, pc\n mov pc, XXX -- This combination is used for calls to function # pointers LinkMovPC => { @@ -316,7 +315,6 @@ LinkMovPC => { "\tarch_irn_add_flags(res, arch_irn_flags_modify_flags);", emit => ". mov lr, pc\n". ". mov pc, %SO", - mode => "mode_T", }, # mov lr, pc\n ldr pc, XXX -- This combination is used for calls to function @@ -330,7 +328,6 @@ LinkLdrPC => { custominit => "arch_irn_add_flags(res, arch_irn_flags_modify_flags);", emit => ". mov lr, pc\n". ". ldr pc, %SO", - mode => "mode_T", }, Bl => { @@ -341,13 +338,12 @@ Bl => { attr => "ir_entity *entity, int symconst_offset", custominit => "arch_irn_add_flags(res, arch_irn_flags_modify_flags);", emit => '. bl %SC', - mode => "mode_T", }, # this node produces ALWAYS an empty (tempary) gp reg and cannot be CSE'd EmptyReg => { - op_flags => "c", - irn_flags => "R", + op_flags => [ "constlike" ], + irn_flags => [ "rematerializable" ], reg_req => { out => [ "gp" ] }, emit => '. /* %D0 now available for calculations */', cmp_attr => 'return 1;', @@ -355,7 +351,7 @@ EmptyReg => { }, CopyB => { - op_flags => "F|H", + op_flags => [ "fragile" ], state => "pinned", attr => "unsigned size", attr_type => "arm_CopyB_attr_t", @@ -364,8 +360,8 @@ CopyB => { }, FrameAddr => { - op_flags => "c", - irn_flags => "R", + op_flags => [ "constlike" ], + irn_flags => [ "rematerializable" ], attr => "ir_entity *entity, int symconst_offset", reg_req => { in => [ "gp" ], out => [ "gp" ] }, ins => [ "base" ], @@ -374,8 +370,8 @@ FrameAddr => { }, SymConst => { - op_flags => "c", - irn_flags => "R", + op_flags => [ "constlike" ], + irn_flags => [ "rematerializable" ], attr => "ir_entity *entity, int symconst_offset", reg_req => { out => [ "gp" ] }, attr_type => "arm_SymConst_attr_t", @@ -383,7 +379,7 @@ SymConst => { }, Cmp => { - irn_flags => "R|F", + irn_flags => [ "rematerializable", "modify_flags" ], emit => '. cmp %S0, %SO', mode => $mode_flags, attr_type => "arm_cmp_attr_t", @@ -391,7 +387,7 @@ Cmp => { }, Tst => { - irn_flags => "R|F", + irn_flags => [ "rematerializable", "modify_flags" ], emit => '. tst %S0, %SO', mode => $mode_flags, attr_type => "arm_cmp_attr_t", @@ -399,7 +395,7 @@ Tst => { }, B => { - op_flags => "L|X|Y", + op_flags => [ "labeled", "cfopcode", "forking" ], state => "pinned", mode => "mode_T", reg_req => { in => [ "flags" ], out => [ "none", "none" ] }, @@ -410,25 +406,26 @@ B => { Jmp => { state => "pinned", - op_flags => "X", - irn_flags => "J", + op_flags => [ "cfopcode" ], + irn_flags => [ "simple_jump" ], reg_req => { out => [ "none" ] }, mode => "mode_X", }, SwitchJmp => { - op_flags => "L|X|Y", + op_flags => [ "labeled", "cfopcode", "forking" ], state => "pinned", mode => "mode_T", attr => "int n_projs, long def_proj_num", init_attr => "\tset_arm_SwitchJmp_n_projs(res, n_projs);\n". - "\tset_arm_SwitchJmp_default_proj_num(res, def_proj_num);", + "\tset_arm_SwitchJmp_default_proj_num(res, def_proj_num);\n". + "\tinfo->out_infos = NULL;", reg_req => { in => [ "gp" ], out => [ "none" ] }, attr_type => "arm_SwitchJmp_attr_t", }, Ldr => { - op_flags => "L|F", + op_flags => [ "labeled", "fragile" ], state => "exc_pinned", ins => [ "ptr", "mem" ], outs => [ "res", "M" ], @@ -439,10 +436,10 @@ Ldr => { }, Str => { - op_flags => "L|F", + op_flags => [ "labeled", "fragile" ], state => "exc_pinned", ins => [ "ptr", "val", "mem" ], - outs => [ "mem" ], + outs => [ "M" ], reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] }, emit => '. str%SM %S1, [%S0, #%O]', mode => "mode_M", @@ -451,8 +448,8 @@ Str => { }, StoreStackM4Inc => { - op_flags => "L|F", - irn_flags => "R", + op_flags => [ "labeled", "fragile" ], + irn_flags => [ "rematerializable" ], state => "exc_pinned", reg_req => { in => [ "sp", "gp", "gp", "gp", "gp", "none" ], out => [ "sp:I|S", "none" ] }, emit => '. stmfd %S0!, {%S1, %S2, %S3, %S4}', @@ -460,8 +457,8 @@ StoreStackM4Inc => { }, LoadStackM3Epilogue => { - op_flags => "L|F", - irn_flags => "R", + op_flags => [ "labeled", "fragile" ], + irn_flags => [ "rematerializable" ], state => "exc_pinned", reg_req => { in => [ "sp", "none" ], out => [ "r11:I", "sp:I|S", "pc:I", "none" ] }, emit => '. ldmfd %S0, {%D0, %D1, %D2}', @@ -471,7 +468,7 @@ LoadStackM3Epilogue => { Adf => { - irn_flags => "R", + irn_flags => [ "rematerializable" ], reg_req => { in => [ "fpa", "fpa" ], out => [ "fpa" ] }, emit => '. adf%AM %D0, %S0, %S1', attr_type => "arm_farith_attr_t", @@ -480,7 +477,7 @@ Adf => { }, Muf => { - irn_flags => "R", + irn_flags => [ "rematerializable" ], reg_req => { in => [ "fpa", "fpa" ], out => [ "fpa" ] }, emit =>'. muf%AM %D0, %S0, %S1', attr_type => "arm_farith_attr_t", @@ -489,7 +486,7 @@ Muf => { }, Suf => { - irn_flags => "R", + irn_flags => [ "rematerializable" ], reg_req => { in => [ "fpa", "fpa" ], out => [ "fpa" ] }, emit => '. suf%AM %D0, %S0, %S1', attr_type => "arm_farith_attr_t", @@ -507,7 +504,7 @@ Dvf => { }, Mvf => { - irn_flags => "R", + irn_flags => [ "rematerializable" ], reg_req => { in => [ "fpa" ], out => [ "fpa" ] }, emit => '. mvf%AM %S0, %D0', attr_type => "arm_farith_attr_t", @@ -515,8 +512,17 @@ Mvf => { mode => $mode_fp, }, +FltX => { + irn_flags => [ "rematerializable" ], + reg_req => { in => [ "gp" ], out => [ "fpa" ] }, + emit => '. flt%AM %D0, %S0', + attr_type => "arm_farith_attr_t", + attr => "ir_mode *op_mode", + mode => $mode_fp, +}, + Cmfe => { - irn_flags => "R|F", + irn_flags => [ "rematerializable", "modify_flags" ], mode => $mode_flags, attr_type => "arm_cmp_attr_t", attr => "bool ins_permuted", @@ -526,7 +532,7 @@ Cmfe => { }, Ldf => { - op_flags => "L|F", + op_flags => [ "labeled", "fragile" ], state => "exc_pinned", ins => [ "ptr", "mem" ], outs => [ "res", "M" ], @@ -537,7 +543,7 @@ Ldf => { }, Stf => { - op_flags => "L|F", + op_flags => [ "labeled", "fragile" ], state => "exc_pinned", ins => [ "ptr", "val", "mem" ], outs => [ "M" ], @@ -552,9 +558,9 @@ Stf => { # floating point constants # fConst => { - op_flags => "c", - irn_flags => "R", - attr => "tarval *tv", + op_flags => [ "constlike" ], + irn_flags => [ "rematerializable" ], + attr => "ir_tarval *tv", init_attr => "attr->tv = tv;", mode => "get_tarval_mode(tv)", reg_req => { out => [ "fpa" ] },