avoid generic names like flags in generator
[libfirm] / ir / be / arm / arm_spec.pl
index 944059b..2dc7368 100644 (file)
@@ -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" }
        ],
 );
@@ -80,25 +72,25 @@ $default_attr_type = "arm_attr_t";
 $default_copy_attr = "arm_copy_attr";
 
 %init_attr = (
-       arm_attr_t           => "\tinit_arm_attributes(res, flags, in_reqs, exec_units, n_res);",
+       arm_attr_t           => "\tinit_arm_attributes(res, irn_flags_, in_reqs, exec_units, n_res);",
        arm_SymConst_attr_t  =>
-               "\tinit_arm_attributes(res, flags, in_reqs, exec_units, n_res);\n".
+               "\tinit_arm_attributes(res, irn_flags_, in_reqs, exec_units, n_res);\n".
                "\tinit_arm_SymConst_attributes(res, entity, symconst_offset);",
-       arm_CondJmp_attr_t   => "\tinit_arm_attributes(res, flags, in_reqs, exec_units, n_res);",
-       arm_SwitchJmp_attr_t => "\tinit_arm_attributes(res, flags, in_reqs, exec_units, n_res);",
-       arm_fConst_attr_t    => "\tinit_arm_attributes(res, flags, in_reqs, exec_units, n_res);",
+       arm_CondJmp_attr_t   => "\tinit_arm_attributes(res, irn_flags_, in_reqs, exec_units, n_res);",
+       arm_SwitchJmp_attr_t => "\tinit_arm_attributes(res, irn_flags_, in_reqs, exec_units, n_res);",
+       arm_fConst_attr_t    => "\tinit_arm_attributes(res, irn_flags_, in_reqs, exec_units, n_res);",
        arm_load_store_attr_t =>
-               "\tinit_arm_attributes(res, flags, in_reqs, exec_units, n_res);\n".
+               "\tinit_arm_attributes(res, irn_flags_, in_reqs, exec_units, n_res);\n".
                "\tinit_arm_load_store_attributes(res, ls_mode, entity, entity_sign, offset, is_frame_entity);",
        arm_shifter_operand_t =>
-               "\tinit_arm_attributes(res, flags, in_reqs, exec_units, n_res);\n",
+               "\tinit_arm_attributes(res, irn_flags_, in_reqs, exec_units, n_res);\n",
        arm_cmp_attr_t =>
-               "\tinit_arm_attributes(res, flags, in_reqs, exec_units, n_res);\n",
+               "\tinit_arm_attributes(res, irn_flags_, in_reqs, exec_units, n_res);\n",
        arm_farith_attr_t =>
-               "\tinit_arm_attributes(res, flags, in_reqs, exec_units, n_res);\n".
+               "\tinit_arm_attributes(res, irn_flags_, in_reqs, exec_units, n_res);\n".
                "\tinit_arm_farith_attributes(res, op_mode);",
        arm_CopyB_attr_t =>
-               "\tinit_arm_attributes(res, flags, in_reqs, exec_units, n_res);\n".
+               "\tinit_arm_attributes(res, irn_flags_, in_reqs, exec_units, n_res);\n".
                "\tinit_arm_CopyB_attributes(res, size);",
 );
 
@@ -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 => {
@@ -352,7 +351,6 @@ EmptyReg => {
 },
 
 CopyB => {
-       op_flags  => [ "fragile" ],
        state     => "pinned",
        attr      => "unsigned size",
        attr_type => "arm_CopyB_attr_t",
@@ -400,9 +398,9 @@ B => {
        state     => "pinned",
        mode      => "mode_T",
        reg_req   => { in => [ "flags" ], out => [ "none", "none" ] },
-       attr      => "pn_Cmp pnc",
+       attr      => "ir_relation relation",
        attr_type => "arm_CondJmp_attr_t",
-       init_attr => "\tset_arm_CondJmp_pnc(res, pnc);",
+       init_attr => "\tset_arm_CondJmp_relation(res, relation);",
 },
 
 Jmp => {
@@ -419,13 +417,14 @@ SwitchJmp => {
        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  => [ "labeled", "fragile" ],
+       op_flags  => [ "labeled" ],
        state     => "exc_pinned",
        ins       => [ "ptr", "mem" ],
        outs      => [ "res", "M" ],
@@ -436,7 +435,7 @@ Ldr => {
 },
 
 Str => {
-       op_flags  => [ "labeled", "fragile" ],
+       op_flags  => [ "labeled" ],
        state     => "exc_pinned",
        ins       => [ "ptr", "val", "mem" ],
        outs      => [ "M" ],
@@ -448,7 +447,7 @@ Str => {
 },
 
 StoreStackM4Inc => {
-       op_flags  => [ "labeled", "fragile" ],
+       op_flags  => [ "labeled" ],
        irn_flags => [ "rematerializable" ],
        state     => "exc_pinned",
        reg_req   => { in => [ "sp", "gp", "gp", "gp", "gp", "none" ], out => [ "sp:I|S", "none" ] },
@@ -457,7 +456,7 @@ StoreStackM4Inc => {
 },
 
 LoadStackM3Epilogue => {
-       op_flags  => [ "labeled", "fragile" ],
+       op_flags  => [ "labeled" ],
        irn_flags => [ "rematerializable" ],
        state     => "exc_pinned",
        reg_req   => { in => [ "sp", "none" ], out => [ "r11:I", "sp:I|S", "pc:I", "none" ] },
@@ -532,7 +531,7 @@ Cmfe => {
 },
 
 Ldf => {
-       op_flags  => [ "labeled", "fragile" ],
+       op_flags  => [ "labeled" ],
        state     => "exc_pinned",
        ins       => [ "ptr", "mem" ],
        outs      => [ "res", "M" ],
@@ -543,7 +542,7 @@ Ldf => {
 },
 
 Stf => {
-       op_flags  => [ "labeled", "fragile" ],
+       op_flags  => [ "labeled" ],
        state     => "exc_pinned",
        ins       => [ "ptr", "val", "mem" ],
        outs      => [ "M" ],
@@ -560,7 +559,7 @@ Stf => {
 fConst => {
        op_flags  => [ "constlike" ],
        irn_flags => [ "rematerializable" ],
-       attr      => "tarval *tv",
+       attr      => "ir_tarval *tv",
        init_attr => "attr->tv = tv;",
        mode      => "get_tarval_mode(tv)",
        reg_req   => { out => [ "fpa" ] },