Commit 3ab17631 authored by Matthias Braun's avatar Matthias Braun
Browse files

TEMPLATE: Some rudimentary argument support

parent 24994170
......@@ -195,8 +195,8 @@ Jmp => {
Start => {
irn_flags => [ "schedule_first" ],
state => "pinned",
reg_req => { in => [], out => [ "sp:I|S", "none" ] },
outs => [ "stack", "M" ],
reg_req => { in => [], out => [ "sp:I|S", "r0", "r1", "r2", "r3", "none" ] },
outs => [ "stack", "arg0", "arg1", "arg2", "arg3", "M" ],
ins => [],
},
......
......@@ -254,6 +254,28 @@ static ir_node *gen_Phi(ir_node *node)
return be_transform_phi(node, req);
}
static ir_node *gen_Proj_Proj(ir_node *node)
{
ir_node *pred = get_Proj_pred(node);
ir_node *pred_pred = get_Proj_pred(pred);
if (is_Start(pred_pred)) {
if (get_Proj_num(pred) == pn_Start_T_args) {
ir_node *new_start = be_transform_node(pred_pred);
// assume everything is passed in gp registers
unsigned arg_num = get_Proj_num(node);
if (arg_num >= 4)
panic("more than 4 arguments not supported");
static const unsigned pns[] = {
pn_TEMPLATE_Start_arg0, pn_TEMPLATE_Start_arg1,
pn_TEMPLATE_Start_arg2, pn_TEMPLATE_Start_arg3
};
assert(arg_num < ARRAY_SIZE(pns));
return new_r_Proj(new_start, gp_regs_mode, pns[arg_num]);
}
}
panic("No transformer for %+F -> %+F -> %+F", node, pred, pred_pred);
}
static ir_node *gen_Proj_Start(ir_node *node)
{
dbg_info *dbgi = get_irn_dbg_info(node);
......@@ -295,6 +317,7 @@ static void TEMPLATE_register_transformers(void)
be_set_transform_function(op_Store, gen_Store);
be_set_transform_function(op_Sub, gen_Sub);
be_set_transform_proj_function(op_Start, gen_Proj_Start);
be_set_transform_proj_function(op_Proj, gen_Proj_Proj);
}
static const unsigned ignore_regs[] = {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment