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