$arch = "arm";
-# $comment_string = 'WIRHABENKEINEKOMMENTARE';
$comment_string = '/*';
# the number of additional opcodes you want to register
-$additional_opcodes = 0;
+#$additional_opcodes = 0;
# The node description is done as a perl hash initializer with the
# following structure:
# "reg_req" => { "in" => [ "reg_class|register" ], "out" => [ "reg_class|register|in_rX" ] },
# "cmp_attr" => "c source code for comparing node attributes",
# "emit" => "emit code with templates",
+# "attr" => "attitional attribute arguments for constructor"
+# "init_attr" => "emit attribute initialization template"
# "rd_constructor" => "c source code which constructs an ir_node"
# },
#
# for i = 1 .. arity: ir_node *op_i
# ir_mode *mode
#
+# outs: if a node defines more than one output, the names of the projections
+# nodes having outs having automatically the mode mode_T
+#
# comment: OPTIONAL comment for the node constructor
#
# rd_constructor: for every operation there will be a
# 4 - ignore (do not assign this register)
# NOTE: Last entry of each class is the largest Firm-Mode a register can hold
%reg_classes = (
- "general_purpose" => [
+ "gp" => [
{ "name" => "r0", "type" => 1 },
{ "name" => "r1", "type" => 1 },
{ "name" => "r2", "type" => 1 },
{ "name" => "r10", "type" => 2 },
{ "name" => "r11", "type" => 2 },
{ "name" => "r12", "type" => 6 }, # reserved for linker
- { "name" => "r13", "type" => 6 }, # this is our stack pointer
- { "name" => "r14", "type" => 3 }, # this is our return address
- { "name" => "r15", "type" => 6 }, # this is our program counter
- { "name" => "rxx", "type" => 6 }, # dummy register for no_mem
- { "name" => "MURX", "type" => 6 }, # this is our workaround-register
- { "mode" => "mode_P" }
+ { "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" }
],
- "floating_point" => [
+ "fpa" => [
{ "name" => "f0", "type" => 1 },
{ "name" => "f1", "type" => 1 },
{ "name" => "f2", "type" => 1 },
{ "name" => "f5", "type" => 2 },
{ "name" => "f6", "type" => 2 },
{ "name" => "f7", "type" => 2 },
- { "name" => "fxx", "type" => 6 }, # dummy register for no_mem
- { "mode" => "mode_D" }
+ { "mode" => "mode_E" }
]
); # %reg_classes
"op_flags" => "C",
"irn_flags" => "R",
"comment" => "construct Add: Add(a, b) = Add(b, a) = a + b",
- "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
- "emit" => '. ADD %D1, %S1, %S2\t\t\t/* Add(%S1, %S2) -> %D1, (%A1, %A2) */'
+ "attr" => "arm_shift_modifier mod, tarval *shf",
+ "init_attr" => 'ARM_SET_SHF_MOD(attr, mod); attr->value = shf;',
+ "cmp_attr" => 'return (attr_a->instr_fl != attr_b->instr_fl) || (attr_a->value != attr_b->value);',
+ "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
+ "emit" => '. add %D1, %S1, %S2%X0 /* Add(%S1, %S2) -> %D1, (%A1, %A2) */'
},
"Add_i" => {
"irn_flags" => "R",
"comment" => "construct Add: Add(a, const) = Add(const, a) = a + const",
- "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
- "emit" => '. ADD %D1, %S1, %C\t\t\t/* Add(%C, %S1) -> %D1, (%A1, const) */',
- "cmp_attr" =>
-' if (attr_a->value == NULL || attr_b->value == NULL)
- return 1;
-
- return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
-'
+ "attr" => "tarval *tv",
+ "init_attr" => 'ARM_SET_SHF_MOD(attr, ARM_SHF_IMM); attr->value = tv;',
+ "cmp_attr" => 'return attr_a->value != attr_b->value;',
+ "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
+ "emit" => '. add %D1, %S1, %C /* Add(%C, %S1) -> %D1, (%A1, const) */'
},
"Mul" => {
#"op_flags" => "C",
"irn_flags" => "R",
"comment" => "construct Mul: Mul(a, b) = Mul(b, a) = a * b",
- "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "!in_r1" ] },
- "emit" =>'. MUL %D1, %S1, %S2\t\t\t/* Mul(%S1, %S2) -> %D1, (%A1, %A2) */'
+ "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "!in_r1" ] },
+ "emit" =>'. mul %D1, %S1, %S2 /* Mul(%S1, %S2) -> %D1, (%A1, %A2) */'
+},
+
+"Smull" => {
+ #"op_flags" => "C",
+ "irn_flags" => "R",
+ "comment" => "construct signed 64bit Mul: Mul(a, b) = Mul(b, a) = a * b",
+ "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp", "gp" ] },
+ "emit" =>'. smull %D1, %D2, %S1, %S2 /* SMull(%S1, %S2) -> %D1, %D2, (%A1, %A2) */',
+ "outs" => [ "low", "high" ],
+},
+
+"Umull" => {
+ #"op_flags" => "C",
+ "irn_flags" => "R",
+ "comment" => "construct unsigned 64bit Mul: Mul(a, b) = Mul(b, a) = a * b",
+ "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp", "gp" ] },
+ "emit" =>'. umull %D1, %D2, %S1, %S2 /* UMull(%S1, %S2) -> %D1, %D2, (%A1, %A2) */',
+ "outs" => [ "low", "high" ],
+},
+
+"Mla" => {
+ #"op_flags" => "C",
+ "irn_flags" => "R",
+ "comment" => "construct Mla: Mla(a, b, c) = a * b + c",
+ "reg_req" => { "in" => [ "gp", "gp", "gp" ], "out" => [ "!in_r1" ] },
+ "emit" =>'. mla %D1, %S1, %S2, %S3 /* Mla(%S1, %S2, %S3) -> %D1, (%A1, %A2, %A3) */'
},
"And" => {
"op_flags" => "C",
"irn_flags" => "R",
"comment" => "construct And: And(a, b) = And(b, a) = a AND b",
- "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
- "emit" => '. AND %D1, %S1, %S2\t\t/* And(%S1, %S2) -> %D1, (%A1, %A2) */'
+ "attr" => "arm_shift_modifier mod, tarval *shf",
+ "init_attr" => 'ARM_SET_SHF_MOD(attr, mod); attr->value = shf;',
+ "cmp_attr" => 'return (attr_a->instr_fl != attr_b->instr_fl) || (attr_a->value != attr_b->value);',
+ "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
+ "emit" => '. and %D1, %S1, %S2%X0 /* And(%S1, %S2) -> %D1, (%A1, %A2) */'
},
"And_i" => {
"irn_flags" => "R",
"comment" => "construct And: And(a, const) = And(const, a) = a AND const",
- "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
- "emit" => '. AND %D1, %S1, %C\t\t\t/* And(%C, %S1) -> %D1, (%A1, const) */',
- "cmp_attr" =>
-' if (attr_a->value == NULL || attr_b->value == NULL)
- return 1;
-
- return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
-'
+ "attr" => "tarval *tv",
+ "init_attr" => 'ARM_SET_SHF_MOD(attr, ARM_SHF_IMM); attr->value = tv;',
+ "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
+ "emit" => '. and %D1, %S1, %C /* And(%C, %S1) -> %D1, (%A1, const) */',
+ "cmp_attr" => 'return attr_a->value != attr_b->value;'
},
"Or" => {
"op_flags" => "C",
"irn_flags" => "R",
"comment" => "construct Or: Or(a, b) = Or(b, a) = a OR b",
- "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
- "emit" => '. ORR %D1, %S1, %S2\t\t/* Or(%S1, %S2) -> %D1, (%A1, %A2) */'
+ "attr" => "arm_shift_modifier mod, tarval *shf",
+ "init_attr" => 'ARM_SET_SHF_MOD(attr, mod); attr->value = shf;',
+ "cmp_attr" => 'return (attr_a->instr_fl != attr_b->instr_fl) || (attr_a->value != attr_b->value);',
+ "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
+ "emit" => '. orr %D1, %S1, %S2%X0 /* Or(%S1, %S2) -> %D1, (%A1, %A2) */'
},
"Or_i" => {
"irn_flags" => "R",
"comment" => "construct Or: Or(a, const) = Or(const, a) = a OR const",
- "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
- "emit" => '. ORR %D1, %S1, %C\t\t\t/* Or(%C, %S1) -> %D1, (%A1, const) */',
- "cmp_attr" =>
-' if (attr_a->value == NULL || attr_b->value == NULL)
- return 1;
-
- return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
-'
-},
-
-"Or_Shl_i" => {
- "irn_flags" => "R",
- "comment" => "construct Or with immediate shifter operand",
- "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
- "emit" => '. ORR %D1, %S1, %S2 LSL %C\t\t\t/* Or_Shl_i(%S1, %S2 << %C) -> %D1, (%A1, const) */',
- "cmp_attr" =>
-' if (attr_a->value == NULL || attr_b->value == NULL)
- return 1;
-
- return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
-'
+ "attr" => "tarval *tv",
+ "init_attr" => 'ARM_SET_SHF_MOD(attr, ARM_SHF_IMM); attr->value = tv;',
+ "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
+ "cmp_attr" => 'return attr_a->value != attr_b->value;',
+ "emit" => '. orr %D1, %S1, %C /* Or(%C, %S1) -> %D1, (%A1, const) */'
},
"Eor" => {
"op_flags" => "C",
"irn_flags" => "R",
"comment" => "construct Eor: Eor(a, b) = Eor(b, a) = a EOR b",
- "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
- "emit" => '. EOR %D1, %S1, %S2\t\t\t/* Xor(%S1, %S2) -> %D1, (%A1, %A2) */'
+ "attr" => "arm_shift_modifier mod, tarval *shf",
+ "init_attr" => 'ARM_SET_SHF_MOD(attr, mod); attr->value = shf;',
+ "cmp_attr" => 'return (attr_a->instr_fl != attr_b->instr_fl) || (attr_a->value != attr_b->value);',
+ "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
+ "emit" => '. eor %D1, %S1, %S2%X0 /* Xor(%S1, %S2) -> %D1, (%A1, %A2) */'
},
"Eor_i" => {
"irn_flags" => "R",
"comment" => "construct Eor: Eor(a, const) = Eor(const, a) = a EOR const",
- "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
- "emit" => '. EOR %D1, %S1, %C\t\t\t/* Xor(%C, %S1) -> %D1, (%A1, const) */',
- "cmp_attr" =>
-' if (attr_a->value == NULL || attr_b->value == NULL)
- return 1;
-
- return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
-'
+ "attr" => "tarval *tv",
+ "init_attr" => 'ARM_SET_SHF_MOD(attr, ARM_SHF_IMM); attr->value = tv;',
+ "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
+ "cmp_attr" => 'return attr_a->value != attr_b->value;',
+ "emit" => '. eor %D1, %S1, %C /* Xor(%C, %S1) -> %D1, (%A1, const) */'
},
# not commutative operations
+"Bic" => {
+ "irn_flags" => "R",
+ "comment" => "construct Bic: Bic(a, b) = a AND ~b",
+ "attr" => "arm_shift_modifier mod, tarval *shf",
+ "init_attr" => 'ARM_SET_SHF_MOD(attr, mod); attr->value = shf;',
+ "cmp_attr" => 'return (attr_a->instr_fl != attr_b->instr_fl) || (attr_a->value != attr_b->value);',
+ "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
+ "emit" => '. bic %D1, %S1, %S2%X0 /* AndNot(%S1, %S2) -> %D1, (%A1, %A2) */'
+},
+
+"Bic_i" => {
+ "irn_flags" => "R",
+ "comment" => "construct Bic: Bic(a, const) = a AND ~const",
+ "attr" => "tarval *tv",
+ "init_attr" => 'ARM_SET_SHF_MOD(attr, ARM_SHF_IMM); attr->value = tv;',
+ "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
+ "emit" => '. bic %D1, %S1, %C /* AndNot(%C, %S1) -> %D1, (%A1, const) */',
+ "cmp_attr" => 'return attr_a->value != attr_b->value;'
+},
+
"Sub" => {
"irn_flags" => "R",
"comment" => "construct Sub: Sub(a, b) = a - b",
- "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
- "emit" => '. SUB %D1, %S1, %S2\t\t\t/* Sub(%S1, %S2) -> %D1, (%A1, %A2) */'
+ "attr" => "arm_shift_modifier mod, tarval *shf",
+ "init_attr" => 'ARM_SET_SHF_MOD(attr, mod); attr->value = shf;',
+ "cmp_attr" => 'return (attr_a->instr_fl != attr_b->instr_fl) || (attr_a->value != attr_b->value);',
+ "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
+ "emit" => '. sub %D1, %S1, %S2%X0 /* Sub(%S1, %S2) -> %D1, (%A1, %A2) */'
},
"Sub_i" => {
"irn_flags" => "R",
"comment" => "construct Sub: Sub(a, const) = a - const",
- "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
- "emit" => '. SUB %D1, %S1, %C\t\t\t/* Sub(%S1, %C) -> %D1, (%A1, const) */',
- "cmp_attr" =>
-' if (attr_a->value == NULL || attr_b->value == NULL)
- return 1;
-
- return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
-'
+ "attr" => "tarval *tv",
+ "init_attr" => 'ARM_SET_SHF_MOD(attr, ARM_SHF_IMM); attr->value = tv;',
+ "cmp_attr" => 'return attr_a->value != attr_b->value;',
+ "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
+ "emit" => '. sub %D1, %S1, %C /* Sub(%S1, %C) -> %D1, (%A1, const) */',
},
-"Shl" => {
+"Rsb" => {
"irn_flags" => "R",
- "comment" => "construct Shl: Shl(a, b) = a << b",
- "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
- "emit" => '. MOV %D1, %S1, LSL %S2\t/* Shl(%S1, %S2) -> %D1, (%A1, %A2) */'
+ "comment" => "construct Rsb: Rsb(a, b) = b - a",
+ "attr" => "arm_shift_modifier mod, tarval *shf",
+ "init_attr" => 'ARM_SET_SHF_MOD(attr, mod); attr->value = shf;',
+ "cmp_attr" => 'return (attr_a->instr_fl != attr_b->instr_fl) || (attr_a->value != attr_b->value);',
+ "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
+ "emit" => '. rsb %D1, %S1, %S2%X0 /* Rsb(%S1, %S2) -> %D1, (%A1, %A2) */'
},
-"Shl_i" => {
+"Rsb_i" => {
"irn_flags" => "R",
- "comment" => "construct Shl: Shl(a, const) = a << const",
- "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
- "emit" => '. MOV %D1, %S1, LSL %C\t\t\t/* Shl(%S1, %C) -> %D1, (%A1, const) */',
- "cmp_attr" =>
-' if (attr_a->value == NULL || attr_b->value == NULL)
- return 1;
-
- return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
-'
+ "comment" => "construct Rsb: Rsb(a, const) = const - a",
+ "attr" => "tarval *tv",
+ "init_attr" => 'ARM_SET_SHF_MOD(attr, ARM_SHF_IMM); attr->value = tv;',
+ "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
+ "emit" => '. rsb %D1, %S1, %C /* Rsb(%S1, %C) -> %D1, (%A1, const) */',
+ "cmp_attr" => 'return attr_a->value != attr_b->value;'
},
-"Shr" => {
+"Shl" => {
"irn_flags" => "R",
- "comment" => "construct Shr: Shr(a, b) = a >> b",
- "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "in_r1" ] },
- "emit" => '. MOV %D1, %S1, LSR %S2\t\t\t/* Shr(%S1, %S2) -> %D1, (%A1, %A2) */'
+ "comment" => "construct Shl: Shl(a, b) = a << b",
+ "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
+ "emit" => '. mov %D1, %S1, lsl %S2 /* Shl(%S1, %S2) -> %D1, (%A1, %A2) */'
},
-"Shr_i" => {
+"Shr" => {
"irn_flags" => "R",
- "comment" => "construct Shr: Shr(a, const) = a >> const",
- "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
- "emit" => '. MOV %D1, %S1, LSR %C\t\t\t/* Shr(%S1, %C) -> %D1, (%A1, const) */',
- "cmp_attr" =>
-' if (attr_a->value == NULL || attr_b->value == NULL)
- return 1;
-
- return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
-'
+ "comment" => "construct Shr: Shr(a, b) = a >> b",
+ "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "in_r1" ] },
+ "emit" => '. mov %D1, %S1, lsr %S2 /* Shr(%S1, %S2) -> %D1, (%A1, %A2) */'
},
"Shrs" => {
"irn_flags" => "R",
"comment" => "construct Shrs: Shrs(a, b) = a >> b",
- "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "in_r1" ] },
- "emit" => '. MOV %D1, %S1, ASR %S2\t\t\t\t\t/* Shrs(%S1, %S2) -> %D1, (%A1, %A2) */'
+ "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "in_r1" ] },
+ "emit" => '. mov %D1, %S1, asr %S2 /* Shrs(%S1, %S2) -> %D1, (%A1, %A2) */'
},
-"Shrs_i" => {
- "irn_flags" => "R",
- "comment" => "construct Shrs: Shrs(a, const) = a >> const",
- "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
- "emit" => '. MOV %D1, %S1, ASR %C\t\t\t/* Shrs(%S1, %C) -> %D1, (%A1, const) */',
- "cmp_attr" =>
-' if (attr_a->value == NULL || attr_b->value == NULL)
- return 1;
-
- return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
-'
-},
-
-#"Div" => {
-# "irn_flags" => "R",
-# "comment" => "construct Div: Div(a, b) = a / b",
-# "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
-# "emit" =>'. div %S1, %S2, %D1\t\t\t/* div(%S1, %S2) -> %D1, (%A1, %A2) */'
-#},
-#
-#"Div_i" => {
-# "irn_flags" => "R",
-# "comment" => "construct Div: Div(a, const) = a / const",
-# "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
-# "emit" => '. div %S1, %C, %D1\t\t\t/* signed div(%C, %S1) -> %D1, (%A1, const) */'
-#},
-#
-#"Mod" => {
-# "irn_flags" => "R",
-# "comment" => "construct Mod: Mod(a, b) = a % b",
-# "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
-# "emit" =>'. mod %S1, %S2, %D1\t\t\t/* mod(%S1, %S2) -> %D1, (%A1, %A2) */'
-#},
-#
-#"Mod_i" => {
-# "irn_flags" => "R",
-# "comment" => "construct mod: Mod(a, const) = a % const",
-# "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
-# "emit" => '. mod %S1, %C, %D1\t\t\t/* mod(%C, %S1) -> %D1, (%A1, const) */'
-#},
-#
-#"DivMod" => {
-# "irn_flags" => "R",
-# "comment" => "construct DivMod: DivMod(a, b) = a / b",
-# "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
-# "emit" =>'. div %S1, %S2, %D1\t\t\t/* div(%S1, %S2) -> %D1, (%A1, %A2) */'
-#},
-#
-#"Div_i" => {
-# "irn_flags" => "R",
-# "comment" => "construct DivMod: DivMod(a, const) = a / const",
-# "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
-# "emit" => '. div %S1, %C, %D1\t\t\t/* signed div(%C, %S1) -> %D1, (%A1, const) */'
-#},
-
#"RotR" => {
# "irn_flags" => "R",
# "comment" => "construct RotR: RotR(a, b) = a ROTR b",
-# "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
-# "emit" => '. MOV %D1, %S1, ROR %S2\t\t\t/* RotR(%S1, %S2) -> %D1, (%A1, %A2) */'
-## "emit" => '. ror %S1, %S2, %D1\t\t\t/* RotR(%S1, %S2) -> %D1, (%A1, %A2) */'
+# "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
+# "emit" => '. mov %D1, %S1, ror %S2 /* RotR(%S1, %S2) -> %D1, (%A1, %A2) */'
+## "emit" => '. ror %S1, %S2, %D1 /* RotR(%S1, %S2) -> %D1, (%A1, %A2) */'
#},
#"RotL" => {
# "irn_flags" => "R",
# "comment" => "construct RotL: RotL(a, b) = a ROTL b",
-# "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
-# "emit" => '. rol %S1, %S2, %D1\t\t\t/* RotL(%S1, %S2) -> %D1, (%A1, %A2) */'
+# "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
+# "emit" => '. rol %S1, %S2, %D1 /* RotL(%S1, %S2) -> %D1, (%A1, %A2) */'
#},
#"RotL_i" => {
# "irn_flags" => "R",
# "comment" => "construct RotL: RotL(a, const) = a ROTL const",
-# "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
-# "emit" => '. rol %S1, %C, %D1\t\t\t/* RotL(%S1, %C) -> %D1, (%A1, const) */'
+# "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
+# "emit" => '. rol %S1, %C, %D1 /* RotL(%S1, %C) -> %D1, (%A1, const) */'
#},
-"Minus" => {
+"Mov" => {
"irn_flags" => "R",
- "comment" => "construct Minus: Minus(a) = -a",
- "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
- "emit" => '. RSB %D1, %S1, #0\t\t\t/* Neg(%S1) -> %D1, (%A1) */'
+ "comment" => "construct Mov: a = b",
+ "attr" => "arm_shift_modifier mod, tarval *shf",
+ "init_attr" => 'ARM_SET_SHF_MOD(attr, mod); attr->value = shf;',
+ "cmp_attr" => 'return (attr_a->instr_fl != attr_b->instr_fl) || (attr_a->value != attr_b->value);',
+ "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
+ "emit" => '. mov %D1, %S1%X0 /* Mov(%S1%X0) -> %D1, (%A1) */'
},
-#"Inc" => {
-# "irn_flags" => "R",
-# "comment" => "construct Increment: Inc(a) = a++",
-# "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
-# "emit" => '. inc %S1, %D1\t\t\t/* Inc(%S1) -> %D1, (%A1) */'
-#},
-#
-#"Dec" => {
-# "irn_flags" => "R",
-# "comment" => "construct Decrement: Dec(a) = a--",
-# "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
-# "emit" => '. dec %S1, %D1\t\t\t/* Dec(%S1) -> %D1, (%A1) */'
-#},
+"Mov_i" => {
+ "irn_flags" => "R",
+ "comment" => "represents an integer constant",
+ "attr" => "tarval *tv",
+ "init_attr" => 'ARM_SET_SHF_MOD(attr, ARM_SHF_IMM); attr->value = tv;',
+ "reg_req" => { "out" => [ "gp" ] },
+ "emit" => '. mov %D1, %C /* Mov Const into register */',
+ "cmp_attr" => 'return attr_a->value != attr_b->value;'
+},
-"Not" => {
- "arity" => 1,
-# "remat" => 1,
- "irn_flags" => "R",
- "comment" => "construct Not: Not(a) = !a",
- "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
- "emit" => '. MVN %D1, %S1\t\t\t/* Not(%S1) -> %D1, (%A1) */'
+"Mvn" => {
+ "irn_flags" => "R",
+ "comment" => "construct Not: Not(a) = !a",
+ "attr" => "arm_shift_modifier mod, tarval *shf",
+ "init_attr" => 'ARM_SET_SHF_MOD(attr, mod); attr->value = shf;',
+ "cmp_attr" => 'return (attr_a->instr_fl != attr_b->instr_fl) || (attr_a->value != attr_b->value);',
+ "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
+ "emit" => '. mvn %D1, %S1%X0 /* ~(%S1%X0) -> %D1, (%A1) */'
+},
+
+"Mvn_i" => {
+ "irn_flags" => "R",
+ "comment" => "represents a negated integer constant",
+ "attr" => "tarval *tv",
+ "init_attr" => 'ARM_SET_SHF_MOD(attr, ARM_SHF_IMM); attr->value = tv;',
+ "cmp_attr" => 'return attr_a->value != attr_b->value;',
+ "reg_req" => { "out" => [ "gp" ] },
+ "emit" => '. mvn %D1, %C /* Mov ~Const into register */',
},
"Abs" => {
"irn_flags" => "R",
"comment" => "construct Abs: Abs(a) = |a|",
- "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
+ "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
"emit" =>
-'. MOVS %S1, %S1, #0\t\t\t/* set condition flag */\n
-. RSBMI %D1, %S1, #0\t\t\t/* Neg(%S1) -> %D1, (%A1) */'
+'. movs %S1, %S1, #0 /* set condition flag */\n
+. rsbmi %D1, %S1, #0 /* Neg(%S1) -> %D1, (%A1) */'
},
# other operations
"EmptyReg" => {
"op_flags" => "c",
"irn_flags" => "R",
- "comment" => "just to get an emptz register for calculations",
- "reg_req" => { "out" => [ "general_purpose" ] },
+ "comment" => "allocate an empty register for calculations",
+ "reg_req" => { "out" => [ "gp" ] },
"emit" => '. /* %D1 now available for calculations */',
"cmp_attr" => 'return 1;'
},
"Copy" => {
"comment" => "implements a register copy",
- "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
+ "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
},
"CopyB" => {
"op_flags" => "F|H",
"state" => "pinned",
"comment" => "implements a memcopy: CopyB(dst, src, size, mem) == memcpy(dst, src, size)",
- "reg_req" => { "in" => [ "!r13", "!r13", "general_purpose", "general_purpose", "general_purpose", "none" ], "out" => [ "none" ] },
-},
-
-"Const" => {
- "irn_flags" => "R",
- "comment" => "represents an integer constant",
- "reg_req" => { "out" => [ "general_purpose" ] },
- "emit" => '. MOV %D1, %C \t\t\t/* Mov Const into register */',
- "cmp_attr" =>
-' if (attr_a->value == NULL || attr_b->value == NULL)
- return 1;
-
- return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
-'
-},
-
-"Const_Neg" => {
- "irn_flags" => "R",
- "comment" => "represents a negated integer constant",
- "reg_req" => { "out" => [ "general_purpose" ] },
- "emit" => '. MVN %D1, %C \t\t\t/* Mov negated Const into register */',
- "cmp_attr" =>
-' if (attr_a->value == NULL || attr_b->value == NULL)
- return 1;
-
- return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
-'
+ "reg_req" => { "in" => [ "!sp", "!sp", "gp", "gp", "gp", "none" ], "out" => [ "none" ] },
},
"SymConst" => {
"op_flags" => "c",
"irn_flags" => "R",
"comment" => "represents a symbolic constant",
- "reg_req" => { "out" => [ "general_purpose" ] },
-# "emit" => '. LDR %D1, %C\t\t\t/* Mov Const into register */',
+ "attr" => "const char *label",
+ "init_attr" => ' attr->symconst_label = label;',
+ "reg_req" => { "out" => [ "gp" ] },
+# "emit" => '. ldr %D1, %C /* Mov Const into register */',
"cmp_attr" =>
-' if (attr_a->value == NULL || attr_b->value == NULL)
- return 1;
-
- return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
-'
+' /* should be identical but ...*/
+ return strcmp(attr_a->symconst_label, attr_b->symconst_label);'
},
"CondJmp" => {
"op_flags" => "L|X|Y",
"comment" => "construct conditional jump: CMP A, B && JMPxx LABEL",
"cmp_attr" => " return arm_comp_condJmp(attr_a, attr_b);\n",
- "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "none", "none"] },
+ "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "none", "none"] },
},
"SwitchJmp" => {
"op_flags" => "L|X|Y",
"comment" => "construct switch",
- "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "none" ] },
+ "reg_req" => { "in" => [ "gp" ], "out" => [ "none" ] },
"cmp_attr" => " return 0;\n",
},
"irn_flags" => "R",
"state" => "exc_pinned",
"comment" => "construct Load: Load(ptr, mem) = LD ptr -> reg",
- "reg_req" => { "in" => [ "general_purpose", "none" ], "out" => [ "general_purpose" ] },
- "emit" => '. LDR %D1, [%S1, #0]\t\t\t/* Load((%S1)) -> %D1, (%A1) */'
-# "emit" => '. LDR %D1, %S1, %O\t\t\t/* Load((%S1)) -> %D1, (%A1) */'
+ "reg_req" => { "in" => [ "gp", "none" ], "out" => [ "gp", "none" ] },
+ "emit" => '. ldr %D1, [%S1, #0] /* Load((%S1)) -> %D1, (%A1) */',
+ "outs" => [ "res", "M" ],
},
"Loadb" => {
"irn_flags" => "R",
"state" => "exc_pinned",
"comment" => "construct Load: Load(ptr, mem) = LD ptr -> reg",
- "reg_req" => { "in" => [ "general_purpose", "none" ], "out" => [ "general_purpose" ] },
- "emit" => '. LDRB %D1, [%S1, #0]\t\t\t/* Load((%S1)) -> %D1, (%A1) */'
-# "emit" => '. LDRB %D1, %S1, %O\t\t\t/* Load((%S1)) -> %D1, (%A1) */'
+ "reg_req" => { "in" => [ "gp", "none" ], "out" => [ "gp", "none" ] },
+ "emit" => '. ldrb %D1, [%S1, #0] /* Load((%S1)) -> %D1, (%A1) */',
+ "outs" => [ "res", "M" ],
},
"Loadbs" => {
"irn_flags" => "R",
"state" => "exc_pinned",
"comment" => "construct Load: Load(ptr, mem) = LD ptr -> reg",
- "reg_req" => { "in" => [ "general_purpose", "none" ], "out" => [ "general_purpose" ] },
- "emit" => '. LDRSB %D1, [%S1, #0]\t\t\t/* Load((%S1)) -> %D1, (%A1) */'
-# "emit" => '. LDRSB %D1, %S1, %O\t\t\t/* Load((%S1)) -> %D1, (%A1) */'
+ "reg_req" => { "in" => [ "gp", "none" ], "out" => [ "gp", "none" ] },
+ "emit" => '. ldrsb %D1, [%S1, #0] /* Load((%S1)) -> %D1, (%A1) */',
+ "outs" => [ "res", "M" ],
},
"Loadh" => {
"irn_flags" => "R",
"state" => "exc_pinned",
"comment" => "construct Load: Load(ptr, mem) = LD ptr -> reg",
- "reg_req" => { "in" => [ "general_purpose", "none" ], "out" => [ "general_purpose" ] },
- "emit" => '. LDRH %D1, [%S1, #0]\t\t\t/* Load((%S1)) -> %D1, (%A1) */'
-# "emit" => '. LDRH %D1, %S1, %O\t\t\t/* Load((%S1)) -> %D1, (%A1) */'
+ "reg_req" => { "in" => [ "gp", "none" ], "out" => [ "gp", "none" ] },
+ "emit" => '. ldrh %D1, [%S1, #0] /* Load((%S1)) -> %D1, (%A1) */',
+ "outs" => [ "res", "M" ],
},
"Loadhs" => {
"irn_flags" => "R",
"state" => "exc_pinned",
"comment" => "construct Load: Load(ptr, mem) = LD ptr -> reg",
- "reg_req" => { "in" => [ "general_purpose", "none" ], "out" => [ "general_purpose" ] },
- "emit" => '. LDRSH %D1, [%S1, #0]\t\t\t/* Load((%S1)) -> %D1, (%A1) */'
-# "emit" => '. LDRSH %D1, %S1, %O\t\t\t/* Load((%S1)) -> %D1, (%A1) */'
+ "reg_req" => { "in" => [ "gp", "none" ], "out" => [ "gp", "none" ] },
+ "emit" => '. ldrsh %D1, [%S1, #0] /* Load((%S1)) -> %D1, (%A1) */',
+ "outs" => [ "res", "M" ],
},
"Storeb" => {
"irn_flags" => "R",
"state" => "exc_pinned",
"comment" => "construct Store: Store(ptr, val, mem) = ST ptr,val",
- "reg_req" => { "in" => [ "general_purpose", "general_purpose", "none" ] },
- "emit" => '. STRB %S2, [%S1, #0]\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
-# "emit" => '. movl %S2, %O(%S1)\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
+ "reg_req" => { "in" => [ "gp", "gp", "none" ] },
+ "emit" => '. strb %S2, [%S1, #0] /* Store(%S2) -> (%S1), (%A1, %A2) */',
+ "outs" => [ "M" ],
},
"Storebs" => {
"irn_flags" => "R",
"state" => "exc_pinned",
"comment" => "construct Store: Store(ptr, val, mem) = ST ptr,val",
- "reg_req" => { "in" => [ "general_purpose", "general_purpose", "none" ] },
- "emit" => '. STRSB %S2, [%S1, #0]\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
-# "emit" => '. movl %S2, %O(%S1)\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
+ "reg_req" => { "in" => [ "gp", "gp", "none" ] },
+ "emit" => '. strsb %S2, [%S1, #0] /* Store(%S2) -> (%S1), (%A1, %A2) */',
+ "outs" => [ "M" ],
},
"Storeh" => {
"irn_flags" => "R",
"state" => "exc_pinned",
"comment" => "construct Store: Store(ptr, val, mem) = ST ptr,val",
- "reg_req" => { "in" => [ "general_purpose", "general_purpose", "none" ] },
- "emit" => '. STRH %S2, [%S1, #0]\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
-# "emit" => '. movl %S2, %O(%S1)\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
+ "reg_req" => { "in" => [ "gp", "gp", "none" ] },
+ "emit" => '. strh %S2, [%S1, #0] /* Store(%S2) -> (%S1), (%A1, %A2) */',
+ "outs" => [ "M" ],
},
"Storehs" => {
"irn_flags" => "R",
"state" => "exc_pinned",
"comment" => "construct Store: Store(ptr, val, mem) = ST ptr,val",
- "reg_req" => { "in" => [ "general_purpose", "general_purpose", "none" ] },
- "emit" => '. STRSH%S2, [%S1, #0]\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
-# "emit" => '. movl %S2, %O(%S1)\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
+ "reg_req" => { "in" => [ "gp", "gp", "none" ] },
+ "emit" => '. strhs %S2, [%S1, #0] /* Store(%S2) -> (%S1), (%A1, %A2) */',
+ "outs" => [ "M" ],
},
"Store" => {
"irn_flags" => "R",
"state" => "exc_pinned",
"comment" => "construct Store: Store(ptr, val, mem) = ST ptr,val",
- "reg_req" => { "in" => [ "general_purpose", "general_purpose", "none" ] },
- "emit" => '. STR %S2, [%S1, #0]\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
-# "emit" => '. movl %S2, %O(%S1)\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
+ "reg_req" => { "in" => [ "gp", "gp", "none" ] },
+ "emit" => '. str %S2, [%S1, #0] /* Store(%S2) -> (%S1), (%A1, %A2) */',
+ "outs" => [ "M" ],
},
"StoreStackM4Inc" => {
"irn_flags" => "R",
"state" => "exc_pinned",
"comment" => "construct Store: Store(ptr, val, mem) = ST ptr,val",
- "reg_req" => { "in" => [ "r13", "general_purpose", "general_purpose", "general_purpose", "general_purpose", "none" ], "out" => [ "general_purpose", "none" ] },
- "emit" => '. STMFD %S1!, {%S2, %S3, %S4, %S5}\t\t\t/* Store multiple on Stack*/'
+ "reg_req" => { "in" => [ "sp", "gp", "gp", "gp", "gp", "none" ], "out" => [ "gp", "none" ] },
+ "emit" => '. stmfd %S1!, {%S2, %S3, %S4, %S5} /* Store multiple on Stack*/',
+ "outs" => [ "ptr", "M" ],
},
"LoadStackM3" => {
"irn_flags" => "R",
"state" => "exc_pinned",
"comment" => "construct Load: Load(ptr, mem) = LD ptr -> reg",
- "reg_req" => { "in" => [ "r13", "none" ], "out" => [ "general_purpose", "general_purpose", "general_purpose", "none" ] },
- "emit" => '. LDMFD %S1, {%D1, %D2, %D3}\t\t\t/* Load multiple from Stack */'
+ "reg_req" => { "in" => [ "sp", "none" ], "out" => [ "gp", "gp", "gp", "none" ] },
+ "emit" => '. ldmfd %S1, {%D1, %D2, %D3} /* Load multiple from Stack */',
+ "outs" => [ "res0", "res1", "res2", "M" ],
},
-
-
-
-
-
-
-#--------------------------------------------------------#
-# __ _ _ _ #
-# / _| | | | | | #
-# | |_| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
-# | _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
-# | | | | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
-# |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
-#--------------------------------------------------------#
+#---------------------------------------------------#
+# __ _ #
+# / _| | | #
+# | |_ _ __ __ _ _ __ ___ __| | ___ ___ #
+# | _| '_ \ / _` | | '_ \ / _ \ / _` |/ _ \/ __| #
+# | | | |_) | (_| | | | | | (_) | (_| | __/\__ \ #
+# |_| | .__/ \__,_| |_| |_|\___/ \__,_|\___||___/ #
+# | | #
+# |_| #
+#---------------------------------------------------#
# commutative operations
-"fAddd" => {
+"fpaAdd" => {
"op_flags" => "C",
"irn_flags" => "R",
- "comment" => "construct DP FP Add: Add(a, b) = Add(b, a) = a + b",
- "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
- "emit" => '. FADDD %D1, %S1, %S2\t\t\t/* FP Add(%S1, %S2) -> %D1 */'
+ "comment" => "construct FPA Add: Add(a, b) = Add(b, a) = a + b",
+ "reg_req" => { "in" => [ "fpa", "fpa" ], "out" => [ "fpa" ] },
+ "emit" => '. adf%M %D1, %S1, %S2 /* FPA Add(%S1, %S2) -> %D1 */',
},
-"fAdds" => {
+"fpaMul" => {
"op_flags" => "C",
- "irn_flags" => "R",
- "comment" => "construct SP FP Add: Add(a, b) = Add(b, a) = a + b",
- "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
- "emit" => '. FADDS %D1, %S1, %S2\t\t\t/* FP Add(%S1, %S2) -> %D1 */'
+ "comment" => "construct FPA Mul: Mul(a, b) = Mul(b, a) = a * b",
+ "reg_req" => { "in" => [ "fpa", "fpa" ], "out" => [ "fpa" ] },
+ "emit" =>'. muf%M %D1, %S1, %S2 /* FPA Mul(%S1, %S2) -> %D1 */',
},
-"fMuls" => {
+"fpaFMul" => {
"op_flags" => "C",
- "comment" => "construct FP Mul: Mul(a, b) = Mul(b, a) = a * b",
- "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
- "emit" =>'. FMULS %D1, %S1, %S2\t\t\t/* FP Mul(%S1, %S2) -> %D1 */'
+ "comment" => "construct FPA Fast Mul: Mul(a, b) = Mul(b, a) = a * b",
+ "reg_req" => { "in" => [ "fpa", "fpa" ], "out" => [ "fpa" ] },
+ "emit" =>'. fml%M %D1, %S1, %S2 /* FPA Fast Mul(%S1, %S2) -> %D1 */',
},
-"fMuld" => {
+"fpaMax" => {
"op_flags" => "C",
- "comment" => "construct FP Mul: Mul(a, b) = Mul(b, a) = a * b",
- "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
- "emit" =>'. FMULD %D1, %S1, %S2\t\t\t/* FP Mul(%S1, %S2) -> %D1 */'
+ "irn_flags" => "R",
+ "comment" => "construct FPA Max: Max(a, b) = Max(b, a) = a > b ? a : b",
+ "reg_req" => { "in" => [ "fpa", "fpa" ], "out" => [ "fpa" ] },
+ "emit" =>'. fmax %S1, %S2, %D1 /* FPA Max(%S1, %S2) -> %D1 */',
},
-"fDivs" => {
- "comment" => "construct FP Div: Div(a, b) = a / b",
- "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
- "emit" =>'. FDIVS %D1, %S1, %S2\t\t\t/* FP Div(%S1, %S2) -> %D1 */'
+"fpaMin" => {
+ "op_flags" => "C",
+ "irn_flags" => "R",
+ "comment" => "construct FPA Min: Min(a, b) = Min(b, a) = a < b ? a : b",
+ "reg_req" => { "in" => [ "fpa", "fpa" ], "out" => [ "fpa" ] },
+ "emit" =>'. fmin %S1, %S2, %D1 /* FPA Min(%S1, %S2) -> %D1 */',
},
-"fDivd" => {
- "comment" => "construct FP Div: Div(a, b) = a / b",
- "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
- "emit" =>'. FDIVD %D1, %S1, %S2\t\t\t/* FP Div(%S1, %S2) -> %D1 */'
-},
+# not commutative operations
-"fDiv" => {
- "comment" => "construct FP Div: Div(a, b) = a / b",
- "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
- "emit" =>'. FDIV %D1, %S1, %S2\t\t\t/* FP Div(%S1, %S2) -> %D1 */'
+"fpaSub" => {
+ "irn_flags" => "R",
+ "comment" => "construct FPA Sub: Sub(a, b) = a - b",
+ "reg_req" => { "in" => [ "fpa", "fpa" ], "out" => [ "fpa" ] },
+ "emit" => '. suf%M %D1, %S1, %S2 /* FPA Sub(%S1, %S2) -> %D1 */'
},
-"fMax" => {
- "op_flags" => "C",
+"fpaRsb" => {
"irn_flags" => "R",
- "comment" => "construct FP Max: Max(a, b) = Max(b, a) = a > b ? a : b",
- "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
- "emit" =>'. fmax %S1, %S2, %D1\t\t\t/* FP Max(%S1, %S2) -> %D1 */'
+ "comment" => "construct FPA reverse Sub: Sub(a, b) = b - a",
+ "reg_req" => { "in" => [ "fpa", "fpa" ], "out" => [ "fpa" ] },
+ "emit" => '. rsf%M %D1, %S1, %S2 /* FPA reverse Sub(%S1, %S2) -> %D1 */'
},
-"fMin" => {
- "op_flags" => "C",
- "irn_flags" => "R",
- "comment" => "construct FP Min: Min(a, b) = Min(b, a) = a < b ? a : b",
- "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
- "emit" =>'. fmin %S1, %S2, %D1\t\t\t/* FP Min(%S1, %S2) -> %D1 */'
+"fpaDiv" => {
+ "comment" => "construct FPA Div: Div(a, b) = a / b",
+ "reg_req" => { "in" => [ "fpa", "fpa" ], "out" => [ "fpa" ] },
+ "emit" =>'. dvf%M %D1, %S1, %S2 /* FPA Div(%S1, %S2) -> %D1 */',
},
-# not commutative operations
+"fpaRdv" => {
+ "comment" => "construct FPA reverse Div: Div(a, b) = b / a",
+ "reg_req" => { "in" => [ "fpa", "fpa" ], "out" => [ "fpa" ] },
+ "emit" =>'. rdf%M %D1, %S1, %S2 /* FPA reverse Div(%S1, %S2) -> %D1 */',
+},
-"fSubs" => {
- "irn_flags" => "R",
- "comment" => "construct FP Sub: Sub(a, b) = a - b",
- "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
- "emit" => '. FSUBS %D1, %S1, %S2\t\t\t/* FP Sub(%S1, %S2) -> %D1 */'
+"fpaFDiv" => {
+ "comment" => "construct FPA Fast Div: Div(a, b) = a / b",
+ "reg_req" => { "in" => [ "fpa", "fpa" ], "out" => [ "fpa" ] },
+ "emit" =>'. fdv%M %D1, %S1, %S2 /* FPA Fast Div(%S1, %S2) -> %D1 */',
},
-"fSubd" => {
- "irn_flags" => "R",
- "comment" => "construct FP Sub: Sub(a, b) = a - b",
- "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
- "emit" => '. FSUBD %D1, %S1, %S2\t\t\t/* FP Sub(%S1, %S2) -> %D1 */'
+"fpaFRdv" => {
+ "comment" => "construct FPA Fast reverse Div: Div(a, b) = b / a",
+ "reg_req" => { "in" => [ "fpa", "fpa" ], "out" => [ "fpa" ] },
+ "emit" =>'. frd%M %D1, %S1, %S2 /* FPA Fast reverse Div(%S1, %S2) -> %D1 */',
},
-"fMinus" => {
+"fpaMov" => {
"irn_flags" => "R",
- "comment" => "construct FP Minus: Minus(a) = -a",
- "reg_req" => { "in" => [ "floating_point" ], "out" => [ "floating_point" ] },
- "emit" => '. fneg %S1, %D1\t\t\t/* FP Minus(%S1) -> %D1 */'
+ "comment" => "construct FPA Move: b = a",
+ "reg_req" => { "in" => [ "fpa" ], "out" => [ "fpa" ] },
+ "emit" => '. mvf%M %S1, %D1 /* FPA Mov %S1 -> %D1 */',
},
-"fAbss" => {
+"fpaMnv" => {
"irn_flags" => "R",
- "comment" => "construct FP Absolute value: fAbss(a) = |a|",
- "reg_req" => { "in" => [ "floating_point" ], "out" => [ "floating_point" ] },
- "emit" => '. FABSS %D1, %S1\t\t\t/* FP Abss(%S1) -> %D1 */'
+ "comment" => "construct FPA Move Negated: b = -a",
+ "reg_req" => { "in" => [ "fpa" ], "out" => [ "fpa" ] },
+ "emit" => '. mnf%M %S1, %D1 /* FPA Neg(%S1) -> %D1 */',
},
-"fAbsd" => {
+"fpaAbs" => {
"irn_flags" => "R",
- "comment" => "construct FP Absolute value: fAbsd(a) = |a|",
- "reg_req" => { "in" => [ "floating_point" ], "out" => [ "floating_point" ] },
- "emit" => '. FABSD %D1, %S1\t\t\t/* FP Absd(%S1) -> %D1 */'
+ "comment" => "construct FPA Absolute value: fAbsd(a) = |a|",
+ "reg_req" => { "in" => [ "fpa" ], "out" => [ "fpa" ] },
+ "emit" => '. abs%M %D1, %S1 /* FPA Abs(%S1) -> %D1 */',
},
# other operations
-"fConst" => {
+"fpaConst" => {
"op_flags" => "c",
"irn_flags" => "R",
- "comment" => "represents a FP constant",
- "reg_req" => { "out" => [ "floating_point" ] },
- "emit" => '. FMOV %D1, %C\t\t\t/* Mov fConst into register */',
- "cmp_attr" =>
-' if (attr_a->value == NULL || attr_b->value == NULL)
- return 1;
-
- return get_tarval_double(attr_a->value) != get_tarval_double(attr_b->value);'
+ "comment" => "represents a FPA constant",
+ "attr" => "tarval *val",
+ "init_attr" => 'attr->value = val;',
+ "reg_req" => { "out" => [ "fpa" ] },
+ "emit" => '. fmov %D1, %C /* Mov fConst into register */',
+ "cmp_attr" => 'return attr_a->value != attr_b->value;',
},
-"fConvD2S" => {
+"fpaFlt" => {
"irn_flags" => "R",
- "comment" => "convert double to single",
- "reg_req" => { "in" => [ "floating_point" ], "out" => [ "floating_point" ] },
- "emit" => '. FCVTSD %D1, %S1\t\t\t/* Convert double to single */',
+ "comment" => "construct a FPA integer->float conversion",
+ "reg_req" => { "in" => ["gp"], "out" => [ "fpa" ] },
+ "emit" => '. flt%M %D1, %S1 /* convert int to fp */',
},
-"fConvS2D" => {
+"fpaFix" => {
"irn_flags" => "R",
- "comment" => "convert single to double",
- "reg_req" => { "in" => [ "floating_point" ], "out" => [ "floating_point" ] },
- "emit" => '. FCVTDS %D1, %S1\t\t\t/* Convert single to double */',
+ "comment" => "construct a FPA float->integer conversion",
+ "reg_req" => { "in" => ["fpa"], "out" => [ "gp" ] },
+ "emit" => '. fix %D1, %S1 /* convert fp to int */',
},
-
# Load / Store
-"fLoads" => {
+"fpaLdf" => {
"op_flags" => "L|F",
"irn_flags" => "R",
"state" => "exc_pinned",
- "comment" => "construct FP Load: Load(ptr, mem) = LD ptr",
- "reg_req" => { "in" => [ "general_purpose", "none" ], "out" => [ "floating_point" ] },
- "emit" => '. FLDS %D1, %S1\t\t\t/* Load((%S1)) -> %D1 */'
-# "emit" => '. fmov %O(%S1), %D1\t\t\t/* Load((%S1)) -> %D1 */'
+ "comment" => "construct FPA Load: Load(ptr, mem) = LD ptr",
+ "attr" => "ir_mode *op_mode",
+ "init_attr" => "attr->op_mode = op_mode;",
+ "reg_req" => { "in" => [ "gp", "none" ], "out" => [ "fpa", "none" ] },
+ "emit" => '. ldf%M %D1, [%S1, #0] /* Load((%S1)) -> %D1 */',
+ "outs" => [ "res", "M" ],
},
-"fLoadd" => {
- "op_flags" => "L|F",
- "irn_flags" => "R",
- "state" => "exc_pinned",
- "comment" => "construct FP Load: Load(ptr, mem) = LD ptr",
- "reg_req" => { "in" => [ "general_purpose", "none" ], "out" => [ "floating_point" ] },
- "emit" => '. FLDD %D1, %S1\t\t\t/* Load((%S1)) -> %D1 */'
-# "emit" => '. fmov %O(%S1), %D1\t\t\t/* Load((%S1)) -> %D1 */'
-},
-
-"fStores" => {
+"fpaStf" => {
"op_flags" => "L|F",
"irn_flags" => "R",
"state" => "exc_pinned",
"comment" => "construct Store: Store(ptr, val, mem) = ST ptr,val",
- "reg_req" => { "in" => [ "general_purpose", "floating_point", "none" ] },
- "emit" => '. FSTS %S2, %S1\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
+ "attr" => "ir_mode *op_mode",
+ "init_attr" => "attr->op_mode = op_mode;",
+ "reg_req" => { "in" => [ "gp", "fpa", "none" ] },
+ "emit" => '. stf%M [%S2, #0], %S1 /* Store(%S2) -> (%S1), (%A1, %A2) */',
+ "outs" => [ "M" ],
},
-"fStored" => {
+"fpaDbl2GP" => {
"op_flags" => "L|F",
"irn_flags" => "R",
"state" => "exc_pinned",
- "comment" => "construct Store: Store(ptr, val, mem) = ST ptr,val",
- "reg_req" => { "in" => [ "general_purpose", "floating_point", "none" ] },
- "emit" => '. FSTD %S2, %S1\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
-},
+ "comment" => "construct fp double to 2 gp register transfer",
+ "reg_req" => { "in" => [ "fpa", "none" ], "out" => [ "gp", "gp" ] },
+ "outs" => [ "low", "high", "M" ],
+},
+
+
+#---------------------------------------------------#
+# __ _ #
+# / _| | | #
+# __ _| |_ _ __ _ __ ___ __| | ___ ___ #
+# \ \ / / _| '_ \ | '_ \ / _ \ / _` |/ _ \/ __| #
+# \ V /| | | |_) | | | | | (_) | (_| | __/\__ \ #
+# \_/ |_| | .__/ |_| |_|\___/ \__,_|\___||___/ #
+# | | #
+# |_| #
+#---------------------------------------------------#
); # end of %nodes