sparc: dont emit unnecarry block labels
[libfirm] / ir / be / sparc / sparc_spec.pl
1 # Creation: 2006/02/13
2 # $Id$
3
4 $arch = "sparc";
5
6 $mode_gp      = "mode_Iu";
7 $mode_flags   = "mode_Bu";
8 $mode_fpflags = "mode_Bu";
9 $mode_fp      = "mode_F";
10 $mode_fp2     = "mode_D";
11 $mode_fp4     = "mode_E"; # not correct, we need to register a new mode
12
13 # available SPARC registers: 8 globals, 24 window regs (8 ins, 8 outs, 8 locals)
14 %reg_classes = (
15         gp => [
16                 { name => "g0" },
17                 { name => "g1" },
18                 { name => "g2" },
19                 { name => "g3" },
20                 { name => "g4" },
21                 { name => "g5" },
22                 { name => "g6" },
23                 { name => "g7" },
24
25                 { name => "o0" },
26                 { name => "o1" },
27                 { name => "o2" },
28                 { name => "o3" },
29                 { name => "o4" },
30                 { name => "o5" },
31                 { name => "sp" },
32                 { name => "o7" },
33
34                 { name => "l0" },
35                 { name => "l1" },
36                 { name => "l2" },
37                 { name => "l3" },
38                 { name => "l4" },
39                 { name => "l5" },
40                 { name => "l6" },
41                 { name => "l7" },
42
43                 { name => "i0" },
44                 { name => "i1" },
45                 { name => "i2" },
46                 { name => "i3" },
47                 { name => "i4" },
48                 { name => "i5" },
49                 { name => "frame_pointer", realname => "fp" },
50                 { name => "i7" },
51                 { mode => $mode_gp }
52         ],
53         fpflags_class => [
54                 { name => "fpflags" },
55                 { mode => $mode_fpflags, flags => "manual_ra" }
56         ],
57         flags_class => [
58                 { name => "flags" },
59                 { mode => $mode_flags, flags => "manual_ra" }
60         ],
61         mul_div_high_res => [
62                 { name => "y" },
63                 { mode => $mode_gp, flags => "manual_ra" }
64         ],
65         # fp registers can be accessed any time
66         fp => [
67                 { name => "f0" },
68                 { name => "f1" },
69                 { name => "f2" },
70                 { name => "f3" },
71                 { name => "f4" },
72                 { name => "f5" },
73                 { name => "f6" },
74                 { name => "f7" },
75                 { name => "f8" },
76                 { name => "f9" },
77                 { name => "f10" },
78                 { name => "f11" },
79                 { name => "f12" },
80                 { name => "f13" },
81                 { name => "f14" },
82                 { name => "f15" },
83                 { name => "f16" },
84                 { name => "f17" },
85                 { name => "f18" },
86                 { name => "f19" },
87                 { name => "f20" },
88                 { name => "f21" },
89                 { name => "f22" },
90                 { name => "f23" },
91                 { name => "f24" },
92                 { name => "f25" },
93                 { name => "f26" },
94                 { name => "f27" },
95                 { name => "f28" },
96                 { name => "f29" },
97                 { name => "f30" },
98                 { name => "f31" },
99                 { mode => $mode_fp }
100         ]
101 ); # %reg_classes
102
103 %emit_templates = (
104 # emit source reg or imm dep. on node's arity
105         RI  => "${arch}_emit_reg_or_imm(node, -1);",
106         R1I => "${arch}_emit_reg_or_imm(node, 1);",
107         S0  => "${arch}_emit_source_register(node, 0);",
108         S1  => "${arch}_emit_source_register(node, 1);",
109         D0  => "${arch}_emit_dest_register(node, 0);",
110         HIM => "${arch}_emit_high_immediate(node);",
111         LM  => "${arch}_emit_load_mode(node);",
112         SM  => "${arch}_emit_store_mode(node);",
113         FLSM => "${arch}_emit_float_load_store_mode(node);",
114         FPM  => "${arch}_emit_fp_mode_suffix(node);",
115         FCONVS => "${arch}_emit_fp_conv_source(node);",
116         FCONVD => "${arch}_emit_fp_conv_destination(node);",
117         O1     => "${arch}_emit_offset(node, 1);",
118         O2     => "${arch}_emit_offset(node, 2);",
119 );
120
121 $default_attr_type = "sparc_attr_t";
122 $default_copy_attr = "sparc_copy_attr";
123
124
125 %init_attr = (
126         sparc_attr_t             => "\tinit_sparc_attributes(res, irn_flags_, in_reqs, exec_units, n_res);",
127         sparc_load_store_attr_t  => "\tinit_sparc_attributes(res, irn_flags_, in_reqs, exec_units, n_res);",
128         sparc_jmp_cond_attr_t    => "\tinit_sparc_attributes(res, irn_flags_, in_reqs, exec_units, n_res);",
129         sparc_switch_jmp_attr_t  => "\tinit_sparc_attributes(res, irn_flags_, in_reqs, exec_units, n_res);\n".
130                                     "\tinit_sparc_switch_jmp_attributes(res, default_pn, jump_table);\n",
131         sparc_fp_attr_t          => "\tinit_sparc_attributes(res, irn_flags_, in_reqs, exec_units, n_res);\n".
132                                     "\tinit_sparc_fp_attributes(res, fp_mode);\n",
133         sparc_fp_conv_attr_t     => "\tinit_sparc_attributes(res, irn_flags_, in_reqs, exec_units, n_res);".
134                                     "\tinit_sparc_fp_conv_attributes(res, src_mode, dest_mode);\n",
135 );
136
137 %compare_attr = (
138         sparc_attr_t            => "cmp_attr_sparc",
139         sparc_load_store_attr_t => "cmp_attr_sparc_load_store",
140         sparc_jmp_cond_attr_t   => "cmp_attr_sparc_jmp_cond",
141         sparc_switch_jmp_attr_t => "cmp_attr_sparc_switch_jmp",
142         sparc_fp_attr_t         => "cmp_attr_sparc_fp",
143         sparc_fp_conv_attr_t    => "cmp_attr_sparc_fp_conv",
144 );
145
146 %custom_irn_flags = (
147         modifies_flags    => "(arch_irn_flags_t)sparc_arch_irn_flag_modifies_flags",
148         modifies_fp_flags => "(arch_irn_flags_t)sparc_arch_irn_flag_modifies_fp_flags",
149 );
150
151 my %cmp_operand_constructors = (
152         imm => {
153                 attr       => "ir_entity *immediate_entity, int32_t immediate_value",
154                 custominit => "sparc_set_attr_imm(res, immediate_entity, immediate_value);",
155                 reg_req    => { in => [ "gp" ], out => [ "flags" ] },
156                 ins        => [ "left" ],
157         },
158         reg => {
159                 reg_req    => { in => [ "gp", "gp" ], out => [ "flags" ] },
160                 ins        => [ "left", "right" ],
161         },
162 );
163
164 my %binop_operand_constructors = (
165         imm => {
166                 attr       => "ir_entity *immediate_entity, int32_t immediate_value",
167                 custominit => "sparc_set_attr_imm(res, immediate_entity, immediate_value);",
168                 reg_req    => { in => [ "gp" ], out => [ "gp" ] },
169                 ins        => [ "left" ],
170         },
171         reg => {
172                 reg_req    => { in => [ "gp", "gp" ], out => [ "gp" ] },
173                 ins        => [ "left", "right" ],
174         },
175 );
176
177 my %binopcc_operand_constructors = (
178         imm => {
179                 attr       => "ir_entity *immediate_entity, int32_t immediate_value",
180                 custominit => "sparc_set_attr_imm(res, immediate_entity, immediate_value);",
181                 reg_req    => { in => [ "gp" ], out => [ "gp", "flags" ] },
182                 ins        => [ "left" ],
183         },
184         reg => {
185                 reg_req    => { in => [ "gp", "gp" ], out => [ "gp", "flags" ] },
186                 ins        => [ "left", "right" ],
187         },
188 );
189
190 my %binopx_operand_constructors = (
191         imm => {
192                 attr       => "ir_entity *immediate_entity, int32_t immediate_value",
193                 custominit => "sparc_set_attr_imm(res, immediate_entity, immediate_value);",
194                 reg_req    => { in => [ "gp", "flags" ], out => [ "gp" ] },
195                 ins        => [ "left", "carry" ],
196         },
197         reg => {
198                 reg_req    => { in => [ "gp", "gp", "flags" ], out => [ "gp" ] },
199                 ins        => [ "left", "right", "carry" ],
200         },
201 );
202
203
204 my %binopcczero_operand_constructors = (
205         imm => {
206                 attr       => "ir_entity *immediate_entity, int32_t immediate_value",
207                 custominit => "sparc_set_attr_imm(res, immediate_entity, immediate_value);",
208                 reg_req    => { in => [ "gp" ], out => [ "flags" ] },
209                 ins        => [ "left" ],
210         },
211         reg => {
212                 reg_req    => { in => [ "gp", "gp" ], out => [ "flags" ] },
213                 ins        => [ "left", "right" ],
214         },
215 );
216
217 my %div_operand_constructors = (
218         imm => {
219                 attr       => "ir_entity *immediate_entity, int32_t immediate_value",
220                 custominit => "sparc_set_attr_imm(res, immediate_entity, immediate_value);",
221                 reg_req    => { in => [ "gp", "gp" ], out => [ "gp" ] },
222         },
223         reg => {
224                 reg_req    => { in => [ "gp", "gp", "gp" ], out => [ "gp" ] },
225         },
226 );
227
228 my %float_binop_constructors = (
229         s => {
230                 reg_req => { in => [ "fp", "fp" ], out => [ "fp" ] },
231                 mode    => $mode_fp,
232         },
233         d => {
234                 reg_req => { in => [ "fp:a|2", "fp:a|2" ], out => [ "fp:a|2" ] },
235                 mode    => $mode_fp2,
236         },
237         q => {
238                 reg_req => { in => [ "fp:a|4", "fp:a|4" ], out => [ "fp:a|4" ] },
239                 mode    => $mode_fp4,
240         }
241 );
242
243 my %float_unop_constructors = (
244         s => {
245                 reg_req => { in => [ "fp" ], out => [ "fp" ] },
246                 mode    => $mode_fp,
247         },
248         d => {
249                 reg_req => { in => [ "fp:a|2" ], out => [ "fp:a|2" ] },
250                 mode    => $mode_fp2,
251         },
252         q => {
253                 reg_req => { in => [ "fp:a|4" ], out => [ "fp:a|4" ] },
254                 mode    => $mode_fp4,
255         }
256 );
257
258 %nodes = (
259
260 Add => {
261         irn_flags    => [ "rematerializable" ],
262         mode         => $mode_gp,
263         emit         => '. add %S0, %R1I, %D0',
264         constructors => \%binop_operand_constructors,
265 },
266
267 AddCC => {
268         irn_flags    => [ "rematerializable" ],
269         emit         => '. addcc %S0, %R1I, %D0',
270         outs         => [ "res", "flags" ],
271         constructors => \%binopcc_operand_constructors,
272 },
273
274 AddX => {
275         # At the moment not rematerializable because of assert in beflags.c/
276         # (it claims that spiller can't rematerialize flag stuff correctly)
277         #irn_flags    => [ "rematerializable" ],
278         emit         => '. addx %S0, %R1I, %D0',
279         constructors => \%binopx_operand_constructors,
280         mode         => $mode_gp,
281 },
282
283 AddCC_t => {
284         ins       => [ "left", "right" ],
285         outs      => [ "res", "flags" ],
286         attr_type => "",
287         dump_func => "NULL",
288 },
289
290 AddX_t => {
291         ins       => [ "left", "right", "flags_input" ],
292         attr_type => "",
293         dump_func => "NULL",
294 },
295
296 Sub => {
297         irn_flags    => [ "rematerializable" ],
298         mode         => $mode_gp,
299         emit         => '. sub %S0, %R1I, %D0',
300         constructors => \%binop_operand_constructors,
301 },
302
303 SubCC => {
304         irn_flags    => [ "rematerializable" ],
305         emit         => '. subcc %S0, %R1I, %D0',
306         outs         => [ "res", "flags" ],
307         constructors => \%binopcc_operand_constructors,
308 },
309
310 SubX => {
311         # Not rematerializable (see AddX)
312         emit         => '. subx %S0, %R1I, %D0',
313         constructors => \%binopx_operand_constructors,
314         mode         => $mode_gp,
315 },
316
317 SubCC_t => {
318         ins       => [ "left", "right" ],
319         outs      => [ "res", "flags" ],
320         attr_type => "",
321         dump_func => "NULL",
322 },
323
324 SubX_t => {
325         ins       => [ "left", "right", "flags_input" ],
326         attr_type => "",
327         dump_func => "NULL",
328 },
329
330 # Load / Store
331 Ld => {
332         op_flags  => [ "labeled" ],
333         state     => "exc_pinned",
334         constructors => {
335                 imm => {
336                         reg_req    => { in => [ "gp", "none" ], out => [ "gp", "none" ] },
337                         ins        => [ "ptr", "mem" ],
338                         attr       => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
339                         custominit => "init_sparc_load_store_attributes(res, ls_mode, entity, offset, is_frame_entity, false);",
340                 },
341                 reg => {
342                         reg_req    => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
343                         ins        => [ "ptr", "ptr2", "mem" ],
344                         attr       => "ir_mode *ls_mode",
345                         custominit => "init_sparc_load_store_attributes(res, ls_mode, NULL, 0, false, true);",
346                 },
347         },
348         ins       => [ "ptr", "mem" ],
349         outs      => [ "res", "M" ],
350         attr_type => "sparc_load_store_attr_t",
351         emit      => '. ld%LM [%S0%O1], %D0'
352 },
353
354 SetHi => {
355         irn_flags  => [ "rematerializable" ],
356         outs       => [ "res" ],
357         mode       => $mode_gp,
358         reg_req    => { in => [], out => [ "gp" ] },
359         attr       => "ir_entity *entity, int32_t immediate_value",
360         custominit => "sparc_set_attr_imm(res, entity, immediate_value);",
361         emit       => '. sethi %HIM, %D0'
362 },
363
364 St => {
365         op_flags  => [ "labeled" ],
366         mode      => "mode_M",
367         state     => "exc_pinned",
368         constructors => {
369                 imm => {
370                         reg_req    => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
371                         ins        => [ "val", "ptr", "mem" ],
372                         attr       => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
373                         custominit => "init_sparc_load_store_attributes(res, ls_mode, entity, offset, is_frame_entity, false);",
374                 },
375                 reg => {
376                         reg_req    => { in => [ "gp", "gp", "gp", "none" ], out => [ "none" ] },
377                         ins        => [ "val", "ptr", "ptr2", "mem" ],
378                         attr       => "ir_mode *ls_mode",
379                         custominit => "init_sparc_load_store_attributes(res, ls_mode, NULL, 0, false, true);",
380                 },
381         },
382         ins       => [ "val", "ptr", "mem" ],
383         outs      => [ "M" ],
384         attr_type => "sparc_load_store_attr_t",
385         emit      => '. st%SM %S0, [%S1%O2]'
386 },
387
388 Save => {
389         emit      => '. save %S0, %R1I, %D0',
390         outs      => [ "stack" ],
391         ins       => [ "stack" ],
392         constructors => {
393                 imm => {
394                         attr       => "ir_entity *immediate_entity, int32_t immediate_value",
395                         custominit => "sparc_set_attr_imm(res, immediate_entity, immediate_value);",
396                         reg_req    => { in => [ "sp" ], out => [ "sp:I|S" ] },
397                         ins        => [ "stack" ],
398                 },
399                 reg => {
400                         reg_req    => { in => [ "sp", "gp" ], out => [ "sp:I|S" ] },
401                         ins        => [ "stack", "increment" ],
402                 }
403         },
404         mode => $mode_gp,
405 },
406
407 Restore => {
408         emit => '. restore %S0, %R1I, %D0',
409         outs => [ "stack" ],
410         ins  => [ "stack" ],
411         constructors => {
412                 imm => {
413                         attr       => "ir_entity *immediate_entity, int32_t immediate_value",
414                         custominit => "sparc_set_attr_imm(res, immediate_entity, immediate_value);",
415                         reg_req    => { in => [ "sp" ], out => [ "sp:I|S" ] },
416                         ins        => [ "stack" ],
417                 },
418                 reg => {
419                         reg_req    => { in => [ "sp", "gp" ], out => [ "sp:I|S" ] },
420                         ins        => [ "stack", "increment" ],
421                 }
422         },
423         mode => $mode_gp,
424 },
425
426 RestoreZero => {
427         reg_req => { in => [ "frame_pointer" ], out => [ "sp:I|S" ] },
428         ins     => [ "frame_pointer" ],
429         outs    => [ "stack" ],
430         emit    => '. restore',
431         mode    => $mode_gp,
432 },
433
434 SubSP => {
435         reg_req => { in => [ "sp", "gp" ], out => [ "sp:I|S" ] },
436         ins     => [ "stack", "size" ],
437         outs    => [ "stack" ],
438         emit    => ". sub %S0, %S1, %D0\n",
439         mode    => $mode_gp,
440 },
441
442 AddSP => {
443         reg_req => { in => [ "sp", "gp" ], out => [ "sp:I|S" ] },
444         ins     => [ "stack", "size" ],
445         outs    => [ "stack" ],
446         emit    => ". add %S0, %S1, %D0\n",
447         mode    => $mode_gp,
448 },
449
450 FrameAddr => {
451         op_flags   => [ "constlike" ],
452         irn_flags  => [ "rematerializable" ],
453         attr       => "ir_entity *entity, int32_t offset",
454         reg_req    => { in => [ "gp" ], out => [ "gp" ] },
455         ins        => [ "base" ],
456         attr_type  => "sparc_attr_t",
457         custominit => "sparc_set_attr_imm(res, entity, offset);",
458         mode       => $mode_gp,
459 },
460
461 Bicc => {
462         op_flags  => [ "labeled", "cfopcode", "forking" ],
463         state     => "pinned",
464         mode      => "mode_T",
465         attr_type => "sparc_jmp_cond_attr_t",
466         attr      => "ir_relation relation, bool is_unsigned",
467         init_attr => "\tinit_sparc_jmp_cond_attr(res, relation, is_unsigned);",
468         reg_req   => { in => [ "flags" ], out => [ "none", "none" ] },
469         ins       => [ "flags" ],
470         outs      => [ "false", "true" ],
471 },
472
473 fbfcc => {
474         op_flags  => [ "labeled", "cfopcode", "forking" ],
475         state     => "pinned",
476         mode      => "mode_T",
477         attr_type => "sparc_jmp_cond_attr_t",
478         attr      => "ir_relation relation",
479         init_attr => "\tinit_sparc_jmp_cond_attr(res, relation, false);",
480         reg_req   => { in => [ "fpflags" ], out => [ "none", "none" ] },
481         ins       => [ "flags" ],
482         outs      => [ "false", "true" ],
483 },
484
485 Ba => {
486         state     => "pinned",
487         op_flags  => [ "cfopcode" ],
488         irn_flags => [ "simple_jump" ],
489         reg_req   => { out => [ "none" ] },
490         mode      => "mode_X",
491 },
492
493 Start => {
494         state     => "pinned",
495         out_arity => "variable",
496         ins       => [],
497 },
498
499 # This is a JumpLink instruction, but with the addition that you can add custom
500 # register constraints to model your calling conventions
501 Return => {
502         state     => "pinned",
503         op_flags  => [ "cfopcode" ],
504         arity     => "variable",
505         mode      => "mode_X",
506         constructors => {
507                 imm => {
508                         attr       => "ir_entity *entity, int32_t offset",
509                         custominit => "\tsparc_set_attr_imm(res, entity, offset);",
510                         arity     => "variable",
511                         reg_req   => { out => [ "none" ] },
512                 },
513                 reg => {
514                         arity     => "variable",
515                         reg_req   => { out => [ "none" ] },
516                 }
517         },
518 },
519
520 Call => {
521         irn_flags => [ "modifies_flags", "modifies_fp_flags" ],
522         state     => "exc_pinned",
523         arity     => "variable",
524         out_arity => "variable",
525         constructors => {
526                 imm => {
527                         attr       => "ir_entity *entity, int32_t offset, bool aggregate_return",
528                         custominit => "\tsparc_set_attr_imm(res, entity, offset);".
529                                       "\tif (aggregate_return) arch_add_irn_flags(res, sparc_arch_irn_flag_aggregate_return);",
530                         arity     => "variable",
531                         out_arity => "variable",
532                 },
533                 reg => {
534                         attr       => "bool aggregate_return",
535                         arity      => "variable",
536                         out_arity  => "variable",
537                         custominit => "\tif (aggregate_return) arch_add_irn_flags(res, sparc_arch_irn_flag_aggregate_return);",
538                 }
539         },
540 },
541
542 Cmp => {  # aka SubccZero
543         irn_flags    => [ "rematerializable", "modifies_flags" ],
544         emit         => '. cmp %S0, %R1I',
545         mode         => $mode_flags,
546         constructors => \%binopcczero_operand_constructors,
547 },
548
549 SwitchJmp => {
550         op_flags     => [ "labeled", "cfopcode", "forking" ],
551         state        => "pinned",
552         mode         => "mode_T",
553         reg_req      => { in => [ "gp" ], out => [ ] },
554         attr_type    => "sparc_switch_jmp_attr_t",
555         attr         => "long default_pn, ir_entity *jump_table",
556         init_attr => "info->out_infos = NULL;", # XXX ugly hack for out requirements
557 },
558
559 Sll => {
560         irn_flags    => [ "rematerializable" ],
561         mode         => $mode_gp,
562         emit         => '. sll %S0, %R1I, %D0',
563         constructors => \%binop_operand_constructors,
564 },
565
566 Srl => {
567         irn_flags    => [ "rematerializable" ],
568         mode         => $mode_gp,
569         emit         => '. srl %S0, %R1I, %D0',
570         constructors => \%binop_operand_constructors,
571 },
572
573 Sra => {
574         irn_flags    => [ "rematerializable" ],
575         mode         => $mode_gp,
576         emit         => '. sra %S0, %R1I, %D0',
577         constructors => \%binop_operand_constructors,
578 },
579
580 And => {
581         irn_flags    => [ "rematerializable" ],
582         mode         => $mode_gp,
583         emit         => '. and %S0, %R1I, %D0',
584         constructors => \%binop_operand_constructors,
585 },
586
587 AndCCZero => {
588         irn_flags    => [ "rematerializable", "modifies_flags" ],
589         emit         => '. andcc %S0, %R1I, %%g0',
590         mode         => $mode_flags,
591         constructors => \%binopcczero_operand_constructors,
592 },
593
594 AndN => {
595         irn_flags => [ "rematerializable" ],
596         mode      => $mode_gp,
597         emit      => '. andn %S0, %R1I, %D0',
598         constructors => \%binop_operand_constructors,
599 },
600
601 AndNCCZero => {
602         irn_flags    => [ "rematerializable", "modifies_flags" ],
603         emit         => '. andncc %S0, %R1I, %%g0',
604         mode         => $mode_flags,
605         constructors => \%binopcczero_operand_constructors,
606 },
607
608 Or => {
609         irn_flags    => [ "rematerializable" ],
610         mode         => $mode_gp,
611         emit         => '. or %S0, %R1I, %D0',
612         constructors => \%binop_operand_constructors,
613 },
614
615 OrCCZero => {
616         irn_flags    => [ "rematerializable", "modifies_flags" ],
617         emit         => '. orcc %S0, %R1I, %%g0',
618         mode         => $mode_flags,
619         constructors => \%binopcczero_operand_constructors,
620 },
621
622 OrN => {
623         irn_flags => [ "rematerializable" ],
624         mode      => $mode_gp,
625         emit      => '. orn %S0, %R1I, %D0',
626         constructors => \%binop_operand_constructors,
627 },
628
629 OrNCCZero => {
630         irn_flags    => [ "rematerializable", "modifies_flags" ],
631         emit         => '. orncc %S0, %R1I, %%g0',
632         mode         => $mode_flags,
633         constructors => \%binopcczero_operand_constructors,
634 },
635
636 Xor => {
637         irn_flags    => [ "rematerializable" ],
638         mode         => $mode_gp,
639         emit         => '. xor %S0, %R1I, %D0',
640         constructors => \%binop_operand_constructors,
641 },
642
643 XorCCZero => {
644         irn_flags    => [ "rematerializable", "modifies_flags" ],
645         emit         => '. xorcc %S0, %R1I, %%g0',
646         mode         => $mode_flags,
647         constructors => \%binopcczero_operand_constructors,
648 },
649
650 XNor => {
651         irn_flags => [ "rematerializable" ],
652         mode      => $mode_gp,
653         emit      => '. xnor %S0, %R1I, %D0',
654         constructors => \%binop_operand_constructors,
655 },
656
657 XNorCCZero => {
658         irn_flags    => [ "rematerializable", "modifies_flags" ],
659         emit         => '. xnorcc %S0, %R1I, %%g0',
660         mode         => $mode_flags,
661         constructors => \%binopcczero_operand_constructors,
662 },
663
664 Mul => {
665         irn_flags    => [ "rematerializable" ],
666         mode         => $mode_gp,
667         emit         => '. smul %S0, %R1I, %D0',
668         constructors => \%binop_operand_constructors,
669 },
670
671 SMulh => {
672         irn_flags    => [ "rematerializable" ],
673         outs         => [ "low", "high" ],
674         constructors => \%binop_operand_constructors,
675 },
676
677 UMulh => {
678         irn_flags    => [ "rematerializable" ],
679         outs         => [ "low", "high" ],
680         constructors => \%binop_operand_constructors,
681 },
682
683 SDiv => {
684         irn_flags    => [ "rematerializable" ],
685         state        => "exc_pinned",
686         ins          => [ "dividend_high", "dividend_low", "divisor" ],
687         outs         => [ "res", "M" ],
688         constructors => \%div_operand_constructors,
689 },
690
691 UDiv => {
692         irn_flags    => [ "rematerializable" ],
693         state        => "exc_pinned",
694         ins          => [ "dividend_high", "dividend_low", "divisor" ],
695         outs         => [ "res", "M" ],
696         constructors => \%div_operand_constructors,
697 },
698
699 fcmp => {
700         irn_flags => [ "rematerializable", "modifies_fp_flags" ],
701         emit      => '. fcmp%FPM %S0, %S1',
702         attr_type => "sparc_fp_attr_t",
703         attr      => "ir_mode *fp_mode",
704         mode      => $mode_fpflags,
705         constructors => {
706                 s => {
707                         reg_req => { in => [ "fp", "fp" ], out => [ "fpflags" ] },
708                 },
709                 d => {
710                         reg_req => { in => [ "fp:a|2", "fp:a|2" ], out => [ "fpflags" ] },
711                 },
712                 q => {
713                         reg_req => { in => [ "fp:a|4", "fp:a|4" ], out => [ "fpflags" ] },
714                 },
715         },
716 },
717
718 fadd => {
719         op_flags     => [ "commutative" ],
720         irn_flags    => [ "rematerializable" ],
721         emit         => '. fadd%FPM %S0, %S1, %D0',
722         attr_type    => "sparc_fp_attr_t",
723         attr         => "ir_mode *fp_mode",
724         ins          => [ "left", "right" ],
725         constructors => \%float_binop_constructors,
726 },
727
728 fsub => {
729         irn_flags    => [ "rematerializable" ],
730         emit         => '. fsub%FPM %S0, %S1, %D0',
731         attr_type    => "sparc_fp_attr_t",
732         attr         => "ir_mode *fp_mode",
733         ins          => [ "left", "right" ],
734         constructors => \%float_binop_constructors,
735 },
736
737 fmul => {
738         irn_flags    => [ "rematerializable" ],
739         op_flags     => [ "commutative" ],
740         emit         =>'. fmul%FPM %S0, %S1, %D0',
741         attr_type    => "sparc_fp_attr_t",
742         attr         => "ir_mode *fp_mode",
743         ins          => [ "left", "right" ],
744         constructors => \%float_binop_constructors,
745 },
746
747 fdiv => {
748         irn_flags    => [ "rematerializable" ],
749         emit         => '. fdiv%FPM %S0, %S1, %D0',
750         attr_type    => "sparc_fp_attr_t",
751         attr         => "ir_mode *fp_mode",
752         ins          => [ "left", "right" ],
753         outs         => [ "res", "M" ],
754         constructors => {
755                 s => {
756                         reg_req => { in => [ "fp", "fp" ], out => [ "fp", "none" ] },
757                 },
758                 d => {
759                         reg_req => { in => [ "fp:a|2", "fp:a|2" ], out => [ "fp:a|2", "none" ] },
760                 },
761                 q => {
762                         reg_req => { in => [ "fp:a|4", "fp:a|4" ], out => [ "fp:a|4", "none" ] },
763                 }
764         },
765 },
766
767 fneg => {
768         irn_flags => [ "rematerializable" ],
769         reg_req   => { in => [ "fp" ], out => [ "fp" ] },
770         # note that we only need the first register even for wide-values
771         emit      => '. fnegs %S0, %D0',
772         attr_type => "sparc_fp_attr_t",
773         attr      => "ir_mode *fp_mode",
774         ins          => [ "val" ],
775         constructors => \%float_unop_constructors,
776 },
777
778 "fabs" => {
779         irn_flags    => [ "rematerializable" ],
780         # note that we only need the first register even for wide-values
781         emit         => '. fabs %S0, %D0',
782         attr_type    => "sparc_fp_attr_t",
783         attr         => "ir_mode *fp_mode",
784         ins          => [ "val" ],
785         constructors => \%float_unop_constructors,
786 },
787
788 fftof => {
789         irn_flags => [ "rematerializable" ],
790         emit      => '. f%FCONVS%.to%FCONVD %S0, %D0',
791         attr_type => "sparc_fp_conv_attr_t",
792         attr      => "ir_mode *src_mode, ir_mode *dest_mode",
793         constructors => {
794                 s_d => {
795                         reg_req => { in => [ "fp" ], out => [ "fp:a|2" ] },
796                         mode    => $mode_fp2,
797                 },
798                 s_q => {
799                         reg_req => { in => [ "fp" ], out => [ "fp:a|2" ] },
800                         mode    => $mode_fp4,
801                 },
802                 d_s => {
803                         reg_req => { in => [ "fp:a|2" ], out => [ "fp" ] },
804                         mode    => $mode_fp,
805                 },
806                 d_q => {
807                         reg_req => { in => [ "fp:a|2" ], out => [ "fp:a|4" ] },
808                         mode    => $mode_fp4,
809                 },
810                 q_s => {
811                         reg_req => { in => [ "fp:a|4" ], out => [ "fp" ] },
812                         mode    => $mode_fp,
813                 },
814                 q_d => {
815                         reg_req => { in => [ "fp:a|4" ], out => [ "fp:a|2" ] },
816                         mode    => $mode_fp2,
817                 },
818         },
819 },
820
821 fitof => {
822         irn_flags => [ "rematerializable" ],
823         emit      => '. fito%FPM %S0, %D0',
824         attr_type => "sparc_fp_attr_t",
825         attr      => "ir_mode *fp_mode",
826         constructors => {
827                 s => {
828                         reg_req => { in => [ "fp" ], out => [ "fp" ] },
829                         mode    => $mode_fp,
830                 },
831                 d => {
832                         reg_req => { in => [ "fp" ], out => [ "fp:a|2" ] },
833                         mode    => $mode_fp2,
834                 },
835                 q => {
836                         reg_req => { in => [ "fp" ], out => [ "fp:a|4" ] },
837                         mode    => $mode_fp4,
838                 },
839         },
840 },
841
842 fftoi => {
843         irn_flags => [ "rematerializable" ],
844         emit      => '. f%FPM%.toi %S0, %D0',
845         attr_type => "sparc_fp_attr_t",
846         attr      => "ir_mode *fp_mode",
847         mode      => $mode_gp,
848         constructors => {
849                 s => {
850                         reg_req => { in => [ "fp" ], out => [ "fp" ] },
851                 },
852                 d => {
853                         reg_req => { in => [ "fp:a|2" ], out => [ "fp" ] },
854                 },
855                 q => {
856                         reg_req => { in => [ "fp:a|4" ], out => [ "fp" ] },
857                 },
858         },
859 },
860
861 Ldf => {
862         op_flags  => [ "labeled" ],
863         state     => "exc_pinned",
864         constructors => {
865                 s => {
866                         reg_req => { in => [ "gp", "none" ], out => [ "fp", "none" ] },
867                 },
868                 d => {
869                         reg_req => { in => [ "gp", "none" ], out => [ "fp:a|2", "none" ] },
870                 },
871                 q => {
872                         reg_req => { in => [ "gp", "none" ], out => [ "fp:a|4", "none" ] },
873                 },
874         },
875         ins       => [ "ptr", "mem" ],
876         outs      => [ "res", "M" ],
877         attr_type => "sparc_load_store_attr_t",
878         attr      => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
879         custominit => "init_sparc_load_store_attributes(res, ls_mode, entity, offset, is_frame_entity, false);",
880         emit      => '. ld%FLSM [%S0%O1], %D0'
881 },
882
883 Stf => {
884         op_flags  => [ "labeled" ],
885         state     => "exc_pinned",
886         constructors => {
887                 s => {
888                         reg_req => { in => [ "fp",     "gp", "none" ], out => [ "none" ] },
889                 },
890                 d => {
891                         reg_req => { in => [ "fp:a|2", "gp", "none" ], out => [ "none" ] },
892                 },
893                 q => {
894                         reg_req => { in => [ "fp:a|4", "gp", "none" ], out => [ "none" ] },
895                 },
896         },
897         ins       => [ "val", "ptr", "mem" ],
898         outs      => [ "M" ],
899         attr_type => "sparc_load_store_attr_t",
900         attr      => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
901         custominit => "init_sparc_load_store_attributes(res, ls_mode, entity, offset, is_frame_entity, false);",
902         emit      => '. st%FLSM %S0, [%S1%O2]',
903         mode      => 'mode_M',
904 },
905
906 ); # end of %nodes