{ name => "i3", realname => "i3", type => 0 }, # param 4
{ name => "i4", realname => "i4", type => 0 }, # param 5
{ name => "i5", realname => "i5", type => 0 }, # param 6
- { name => "fp", realname => "fp", type => $ignore }, # our framepointer
+ { name => "frame_pointer", realname => "fp", type => $ignore }, # our framepointer
{ name => "i7", realname => "i7", type => $ignore }, # return address - 8
{ mode => $mode_gp }
],
{ mode => $mode_flags, flags => "manual_ra" }
],
# fp registers can be accessed any time
- fp => [
+ fp => [
{ name => "f0", type => $caller_save },
{ name => "f1", type => $caller_save },
{ name => "f2", type => $caller_save },
%emit_templates = (
# emit source reg or imm dep. on node's arity
- RI => "${arch}_emit_reg_or_imm(node, -1);",
+ RI => "${arch}_emit_reg_or_imm(node, -1);",
R1I => "${arch}_emit_reg_or_imm(node, 0);",
R2I => "${arch}_emit_reg_or_imm(node, 1);",
R3I => "${arch}_emit_reg_or_imm(node, 2);",
-# simple reg emitters
- S1 => "${arch}_emit_source_register(node, 0);",
- S2 => "${arch}_emit_source_register(node, 1);",
- S3 => "${arch}_emit_source_register(node, 2);",
- S4 => "${arch}_emit_source_register(node, 3);",
- S5 => "${arch}_emit_source_register(node, 4);",
- S6 => "${arch}_emit_source_register(node, 5);",
- D1 => "${arch}_emit_dest_register(node, 0);",
- D2 => "${arch}_emit_dest_register(node, 1);",
- D3 => "${arch}_emit_dest_register(node, 2);",
- D4 => "${arch}_emit_dest_register(node, 3);",
- D5 => "${arch}_emit_dest_register(node, 4);",
- D6 => "${arch}_emit_dest_register(node, 5);",
-# more custom emitters
- C => "${arch}_emit_immediate(node);",
+ S1 => "${arch}_emit_source_register(node, 0);",
+ S2 => "${arch}_emit_source_register(node, 1);",
+ S3 => "${arch}_emit_source_register(node, 2);",
+ S4 => "${arch}_emit_source_register(node, 3);",
+ S5 => "${arch}_emit_source_register(node, 4);",
+ S6 => "${arch}_emit_source_register(node, 5);",
+ D1 => "${arch}_emit_dest_register(node, 0);",
+ D2 => "${arch}_emit_dest_register(node, 1);",
+ D3 => "${arch}_emit_dest_register(node, 2);",
+ D4 => "${arch}_emit_dest_register(node, 3);",
+ D5 => "${arch}_emit_dest_register(node, 4);",
+ D6 => "${arch}_emit_dest_register(node, 5);",
+ IM => "${arch}_emit_immediate(node);",
LM => "${arch}_emit_load_mode(node);",
SM => "${arch}_emit_store_mode(node);",
- EXTPREF => "${arch}_emit_mode_sign_prefix(node);",
FPM => "${arch}_emit_fp_mode_suffix(node);",
- FPLM => "${arch}_emit_fp_load_mode(node);",
- FPSM => "${arch}_emit_fp_store_mode(node);",
- O => "${arch}_emit_offset(node);",
+ FCONVS => "${arch}_emit_fp_conv_source(node);",
+ FCONVD => "${arch}_emit_fp_conv_destination(node);",
+ O => "${arch}_emit_offset(node);",
);
$default_attr_type = "sparc_attr_t";
"\tinit_sparc_load_store_attributes(res, ls_mode, entity, entity_sign, offset, is_frame_entity);",
sparc_symconst_attr_t => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);\n".
"\tinit_sparc_symconst_attributes(res, entity);",
- sparc_cmp_attr_t => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);\n",
sparc_jmp_cond_attr_t => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);",
sparc_jmp_switch_attr_t => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);",
sparc_save_attr_t => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);",
-
+ sparc_fp_attr_t => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);\n".
+ "\tinit_sparc_fp_attributes(res, fp_mode);\n",
+ sparc_fp_conv_attr_t => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);".
+ "\tinit_sparc_fp_conv_attributes(res, src_mode, dest_mode);\n",
);
%compare_attr = (
sparc_symconst_attr_t => "cmp_attr_sparc_symconst",
sparc_jmp_cond_attr_t => "cmp_attr_sparc_jmp_cond",
sparc_jmp_switch_attr_t => "cmp_attr_sparc_jmp_switch",
- sparc_cmp_attr_t => "cmp_attr_sparc_cmp",
sparc_save_attr_t => "cmp_attr_sparc_save",
+ sparc_fp_attr_t => "cmp_attr_sparc_fp",
+ sparc_fp_conv_attr_t => "cmp_attr_sparc_fp_conv",
);
# addressing modes: imm, reg, reg +/- imm, reg + reg
my %cmp_operand_constructors = (
imm => {
- attr => "int immediate_value, bool ins_permuted, bool is_unsigned",
- custominit => "sparc_set_attr_imm(res, immediate_value);" .
- "\tinit_sparc_cmp_attr(res, ins_permuted, is_unsigned);",
+ attr => "int immediate_value",
+ custominit => "sparc_set_attr_imm(res, immediate_value);",
reg_req => { in => [ "gp" ], out => [ "flags" ] },
- ins => [ "left" ],
+ ins => [ "left" ],
},
reg => {
- attr => "bool ins_permuted, bool is_unsigned",
- custominit => "init_sparc_cmp_attr(res, ins_permuted, is_unsigned);",
reg_req => { in => [ "gp", "gp" ], out => [ "flags" ] },
ins => [ "left", "right" ],
},
mode => "mode_M",
state => "exc_pinned",
ins => [ "ptr", "val", "mem" ],
- outs => [ "mem" ],
+ outs => [ "M" ],
reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
attr_type => "sparc_load_store_attr_t",
attr => "ir_mode *ls_mode, ir_entity *entity, int entity_sign, long offset, bool is_frame_entity",
Save => {
reg_req => {
in => [ "sp", "none"],
- out => [ "sp:I|S","none" ]
+ out => [ "sp:I|S", "frame_pointer:I", "none" ]
},
ins => [ "stack", "mem" ],
- outs => [ "stack", "mem" ],
+ outs => [ "stack", "frame", "mem" ],
attr => "int initial_stacksize",
attr_type => "sparc_save_attr_t",
- init_attr => "\tinit_sparc_save_attr(res, initial_stacksize);",
+ init_attr => "\tinit_sparc_save_attributes(res, initial_stacksize);",
},
SubSP => {
state => "pinned",
mode => "mode_T",
reg_req => { in => [ "flags" ], out => [ "none", "none" ] },
- attr => "int proj_num",
+ attr => "int proj_num, bool is_unsigned",
attr_type => "sparc_jmp_cond_attr_t",
- init_attr => "\tset_sparc_jmp_cond_proj_num(res, proj_num);",
+ init_attr => "\tinit_sparc_jmp_cond_attr(res, proj_num, is_unsigned);",
},
Ba => {
mode => "mode_X",
},
+Call => {
+ irn_flags => [ "modify_flags" ],
+ state => "exc_pinned",
+ arity => "variable",
+ out_arity => "variable",
+ constructors => {
+ imm => {
+ attr => "ir_entity *entity, long offset",
+ custominit => "get_sparc_attr(res)->immediate_value_entity = entity;",
+ arity => "variable",
+ out_arity => "variable",
+ },
+ reg => {
+ arity => "variable",
+ out_arity => "variable",
+ }
+ },
+},
+
Cmp => {
irn_flags => [ "rematerializable", "modify_flags" ],
emit => '. cmp %S1, %R2I',
mode => $mode_flags,
- attr_type => "sparc_cmp_attr_t",
constructors => \%cmp_operand_constructors,
},
irn_flags => [ "rematerializable", "modify_flags" ],
emit => '. tst %S1',
mode => $mode_flags,
- attr_type => "sparc_cmp_attr_t",
- attr => "bool ins_permuted, bool is_unsigned",
- custominit => "init_sparc_cmp_attr(res, ins_permuted, is_unsigned);",
reg_req => { in => [ "gp" ], out => [ "flags" ] },
- ins => [ "left" ],
+ ins => [ "val" ],
},
SwitchJmp => {
Sll => {
irn_flags => [ "rematerializable" ],
- mode => $mode_gp,
+ mode => $mode_gp,
reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
emit => '. sll %S1, %R2I, %D1',
constructors => \%binop_operand_constructors,
Slr => {
irn_flags => [ "rematerializable" ],
- mode => $mode_gp,
+ mode => $mode_gp,
reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
emit => '. srl %S1, %R2I, %D1',
constructors => \%binop_operand_constructors,
Sra => {
irn_flags => [ "rematerializable" ],
- mode => $mode_gp,
+ mode => $mode_gp,
reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
emit => '. sra %S1, %R2I, %D1',
constructors => \%binop_operand_constructors,
And => {
irn_flags => [ "rematerializable" ],
- mode => $mode_gp,
+ mode => $mode_gp,
reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
emit => '. and %S1, %R2I, %D1',
constructors => \%binop_operand_constructors,
Or => {
irn_flags => [ "rematerializable" ],
- mode => $mode_gp,
+ mode => $mode_gp,
reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
emit => '. or %S1, %R2I, %D1',
constructors => \%binop_operand_constructors,
Xor => {
irn_flags => [ "rematerializable" ],
- mode => $mode_gp,
+ mode => $mode_gp,
reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
emit => '. xor %S1, %R2I, %D1',
constructors => \%binop_operand_constructors,
},
Mul => {
- state => "exc_pinned",
- reg_req => { in => [ "gp", "gp" ], out => [ "gp", "flags" ] },
- outs => [ "low", "high" ],
+ reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
constructors => \%binop_operand_constructors,
- #emit =>'. mul %S1, %R2I, %D1'
+ emit => '. mul %S1, %R2I, %D1',
+ mode => $mode_gp,
},
Mulh => {
- state => "exc_pinned",
reg_req => { in => [ "gp", "gp" ], out => [ "gp", "gp" ] },
outs => [ "low", "high" ],
constructors => \%binop_operand_constructors,
Div => {
irn_flags => [ "rematerializable" ],
state => "exc_pinned",
- reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
- outs => [ "res" ],
+ reg_req => { in => [ "gp", "gp" ], out => [ "gp", "none" ] },
+ outs => [ "res", "M" ],
constructors => \%binop_operand_constructors,
- #mode => $mode_gp,
- #emit =>'. div %S1, %R2I, %D1'
+ emit => '. div %S1, %R2I, %D1',
},
Minus => {
irn_flags => [ "rematerializable" ],
- mode => $mode_gp,
+ mode => $mode_gp,
reg_req => { in => [ "gp" ], out => [ "gp" ] },
emit => ". sub %%g0, %S1, %D1"
},
Not => {
- irn_flags => [ "rematerializable" ],
- mode => $mode_gp,
- reg_req => { in => [ "gp" ], out => [ "gp" ] },
- emit => '. xnor %S1, %%g0, %D1'
+ irn_flags => [ "rematerializable" ],
+ mode => $mode_gp,
+ reg_req => { in => [ "gp" ], out => [ "gp" ] },
+ emit => '. xnor %S1, %%g0, %D1'
},
Nop => {
emit => '. nop',
},
-fAdd => {
+fadd => {
op_flags => [ "commutative" ],
irn_flags => [ "rematerializable" ],
reg_req => { in => [ "fp", "fp" ], out => [ "fp" ] },
- emit => '. fadd%FPM %S1, %S2, %D1'
+ emit => '. fadd%FPM %S1, %S2, %D1',
+ attr_type => "sparc_fp_attr_t",
+ attr => "ir_mode *fp_mode",
+ mode => $mode_fp,
},
-fMul => {
- op_flags => [ "commutative" ],
+fsub => {
+ irn_flags => [ "rematerializable" ],
reg_req => { in => [ "fp", "fp" ], out => [ "fp" ] },
- emit =>'. fmul%FPM %S1, %S2, %D1'
+ emit => '. fsub%FPM %S1, %S2, %D1',
+ attr_type => "sparc_fp_attr_t",
+ attr => "ir_mode *fp_mode",
+ mode => $mode_fp,
},
-fsMuld => {
+fmul => {
+ irn_flags => [ "rematerializable" ],
op_flags => [ "commutative" ],
reg_req => { in => [ "fp", "fp" ], out => [ "fp" ] },
- emit =>'. fsmuld %S1, %S2, %D1'
+ emit =>'. fmul%FPM %S1, %S2, %D1',
+ attr_type => "sparc_fp_attr_t",
+ attr => "ir_mode *fp_mode",
+ mode => $mode_fp,
},
-FsTOd => {
+fdiv => {
+ irn_flags => [ "rematerializable" ],
+ reg_req => { in => [ "fp", "fp" ], out => [ "fp", "none" ] },
+ emit => '. fdiv%FPM %S1, %S2, %D1',
+ attr_type => "sparc_fp_attr_t",
+ attr => "ir_mode *fp_mode",
+ outs => [ "res", "M" ],
+},
+
+fneg => {
irn_flags => [ "rematerializable" ],
reg_req => { in => [ "fp" ], out => [ "fp" ] },
- emit =>'. FsTOd %S1, %D1'
+ emit => '. fneg%FPM %S1, %D1',
+ attr_type => "sparc_fp_attr_t",
+ attr => "ir_mode *fp_mode",
+ mode => $mode_fp,
},
-FdTOs => {
+"fabs" => {
irn_flags => [ "rematerializable" ],
reg_req => { in => [ "fp" ], out => [ "fp" ] },
- emit =>'. FdTOs %S1, %D1'
+ emit => '. fabs%FPM %S1, %D1',
+ attr_type => "sparc_fp_attr_t",
+ attr => "ir_mode *fp_mode",
+ mode => $mode_fp,
},
-FiTOs => {
+fftof => {
irn_flags => [ "rematerializable" ],
- reg_req => { in => [ "gp" ], out => [ "fp" ] },
- emit =>'. FiTOs %S1, %D1'
+ reg_req => { in => [ "fp" ], out => [ "fp" ] },
+ emit => '. f%FCONVS.to%FCONVD %S1, %D1',
+ attr_type => "sparc_fp_conv_attr_t",
+ attr => "ir_mode *src_mode, ir_mode *dest_mode",
+ mode => $mode_fp,
},
-FiTOd => {
+fitof => {
irn_flags => [ "rematerializable" ],
reg_req => { in => [ "gp" ], out => [ "fp" ] },
- emit =>'. FiTOd %S1, %D1'
+ emit => '. fito%FPM %S1, %D1',
+ attr_type => "sparc_fp_attr_t",
+ attr => "ir_mode *fp_mode",
+ mode => $mode_fp,
},
-FsTOi => {
+fftoi => {
irn_flags => [ "rematerializable" ],
reg_req => { in => [ "fp" ], out => [ "gp" ] },
- emit =>'. FsTOi %S1, %D1'
+ emit => '. f%FPM.toi %S1, %D1',
+ attr_type => "sparc_fp_attr_t",
+ attr => "ir_mode *fp_mode",
+ mode => $mode_gp,
},
-FdTOi => {
- irn_flags => [ "rematerializable" ],
- reg_req => { in => [ "fp" ], out => [ "gp" ] },
- emit =>'. FdTOi %S1, %D1'
+Ldf => {
+ op_flags => [ "labeled", "fragile" ],
+ state => "exc_pinned",
+ ins => [ "ptr", "mem" ],
+ outs => [ "res", "M" ],
+ reg_req => { in => [ "gp", "none" ], out => [ "fp", "none" ] },
+ attr_type => "sparc_load_store_attr_t",
+ attr => "ir_mode *ls_mode, ir_entity *entity, int entity_sign, long offset, bool is_frame_entity",
+ emit => '. ld [%S1%O], %D1'
+},
+
+Stf => {
+ op_flags => [ "labeled", "fragile" ],
+ state => "exc_pinned",
+ ins => [ "ptr", "val", "mem" ],
+ outs => [ "M" ],
+ reg_req => { in => [ "gp", "fp", "none" ], out => [ "none" ] },
+ attr_type => "sparc_load_store_attr_t",
+ attr => "ir_mode *ls_mode, ir_entity *entity, int entity_sign, long offset, bool is_frame_entity",
+ emit => '. st %S2, [%S1%O]',
+ mode => 'mode_M',
},
); # end of %nodes