2 * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * @brief Backend node support for generic backend nodes.
23 * @author Sebastian Hack
27 * Backend node support for generic backend nodes.
28 * This file provides Perm, Copy, Spill and Reload nodes.
41 #include "bitfiddle.h"
42 #include "raw_bitset.h"
62 #define get_irn_attr(irn) get_irn_generic_attr(irn)
63 #define get_irn_attr_const(irn) get_irn_generic_attr_const(irn)
66 arch_register_req_t req;
67 arch_register_req_t in_req;
70 /** The generic be nodes attribute type. */
72 be_reg_data_t *reg_data;
75 /** The be_Return nodes attribute type. */
77 be_node_attr_t node_attr; /**< base attributes of every be node. */
78 int num_ret_vals; /**< number of return values */
79 unsigned pop; /**< number of bytes that should be popped */
80 int emit_pop; /**< if set, emit pop bytes, even if pop = 0 */
83 /** The be_IncSP attribute type. */
85 be_node_attr_t node_attr; /**< base attributes of every be node. */
86 int offset; /**< The offset by which the stack shall be expanded/shrinked. */
87 int align; /**< whether stack should be aligned after the
91 /** The be_Frame attribute type. */
93 be_node_attr_t node_attr; /**< base attributes of every be node. */
98 /** The be_Call attribute type. */
100 be_node_attr_t node_attr; /**< base attributes of every be node. */
101 ir_entity *ent; /**< The called entity if this is a static call. */
103 ir_type *call_tp; /**< The call type, copied from the original Call node. */
107 be_node_attr_t node_attr; /**< base attributes of every be node. */
108 ir_entity **in_entities;
109 ir_entity **out_entities;
115 ir_op *op_be_MemPerm;
118 ir_op *op_be_CopyKeep;
124 ir_op *op_be_RegParams;
125 ir_op *op_be_FrameAddr;
126 ir_op *op_be_Barrier;
129 static const ir_op_ops be_node_op_ops;
131 #define N irop_flag_none
132 #define L irop_flag_labeled
133 #define C irop_flag_commutative
134 #define X irop_flag_cfopcode
135 #define I irop_flag_ip_cfopcode
136 #define F irop_flag_fragile
137 #define Y irop_flag_forking
138 #define H irop_flag_highlevel
139 #define c irop_flag_constlike
140 #define K irop_flag_keep
141 #define M irop_flag_uses_memory
144 * Compare two be node attributes.
146 * @return zero if both attributes are identically
148 static int _node_cmp_attr(const be_node_attr_t *a, const be_node_attr_t *b) {
149 int i, len = ARR_LEN(a->reg_data);
151 if (len != ARR_LEN(b->reg_data))
154 for (i = len - 1; i >= 0; --i) {
155 if (!reg_reqs_equal(&a->reg_data[i].in_req, &b->reg_data[i].in_req) ||
156 !reg_reqs_equal(&a->reg_data[i].req, &b->reg_data[i].req))
164 * Compare the node attributes of two be_node's.
166 * @return zero if both nodes have identically attributes
168 static int node_cmp_attr(ir_node *a, ir_node *b) {
169 const be_node_attr_t *a_attr = get_irn_attr_const(a);
170 const be_node_attr_t *b_attr = get_irn_attr_const(b);
172 if (_node_cmp_attr(a_attr, b_attr) != 0)
175 return !be_info_equal(a, b);
179 * Compare the attributes of two be_FrameAddr nodes.
181 * @return zero if both nodes have identically attributes
183 static int FrameAddr_cmp_attr(ir_node *a, ir_node *b) {
184 const be_frame_attr_t *a_attr = get_irn_attr_const(a);
185 const be_frame_attr_t *b_attr = get_irn_attr_const(b);
187 if (a_attr->ent != b_attr->ent || a_attr->offset != b_attr->offset)
190 return _node_cmp_attr(&a_attr->node_attr, &b_attr->node_attr);
194 * Compare the attributes of two be_Return nodes.
196 * @return zero if both nodes have identically attributes
198 static int Return_cmp_attr(ir_node *a, ir_node *b) {
199 const be_return_attr_t *a_attr = get_irn_attr_const(a);
200 const be_return_attr_t *b_attr = get_irn_attr_const(b);
202 if (a_attr->num_ret_vals != b_attr->num_ret_vals)
204 if (a_attr->pop != b_attr->pop)
206 if (a_attr->emit_pop != b_attr->emit_pop)
209 return _node_cmp_attr(&a_attr->node_attr, &b_attr->node_attr);
213 * Compare the attributes of two be_IncSP nodes.
215 * @return zero if both nodes have identically attributes
217 static int IncSP_cmp_attr(ir_node *a, ir_node *b) {
218 const be_incsp_attr_t *a_attr = get_irn_attr_const(a);
219 const be_incsp_attr_t *b_attr = get_irn_attr_const(b);
221 if (a_attr->offset != b_attr->offset)
224 return _node_cmp_attr(&a_attr->node_attr, &b_attr->node_attr);
228 * Compare the attributes of two be_Call nodes.
230 * @return zero if both nodes have identically attributes
232 static int Call_cmp_attr(ir_node *a, ir_node *b) {
233 const be_call_attr_t *a_attr = get_irn_attr_const(a);
234 const be_call_attr_t *b_attr = get_irn_attr_const(b);
236 if (a_attr->ent != b_attr->ent ||
237 a_attr->call_tp != b_attr->call_tp)
240 return _node_cmp_attr(&a_attr->node_attr, &b_attr->node_attr);
243 static inline arch_register_req_t *get_be_req(const ir_node *node, int pos)
246 const be_node_attr_t *attr;
249 assert(is_be_node(node));
250 attr = get_irn_attr_const(node);
256 assert(idx < get_irn_arity(node));
258 assert(idx < ARR_LEN(attr->reg_data));
259 rd = &attr->reg_data[idx];
261 return pos < 0 ? &rd->req : &rd->in_req;
265 * Initializes the generic attribute of all be nodes and return it.
267 static void *init_node_attr(ir_node *node, int max_reg_data)
269 ir_graph *irg = get_irn_irg(node);
270 struct obstack *obst = get_irg_obstack(irg);
271 be_node_attr_t *a = get_irn_attr(node);
273 memset(a, 0, sizeof(get_op_attr_size(get_irn_op(node))));
275 if(max_reg_data >= 0) {
276 backend_info_t *info = be_get_info(node);
277 info->out_infos = NEW_ARR_D(reg_out_info_t, obst, max_reg_data);
278 memset(info->out_infos, 0, max_reg_data * sizeof(info->out_infos[0]));
280 a->reg_data = NEW_ARR_D(be_reg_data_t, obst, max_reg_data);
281 memset(a->reg_data, 0, max_reg_data * sizeof(a->reg_data[0]));
283 backend_info_t *info = be_get_info(node);
284 info->out_infos = NEW_ARR_F(reg_out_info_t, 0);
286 a->reg_data = NEW_ARR_F(be_reg_data_t, 0);
292 static void add_register_req(ir_node *node)
294 backend_info_t *info = be_get_info(node);
295 be_node_attr_t *a = get_irn_attr(node);
296 be_reg_data_t regreq;
297 reg_out_info_t out_info;
298 memset(®req, 0, sizeof(regreq));
299 memset(&out_info, 0, sizeof(out_info));
300 ARR_APP1(be_reg_data_t, a->reg_data, regreq);
301 ARR_APP1(reg_out_info_t, info->out_infos, out_info);
304 ir_node *be_new_Spill(const arch_register_class_t *cls, const arch_register_class_t *cls_frame,
305 ir_node *bl, ir_node *frame, ir_node *to_spill)
310 ir_graph *irg = get_Block_irg(bl);
314 res = new_ir_node(NULL, irg, bl, op_be_Spill, mode_M, 2, in);
315 a = init_node_attr(res, 2);
319 be_node_set_reg_class_in(res, be_pos_Spill_frame, cls_frame);
320 be_node_set_reg_class_in(res, be_pos_Spill_val, cls);
323 * For spills and reloads, we return "none" as requirement for frame
324 * pointer, so every input is ok. Some backends need this (e.g. STA).
325 * Matze: we should investigate if this is really needed, this solution
326 * looks very hacky to me
328 be_node_set_reg_class_in(res, be_pos_Spill_frame, NULL);
333 ir_node *be_new_Reload(const arch_register_class_t *cls,
334 const arch_register_class_t *cls_frame, ir_node *block,
335 ir_node *frame, ir_node *mem, ir_mode *mode)
339 ir_graph *irg = get_Block_irg(block);
343 res = new_ir_node(NULL, irg, block, op_be_Reload, mode, 2, in);
345 init_node_attr(res, 2);
346 be_node_set_reg_class_out(res, 0, cls);
347 be_node_set_reg_class_in(res, be_pos_Reload_frame, cls_frame);
348 arch_irn_set_flags(res, arch_irn_flags_rematerializable);
351 * For spills and reloads, we return "none" as requirement for frame
352 * pointer, so every input is ok. Some backends need this (e.g. STA).
353 * Matze: we should investigate if this is really needed, this solution
354 * looks very hacky to me
356 be_node_set_reg_class_in(res, be_pos_Reload_frame, NULL);
361 ir_node *be_get_Reload_mem(const ir_node *irn)
363 assert(be_is_Reload(irn));
364 return get_irn_n(irn, be_pos_Reload_mem);
367 ir_node *be_get_Reload_frame(const ir_node *irn)
369 assert(be_is_Reload(irn));
370 return get_irn_n(irn, be_pos_Reload_frame);
373 ir_node *be_get_Spill_val(const ir_node *irn)
375 assert(be_is_Spill(irn));
376 return get_irn_n(irn, be_pos_Spill_val);
379 ir_node *be_get_Spill_frame(const ir_node *irn)
381 assert(be_is_Spill(irn));
382 return get_irn_n(irn, be_pos_Spill_frame);
385 ir_node *be_new_Perm(const arch_register_class_t *cls, ir_node *block, int n, ir_node *in[])
388 ir_graph *irg = get_Block_irg(block);
390 ir_node *irn = new_ir_node(NULL, irg, block, op_be_Perm, mode_T, n, in);
391 init_node_attr(irn, n);
392 for (i = 0; i < n; ++i) {
393 be_node_set_reg_class_in(irn, i, cls);
394 be_node_set_reg_class_out(irn, i, cls);
400 void be_Perm_reduce(ir_node *perm, int new_size, int *map)
402 int arity = get_irn_arity(perm);
403 be_reg_data_t *old_data = ALLOCAN(be_reg_data_t, arity);
404 reg_out_info_t *old_infos = ALLOCAN(reg_out_info_t, arity);
405 be_node_attr_t *attr = get_irn_attr(perm);
406 backend_info_t *info = be_get_info(perm);
411 assert(be_is_Perm(perm));
412 assert(new_size <= arity);
414 new_in = alloca(new_size * sizeof(*new_in));
416 /* save the old register data */
417 memcpy(old_data, attr->reg_data, arity * sizeof(old_data[0]));
418 memcpy(old_infos, info->out_infos, arity * sizeof(old_infos[0]));
420 /* compose the new in array and set the new register data directly in place */
421 for (i = 0; i < new_size; ++i) {
423 new_in[i] = get_irn_n(perm, idx);
424 attr->reg_data[i] = old_data[idx];
425 info->out_infos[i] = old_infos[idx];
428 set_irn_in(perm, new_size, new_in);
431 ir_node *be_new_MemPerm(const arch_env_t *arch_env, ir_node *bl, int n, ir_node *in[])
433 ir_graph *irg = get_Block_irg(bl);
434 ir_node *frame = get_irg_frame(irg);
435 const arch_register_class_t *cls_frame = arch_get_irn_reg_class_out(frame);
436 const arch_register_t *sp = arch_env->sp;
438 be_memperm_attr_t *attr;
442 real_in = ALLOCAN(ir_node*, n + 1);
444 memcpy(&real_in[1], in, n * sizeof(real_in[0]));
446 irn = new_ir_node(NULL, irg, bl, op_be_MemPerm, mode_T, n+1, real_in);
448 init_node_attr(irn, n + 1);
449 be_node_set_reg_class_in(irn, 0, sp->reg_class);
450 for (i = 0; i < n; ++i) {
451 be_node_set_reg_class_in(irn, i + 1, cls_frame);
452 be_node_set_reg_class_out(irn, i, cls_frame);
455 attr = get_irn_attr(irn);
457 attr->in_entities = obstack_alloc(irg->obst, n * sizeof(attr->in_entities[0]));
458 memset(attr->in_entities, 0, n * sizeof(attr->in_entities[0]));
459 attr->out_entities = obstack_alloc(irg->obst, n*sizeof(attr->out_entities[0]));
460 memset(attr->out_entities, 0, n*sizeof(attr->out_entities[0]));
466 ir_node *be_new_Copy(const arch_register_class_t *cls, ir_node *bl, ir_node *op)
470 arch_register_req_t *req;
471 ir_graph *irg = get_Block_irg(bl);
474 res = new_ir_node(NULL, irg, bl, op_be_Copy, get_irn_mode(op), 1, in);
475 init_node_attr(res, 1);
476 be_node_set_reg_class_in(res, 0, cls);
477 be_node_set_reg_class_out(res, 0, cls);
479 req = get_be_req(res, BE_OUT_POS(0));
481 req->type = arch_register_req_type_should_be_same;
482 req->other_same = 1U << 0;
487 ir_node *be_get_Copy_op(const ir_node *cpy) {
488 return get_irn_n(cpy, be_pos_Copy_op);
491 void be_set_Copy_op(ir_node *cpy, ir_node *op) {
492 set_irn_n(cpy, be_pos_Copy_op, op);
495 ir_node *be_new_Keep(const arch_register_class_t *cls, ir_node *bl, int n, ir_node *in[])
499 ir_graph *irg = get_Block_irg(bl);
501 res = new_ir_node(NULL, irg, bl, op_be_Keep, mode_ANY, -1, NULL);
502 init_node_attr(res, -1);
504 for(i = 0; i < n; ++i) {
505 add_irn_n(res, in[i]);
506 add_register_req(res);
507 be_node_set_reg_class_in(res, i, cls);
514 void be_Keep_add_node(ir_node *keep, const arch_register_class_t *cls, ir_node *node)
518 assert(be_is_Keep(keep));
519 n = add_irn_n(keep, node);
520 add_register_req(keep);
521 be_node_set_reg_class_in(keep, n, cls);
524 /* creates a be_Call */
525 ir_node *be_new_Call(dbg_info *dbg, ir_graph *irg, ir_node *bl, ir_node *mem, ir_node *sp, ir_node *ptr,
526 int n_outs, int n, ir_node *in[], ir_type *call_tp)
529 int real_n = be_pos_Call_first_arg + n;
533 NEW_ARR_A(ir_node *, real_in, real_n);
534 real_in[be_pos_Call_mem] = mem;
535 real_in[be_pos_Call_sp] = sp;
536 real_in[be_pos_Call_ptr] = ptr;
537 memcpy(&real_in[be_pos_Call_first_arg], in, n * sizeof(in[0]));
539 irn = new_ir_node(dbg, irg, bl, op_be_Call, mode_T, real_n, real_in);
540 a = init_node_attr(irn, (n_outs > real_n ? n_outs : real_n));
542 a->call_tp = call_tp;
547 /* Gets the call entity or NULL if this is no static call. */
548 ir_entity *be_Call_get_entity(const ir_node *call) {
549 const be_call_attr_t *a = get_irn_attr_const(call);
550 assert(be_is_Call(call));
554 /* Sets the call entity. */
555 void be_Call_set_entity(ir_node *call, ir_entity *ent) {
556 be_call_attr_t *a = get_irn_attr(call);
557 assert(be_is_Call(call));
561 /* Gets the call type. */
562 ir_type *be_Call_get_type(ir_node *call) {
563 const be_call_attr_t *a = get_irn_attr_const(call);
564 assert(be_is_Call(call));
568 /* Sets the call type. */
569 void be_Call_set_type(ir_node *call, ir_type *call_tp) {
570 be_call_attr_t *a = get_irn_attr(call);
571 assert(be_is_Call(call));
572 a->call_tp = call_tp;
575 void be_Call_set_pop(ir_node *call, unsigned pop) {
576 be_call_attr_t *a = get_irn_attr(call);
580 unsigned be_Call_get_pop(const ir_node *call) {
581 const be_call_attr_t *a = get_irn_attr_const(call);
585 /* Construct a new be_Return. */
586 ir_node *be_new_Return(dbg_info *dbg, ir_graph *irg, ir_node *block, int n_res,
587 unsigned pop, int n, ir_node *in[])
593 res = new_ir_node(dbg, irg, block, op_be_Return, mode_X, -1, NULL);
594 init_node_attr(res, -1);
595 for(i = 0; i < n; ++i) {
596 add_irn_n(res, in[i]);
597 add_register_req(res);
600 a = get_irn_attr(res);
601 a->num_ret_vals = n_res;
608 /* Returns the number of real returns values */
609 int be_Return_get_n_rets(const ir_node *ret) {
610 const be_return_attr_t *a = get_irn_generic_attr_const(ret);
611 return a->num_ret_vals;
614 /* return the number of bytes that should be popped from stack when executing the Return. */
615 unsigned be_Return_get_pop(const ir_node *ret) {
616 const be_return_attr_t *a = get_irn_generic_attr_const(ret);
620 /* return non-zero, if number of popped bytes must be always emitted */
621 int be_Return_get_emit_pop(const ir_node *ret) {
622 const be_return_attr_t *a = get_irn_generic_attr_const(ret);
626 /* return non-zero, if number of popped bytes must be always emitted */
627 void be_Return_set_emit_pop(ir_node *ret, int emit_pop) {
628 be_return_attr_t *a = get_irn_generic_attr(ret);
629 a->emit_pop = emit_pop;
632 int be_Return_append_node(ir_node *ret, ir_node *node) {
635 pos = add_irn_n(ret, node);
636 add_register_req(ret);
641 ir_node *be_new_IncSP(const arch_register_t *sp, ir_node *bl,
642 ir_node *old_sp, int offset, int align)
647 ir_graph *irg = get_Block_irg(bl);
650 irn = new_ir_node(NULL, irg, bl, op_be_IncSP, sp->reg_class->mode,
651 sizeof(in) / sizeof(in[0]), in);
652 a = init_node_attr(irn, 1);
656 /* Set output constraint to stack register. */
657 be_node_set_reg_class_in(irn, 0, sp->reg_class);
658 be_set_constr_single_reg_out(irn, 0, sp, arch_register_req_type_produces_sp);
663 ir_node *be_new_AddSP(const arch_register_t *sp, ir_node *bl, ir_node *old_sp, ir_node *sz)
667 ir_node *in[be_pos_AddSP_last];
668 const arch_register_class_t *cls;
671 in[be_pos_AddSP_old_sp] = old_sp;
672 in[be_pos_AddSP_size] = sz;
674 irg = get_Block_irg(bl);
675 irn = new_ir_node(NULL, irg, bl, op_be_AddSP, mode_T, be_pos_AddSP_last, in);
676 a = init_node_attr(irn, be_pos_AddSP_last);
678 /* Set output constraint to stack register. */
679 be_set_constr_single_reg_in(irn, be_pos_AddSP_old_sp, sp, 0);
680 be_node_set_reg_class_in(irn, be_pos_AddSP_size, arch_register_get_class(sp));
681 be_set_constr_single_reg_out(irn, pn_be_AddSP_sp, sp, arch_register_req_type_produces_sp);
683 cls = arch_register_get_class(sp);
688 ir_node *be_new_SubSP(const arch_register_t *sp, ir_node *bl, ir_node *old_sp, ir_node *sz)
692 ir_node *in[be_pos_SubSP_last];
695 in[be_pos_SubSP_old_sp] = old_sp;
696 in[be_pos_SubSP_size] = sz;
698 irg = get_Block_irg(bl);
699 irn = new_ir_node(NULL, irg, bl, op_be_SubSP, mode_T, be_pos_SubSP_last, in);
700 a = init_node_attr(irn, be_pos_SubSP_last);
702 /* Set output constraint to stack register. */
703 be_set_constr_single_reg_in(irn, be_pos_SubSP_old_sp, sp, 0);
704 be_node_set_reg_class_in(irn, be_pos_SubSP_size, arch_register_get_class(sp));
705 be_set_constr_single_reg_out(irn, pn_be_SubSP_sp, sp, arch_register_req_type_produces_sp);
710 ir_node *be_new_RegParams(ir_node *bl, int n_outs)
714 ir_graph *irg = get_Block_irg(bl);
716 res = new_ir_node(NULL, irg, bl, op_be_RegParams, mode_T, 0, NULL);
717 init_node_attr(res, -1);
718 for(i = 0; i < n_outs; ++i)
719 add_register_req(res);
724 ir_node *be_new_FrameAddr(const arch_register_class_t *cls_frame, ir_node *bl, ir_node *frame, ir_entity *ent)
729 ir_graph *irg = get_Block_irg(bl);
732 irn = new_ir_node(NULL, irg, bl, op_be_FrameAddr, get_irn_mode(frame), 1, in);
733 a = init_node_attr(irn, 1);
736 be_node_set_reg_class_in(irn, 0, cls_frame);
737 be_node_set_reg_class_out(irn, 0, cls_frame);
739 return optimize_node(irn);
742 ir_node *be_get_FrameAddr_frame(const ir_node *node) {
743 assert(be_is_FrameAddr(node));
744 return get_irn_n(node, be_pos_FrameAddr_ptr);
747 ir_entity *be_get_FrameAddr_entity(const ir_node *node)
749 const be_frame_attr_t *attr = get_irn_generic_attr_const(node);
753 ir_node *be_new_CopyKeep(const arch_register_class_t *cls, ir_node *bl, ir_node *src, int n, ir_node *in_keep[], ir_mode *mode)
756 ir_node **in = ALLOCAN(ir_node*, n + 1);
757 ir_graph *irg = get_Block_irg(bl);
760 memcpy(&in[1], in_keep, n * sizeof(in[0]));
761 irn = new_ir_node(NULL, irg, bl, op_be_CopyKeep, mode, n + 1, in);
762 init_node_attr(irn, n + 1);
763 be_node_set_reg_class_in(irn, 0, cls);
764 be_node_set_reg_class_out(irn, 0, cls);
769 ir_node *be_new_CopyKeep_single(const arch_register_class_t *cls, ir_node *bl, ir_node *src, ir_node *keep, ir_mode *mode)
771 return be_new_CopyKeep(cls, bl, src, 1, &keep, mode);
774 ir_node *be_get_CopyKeep_op(const ir_node *cpy) {
775 return get_irn_n(cpy, be_pos_CopyKeep_op);
778 void be_set_CopyKeep_op(ir_node *cpy, ir_node *op) {
779 set_irn_n(cpy, be_pos_CopyKeep_op, op);
782 ir_node *be_new_Barrier(ir_node *bl, int n, ir_node *in[])
786 ir_graph *irg = get_Block_irg(bl);
788 res = new_ir_node(NULL, irg, bl, op_be_Barrier, mode_T, -1, NULL);
789 init_node_attr(res, -1);
790 for(i = 0; i < n; ++i) {
791 add_irn_n(res, in[i]);
792 add_register_req(res);
798 ir_node *be_Barrier_append_node(ir_node *barrier, ir_node *node)
800 ir_node *block = get_nodes_block(barrier);
801 ir_mode *mode = get_irn_mode(node);
802 int n = add_irn_n(barrier, node);
804 ir_node *proj = new_r_Proj(block, barrier, mode, n);
805 add_register_req(barrier);
810 /* Construct a new be_Unwind. */
811 ir_node *be_new_Unwind(dbg_info *dbg, ir_node *block,
812 ir_node *mem, ir_node *sp)
816 ir_graph *irg = get_Block_irg(block);
818 in[be_pos_Unwind_mem] = mem;
819 in[be_pos_Unwind_sp] = sp;
820 res = new_ir_node(dbg, irg, block, op_be_Unwind, mode_X, 2, in);
821 init_node_attr(res, -1);
826 int be_has_frame_entity(const ir_node *irn)
828 switch (get_irn_opcode(irn)) {
838 ir_entity *be_get_frame_entity(const ir_node *irn)
840 if (be_has_frame_entity(irn)) {
841 const be_frame_attr_t *a = get_irn_attr_const(irn);
847 int be_get_frame_offset(const ir_node *irn)
849 assert(is_be_node(irn));
850 if (be_has_frame_entity(irn)) {
851 const be_frame_attr_t *a = get_irn_attr_const(irn);
857 void be_set_MemPerm_in_entity(const ir_node *irn, int n, ir_entity *ent)
859 const be_memperm_attr_t *attr = get_irn_attr_const(irn);
861 assert(be_is_MemPerm(irn));
862 assert(n < be_get_MemPerm_entity_arity(irn));
864 attr->in_entities[n] = ent;
867 ir_entity* be_get_MemPerm_in_entity(const ir_node* irn, int n)
869 const be_memperm_attr_t *attr = get_irn_attr_const(irn);
871 assert(be_is_MemPerm(irn));
872 assert(n < be_get_MemPerm_entity_arity(irn));
874 return attr->in_entities[n];
877 void be_set_MemPerm_out_entity(const ir_node *irn, int n, ir_entity *ent)
879 const be_memperm_attr_t *attr = get_irn_attr_const(irn);
881 assert(be_is_MemPerm(irn));
882 assert(n < be_get_MemPerm_entity_arity(irn));
884 attr->out_entities[n] = ent;
887 ir_entity* be_get_MemPerm_out_entity(const ir_node* irn, int n)
889 const be_memperm_attr_t *attr = get_irn_attr_const(irn);
891 assert(be_is_MemPerm(irn));
892 assert(n < be_get_MemPerm_entity_arity(irn));
894 return attr->out_entities[n];
897 int be_get_MemPerm_entity_arity(const ir_node *irn)
899 return get_irn_arity(irn) - 1;
902 static void set_req_single(struct obstack *obst, arch_register_req_t *req,
903 const arch_register_t *reg, arch_register_req_type_t additional_types)
905 const arch_register_class_t *cls = arch_register_get_class(reg);
906 unsigned *limited_bitset;
908 limited_bitset = rbitset_obstack_alloc(obst, arch_register_class_n_regs(cls));
909 rbitset_set(limited_bitset, arch_register_get_index(reg));
912 req->type |= arch_register_req_type_limited | additional_types;
913 req->limited = limited_bitset;
917 void be_set_constr_single_reg_in(ir_node *node, int pos,
918 const arch_register_t *reg, arch_register_req_type_t additional_types)
920 arch_register_req_t *req = get_be_req(node, pos);
921 ir_graph *irg = get_irn_irg(node);
922 struct obstack *obst = get_irg_obstack(irg);
924 set_req_single(obst, req, reg, additional_types);
927 void be_set_constr_single_reg_out(ir_node *node, int pos,
928 const arch_register_t *reg, arch_register_req_type_t additional_types)
930 arch_register_req_t *req = get_be_req(node, BE_OUT_POS(pos));
931 ir_graph *irg = get_irn_irg(node);
932 struct obstack *obst = get_irg_obstack(irg);
934 /* if we have an ignore register, add ignore flag and just assign it */
935 if (reg->type & arch_register_type_ignore) {
936 additional_types |= arch_register_req_type_ignore;
939 arch_irn_set_register(node, pos, reg);
940 set_req_single(obst, req, reg, additional_types);
943 void be_set_constr_limited(ir_node *node, int pos, const arch_register_req_t *req)
945 ir_graph *irg = get_irn_irg(node);
946 struct obstack *obst = get_irg_obstack(irg);
947 arch_register_req_t *r = get_be_req(node, pos);
949 assert(arch_register_req_is(req, limited));
950 assert(!(req->type & (arch_register_req_type_should_be_same | arch_register_req_type_must_be_different)));
951 memcpy(r, req, sizeof(r[0]));
952 r->limited = rbitset_duplicate_obstack_alloc(obst, req->limited, req->cls->n_regs);
955 void be_node_set_reg_class_in(ir_node *irn, int pos, const arch_register_class_t *cls)
957 arch_register_req_t *req = get_be_req(irn, pos);
962 req->type = arch_register_req_type_none;
963 } else if (req->type == arch_register_req_type_none) {
964 req->type = arch_register_req_type_normal;
968 void be_node_set_reg_class_out(ir_node *irn, int pos, const arch_register_class_t *cls)
970 arch_register_req_t *req = get_be_req(irn, BE_OUT_POS(pos));
975 req->type = arch_register_req_type_none;
976 } else if (req->type == arch_register_req_type_none) {
977 req->type = arch_register_req_type_normal;
981 void be_node_set_req_type(ir_node *irn, int pos, arch_register_req_type_t type)
983 arch_register_req_t *req = get_be_req(irn, pos);
987 ir_node *be_get_IncSP_pred(ir_node *irn) {
988 assert(be_is_IncSP(irn));
989 return get_irn_n(irn, 0);
992 void be_set_IncSP_pred(ir_node *incsp, ir_node *pred) {
993 assert(be_is_IncSP(incsp));
994 set_irn_n(incsp, 0, pred);
997 void be_set_IncSP_offset(ir_node *irn, int offset)
999 be_incsp_attr_t *a = get_irn_attr(irn);
1000 assert(be_is_IncSP(irn));
1004 int be_get_IncSP_offset(const ir_node *irn)
1006 const be_incsp_attr_t *a = get_irn_attr_const(irn);
1007 assert(be_is_IncSP(irn));
1011 int be_get_IncSP_align(const ir_node *irn)
1013 const be_incsp_attr_t *a = get_irn_attr_const(irn);
1014 assert(be_is_IncSP(irn));
1018 ir_node *be_spill(ir_node *block, ir_node *irn)
1020 ir_graph *irg = get_Block_irg(block);
1021 ir_node *frame = get_irg_frame(irg);
1022 const arch_register_class_t *cls = arch_get_irn_reg_class_out(irn);
1023 const arch_register_class_t *cls_frame = arch_get_irn_reg_class_out(frame);
1026 spill = be_new_Spill(cls, cls_frame, block, frame, irn);
1030 ir_node *be_reload(const arch_register_class_t *cls, ir_node *insert, ir_mode *mode, ir_node *spill)
1033 ir_node *bl = is_Block(insert) ? insert : get_nodes_block(insert);
1034 ir_graph *irg = get_Block_irg(bl);
1035 ir_node *frame = get_irg_frame(irg);
1036 const arch_register_class_t *cls_frame = arch_get_irn_reg_class_out(frame);
1038 assert(be_is_Spill(spill) || (is_Phi(spill) && get_irn_mode(spill) == mode_M));
1040 reload = be_new_Reload(cls, cls_frame, bl, frame, spill, mode);
1042 if (is_Block(insert)) {
1043 insert = sched_skip(insert, 0, sched_skip_cf_predicator, NULL);
1044 sched_add_after(insert, reload);
1046 sched_add_before(insert, reload);
1054 | _ \ ___ __ _ | _ \ ___ __ _ ___
1055 | |_) / _ \/ _` | | |_) / _ \/ _` / __|
1056 | _ < __/ (_| | | _ < __/ (_| \__ \
1057 |_| \_\___|\__, | |_| \_\___|\__, |___/
1063 static const arch_register_req_t *be_node_get_out_reg_req(
1064 const ir_node *irn, int pos)
1066 const be_node_attr_t *a = get_irn_attr_const(irn);
1069 if (pos >= ARR_LEN(a->reg_data)) {
1070 return arch_no_register_req;
1073 return &a->reg_data[pos].req;
1076 static const arch_register_req_t *be_node_get_in_reg_req(
1077 const ir_node *irn, int pos)
1079 const be_node_attr_t *a = get_irn_attr_const(irn);
1082 if (pos >= get_irn_arity(irn) || pos >= ARR_LEN(a->reg_data))
1083 return arch_no_register_req;
1085 return &a->reg_data[pos].in_req;
1088 static arch_irn_class_t be_node_classify(const ir_node *irn)
1090 switch (get_irn_opcode(irn)) {
1091 case beo_Spill: return arch_irn_class_spill;
1092 case beo_Reload: return arch_irn_class_reload;
1093 case beo_Perm: return arch_irn_class_perm;
1094 case beo_Copy: return arch_irn_class_copy;
1099 static ir_entity *be_node_get_frame_entity(const ir_node *irn)
1101 return be_get_frame_entity(irn);
1104 static void be_node_set_frame_entity(ir_node *irn, ir_entity *ent)
1108 assert(be_has_frame_entity(irn));
1110 a = get_irn_attr(irn);
1114 static void be_node_set_frame_offset(ir_node *irn, int offset)
1118 if(!be_has_frame_entity(irn))
1121 a = get_irn_attr(irn);
1125 static int be_node_get_sp_bias(const ir_node *irn)
1127 if(be_is_IncSP(irn))
1128 return be_get_IncSP_offset(irn);
1130 return -(int)be_Call_get_pop(irn);
1136 ___ ____ _ _ _ _ _ _
1137 |_ _| _ \| \ | | | | | | __ _ _ __ __| | | ___ _ __
1138 | || |_) | \| | | |_| |/ _` | '_ \ / _` | |/ _ \ '__|
1139 | || _ <| |\ | | _ | (_| | | | | (_| | | __/ |
1140 |___|_| \_\_| \_| |_| |_|\__,_|_| |_|\__,_|_|\___|_|
1145 static const arch_irn_ops_t be_node_irn_ops = {
1146 be_node_get_in_reg_req,
1147 be_node_get_out_reg_req,
1149 be_node_get_frame_entity,
1150 be_node_set_frame_entity,
1151 be_node_set_frame_offset,
1152 be_node_get_sp_bias,
1153 NULL, /* get_inverse */
1154 NULL, /* get_op_estimated_cost */
1155 NULL, /* possible_memory_operand */
1156 NULL, /* perform_memory_operand */
1159 static const arch_register_req_t *dummy_reg_req(
1160 const ir_node *node, int pos)
1164 return arch_no_register_req;
1167 static arch_irn_class_t dummy_classify(const ir_node *node)
1173 static ir_entity* dummy_get_frame_entity(const ir_node *node)
1179 static void dummy_set_frame_entity(ir_node *node, ir_entity *entity)
1183 panic("dummy_set_frame_entity() should not be called");
1186 static void dummy_set_frame_offset(ir_node *node, int bias)
1190 panic("dummy_set_frame_offset() should not be called");
1193 static int dummy_get_sp_bias(const ir_node *node)
1199 /* for "middleend" nodes */
1200 static const arch_irn_ops_t dummy_be_irn_ops = {
1204 dummy_get_frame_entity,
1205 dummy_set_frame_entity,
1206 dummy_set_frame_offset,
1208 NULL, /* get_inverse */
1209 NULL, /* get_op_estimated_cost */
1210 NULL, /* possible_memory_operand */
1211 NULL, /* perform_memory_operand */
1215 ____ _ _ ___ ____ _ _ _ _ _ _
1216 | _ \| |__ (_) |_ _| _ \| \ | | | | | | __ _ _ __ __| | | ___ _ __
1217 | |_) | '_ \| | | || |_) | \| | | |_| |/ _` | '_ \ / _` | |/ _ \ '__|
1218 | __/| | | | | | || _ <| |\ | | _ | (_| | | | | (_| | | __/ |
1219 |_| |_| |_|_| |___|_| \_\_| \_| |_| |_|\__,_|_| |_|\__,_|_|\___|_|
1224 * Guess correct register class of a phi node by looking at its arguments
1226 static const arch_register_req_t *get_Phi_reg_req_recursive(const ir_node *phi,
1229 int n = get_irn_arity(phi);
1233 if(*visited && pset_find_ptr(*visited, phi))
1236 for(i = 0; i < n; ++i) {
1237 op = get_irn_n(phi, i);
1238 /* Matze: don't we unnecessary constraint our phis with this?
1239 * we only need to take the regclass IMO*/
1241 return arch_get_register_req_out(op);
1245 * The operands of that Phi were all Phis themselves.
1246 * We have to start a DFS for a non-Phi argument now.
1249 *visited = pset_new_ptr(16);
1251 pset_insert_ptr(*visited, phi);
1253 for(i = 0; i < n; ++i) {
1254 const arch_register_req_t *req;
1255 op = get_irn_n(phi, i);
1256 req = get_Phi_reg_req_recursive(op, visited);
1264 static const arch_register_req_t *phi_get_irn_reg_req(const ir_node *node,
1267 backend_info_t *info = be_get_info(node);
1268 const arch_register_req_t *req = info->out_infos[0].req;
1272 if (!mode_is_datab(get_irn_mode(node))) {
1273 req = arch_no_register_req;
1275 pset *visited = NULL;
1276 ir_graph *irg = get_irn_irg(node);
1277 struct obstack *obst = get_irg_obstack(irg);
1279 req = get_Phi_reg_req_recursive(node, &visited);
1280 assert(req->cls != NULL);
1282 if (req->type != arch_register_req_type_normal) {
1283 arch_register_req_t *nreq = obstack_alloc(obst, sizeof(*nreq));
1285 nreq->type = arch_register_req_type_normal;
1289 if (visited != NULL)
1292 info->out_infos[0].req = req;
1298 void be_set_phi_reg_req(ir_node *node, const arch_register_req_t *req)
1300 backend_info_t *info = be_get_info(node);
1301 info->out_infos[0].req = req;
1303 assert(mode_is_datab(get_irn_mode(node)));
1306 int be_dump_phi_reg_reqs(ir_node *node, FILE *F, dump_reason_t reason)
1308 backend_info_t *info;
1313 case dump_node_opcode_txt:
1314 fputs(get_op_name(get_irn_op(node)), F);
1316 case dump_node_mode_txt:
1317 fprintf(F, "%s", get_mode_name(get_irn_mode(node)));
1319 case dump_node_nodeattr_txt:
1321 case dump_node_info_txt:
1322 info = be_get_info(node);
1324 /* we still have a little problem with the initialisation order. This
1325 dump function is attached to the Phi ops before we can be sure
1326 that all backend infos have been constructed... */
1328 const arch_register_req_t *req = info->out_infos[0].req;
1329 const arch_register_t *reg = arch_irn_get_register(node, 0);
1331 arity = get_irn_arity(node);
1332 for (i = 0; i < arity; ++i) {
1333 fprintf(F, "inreq #%d = ", i);
1334 arch_dump_register_req(F, req, node);
1337 fprintf(F, "outreq #0 = ");
1338 arch_dump_register_req(F, req, node);
1343 fprintf(F, "reg #0 = %s\n", reg != NULL ? reg->name : "n/a");
1355 static const arch_irn_ops_t phi_irn_ops = {
1356 phi_get_irn_reg_req,
1357 phi_get_irn_reg_req,
1359 dummy_get_frame_entity,
1360 dummy_set_frame_entity,
1361 dummy_set_frame_offset,
1363 NULL, /* get_inverse */
1364 NULL, /* get_op_estimated_cost */
1365 NULL, /* possible_memory_operand */
1366 NULL, /* perform_memory_operand */
1371 | \ | | ___ __| | ___ | _ \ _ _ _ __ ___ _ __ (_)_ __ __ _
1372 | \| |/ _ \ / _` |/ _ \ | | | | | | | '_ ` _ \| '_ \| | '_ \ / _` |
1373 | |\ | (_) | (_| | __/ | |_| | |_| | | | | | | |_) | | | | | (_| |
1374 |_| \_|\___/ \__,_|\___| |____/ \__,_|_| |_| |_| .__/|_|_| |_|\__, |
1379 * Dumps node register requirements to a file.
1381 static void dump_node_reqs(FILE *F, ir_node *node)
1384 be_node_attr_t *a = get_irn_attr(node);
1385 int len = ARR_LEN(a->reg_data);
1387 for (i = 0; i < len; ++i) {
1388 const arch_register_req_t *req = &a->reg_data[i].in_req;
1389 if (req->cls == NULL)
1391 fprintf(F, "inreq #%d = ", i);
1392 arch_dump_register_req(F, req, node);
1396 for (i = 0; i < len; ++i) {
1397 const arch_register_req_t *req = &a->reg_data[i].req;
1398 if (req->cls == NULL)
1400 fprintf(F, "outreq #%d = ", i);
1401 arch_dump_register_req(F, req, node);
1407 for (i = 0; i < len; ++i) {
1408 const arch_register_t *reg = arch_irn_get_register(node, i);
1409 fprintf(F, "reg #%d = %s\n", i, reg != NULL ? reg->name : "n/a");
1414 * ir_op-Operation: dump a be node to file
1416 static int dump_node(ir_node *irn, FILE *f, dump_reason_t reason)
1418 be_node_attr_t *at = get_irn_attr(irn);
1420 assert(is_be_node(irn));
1423 case dump_node_opcode_txt:
1424 fputs(get_op_name(get_irn_op(irn)), f);
1426 case dump_node_mode_txt:
1427 if(be_is_Perm(irn) || be_is_Copy(irn) || be_is_CopyKeep(irn)) {
1428 fprintf(f, " %s", get_mode_name(get_irn_mode(irn)));
1431 case dump_node_nodeattr_txt:
1432 if(be_is_Call(irn)) {
1433 be_call_attr_t *a = (be_call_attr_t *) at;
1435 fprintf(f, " [%s] ", get_entity_name(a->ent));
1437 if(be_is_IncSP(irn)) {
1438 const be_incsp_attr_t *attr = get_irn_generic_attr_const(irn);
1439 if(attr->offset == BE_STACK_FRAME_SIZE_EXPAND) {
1440 fprintf(f, " [Setup Stackframe] ");
1441 } else if(attr->offset == BE_STACK_FRAME_SIZE_SHRINK) {
1442 fprintf(f, " [Destroy Stackframe] ");
1444 fprintf(f, " [%d] ", attr->offset);
1448 case dump_node_info_txt:
1449 dump_node_reqs(f, irn);
1451 if(be_has_frame_entity(irn)) {
1452 be_frame_attr_t *a = (be_frame_attr_t *) at;
1454 unsigned size = get_type_size_bytes(get_entity_type(a->ent));
1455 ir_fprintf(f, "frame entity: %+F, offset 0x%x (%d), size 0x%x (%d) bytes\n",
1456 a->ent, a->offset, a->offset, size, size);
1461 switch (get_irn_opcode(irn)) {
1464 be_incsp_attr_t *a = (be_incsp_attr_t *) at;
1465 if (a->offset == BE_STACK_FRAME_SIZE_EXPAND)
1466 fprintf(f, "offset: FRAME_SIZE\n");
1467 else if(a->offset == BE_STACK_FRAME_SIZE_SHRINK)
1468 fprintf(f, "offset: -FRAME SIZE\n");
1470 fprintf(f, "offset: %u\n", a->offset);
1475 be_call_attr_t *a = (be_call_attr_t *) at;
1478 fprintf(f, "\ncalling: %s\n", get_entity_name(a->ent));
1484 for(i = 0; i < be_get_MemPerm_entity_arity(irn); ++i) {
1485 ir_entity *in, *out;
1486 in = be_get_MemPerm_in_entity(irn, i);
1487 out = be_get_MemPerm_out_entity(irn, i);
1489 fprintf(f, "\nin[%d]: %s\n", i, get_entity_name(in));
1492 fprintf(f, "\nout[%d]: %s\n", i, get_entity_name(out));
1508 * Copies the backend specific attributes from old node to new node.
1510 static void copy_attr(const ir_node *old_node, ir_node *new_node)
1512 const be_node_attr_t *old_attr = get_irn_attr_const(old_node);
1513 be_node_attr_t *new_attr = get_irn_attr(new_node);
1514 struct obstack *obst = get_irg_obstack(get_irn_irg(new_node));
1515 backend_info_t *old_info = be_get_info(old_node);
1516 backend_info_t *new_info = be_get_info(new_node);
1519 assert(is_be_node(old_node));
1520 assert(is_be_node(new_node));
1522 memcpy(new_attr, old_attr, get_op_attr_size(get_irn_op(old_node)));
1523 new_attr->reg_data = NULL;
1525 if(old_attr->reg_data != NULL)
1526 len = ARR_LEN(old_attr->reg_data);
1530 if(get_irn_op(old_node)->opar == oparity_dynamic
1531 || be_is_RegParams(old_node)) {
1532 new_attr->reg_data = NEW_ARR_F(be_reg_data_t, len);
1533 new_info->out_infos = NEW_ARR_F(reg_out_info_t, len);
1535 new_attr->reg_data = NEW_ARR_D(be_reg_data_t, obst, len);
1536 new_info->out_infos = NEW_ARR_D(reg_out_info_t, obst, len);
1540 memcpy(new_attr->reg_data, old_attr->reg_data, len * sizeof(be_reg_data_t));
1541 memcpy(new_info->out_infos, old_info->out_infos, len * sizeof(new_info->out_infos[0]));
1542 for(i = 0; i < len; ++i) {
1543 const be_reg_data_t *rd = &old_attr->reg_data[i];
1544 be_reg_data_t *newrd = &new_attr->reg_data[i];
1545 if (arch_register_req_is(&rd->req, limited)) {
1546 const arch_register_req_t *req = &rd->req;
1547 arch_register_req_t *new_req = &newrd->req;
1549 = rbitset_duplicate_obstack_alloc(obst, req->limited, req->cls->n_regs);
1551 if(arch_register_req_is(&rd->in_req, limited)) {
1552 const arch_register_req_t *req = &rd->in_req;
1553 arch_register_req_t *new_req = &newrd->in_req;
1555 = rbitset_duplicate_obstack_alloc(obst, req->limited, req->cls->n_regs);
1561 static const ir_op_ops be_node_op_ops = {
1582 int is_be_node(const ir_node *irn)
1584 return get_op_ops(get_irn_op(irn))->be_ops == &be_node_irn_ops;
1587 void be_init_op(void)
1591 /* Acquire all needed opcodes. */
1592 op_be_Spill = new_ir_op(beo_Spill, "be_Spill", op_pin_state_pinned, N, oparity_unary, 0, sizeof(be_frame_attr_t), &be_node_op_ops);
1593 op_be_Reload = new_ir_op(beo_Reload, "be_Reload", op_pin_state_pinned, N, oparity_zero, 0, sizeof(be_frame_attr_t), &be_node_op_ops);
1594 op_be_Perm = new_ir_op(beo_Perm, "be_Perm", op_pin_state_pinned, N, oparity_variable, 0, sizeof(be_node_attr_t), &be_node_op_ops);
1595 op_be_MemPerm = new_ir_op(beo_MemPerm, "be_MemPerm", op_pin_state_pinned, N, oparity_variable, 0, sizeof(be_memperm_attr_t), &be_node_op_ops);
1596 op_be_Copy = new_ir_op(beo_Copy, "be_Copy", op_pin_state_floats, N, oparity_unary, 0, sizeof(be_node_attr_t), &be_node_op_ops);
1597 op_be_Keep = new_ir_op(beo_Keep, "be_Keep", op_pin_state_floats, K, oparity_dynamic, 0, sizeof(be_node_attr_t), &be_node_op_ops);
1598 op_be_CopyKeep = new_ir_op(beo_CopyKeep, "be_CopyKeep", op_pin_state_floats, K, oparity_variable, 0, sizeof(be_node_attr_t), &be_node_op_ops);
1599 op_be_Call = new_ir_op(beo_Call, "be_Call", op_pin_state_pinned, F|M, oparity_variable, 0, sizeof(be_call_attr_t), &be_node_op_ops);
1600 op_be_Return = new_ir_op(beo_Return, "be_Return", op_pin_state_pinned, X, oparity_dynamic, 0, sizeof(be_return_attr_t), &be_node_op_ops);
1601 op_be_AddSP = new_ir_op(beo_AddSP, "be_AddSP", op_pin_state_pinned, N, oparity_unary, 0, sizeof(be_node_attr_t), &be_node_op_ops);
1602 op_be_SubSP = new_ir_op(beo_SubSP, "be_SubSP", op_pin_state_pinned, N, oparity_unary, 0, sizeof(be_node_attr_t), &be_node_op_ops);
1603 op_be_IncSP = new_ir_op(beo_IncSP, "be_IncSP", op_pin_state_pinned, N, oparity_unary, 0, sizeof(be_incsp_attr_t), &be_node_op_ops);
1604 op_be_RegParams = new_ir_op(beo_RegParams, "be_RegParams", op_pin_state_pinned, N, oparity_zero, 0, sizeof(be_node_attr_t), &be_node_op_ops);
1605 op_be_FrameAddr = new_ir_op(beo_FrameAddr, "be_FrameAddr", op_pin_state_floats, N, oparity_unary, 0, sizeof(be_frame_attr_t), &be_node_op_ops);
1606 op_be_Barrier = new_ir_op(beo_Barrier, "be_Barrier", op_pin_state_pinned, N, oparity_dynamic, 0, sizeof(be_node_attr_t), &be_node_op_ops);
1607 op_be_Unwind = new_ir_op(beo_Unwind, "be_Unwind", op_pin_state_pinned, X, oparity_zero, 0, sizeof(be_node_attr_t), &be_node_op_ops);
1609 op_be_Spill->ops.node_cmp_attr = FrameAddr_cmp_attr;
1610 op_be_Reload->ops.node_cmp_attr = FrameAddr_cmp_attr;
1611 op_be_Perm->ops.node_cmp_attr = node_cmp_attr;
1612 op_be_MemPerm->ops.node_cmp_attr = node_cmp_attr;
1613 op_be_Copy->ops.node_cmp_attr = node_cmp_attr;
1614 op_be_Keep->ops.node_cmp_attr = node_cmp_attr;
1615 op_be_CopyKeep->ops.node_cmp_attr = node_cmp_attr;
1616 op_be_Call->ops.node_cmp_attr = Call_cmp_attr;
1617 op_be_Return->ops.node_cmp_attr = Return_cmp_attr;
1618 op_be_AddSP->ops.node_cmp_attr = node_cmp_attr;
1619 op_be_SubSP->ops.node_cmp_attr = node_cmp_attr;
1620 op_be_IncSP->ops.node_cmp_attr = IncSP_cmp_attr;
1621 op_be_RegParams->ops.node_cmp_attr = node_cmp_attr;
1622 op_be_FrameAddr->ops.node_cmp_attr = FrameAddr_cmp_attr;
1623 op_be_Barrier->ops.node_cmp_attr = node_cmp_attr;
1624 op_be_Unwind->ops.node_cmp_attr = node_cmp_attr;
1626 /* attach out dummy_ops to middle end nodes */
1627 for (opc = iro_First; opc <= iro_Last; ++opc) {
1628 ir_op *op = get_irp_opcode(opc);
1629 assert(op->ops.be_ops == NULL);
1630 op->ops.be_ops = &dummy_be_irn_ops;
1633 op_Phi->ops.be_ops = &phi_irn_ops;