added get_next_ir_opcodes() to allow allocation of cosecutive opcodes
[libfirm] / ir / be / ia32 / ia32_spec.pl
index 6701cd4..594d2d8 100644 (file)
@@ -12,7 +12,7 @@ $arch = "ia32";
 # %nodes = (
 #
 # <op-name> => {
-#   "op_flags" => "N|L|C|X|I|F|Y|H|c",
+#   "op_flags" => "N|L|C|X|I|F|Y|H|c|K",
 #   "arity"    => "0|1|2|3|variable|dynamic|all",
 #   "state"    => "floats|pinned",
 #   "args"     => [
@@ -38,6 +38,7 @@ $arch = "ia32";
 #   Y   irop_flag_forking
 #   H   irop_flag_highlevel
 #   c   irop_flag_constlike
+#   K   irop_flag_keep
 #
 # op_flags: flags for the operation, OPTIONAL (default is "N")
 #
@@ -76,17 +77,19 @@ $arch = "ia32";
 #   2 - caller save (register must be saved by the caller of a function)
 #   3 - callee save (register must be saved by the called function)
 #   4 - ignore (do not assign this register)
-# NOTE: Make sure to list the registers returning the call-result at first and
-#       in the correct order, otherwise it will break the magic!
+# NOTE: Make sure to list the registers returning the call-result before all other
+#       caller save registers and in the correct order, otherwise it will break
+#       the magic!
 %reg_classes = (
   "general_purpose" => [
                          { "name" => "eax", "type" => 2 },
                          { "name" => "edx", "type" => 2 },
                          { "name" => "ebx", "type" => 3 },
                          { "name" => "ecx", "type" => 2 },
-                         { "name" => "edi", "type" => 2 },
                          { "name" => "esi", "type" => 3 },
-                         { "name" => "ebp", "type" => 3 }
+                         { "name" => "edi", "type" => 3 },
+                         { "name" => "ebp", "type" => 3 },
+                         { "name" => "esp", "type" => 4 }  # we don't want esp to be assigned
                        ],
   "floating_point"  => [
                          { "name" => "xmm0", "type" => 2 },
@@ -524,18 +527,9 @@ $arch = "ia32";
   "emit"     => '. leal %C(%S1), %D1\t\t\t/* %D1 = %S1 + %C, (%A1)*/'
 },
 
-"RegParam" => {
-  "arity"    => 1,
-  "comment"  => "constructs a Register Parameter to cover parameters passed in register",
-  "reg_req"  => { "in" => [ "none" ], "out" => [ "none" ] },
-  "cmp_attr" =>
-'
-  return (attr_a->pn_code != attr_b->pn_code);
-'
-},
-
 "StackParam" => {
   "arity"    => 1,
+  "remat"    => 1,
   "comment"  => "constructs a Stack Parameter to retrieve a parameter from Stack",
   "reg_req"  => { "in" => [ "none" ], "out" => [ "general_purpose" ] },
   "cmp_attr" =>
@@ -703,6 +697,7 @@ $arch = "ia32";
 
 "fStackParam" => {
   "arity"    => 1,
+  "remat"    => 1,
   "comment"  => "constructs a Stack Parameter to retrieve a SSE parameter from Stack",
   "reg_req"  => { "in" => [ "none" ], "out" => [ "floating_point" ] },
   "cmp_attr" =>
@@ -727,7 +722,6 @@ $arch = "ia32";
   "op_flags" => "L|F",
   "state"    => "mem_pinned",
   "arity"    => "variable",
-  "spill"    => 0,
   "comment"  => "construct Call: Call(...)",
   "args"     => [
                   { "type" => "int",        "name" => "n" },
@@ -737,6 +731,41 @@ $arch = "ia32";
 "  if (!op_ia32_Call) assert(0);
   return new_ir_node(db, irg, block, op_ia32_Call, mode_T, n, in);
 "
+},
+
+# Return
+
+"Return" => {
+  "op_flags" => "L|X",
+  "state"    => "pinned",
+  "arity"    => "variable",
+  "comment"  => "construct Return: Return(...)",
+  "args"     => [
+                  { "type" => "int",        "name" => "n" },
+                  { "type" => "ir_node **", "name" => "in" }
+                ],
+  "rd_constructor" =>
+"  if (!op_ia32_Return) assert(0);
+  return new_ir_node(db, irg, block, op_ia32_Return, mode_X, n, in);
+"
+},
+
+# M/Alloc
+
+"Alloca" => {
+  "op_flags" => "L|F",
+  "state"    => "pinned",
+  "arity"    => "2",
+  "comment"  => "construct Alloca: allocate memory on Stack",
+  "reg_req"  => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] }
+},
+
+"Alloca_i" => {
+  "op_flags" => "L|F",
+  "state"    => "pinned",
+  "arity"    => "1",
+  "comment"  => "construct Alloca: allocate memory on Stack",
+  "reg_req"  => { "out" => [ "general_purpose" ] }
 }
 
 ); # end of %nodes