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