libFirm
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
gen_TEMPLATE_new_nodes.c
1 #include "gen_TEMPLATE_new_nodes.h"
2 
3 #include "benode.h"
4 #include "TEMPLATE_bearch_t.h"
5 #include "gen_TEMPLATE_regalloc_if.h"
6 #include "TEMPLATE_new_nodes_t.h"
7 #include "fourcc.h"
8 #include "irgopt.h"
9 #include "ircons_t.h"
10 
11 ir_op *op_TEMPLATE_Add = NULL;
12 ir_op *op_TEMPLATE_And = NULL;
13 ir_op *op_TEMPLATE_Const = NULL;
14 ir_op *op_TEMPLATE_Jmp = NULL;
15 ir_op *op_TEMPLATE_Load = NULL;
16 ir_op *op_TEMPLATE_Minus = NULL;
17 ir_op *op_TEMPLATE_Mul = NULL;
18 ir_op *op_TEMPLATE_Not = NULL;
19 ir_op *op_TEMPLATE_Or = NULL;
20 ir_op *op_TEMPLATE_Return = NULL;
21 ir_op *op_TEMPLATE_Shl = NULL;
22 ir_op *op_TEMPLATE_Shr = NULL;
23 ir_op *op_TEMPLATE_Store = NULL;
24 ir_op *op_TEMPLATE_Sub = NULL;
25 ir_op *op_TEMPLATE_Xor = NULL;
26 ir_op *op_TEMPLATE_fAdd = NULL;
27 ir_op *op_TEMPLATE_fConst = NULL;
28 ir_op *op_TEMPLATE_fDiv = NULL;
29 ir_op *op_TEMPLATE_fLoad = NULL;
30 ir_op *op_TEMPLATE_fMinus = NULL;
31 ir_op *op_TEMPLATE_fMul = NULL;
32 ir_op *op_TEMPLATE_fStore = NULL;
33 ir_op *op_TEMPLATE_fSub = NULL;
34 
35 
36 static int TEMPLATE_opcode_start = -1;
37 
39 #define TEMPLATE_op_tag FOURCC('T', 'E', 'M', 'P')
40 
42 int is_TEMPLATE_op(const ir_op *op)
43 {
44  return get_op_tag(op) == TEMPLATE_op_tag;
45 }
46 
48 int is_TEMPLATE_irn(const ir_node *node)
49 {
50  return is_TEMPLATE_op(get_irn_op(node));
51 }
52 
53 int get_TEMPLATE_irn_opcode(const ir_node *node)
54 {
55  assert(is_TEMPLATE_irn(node));
56  return get_irn_opcode(node) - TEMPLATE_opcode_start;
57 }
58 
59 #undef BIT
60 #define BIT(x) (1 << (x))
61 
62 
63 
64 
65 ir_node *new_bd_TEMPLATE_Add(dbg_info *dbgi, ir_node *block, ir_node *op0, ir_node *op1)
66 {
67  static arch_register_req_t const *in_reqs[] = {
68  &TEMPLATE_class_reg_req_gp,
69  &TEMPLATE_class_reg_req_gp,
70  };
71 
72  /* construct in array */
73  ir_node *const in[] = {
74  op0,
75  op1,
76  };
77 
78  ir_graph *const irg = get_irn_irg(block);
79  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_Add, mode_Iu, 2, in);
80 
81  /* init node attributes */
82 
83  /* flags */
84  arch_irn_flags_t irn_flags = arch_irn_flags_none;
85  irn_flags |= arch_irn_flag_rematerializable;
86  int const n_res = 1;
87  be_info_init_irn(res, irn_flags, in_reqs, n_res);
88  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
89  (void)attr; /* avoid potential warning */
90  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
91  out_infos[0].req = &TEMPLATE_class_reg_req_gp;
92 
93  verify_new_node(res);
94  return optimize_node(res);
95 }
96 
97 ir_node *new_bd_TEMPLATE_And(dbg_info *dbgi, ir_node *block, ir_node *op0, ir_node *op1)
98 {
99  static arch_register_req_t const *in_reqs[] = {
100  &TEMPLATE_class_reg_req_gp,
101  &TEMPLATE_class_reg_req_gp,
102  };
103 
104  /* construct in array */
105  ir_node *const in[] = {
106  op0,
107  op1,
108  };
109 
110  ir_graph *const irg = get_irn_irg(block);
111  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_And, mode_Iu, 2, in);
112 
113  /* init node attributes */
114 
115  /* flags */
116  arch_irn_flags_t irn_flags = arch_irn_flags_none;
117  irn_flags |= arch_irn_flag_rematerializable;
118  int const n_res = 1;
119  be_info_init_irn(res, irn_flags, in_reqs, n_res);
120  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
121  (void)attr; /* avoid potential warning */
122  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
123  out_infos[0].req = &TEMPLATE_class_reg_req_gp;
124 
125  verify_new_node(res);
126  return optimize_node(res);
127 }
128 
129 ir_node *new_bd_TEMPLATE_Const(dbg_info *dbgi, ir_node *block, ir_entity *entity, ir_tarval *value)
130 {
131  arch_register_req_t const **const in_reqs = NULL;
132 
133 
134  ir_graph *const irg = get_irn_irg(block);
135  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_Const, mode_Iu, 0, NULL);
136 
137  /* init node attributes */
138 
139  /* flags */
140  arch_irn_flags_t irn_flags = arch_irn_flags_none;
141  irn_flags |= arch_irn_flag_rematerializable;
142  int const n_res = 1;
143  be_info_init_irn(res, irn_flags, in_reqs, n_res);
144  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
145  (void)attr; /* avoid potential warning */
146  set_TEMPLATE_value(res, entity, value);
147  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
148  out_infos[0].req = &TEMPLATE_class_reg_req_gp;
149 
150  verify_new_node(res);
151  return optimize_node(res);
152 }
153 
154 ir_node *new_bd_TEMPLATE_Jmp(dbg_info *dbgi, ir_node *block)
155 {
156  arch_register_req_t const **const in_reqs = NULL;
157 
158 
159  ir_graph *const irg = get_irn_irg(block);
160  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_Jmp, mode_X, 0, NULL);
161 
162  /* init node attributes */
163 
164  /* flags */
165  arch_irn_flags_t irn_flags = arch_irn_flags_none;
166  irn_flags |= arch_irn_flag_simple_jump;
167  irn_flags |= arch_irn_flag_fallthrough;
168  int const n_res = 1;
169  be_info_init_irn(res, irn_flags, in_reqs, n_res);
170  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
171  (void)attr; /* avoid potential warning */
172  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
173  out_infos[0].req = &arch_exec_requirement;
174 
175  verify_new_node(res);
176  return optimize_node(res);
177 }
178 
179 ir_node *new_bd_TEMPLATE_Load(dbg_info *dbgi, ir_node *block, ir_node *mem, ir_node *ptr)
180 {
181  static arch_register_req_t const *in_reqs[] = {
182  &arch_memory_requirement,
183  &TEMPLATE_class_reg_req_gp,
184  };
185 
186  /* construct in array */
187  ir_node *const in[] = {
188  mem,
189  ptr,
190  };
191 
192  ir_graph *const irg = get_irn_irg(block);
193  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_Load, mode_T, 2, in);
194 
195  /* init node attributes */
196 
197  /* flags */
198  arch_irn_flags_t irn_flags = arch_irn_flags_none;
199  irn_flags |= arch_irn_flag_rematerializable;
200  int const n_res = 2;
201  be_info_init_irn(res, irn_flags, in_reqs, n_res);
202  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
203  (void)attr; /* avoid potential warning */
204  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
205  out_infos[0].req = &TEMPLATE_class_reg_req_gp;
206  out_infos[1].req = &arch_memory_requirement;
207 
208  verify_new_node(res);
209  return optimize_node(res);
210 }
211 
212 ir_node *new_bd_TEMPLATE_Minus(dbg_info *dbgi, ir_node *block, ir_node *op0)
213 {
214  static arch_register_req_t const *in_reqs[] = {
215  &TEMPLATE_class_reg_req_gp,
216  };
217 
218  /* construct in array */
219  ir_node *const in[] = {
220  op0,
221  };
222 
223  ir_graph *const irg = get_irn_irg(block);
224  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_Minus, mode_Iu, 1, in);
225 
226  /* init node attributes */
227 
228  /* flags */
229  arch_irn_flags_t irn_flags = arch_irn_flags_none;
230  irn_flags |= arch_irn_flag_rematerializable;
231  int const n_res = 1;
232  be_info_init_irn(res, irn_flags, in_reqs, n_res);
233  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
234  (void)attr; /* avoid potential warning */
235  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
236  out_infos[0].req = &TEMPLATE_class_reg_req_gp;
237 
238  verify_new_node(res);
239  return optimize_node(res);
240 }
241 
242 ir_node *new_bd_TEMPLATE_Mul(dbg_info *dbgi, ir_node *block, ir_node *op0, ir_node *op1)
243 {
244  static arch_register_req_t const *in_reqs[] = {
245  &TEMPLATE_class_reg_req_gp,
246  &TEMPLATE_class_reg_req_gp,
247  };
248 
249  /* construct in array */
250  ir_node *const in[] = {
251  op0,
252  op1,
253  };
254 
255  ir_graph *const irg = get_irn_irg(block);
256  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_Mul, mode_Iu, 2, in);
257 
258  /* init node attributes */
259 
260  /* flags */
261  arch_irn_flags_t irn_flags = arch_irn_flags_none;
262  irn_flags |= arch_irn_flag_rematerializable;
263  int const n_res = 1;
264  be_info_init_irn(res, irn_flags, in_reqs, n_res);
265  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
266  (void)attr; /* avoid potential warning */
267  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
268  out_infos[0].req = &TEMPLATE_class_reg_req_gp;
269 
270  verify_new_node(res);
271  return optimize_node(res);
272 }
273 
274 ir_node *new_bd_TEMPLATE_Not(dbg_info *dbgi, ir_node *block, ir_node *op0)
275 {
276  static arch_register_req_t const *in_reqs[] = {
277  &TEMPLATE_class_reg_req_gp,
278  };
279 
280  /* construct in array */
281  ir_node *const in[] = {
282  op0,
283  };
284 
285  ir_graph *const irg = get_irn_irg(block);
286  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_Not, mode_Iu, 1, in);
287 
288  /* init node attributes */
289 
290  /* flags */
291  arch_irn_flags_t irn_flags = arch_irn_flags_none;
292  irn_flags |= arch_irn_flag_rematerializable;
293  int const n_res = 1;
294  be_info_init_irn(res, irn_flags, in_reqs, n_res);
295  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
296  (void)attr; /* avoid potential warning */
297  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
298  out_infos[0].req = &TEMPLATE_class_reg_req_gp;
299 
300  verify_new_node(res);
301  return optimize_node(res);
302 }
303 
304 ir_node *new_bd_TEMPLATE_Or(dbg_info *dbgi, ir_node *block, ir_node *op0, ir_node *op1)
305 {
306  static arch_register_req_t const *in_reqs[] = {
307  &TEMPLATE_class_reg_req_gp,
308  &TEMPLATE_class_reg_req_gp,
309  };
310 
311  /* construct in array */
312  ir_node *const in[] = {
313  op0,
314  op1,
315  };
316 
317  ir_graph *const irg = get_irn_irg(block);
318  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_Or, mode_Iu, 2, in);
319 
320  /* init node attributes */
321 
322  /* flags */
323  arch_irn_flags_t irn_flags = arch_irn_flags_none;
324  irn_flags |= arch_irn_flag_rematerializable;
325  int const n_res = 1;
326  be_info_init_irn(res, irn_flags, in_reqs, n_res);
327  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
328  (void)attr; /* avoid potential warning */
329  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
330  out_infos[0].req = &TEMPLATE_class_reg_req_gp;
331 
332  verify_new_node(res);
333  return optimize_node(res);
334 }
335 
336 ir_node *new_bd_TEMPLATE_Return(dbg_info *dbgi, ir_node *block, int const arity, ir_node *const *const in, arch_register_req_t const **const in_reqs)
337 {
338 
339 
340  ir_graph *const irg = get_irn_irg(block);
341  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_Return, mode_X, arity, in);
342 
343  /* init node attributes */
344 
345  /* flags */
346  arch_irn_flags_t irn_flags = arch_irn_flags_none;
347  int const n_res = 1;
348  be_info_init_irn(res, irn_flags, in_reqs, n_res);
349  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
350  (void)attr; /* avoid potential warning */
351  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
352  out_infos[0].req = &arch_exec_requirement;
353 
354  verify_new_node(res);
355  return optimize_node(res);
356 }
357 
358 ir_node *new_bd_TEMPLATE_Shl(dbg_info *dbgi, ir_node *block, ir_node *op0, ir_node *op1)
359 {
360  static arch_register_req_t const *in_reqs[] = {
361  &TEMPLATE_class_reg_req_gp,
362  &TEMPLATE_class_reg_req_gp,
363  };
364 
365  /* construct in array */
366  ir_node *const in[] = {
367  op0,
368  op1,
369  };
370 
371  ir_graph *const irg = get_irn_irg(block);
372  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_Shl, mode_Iu, 2, in);
373 
374  /* init node attributes */
375 
376  /* flags */
377  arch_irn_flags_t irn_flags = arch_irn_flags_none;
378  irn_flags |= arch_irn_flag_rematerializable;
379  int const n_res = 1;
380  be_info_init_irn(res, irn_flags, in_reqs, n_res);
381  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
382  (void)attr; /* avoid potential warning */
383  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
384  out_infos[0].req = &TEMPLATE_class_reg_req_gp;
385 
386  verify_new_node(res);
387  return optimize_node(res);
388 }
389 
390 ir_node *new_bd_TEMPLATE_Shr(dbg_info *dbgi, ir_node *block, ir_node *op0, ir_node *op1)
391 {
392  static arch_register_req_t const *in_reqs[] = {
393  &TEMPLATE_class_reg_req_gp,
394  &TEMPLATE_class_reg_req_gp,
395  };
396 
397  /* construct in array */
398  ir_node *const in[] = {
399  op0,
400  op1,
401  };
402 
403  ir_graph *const irg = get_irn_irg(block);
404  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_Shr, mode_Iu, 2, in);
405 
406  /* init node attributes */
407 
408  /* flags */
409  arch_irn_flags_t irn_flags = arch_irn_flags_none;
410  irn_flags |= arch_irn_flag_rematerializable;
411  int const n_res = 1;
412  be_info_init_irn(res, irn_flags, in_reqs, n_res);
413  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
414  (void)attr; /* avoid potential warning */
415  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
416  out_infos[0].req = &TEMPLATE_class_reg_req_gp;
417 
418  verify_new_node(res);
419  return optimize_node(res);
420 }
421 
422 ir_node *new_bd_TEMPLATE_Store(dbg_info *dbgi, ir_node *block, ir_node *mem, ir_node *ptr, ir_node *val)
423 {
424  static arch_register_req_t const *in_reqs[] = {
425  &arch_memory_requirement,
426  &TEMPLATE_class_reg_req_gp,
427  &TEMPLATE_class_reg_req_gp,
428  };
429 
430  /* construct in array */
431  ir_node *const in[] = {
432  mem,
433  ptr,
434  val,
435  };
436 
437  ir_graph *const irg = get_irn_irg(block);
438  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_Store, mode_M, 3, in);
439 
440  /* init node attributes */
441 
442  /* flags */
443  arch_irn_flags_t irn_flags = arch_irn_flags_none;
444  irn_flags |= arch_irn_flag_rematerializable;
445  int const n_res = 1;
446  be_info_init_irn(res, irn_flags, in_reqs, n_res);
447  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
448  (void)attr; /* avoid potential warning */
449  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
450  out_infos[0].req = &arch_memory_requirement;
451 
452  verify_new_node(res);
453  return optimize_node(res);
454 }
455 
456 ir_node *new_bd_TEMPLATE_Sub(dbg_info *dbgi, ir_node *block, ir_node *op0, ir_node *op1)
457 {
458  static arch_register_req_t const *in_reqs[] = {
459  &TEMPLATE_class_reg_req_gp,
460  &TEMPLATE_class_reg_req_gp,
461  };
462 
463  /* construct in array */
464  ir_node *const in[] = {
465  op0,
466  op1,
467  };
468 
469  ir_graph *const irg = get_irn_irg(block);
470  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_Sub, mode_Iu, 2, in);
471 
472  /* init node attributes */
473 
474  /* flags */
475  arch_irn_flags_t irn_flags = arch_irn_flags_none;
476  irn_flags |= arch_irn_flag_rematerializable;
477  int const n_res = 1;
478  be_info_init_irn(res, irn_flags, in_reqs, n_res);
479  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
480  (void)attr; /* avoid potential warning */
481  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
482  out_infos[0].req = &TEMPLATE_class_reg_req_gp;
483 
484  verify_new_node(res);
485  return optimize_node(res);
486 }
487 
488 ir_node *new_bd_TEMPLATE_Xor(dbg_info *dbgi, ir_node *block, ir_node *op0, ir_node *op1)
489 {
490  static arch_register_req_t const *in_reqs[] = {
491  &TEMPLATE_class_reg_req_gp,
492  &TEMPLATE_class_reg_req_gp,
493  };
494 
495  /* construct in array */
496  ir_node *const in[] = {
497  op0,
498  op1,
499  };
500 
501  ir_graph *const irg = get_irn_irg(block);
502  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_Xor, mode_Iu, 2, in);
503 
504  /* init node attributes */
505 
506  /* flags */
507  arch_irn_flags_t irn_flags = arch_irn_flags_none;
508  irn_flags |= arch_irn_flag_rematerializable;
509  int const n_res = 1;
510  be_info_init_irn(res, irn_flags, in_reqs, n_res);
511  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
512  (void)attr; /* avoid potential warning */
513  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
514  out_infos[0].req = &TEMPLATE_class_reg_req_gp;
515 
516  verify_new_node(res);
517  return optimize_node(res);
518 }
519 
520 ir_node *new_bd_TEMPLATE_fAdd(dbg_info *dbgi, ir_node *block, ir_node *op0, ir_node *op1)
521 {
522  static arch_register_req_t const *in_reqs[] = {
523  &TEMPLATE_class_reg_req_fp,
524  &TEMPLATE_class_reg_req_fp,
525  };
526 
527  /* construct in array */
528  ir_node *const in[] = {
529  op0,
530  op1,
531  };
532 
533  ir_graph *const irg = get_irn_irg(block);
534  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_fAdd, mode_F, 2, in);
535 
536  /* init node attributes */
537 
538  /* flags */
539  arch_irn_flags_t irn_flags = arch_irn_flags_none;
540  irn_flags |= arch_irn_flag_rematerializable;
541  int const n_res = 1;
542  be_info_init_irn(res, irn_flags, in_reqs, n_res);
543  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
544  (void)attr; /* avoid potential warning */
545  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
546  out_infos[0].req = &TEMPLATE_class_reg_req_fp;
547 
548  verify_new_node(res);
549  return optimize_node(res);
550 }
551 
552 ir_node *new_bd_TEMPLATE_fConst(dbg_info *dbgi, ir_node *block)
553 {
554  arch_register_req_t const **const in_reqs = NULL;
555 
556 
557  ir_graph *const irg = get_irn_irg(block);
558  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_fConst, mode_F, 0, NULL);
559 
560  /* init node attributes */
561 
562  /* flags */
563  arch_irn_flags_t irn_flags = arch_irn_flags_none;
564  irn_flags |= arch_irn_flag_rematerializable;
565  int const n_res = 1;
566  be_info_init_irn(res, irn_flags, in_reqs, n_res);
567  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
568  (void)attr; /* avoid potential warning */
569  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
570  out_infos[0].req = &TEMPLATE_class_reg_req_fp;
571 
572  verify_new_node(res);
573  return optimize_node(res);
574 }
575 
576 ir_node *new_bd_TEMPLATE_fDiv(dbg_info *dbgi, ir_node *block, ir_node *op0, ir_node *op1)
577 {
578  static arch_register_req_t const *in_reqs[] = {
579  &TEMPLATE_class_reg_req_fp,
580  &TEMPLATE_class_reg_req_fp,
581  };
582 
583  /* construct in array */
584  ir_node *const in[] = {
585  op0,
586  op1,
587  };
588 
589  ir_graph *const irg = get_irn_irg(block);
590  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_fDiv, mode_F, 2, in);
591 
592  /* init node attributes */
593 
594  /* flags */
595  arch_irn_flags_t irn_flags = arch_irn_flags_none;
596  int const n_res = 1;
597  be_info_init_irn(res, irn_flags, in_reqs, n_res);
598  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
599  (void)attr; /* avoid potential warning */
600  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
601  out_infos[0].req = &TEMPLATE_class_reg_req_fp;
602 
603  verify_new_node(res);
604  return optimize_node(res);
605 }
606 
607 ir_node *new_bd_TEMPLATE_fLoad(dbg_info *dbgi, ir_node *block, ir_node *mem, ir_node *ptr)
608 {
609  static arch_register_req_t const *in_reqs[] = {
610  &arch_memory_requirement,
611  &TEMPLATE_class_reg_req_gp,
612  };
613 
614  /* construct in array */
615  ir_node *const in[] = {
616  mem,
617  ptr,
618  };
619 
620  ir_graph *const irg = get_irn_irg(block);
621  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_fLoad, mode_T, 2, in);
622 
623  /* init node attributes */
624 
625  /* flags */
626  arch_irn_flags_t irn_flags = arch_irn_flags_none;
627  irn_flags |= arch_irn_flag_rematerializable;
628  int const n_res = 2;
629  be_info_init_irn(res, irn_flags, in_reqs, n_res);
630  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
631  (void)attr; /* avoid potential warning */
632  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
633  out_infos[0].req = &TEMPLATE_class_reg_req_fp;
634  out_infos[1].req = &arch_memory_requirement;
635 
636  verify_new_node(res);
637  return optimize_node(res);
638 }
639 
640 ir_node *new_bd_TEMPLATE_fMinus(dbg_info *dbgi, ir_node *block, ir_node *op0)
641 {
642  static arch_register_req_t const *in_reqs[] = {
643  &TEMPLATE_class_reg_req_fp,
644  };
645 
646  /* construct in array */
647  ir_node *const in[] = {
648  op0,
649  };
650 
651  ir_graph *const irg = get_irn_irg(block);
652  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_fMinus, mode_F, 1, in);
653 
654  /* init node attributes */
655 
656  /* flags */
657  arch_irn_flags_t irn_flags = arch_irn_flags_none;
658  irn_flags |= arch_irn_flag_rematerializable;
659  int const n_res = 1;
660  be_info_init_irn(res, irn_flags, in_reqs, n_res);
661  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
662  (void)attr; /* avoid potential warning */
663  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
664  out_infos[0].req = &TEMPLATE_class_reg_req_fp;
665 
666  verify_new_node(res);
667  return optimize_node(res);
668 }
669 
670 ir_node *new_bd_TEMPLATE_fMul(dbg_info *dbgi, ir_node *block, ir_node *op0, ir_node *op1)
671 {
672  static arch_register_req_t const *in_reqs[] = {
673  &TEMPLATE_class_reg_req_fp,
674  &TEMPLATE_class_reg_req_fp,
675  };
676 
677  /* construct in array */
678  ir_node *const in[] = {
679  op0,
680  op1,
681  };
682 
683  ir_graph *const irg = get_irn_irg(block);
684  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_fMul, mode_F, 2, in);
685 
686  /* init node attributes */
687 
688  /* flags */
689  arch_irn_flags_t irn_flags = arch_irn_flags_none;
690  int const n_res = 1;
691  be_info_init_irn(res, irn_flags, in_reqs, n_res);
692  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
693  (void)attr; /* avoid potential warning */
694  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
695  out_infos[0].req = &TEMPLATE_class_reg_req_fp;
696 
697  verify_new_node(res);
698  return optimize_node(res);
699 }
700 
701 ir_node *new_bd_TEMPLATE_fStore(dbg_info *dbgi, ir_node *block, ir_node *mem, ir_node *ptr, ir_node *val)
702 {
703  static arch_register_req_t const *in_reqs[] = {
704  &arch_memory_requirement,
705  &TEMPLATE_class_reg_req_gp,
706  &TEMPLATE_class_reg_req_fp,
707  };
708 
709  /* construct in array */
710  ir_node *const in[] = {
711  mem,
712  ptr,
713  val,
714  };
715 
716  ir_graph *const irg = get_irn_irg(block);
717  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_fStore, mode_M, 3, in);
718 
719  /* init node attributes */
720 
721  /* flags */
722  arch_irn_flags_t irn_flags = arch_irn_flags_none;
723  irn_flags |= arch_irn_flag_rematerializable;
724  int const n_res = 1;
725  be_info_init_irn(res, irn_flags, in_reqs, n_res);
726  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
727  (void)attr; /* avoid potential warning */
728  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
729  out_infos[0].req = &arch_memory_requirement;
730 
731  verify_new_node(res);
732  return optimize_node(res);
733 }
734 
735 ir_node *new_bd_TEMPLATE_fSub(dbg_info *dbgi, ir_node *block, ir_node *op0, ir_node *op1)
736 {
737  static arch_register_req_t const *in_reqs[] = {
738  &TEMPLATE_class_reg_req_fp,
739  &TEMPLATE_class_reg_req_fp,
740  };
741 
742  /* construct in array */
743  ir_node *const in[] = {
744  op0,
745  op1,
746  };
747 
748  ir_graph *const irg = get_irn_irg(block);
749  ir_node *const res = new_ir_node(dbgi, irg, block, op_TEMPLATE_fSub, mode_F, 2, in);
750 
751  /* init node attributes */
752 
753  /* flags */
754  arch_irn_flags_t irn_flags = arch_irn_flags_none;
755  irn_flags |= arch_irn_flag_rematerializable;
756  int const n_res = 1;
757  be_info_init_irn(res, irn_flags, in_reqs, n_res);
758  TEMPLATE_attr_t *const attr = (TEMPLATE_attr_t*)get_irn_generic_attr(res);
759  (void)attr; /* avoid potential warning */
760  reg_out_info_t *const out_infos = be_get_info(res)->out_infos;
761  out_infos[0].req = &TEMPLATE_class_reg_req_fp;
762 
763  verify_new_node(res);
764  return optimize_node(res);
765 }
766 
767 
772 void TEMPLATE_create_opcodes(void)
773 {
774  ir_op *op;
775  int cur_opcode = get_next_ir_opcodes(iro_TEMPLATE_last);
776 
777  TEMPLATE_opcode_start = cur_opcode;
778  op = new_ir_op(cur_opcode + iro_TEMPLATE_Add, "TEMPLATE_Add", op_pin_state_floats, irop_flag_none, oparity_any, -1, sizeof(TEMPLATE_attr_t));
779  set_op_dump(op, TEMPLATE_dump_node);
780  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
781  set_op_copy_attr(op, be_copy_attr);
782  set_op_tag(op, TEMPLATE_op_tag);
783  op_TEMPLATE_Add = op;
784  op = new_ir_op(cur_opcode + iro_TEMPLATE_And, "TEMPLATE_And", op_pin_state_floats, irop_flag_none, oparity_any, -1, sizeof(TEMPLATE_attr_t));
785  set_op_dump(op, TEMPLATE_dump_node);
786  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
787  set_op_copy_attr(op, be_copy_attr);
788  set_op_tag(op, TEMPLATE_op_tag);
789  op_TEMPLATE_And = op;
790  op = new_ir_op(cur_opcode + iro_TEMPLATE_Const, "TEMPLATE_Const", op_pin_state_floats, irop_flag_constlike, oparity_any, -1, sizeof(TEMPLATE_attr_t));
791  set_op_dump(op, TEMPLATE_dump_node);
792  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
793  set_op_copy_attr(op, be_copy_attr);
794  set_op_tag(op, TEMPLATE_op_tag);
795  op_TEMPLATE_Const = op;
796  op = new_ir_op(cur_opcode + iro_TEMPLATE_Jmp, "TEMPLATE_Jmp", op_pin_state_pinned, irop_flag_cfopcode, oparity_any, -1, sizeof(TEMPLATE_attr_t));
797  set_op_dump(op, TEMPLATE_dump_node);
798  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
799  set_op_copy_attr(op, be_copy_attr);
800  set_op_tag(op, TEMPLATE_op_tag);
801  op_TEMPLATE_Jmp = op;
802  op = new_ir_op(cur_opcode + iro_TEMPLATE_Load, "TEMPLATE_Load", op_pin_state_exc_pinned, irop_flag_uses_memory, oparity_any, -1, sizeof(TEMPLATE_attr_t));
803  ir_op_set_memory_index(op, 0); set_op_dump(op, TEMPLATE_dump_node);
804  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
805  set_op_copy_attr(op, be_copy_attr);
806  set_op_tag(op, TEMPLATE_op_tag);
807  op_TEMPLATE_Load = op;
808  op = new_ir_op(cur_opcode + iro_TEMPLATE_Minus, "TEMPLATE_Minus", op_pin_state_floats, irop_flag_none, oparity_any, -1, sizeof(TEMPLATE_attr_t));
809  set_op_dump(op, TEMPLATE_dump_node);
810  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
811  set_op_copy_attr(op, be_copy_attr);
812  set_op_tag(op, TEMPLATE_op_tag);
813  op_TEMPLATE_Minus = op;
814  op = new_ir_op(cur_opcode + iro_TEMPLATE_Mul, "TEMPLATE_Mul", op_pin_state_floats, irop_flag_none, oparity_any, -1, sizeof(TEMPLATE_attr_t));
815  set_op_dump(op, TEMPLATE_dump_node);
816  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
817  set_op_copy_attr(op, be_copy_attr);
818  set_op_tag(op, TEMPLATE_op_tag);
819  op_TEMPLATE_Mul = op;
820  op = new_ir_op(cur_opcode + iro_TEMPLATE_Not, "TEMPLATE_Not", op_pin_state_floats, irop_flag_none, oparity_any, -1, sizeof(TEMPLATE_attr_t));
821  set_op_dump(op, TEMPLATE_dump_node);
822  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
823  set_op_copy_attr(op, be_copy_attr);
824  set_op_tag(op, TEMPLATE_op_tag);
825  op_TEMPLATE_Not = op;
826  op = new_ir_op(cur_opcode + iro_TEMPLATE_Or, "TEMPLATE_Or", op_pin_state_floats, irop_flag_none, oparity_any, -1, sizeof(TEMPLATE_attr_t));
827  set_op_dump(op, TEMPLATE_dump_node);
828  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
829  set_op_copy_attr(op, be_copy_attr);
830  set_op_tag(op, TEMPLATE_op_tag);
831  op_TEMPLATE_Or = op;
832  op = new_ir_op(cur_opcode + iro_TEMPLATE_Return, "TEMPLATE_Return", op_pin_state_pinned, irop_flag_cfopcode, oparity_any, -1, sizeof(TEMPLATE_attr_t));
833  set_op_dump(op, TEMPLATE_dump_node);
834  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
835  set_op_copy_attr(op, be_copy_attr);
836  set_op_tag(op, TEMPLATE_op_tag);
837  op_TEMPLATE_Return = op;
838  op = new_ir_op(cur_opcode + iro_TEMPLATE_Shl, "TEMPLATE_Shl", op_pin_state_floats, irop_flag_none, oparity_any, -1, sizeof(TEMPLATE_attr_t));
839  set_op_dump(op, TEMPLATE_dump_node);
840  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
841  set_op_copy_attr(op, be_copy_attr);
842  set_op_tag(op, TEMPLATE_op_tag);
843  op_TEMPLATE_Shl = op;
844  op = new_ir_op(cur_opcode + iro_TEMPLATE_Shr, "TEMPLATE_Shr", op_pin_state_floats, irop_flag_none, oparity_any, -1, sizeof(TEMPLATE_attr_t));
845  set_op_dump(op, TEMPLATE_dump_node);
846  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
847  set_op_copy_attr(op, be_copy_attr);
848  set_op_tag(op, TEMPLATE_op_tag);
849  op_TEMPLATE_Shr = op;
850  op = new_ir_op(cur_opcode + iro_TEMPLATE_Store, "TEMPLATE_Store", op_pin_state_exc_pinned, irop_flag_uses_memory, oparity_any, -1, sizeof(TEMPLATE_attr_t));
851  ir_op_set_memory_index(op, 0); set_op_dump(op, TEMPLATE_dump_node);
852  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
853  set_op_copy_attr(op, be_copy_attr);
854  set_op_tag(op, TEMPLATE_op_tag);
855  op_TEMPLATE_Store = op;
856  op = new_ir_op(cur_opcode + iro_TEMPLATE_Sub, "TEMPLATE_Sub", op_pin_state_floats, irop_flag_none, oparity_any, -1, sizeof(TEMPLATE_attr_t));
857  set_op_dump(op, TEMPLATE_dump_node);
858  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
859  set_op_copy_attr(op, be_copy_attr);
860  set_op_tag(op, TEMPLATE_op_tag);
861  op_TEMPLATE_Sub = op;
862  op = new_ir_op(cur_opcode + iro_TEMPLATE_Xor, "TEMPLATE_Xor", op_pin_state_floats, irop_flag_none, oparity_any, -1, sizeof(TEMPLATE_attr_t));
863  set_op_dump(op, TEMPLATE_dump_node);
864  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
865  set_op_copy_attr(op, be_copy_attr);
866  set_op_tag(op, TEMPLATE_op_tag);
867  op_TEMPLATE_Xor = op;
868  op = new_ir_op(cur_opcode + iro_TEMPLATE_fAdd, "TEMPLATE_fAdd", op_pin_state_floats, irop_flag_none, oparity_any, -1, sizeof(TEMPLATE_attr_t));
869  set_op_dump(op, TEMPLATE_dump_node);
870  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
871  set_op_copy_attr(op, be_copy_attr);
872  set_op_tag(op, TEMPLATE_op_tag);
873  op_TEMPLATE_fAdd = op;
874  op = new_ir_op(cur_opcode + iro_TEMPLATE_fConst, "TEMPLATE_fConst", op_pin_state_floats, irop_flag_constlike, oparity_any, -1, sizeof(TEMPLATE_attr_t));
875  set_op_dump(op, TEMPLATE_dump_node);
876  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
877  set_op_copy_attr(op, be_copy_attr);
878  set_op_tag(op, TEMPLATE_op_tag);
879  op_TEMPLATE_fConst = op;
880  op = new_ir_op(cur_opcode + iro_TEMPLATE_fDiv, "TEMPLATE_fDiv", op_pin_state_floats, irop_flag_none, oparity_any, -1, sizeof(TEMPLATE_attr_t));
881  set_op_dump(op, TEMPLATE_dump_node);
882  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
883  set_op_copy_attr(op, be_copy_attr);
884  set_op_tag(op, TEMPLATE_op_tag);
885  op_TEMPLATE_fDiv = op;
886  op = new_ir_op(cur_opcode + iro_TEMPLATE_fLoad, "TEMPLATE_fLoad", op_pin_state_exc_pinned, irop_flag_uses_memory, oparity_any, -1, sizeof(TEMPLATE_attr_t));
887  ir_op_set_memory_index(op, 0); set_op_dump(op, TEMPLATE_dump_node);
888  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
889  set_op_copy_attr(op, be_copy_attr);
890  set_op_tag(op, TEMPLATE_op_tag);
891  op_TEMPLATE_fLoad = op;
892  op = new_ir_op(cur_opcode + iro_TEMPLATE_fMinus, "TEMPLATE_fMinus", op_pin_state_floats, irop_flag_none, oparity_any, -1, sizeof(TEMPLATE_attr_t));
893  set_op_dump(op, TEMPLATE_dump_node);
894  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
895  set_op_copy_attr(op, be_copy_attr);
896  set_op_tag(op, TEMPLATE_op_tag);
897  op_TEMPLATE_fMinus = op;
898  op = new_ir_op(cur_opcode + iro_TEMPLATE_fMul, "TEMPLATE_fMul", op_pin_state_floats, irop_flag_none, oparity_any, -1, sizeof(TEMPLATE_attr_t));
899  set_op_dump(op, TEMPLATE_dump_node);
900  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
901  set_op_copy_attr(op, be_copy_attr);
902  set_op_tag(op, TEMPLATE_op_tag);
903  op_TEMPLATE_fMul = op;
904  op = new_ir_op(cur_opcode + iro_TEMPLATE_fStore, "TEMPLATE_fStore", op_pin_state_exc_pinned, irop_flag_uses_memory, oparity_any, -1, sizeof(TEMPLATE_attr_t));
905  ir_op_set_memory_index(op, 0); set_op_dump(op, TEMPLATE_dump_node);
906  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
907  set_op_copy_attr(op, be_copy_attr);
908  set_op_tag(op, TEMPLATE_op_tag);
909  op_TEMPLATE_fStore = op;
910  op = new_ir_op(cur_opcode + iro_TEMPLATE_fSub, "TEMPLATE_fSub", op_pin_state_floats, irop_flag_none, oparity_any, -1, sizeof(TEMPLATE_attr_t));
911  set_op_dump(op, TEMPLATE_dump_node);
912  set_op_attrs_equal(op, TEMPLATE_attrs_equal);
913  set_op_copy_attr(op, be_copy_attr);
914  set_op_tag(op, TEMPLATE_op_tag);
915  op_TEMPLATE_fSub = op;
916 
917 }
918 
919 void TEMPLATE_free_opcodes(void)
920 {
921  free_ir_op(op_TEMPLATE_Add); op_TEMPLATE_Add = NULL;
922  free_ir_op(op_TEMPLATE_And); op_TEMPLATE_And = NULL;
923  free_ir_op(op_TEMPLATE_Const); op_TEMPLATE_Const = NULL;
924  free_ir_op(op_TEMPLATE_Jmp); op_TEMPLATE_Jmp = NULL;
925  free_ir_op(op_TEMPLATE_Load); op_TEMPLATE_Load = NULL;
926  free_ir_op(op_TEMPLATE_Minus); op_TEMPLATE_Minus = NULL;
927  free_ir_op(op_TEMPLATE_Mul); op_TEMPLATE_Mul = NULL;
928  free_ir_op(op_TEMPLATE_Not); op_TEMPLATE_Not = NULL;
929  free_ir_op(op_TEMPLATE_Or); op_TEMPLATE_Or = NULL;
930  free_ir_op(op_TEMPLATE_Return); op_TEMPLATE_Return = NULL;
931  free_ir_op(op_TEMPLATE_Shl); op_TEMPLATE_Shl = NULL;
932  free_ir_op(op_TEMPLATE_Shr); op_TEMPLATE_Shr = NULL;
933  free_ir_op(op_TEMPLATE_Store); op_TEMPLATE_Store = NULL;
934  free_ir_op(op_TEMPLATE_Sub); op_TEMPLATE_Sub = NULL;
935  free_ir_op(op_TEMPLATE_Xor); op_TEMPLATE_Xor = NULL;
936  free_ir_op(op_TEMPLATE_fAdd); op_TEMPLATE_fAdd = NULL;
937  free_ir_op(op_TEMPLATE_fConst); op_TEMPLATE_fConst = NULL;
938  free_ir_op(op_TEMPLATE_fDiv); op_TEMPLATE_fDiv = NULL;
939  free_ir_op(op_TEMPLATE_fLoad); op_TEMPLATE_fLoad = NULL;
940  free_ir_op(op_TEMPLATE_fMinus); op_TEMPLATE_fMinus = NULL;
941  free_ir_op(op_TEMPLATE_fMul); op_TEMPLATE_fMul = NULL;
942  free_ir_op(op_TEMPLATE_fStore); op_TEMPLATE_fStore = NULL;
943  free_ir_op(op_TEMPLATE_fSub); op_TEMPLATE_fSub = NULL;
944 
945 }
void set_op_dump(ir_op *op, dump_node_func func)
Sets dump callback func for operation op.
void * get_irn_generic_attr(ir_node *node)
Returns a pointer to the node attributes.
ir_mode * mode_X
execution
Definition: irmode.h:205
unsigned get_next_ir_opcodes(unsigned num)
Returns the next free n IR opcode number, allows to register a bunch of user ops. ...
void set_op_attrs_equal(ir_op *op, node_attrs_equal_func func)
Sets attrs_equal callback func for operation op.
ir_op * new_ir_op(unsigned code, const char *name, op_pin_state p, irop_flags flags, op_arity opar, int op_index, size_t attr_size)
Creates a new IR operation.
Nodes of this opcode can be placed in any basic block.
Definition: firm_types.h:202
struct ir_graph ir_graph
Procedure Graph.
Definition: firm_types.h:74
struct dbg_info dbg_info
Source Reference.
Definition: firm_types.h:40
struct ir_node ir_node
Procedure Graph Node.
Definition: firm_types.h:53
ir_mode * mode_F
ieee754 binary32 float (single precision)
Definition: irmode.h:180
ir_mode * mode_Iu
uint32
Definition: irmode.h:187
ir_node * new_ir_node(dbg_info *db, ir_graph *irg, ir_node *block, ir_op *op, ir_mode *mode, int arity, ir_node *const *in)
IR node constructor.
This operation is a control flow operation.
Definition: irop.h:44
unsigned get_irn_opcode(const ir_node *node)
Returns the opcode-enum of the node.
struct ir_entity ir_entity
Entity.
Definition: firm_types.h:83
ir_graph * get_irn_irg(const ir_node *node)
Returns the ir_graph this node belongs to.
ir_mode * mode_M
memory
Definition: irmode.h:178
Node must remain in this basic block if it can throw an exception, else can float.
Definition: firm_types.h:204
ir_op * get_irn_op(const ir_node *node)
Returns the opcode struct of the node.
void ir_op_set_memory_index(ir_op *op, int memory_index)
Sets memory input of operation using memory.
struct ir_op ir_op
Node Opcode.
Definition: firm_types.h:56
ir_node * optimize_node(ir_node *n)
Applies local optimizations to a single node.
void free_ir_op(ir_op *code)
Frees an ir operation.
Nodes must remain in this basic block.
Definition: firm_types.h:203
ir_mode * mode_T
tuple (none)
Definition: irmode.h:208
Nothing.
Definition: irop.h:42
This operation has no arguments and is some kind of a constant.
Definition: irop.h:49
struct ir_tarval ir_tarval
Target Machine Value.
Definition: firm_types.h:68
void verify_new_node(ir_node *node)
If firm is built in debug mode, verify that a newly created node is fine.
void set_op_copy_attr(ir_op *op, copy_attr_func func)
Sets attribute copy callback func for operation op.
This operation has a memory input and may change the memory state.
Definition: irop.h:53
Any other arity, either fixed for the opcode or known when creating the node.
Definition: irop.h:36