initaler checkin SPARC backend
[libfirm] / ir / be / sparc / sparc_spec.pl
1 # Creation: 2006/02/13
2 # $Id: TEMPLATE_spec.pl 24066 2008-11-27 14:51:14Z mallon $
3 # This is a template specification for the Firm-Backend
4
5 $new_emit_syntax = 1;
6
7 # the cpu architecture (ia32, ia64, mips, sparc, ppc, ...)
8
9 $arch = "sparc";
10
11 $mode_gp      = "mode_Iu";
12 $mode_flags   = "mode_Bu";
13 $mode_fp      = "mode_D";
14
15 # The node description is done as a perl hash initializer with the
16 # following structure:
17 #
18 # %nodes = (
19 #
20 # <op-name> => {
21 #   op_flags  => "N|L|C|X|I|F|Y|H|c|K",                 # optional
22 #   irn_flags => "R|N|I"                                # optional
23 #   arity     => "0|1|2|3 ... |variable|dynamic|any",   # optional
24 #   state     => "floats|pinned|mem_pinned|exc_pinned", # optional
25 #   args      => [
26 #                    { type => "type 1", name => "name 1" },
27 #                    { type => "type 2", name => "name 2" },
28 #                    ...
29 #                  ],
30 #   comment   => "any comment for constructor",  # optional
31 #   reg_req   => { in => [ "reg_class|register" ], out => [ "reg_class|register|in_rX" ] },
32 #   cmp_attr  => "c source code for comparing node attributes", # optional
33 #   outs      => { "out1", "out2" },# optional, creates pn_op_out1, ... consts
34 #   ins       => { "in1", "in2" },  # optional, creates n_op_in1, ... consts
35 #   mode      => "mode_Iu",         # optional, predefines the mode
36 #   emit      => "emit code with templates",   # optional for virtual nodes
37 #   attr      => "additional attribute arguments for constructor", # optional
38 #   init_attr => "emit attribute initialization template",         # optional
39 #   rd_constructor => "c source code which constructs an ir_node", # optional
40 #   hash_func => "name of the hash function for this operation",   # optional, get the default hash function else
41 #   latency   => "latency of this operation (can be float)"        # optional
42 #   attr_type => "name of the attribute struct",                   # optional
43 # },
44 #
45 # ... # (all nodes you need to describe)
46 #
47 # ); # close the %nodes initializer
48
49 # op_flags: flags for the operation, OPTIONAL (default is "N")
50 # the op_flags correspond to the firm irop_flags:
51 #   N   irop_flag_none
52 #   L   irop_flag_labeled
53 #   C   irop_flag_commutative
54 #   X   irop_flag_cfopcode
55 #   I   irop_flag_ip_cfopcode
56 #   F   irop_flag_fragile
57 #   Y   irop_flag_forking
58 #   H   irop_flag_highlevel
59 #   c   irop_flag_constlike
60 #   K   irop_flag_keep
61 #
62 # irn_flags: special node flags, OPTIONAL (default is 0)
63 # following irn_flags are supported:
64 #   R   rematerializeable
65 #   N   not spillable
66 #   I   ignore for register allocation
67 #
68 # state: state of the operation, OPTIONAL (default is "floats")
69 #
70 # arity: arity of the operation, MUST NOT BE OMITTED
71 #
72 # args:  the OPTIONAL arguments of the node constructor (debug, irg and block
73 #        are always the first 3 arguments and are always autmatically
74 #        created)
75 #        If this key is missing the following arguments will be created:
76 #        for i = 1 .. arity: ir_node *op_i
77 #        ir_mode *mode
78 #
79 # outs:  if a node defines more than one output, the names of the projections
80 #        nodes having outs having automatically the mode mode_T
81 #
82 # comment: OPTIONAL comment for the node constructor
83 #
84 # rd_constructor: for every operation there will be a
85 #      new_rd_<arch>_<op-name> function with the arguments from above
86 #      which creates the ir_node corresponding to the defined operation
87 #      you can either put the complete source code of this function here
88 #
89 #      This key is OPTIONAL. If omitted, the following constructor will
90 #      be created:
91 #      if (!op_<arch>_<op-name>) assert(0);
92 #      for i = 1 to arity
93 #         set in[i] = op_i
94 #      done
95 #      res = new_ir_node(db, irg, block, op_<arch>_<op-name>, mode, arity, in)
96 #      return res
97 #
98 # NOTE: rd_constructor and args are only optional if and only if arity is 0,1,2 or 3
99
100 # register types:
101 #   0 - no special type
102 #   1 - caller save (register must be saved by the caller of a function)
103 #   2 - callee save (register must be saved by the called function)
104 #   4 - ignore (do not assign this register)
105 # NOTE: Last entry of each class is the largest Firm-Mode a register can hold
106
107 # available SPARC registers: 8 globals, 24 window regs (8 ins, 8 outs, 8 locals)
108 %reg_classes = (
109         gp => [
110                 { name => "g0", realname => "r0", type => 4 }, # hardwired 0, behaves like /dev/null
111                 { name => "g1", realname => "r1", type => 1 }, # temp. value
112                 { name => "g2", realname => "r2", type => 1 },
113                 { name => "g3", realname => "r3", type => 1 },
114                 { name => "g4", realname => "r4", type => 1 },
115                 { name => "g5", realname => "r5", type => 1 }, # reserved by SPARC ABI
116                 { name => "g6", realname => "r6", type => 1 }, # reserved by SPARC ABI
117                 { name => "g7", realname => "r7", type => 2 }, # reserved by SPARC ABI
118
119                 # window's out registers
120                 { name => "o0", realname => "r8", type => 1 }, # param 1 / return value from callee
121                 { name => "o1", realname => "r9", type => 1 }, # param 2
122                 { name => "o2", realname => "r10", type => 1 }, # param 3
123                 { name => "o3", realname => "r11", type => 1 }, # param 4
124                 { name => "o4", realname => "r12", type => 1 }, # param 5
125                 { name => "o5", realname => "r13", type => 1 }, # param 6
126                 { name => "sp", realname => "r14", type => 4 }, # our stackpointer
127                 { name => "o7", realname => "r15", type => 1 }, # temp. value / address of CALL instr.
128
129                 # window's local registers
130                 { name => "l0", realname => "r16", type => 2 },
131                 { name => "l1", realname => "r17", type => 2 },
132                 { name => "l2", realname => "r18", type => 2 },
133                 { name => "l3", realname => "r19", type => 2 },
134                 { name => "l4", realname => "r20", type => 2 },
135                 { name => "l5", realname => "r21", type => 2 },
136                 { name => "l6", realname => "r22", type => 2 },
137                 { name => "l7", realname => "r23", type => 2 },
138
139                 # window's in registers
140                 { name => "i0", realname => "r24", type => 2 }, # incoming param1 / return value to caller
141                 { name => "i1", realname => "r25", type => 2 }, # param 2
142                 { name => "i2", realname => "r26", type => 2 }, # param 3
143                 { name => "i3", realname => "r27", type => 2 }, # param 4
144                 { name => "i4", realname => "r28", type => 2 }, # param 5
145                 { name => "i5", realname => "r29", type => 2 }, # param 6
146                 { name => "fp", realname => "r30", type => 4 }, # our framepointer
147                 { name => "i7", realname => "r31", type => 2 }, # return address - 8
148                 { mode => $mode_gp }
149         ],
150         flags => [
151                 { name => "y", realname => "y", type => 4 },  # the multiply/divide state register
152                 { mode => $mode_flags, flags => "manual_ra" }
153         ],
154 #       cpu => [
155 #               { name => "psr", realname => "psr", type => 4 },  # the processor state register
156 #               { name => "wim", realname => "wim", type => 4 },  # the window invalid mask register
157 #               { name => "tbr", realname => "tbr", type => 4 },  # the trap base register
158 #               { name => "pc", realname => "pc", type => 4 },  # the program counter register
159 #               { name => "npc", realname => "npc", type => 4 },  # the next instruction addr. (PC + 1) register
160 #               { mode => "mode_Iu", flags => "manual_ra" }
161 #       ],
162
163         # fp registers can be accessed any time
164         fp  => [
165                 { name => "f0", type => 1 },
166                 { name => "f1", type => 1 },
167                 { name => "f2", type => 1 },
168                 { name => "f3", type => 1 },
169                 { name => "f4", type => 1 },
170                 { name => "f5", type => 1 },
171                 { name => "f6", type => 1 },
172                 { name => "f7", type => 1 },
173                 { name => "f8", type => 1 },
174                 { name => "f9", type => 1 },
175                 { name => "f10", type => 1 },
176                 { name => "f11", type => 1 },
177                 { name => "f12", type => 1 },
178                 { name => "f13", type => 1 },
179                 { name => "f14", type => 1 },
180                 { name => "f15", type => 1 },
181                 { name => "f16", type => 1 },
182                 { name => "f17", type => 1 },
183                 { name => "f18", type => 1 },
184                 { name => "f19", type => 1 },
185                 { name => "f20", type => 1 },
186                 { name => "f21", type => 1 },
187                 { name => "f22", type => 1 },
188                 { name => "f23", type => 1 },
189                 { name => "f24", type => 1 },
190                 { name => "f25", type => 1 },
191                 { name => "f26", type => 1 },
192                 { name => "f27", type => 1 },
193                 { name => "f28", type => 1 },
194                 { name => "f29", type => 1 },
195                 { name => "f30", type => 1 },
196                 { name => "f31", type => 1 },
197                 { mode => $mode_fp }
198         ]
199 ); # %reg_classes
200
201 %emit_templates = (
202 # emit source reg or imm dep. on node's arity
203     RI => "${arch}_emit_reg_or_imm(node, -1);",
204     R1I => "${arch}_emit_reg_or_imm(node, 0);",
205     R2I => "${arch}_emit_reg_or_imm(node, 1);",
206     R3I => "${arch}_emit_reg_or_imm(node, 2);",
207 # simple reg emitters
208     S1 => "${arch}_emit_source_register(node, 0);",
209     S2 => "${arch}_emit_source_register(node, 1);",
210     S3 => "${arch}_emit_source_register(node, 2);",
211     S4 => "${arch}_emit_source_register(node, 3);",
212     S5 => "${arch}_emit_source_register(node, 4);",
213     S6 => "${arch}_emit_source_register(node, 5);",
214     D1 => "${arch}_emit_dest_register(node, 0);",
215     D2 => "${arch}_emit_dest_register(node, 1);",
216     D3 => "${arch}_emit_dest_register(node, 2);",
217     D4 => "${arch}_emit_dest_register(node, 3);",
218     D5 => "${arch}_emit_dest_register(node, 4);",
219     D6 => "${arch}_emit_dest_register(node, 5);",
220 # more custom emitters
221         C  => "${arch}_emit_immediate(node);",
222         LM  => "${arch}_emit_load_mode(node);",
223         SM  => "${arch}_emit_store_mode(node);",
224         O  => "${arch}_emit_offset(node);",
225 );
226
227 #--------------------------------------------------#
228 #                        _                         #
229 #                       (_)                        #
230 #  _ __   _____      __  _ _ __    ___  _ __  ___  #
231 # | '_ \ / _ \ \ /\ / / | | '__|  / _ \| '_ \/ __| #
232 # | | | |  __/\ V  V /  | | |    | (_) | |_) \__ \ #
233 # |_| |_|\___| \_/\_/   |_|_|     \___/| .__/|___/ #
234 #                                      | |         #
235 #                                      |_|         #
236 #--------------------------------------------------#
237
238 $default_attr_type = "sparc_attr_t";
239 $default_copy_attr = "sparc_copy_attr";
240
241
242 %init_attr = (
243                     sparc_attr_t                                => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);",
244                     sparc_load_store_attr_t         => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);\n".
245                                                                                         "\tinit_sparc_load_store_attributes(res, ls_mode, entity, entity_sign, offset, is_frame_entity);",
246                     sparc_symconst_attr_t                       => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);\n".
247                                                                                                 "\tinit_sparc_symconst_attributes(res, entity);",
248                         sparc_cmp_attr_t                                => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);\n",
249                         sparc_jmp_cond_attr_t                   => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);",
250                         sparc_jmp_switch_attr_t                 => "\tinit_sparc_attributes(res, flags, in_reqs, exec_units, n_res);",
251
252 );
253
254 %compare_attr = (
255                     sparc_attr_t            => "cmp_attr_sparc",
256                     sparc_load_store_attr_t => "cmp_attr_sparc_load_store",
257                     sparc_symconst_attr_t   => "cmp_attr_sparc_symconst",
258                     sparc_jmp_cond_attr_t       => "cmp_attr_sparc_jmp_cond",
259                     sparc_jmp_switch_attr_t     => "cmp_attr_sparc_jmp_switch",
260                     sparc_cmp_attr_t            => "cmp_attr_sparc_cmp",
261 );
262
263
264 # addressing modes: imm, reg, reg +/- imm, reg + reg
265 # max. imm = 13 bits signed (-4096 ... 4096)
266
267
268 my %cmp_operand_constructors = (
269     imm => {
270         attr       => "int immediate_value, bool ins_permuted, bool is_unsigned",
271         custominit => "sparc_set_attr_imm(res, immediate_value);" .
272                                                 "\tinit_sparc_cmp_attr(res, ins_permuted, is_unsigned);",
273         reg_req    => { in => [ "gp" ], out => [ "flags" ] },
274                 ins        => [ "left" ],
275     },
276     reg => {
277                 attr       => "bool ins_permuted, bool is_unsigned",
278         custominit => "init_sparc_cmp_attr(res, ins_permuted, is_unsigned);",
279         reg_req    => { in => [ "gp", "gp" ], out => [ "flags" ] },
280         ins        => [ "left", "right" ],
281     },
282 );
283
284 my %unop_operand_constructors = (
285     imm => {
286         attr       => "int immediate_value",
287         custominit => "sparc_set_attr_imm(res, immediate_value);",
288         reg_req    => { in => [], out => [ "gp" ] },
289     },
290     reg => {
291                 # custominit => "set_sparc_attr_values(res, immediate_value);",
292         reg_req    => { in => [ "gp" ], out => [ "gp" ] },
293     },
294 );
295
296 my %binop_operand_constructors = (
297     imm => {
298         attr       => "int immediate_value",
299         custominit => "sparc_set_attr_imm(res, immediate_value);",
300         reg_req    => { in => [ "gp" ], out => [ "gp" ] },
301         ins        => [ "left" ],
302     },
303     reg => {
304                 # custominit => "set_sparc_attr_values(res, immediate_value);",
305         reg_req    => { in => [ "gp", "gp" ], out => [ "gp" ] },
306         ins        => [ "left", "right" ],
307     },
308 );
309
310 %nodes = (
311
312 #-----------------------------------------------------------------#
313 #  _       _                                         _            #
314 # (_)     | |                                       | |           #
315 #  _ _ __ | |_ ___  __ _  ___ _ __   _ __   ___   __| | ___  ___  #
316 # | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
317 # | | | | | ||  __/ (_| |  __/ |    | | | | (_) | (_| |  __/\__ \ #
318 # |_|_| |_|\__\___|\__, |\___|_|    |_| |_|\___/ \__,_|\___||___/ #
319 #                   __/ |                                         #
320 #                  |___/                                          #
321 #-----------------------------------------------------------------#
322
323 # commutative operations
324
325 Add => {
326   op_flags  => "C",
327   irn_flags => "R",
328   comment   => "construct Add: Add(a, b) = Add(b, a) = a + b",
329   mode          => $mode_gp,
330   emit      => '. add %S1, %R2I, %D1',
331   constructors => \%binop_operand_constructors,
332 },
333
334 Sub => {
335   irn_flags => "R",
336   comment   => "construct Sub: Sub(a, b) = a - b",
337   mode          => $mode_gp,
338   reg_req   => { in => [ "gp", "gp" ], out => [ "gp" ] },
339   emit      => '. sub %S1, %R2I, %D1',
340   constructors => \%binop_operand_constructors,
341 },
342
343
344 # Load / Store
345 Load => {
346   op_flags  => "L|F",
347   comment   => "construct Load: Load(ptr, mem) = LD ptr -> reg",
348   state     => "exc_pinned",
349   ins       => [ "ptr", "mem" ],
350   outs      => [ "res", "M" ],
351   reg_req   => { in => [ "gp", "none" ], out => [ "gp", "none" ] },
352   attr_type => "sparc_load_store_attr_t",
353   attr      => "ir_mode *ls_mode, ir_entity *entity, int entity_sign, long offset, bool is_frame_entity",
354   emit      => '. ld%LM [%S1%O], %D1'
355 },
356
357 Store => {
358   op_flags  => "L|F",
359   comment   => "construct Store: Store(ptr, val, mem) = ST ptr,val",
360   mode          => "mode_M",
361   state     => "exc_pinned",
362   ins       => [ "ptr", "val", "mem" ],
363   outs      => [ "mem" ],
364   reg_req   => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
365   attr_type => "sparc_load_store_attr_t",
366   attr      => "ir_mode *ls_mode, ir_entity *entity, int entity_sign, long offset, bool is_frame_entity",
367   emit      => '. st%SM %S1, [%D1%O]'
368 },
369
370 Mov => {
371   irn_flags => "R",
372   comment   => "construct Mov: Mov(src, dest) = MV src,dest",
373   arity     => "variable",
374   emit      => '. mov %R1I, %D1',
375   mode      => $mode_gp,
376   constructors => \%unop_operand_constructors,
377 },
378
379 AddSP => {
380         comment => "alloc stack space",
381         reg_req   => { in => [ "sp", "gp", "none" ], out => [ "sp:I|S", "gp", "none" ] },
382         ins       => [ "stack", "size", "mem" ],
383         outs      => [ "stack", "addr", "M" ],
384         emit      => ". sub %S1, %S2, %D1\n",
385 },
386
387 SubSP => {
388         comment => "free stack space",
389         reg_req   => { in => [ "sp", "gp", "none" ], out => [ "sp:I|S", "none" ] },
390         ins       => [ "stack", "size", "mem" ],
391         outs      => [ "stack", "M" ],
392         emit      => ". add %S1, %S2, %D1\n",
393 },
394
395 SymConst => {
396         op_flags  => "c",
397         irn_flags => "R",
398         attr      => "ir_entity *entity",
399         reg_req   => { out => [ "gp" ] },
400         attr_type => "sparc_symconst_attr_t",
401         mode      => $mode_gp,
402 },
403
404 FrameAddr => {
405         op_flags  => "c",
406         irn_flags => "R",
407         attr      => "ir_entity *entity",
408         reg_req   => { in => [ "gp" ], out => [ "gp" ] },
409         ins       => [ "base" ],
410         attr_type => "sparc_symconst_attr_t",
411         mode      => $mode_gp,
412 },
413
414 Branch => {
415         op_flags  => "L|X|Y",
416         state     => "pinned",
417         mode      => "mode_T",
418         reg_req   => { in => [ "flags" ], out => [ "none", "none" ] },
419         attr      => "int proj_num",
420         attr_type => "sparc_jmp_cond_attr_t",
421         init_attr => "\tset_sparc_jmp_cond_proj_num(res, proj_num);",
422 },
423
424 Cmp => {
425         irn_flags    => "R|F",
426         emit         => '. cmp %S1, %R2I',
427         mode         => $mode_flags,
428         attr_type    => "sparc_cmp_attr_t",
429         constructors => \%cmp_operand_constructors,
430 },
431
432 Tst => {
433         irn_flags    => "R|F",
434         emit         => '. tst %S1',
435         mode         => $mode_flags,
436         attr_type    => "sparc_cmp_attr_t",
437         attr         => "bool ins_permuted, bool is_unsigned",
438         custominit   => "init_sparc_cmp_attr(res, ins_permuted, is_unsigned);",
439         reg_req      => { in => [ "gp" ], out => [ "flags" ] },
440         ins          => [ "left" ],
441 },
442
443 SwitchJmp => {
444         op_flags  => "L|X|Y",
445         state     => "pinned",
446         mode      => "mode_T",
447         attr      => "int n_projs, long def_proj_num",
448         init_attr => "\tset_sparc_jmp_switch_n_projs(res, n_projs);\n".
449                                         "\tset_sparc_jmp_switch_default_proj_num(res, def_proj_num);",
450         reg_req   => { in => [ "gp" ], out => [ "none" ] },
451         attr_type => "sparc_jmp_switch_attr_t",
452 },
453 #Mul => {
454 #  op_flags  => "C",
455 #  irn_flags => "R",
456 #  comment   => "construct Mul: Mul(a, b) = Mul(b, a) = a * b",
457 #  reg_req   => { in => [ "gp", "gp" ], out => [ "gp" ] },
458 #  emit      =>'. mul %S1, %S2, %D1'
459 #},
460
461 #Mul_i => {
462 #  irn_flags => "R",
463 #  comment   => "construct Mul: Mul(a, const) = Mul(const, a) = a * const",
464 #  reg_req   => { in => [ "gp" ], out => [ "gp" ] },
465 #  emit      => '. mul %S1, %C, %D1'
466 #},
467 #
468 #And => {
469 #  op_flags  => "C",
470 #  irn_flags => "R",
471 #  comment   => "construct And: And(a, b) = And(b, a) = a AND b",
472 #  reg_req   => { in => [ "gp", "gp" ], out => [ "gp" ] },
473 #  emit      => '. and %S1, %S2, %D1'
474 #},
475 #
476 #And_i => {
477 #  irn_flags => "R",
478 #  comment   => "construct And: And(a, const) = And(const, a) = a AND const",
479 #  reg_req   => { in => [ "gp" ], out => [ "gp" ] },
480 #  emit      => '. and %S1, %C, %D1'
481 #},
482 #
483 #Or => {
484 #  op_flags  => "C",
485 #  irn_flags => "R",
486 #  comment   => "construct Or: Or(a, b) = Or(b, a) = a OR b",
487 #  reg_req   => { in => [ "gp", "gp" ], out => [ "gp" ] },
488 #  emit      => '. or %S1, %S2, %D1'
489 #},
490 #
491 #Or_i => {
492 #  op_flags  => "C",
493 #  irn_flags => "R",
494 #  comment   => "construct Or: Or(a, const) = Or(const, a) = a OR const",
495 #  reg_req   => { in => [ "gp" ], out => [ "gp" ] },
496 #  emit      => '. or %S1, %C, %D1'
497 #},
498 #
499 #Eor => {
500 #  op_flags  => "C",
501 #  irn_flags => "R",
502 #  comment   => "construct Eor: Eor(a, b) = Eor(b, a) = a EOR b",
503 #  reg_req   => { in => [ "gp", "gp" ], out => [ "gp" ] },
504 #  emit      => '. xor %S1, %S2, %D1'
505 #},
506 #
507 #Eor_i => {
508 #  irn_flags => "R",
509 #  comment   => "construct Eor: Eor(a, const) = Eor(const, a) = a EOR const",
510 #  reg_req   => { in => [ "gp" ], out => [ "gp" ] },
511 #  emit      => '. xor %S1, %C, %D1'
512 #},
513
514 # not commutative operations
515 #Shl => {
516 #  irn_flags => "R",
517 #  comment   => "construct Shl: Shl(a, b) = a << b",
518 #  reg_req   => { in => [ "gp", "gp" ], out => [ "gp" ] },
519 #  emit      => '. shl %S1, %S2, %D1'
520 #},
521 #
522 #Shl_i => {
523 #  irn_flags => "R",
524 #  comment   => "construct Shl: Shl(a, const) = a << const",
525 #  reg_req   => { in => [ "gp" ], out => [ "gp" ] },
526 #  emit      => '. shl %S1, %C, %D1'
527 #},
528 #
529 #Shr => {
530 #  irn_flags => "R",
531 #  comment   => "construct Shr: Shr(a, b) = a >> b",
532 #  reg_req   => { in => [ "gp", "gp" ], out => [ "in_r1" ] },
533 #  emit      => '. shr %S2, %D1'
534 #},
535 #
536 #Shr_i => {
537 #  irn_flags => "R",
538 #  comment   => "construct Shr: Shr(a, const) = a >> const",
539 #  reg_req   => { in => [ "gp" ], out => [ "gp" ] },
540 #  emit      => '. shr %S1, %C, %D1'
541 #},
542 #
543 #RotR => {
544 #  irn_flags => "R",
545 #  comment   => "construct RotR: RotR(a, b) = a ROTR b",
546 #  reg_req   => { in => [ "gp", "gp" ], out => [ "gp" ] },
547 #  emit      => '. ror %S1, %S2, %D1'
548 #},
549 #
550 #RotL => {
551 #  irn_flags => "R",
552 #  comment   => "construct RotL: RotL(a, b) = a ROTL b",
553 #  reg_req   => { in => [ "gp", "gp" ], out => [ "gp" ] },
554 #  emit      => '. rol %S1, %S2, %D1'
555 #},
556 #
557 #RotL_i => {
558 #  irn_flags => "R",
559 #  comment   => "construct RotL: RotL(a, const) = a ROTL const",
560 #  reg_req   => { in => [ "gp" ], out => [ "gp" ] },
561 #  emit      => '. rol %S1, %C, %D1'
562 #},
563 #
564 #Minus => {
565 #  irn_flags => "R",
566 #  comment   => "construct Minus: Minus(a) = -a",
567 #  reg_req   => { in => [ "gp" ], out => [ "gp" ] },
568 #  emit      => '. neg %S1, %D1'
569 #},
570 #
571 #Inc => {
572 #  irn_flags => "R",
573 #  comment   => "construct Increment: Inc(a) = a++",
574 #  reg_req   => { in => [ "gp" ], out => [ "gp" ] },
575 #  emit      => '. inc %S1, %D1'
576 #},
577 #
578 #Dec => {
579 #  irn_flags => "R",
580 #  comment   => "construct Decrement: Dec(a) = a--",
581 #  reg_req   => { in => [ "gp" ], out => [ "gp" ] },
582 #  emit      => '. dec %S1, %D1'
583 #},
584 #
585 #Not => {
586 #  arity       => 1,
587 #  remat       => 1,
588 #  comment     => "construct Not: Not(a) = !a",
589 #  reg_req     => { in => [ "gp" ], out => [ "gp" ] },
590 #  emit        => '. not %S1, %D1'
591 #},
592
593
594 #--------------------------------------------------------#
595 #    __ _             _                     _            #
596 #   / _| |           | |                   | |           #
597 #  | |_| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
598 #  |  _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
599 #  | | | | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
600 #  |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
601 #--------------------------------------------------------#
602
603 # commutative operations
604
605 #fAdd => {
606 #  op_flags  => "C",
607 #  irn_flags => "R",
608 #  comment   => "construct FP Add: Add(a, b) = Add(b, a) = a + b",
609 #  reg_req   => { in => [ "fp", "fp" ], out => [ "fp" ] },
610 #  emit      => '. fadd %S1, %S2, %D1'
611 #},
612 #
613 #fMul => {
614 #  op_flags  => "C",
615 #  comment   => "construct FP Mul: Mul(a, b) = Mul(b, a) = a * b",
616 #  reg_req   => { in => [ "fp", "fp" ], out => [ "fp" ] },
617 #  emit      =>'. fmul %S1, %S2, %D1'
618 #},
619 #
620 #fMax => {
621 #  op_flags  => "C",
622 #  irn_flags => "R",
623 #  comment   => "construct FP Max: Max(a, b) = Max(b, a) = a > b ? a : b",
624 #  reg_req   => { in => [ "fp", "fp" ], out => [ "fp" ] },
625 #  emit      =>'. fmax %S1, %S2, %D1'
626 #},
627 #
628 #fMin => {
629 #  op_flags  => "C",
630 #  irn_flags => "R",
631 #  comment   => "construct FP Min: Min(a, b) = Min(b, a) = a < b ? a : b",
632 #  reg_req   => { in => [ "fp", "fp" ], out => [ "fp" ] },
633 #  emit      =>'. fmin %S1, %S2, %D1'
634 #},
635 #
636 ## not commutative operations
637 #
638 #fSub => {
639 #  irn_flags => "R",
640 #  comment   => "construct FP Sub: Sub(a, b) = a - b",
641 #  reg_req   => { in => [ "fp", "fp" ], out => [ "fp" ] },
642 #  emit      => '. fsub %S1, %S2, %D1'
643 #},
644 #
645 #fDiv => {
646 #  comment   => "construct FP Div: Div(a, b) = a / b",
647 #  reg_req   => { in => [ "fp", "fp" ], out => [ "fp" ] },
648 #  emit      => '. fdiv %S1, %S2, %D1'
649 #},
650 #
651 #fMinus => {
652 #  irn_flags => "R",
653 #  comment   => "construct FP Minus: Minus(a) = -a",
654 #  reg_req   => { in => [ "fp" ], out => [ "fp" ] },
655 #  emit      => '. fneg %S1, %D1'
656 #},
657 #
658 ## other operations
659 #
660 #fConst => {
661 #  op_flags  => "c",
662 #  irn_flags => "R",
663 #  comment   => "represents a FP constant",
664 #  reg_req   => { out => [ "fp" ] },
665 #  emit      => '. fmov %C, %D1',
666 #  cmp_attr  =>
667 #'
668 #       /* TODO: compare fConst attributes */
669 #       return 1;
670 #'
671 #},
672 #
673 ## Load / Store
674 #
675 #fLoad => {
676 #  op_flags  => "L|F",
677 #  irn_flags => "R",
678 #  state     => "exc_pinned",
679 #  comment   => "construct FP Load: Load(ptr, mem) = LD ptr",
680 #  reg_req   => { in => [ "gp", "none" ], out => [ "fp" ] },
681 #  emit      => '. fmov (%S1), %D1'
682 #},
683 #
684 #fStore => {
685 #  op_flags  => "L|F",
686 #  irn_flags => "R",
687 #  state     => "exc_pinned",
688 #  comment   => "construct Store: Store(ptr, val, mem) = ST ptr,val",
689 #  reg_req   => { in => [ "gp", "fp", "none" ] },
690 #  emit      => '. fmov %S2, (%S1)'
691 #},
692
693 ); # end of %nodes