changed codegen interface
[libfirm] / ir / be / ia32 / ia32_spec.pl
1 # Creation: 2005/10/19
2 # $Id$
3 # This is the specification for the ia32 assembler Firm-operations
4
5 # the cpu architecture (ia32, ia64, mips, sparc, ppc, ...)
6
7 $arch = "ia32";
8
9 # The node description is done as a perl hash initializer with the
10 # following structure:
11 #
12 # %nodes = (
13 #
14 # <op-name> => {
15 #   "op_flags"  => "N|L|C|X|I|F|Y|H|c|K",
16 #   "irn_flags" => "R|N|I"
17 #   "arity"     => "0|1|2|3 ... |variable|dynamic|all",
18 #   "state"     => "floats|pinned",
19 #   "args"      => [
20 #                    { "type" => "type 1", "name" => "name 1" },
21 #                    { "type" => "type 2", "name" => "name 2" },
22 #                    ...
23 #                  ],
24 #   "comment"   => "any comment for constructor",
25 #   "emit"      => "emit code with templates",
26 #   "rd_constructor" => "c source code which constructs an ir_node"
27 # },
28 #
29 # ... # (all nodes you need to describe)
30 #
31 # ); # close the %nodes initializer
32
33 # op_flags: flags for the operation, OPTIONAL (default is "N")
34 # the op_flags correspond to the firm irop_flags:
35 #   N   irop_flag_none
36 #   L   irop_flag_labeled
37 #   C   irop_flag_commutative
38 #   X   irop_flag_cfopcode
39 #   I   irop_flag_ip_cfopcode
40 #   F   irop_flag_fragile
41 #   Y   irop_flag_forking
42 #   H   irop_flag_highlevel
43 #   c   irop_flag_constlike
44 #   K   irop_flag_keep
45 #
46 # irn_flags: special node flags, OPTIONAL (default is 0)
47 # following irn_flags are supported:
48 #   R   rematerializeable
49 #   N   not spillable
50 #   I   ignore for register allocation
51 #
52 # state: state of the operation, OPTIONAL (default is "pinned")
53 #
54 # arity: arity of the operation, MUST NOT BE OMITTED
55 #
56 # args:  the OPTIONAL arguments of the node constructor (debug, irg and block
57 #        are always the first 3 arguments and are always autmatically
58 #        created)
59 #        If this key is missing the following arguments will be created:
60 #        for i = 1 .. arity: ir_node *op_i
61 #        ir_mode *mode
62 #
63 # comment: OPTIONAL comment for the node constructor
64 #
65 # rd_constructor: for every operation there will be a
66 #      new_rd_<arch>_<op-name> function with the arguments from above
67 #      which creates the ir_node corresponding to the defined operation
68 #      you can either put the complete source code of this function here
69 #
70 #      This key is OPTIONAL. If omitted, the following constructor will
71 #      be created:
72 #      if (!op_<arch>_<op-name>) assert(0);
73 #      for i = 1 to arity
74 #         set in[i] = op_i
75 #      done
76 #      res = new_ir_node(db, irg, block, op_<arch>_<op-name>, mode, arity, in)
77 #      return res
78 #
79 # NOTE: rd_constructor and args are only optional if and only if arity is 0,1,2 or 3
80
81 # register types:
82 #   0 - no special type
83 #   1 - caller save (register must be saved by the caller of a function)
84 #   2 - callee save (register must be saved by the called function)
85 #   4 - ignore (do not assign this register)
86 # NOTE: Make sure to list the registers returning the call-result before all other
87 #       caller save registers and in the correct order, otherwise it will break
88 #       the magic!
89 # Last entry of each class is the largest Firm-Mode a register can hold
90 %reg_classes = (
91   "gp" => [
92             { "name" => "eax", "type" => 1 },
93             { "name" => "edx", "type" => 1 },
94             { "name" => "ebx", "type" => 2 },
95             { "name" => "ecx", "type" => 1 },
96             { "name" => "esi", "type" => 2 },
97             { "name" => "edi", "type" => 2 },
98             { "name" => "ebp", "type" => 2 },
99             { "name" => "esp", "type" => 6 },
100             { "name" => "xxx", "type" => 6 },  # we need a dummy register for NoReg and Unknown nodes
101                         { "mode" => "mode_P" }
102           ],
103   "fp" => [
104             { "name" => "xmm0", "type" => 1 },
105             { "name" => "xmm1", "type" => 1 },
106             { "name" => "xmm2", "type" => 1 },
107             { "name" => "xmm3", "type" => 1 },
108             { "name" => "xmm4", "type" => 1 },
109             { "name" => "xmm5", "type" => 1 },
110             { "name" => "xmm6", "type" => 1 },
111             { "name" => "xmm7", "type" => 1 },
112             { "name" => "xxxx", "type" => 4 },  # we need a dummy register for NoReg and Unknown nodes
113                         { "mode" => "mode_D" }
114           ]
115 ); # %reg_classes
116
117 #--------------------------------------------------#
118 #                        _                         #
119 #                       (_)                        #
120 #  _ __   _____      __  _ _ __    ___  _ __  ___  #
121 # | '_ \ / _ \ \ /\ / / | | '__|  / _ \| '_ \/ __| #
122 # | | | |  __/\ V  V /  | | |    | (_) | |_) \__ \ #
123 # |_| |_|\___| \_/\_/   |_|_|     \___/| .__/|___/ #
124 #                                      | |         #
125 #                                      |_|         #
126 #--------------------------------------------------#
127
128 %nodes = (
129
130 #-----------------------------------------------------------------#
131 #  _       _                                         _            #
132 # (_)     | |                                       | |           #
133 #  _ _ __ | |_ ___  __ _  ___ _ __   _ __   ___   __| | ___  ___  #
134 # | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
135 # | | | | | ||  __/ (_| |  __/ |    | | | | (_) | (_| |  __/\__ \ #
136 # |_|_| |_|\__\___|\__, |\___|_|    |_| |_|\___/ \__,_|\___||___/ #
137 #                   __/ |                                         #
138 #                  |___/                                          #
139 #-----------------------------------------------------------------#
140
141 # commutative operations
142
143 # NOTE:
144 # All nodes supporting Addressmode have 5 INs:
145 # 1 - base    r1 == NoReg in case of no AM or no base
146 # 2 - index   r2 == NoReg in case of no AM or no index
147 # 3 - op1     r3 == always present
148 # 4 - op2     r4 == NoReg in case of immediate operation
149 # 5 - mem     NoMem in case of no AM otherwise it takes the mem from the Load
150
151 "Add" => {
152   "irn_flags" => "R",
153   "comment"   => "construct Add: Add(a, b) = Add(b, a) = a + b",
154   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r1" ] },
155   "emit"      => '. add %ia32_emit_binop\t\t\t/* Add(%A1, %A2) -> %D1 */'
156 },
157
158 "Mul" => {
159   "irn_flags" => "A",
160   "comment"   => "construct Mul: Mul(a, b) = Mul(b, a) = a * b",
161   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r1" ] },
162   "emit"      => '. imul %ia32_emit_binop\t\t\t/* Mul(%A1, %A2) -> %D1 */'
163 },
164
165 # Mulh is an exception from the 4 INs with AM because the target is always EAX:EDX
166 "Mulh" => {
167   "comment"   => "construct Mul: Mul(a, b) = Mul(b, a) = a * b",
168   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "eax in_r1", "edx in_r2" ] },
169   "emit"      => '. imul %ia32_emit_unop\t\t\t/* Mulh(%A1, %A2) -> %D1 */ '
170 },
171
172 "And" => {
173   "irn_flags" => "R",
174   "comment"   => "construct And: And(a, b) = And(b, a) = a AND b",
175   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r1" ] },
176   "emit"      => '. and %ia32_emit_binop\t\t\t/* And(%A1, %A2) -> %D1 */'
177 },
178
179 "Or" => {
180   "irn_flags" => "R",
181   "comment"   => "construct Or: Or(a, b) = Or(b, a) = a OR b",
182   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r1" ] },
183   "emit"      => '. or %ia32_emit_binop\t\t\t/* Or(%A1, %A2) -> %D1 */'
184 },
185
186 "Eor" => {
187   "irn_flags" => "R",
188   "comment"   => "construct Eor: Eor(a, b) = Eor(b, a) = a EOR b",
189   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r1" ] },
190   "emit"      => '. xor %ia32_emit_binop\t\t\t/* Xor(%A1, %A2) -> %D1 */'
191 },
192
193 "Max" => {
194   "irn_flags" => "R",
195   "comment"   => "construct Max: Max(a, b) = Max(b, a) = a > b ? a : b",
196   "reg_req"   => { "in" => [ "gp", "gp" ], "out" => [ "in_r1" ] },
197   "emit"      =>
198 '2. cmp %S1, %S2\t\t\t/* prepare Max (%S1 - %S2), (%A1, %A2) */
199   if (mode_is_signed(get_irn_mode(n))) {
200 4.  cmovl %D1, %S2\t\t\t/* %S1 is less %S2 */
201   }
202   else {
203 4.  cmovb %D1, %S2\t\t\t/* %S1 is below %S2 */
204   }
205 '
206 },
207
208 "Min" => {
209   "irn_flags" => "R",
210   "comment"   => "construct Min: Min(a, b) = Min(b, a) = a < b ? a : b",
211   "reg_req"   => { "in" => [ "gp", "gp" ], "out" => [ "in_r1" ] },
212   "emit"      =>
213 '2. cmp %S1, %S2\t\t\t/* prepare Min (%S1 - %S2), (%A1, %A2) */
214   if (mode_is_signed(get_irn_mode(n))) {
215 2.  cmovg %D1, %S2\t\t\t/* %S1 is greater %S2 */
216   }
217   else {
218 2.  cmova %D1, %S2, %D1\t\t\t/* %S1 is above %S2 */
219   }
220 '
221 },
222
223 # not commutative operations
224
225 "Sub" => {
226   "irn_flags" => "R",
227   "comment"   => "construct Sub: Sub(a, b) = a - b",
228   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r1" ] },
229   "emit"      => '. sub %ia32_emit_binop\t\t\t/* Sub(%A1, %A2) -> %D1 */'
230 },
231
232 "DivMod" => {
233   "op_flags" => "F|L",
234   "state"    => "exc_pinned",
235   "reg_req"  => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "eax in_r1", "edx in_r3" ] },
236   "emit"     =>
237 '  if (mode_is_signed(get_irn_mode(n))) {
238 4.  idiv %S2\t\t\t/* signed DivMod(%S1, %S2) -> %D1, (%A1, %A2, %A3) */
239   }
240   else {
241 4.  div %S2\t\t\t/* unsigned DivMod(%S1, %S2) -> %D1, (%A1, %A2, %A3) */
242   }
243 '
244 },
245
246 "Shl" => {
247   "irn_flags" => "R",
248   "comment"   => "construct Shl: Shl(a, b) = a << b",
249   "reg_req"   => { "in" => [ "gp", "gp", "gp", "ecx", "none" ], "out" => [ "in_r1" ] },
250   "emit"      => '. shl %ia32_emit_binop\t\t\t/* Shl(%A1, %A2) -> %D1 */'
251 },
252
253 "Shr" => {
254   "irn_flags" => "R",
255   "comment"   => "construct Shr: Shr(a, b) = a >> b",
256   "reg_req"   => { "in" => [ "gp", "gp", "gp", "ecx", "none" ], "out" => [ "in_r1" ] },
257   "emit"      => '. shr %ia32_emit_binop\t\t\t/* Shr(%A1, %A2) -> %D1 */'
258 },
259
260 "Shrs" => {
261   "irn_flags" => "R",
262   "comment"   => "construct Shrs: Shrs(a, b) = a >> b",
263   "reg_req"   => { "in" => [ "gp", "gp", "gp", "ecx", "none" ], "out" => [ "in_r1" ] },
264   "emit"      => '. sar %ia32_emit_binop\t\t\t/* Shrs(%A1, %A2) -> %D1 */'
265 },
266
267 "RotR" => {
268   "irn_flags" => "R",
269   "comment"     => "construct RotR: RotR(a, b) = a ROTR b",
270   "reg_req"     => { "in" => [ "gp", "gp", "gp", "ecx", "none" ], "out" => [ "in_r1" ] },
271   "emit"        => '. ror %ia32_emit_binop\t\t\t/* RotR(%A1, %A2) -> %D1 */'
272 },
273
274 "RotL" => {
275   "irn_flags" => "R",
276   "comment"   => "construct RotL: RotL(a, b) = a ROTL b",
277   "reg_req"   => { "in" => [ "gp", "gp", "gp", "ecx", "none" ], "out" => [ "in_r1" ] },
278   "emit"      => '. rol %ia32_emit_binop\t\t\t/* RotL(%A1, %A2) -> %D1 */'
279 },
280
281 # unary operations
282
283 "Minus" => {
284   "irn_flags" => "R",
285   "comment"   => "construct Minus: Minus(a) = -a",
286   "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "in_r1" ] },
287   "emit"      => '. neg %ia32_emit_unop\t\t\t/* Neg(%A1) -> %D1, (%A1) */'
288 },
289
290 "Inc" => {
291   "irn_flags" => "R",
292   "comment"   => "construct Increment: Inc(a) = a++",
293   "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "in_r1" ] },
294   "emit"      => '. inc %ia32_emit_unop\t\t\t/* Inc(%S1) -> %D1, (%A1) */'
295 },
296
297 "Dec" => {
298   "irn_flags" => "R",
299   "comment"   => "construct Decrement: Dec(a) = a--",
300   "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "in_r1" ] },
301   "emit"      => '. dec %ia32_emit_unop\t\t\t/* Dec(%S1) -> %D1, (%A1) */'
302 },
303
304 "Not" => {
305   "irn_flags" => "R",
306   "comment"   => "construct Not: Not(a) = !a",
307   "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "in_r1" ] },
308   "emit"      => '. not %ia32_emit_unop\t\t\t/* Not(%S1) -> %D1, (%A1) */'
309 },
310
311 # other operations
312
313 "Conv" => {
314   "arity"    => 1,
315   "reg_req"  => { "in" => [ "gp" ], "out" => [ "in_r1" ] },
316   "comment"  => "construct Conv: Conv(a) = (conv)a"
317 },
318
319 "CondJmp" => {
320   "op_flags"  => "L|X|Y",
321   "comment"   => "construct conditional jump: CMP A, B && JMPxx LABEL",
322   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "none", "none" ] },
323 },
324
325 "SwitchJmp" => {
326   "op_flags"  => "L|X|Y",
327   "comment"   => "construct switch",
328   "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "none" ] },
329 },
330
331 "Const" => {
332   "op_flags"  => "c",
333   "irn_flags" => "R",
334   "comment"   => "represents an integer constant",
335   "reg_req"   => { "out" => [ "gp" ] },
336   "emit"      => '. mov %D1, %C\t\t\t/* Mov Const into register */',
337   "cmp_attr"  =>
338 '
339   if (attr_a->tp == attr_b->tp) {
340     if (attr_a->tp == ia32_SymConst) {
341       if (attr_a->sc == NULL || attr_b->sc == NULL)
342         return 1;
343       else
344         return strcmp(attr_a->sc, attr_b->sc);
345     }
346     else {
347       if (attr_a->tv == NULL || attr_b->tv == NULL)
348         return 1;
349
350       if (tarval_cmp(attr_a->tv, attr_b->tv) == pn_Cmp_Eq)
351         return 0;
352       else
353         return 1;
354     }
355   }
356   else
357     return 1;
358 '
359 },
360
361 "Cdq" => {
362   "irn_flags" => "R",
363   "comment"   => "construct CDQ: sign extend EAX -> EDX:EAX",
364   "reg_req"   => { "in" => [ "gp" ], "out" => [ "eax in_r1", "edx" ] },
365   "emit"      => '. cdq\t\t\t/* sign extend EAX -> EDX:EAX, (%A1) */'
366 },
367
368 # Load / Store
369
370 "Load" => {
371   "op_flags"  => "L|F",
372   "irn_flags" => "R",
373   "state"     => "exc_pinned",
374   "comment"   => "construct Load: Load(ptr, mem) = LD ptr -> reg",
375   "reg_req"   => { "in" => [ "gp", "gp", "none" ], "out" => [ "gp" ] },
376   "emit"      => '. mov %D1, %ia32_emit_am\t\t\t/* Load((%A1)) -> %D1 */'
377 },
378
379 "Store" => {
380   "op_flags"  => "L|F",
381   "state"     => "exc_pinned",
382   "comment"   => "construct Store: Store(ptr, val, mem) = ST ptr,val",
383   "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ] },
384   "emit"      => '. mov %ia32_emit_am, %S3\t\t\t/* Store(%A2) -> (%A1) */'
385 },
386
387 "Lea" => {
388   "irn_flags" => "R",
389   "comment"   => "construct Lea: Lea(a,b) = lea [a+b*const+offs] | res = a + b * const + offs with const = 0,1,2,4,8",
390   "reg_req"   => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
391   "emit"      => '. lea %D1, %ia32_emit_am\t\t/* %D1 = %S1 + %S2 << %C + %O, (%A1, %A2) */'
392 },
393
394 "StackParam" => {
395   "arity"    => 1,
396   "remat"    => 1,
397   "comment"  => "constructs a Stack Parameter to retrieve a parameter from Stack",
398   "reg_req"  => { "in" => [ "none" ], "out" => [ "gp" ] },
399   "cmp_attr" =>
400 '
401   return (attr_a->pn_code != attr_b->pn_code);
402 '
403 },
404
405 "StackArg" => {
406   "arity"    => 2,
407   "comment"  => "constructs a Stack Argument to pass an argument on Stack",
408   "reg_req"  => { "in" => [ "none", "gp" ], "out" => [ "none" ] },
409   "cmp_attr" =>
410 '
411   return (attr_a->pn_code != attr_b->pn_code);
412 '
413 },
414
415 #--------------------------------------------------------#
416 #    __ _             _                     _            #
417 #   / _| |           | |                   | |           #
418 #  | |_| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
419 #  |  _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
420 #  | | | | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
421 #  |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
422 #--------------------------------------------------------#
423
424 # commutative operations
425
426 "fAdd" => {
427   "irn_flags" => "R",
428   "comment"   => "construct SSE Add: Add(a, b) = Add(b, a) = a + b",
429   "reg_req"   => { "in" => [ "gp", "gp", "fp", "fp", "none" ], "out" => [ "in_r1" ] },
430   "emit"      => '. adds%M %ia32_emit_binop\t\t\t/* SSE Add(%A1, %A2) -> %D1 */'
431 },
432
433 "fMul" => {
434   "irn_flags" => "R",
435   "comment"   => "construct SSE Mul: Mul(a, b) = Mul(b, a) = a * b",
436   "reg_req"   => { "in" => [ "gp", "gp", "fp", "fp", "none" ], "out" => [ "in_r3" ] },
437   "emit"      => '. muls%M %ia32_emit_binop\t\t\t/* SSE Mul(%A1, %A2) -> %D1 */'
438 },
439
440 "fMax" => {
441   "irn_flags" => "R",
442   "comment"   => "construct SSE Max: Max(a, b) = Max(b, a) = a > b ? a : b",
443   "reg_req"   => { "in" => [ "gp", "gp", "fp", "fp", "none" ], "out" => [ "in_r3" ] },
444   "emit"      => '. maxs%M %ia32_emit_binop\t\t\t/* SSE Max(%A1, %A2) -> %D1 */'
445 },
446
447 "fMin" => {
448   "irn_flags" => "R",
449   "comment"   => "construct SSE Min: Min(a, b) = Min(b, a) = a < b ? a : b",
450   "reg_req"   => { "in" => [ "gp", "gp", "fp", "fp", "none" ], "out" => [ "in_r3" ] },
451   "emit"      => '. mins%M %ia32_emit_binop\t\t\t/* SSE Min(%A1, %A2) -> %D1 */'
452 },
453
454 "fAnd" => {
455   "irn_flags" => "R",
456   "comment"   => "construct SSE And: And(a, b) = a AND b",
457   "reg_req"   => { "in" => [ "gp", "gp", "fp", "fp", "none" ], "out" => [ "in_r3" ] },
458   "emit"      => '. andp%M %ia32_emit_binop\t\t\t/* SSE And(%A3, %A4) -> %D1 */'
459 },
460
461 "fOr" => {
462   "irn_flags" => "R",
463   "comment"   => "construct SSE Or: Or(a, b) = a OR b",
464   "reg_req"   => { "in" => [ "gp", "gp", "fp", "fp", "none" ], "out" => [ "in_r3" ] },
465   "emit"      => '. orp%M %ia32_emit_binop\t\t\t/* SSE Or(%A3, %A4) -> %D1 */'
466 },
467
468 "fEor" => {
469   "irn_flags" => "R",
470   "comment"   => "construct SSE Eor: Eor(a, b) = a XOR b",
471   "reg_req"   => { "in" => [ "gp", "gp", "fp", "fp", "none" ], "out" => [ "in_r3" ] },
472   "emit"      => '. xorp%M %ia32_emit_binop\t\t\t/* SSE Xor(%A3, %A4) -> %D1 */'
473 },
474
475 # not commutative operations
476
477 "fSub" => {
478   "irn_flags" => "R",
479   "comment"   => "construct SSE Sub: Sub(a, b) = a - b",
480   "reg_req"   => { "in" => [ "gp", "gp", "fp", "fp", "none" ], "out" => [ "in_r1" ] },
481   "emit"      => '. subs%M %ia32_emit_binop\t\t\t/* SSE Sub(%A1, %A2) -> %D1 */'
482 },
483
484 "fDiv" => {
485   "irn_flags" => "R",
486   "comment"   => "construct SSE Div: Div(a, b) = a / b",
487   "reg_req"   => { "in" => [ "gp", "gp", "fp", "fp", "none" ], "out" => [ "in_r1" ] },
488   "emit"      => '. divs%M %ia32_emit_binop\t\t\t/* SSE Div(%A1, %A2) -> %D1 */'
489 },
490
491 # other operations
492
493 "fConv" => {
494   "arity"    => 1,
495   "reg_req"  => { "in" => [ "fp" ], "out" => [ "gp" ] },
496   "comment"  => "construct Conv: Conv(a) = (conv)a"
497 },
498
499 "fCondJmp" => {
500   "op_flags"  => "L|X|Y",
501   "comment"   => "construct conditional jump: UCOMIS A, B && JMPxx LABEL",
502   "reg_req"   => { "in" => [ "gp", "gp", "fp", "fp", "none" ], "out" => [ "none", "none" ] },
503 },
504
505 "fConst" => {
506   "op_flags"  => "c",
507   "irn_flags" => "R",
508   "comment"   => "represents a SSE constant",
509   "reg_req"   => { "out" => [ "fp" ] },
510   "emit"      => '. mov%M %D1, %C\t\t\t/* Load fConst into register */',
511   "cmp_attr"  =>
512 '
513   if (attr_a->tp == attr_b->tp) {
514     if (attr_a->tp == ia32_SymConst) {
515       if (attr_a->sc == NULL || attr_b->sc == NULL)
516         return 1;
517       else
518         return strcmp(attr_a->sc, attr_b->sc);
519     }
520     else {
521       if (attr_a->tv == NULL || attr_b->tv == NULL)
522         return 1;
523
524       if (tarval_cmp(attr_a->tv, attr_b->tv) == pn_Cmp_Eq)
525         return 0;
526       else
527         return 1;
528     }
529   }
530   else
531     return 1;
532 '
533 },
534
535 # Load / Store
536
537 "fLoad" => {
538   "op_flags"  => "L|F",
539   "irn_flags" => "R",
540   "state"     => "exc_pinned",
541   "comment"   => "construct SSE Load: Load(ptr, mem) = LD ptr",
542   "reg_req"   => { "in" => [ "gp", "gp", "none" ], "out" => [ "fp" ] },
543   "emit"      => '. movs%M %D1, %ia32_emit_am\t\t\t/* Load((%A1)) -> %D1 */'
544 },
545
546 "fStore" => {
547   "op_flags" => "L|F",
548   "state"    => "exc_pinned",
549   "comment"  => "construct Store: Store(ptr, val, mem) = ST ptr,val",
550   "reg_req"  => { "in" => [ "gp", "gp", "fp", "none" ] },
551   "emit"     => '. movs%M %ia32_emit_am, %S3\t\t\t/* Store(%S3) -> (%A1) */'
552 },
553
554 "fStackParam" => {
555   "arity"    => 1,
556   "remat"    => 1,
557   "comment"  => "constructs a Stack Parameter to retrieve a SSE parameter from Stack",
558   "reg_req"  => { "in" => [ "none" ], "out" => [ "fp" ] },
559   "cmp_attr" =>
560 '
561   return (attr_a->pn_code != attr_b->pn_code);
562 '
563 },
564
565 "fStackArg" => {
566   "arity"    => 2,
567   "comment"  => "constructs a Stack Argument to pass an argument on Stack",
568   "reg_req"  => { "in" => [ "none", "fp" ], "out" => [ "none" ] },
569   "cmp_attr" =>
570 '
571   return (attr_a->pn_code != attr_b->pn_code);
572 '
573 },
574
575 # Call
576
577 "Call" => {
578   "op_flags" => "L|F",
579   "state"    => "mem_pinned",
580   "arity"    => "variable",
581   "comment"  => "construct Call: Call(...)",
582   "args"     => [
583                   { "type" => "int",        "name" => "n" },
584                   { "type" => "ir_node **", "name" => "in" }
585                 ],
586   "rd_constructor" =>
587 "  if (!op_ia32_Call) assert(0);
588   return new_ir_node(db, irg, block, op_ia32_Call, mode_T, n, in);
589 "
590 },
591
592 # Return
593
594 "Return" => {
595   "op_flags" => "L|X",
596   "state"    => "pinned",
597   "arity"    => "variable",
598   "comment"  => "construct Return: Return(...)",
599   "args"     => [
600                   { "type" => "int",        "name" => "n" },
601                   { "type" => "ir_node **", "name" => "in" }
602                 ],
603   "rd_constructor" =>
604 "  if (!op_ia32_Return) assert(0);
605   return new_ir_node(db, irg, block, op_ia32_Return, mode_X, n, in);
606 "
607 },
608
609 # M/Alloc
610
611 "Alloca" => {
612   "op_flags" => "L|F",
613   "state"    => "pinned",
614   "arity"    => "2",
615   "comment"  => "construct Alloca: allocate memory on Stack",
616   "reg_req"  => { "in" => [ "gp" ], "out" => [ "gp" ] }
617 },
618
619 ); # end of %nodes