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"
56 #include "besched_t.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;
74 /** The generic be nodes attribute type. */
76 be_reg_data_t *reg_data;
79 /** The be_Return nodes attribute type. */
81 be_node_attr_t node_attr; /**< base attributes of every be node. */
82 int num_ret_vals; /**< number of return values */
83 unsigned pop; /**< number of bytes that should be popped */
84 int emit_pop; /**< if set, emit pop bytes, even if pop = 0 */
87 /** The be_IncSP attribute type. */
89 be_node_attr_t node_attr; /**< base attributes of every be node. */
90 int offset; /**< The offset by which the stack shall be expanded/shrinked. */
91 int align; /**< whether stack should be aligned after the
95 /** The be_Frame attribute type. */
97 be_node_attr_t node_attr; /**< base attributes of every be node. */
102 /** The be_Call attribute type. */
104 be_node_attr_t node_attr; /**< base attributes of every be node. */
105 ir_entity *ent; /**< The called entity if this is a static call. */
107 ir_type *call_tp; /**< The call type, copied from the original Call node. */
111 be_node_attr_t node_attr; /**< base attributes of every be node. */
112 ir_entity **in_entities;
113 ir_entity **out_entities;
119 ir_op *op_be_MemPerm;
122 ir_op *op_be_CopyKeep;
128 ir_op *op_be_RegParams;
129 ir_op *op_be_FrameAddr;
130 ir_op *op_be_Barrier;
133 static const ir_op_ops be_node_op_ops;
135 #define N irop_flag_none
136 #define L irop_flag_labeled
137 #define C irop_flag_commutative
138 #define X irop_flag_cfopcode
139 #define I irop_flag_ip_cfopcode
140 #define F irop_flag_fragile
141 #define Y irop_flag_forking
142 #define H irop_flag_highlevel
143 #define c irop_flag_constlike
144 #define K irop_flag_keep
145 #define M irop_flag_uses_memory
147 static int be_reqs_equal(const be_req_t *req1, const be_req_t *req2)
149 if(!reg_reqs_equal(&req1->req, &req2->req))
156 * Compare two be node attributes.
158 * @return zero if both attributes are identically
160 static int _node_cmp_attr(const be_node_attr_t *a, const be_node_attr_t *b) {
163 if (ARR_LEN(a->reg_data) != ARR_LEN(b->reg_data))
166 len = ARR_LEN(a->reg_data);
167 for (i = 0; i < len; ++i) {
168 if (!be_reqs_equal(&a->reg_data[i].in_req, &b->reg_data[i].in_req) ||
169 !be_reqs_equal(&a->reg_data[i].req, &b->reg_data[i].req))
177 * Compare the node attributes of two be_node's.
179 * @return zero if both nodes have identically attributes
181 static int node_cmp_attr(ir_node *a, ir_node *b) {
182 const be_node_attr_t *a_attr = get_irn_attr_const(a);
183 const be_node_attr_t *b_attr = get_irn_attr_const(b);
185 if(_node_cmp_attr(a_attr, b_attr) != 0)
188 return !be_info_equal(a, b);
192 * Compare the attributes of two be_FrameAddr nodes.
194 * @return zero if both nodes have identically attributes
196 static int FrameAddr_cmp_attr(ir_node *a, ir_node *b) {
197 const be_frame_attr_t *a_attr = get_irn_attr_const(a);
198 const be_frame_attr_t *b_attr = get_irn_attr_const(b);
200 if (a_attr->ent != b_attr->ent || a_attr->offset != b_attr->offset)
203 return _node_cmp_attr(&a_attr->node_attr, &b_attr->node_attr);
207 * Compare the attributes of two be_Return nodes.
209 * @return zero if both nodes have identically attributes
211 static int Return_cmp_attr(ir_node *a, ir_node *b) {
212 const be_return_attr_t *a_attr = get_irn_attr_const(a);
213 const be_return_attr_t *b_attr = get_irn_attr_const(b);
215 if (a_attr->num_ret_vals != b_attr->num_ret_vals)
217 if (a_attr->pop != b_attr->pop)
219 if (a_attr->emit_pop != b_attr->emit_pop)
222 return _node_cmp_attr(&a_attr->node_attr, &b_attr->node_attr);
226 * Compare the attributes of two be_IncSP nodes.
228 * @return zero if both nodes have identically attributes
230 static int IncSP_cmp_attr(ir_node *a, ir_node *b) {
231 const be_incsp_attr_t *a_attr = get_irn_attr_const(a);
232 const be_incsp_attr_t *b_attr = get_irn_attr_const(b);
234 if (a_attr->offset != b_attr->offset)
237 return _node_cmp_attr(&a_attr->node_attr, &b_attr->node_attr);
241 * Compare the attributes of two be_Call nodes.
243 * @return zero if both nodes have identically attributes
245 static int Call_cmp_attr(ir_node *a, ir_node *b) {
246 const be_call_attr_t *a_attr = get_irn_attr_const(a);
247 const be_call_attr_t *b_attr = get_irn_attr_const(b);
249 if (a_attr->ent != b_attr->ent ||
250 a_attr->call_tp != b_attr->call_tp)
253 return _node_cmp_attr(&a_attr->node_attr, &b_attr->node_attr);
256 static inline be_req_t *get_be_req(const ir_node *node, int pos)
259 const be_node_attr_t *attr;
262 assert(is_be_node(node));
263 attr = get_irn_attr_const(node);
269 assert(idx < get_irn_arity(node));
271 assert(idx < ARR_LEN(attr->reg_data));
272 rd = &attr->reg_data[idx];
274 return pos < 0 ? &rd->req : &rd->in_req;
277 static inline arch_register_req_t *get_req(const ir_node *node, int pos)
279 be_req_t *bereq = get_be_req(node, pos);
284 * Initializes the generic attribute of all be nodes and return ir.
286 static void *init_node_attr(ir_node *node, int max_reg_data)
288 ir_graph *irg = get_irn_irg(node);
289 struct obstack *obst = get_irg_obstack(irg);
290 be_node_attr_t *a = get_irn_attr(node);
292 memset(a, 0, sizeof(get_op_attr_size(get_irn_op(node))));
294 if(max_reg_data >= 0) {
295 backend_info_t *info = be_get_info(node);
296 info->out_infos = NEW_ARR_D(reg_out_info_t, obst, max_reg_data);
297 memset(info->out_infos, 0, max_reg_data * sizeof(info->out_infos[0]));
299 a->reg_data = NEW_ARR_D(be_reg_data_t, obst, max_reg_data);
300 memset(a->reg_data, 0, max_reg_data * sizeof(a->reg_data[0]));
302 backend_info_t *info = be_get_info(node);
303 info->out_infos = NEW_ARR_F(reg_out_info_t, 0);
305 a->reg_data = NEW_ARR_F(be_reg_data_t, 0);
311 static void add_register_req(ir_node *node)
313 backend_info_t *info = be_get_info(node);
314 be_node_attr_t *a = get_irn_attr(node);
315 be_reg_data_t regreq;
316 reg_out_info_t out_info;
317 memset(®req, 0, sizeof(regreq));
318 memset(&out_info, 0, sizeof(out_info));
319 ARR_APP1(be_reg_data_t, a->reg_data, regreq);
320 ARR_APP1(reg_out_info_t, info->out_infos, out_info);
324 * Skip Proj nodes and return their Proj numbers.
326 * If *node is a Proj or Proj(Proj) node, skip it.
328 * @param node points to the node to be skipped
330 * @return 0 if *node was no Proj node, its Proj number else.
332 static int redir_proj(const ir_node **node)
334 const ir_node *n = *node;
339 *node = irn = get_Proj_pred(n);
341 assert(get_irn_mode(irn) == mode_T);
342 *node = get_Proj_pred(irn);
344 return get_Proj_proj(n);
350 ir_node *be_new_Spill(const arch_register_class_t *cls, const arch_register_class_t *cls_frame,
351 ir_graph *irg, ir_node *bl, ir_node *frame, ir_node *to_spill)
359 res = new_ir_node(NULL, irg, bl, op_be_Spill, mode_M, 2, in);
360 a = init_node_attr(res, 2);
364 be_node_set_reg_class_in(res, be_pos_Spill_frame, cls_frame);
365 be_node_set_reg_class_in(res, be_pos_Spill_val, cls);
369 ir_node *be_new_Reload(const arch_register_class_t *cls,
370 const arch_register_class_t *cls_frame, ir_graph *irg, ir_node *block,
371 ir_node *frame, ir_node *mem, ir_mode *mode)
378 res = new_ir_node(NULL, irg, block, op_be_Reload, mode, 2, in);
380 init_node_attr(res, 2);
381 be_node_set_reg_class_out(res, 0, cls);
382 be_node_set_reg_class_in(res, be_pos_Reload_frame, cls_frame);
383 arch_irn_set_flags(res, arch_irn_flags_rematerializable);
387 ir_node *be_get_Reload_mem(const ir_node *irn)
389 assert(be_is_Reload(irn));
390 return get_irn_n(irn, be_pos_Reload_mem);
393 ir_node *be_get_Reload_frame(const ir_node *irn)
395 assert(be_is_Reload(irn));
396 return get_irn_n(irn, be_pos_Reload_frame);
399 ir_node *be_get_Spill_val(const ir_node *irn)
401 assert(be_is_Spill(irn));
402 return get_irn_n(irn, be_pos_Spill_val);
405 ir_node *be_get_Spill_frame(const ir_node *irn)
407 assert(be_is_Spill(irn));
408 return get_irn_n(irn, be_pos_Spill_frame);
411 ir_node *be_new_Perm(const arch_register_class_t *cls, ir_graph *irg,
412 ir_node *block, int n, ir_node *in[])
415 ir_node *irn = new_ir_node(NULL, irg, block, op_be_Perm, mode_T, n, in);
416 init_node_attr(irn, n);
417 for(i = 0; i < n; ++i) {
418 be_node_set_reg_class_in(irn, i, cls);
419 be_node_set_reg_class_out(irn, i, cls);
425 void be_Perm_reduce(ir_node *perm, int new_size, int *map)
427 int arity = get_irn_arity(perm);
428 be_reg_data_t *old_data = ALLOCAN(be_reg_data_t, arity);
429 reg_out_info_t *old_infos = ALLOCAN(reg_out_info_t, arity);
430 be_node_attr_t *attr = get_irn_attr(perm);
431 backend_info_t *info = be_get_info(perm);
436 assert(be_is_Perm(perm));
437 assert(new_size <= arity);
439 new_in = alloca(new_size * sizeof(*new_in));
441 /* save the old register data */
442 memcpy(old_data, attr->reg_data, arity * sizeof(old_data[0]));
443 memcpy(old_infos, info->out_infos, arity * sizeof(old_infos[0]));
445 /* compose the new in array and set the new register data directly in place */
446 for (i = 0; i < new_size; ++i) {
448 new_in[i] = get_irn_n(perm, idx);
449 attr->reg_data[i] = old_data[idx];
450 info->out_infos[i] = old_infos[idx];
453 set_irn_in(perm, new_size, new_in);
456 ir_node *be_new_MemPerm(const arch_env_t *arch_env, ir_graph *irg, ir_node *bl, int n, ir_node *in[])
458 ir_node *frame = get_irg_frame(irg);
459 const arch_register_class_t *cls_frame = arch_get_irn_reg_class_out(frame);
460 const arch_register_t *sp = arch_env->sp;
462 be_memperm_attr_t *attr;
466 real_in = ALLOCAN(ir_node*, n + 1);
468 memcpy(&real_in[1], in, n * sizeof(real_in[0]));
470 irn = new_ir_node(NULL, irg, bl, op_be_MemPerm, mode_T, n+1, real_in);
472 init_node_attr(irn, n + 1);
473 be_node_set_reg_class_in(irn, 0, sp->reg_class);
474 for (i = 0; i < n; ++i) {
475 be_node_set_reg_class_in(irn, i + 1, cls_frame);
476 be_node_set_reg_class_out(irn, i, cls_frame);
479 attr = get_irn_attr(irn);
481 attr->in_entities = obstack_alloc(irg->obst, n * sizeof(attr->in_entities[0]));
482 memset(attr->in_entities, 0, n * sizeof(attr->in_entities[0]));
483 attr->out_entities = obstack_alloc(irg->obst, n*sizeof(attr->out_entities[0]));
484 memset(attr->out_entities, 0, n*sizeof(attr->out_entities[0]));
490 ir_node *be_new_Copy(const arch_register_class_t *cls, ir_graph *irg, ir_node *bl, ir_node *op)
494 arch_register_req_t *req;
497 res = new_ir_node(NULL, irg, bl, op_be_Copy, get_irn_mode(op), 1, in);
498 init_node_attr(res, 1);
499 be_node_set_reg_class_in(res, 0, cls);
500 be_node_set_reg_class_out(res, 0, cls);
502 req = get_req(res, BE_OUT_POS(0));
504 req->type = arch_register_req_type_should_be_same;
505 req->other_same = 1U << 0;
510 ir_node *be_get_Copy_op(const ir_node *cpy) {
511 return get_irn_n(cpy, be_pos_Copy_op);
514 void be_set_Copy_op(ir_node *cpy, ir_node *op) {
515 set_irn_n(cpy, be_pos_Copy_op, op);
518 ir_node *be_new_Keep(const arch_register_class_t *cls, ir_graph *irg, ir_node *bl, int n, ir_node *in[])
523 res = new_ir_node(NULL, irg, bl, op_be_Keep, mode_ANY, -1, NULL);
524 init_node_attr(res, -1);
526 for(i = 0; i < n; ++i) {
527 add_irn_n(res, in[i]);
528 add_register_req(res);
529 be_node_set_reg_class_in(res, i, cls);
536 void be_Keep_add_node(ir_node *keep, const arch_register_class_t *cls, ir_node *node)
540 assert(be_is_Keep(keep));
541 n = add_irn_n(keep, node);
542 add_register_req(keep);
543 be_node_set_reg_class_in(keep, n, cls);
546 /* creates a be_Call */
547 ir_node *be_new_Call(dbg_info *dbg, ir_graph *irg, ir_node *bl, ir_node *mem, ir_node *sp, ir_node *ptr,
548 int n_outs, int n, ir_node *in[], ir_type *call_tp)
551 int real_n = be_pos_Call_first_arg + n;
555 NEW_ARR_A(ir_node *, real_in, real_n);
556 real_in[be_pos_Call_mem] = mem;
557 real_in[be_pos_Call_sp] = sp;
558 real_in[be_pos_Call_ptr] = ptr;
559 memcpy(&real_in[be_pos_Call_first_arg], in, n * sizeof(in[0]));
561 irn = new_ir_node(dbg, irg, bl, op_be_Call, mode_T, real_n, real_in);
562 a = init_node_attr(irn, (n_outs > real_n ? n_outs : real_n));
564 a->call_tp = call_tp;
569 /* Gets the call entity or NULL if this is no static call. */
570 ir_entity *be_Call_get_entity(const ir_node *call) {
571 const be_call_attr_t *a = get_irn_attr_const(call);
572 assert(be_is_Call(call));
576 /* Sets the call entity. */
577 void be_Call_set_entity(ir_node *call, ir_entity *ent) {
578 be_call_attr_t *a = get_irn_attr(call);
579 assert(be_is_Call(call));
583 /* Gets the call type. */
584 ir_type *be_Call_get_type(ir_node *call) {
585 const be_call_attr_t *a = get_irn_attr_const(call);
586 assert(be_is_Call(call));
590 /* Sets the call type. */
591 void be_Call_set_type(ir_node *call, ir_type *call_tp) {
592 be_call_attr_t *a = get_irn_attr(call);
593 assert(be_is_Call(call));
594 a->call_tp = call_tp;
597 void be_Call_set_pop(ir_node *call, unsigned pop) {
598 be_call_attr_t *a = get_irn_attr(call);
602 unsigned be_Call_get_pop(const ir_node *call) {
603 const be_call_attr_t *a = get_irn_attr_const(call);
607 /* Construct a new be_Return. */
608 ir_node *be_new_Return(dbg_info *dbg, ir_graph *irg, ir_node *block, int n_res,
609 unsigned pop, int n, ir_node *in[])
615 res = new_ir_node(dbg, irg, block, op_be_Return, mode_X, -1, NULL);
616 init_node_attr(res, -1);
617 for(i = 0; i < n; ++i) {
618 add_irn_n(res, in[i]);
619 add_register_req(res);
622 a = get_irn_attr(res);
623 a->num_ret_vals = n_res;
630 /* Returns the number of real returns values */
631 int be_Return_get_n_rets(const ir_node *ret) {
632 const be_return_attr_t *a = get_irn_generic_attr_const(ret);
633 return a->num_ret_vals;
636 /* return the number of bytes that should be popped from stack when executing the Return. */
637 unsigned be_Return_get_pop(const ir_node *ret) {
638 const be_return_attr_t *a = get_irn_generic_attr_const(ret);
642 /* return non-zero, if number of popped bytes must be always emitted */
643 int be_Return_get_emit_pop(const ir_node *ret) {
644 const be_return_attr_t *a = get_irn_generic_attr_const(ret);
648 /* return non-zero, if number of popped bytes must be always emitted */
649 void be_Return_set_emit_pop(ir_node *ret, int emit_pop) {
650 be_return_attr_t *a = get_irn_generic_attr(ret);
651 a->emit_pop = emit_pop;
654 int be_Return_append_node(ir_node *ret, ir_node *node) {
657 pos = add_irn_n(ret, node);
658 add_register_req(ret);
663 ir_node *be_new_IncSP(const arch_register_t *sp, ir_graph *irg, ir_node *bl,
664 ir_node *old_sp, int offset, int align)
671 irn = new_ir_node(NULL, irg, bl, op_be_IncSP, sp->reg_class->mode,
672 sizeof(in) / sizeof(in[0]), in);
673 a = init_node_attr(irn, 1);
677 /* Set output constraint to stack register. */
678 be_node_set_reg_class_in(irn, 0, sp->reg_class);
679 be_set_constr_single_reg_out(irn, 0, sp, arch_register_req_type_produces_sp);
684 ir_node *be_new_AddSP(const arch_register_t *sp, ir_graph *irg, ir_node *bl, ir_node *old_sp, ir_node *sz)
688 ir_node *in[be_pos_AddSP_last];
689 const arch_register_class_t *cls;
691 in[be_pos_AddSP_old_sp] = old_sp;
692 in[be_pos_AddSP_size] = sz;
694 irn = new_ir_node(NULL, irg, bl, op_be_AddSP, mode_T, be_pos_AddSP_last, in);
695 a = init_node_attr(irn, be_pos_AddSP_last);
697 /* Set output constraint to stack register. */
698 be_set_constr_single_reg_in(irn, be_pos_AddSP_old_sp, sp, 0);
699 be_node_set_reg_class_in(irn, be_pos_AddSP_size, arch_register_get_class(sp));
700 be_set_constr_single_reg_out(irn, pn_be_AddSP_sp, sp, arch_register_req_type_produces_sp);
702 cls = arch_register_get_class(sp);
707 ir_node *be_new_SubSP(const arch_register_t *sp, ir_graph *irg, ir_node *bl, ir_node *old_sp, ir_node *sz)
711 ir_node *in[be_pos_SubSP_last];
713 in[be_pos_SubSP_old_sp] = old_sp;
714 in[be_pos_SubSP_size] = sz;
716 irn = new_ir_node(NULL, irg, bl, op_be_SubSP, mode_T, be_pos_SubSP_last, in);
717 a = init_node_attr(irn, be_pos_SubSP_last);
719 /* Set output constraint to stack register. */
720 be_set_constr_single_reg_in(irn, be_pos_SubSP_old_sp, sp, 0);
721 be_node_set_reg_class_in(irn, be_pos_SubSP_size, arch_register_get_class(sp));
722 be_set_constr_single_reg_out(irn, pn_be_SubSP_sp, sp, arch_register_req_type_produces_sp);
727 ir_node *be_new_RegParams(ir_graph *irg, ir_node *bl, int n_outs)
732 res = new_ir_node(NULL, irg, bl, op_be_RegParams, mode_T, 0, NULL);
733 init_node_attr(res, -1);
734 for(i = 0; i < n_outs; ++i)
735 add_register_req(res);
740 ir_node *be_new_FrameAddr(const arch_register_class_t *cls_frame, ir_graph *irg, ir_node *bl, ir_node *frame, ir_entity *ent)
747 irn = new_ir_node(NULL, irg, bl, op_be_FrameAddr, get_irn_mode(frame), 1, in);
748 a = init_node_attr(irn, 1);
751 be_node_set_reg_class_in(irn, 0, cls_frame);
752 be_node_set_reg_class_out(irn, 0, cls_frame);
754 return optimize_node(irn);
757 ir_node *be_get_FrameAddr_frame(const ir_node *node) {
758 assert(be_is_FrameAddr(node));
759 return get_irn_n(node, be_pos_FrameAddr_ptr);
762 ir_entity *be_get_FrameAddr_entity(const ir_node *node)
764 const be_frame_attr_t *attr = get_irn_generic_attr_const(node);
768 ir_node *be_new_CopyKeep(const arch_register_class_t *cls, ir_graph *irg, ir_node *bl, ir_node *src, int n, ir_node *in_keep[], ir_mode *mode)
771 ir_node **in = ALLOCAN(ir_node*, n + 1);
774 memcpy(&in[1], in_keep, n * sizeof(in[0]));
775 irn = new_ir_node(NULL, irg, bl, op_be_CopyKeep, mode, n + 1, in);
776 init_node_attr(irn, n + 1);
777 be_node_set_reg_class_in(irn, 0, cls);
778 be_node_set_reg_class_out(irn, 0, cls);
783 ir_node *be_new_CopyKeep_single(const arch_register_class_t *cls, ir_graph *irg, ir_node *bl, ir_node *src, ir_node *keep, ir_mode *mode)
785 return be_new_CopyKeep(cls, irg, bl, src, 1, &keep, mode);
788 ir_node *be_get_CopyKeep_op(const ir_node *cpy) {
789 return get_irn_n(cpy, be_pos_CopyKeep_op);
792 void be_set_CopyKeep_op(ir_node *cpy, ir_node *op) {
793 set_irn_n(cpy, be_pos_CopyKeep_op, op);
796 ir_node *be_new_Barrier(ir_graph *irg, ir_node *bl, int n, ir_node *in[])
801 res = new_ir_node(NULL, irg, bl, op_be_Barrier, mode_T, -1, NULL);
802 init_node_attr(res, -1);
803 for(i = 0; i < n; ++i) {
804 add_irn_n(res, in[i]);
805 add_register_req(res);
811 ir_node *be_Barrier_append_node(ir_node *barrier, ir_node *node)
813 ir_graph *irg = get_irn_irg(barrier);
814 ir_node *block = get_nodes_block(barrier);
815 ir_mode *mode = get_irn_mode(node);
816 int n = add_irn_n(barrier, node);
818 ir_node *proj = new_r_Proj(irg, block, barrier, mode, n);
819 add_register_req(barrier);
824 /* Construct a new be_Unwind. */
825 ir_node *be_new_Unwind(dbg_info *dbg, ir_graph *irg, ir_node *block,
826 ir_node *mem, ir_node *sp)
831 in[be_pos_Unwind_mem] = mem;
832 in[be_pos_Unwind_sp] = sp;
833 res = new_ir_node(dbg, irg, block, op_be_Unwind, mode_X, 2, in);
834 init_node_attr(res, -1);
839 int be_has_frame_entity(const ir_node *irn)
841 switch (get_irn_opcode(irn)) {
851 ir_entity *be_get_frame_entity(const ir_node *irn)
853 if (be_has_frame_entity(irn)) {
854 const be_frame_attr_t *a = get_irn_attr_const(irn);
860 int be_get_frame_offset(const ir_node *irn)
862 assert(is_be_node(irn));
863 if (be_has_frame_entity(irn)) {
864 const be_frame_attr_t *a = get_irn_attr_const(irn);
870 void be_set_MemPerm_in_entity(const ir_node *irn, int n, ir_entity *ent)
872 const be_memperm_attr_t *attr = get_irn_attr_const(irn);
874 assert(be_is_MemPerm(irn));
875 assert(n < be_get_MemPerm_entity_arity(irn));
877 attr->in_entities[n] = ent;
880 ir_entity* be_get_MemPerm_in_entity(const ir_node* irn, int n)
882 const be_memperm_attr_t *attr = get_irn_attr_const(irn);
884 assert(be_is_MemPerm(irn));
885 assert(n < be_get_MemPerm_entity_arity(irn));
887 return attr->in_entities[n];
890 void be_set_MemPerm_out_entity(const ir_node *irn, int n, ir_entity *ent)
892 const be_memperm_attr_t *attr = get_irn_attr_const(irn);
894 assert(be_is_MemPerm(irn));
895 assert(n < be_get_MemPerm_entity_arity(irn));
897 attr->out_entities[n] = ent;
900 ir_entity* be_get_MemPerm_out_entity(const ir_node* irn, int n)
902 const be_memperm_attr_t *attr = get_irn_attr_const(irn);
904 assert(be_is_MemPerm(irn));
905 assert(n < be_get_MemPerm_entity_arity(irn));
907 return attr->out_entities[n];
910 int be_get_MemPerm_entity_arity(const ir_node *irn)
912 return get_irn_arity(irn) - 1;
915 static void set_req_single(struct obstack *obst, arch_register_req_t *req,
916 const arch_register_t *reg, arch_register_req_type_t additional_types)
918 const arch_register_class_t *cls = arch_register_get_class(reg);
919 unsigned *limited_bitset;
921 limited_bitset = rbitset_obstack_alloc(obst, arch_register_class_n_regs(cls));
922 rbitset_set(limited_bitset, arch_register_get_index(reg));
925 req->type |= arch_register_req_type_limited | additional_types;
926 req->limited = limited_bitset;
930 void be_set_constr_single_reg_in(ir_node *node, int pos,
931 const arch_register_t *reg, arch_register_req_type_t additional_types)
933 arch_register_req_t *req = get_req(node, pos);
934 ir_graph *irg = get_irn_irg(node);
935 struct obstack *obst = get_irg_obstack(irg);
937 set_req_single(obst, req, reg, additional_types);
940 void be_set_constr_single_reg_out(ir_node *node, int pos,
941 const arch_register_t *reg, arch_register_req_type_t additional_types)
943 arch_register_req_t *req = get_req(node, BE_OUT_POS(pos));
944 ir_graph *irg = get_irn_irg(node);
945 struct obstack *obst = get_irg_obstack(irg);
947 /* if we have an ignore register, add ignore flag and just assign it */
948 if (reg->type & arch_register_type_ignore) {
949 additional_types |= arch_register_req_type_ignore;
952 arch_irn_set_register(node, pos, reg);
953 set_req_single(obst, req, reg, additional_types);
956 void be_set_constr_limited(ir_node *node, int pos, const arch_register_req_t *req)
958 ir_graph *irg = get_irn_irg(node);
959 struct obstack *obst = get_irg_obstack(irg);
960 arch_register_req_t *r = get_req(node, pos);
962 assert(arch_register_req_is(req, limited));
963 assert(!(req->type & (arch_register_req_type_should_be_same | arch_register_req_type_must_be_different)));
964 memcpy(r, req, sizeof(r[0]));
965 r->limited = rbitset_duplicate_obstack_alloc(obst, req->limited, req->cls->n_regs);
968 void be_node_set_reg_class_in(ir_node *irn, int pos, const arch_register_class_t *cls)
970 arch_register_req_t *req = get_req(irn, 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_reg_class_out(ir_node *irn, int pos, const arch_register_class_t *cls)
983 arch_register_req_t *req = get_req(irn, BE_OUT_POS(pos));
988 req->type = arch_register_req_type_none;
989 } else if (req->type == arch_register_req_type_none) {
990 req->type = arch_register_req_type_normal;
994 void be_node_set_req_type(ir_node *irn, int pos, arch_register_req_type_t type)
996 arch_register_req_t *req = get_req(irn, pos);
1000 ir_node *be_get_IncSP_pred(ir_node *irn) {
1001 assert(be_is_IncSP(irn));
1002 return get_irn_n(irn, 0);
1005 void be_set_IncSP_pred(ir_node *incsp, ir_node *pred) {
1006 assert(be_is_IncSP(incsp));
1007 set_irn_n(incsp, 0, pred);
1010 void be_set_IncSP_offset(ir_node *irn, int offset)
1012 be_incsp_attr_t *a = get_irn_attr(irn);
1013 assert(be_is_IncSP(irn));
1017 int be_get_IncSP_offset(const ir_node *irn)
1019 const be_incsp_attr_t *a = get_irn_attr_const(irn);
1020 assert(be_is_IncSP(irn));
1024 int be_get_IncSP_align(const ir_node *irn)
1026 const be_incsp_attr_t *a = get_irn_attr_const(irn);
1027 assert(be_is_IncSP(irn));
1031 ir_node *be_spill(ir_node *block, ir_node *irn)
1033 ir_graph *irg = get_irn_irg(block);
1034 ir_node *frame = get_irg_frame(irg);
1035 const arch_register_class_t *cls = arch_get_irn_reg_class_out(irn);
1036 const arch_register_class_t *cls_frame = arch_get_irn_reg_class_out(frame);
1039 spill = be_new_Spill(cls, cls_frame, irg, block, frame, irn);
1043 ir_node *be_reload(const arch_register_class_t *cls, ir_node *insert, ir_mode *mode, ir_node *spill)
1046 ir_node *bl = is_Block(insert) ? insert : get_nodes_block(insert);
1047 ir_graph *irg = get_irn_irg(bl);
1048 ir_node *frame = get_irg_frame(irg);
1049 const arch_register_class_t *cls_frame = arch_get_irn_reg_class_out(frame);
1051 assert(be_is_Spill(spill) || (is_Phi(spill) && get_irn_mode(spill) == mode_M));
1053 reload = be_new_Reload(cls, cls_frame, irg, bl, frame, spill, mode);
1055 if (is_Block(insert)) {
1056 insert = sched_skip(insert, 0, sched_skip_cf_predicator, NULL);
1057 sched_add_after(insert, reload);
1059 sched_add_before(insert, reload);
1067 | _ \ ___ __ _ | _ \ ___ __ _ ___
1068 | |_) / _ \/ _` | | |_) / _ \/ _` / __|
1069 | _ < __/ (_| | | _ < __/ (_| \__ \
1070 |_| \_\___|\__, | |_| \_\___|\__, |___/
1077 arch_register_req_t *get_out_reg_req(const ir_node *irn, int out_pos)
1079 const be_node_attr_t *a = get_irn_attr_const(irn);
1081 if(out_pos >= ARR_LEN(a->reg_data)) {
1082 return arch_no_register_req;
1085 return &a->reg_data[out_pos].req.req;
1089 arch_register_req_t *get_in_reg_req(const ir_node *irn, int pos)
1091 const be_node_attr_t *a = get_irn_attr_const(irn);
1093 if(pos >= get_irn_arity(irn) || pos >= ARR_LEN(a->reg_data))
1094 return arch_no_register_req;
1096 return &a->reg_data[pos].in_req.req;
1099 static const arch_register_req_t *
1100 be_node_get_irn_reg_req(const ir_node *irn, int pos)
1105 if (get_irn_mode(irn) == mode_T)
1106 return arch_no_register_req;
1109 out_pos = redir_proj((const ir_node **)&irn);
1110 assert(is_be_node(irn));
1111 return get_out_reg_req(irn, out_pos);
1112 } else if (is_be_node(irn)) {
1114 * For spills and reloads, we return "none" as requirement for frame
1115 * pointer, so every input is ok. Some backends need this (e.g. STA).
1117 if ((be_is_Spill(irn) && pos == be_pos_Spill_frame) ||
1118 (be_is_Reload(irn) && pos == be_pos_Reload_frame))
1119 return arch_no_register_req;
1121 return get_in_reg_req(irn, pos);
1124 return arch_no_register_req;
1127 static arch_irn_class_t be_node_classify(const ir_node *irn)
1130 switch (get_irn_opcode(irn)) {
1131 #define XXX(a,b) case a: return b
1132 XXX(beo_Spill, arch_irn_class_spill);
1133 XXX(beo_Reload, arch_irn_class_reload);
1134 XXX(beo_Perm, arch_irn_class_perm);
1135 XXX(beo_Copy, arch_irn_class_copy);
1136 XXX(beo_Return, arch_irn_class_branch);
1139 irn = get_Proj_pred(irn);
1141 assert(get_irn_mode(irn) == mode_T);
1142 irn = get_Proj_pred(irn);
1151 static ir_entity *be_node_get_frame_entity(const ir_node *irn)
1153 return be_get_frame_entity(irn);
1156 static void be_node_set_frame_entity(ir_node *irn, ir_entity *ent)
1160 assert(be_has_frame_entity(irn));
1162 a = get_irn_attr(irn);
1166 static void be_node_set_frame_offset(ir_node *irn, int offset)
1168 if(be_has_frame_entity(irn)) {
1169 be_frame_attr_t *a = get_irn_attr(irn);
1174 static int be_node_get_sp_bias(const ir_node *irn)
1176 if(be_is_IncSP(irn))
1177 return be_get_IncSP_offset(irn);
1179 return -(int)be_Call_get_pop(irn);
1185 ___ ____ _ _ _ _ _ _
1186 |_ _| _ \| \ | | | | | | __ _ _ __ __| | | ___ _ __
1187 | || |_) | \| | | |_| |/ _` | '_ \ / _` | |/ _ \ '__|
1188 | || _ <| |\ | | _ | (_| | | | | (_| | | __/ |
1189 |___|_| \_\_| \_| |_| |_|\__,_|_| |_|\__,_|_|\___|_|
1193 static const arch_irn_ops_t be_node_irn_ops = {
1194 be_node_get_irn_reg_req,
1196 be_node_get_frame_entity,
1197 be_node_set_frame_entity,
1198 be_node_set_frame_offset,
1199 be_node_get_sp_bias,
1200 NULL, /* get_inverse */
1201 NULL, /* get_op_estimated_cost */
1202 NULL, /* possible_memory_operand */
1203 NULL, /* perform_memory_operand */
1207 ____ _ _ ___ ____ _ _ _ _ _ _
1208 | _ \| |__ (_) |_ _| _ \| \ | | | | | | __ _ _ __ __| | | ___ _ __
1209 | |_) | '_ \| | | || |_) | \| | | |_| |/ _` | '_ \ / _` | |/ _ \ '__|
1210 | __/| | | | | | || _ <| |\ | | _ | (_| | | | | (_| | | __/ |
1211 |_| |_| |_|_| |___|_| \_\_| \_| |_| |_|\__,_|_| |_|\__,_|_|\___|_|
1216 const arch_register_t *reg;
1217 arch_register_req_t req;
1218 arch_irn_flags_t flags;
1225 #define get_phi_handler_from_ops(h) container_of(h, phi_handler_t, irn_ops)
1228 phi_attr_t *get_Phi_attr(const ir_node *phi)
1230 phi_attr_t *attr = pmap_get(phi_handler.phi_attrs, (void*) phi);
1232 ir_graph *irg = get_irn_irg(phi);
1233 struct obstack *obst = get_irg_obstack(irg);
1234 attr = obstack_alloc(obst, sizeof(attr[0]));
1235 memset(attr, 0, sizeof(attr[0]));
1236 pmap_insert(phi_handler.phi_attrs, phi, attr);
1243 * Get register class of a Phi.
1246 const arch_register_req_t *get_Phi_reg_req_recursive(const ir_node *phi,
1249 int n = get_irn_arity(phi);
1253 if(*visited && pset_find_ptr(*visited, phi))
1256 for(i = 0; i < n; ++i) {
1257 op = get_irn_n(phi, i);
1258 /* Matze: don't we unnecessary constraint our phis with this?
1259 * we only need to take the regclass IMO*/
1261 return arch_get_register_req_out(op);
1265 * The operands of that Phi were all Phis themselves.
1266 * We have to start a DFS for a non-Phi argument now.
1269 *visited = pset_new_ptr(16);
1271 pset_insert_ptr(*visited, phi);
1273 for(i = 0; i < n; ++i) {
1274 const arch_register_req_t *req;
1275 op = get_irn_n(phi, i);
1276 req = get_Phi_reg_req_recursive(op, visited);
1285 const arch_register_req_t *phi_get_irn_reg_req(const ir_node *irn, int pos)
1290 if(!mode_is_datab(get_irn_mode(irn)))
1291 return arch_no_register_req;
1293 attr = get_Phi_attr(irn);
1295 if(attr->req.type == arch_register_req_type_none) {
1296 pset *visited = NULL;
1297 const arch_register_req_t *req;
1298 req = get_Phi_reg_req_recursive(irn, &visited);
1301 assert(attr->req.cls != NULL);
1302 attr->req.type = arch_register_req_type_normal;
1311 void be_set_phi_reg_req(ir_node *node, const arch_register_req_t *req,
1312 arch_register_req_type_t additional_types)
1316 assert(mode_is_datab(get_irn_mode(node)));
1318 attr = get_Phi_attr(node);
1320 attr->req.type |= additional_types;
1323 void be_set_phi_flags(ir_node *node, arch_irn_flags_t flags)
1327 assert(mode_is_datab(get_irn_mode(node)));
1329 attr = get_Phi_attr(node);
1330 attr->flags = flags;
1333 static arch_irn_class_t phi_classify(const ir_node *irn)
1339 static ir_entity *phi_get_frame_entity(const ir_node *irn)
1345 static void phi_set_frame_entity(ir_node *irn, ir_entity *ent)
1349 panic("phi_set_frame_entity() should not be called");
1352 static void phi_set_frame_offset(ir_node *irn, int bias)
1356 panic("phi_set_frame_offset() should not be called");
1359 static int phi_get_sp_bias(const ir_node *irn)
1365 static const arch_irn_ops_t phi_irn_ops = {
1366 phi_get_irn_reg_req,
1368 phi_get_frame_entity,
1369 phi_set_frame_entity,
1370 phi_set_frame_offset,
1372 NULL, /* get_inverse */
1373 NULL, /* get_op_estimated_cost */
1374 NULL, /* possible_memory_operand */
1375 NULL, /* perform_memory_operand */
1378 void be_phi_handler_new(void)
1380 phi_handler.phi_attrs = pmap_create();
1381 op_Phi->ops.be_ops = &phi_irn_ops;
1384 void be_phi_handler_free(void)
1386 pmap_destroy(phi_handler.phi_attrs);
1387 phi_handler.phi_attrs = NULL;
1388 op_Phi->ops.be_ops = NULL;
1391 void be_phi_handler_reset(void)
1393 if(phi_handler.phi_attrs)
1394 pmap_destroy(phi_handler.phi_attrs);
1395 phi_handler.phi_attrs = pmap_create();
1400 | \ | | ___ __| | ___ | _ \ _ _ _ __ ___ _ __ (_)_ __ __ _
1401 | \| |/ _ \ / _` |/ _ \ | | | | | | | '_ ` _ \| '_ \| | '_ \ / _` |
1402 | |\ | (_) | (_| | __/ | |_| | |_| | | | | | | |_) | | | | | (_| |
1403 |_| \_|\___/ \__,_|\___| |____/ \__,_|_| |_| |_| .__/|_|_| |_|\__, |
1408 * Dumps a register requirement to a file.
1410 static void dump_node_req(FILE *f, int idx, const arch_register_req_t *req,
1411 const ir_node *node)
1415 if (req->cls == NULL) return;
1417 arch_register_req_format(tmp, sizeof(tmp), req, node);
1418 fprintf(f, "#%d %s\n", idx, tmp);
1422 * Dumps node register requirements to a file.
1424 static void dump_node_reqs(FILE *f, ir_node *node)
1427 be_node_attr_t *a = get_irn_attr(node);
1428 int len = ARR_LEN(a->reg_data);
1430 fprintf(f, "registers: \n");
1431 for(i = 0; i < len; ++i) {
1432 const arch_register_t *reg = arch_irn_get_register(node, i);
1433 fprintf(f, "#%d: %s\n", i, reg != NULL ? reg->name : "n/a");
1436 fprintf(f, "in requirements:\n");
1437 for(i = 0; i < len; ++i) {
1438 dump_node_req(f, i, &a->reg_data[i].in_req.req, node);
1441 fprintf(f, "\nout requirements:\n");
1442 for(i = 0; i < len; ++i) {
1443 dump_node_req(f, i, &a->reg_data[i].req.req, node);
1448 * ir_op-Operation: dump a be node to file
1450 static int dump_node(ir_node *irn, FILE *f, dump_reason_t reason)
1452 be_node_attr_t *at = get_irn_attr(irn);
1454 assert(is_be_node(irn));
1457 case dump_node_opcode_txt:
1458 fputs(get_op_name(get_irn_op(irn)), f);
1460 case dump_node_mode_txt:
1461 if(be_is_Perm(irn) || be_is_Copy(irn) || be_is_CopyKeep(irn)) {
1462 fprintf(f, " %s", get_mode_name(get_irn_mode(irn)));
1465 case dump_node_nodeattr_txt:
1466 if(be_is_Call(irn)) {
1467 be_call_attr_t *a = (be_call_attr_t *) at;
1469 fprintf(f, " [%s] ", get_entity_name(a->ent));
1471 if(be_is_IncSP(irn)) {
1472 const be_incsp_attr_t *attr = get_irn_generic_attr_const(irn);
1473 if(attr->offset == BE_STACK_FRAME_SIZE_EXPAND) {
1474 fprintf(f, " [Setup Stackframe] ");
1475 } else if(attr->offset == BE_STACK_FRAME_SIZE_SHRINK) {
1476 fprintf(f, " [Destroy Stackframe] ");
1478 fprintf(f, " [%d] ", attr->offset);
1482 case dump_node_info_txt:
1483 dump_node_reqs(f, irn);
1485 if(be_has_frame_entity(irn)) {
1486 be_frame_attr_t *a = (be_frame_attr_t *) at;
1488 unsigned size = get_type_size_bytes(get_entity_type(a->ent));
1489 ir_fprintf(f, "frame entity: %+F, offset 0x%x (%d), size 0x%x (%d) bytes\n",
1490 a->ent, a->offset, a->offset, size, size);
1495 switch (get_irn_opcode(irn)) {
1498 be_incsp_attr_t *a = (be_incsp_attr_t *) at;
1499 if (a->offset == BE_STACK_FRAME_SIZE_EXPAND)
1500 fprintf(f, "offset: FRAME_SIZE\n");
1501 else if(a->offset == BE_STACK_FRAME_SIZE_SHRINK)
1502 fprintf(f, "offset: -FRAME SIZE\n");
1504 fprintf(f, "offset: %u\n", a->offset);
1509 be_call_attr_t *a = (be_call_attr_t *) at;
1512 fprintf(f, "\ncalling: %s\n", get_entity_name(a->ent));
1518 for(i = 0; i < be_get_MemPerm_entity_arity(irn); ++i) {
1519 ir_entity *in, *out;
1520 in = be_get_MemPerm_in_entity(irn, i);
1521 out = be_get_MemPerm_out_entity(irn, i);
1523 fprintf(f, "\nin[%d]: %s\n", i, get_entity_name(in));
1526 fprintf(f, "\nout[%d]: %s\n", i, get_entity_name(out));
1542 * Copies the backend specific attributes from old node to new node.
1544 static void copy_attr(const ir_node *old_node, ir_node *new_node)
1546 const be_node_attr_t *old_attr = get_irn_attr_const(old_node);
1547 be_node_attr_t *new_attr = get_irn_attr(new_node);
1548 struct obstack *obst = get_irg_obstack(get_irn_irg(new_node));
1549 backend_info_t *old_info = be_get_info(old_node);
1550 backend_info_t *new_info = be_get_info(new_node);
1553 assert(is_be_node(old_node));
1554 assert(is_be_node(new_node));
1556 memcpy(new_attr, old_attr, get_op_attr_size(get_irn_op(old_node)));
1557 new_attr->reg_data = NULL;
1559 if(old_attr->reg_data != NULL)
1560 len = ARR_LEN(old_attr->reg_data);
1564 if(get_irn_op(old_node)->opar == oparity_dynamic
1565 || be_is_RegParams(old_node)) {
1566 new_attr->reg_data = NEW_ARR_F(be_reg_data_t, len);
1567 new_info->out_infos = NEW_ARR_F(reg_out_info_t, len);
1569 new_attr->reg_data = NEW_ARR_D(be_reg_data_t, obst, len);
1570 new_info->out_infos = NEW_ARR_D(reg_out_info_t, obst, len);
1574 memcpy(new_attr->reg_data, old_attr->reg_data, len * sizeof(be_reg_data_t));
1575 memcpy(new_info->out_infos, old_info->out_infos, len * sizeof(new_info->out_infos[0]));
1576 for(i = 0; i < len; ++i) {
1577 const be_reg_data_t *rd = &old_attr->reg_data[i];
1578 be_reg_data_t *newrd = &new_attr->reg_data[i];
1579 if(arch_register_req_is(&rd->req.req, limited)) {
1580 const arch_register_req_t *req = &rd->req.req;
1581 arch_register_req_t *new_req = &newrd->req.req;
1583 = rbitset_duplicate_obstack_alloc(obst, req->limited, req->cls->n_regs);
1585 if(arch_register_req_is(&rd->in_req.req, limited)) {
1586 const arch_register_req_t *req = &rd->in_req.req;
1587 arch_register_req_t *new_req = &newrd->in_req.req;
1589 = rbitset_duplicate_obstack_alloc(obst, req->limited, req->cls->n_regs);
1595 static const ir_op_ops be_node_op_ops = {
1616 int is_be_node(const ir_node *irn)
1618 return get_op_ops(get_irn_op(irn))->be_ops == &be_node_irn_ops;
1621 void be_node_init(void) {
1622 static int inited = 0;
1629 /* Acquire all needed opcodes. */
1630 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);
1631 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);
1632 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);
1633 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);
1634 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);
1635 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);
1636 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);
1637 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);
1638 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);
1639 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);
1640 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);
1641 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);
1642 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);
1643 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);
1644 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);
1645 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);
1647 op_be_Spill->ops.node_cmp_attr = FrameAddr_cmp_attr;
1648 op_be_Reload->ops.node_cmp_attr = FrameAddr_cmp_attr;
1649 op_be_Perm->ops.node_cmp_attr = node_cmp_attr;
1650 op_be_MemPerm->ops.node_cmp_attr = node_cmp_attr;
1651 op_be_Copy->ops.node_cmp_attr = node_cmp_attr;
1652 op_be_Keep->ops.node_cmp_attr = node_cmp_attr;
1653 op_be_CopyKeep->ops.node_cmp_attr = node_cmp_attr;
1654 op_be_Call->ops.node_cmp_attr = Call_cmp_attr;
1655 op_be_Return->ops.node_cmp_attr = Return_cmp_attr;
1656 op_be_AddSP->ops.node_cmp_attr = node_cmp_attr;
1657 op_be_SubSP->ops.node_cmp_attr = node_cmp_attr;
1658 op_be_IncSP->ops.node_cmp_attr = IncSP_cmp_attr;
1659 op_be_RegParams->ops.node_cmp_attr = node_cmp_attr;
1660 op_be_FrameAddr->ops.node_cmp_attr = FrameAddr_cmp_attr;
1661 op_be_Barrier->ops.node_cmp_attr = node_cmp_attr;
1662 op_be_Unwind->ops.node_cmp_attr = node_cmp_attr;