X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Farm%2Farm_spec.pl;h=a17d473d8031de011f4d0758123daea391b0c48b;hb=1cfc3b8913222d4e543ba38b6cb23ae55cf37a76;hp=a0174537cb6cd5aff3edf2de70490be23f1e47f9;hpb=a2e273dd80eb3392e684684c8d1980fd1993c7a9;p=libfirm diff --git a/ir/be/arm/arm_spec.pl b/ir/be/arm/arm_spec.pl index a0174537c..a17d473d8 100644 --- a/ir/be/arm/arm_spec.pl +++ b/ir/be/arm/arm_spec.pl @@ -106,33 +106,33 @@ $mode_gp = "mode_Iu"; $mode_fpa = "mode_E"; # register types: -# 0 - no special type -# 1 - caller save (register must be saved by the caller of a function) -# 2 - callee save (register must be saved by the called function) -# 4 - ignore (do not assign this register) -# 8 - emitter can choose an arbitrary register of this class -# 16 - the register is a virtual one -# 32 - register represents a state +$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" => 1 }, - { "name" => "r1", "type" => 1 }, - { "name" => "r2", "type" => 1 }, - { "name" => "r3", "type" => 1 }, - { "name" => "r4", "type" => 2 }, - { "name" => "r5", "type" => 2 }, - { "name" => "r6", "type" => 2 }, - { "name" => "r7", "type" => 2 }, - { "name" => "r8", "type" => 2 }, - { "name" => "r9", "type" => 2 }, - { "name" => "r10", "type" => 2 }, - { "name" => "r11", "type" => 2 }, - { "name" => "r12", "type" => 4 | 2 }, # reserved for linker - { "name" => "sp", "type" => 4 | 2 }, # this is our stack pointer - { "name" => "lr", "type" => 2 | 1 }, # this is our return address - { "name" => "pc", "type" => 4 | 2 }, # this is our program counter - { name => "gp_UKNWN", type => 4 | 8 | 16 }, # we need a dummy register for Unknown nodes + { "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 | $callee_save }, # reserved for linker + { "name" => "sp", "type" => $ignore | $callee_save }, # this is our stack pointer + { "name" => "lr", "type" => $callee_save | $caller_save }, # this is our return address + { "name" => "pc", "type" => $ignore | $callee_save }, # this is our program counter + { name => "gp_UKNWN", type => $ignore | $arbitrary | $virtual }, # we need a dummy register for Unknown nodes { "mode" => $mode_gp } ], fpa => [ @@ -445,25 +445,24 @@ Shl => { Shr => { irn_flags => "R", - comment => "construct Shr: Shr(a, b) = a >> b", - reg_req => { "in" => [ "gp", "gp" ], "out" => [ "in_r1" ] }, + comment => "construct Shr: Shr(a, b) = a >>u b", + reg_req => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] }, emit => '. mov %D0, %S0, lsr %S1' }, Shrs => { irn_flags => "R", - comment => "construct Shrs: Shrs(a, b) = a >> b", - reg_req => { "in" => [ "gp", "gp" ], "out" => [ "in_r1" ] }, + comment => "construct Shrs: Shrs(a, b) = a >>s b", + reg_req => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] }, emit => '. mov %D0, %S0, asr %S1' }, -#RotR => { -# irn_flags => "R", -# comment => "construct RotR: RotR(a, b) = a ROTR b", -# reg_req => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] }, -# emit => '. mov %D0, %S0, ror %S1 /* RotR(%S0, %S1) -> %D0, (%A1, %A2) */' -## emit => '. ror %S0, %S1, %D0' -#}, +Ror => { + irn_flags => "R", + comment => "construct Ror: Ror(a, b) = a <> b", + reg_req => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] }, + emit => '. mov %D0, %S0, ror %S1' +}, #RotL => { # irn_flags => "R", @@ -579,6 +578,17 @@ CmpBra => { attr_type => "arm_CondJmp_attr_t", }, +TstBra => { + op_flags => "L|X|Y", + state => "pinned", + comment => "construct conditional branch: TST A, B && JMPxx LABEL", + mode => "mode_T", + attr => "int proj_num", + init_attr => "\tset_arm_CondJmp_proj_num(res, proj_num);", + reg_req => { "in" => [ "gp", "gp" ], "out" => [ "none", "none"] }, + attr_type => "arm_CondJmp_attr_t", +}, + SwitchJmp => { op_flags => "L|X|Y", state => "pinned", @@ -1022,9 +1032,9 @@ AddSP => { outs => [ "stack:I|S", "M" ], }, -SubSP => { +SubSPandCopy => { #irn_flags => "I", - comment => "construct Sub from stack pointer", + comment => "construct Sub from stack pointer and copy to Register", reg_req => { in => [ "sp", "gp", "none" ], out => [ "in_r1", "gp", "none" ] }, ins => [ "stack", "size", "mem" ], emit => ". sub %D0, %S0, %S1\n".