Commit 44dd4365 authored by Matthias Braun's avatar Matthias Braun
Browse files

- further refactoring and finally eliminated the callback for get_out_reg_reqs

- Introduced be_Start which is now used instead of iro_Start+be_RegParams
- further cleanups and fixes along the way

[r26549]
parent 15769c9f
...@@ -116,7 +116,7 @@ typedef enum { ...@@ -116,7 +116,7 @@ typedef enum {
beo_AddSP, beo_AddSP,
beo_SubSP, beo_SubSP,
beo_IncSP, beo_IncSP,
beo_RegParams, beo_Start,
beo_FrameAddr, beo_FrameAddr,
beo_Barrier, beo_Barrier,
/* last backend node number */ /* last backend node number */
......
...@@ -140,15 +140,6 @@ const arch_register_req_t *get_TEMPLATE_in_req(const ir_node *node, int pos) ...@@ -140,15 +140,6 @@ const arch_register_req_t *get_TEMPLATE_in_req(const ir_node *node, int pos)
return attr->in_req[pos]; return attr->in_req[pos];
} }
/**
* Returns the result register requirement at position pos of an TEMPLATE node.
*/
const arch_register_req_t *get_TEMPLATE_out_req(const ir_node *node, int pos)
{
const backend_info_t *info = be_get_info(node);
return info->out_infos[pos].req;
}
/** /**
* Sets the IN register requirements at position pos. * Sets the IN register requirements at position pos.
*/ */
......
...@@ -55,11 +55,6 @@ const arch_register_req_t **get_TEMPLATE_in_req_all(const ir_node *node); ...@@ -55,11 +55,6 @@ const arch_register_req_t **get_TEMPLATE_in_req_all(const ir_node *node);
*/ */
const arch_register_req_t *get_TEMPLATE_in_req(const ir_node *node, int pos); const arch_register_req_t *get_TEMPLATE_in_req(const ir_node *node, int pos);
/**
* Returns the result register requirements of an TEMPLATE node.
*/
const arch_register_req_t *get_TEMPLATE_out_req(const ir_node *node, int pos);
/** /**
* Sets the IN register requirements at position pos. * Sets the IN register requirements at position pos.
*/ */
......
...@@ -141,18 +141,18 @@ $arch = "TEMPLATE"; ...@@ -141,18 +141,18 @@ $arch = "TEMPLATE";
); # %reg_classes ); # %reg_classes
%emit_templates = ( %emit_templates = (
S1 => "${arch}_emit_source_register(node, 0);", S1 => "${arch}_emit_source_register(node, 0);",
S2 => "${arch}_emit_source_register(node, 1);", S2 => "${arch}_emit_source_register(node, 1);",
S3 => "${arch}_emit_source_register(node, 2);", S3 => "${arch}_emit_source_register(node, 2);",
S4 => "${arch}_emit_source_register(node, 3);", S4 => "${arch}_emit_source_register(node, 3);",
S5 => "${arch}_emit_source_register(node, 4);", S5 => "${arch}_emit_source_register(node, 4);",
S6 => "${arch}_emit_source_register(node, 5);", S6 => "${arch}_emit_source_register(node, 5);",
D1 => "${arch}_emit_dest_register(node, 0);", D1 => "${arch}_emit_dest_register(node, 0);",
D2 => "${arch}_emit_dest_register(node, 1);", D2 => "${arch}_emit_dest_register(node, 1);",
D3 => "${arch}_emit_dest_register(node, 2);", D3 => "${arch}_emit_dest_register(node, 2);",
D4 => "${arch}_emit_dest_register(node, 3);", D4 => "${arch}_emit_dest_register(node, 3);",
D5 => "${arch}_emit_dest_register(node, 4);", D5 => "${arch}_emit_dest_register(node, 4);",
D6 => "${arch}_emit_dest_register(node, 5);", D6 => "${arch}_emit_dest_register(node, 5);",
C => "${arch}_emit_immediate(node);" C => "${arch}_emit_immediate(node);"
); );
...@@ -183,208 +183,215 @@ $arch = "TEMPLATE"; ...@@ -183,208 +183,215 @@ $arch = "TEMPLATE";
# commutative operations # commutative operations
Add => { Add => {
op_flags => "C", op_flags => "C",
irn_flags => "R", irn_flags => "R",
comment => "construct Add: Add(a, b) = Add(b, a) = a + b", comment => "construct Add: Add(a, b) = Add(b, a) = a + b",
reg_req => { in => [ "general_purpose", "general_purpose" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose", "general_purpose" ], out => [ "general_purpose" ] },
emit => '. add %S1, %S2, %D1' emit => '. add %S1, %S2, %D1'
}, },
Add_i => { Add_i => {
irn_flags => "R", irn_flags => "R",
comment => "construct Add: Add(a, const) = Add(const, a) = a + const", comment => "construct Add: Add(a, const) = Add(const, a) = a + const",
reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] },
emit => '. add %S1, %C, %D1' emit => '. add %S1, %C, %D1'
}, },
Mul => { Mul => {
op_flags => "C", op_flags => "C",
irn_flags => "R", irn_flags => "R",
comment => "construct Mul: Mul(a, b) = Mul(b, a) = a * b", comment => "construct Mul: Mul(a, b) = Mul(b, a) = a * b",
reg_req => { in => [ "general_purpose", "general_purpose" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose", "general_purpose" ], out => [ "general_purpose" ] },
emit =>'. mul %S1, %S2, %D1' emit =>'. mul %S1, %S2, %D1'
}, },
Mul_i => { Mul_i => {
irn_flags => "R", irn_flags => "R",
comment => "construct Mul: Mul(a, const) = Mul(const, a) = a * const", comment => "construct Mul: Mul(a, const) = Mul(const, a) = a * const",
reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] },
emit => '. mul %S1, %C, %D1' emit => '. mul %S1, %C, %D1'
}, },
And => { And => {
op_flags => "C", op_flags => "C",
irn_flags => "R", irn_flags => "R",
comment => "construct And: And(a, b) = And(b, a) = a AND b", comment => "construct And: And(a, b) = And(b, a) = a AND b",
reg_req => { in => [ "general_purpose", "general_purpose" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose", "general_purpose" ], out => [ "general_purpose" ] },
emit => '. and %S1, %S2, %D1' emit => '. and %S1, %S2, %D1'
}, },
And_i => { And_i => {
irn_flags => "R", irn_flags => "R",
comment => "construct And: And(a, const) = And(const, a) = a AND const", comment => "construct And: And(a, const) = And(const, a) = a AND const",
reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] },
emit => '. and %S1, %C, %D1' emit => '. and %S1, %C, %D1'
}, },
Or => { Or => {
op_flags => "C", op_flags => "C",
irn_flags => "R", irn_flags => "R",
comment => "construct Or: Or(a, b) = Or(b, a) = a OR b", comment => "construct Or: Or(a, b) = Or(b, a) = a OR b",
reg_req => { in => [ "general_purpose", "general_purpose" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose", "general_purpose" ], out => [ "general_purpose" ] },
emit => '. or %S1, %S2, %D1' emit => '. or %S1, %S2, %D1'
}, },
Or_i => { Or_i => {
op_flags => "C", op_flags => "C",
irn_flags => "R", irn_flags => "R",
comment => "construct Or: Or(a, const) = Or(const, a) = a OR const", comment => "construct Or: Or(a, const) = Or(const, a) = a OR const",
reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] },
emit => '. or %S1, %C, %D1' emit => '. or %S1, %C, %D1'
}, },
Eor => { Eor => {
op_flags => "C", op_flags => "C",
irn_flags => "R", irn_flags => "R",
comment => "construct Eor: Eor(a, b) = Eor(b, a) = a EOR b", comment => "construct Eor: Eor(a, b) = Eor(b, a) = a EOR b",
reg_req => { in => [ "general_purpose", "general_purpose" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose", "general_purpose" ], out => [ "general_purpose" ] },
emit => '. xor %S1, %S2, %D1' emit => '. xor %S1, %S2, %D1'
}, },
Eor_i => { Eor_i => {
irn_flags => "R", irn_flags => "R",
comment => "construct Eor: Eor(a, const) = Eor(const, a) = a EOR const", comment => "construct Eor: Eor(a, const) = Eor(const, a) = a EOR const",
reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] },
emit => '. xor %S1, %C, %D1' emit => '. xor %S1, %C, %D1'
}, },
# not commutative operations # not commutative operations
Sub => { Sub => {
irn_flags => "R", irn_flags => "R",
comment => "construct Sub: Sub(a, b) = a - b", comment => "construct Sub: Sub(a, b) = a - b",
reg_req => { in => [ "general_purpose", "general_purpose" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose", "general_purpose" ], out => [ "general_purpose" ] },
emit => '. sub %S1, %S2, %D1' emit => '. sub %S1, %S2, %D1'
}, },
Sub_i => { Sub_i => {
irn_flags => "R", irn_flags => "R",
comment => "construct Sub: Sub(a, const) = a - const", comment => "construct Sub: Sub(a, const) = a - const",
reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] },
emit => '. subl %S1, %C, %D1' emit => '. subl %S1, %C, %D1'
}, },
Shl => { Shl => {
irn_flags => "R", irn_flags => "R",
comment => "construct Shl: Shl(a, b) = a << b", comment => "construct Shl: Shl(a, b) = a << b",
reg_req => { in => [ "general_purpose", "general_purpose" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose", "general_purpose" ], out => [ "general_purpose" ] },
emit => '. shl %S1, %S2, %D1' emit => '. shl %S1, %S2, %D1'
}, },
Shl_i => { Shl_i => {
irn_flags => "R", irn_flags => "R",
comment => "construct Shl: Shl(a, const) = a << const", comment => "construct Shl: Shl(a, const) = a << const",
reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] },
emit => '. shl %S1, %C, %D1' emit => '. shl %S1, %C, %D1'
}, },
Shr => { Shr => {
irn_flags => "R", irn_flags => "R",
comment => "construct Shr: Shr(a, b) = a >> b", comment => "construct Shr: Shr(a, b) = a >> b",
reg_req => { in => [ "general_purpose", "general_purpose" ], out => [ "in_r1" ] }, reg_req => { in => [ "general_purpose", "general_purpose" ], out => [ "in_r1" ] },
emit => '. shr %S2, %D1' emit => '. shr %S2, %D1'
}, },
Shr_i => { Shr_i => {
irn_flags => "R", irn_flags => "R",
comment => "construct Shr: Shr(a, const) = a >> const", comment => "construct Shr: Shr(a, const) = a >> const",
reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] },
emit => '. shr %S1, %C, %D1' emit => '. shr %S1, %C, %D1'
}, },
RotR => { RotR => {
irn_flags => "R", irn_flags => "R",
comment => "construct RotR: RotR(a, b) = a ROTR b", comment => "construct RotR: RotR(a, b) = a ROTR b",
reg_req => { in => [ "general_purpose", "general_purpose" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose", "general_purpose" ], out => [ "general_purpose" ] },
emit => '. ror %S1, %S2, %D1' emit => '. ror %S1, %S2, %D1'
}, },
RotL => { RotL => {
irn_flags => "R", irn_flags => "R",
comment => "construct RotL: RotL(a, b) = a ROTL b", comment => "construct RotL: RotL(a, b) = a ROTL b",
reg_req => { in => [ "general_purpose", "general_purpose" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose", "general_purpose" ], out => [ "general_purpose" ] },
emit => '. rol %S1, %S2, %D1' emit => '. rol %S1, %S2, %D1'
}, },
RotL_i => { RotL_i => {
irn_flags => "R", irn_flags => "R",
comment => "construct RotL: RotL(a, const) = a ROTL const", comment => "construct RotL: RotL(a, const) = a ROTL const",
reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] },
emit => '. rol %S1, %C, %D1' emit => '. rol %S1, %C, %D1'
}, },
Minus => { Minus => {
irn_flags => "R", irn_flags => "R",
comment => "construct Minus: Minus(a) = -a", comment => "construct Minus: Minus(a) = -a",
reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] },
emit => '. neg %S1, %D1' emit => '. neg %S1, %D1'
}, },
Inc => { Inc => {
irn_flags => "R", irn_flags => "R",
comment => "construct Increment: Inc(a) = a++", comment => "construct Increment: Inc(a) = a++",
reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] },
emit => '. inc %S1, %D1' emit => '. inc %S1, %D1'
}, },
Dec => { Dec => {
irn_flags => "R", irn_flags => "R",
comment => "construct Decrement: Dec(a) = a--", comment => "construct Decrement: Dec(a) = a--",
reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] },
emit => '. dec %S1, %D1' emit => '. dec %S1, %D1'
}, },
Not => { Not => {
arity => 1, arity => 1,
remat => 1, remat => 1,
comment => "construct Not: Not(a) = !a", comment => "construct Not: Not(a) = !a",
reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose" ], out => [ "general_purpose" ] },
emit => '. not %S1, %D1' emit => '. not %S1, %D1'
}, },
# other operations # other operations
Const => { Const => {
op_flags => "c", op_flags => "c",
irn_flags => "R", irn_flags => "R",
comment => "represents an integer constant", comment => "represents an integer constant",
reg_req => { out => [ "general_purpose" ] }, reg_req => { out => [ "general_purpose" ] },
emit => '. mov %C, %D1', emit => '. mov %C, %D1',
cmp_attr => cmp_attr =>
' '
/* TODO: compare Const attributes */ /* TODO: compare Const attributes */
return 1; return 1;
' '
}, },
Jmp => {
state => "pinned",
op_flags => "X",
reg_req => { out => [ "none" ] },
mode => "mode_X",
},
# Load / Store # Load / Store
Load => { Load => {
op_flags => "L|F", op_flags => "L|F",
irn_flags => "R", irn_flags => "R",
state => "exc_pinned", state => "exc_pinned",
comment => "construct Load: Load(ptr, mem) = LD ptr -> reg", comment => "construct Load: Load(ptr, mem) = LD ptr -> reg",
reg_req => { in => [ "general_purpose", "none" ], out => [ "general_purpose" ] }, reg_req => { in => [ "general_purpose", "none" ], out => [ "general_purpose" ] },
emit => '. mov (%S1), %D1' emit => '. mov (%S1), %D1'
}, },
Store => { Store => {
op_flags => "L|F", op_flags => "L|F",
irn_flags => "R", irn_flags => "R",
state => "exc_pinned", state => "exc_pinned",
comment => "construct Store: Store(ptr, val, mem) = ST ptr,val", comment => "construct Store: Store(ptr, val, mem) = ST ptr,val",
reg_req => { in => [ "general_purpose", "general_purpose", "none" ] }, reg_req => { in => [ "general_purpose", "general_purpose", "none" ] },
emit => '. movl %S2, (%S1)' emit => '. movl %S2, (%S1)'
}, },
#--------------------------------------------------------# #--------------------------------------------------------#
...@@ -399,67 +406,67 @@ Store => { ...@@ -399,67 +406,67 @@ Store => {
# commutative operations # commutative operations
fAdd => { fAdd => {
op_flags => "C", op_flags => "C",
irn_flags => "R", irn_flags => "R",
comment => "construct FP Add: Add(a, b) = Add(b, a) = a + b", comment => "construct FP Add: Add(a, b) = Add(b, a) = a + b",
reg_req => { in => [ "floating_point", "floating_point" ], out => [ "floating_point" ] }, reg_req => { in => [ "floating_point", "floating_point" ], out => [ "floating_point" ] },
emit => '. fadd %S1, %S2, %D1' emit => '. fadd %S1, %S2, %D1'
}, },
fMul => { fMul => {
op_flags => "C", op_flags => "C",
comment => "construct FP Mul: Mul(a, b) = Mul(b, a) = a * b", comment => "construct FP Mul: Mul(a, b) = Mul(b, a) = a * b",
reg_req => { in => [ "floating_point", "floating_point" ], out => [ "floating_point" ] }, reg_req => { in => [ "floating_point", "floating_point" ], out => [ "floating_point" ] },
emit =>'. fmul %S1, %S2, %D1' emit =>'. fmul %S1, %S2, %D1'
}, },
fMax => { fMax => {
op_flags => "C", op_flags => "C",
irn_flags => "R", irn_flags => "R",
comment => "construct FP Max: Max(a, b) = Max(b, a) = a > b ? a : b", comment => "construct FP Max: Max(a, b) = Max(b, a) = a > b ? a : b",
reg_req => { in => [ "floating_point", "floating_point" ], out => [ "floating_point" ] }, reg_req => { in => [ "floating_point", "floating_point" ], out => [ "floating_point" ] },
emit =>'. fmax %S1, %S2, %D1' emit =>'. fmax %S1, %S2, %D1'
}, },
fMin => { fMin => {
op_flags => "C", op_flags => "C",
irn_flags => "R", irn_flags => "R",
comment => "construct FP Min: Min(a, b) = Min(b, a) = a < b ? a : b", comment => "construct FP Min: Min(a, b) = Min(b, a) = a < b ? a : b",
reg_req => { in => [ "floating_point", "floating_point" ], out => [ "floating_point" ] }, reg_req => { in => [ "floating_point", "floating_point" ], out => [ "floating_point" ] },
emit =>'. fmin %S1, %S2, %D1' emit =>'. fmin %S1, %S2, %D1'
}, },
# not commutative operations # not commutative operations
fSub => { fSub => {
irn_flags => "R", irn_flags => "R",
comment => "construct FP Sub: Sub(a, b) = a - b", comment => "construct FP Sub: Sub(a, b) = a - b",
reg_req => { in => [ "floating_point", "floating_point" ], out => [ "floating_point" ] }, reg_req => { in => [ "floating_point", "floating_point" ], out => [ "floating_point" ] },
emit => '. fsub %S1, %S2, %D1' emit => '. fsub %S1, %S2, %D1'
}, },
fDiv => { fDiv => {
comment => "construct FP Div: Div(a, b) = a / b", comment => "construct FP Div: Div(a, b) = a / b",
reg_req => { in => [ "floating_point", "floating_point" ], out => [ "floating_point" ] }, reg_req => { in => [ "floating_point", "floating_point" ], out => [ "floating_point" ] },
emit => '. fdiv %S1, %S2, %D1' emit => '. fdiv %S1, %S2, %D1'
}, },
fMinus => { fMinus => {
irn_flags => "R", irn_flags => "R",
comment => "construct FP Minus: Minus(a) = -a", comment => "construct FP Minus: Minus(a) = -a",
reg_req => { in => [ "floating_point" ], out => [ "floating_point" ] }, reg_req => { in => [ "floating_point" ], out => [ "floating_point" ] },
emit => '. fneg %S1, %D1' emit => '. fneg %S1, %D1'
}, },
# other operations # other operations
fConst => { fConst => {
op_flags => "c", op_flags => "c",
irn_flags => "R", irn_flags => "R",
comment => "represents a FP constant", comment => "represents a FP constant",
reg_req => { out => [ "floating_point" ] }, reg_req => { out => [ "floating_point" ] },
emit => '. fmov %C, %D1', emit => '. fmov %C, %D1',
cmp_attr => cmp_attr =>
' '