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.
43 #include "bitfiddle.h"
44 #include "raw_bitset.h"
56 #include "besched_t.h"
62 #define OUT_POS(x) (-((x) + 1))
64 #define get_irn_attr(irn) get_irn_generic_attr(irn)
65 #define get_irn_attr_const(irn) get_irn_generic_attr_const(irn)
68 arch_register_req_t req;
69 arch_irn_flags_t flags;
73 const arch_register_t *reg;
78 /** The generic be nodes attribute type. */
80 be_reg_data_t *reg_data;
83 /** The be_Return nodes attribute type. */
85 be_node_attr_t node_attr; /**< base attributes of every be node. */
86 int num_ret_vals; /**< number of return values */
87 unsigned pop; /**< number of bytes that should be popped */
88 int emit_pop; /**< if set, emit pop bytes, even if pop = 0 */
91 /** The be_IncSP attribute type. */
93 be_node_attr_t node_attr; /**< base attributes of every be node. */
94 int offset; /**< The offset by which the stack shall be expanded/shrinked. */
95 int align; /**< whether stack should be aligned after the
99 /** The be_Frame attribute type. */
101 be_node_attr_t node_attr; /**< base attributes of every be node. */
106 /** The be_Call attribute type. */
108 be_node_attr_t node_attr; /**< base attributes of every be node. */
109 ir_entity *ent; /**< The called entity if this is a static call. */
111 ir_type *call_tp; /**< The call type, copied from the original Call node. */
115 be_node_attr_t node_attr; /**< base attributes of every be node. */
116 ir_entity **in_entities;
117 ir_entity **out_entities;
123 ir_op *op_be_MemPerm;
126 ir_op *op_be_CopyKeep;
132 ir_op *op_be_RegParams;
133 ir_op *op_be_FrameAddr;
134 ir_op *op_be_Barrier;
137 static const ir_op_ops be_node_op_ops;
139 #define N irop_flag_none
140 #define L irop_flag_labeled
141 #define C irop_flag_commutative
142 #define X irop_flag_cfopcode
143 #define I irop_flag_ip_cfopcode
144 #define F irop_flag_fragile
145 #define Y irop_flag_forking
146 #define H irop_flag_highlevel
147 #define c irop_flag_constlike
148 #define K irop_flag_keep
149 #define M irop_flag_uses_memory
151 static int be_reqs_equal(const be_req_t *req1, const be_req_t *req2)
153 if(!reg_reqs_equal(&req1->req, &req2->req))
155 if(req1->flags != req2->flags)
162 * Compare two be node attributes.
164 * @return zero if both attributes are identically
166 static int _node_cmp_attr(const be_node_attr_t *a, const be_node_attr_t *b) {
169 if (ARR_LEN(a->reg_data) != ARR_LEN(b->reg_data))
172 len = ARR_LEN(a->reg_data);
173 for (i = 0; i < len; ++i) {
174 if (a->reg_data[i].reg != b->reg_data[i].reg ||
175 !be_reqs_equal(&a->reg_data[i].in_req, &b->reg_data[i].in_req) ||
176 !be_reqs_equal(&a->reg_data[i].req, &b->reg_data[i].req))
184 * Compare the node attributes of two be_node's.
186 * @return zero if both nodes have identically attributes
188 static int node_cmp_attr(ir_node *a, ir_node *b) {
189 const be_node_attr_t *a_attr = get_irn_attr_const(a);
190 const be_node_attr_t *b_attr = get_irn_attr_const(b);
192 return _node_cmp_attr(a_attr, b_attr);
196 * Compare the attributes of two be_FrameAddr nodes.
198 * @return zero if both nodes have identically attributes
200 static int FrameAddr_cmp_attr(ir_node *a, ir_node *b) {
201 const be_frame_attr_t *a_attr = get_irn_attr_const(a);
202 const be_frame_attr_t *b_attr = get_irn_attr_const(b);
204 if (a_attr->ent != b_attr->ent || a_attr->offset != b_attr->offset)
207 return _node_cmp_attr(&a_attr->node_attr, &b_attr->node_attr);
211 * Compare the attributes of two be_Return nodes.
213 * @return zero if both nodes have identically attributes
215 static int Return_cmp_attr(ir_node *a, ir_node *b) {
216 const be_return_attr_t *a_attr = get_irn_attr_const(a);
217 const be_return_attr_t *b_attr = get_irn_attr_const(b);
219 if (a_attr->num_ret_vals != b_attr->num_ret_vals)
221 if (a_attr->pop != b_attr->pop)
223 if (a_attr->emit_pop != b_attr->emit_pop)
226 return _node_cmp_attr(&a_attr->node_attr, &b_attr->node_attr);
230 * Compare the attributes of two be_IncSP nodes.
232 * @return zero if both nodes have identically attributes
234 static int IncSP_cmp_attr(ir_node *a, ir_node *b) {
235 const be_incsp_attr_t *a_attr = get_irn_attr_const(a);
236 const be_incsp_attr_t *b_attr = get_irn_attr_const(b);
238 if (a_attr->offset != b_attr->offset)
241 return _node_cmp_attr(&a_attr->node_attr, &b_attr->node_attr);
245 * Compare the attributes of two be_Call nodes.
247 * @return zero if both nodes have identically attributes
249 static int Call_cmp_attr(ir_node *a, ir_node *b) {
250 const be_call_attr_t *a_attr = get_irn_attr_const(a);
251 const be_call_attr_t *b_attr = get_irn_attr_const(b);
253 if (a_attr->ent != b_attr->ent ||
254 a_attr->call_tp != b_attr->call_tp)
257 return _node_cmp_attr(&a_attr->node_attr, &b_attr->node_attr);
260 static INLINE be_req_t *get_be_req(const ir_node *node, int pos)
263 const be_node_attr_t *attr;
266 assert(is_be_node(node));
267 attr = get_irn_attr_const(node);
273 assert(idx < get_irn_arity(node));
275 assert(idx < ARR_LEN(attr->reg_data));
276 rd = &attr->reg_data[idx];
278 return pos < 0 ? &rd->req : &rd->in_req;
281 static INLINE arch_register_req_t *get_req(const ir_node *node, int pos)
283 be_req_t *bereq = get_be_req(node, pos);
288 * Initializes the generic attribute of all be nodes and return ir.
290 static void *init_node_attr(ir_node *node, int max_reg_data)
292 ir_graph *irg = get_irn_irg(node);
293 struct obstack *obst = get_irg_obstack(irg);
294 be_node_attr_t *a = get_irn_attr(node);
296 memset(a, 0, sizeof(get_op_attr_size(get_irn_op(node))));
298 if(max_reg_data >= 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 a->reg_data = NEW_ARR_F(be_reg_data_t, 0);
308 static void add_register_req(ir_node *node)
310 be_node_attr_t *a = get_irn_attr(node);
311 be_reg_data_t regreq;
312 memset(®req, 0, sizeof(regreq));
313 ARR_APP1(be_reg_data_t, a->reg_data, regreq);
317 * Skip Proj nodes and return their Proj numbers.
319 * If *node is a Proj or Proj(Proj) node, skip it.
321 * @param node points to the node to be skipped
323 * @return 0 if *node was no Proj node, its Proj number else.
325 static int redir_proj(const ir_node **node)
327 const ir_node *n = *node;
332 *node = irn = get_Proj_pred(n);
334 assert(get_irn_mode(irn) == mode_T);
335 *node = get_Proj_pred(irn);
337 return get_Proj_proj(n);
343 static be_reg_data_t *retrieve_reg_data(const ir_node *node)
345 const be_node_attr_t *attr;
349 pos = get_Proj_proj(node);
350 node = get_Proj_pred(node);
353 assert(is_be_node(node));
354 attr = get_irn_attr_const(node);
355 assert(pos >= 0 && pos < ARR_LEN(attr->reg_data) && "illegal proj number");
357 return &attr->reg_data[pos];
361 be_node_set_irn_reg(ir_node *irn, const arch_register_t *reg)
363 be_reg_data_t *r = retrieve_reg_data(irn);
367 ir_node *be_new_Spill(const arch_register_class_t *cls, const arch_register_class_t *cls_frame,
368 ir_graph *irg, ir_node *bl, ir_node *frame, ir_node *to_spill)
376 res = new_ir_node(NULL, irg, bl, op_be_Spill, mode_M, 2, in);
377 a = init_node_attr(res, 2);
381 be_node_set_reg_class(res, be_pos_Spill_frame, cls_frame);
382 be_node_set_reg_class(res, be_pos_Spill_val, cls);
386 ir_node *be_new_Reload(const arch_register_class_t *cls, const arch_register_class_t *cls_frame,
387 ir_graph *irg, ir_node *bl, ir_node *frame, ir_node *mem, ir_mode *mode)
394 res = new_ir_node(NULL, irg, bl, op_be_Reload, mode, 2, in);
396 init_node_attr(res, 2);
397 be_node_set_reg_class(res, -1, cls);
398 be_node_set_reg_class(res, be_pos_Reload_frame, cls_frame);
399 be_node_set_flags(res, -1, arch_irn_flags_rematerializable);
403 ir_node *be_get_Reload_mem(const ir_node *irn)
405 assert(be_is_Reload(irn));
406 return get_irn_n(irn, be_pos_Reload_mem);
409 ir_node *be_get_Reload_frame(const ir_node *irn)
411 assert(be_is_Reload(irn));
412 return get_irn_n(irn, be_pos_Reload_frame);
415 ir_node *be_get_Spill_val(const ir_node *irn)
417 assert(be_is_Spill(irn));
418 return get_irn_n(irn, be_pos_Spill_val);
421 ir_node *be_get_Spill_frame(const ir_node *irn)
423 assert(be_is_Spill(irn));
424 return get_irn_n(irn, be_pos_Spill_frame);
427 ir_node *be_new_Perm(const arch_register_class_t *cls, ir_graph *irg, ir_node *bl, int n, ir_node *in[])
430 ir_node *irn = new_ir_node(NULL, irg, bl, op_be_Perm, mode_T, n, in);
431 init_node_attr(irn, n);
432 for(i = 0; i < n; ++i) {
433 be_node_set_reg_class(irn, i, cls);
434 be_node_set_reg_class(irn, OUT_POS(i), cls);
440 void be_Perm_reduce(ir_node *perm, int new_size, int *map)
442 int arity = get_irn_arity(perm);
443 be_reg_data_t *old_data = alloca(arity * sizeof(old_data[0]));
444 be_node_attr_t *attr = get_irn_attr(perm);
449 assert(be_is_Perm(perm));
450 assert(new_size <= arity);
452 NEW_ARR_A(ir_node *, new_in, new_size);
454 /* save the old register data */
455 memcpy(old_data, attr->reg_data, arity * sizeof(old_data[0]));
457 /* compose the new in array and set the new register data directly in place */
458 for (i = 0; i < new_size; ++i) {
460 new_in[i] = get_irn_n(perm, idx);
461 attr->reg_data[i] = old_data[idx];
464 set_irn_in(perm, new_size, new_in);
467 ir_node *be_new_MemPerm(const arch_env_t *arch_env, ir_graph *irg, ir_node *bl, int n, ir_node *in[])
470 ir_node *frame = get_irg_frame(irg);
471 const arch_register_class_t *cls_frame = arch_get_irn_reg_class(arch_env, frame, -1);
473 const arch_register_t *sp = arch_env->sp;
474 be_memperm_attr_t *attr;
477 real_in = alloca((n+1) * sizeof(real_in[0]));
479 memcpy(&real_in[1], in, n * sizeof(real_in[0]));
481 irn = new_ir_node(NULL, irg, bl, op_be_MemPerm, mode_T, n+1, real_in);
483 init_node_attr(irn, n + 1);
484 be_node_set_reg_class(irn, 0, sp->reg_class);
485 for (i = 0; i < n; ++i) {
486 be_node_set_reg_class(irn, i + 1, cls_frame);
487 be_node_set_reg_class(irn, OUT_POS(i), cls_frame);
490 attr = get_irn_attr(irn);
492 attr->in_entities = obstack_alloc(irg->obst, n * sizeof(attr->in_entities[0]));
493 memset(attr->in_entities, 0, n * sizeof(attr->in_entities[0]));
494 attr->out_entities = obstack_alloc(irg->obst, n*sizeof(attr->out_entities[0]));
495 memset(attr->out_entities, 0, n*sizeof(attr->out_entities[0]));
501 ir_node *be_new_Copy(const arch_register_class_t *cls, ir_graph *irg, ir_node *bl, ir_node *op)
505 arch_register_req_t *req;
508 res = new_ir_node(NULL, irg, bl, op_be_Copy, get_irn_mode(op), 1, in);
509 init_node_attr(res, 1);
510 be_node_set_reg_class(res, 0, cls);
511 be_node_set_reg_class(res, OUT_POS(0), cls);
513 req = get_req(res, OUT_POS(0));
515 req->type = arch_register_req_type_should_be_same;
516 req->other_same = 1U << 0;
521 ir_node *be_get_Copy_op(const ir_node *cpy) {
522 return get_irn_n(cpy, be_pos_Copy_op);
525 void be_set_Copy_op(ir_node *cpy, ir_node *op) {
526 set_irn_n(cpy, be_pos_Copy_op, op);
529 ir_node *be_new_Keep(const arch_register_class_t *cls, ir_graph *irg, ir_node *bl, int n, ir_node *in[])
534 res = new_ir_node(NULL, irg, bl, op_be_Keep, mode_ANY, -1, NULL);
535 init_node_attr(res, -1);
537 for(i = 0; i < n; ++i) {
538 add_irn_n(res, in[i]);
539 add_register_req(res);
540 be_node_set_reg_class(res, i, cls);
547 void be_Keep_add_node(ir_node *keep, const arch_register_class_t *cls, ir_node *node)
551 assert(be_is_Keep(keep));
552 n = add_irn_n(keep, node);
553 add_register_req(keep);
554 be_node_set_reg_class(keep, n, cls);
557 /* creates a be_Call */
558 ir_node *be_new_Call(dbg_info *dbg, ir_graph *irg, ir_node *bl, ir_node *mem, ir_node *sp, ir_node *ptr,
559 int n_outs, int n, ir_node *in[], ir_type *call_tp)
562 int real_n = be_pos_Call_first_arg + n;
566 NEW_ARR_A(ir_node *, real_in, real_n);
567 real_in[be_pos_Call_mem] = mem;
568 real_in[be_pos_Call_sp] = sp;
569 real_in[be_pos_Call_ptr] = ptr;
570 memcpy(&real_in[be_pos_Call_first_arg], in, n * sizeof(in[0]));
572 irn = new_ir_node(dbg, irg, bl, op_be_Call, mode_T, real_n, real_in);
573 a = init_node_attr(irn, (n_outs > real_n ? n_outs : real_n));
575 a->call_tp = call_tp;
580 /* Gets the call entity or NULL if this is no static call. */
581 ir_entity *be_Call_get_entity(const ir_node *call) {
582 const be_call_attr_t *a = get_irn_attr_const(call);
583 assert(be_is_Call(call));
587 /* Sets the call entity. */
588 void be_Call_set_entity(ir_node *call, ir_entity *ent) {
589 be_call_attr_t *a = get_irn_attr(call);
590 assert(be_is_Call(call));
594 /* Gets the call type. */
595 ir_type *be_Call_get_type(ir_node *call) {
596 const be_call_attr_t *a = get_irn_attr_const(call);
597 assert(be_is_Call(call));
601 /* Sets the call type. */
602 void be_Call_set_type(ir_node *call, ir_type *call_tp) {
603 be_call_attr_t *a = get_irn_attr(call);
604 assert(be_is_Call(call));
605 a->call_tp = call_tp;
608 void be_Call_set_pop(ir_node *call, unsigned pop) {
609 be_call_attr_t *a = get_irn_attr(call);
613 unsigned be_Call_get_pop(const ir_node *call) {
614 const be_call_attr_t *a = get_irn_attr_const(call);
618 /* Construct a new be_Return. */
619 ir_node *be_new_Return(dbg_info *dbg, ir_graph *irg, ir_node *block, int n_res,
620 unsigned pop, int n, ir_node *in[])
626 res = new_ir_node(dbg, irg, block, op_be_Return, mode_X, -1, NULL);
627 init_node_attr(res, -1);
628 for(i = 0; i < n; ++i) {
629 add_irn_n(res, in[i]);
630 add_register_req(res);
633 a = get_irn_attr(res);
634 a->num_ret_vals = n_res;
641 /* Returns the number of real returns values */
642 int be_Return_get_n_rets(const ir_node *ret) {
643 const be_return_attr_t *a = get_irn_generic_attr_const(ret);
644 return a->num_ret_vals;
647 /* return the number of bytes that should be popped from stack when executing the Return. */
648 unsigned be_Return_get_pop(const ir_node *ret) {
649 const be_return_attr_t *a = get_irn_generic_attr_const(ret);
653 /* return non-zero, if number of popped bytes must be always emitted */
654 int be_Return_get_emit_pop(const ir_node *ret) {
655 const be_return_attr_t *a = get_irn_generic_attr_const(ret);
659 /* return non-zero, if number of popped bytes must be always emitted */
660 void be_Return_set_emit_pop(ir_node *ret, int emit_pop) {
661 be_return_attr_t *a = get_irn_generic_attr(ret);
662 a->emit_pop = emit_pop;
665 int be_Return_append_node(ir_node *ret, ir_node *node) {
668 pos = add_irn_n(ret, node);
669 add_register_req(ret);
674 ir_node *be_new_IncSP(const arch_register_t *sp, ir_graph *irg, ir_node *bl,
675 ir_node *old_sp, int offset, int align)
682 irn = new_ir_node(NULL, irg, bl, op_be_IncSP, sp->reg_class->mode,
683 sizeof(in) / sizeof(in[0]), in);
684 a = init_node_attr(irn, 1);
688 be_node_set_flags(irn, -1, arch_irn_flags_ignore | arch_irn_flags_modify_sp);
690 /* Set output constraint to stack register. */
691 be_node_set_reg_class(irn, 0, sp->reg_class);
692 be_set_constr_single_reg(irn, BE_OUT_POS(0), sp);
693 be_node_set_irn_reg(irn, sp);
698 ir_node *be_new_AddSP(const arch_register_t *sp, ir_graph *irg, ir_node *bl, ir_node *old_sp, ir_node *sz)
702 ir_node *in[be_pos_AddSP_last];
703 const arch_register_class_t *cls;
705 in[be_pos_AddSP_old_sp] = old_sp;
706 in[be_pos_AddSP_size] = sz;
708 irn = new_ir_node(NULL, irg, bl, op_be_AddSP, mode_T, be_pos_AddSP_last, in);
709 a = init_node_attr(irn, be_pos_AddSP_last);
711 be_node_set_flags(irn, OUT_POS(pn_be_AddSP_sp),
712 arch_irn_flags_ignore | arch_irn_flags_modify_sp);
714 /* Set output constraint to stack register. */
715 be_set_constr_single_reg(irn, be_pos_AddSP_old_sp, sp);
716 be_node_set_reg_class(irn, be_pos_AddSP_size, arch_register_get_class(sp));
717 be_set_constr_single_reg(irn, OUT_POS(pn_be_AddSP_sp), sp);
718 a->reg_data[pn_be_AddSP_sp].reg = sp;
720 cls = arch_register_get_class(sp);
721 be_node_set_reg_class(irn, OUT_POS(pn_be_AddSP_res), cls);
726 ir_node *be_new_SubSP(const arch_register_t *sp, ir_graph *irg, ir_node *bl, ir_node *old_sp, ir_node *sz)
730 ir_node *in[be_pos_SubSP_last];
732 in[be_pos_SubSP_old_sp] = old_sp;
733 in[be_pos_SubSP_size] = sz;
735 irn = new_ir_node(NULL, irg, bl, op_be_SubSP, mode_T, be_pos_SubSP_last, in);
736 a = init_node_attr(irn, be_pos_SubSP_last);
738 be_node_set_flags(irn, OUT_POS(pn_be_SubSP_sp),
739 arch_irn_flags_ignore | arch_irn_flags_modify_sp);
741 /* Set output constraint to stack register. */
742 be_set_constr_single_reg(irn, be_pos_SubSP_old_sp, sp);
743 be_node_set_reg_class(irn, be_pos_SubSP_size, arch_register_get_class(sp));
744 be_set_constr_single_reg(irn, OUT_POS(pn_be_SubSP_sp), sp);
745 a->reg_data[pn_be_SubSP_sp].reg = sp;
750 ir_node *be_new_RegParams(ir_graph *irg, ir_node *bl, int n_outs)
755 res = new_ir_node(NULL, irg, bl, op_be_RegParams, mode_T, 0, NULL);
756 init_node_attr(res, -1);
757 for(i = 0; i < n_outs; ++i)
758 add_register_req(res);
763 ir_node *be_RegParams_append_out_reg(ir_node *regparams,
764 const arch_env_t *arch_env,
765 const arch_register_t *reg)
767 ir_graph *irg = get_irn_irg(regparams);
768 ir_node *block = get_nodes_block(regparams);
769 be_node_attr_t *attr = get_irn_attr(regparams);
770 const arch_register_class_t *cls = arch_register_get_class(reg);
771 ir_mode *mode = arch_register_class_mode(cls);
772 int n = ARR_LEN(attr->reg_data);
775 assert(be_is_RegParams(regparams));
776 proj = new_r_Proj(irg, block, regparams, mode, n);
777 add_register_req(regparams);
778 be_set_constr_single_reg(regparams, BE_OUT_POS(n), reg);
779 arch_set_irn_register(arch_env, proj, reg);
781 /* TODO decide, whether we need to set ignore/modify sp flags here? */
786 ir_node *be_new_FrameAddr(const arch_register_class_t *cls_frame, ir_graph *irg, ir_node *bl, ir_node *frame, ir_entity *ent)
793 irn = new_ir_node(NULL, irg, bl, op_be_FrameAddr, get_irn_mode(frame), 1, in);
794 a = init_node_attr(irn, 1);
797 be_node_set_reg_class(irn, 0, cls_frame);
798 be_node_set_reg_class(irn, OUT_POS(0), cls_frame);
800 return optimize_node(irn);
803 ir_node *be_get_FrameAddr_frame(const ir_node *node) {
804 assert(be_is_FrameAddr(node));
805 return get_irn_n(node, be_pos_FrameAddr_ptr);
808 ir_entity *be_get_FrameAddr_entity(const ir_node *node)
810 const be_frame_attr_t *attr = get_irn_generic_attr_const(node);
814 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)
817 ir_node **in = (ir_node **) alloca((n + 1) * sizeof(in[0]));
820 memcpy(&in[1], in_keep, n * sizeof(in[0]));
821 irn = new_ir_node(NULL, irg, bl, op_be_CopyKeep, mode, n + 1, in);
822 init_node_attr(irn, n + 1);
823 be_node_set_reg_class(irn, OUT_POS(0), cls);
824 be_node_set_reg_class(irn, 0, cls);
829 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)
831 return be_new_CopyKeep(cls, irg, bl, src, 1, &keep, mode);
834 ir_node *be_get_CopyKeep_op(const ir_node *cpy) {
835 return get_irn_n(cpy, be_pos_CopyKeep_op);
838 void be_set_CopyKeep_op(ir_node *cpy, ir_node *op) {
839 set_irn_n(cpy, be_pos_CopyKeep_op, op);
842 ir_node *be_new_Barrier(ir_graph *irg, ir_node *bl, int n, ir_node *in[])
847 res = new_ir_node(NULL, irg, bl, op_be_Barrier, mode_T, -1, NULL);
848 init_node_attr(res, -1);
849 for(i = 0; i < n; ++i) {
850 add_irn_n(res, in[i]);
851 add_register_req(res);
857 ir_node *be_Barrier_append_node(ir_node *barrier, ir_node *node)
859 ir_graph *irg = get_irn_irg(barrier);
860 ir_node *block = get_nodes_block(barrier);
861 ir_mode *mode = get_irn_mode(node);
862 int n = add_irn_n(barrier, node);
864 ir_node *proj = new_r_Proj(irg, block, barrier, mode, n);
865 add_register_req(barrier);
870 /* Construct a new be_Unwind. */
871 ir_node *be_new_Unwind(dbg_info *dbg, ir_graph *irg, ir_node *block,
872 ir_node *mem, ir_node *sp)
877 in[be_pos_Unwind_mem] = mem;
878 in[be_pos_Unwind_sp] = sp;
879 res = new_ir_node(dbg, irg, block, op_be_Unwind, mode_X, 2, in);
880 init_node_attr(res, -1);
885 int be_has_frame_entity(const ir_node *irn)
887 switch (get_irn_opcode(irn)) {
897 ir_entity *be_get_frame_entity(const ir_node *irn)
899 if (be_has_frame_entity(irn)) {
900 const be_frame_attr_t *a = get_irn_attr_const(irn);
906 int be_get_frame_offset(const ir_node *irn)
908 assert(is_be_node(irn));
909 if (be_has_frame_entity(irn)) {
910 const be_frame_attr_t *a = get_irn_attr_const(irn);
916 void be_set_MemPerm_in_entity(const ir_node *irn, int n, ir_entity *ent)
918 const be_memperm_attr_t *attr = get_irn_attr_const(irn);
920 assert(be_is_MemPerm(irn));
921 assert(n < be_get_MemPerm_entity_arity(irn));
923 attr->in_entities[n] = ent;
926 ir_entity* be_get_MemPerm_in_entity(const ir_node* irn, int n)
928 const be_memperm_attr_t *attr = get_irn_attr_const(irn);
930 assert(be_is_MemPerm(irn));
931 assert(n < be_get_MemPerm_entity_arity(irn));
933 return attr->in_entities[n];
936 void be_set_MemPerm_out_entity(const ir_node *irn, int n, ir_entity *ent)
938 const be_memperm_attr_t *attr = get_irn_attr_const(irn);
940 assert(be_is_MemPerm(irn));
941 assert(n < be_get_MemPerm_entity_arity(irn));
943 attr->out_entities[n] = ent;
946 ir_entity* be_get_MemPerm_out_entity(const ir_node* irn, int n)
948 const be_memperm_attr_t *attr = get_irn_attr_const(irn);
950 assert(be_is_MemPerm(irn));
951 assert(n < be_get_MemPerm_entity_arity(irn));
953 return attr->out_entities[n];
956 int be_get_MemPerm_entity_arity(const ir_node *irn)
958 return get_irn_arity(irn) - 1;
961 void be_set_constr_single_reg(ir_node *node, int pos, const arch_register_t *reg)
963 arch_register_req_t *req = get_req(node, pos);
964 const arch_register_class_t *cls = arch_register_get_class(reg);
965 ir_graph *irg = get_irn_irg(node);
966 struct obstack *obst = get_irg_obstack(irg);
967 unsigned *limited_bitset;
969 assert(req->cls == NULL || req->cls == cls);
970 assert(! (req->type & arch_register_req_type_limited));
971 assert(req->limited == NULL);
973 limited_bitset = rbitset_obstack_alloc(obst, arch_register_class_n_regs(cls));
974 rbitset_set(limited_bitset, arch_register_get_index(reg));
977 req->type |= arch_register_req_type_limited;
978 req->limited = limited_bitset;
981 void be_set_constr_limited(ir_node *node, int pos, const arch_register_req_t *req)
983 ir_graph *irg = get_irn_irg(node);
984 struct obstack *obst = get_irg_obstack(irg);
985 arch_register_req_t *r = get_req(node, pos);
987 assert(arch_register_req_is(req, limited));
988 assert(!(req->type & (arch_register_req_type_should_be_same | arch_register_req_type_must_be_different)));
989 memcpy(r, req, sizeof(r[0]));
990 r->limited = rbitset_duplicate_obstack_alloc(obst, req->limited, req->cls->n_regs);
993 void be_node_set_flags(ir_node *irn, int pos, arch_irn_flags_t flags)
995 be_req_t *bereq = get_be_req(irn, pos);
996 bereq->flags = flags;
999 void be_node_add_flags(ir_node *irn, int pos, arch_irn_flags_t flags)
1001 be_req_t *bereq = get_be_req(irn, pos);
1002 bereq->flags |= flags;
1005 void be_node_set_reg_class(ir_node *irn, int pos, const arch_register_class_t *cls)
1007 arch_register_req_t *req = get_req(irn, pos);
1012 req->type = arch_register_req_type_none;
1013 } else if (req->type == arch_register_req_type_none) {
1014 req->type = arch_register_req_type_normal;
1018 void be_node_set_req_type(ir_node *irn, int pos, arch_register_req_type_t type)
1020 arch_register_req_t *req = get_req(irn, pos);
1024 ir_node *be_get_IncSP_pred(ir_node *irn) {
1025 assert(be_is_IncSP(irn));
1026 return get_irn_n(irn, 0);
1029 void be_set_IncSP_pred(ir_node *incsp, ir_node *pred) {
1030 assert(be_is_IncSP(incsp));
1031 set_irn_n(incsp, 0, pred);
1034 void be_set_IncSP_offset(ir_node *irn, int offset)
1036 be_incsp_attr_t *a = get_irn_attr(irn);
1037 assert(be_is_IncSP(irn));
1041 int be_get_IncSP_offset(const ir_node *irn)
1043 const be_incsp_attr_t *a = get_irn_attr_const(irn);
1044 assert(be_is_IncSP(irn));
1048 int be_get_IncSP_align(const ir_node *irn)
1050 const be_incsp_attr_t *a = get_irn_attr_const(irn);
1051 assert(be_is_IncSP(irn));
1055 ir_node *be_spill(const arch_env_t *arch_env, ir_node *block, ir_node *irn)
1057 ir_graph *irg = get_irn_irg(block);
1058 ir_node *frame = get_irg_frame(irg);
1059 const arch_register_class_t *cls = arch_get_irn_reg_class(arch_env, irn, -1);
1060 const arch_register_class_t *cls_frame = arch_get_irn_reg_class(arch_env, frame, -1);
1063 spill = be_new_Spill(cls, cls_frame, irg, block, frame, irn);
1067 ir_node *be_reload(const arch_env_t *arch_env, const arch_register_class_t *cls, ir_node *insert, ir_mode *mode, ir_node *spill)
1070 ir_node *bl = is_Block(insert) ? insert : get_nodes_block(insert);
1071 ir_graph *irg = get_irn_irg(bl);
1072 ir_node *frame = get_irg_frame(irg);
1073 const arch_register_class_t *cls_frame = arch_get_irn_reg_class(arch_env, frame, -1);
1075 assert(be_is_Spill(spill) || (is_Phi(spill) && get_irn_mode(spill) == mode_M));
1077 reload = be_new_Reload(cls, cls_frame, irg, bl, frame, spill, mode);
1079 if (is_Block(insert)) {
1080 insert = sched_skip(insert, 0, sched_skip_cf_predicator, (void *) arch_env);
1081 sched_add_after(insert, reload);
1083 sched_add_before(insert, reload);
1091 | _ \ ___ __ _ | _ \ ___ __ _ ___
1092 | |_) / _ \/ _` | | |_) / _ \/ _` / __|
1093 | _ < __/ (_| | | _ < __/ (_| \__ \
1094 |_| \_\___|\__, | |_| \_\___|\__, |___/
1101 arch_register_req_t *get_out_reg_req(const ir_node *irn, int out_pos)
1103 const be_node_attr_t *a = get_irn_attr_const(irn);
1105 if(out_pos >= ARR_LEN(a->reg_data)) {
1106 return arch_no_register_req;
1109 return &a->reg_data[out_pos].req.req;
1113 arch_register_req_t *get_in_reg_req(const ir_node *irn, int pos)
1115 const be_node_attr_t *a = get_irn_attr_const(irn);
1117 if(pos >= get_irn_arity(irn) || pos >= ARR_LEN(a->reg_data))
1118 return arch_no_register_req;
1120 return &a->reg_data[pos].in_req.req;
1123 static const arch_register_req_t *
1124 be_node_get_irn_reg_req(const ir_node *irn, int pos)
1129 if (get_irn_mode(irn) == mode_T)
1130 return arch_no_register_req;
1132 out_pos = redir_proj((const ir_node **)&irn);
1133 assert(is_be_node(irn));
1134 return get_out_reg_req(irn, out_pos);
1135 } else if (is_be_node(irn)) {
1137 * For spills and reloads, we return "none" as requirement for frame
1138 * pointer, so every input is ok. Some backends need this (e.g. STA).
1140 if ((be_is_Spill(irn) && pos == be_pos_Spill_frame) ||
1141 (be_is_Reload(irn) && pos == be_pos_Reload_frame))
1142 return arch_no_register_req;
1144 return get_in_reg_req(irn, pos);
1147 return arch_no_register_req;
1150 const arch_register_t *
1151 be_node_get_irn_reg(const ir_node *irn)
1155 if (get_irn_mode(irn) == mode_T)
1157 r = retrieve_reg_data(irn);
1161 static arch_irn_class_t be_node_classify(const ir_node *irn)
1164 switch (get_irn_opcode(irn)) {
1165 #define XXX(a,b) case a: return b
1166 XXX(beo_Spill, arch_irn_class_spill);
1167 XXX(beo_Reload, arch_irn_class_reload);
1168 XXX(beo_Perm, arch_irn_class_perm);
1169 XXX(beo_Copy, arch_irn_class_copy);
1170 XXX(beo_Return, arch_irn_class_branch);
1173 irn = get_Proj_pred(irn);
1175 assert(get_irn_mode(irn) == mode_T);
1176 irn = get_Proj_pred(irn);
1181 return arch_irn_class_normal;
1187 static arch_irn_flags_t be_node_get_flags(const ir_node *node)
1193 pos = OUT_POS(get_Proj_proj(node));
1194 node = skip_Proj_const(node);
1197 bereq = get_be_req(node, pos);
1199 return bereq->flags;
1202 static ir_entity *be_node_get_frame_entity(const ir_node *irn)
1204 return be_get_frame_entity(irn);
1207 static void be_node_set_frame_entity(ir_node *irn, ir_entity *ent)
1211 assert(be_has_frame_entity(irn));
1213 a = get_irn_attr(irn);
1217 static void be_node_set_frame_offset(ir_node *irn, int offset)
1219 if(be_has_frame_entity(irn)) {
1220 be_frame_attr_t *a = get_irn_attr(irn);
1225 static int be_node_get_sp_bias(const ir_node *irn)
1227 if(be_is_IncSP(irn))
1228 return be_get_IncSP_offset(irn);
1230 return -(int)be_Call_get_pop(irn);
1236 ___ ____ _ _ _ _ _ _
1237 |_ _| _ \| \ | | | | | | __ _ _ __ __| | | ___ _ __
1238 | || |_) | \| | | |_| |/ _` | '_ \ / _` | |/ _ \ '__|
1239 | || _ <| |\ | | _ | (_| | | | | (_| | | __/ |
1240 |___|_| \_\_| \_| |_| |_|\__,_|_| |_|\__,_|_|\___|_|
1244 static const arch_irn_ops_t be_node_irn_ops = {
1245 be_node_get_irn_reg_req,
1246 be_node_set_irn_reg,
1247 be_node_get_irn_reg,
1250 be_node_get_frame_entity,
1251 be_node_set_frame_entity,
1252 be_node_set_frame_offset,
1253 be_node_get_sp_bias,
1254 NULL, /* get_inverse */
1255 NULL, /* get_op_estimated_cost */
1256 NULL, /* possible_memory_operand */
1257 NULL, /* perform_memory_operand */
1261 ____ _ _ ___ ____ _ _ _ _ _ _
1262 | _ \| |__ (_) |_ _| _ \| \ | | | | | | __ _ _ __ __| | | ___ _ __
1263 | |_) | '_ \| | | || |_) | \| | | |_| |/ _` | '_ \ / _` | |/ _ \ '__|
1264 | __/| | | | | | || _ <| |\ | | _ | (_| | | | | (_| | | __/ |
1265 |_| |_| |_|_| |___|_| \_\_| \_| |_| |_|\__,_|_| |_|\__,_|_|\___|_|
1270 const arch_register_t *reg;
1271 arch_register_req_t req;
1272 arch_irn_flags_t flags;
1276 arch_env_t *arch_env;
1280 #define get_phi_handler_from_ops(h) container_of(h, phi_handler_t, irn_ops)
1283 phi_attr_t *get_Phi_attr(const ir_node *phi)
1285 phi_attr_t *attr = pmap_get(phi_handler.phi_attrs, (void*) phi);
1287 ir_graph *irg = get_irn_irg(phi);
1288 struct obstack *obst = get_irg_obstack(irg);
1289 attr = obstack_alloc(obst, sizeof(attr[0]));
1290 memset(attr, 0, sizeof(attr[0]));
1291 pmap_insert(phi_handler.phi_attrs, phi, attr);
1298 * Get register class of a Phi.
1301 const arch_register_req_t *get_Phi_reg_req_recursive(const ir_node *phi,
1304 int n = get_irn_arity(phi);
1308 if(*visited && pset_find_ptr(*visited, phi))
1311 for(i = 0; i < n; ++i) {
1312 op = get_irn_n(phi, i);
1313 /* Matze: don't we unnecessary constraint our phis with this?
1314 * we only need to take the regclass IMO*/
1316 return arch_get_register_req(phi_handler.arch_env, op, BE_OUT_POS(0));
1320 * The operands of that Phi were all Phis themselves.
1321 * We have to start a DFS for a non-Phi argument now.
1324 *visited = pset_new_ptr(16);
1326 pset_insert_ptr(*visited, phi);
1328 for(i = 0; i < n; ++i) {
1329 const arch_register_req_t *req;
1330 op = get_irn_n(phi, i);
1331 req = get_Phi_reg_req_recursive(op, visited);
1340 const arch_register_req_t *phi_get_irn_reg_req(const ir_node *irn, int pos)
1345 if(!mode_is_datab(get_irn_mode(irn)))
1346 return arch_no_register_req;
1348 attr = get_Phi_attr(irn);
1350 if(attr->req.type == arch_register_req_type_none) {
1351 pset *visited = NULL;
1352 const arch_register_req_t *req;
1353 req = get_Phi_reg_req_recursive(irn, &visited);
1355 memcpy(&attr->req, req, sizeof(req[0]));
1356 assert(attr->req.cls != NULL);
1357 attr->req.type = arch_register_req_type_normal;
1366 void be_set_phi_reg_req(const arch_env_t *arch_env, ir_node *node,
1367 const arch_register_req_t *req)
1372 assert(mode_is_datab(get_irn_mode(node)));
1374 attr = get_Phi_attr(node);
1375 memcpy(&attr->req, req, sizeof(req[0]));
1378 void be_set_phi_flags(const arch_env_t *arch_env, ir_node *node,
1379 arch_irn_flags_t flags)
1384 assert(mode_is_datab(get_irn_mode(node)));
1386 attr = get_Phi_attr(node);
1387 attr->flags = flags;
1390 static void phi_set_irn_reg(ir_node *irn, const arch_register_t *reg)
1392 phi_attr_t *attr = get_Phi_attr(irn);
1396 static const arch_register_t *phi_get_irn_reg(const ir_node *irn)
1398 phi_attr_t *attr = get_Phi_attr(irn);
1402 static arch_irn_class_t phi_classify(const ir_node *irn)
1405 return arch_irn_class_normal;
1408 static arch_irn_flags_t phi_get_flags(const ir_node *irn)
1410 phi_attr_t *attr = get_Phi_attr(irn);
1414 static ir_entity *phi_get_frame_entity(const ir_node *irn)
1420 static void phi_set_frame_entity(ir_node *irn, ir_entity *ent)
1427 static void phi_set_frame_offset(ir_node *irn, int bias)
1434 static int phi_get_sp_bias(const ir_node *irn)
1440 static const arch_irn_ops_t phi_irn_ops = {
1441 phi_get_irn_reg_req,
1446 phi_get_frame_entity,
1447 phi_set_frame_entity,
1448 phi_set_frame_offset,
1450 NULL, /* get_inverse */
1451 NULL, /* get_op_estimated_cost */
1452 NULL, /* possible_memory_operand */
1453 NULL, /* perform_memory_operand */
1456 void be_phi_handler_new(be_main_env_t *env)
1458 phi_handler.arch_env = env->arch_env;
1459 phi_handler.phi_attrs = pmap_create();
1460 op_Phi->ops.be_ops = &phi_irn_ops;
1463 void be_phi_handler_free(void)
1465 pmap_destroy(phi_handler.phi_attrs);
1466 phi_handler.phi_attrs = NULL;
1467 op_Phi->ops.be_ops = NULL;
1470 void be_phi_handler_reset(void)
1472 if(phi_handler.phi_attrs)
1473 pmap_destroy(phi_handler.phi_attrs);
1474 phi_handler.phi_attrs = pmap_create();
1479 | \ | | ___ __| | ___ | _ \ _ _ _ __ ___ _ __ (_)_ __ __ _
1480 | \| |/ _ \ / _` |/ _ \ | | | | | | | '_ ` _ \| '_ \| | '_ \ / _` |
1481 | |\ | (_) | (_| | __/ | |_| | |_| | | | | | | |_) | | | | | (_| |
1482 |_| \_|\___/ \__,_|\___| |____/ \__,_|_| |_| |_| .__/|_|_| |_|\__, |
1487 * Dumps a register requirement to a file.
1489 static void dump_node_req(FILE *f, int idx, const arch_register_req_t *req,
1490 const ir_node *node)
1492 int did_something = 0;
1494 const char *prefix = buf;
1496 snprintf(buf, sizeof(buf), "#%d ", idx);
1497 buf[sizeof(buf) - 1] = '\0';
1502 arch_register_req_format(tmp, sizeof(tmp), req, node);
1503 fprintf(f, "%s", tmp);
1512 * Dumps node register requirements to a file.
1514 static void dump_node_reqs(FILE *f, ir_node *node)
1517 be_node_attr_t *a = get_irn_attr(node);
1518 int len = ARR_LEN(a->reg_data);
1520 fprintf(f, "registers: \n");
1521 for(i = 0; i < len; ++i) {
1522 be_reg_data_t *rd = &a->reg_data[i];
1524 fprintf(f, "#%d: %s\n", i, rd->reg->name);
1527 fprintf(f, "in requirements:\n");
1528 for(i = 0; i < len; ++i) {
1529 dump_node_req(f, i, &a->reg_data[i].in_req.req, node);
1532 fprintf(f, "\nout requirements:\n");
1533 for(i = 0; i < len; ++i) {
1534 dump_node_req(f, i, &a->reg_data[i].req.req, node);
1539 * ir_op-Operation: dump a be node to file
1541 static int dump_node(ir_node *irn, FILE *f, dump_reason_t reason)
1543 be_node_attr_t *at = get_irn_attr(irn);
1545 assert(is_be_node(irn));
1548 case dump_node_opcode_txt:
1549 fprintf(f, get_op_name(get_irn_op(irn)));
1551 case dump_node_mode_txt:
1552 if(be_is_Perm(irn) || be_is_Copy(irn) || be_is_CopyKeep(irn)) {
1553 fprintf(f, " %s", get_mode_name(get_irn_mode(irn)));
1556 case dump_node_nodeattr_txt:
1557 if(be_is_Call(irn)) {
1558 be_call_attr_t *a = (be_call_attr_t *) at;
1560 fprintf(f, " [%s] ", get_entity_name(a->ent));
1562 if(be_is_IncSP(irn)) {
1563 const be_incsp_attr_t *attr = get_irn_generic_attr_const(irn);
1564 if(attr->offset == BE_STACK_FRAME_SIZE_EXPAND) {
1565 fprintf(f, " [Setup Stackframe] ");
1566 } else if(attr->offset == BE_STACK_FRAME_SIZE_SHRINK) {
1567 fprintf(f, " [Destroy Stackframe] ");
1569 fprintf(f, " [%d] ", attr->offset);
1573 case dump_node_info_txt:
1574 dump_node_reqs(f, irn);
1576 if(be_has_frame_entity(irn)) {
1577 be_frame_attr_t *a = (be_frame_attr_t *) at;
1579 unsigned size = get_type_size_bytes(get_entity_type(a->ent));
1580 ir_fprintf(f, "frame entity: %+F, offset 0x%x (%d), size 0x%x (%d) bytes\n",
1581 a->ent, a->offset, a->offset, size, size);
1586 switch (get_irn_opcode(irn)) {
1589 be_incsp_attr_t *a = (be_incsp_attr_t *) at;
1590 if (a->offset == BE_STACK_FRAME_SIZE_EXPAND)
1591 fprintf(f, "offset: FRAME_SIZE\n");
1592 else if(a->offset == BE_STACK_FRAME_SIZE_SHRINK)
1593 fprintf(f, "offset: -FRAME SIZE\n");
1595 fprintf(f, "offset: %u\n", a->offset);
1600 be_call_attr_t *a = (be_call_attr_t *) at;
1603 fprintf(f, "\ncalling: %s\n", get_entity_name(a->ent));
1609 for(i = 0; i < be_get_MemPerm_entity_arity(irn); ++i) {
1610 ir_entity *in, *out;
1611 in = be_get_MemPerm_in_entity(irn, i);
1612 out = be_get_MemPerm_out_entity(irn, i);
1614 fprintf(f, "\nin[%d]: %s\n", i, get_entity_name(in));
1617 fprintf(f, "\nout[%d]: %s\n", i, get_entity_name(out));
1633 * Copies the backend specific attributes from old node to new node.
1635 static void copy_attr(const ir_node *old_node, ir_node *new_node)
1637 const be_node_attr_t *old_attr = get_irn_attr_const(old_node);
1638 be_node_attr_t *new_attr = get_irn_attr(new_node);
1639 struct obstack *obst = get_irg_obstack(get_irn_irg(new_node));
1642 assert(is_be_node(old_node));
1643 assert(is_be_node(new_node));
1645 memcpy(new_attr, old_attr, get_op_attr_size(get_irn_op(old_node)));
1646 new_attr->reg_data = NULL;
1648 if(old_attr->reg_data != NULL)
1649 len = ARR_LEN(old_attr->reg_data);
1653 if(get_irn_op(old_node)->opar == oparity_dynamic
1654 || be_is_RegParams(old_node)) {
1655 new_attr->reg_data = NEW_ARR_F(be_reg_data_t, len);
1657 new_attr->reg_data = NEW_ARR_D(be_reg_data_t, obst, len);
1661 memcpy(new_attr->reg_data, old_attr->reg_data, len * sizeof(be_reg_data_t));
1662 for(i = 0; i < len; ++i) {
1663 const be_reg_data_t *rd = &old_attr->reg_data[i];
1664 be_reg_data_t *newrd = &new_attr->reg_data[i];
1665 if(arch_register_req_is(&rd->req.req, limited)) {
1666 const arch_register_req_t *req = &rd->req.req;
1667 arch_register_req_t *new_req = &newrd->req.req;
1669 = rbitset_duplicate_obstack_alloc(obst, req->limited, req->cls->n_regs);
1671 if(arch_register_req_is(&rd->in_req.req, limited)) {
1672 const arch_register_req_t *req = &rd->in_req.req;
1673 arch_register_req_t *new_req = &newrd->in_req.req;
1675 = rbitset_duplicate_obstack_alloc(obst, req->limited, req->cls->n_regs);
1681 static const ir_op_ops be_node_op_ops = {
1702 int is_be_node(const ir_node *irn)
1704 return get_op_ops(get_irn_op(irn))->be_ops == &be_node_irn_ops;
1707 void be_node_init(void) {
1708 static int inited = 0;
1715 /* Acquire all needed opcodes. */
1716 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);
1717 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);
1718 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);
1719 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);
1720 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);
1721 op_be_Keep = new_ir_op(beo_Keep, "be_Keep", op_pin_state_pinned, K, oparity_dynamic, 0, sizeof(be_node_attr_t), &be_node_op_ops);
1722 op_be_CopyKeep = new_ir_op(beo_CopyKeep, "be_CopyKeep", op_pin_state_pinned, K, oparity_variable, 0, sizeof(be_node_attr_t), &be_node_op_ops);
1723 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);
1724 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);
1725 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);
1726 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);
1727 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);
1728 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);
1729 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);
1730 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);
1731 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);
1733 op_be_Spill->ops.node_cmp_attr = FrameAddr_cmp_attr;
1734 op_be_Reload->ops.node_cmp_attr = FrameAddr_cmp_attr;
1735 op_be_Perm->ops.node_cmp_attr = node_cmp_attr;
1736 op_be_MemPerm->ops.node_cmp_attr = node_cmp_attr;
1737 op_be_Copy->ops.node_cmp_attr = node_cmp_attr;
1738 op_be_Keep->ops.node_cmp_attr = node_cmp_attr;
1739 op_be_CopyKeep->ops.node_cmp_attr = node_cmp_attr;
1740 op_be_Call->ops.node_cmp_attr = Call_cmp_attr;
1741 op_be_Return->ops.node_cmp_attr = Return_cmp_attr;
1742 op_be_AddSP->ops.node_cmp_attr = node_cmp_attr;
1743 op_be_SubSP->ops.node_cmp_attr = node_cmp_attr;
1744 op_be_IncSP->ops.node_cmp_attr = IncSP_cmp_attr;
1745 op_be_RegParams->ops.node_cmp_attr = node_cmp_attr;
1746 op_be_FrameAddr->ops.node_cmp_attr = FrameAddr_cmp_attr;
1747 op_be_Barrier->ops.node_cmp_attr = node_cmp_attr;
1748 op_be_Unwind->ops.node_cmp_attr = node_cmp_attr;