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