made CondJmp and SwitchJmp pinned
[libfirm] / ir / be / arm / arm_spec.pl
index 6db1979..ad9d854 100644 (file)
@@ -123,9 +123,9 @@ $new_emit_syntax = 1;
                          { "name" => "r10", "type" => 2 },
                          { "name" => "r11", "type" => 2 },
                          { "name" => "r12", "type" => 6 }, # reserved for linker
-                         { "name" => "sp", "realname" => "r13", "type" => 6 }, # this is our stack pointer
-                         { "name" => "lr", "realname" => "r14", "type" => 3 }, # this is our return address
-                         { "name" => "pc", "realname" => "r15", "type" => 6 }, # this is our program counter
+                         { "name" => "sp", "type" => 6 }, # this is our stack pointer
+                         { "name" => "lr", "type" => 3 }, # this is our return address
+                         { "name" => "pc", "type" => 6 }, # this is our program counter
                          { "mode" => "mode_Iu" }
                        ],
   fpa  => [
@@ -133,10 +133,10 @@ $new_emit_syntax = 1;
                          { "name" => "f1", "type" => 1 },
                          { "name" => "f2", "type" => 1 },
                          { "name" => "f3", "type" => 1 },
-                         { "name" => "f4", "type" => 2 },
-                         { "name" => "f5", "type" => 2 },
-                         { "name" => "f6", "type" => 2 },
-                         { "name" => "f7", "type" => 2 },
+                         { "name" => "f4", "type" => 1 },
+                         { "name" => "f5", "type" => 1 },
+                         { "name" => "f6", "type" => 1 },
+                         { "name" => "f7", "type" => 1 },
                          { "mode" => "mode_E" }
                        ]
 ); # %reg_classes
@@ -472,6 +472,9 @@ Abs => {
 
 # other operations
 
+#
+# this node produces ALWAYS an empty (tempary) gp reg and cannot be CSE'd
+#
 EmptyReg => {
   op_flags  => "c",
   irn_flags => "R",
@@ -487,10 +490,13 @@ Copy => {
 },
 
 CopyB => {
-  op_flags => "F|H",
-  state    => "pinned",
-  comment  => "implements a memcopy: CopyB(dst, src, size, mem) == memcpy(dst, src, size)",
-  reg_req  => { "in" => [ "!sp", "!sp", "gp", "gp", "gp", "none" ], "out" => [ "none" ] },
+  op_flags  => "F|H",
+  state     => "pinned",
+  comment   => "implements a memcopy: CopyB(dst, src, size, mem) == memcpy(dst, src, size)",
+  attr      => "tarval *tv",
+  init_attr => 'attr->value = tv;',
+  reg_req   => { "in" => [ "!sp", "!sp", "gp", "gp", "gp", "none" ], "out" => [ "none" ] },
+  outs      => [ "M" ],
 },
 
 SymConst => {
@@ -505,6 +511,7 @@ SymConst => {
 
 CondJmp => {
   op_flags  => "L|X|Y",
+  state     => "pinned",
   comment   => "construct conditional jump: CMP A, B && JMPxx LABEL",
   mode      => "mode_T",
   attr      => "int proj_num",
@@ -515,6 +522,7 @@ CondJmp => {
 
 SwitchJmp => {
   op_flags  => "L|X|Y",
+  state     => "pinned",
   comment   => "construct switch",
   mode      => "mode_T",
   attr      => "int n_projs, long def_proj_num",
@@ -583,17 +591,7 @@ Storeb => {
   comment   => "construct Store: Store(ptr, val, mem) = ST ptr,val",
   reg_req   => { "in" => [ "gp", "gp", "none" ], "out" => [ "none" ] },
   emit      => '. strb %S1, [%S0, #0]',
-  outs      => [ "M" ],
-},
-
-Storebs => {
-  op_flags  => "L|F",
-  irn_flags => "R",
-  state     => "exc_pinned",
-  comment   => "construct Store: Store(ptr, val, mem) = ST ptr,val",
-  reg_req   => { "in" => [ "gp", "gp", "none" ], "out" => [ "none" ] },
-  emit      => '. strsb %S1, [%S0, #0]',
-  outs      => [ "M" ],
+  mode      => "mode_M",
 },
 
 Storeh => {
@@ -603,17 +601,7 @@ Storeh => {
   comment   => "construct Store: Store(ptr, val, mem) = ST ptr,val",
   reg_req   => { "in" => [ "gp", "gp", "none" ], out => [ "none" ] },
   emit      => '. strh %S1, [%S0, #0]',
-  outs      => [ "M" ],
-},
-
-Storehs => {
-  op_flags  => "L|F",
-  irn_flags => "R",
-  state     => "exc_pinned",
-  comment   => "construct Store: Store(ptr, val, mem) = ST ptr,val",
-  reg_req   => { "in" => [ "gp", "gp", "none" ], out => [ "none" ] },
-  emit      => '. strhs %S1, [%S0, #0]',
-  outs      => [ "M" ],
+  mode      => "mode_M",
 },
 
 Store => {
@@ -623,7 +611,7 @@ Store => {
   comment   => "construct Store: Store(ptr, val, mem) = ST ptr,val",
   reg_req   => { "in" => [ "gp", "gp", "none" ], out => [ "none" ] },
   emit      => '. str %S1, [%S0, #0]',
-  outs      => [ "M" ],
+  mode      => "mode_M",
 },
 
 StoreStackM4Inc => {
@@ -716,26 +704,38 @@ fpaRsb => {
 
 fpaDiv => {
   comment   => "construct FPA Div: Div(a, b) = a / b",
-  reg_req   => { "in" => [ "fpa", "fpa" ], "out" => [ "fpa" ] },
+  attr      => "ir_mode *op_mode",
+  init_attr => "attr->op_mode = op_mode;",
+  reg_req   => { "in" => [ "fpa", "fpa" ], "out" => [ "fpa", "none" ] },
   emit      =>'. dvf%M %D0, %S0, %S1',
+  outs      => [ "res", "M" ],
 },
 
 fpaRdv => {
   comment   => "construct FPA reverse Div: Div(a, b) = b / a",
-  reg_req   => { "in" => [ "fpa", "fpa" ], "out" => [ "fpa" ] },
+  attr      => "ir_mode *op_mode",
+  init_attr => "attr->op_mode = op_mode;",
+  reg_req   => { "in" => [ "fpa", "fpa" ], "out" => [ "fpa", "none" ] },
   emit      =>'. rdf%M %D0, %S0, %S1',
+  outs      => [ "res", "M" ],
 },
 
 fpaFDiv => {
   comment   => "construct FPA Fast Div: Div(a, b) = a / b",
-  reg_req   => { "in" => [ "fpa", "fpa" ], "out" => [ "fpa" ] },
+  attr      => "ir_mode *op_mode",
+  init_attr => "attr->op_mode = op_mode;",
+  reg_req   => { "in" => [ "fpa", "fpa" ], "out" => [ "fpa", "none" ] },
   emit      =>'. fdv%M %D0, %S0, %S1',
+  outs      => [ "res", "M" ],
 },
 
 fpaFRdv => {
   comment   => "construct FPA Fast reverse Div: Div(a, b) = b / a",
-  reg_req   => { "in" => [ "fpa", "fpa" ], "out" => [ "fpa" ] },
+  attr      => "ir_mode *op_mode",
+  init_attr => "attr->op_mode = op_mode;",
+  reg_req   => { "in" => [ "fpa", "fpa" ], "out" => [ "fpa", "none" ] },
   emit      =>'. frd%M %D0, %S0, %S1',
+  outs      => [ "res", "M" ],
 },
 
 fpaMov => {
@@ -761,17 +761,6 @@ fpaAbs => {
 
 # other operations
 
-fpaConst => {
-  op_flags  => "c",
-  irn_flags => "R",
-  comment   => "represents a FPA constant",
-  attr      => "tarval *val",
-  init_attr => 'attr->value = val;',
-  reg_req   => { "out" => [ "fpa" ] },
-  emit      => '. fmov %D0, %C',
-  cmp_attr  => 'return attr_a->value != attr_b->value;',
-},
-
 fpaFlt => {
   irn_flags => "R",
   comment   => "construct a FPA integer->float conversion",
@@ -809,18 +798,52 @@ fpaStf => {
   init_attr => "attr->op_mode = op_mode;",
   reg_req   => { "in" => [ "gp", "fpa", "none" ], "out" => [ "none" ] },
   emit      => '. stf%M [%S1, #0], %S0',
-  outs      => [ "M" ],
+  mode      => "mode_M",
 },
 
 fpaDbl2GP => {
   op_flags  => "L|F",
   irn_flags => "R",
-  state     => "exc_pinned",
   comment   => "construct fp double to 2 gp register transfer",
   reg_req   => { "in" => [ "fpa", "none" ], "out" => [ "gp", "gp", "none" ] },
   outs      => [ "low", "high", "M" ],
 },
 
+AddSP => {
+  irn_flags => "I",
+  comment   => "construct Add to stack pointer",
+  reg_req   => { in => [ "sp", "gp", "none" ], out => [ "in_r1", "none" ] },
+  emit      => '. add %D0, %S0, %S1',
+  outs      => [ "stack:S", "M" ],
+},
+
+SubSP => {
+  irn_flags => "I",
+  comment   => "construct Sub from stack pointer",
+  reg_req   => { in => [ "sp", "gp", "none" ], out => [ "in_r1", "none" ] },
+  emit      => '. sub %D0, %S0, %S1',
+  outs      => [ "stack:S", "M" ],
+},
+
+LdTls => {
+  irn_flags => "R",
+  comment   => "load the TLS address",
+  reg_req   => { out => [ "gp" ] },
+},
+
+
+#
+# floating point constants
+#
+fpaConst => {
+  op_flags  => "c",
+  irn_flags => "R",
+  comment   => "construct a floating point constant",
+  attr      => "tarval *tv",
+  init_attr => "attr->value = tv;",
+  mode      => "get_tarval_mode(tv)",
+  reg_req   => { "out" => [ "fpa" ] },
+}
 
 #---------------------------------------------------#
 #          __                         _             #