40e5b12b875fcad200e1ce9e8657953f7a1659cb
[libfirm] / ir / be / benode.c
1 /**
2  * @file   benode.c
3  * @date   17.05.2005
4  * @author Sebastian Hack
5  *
6  * Backend node support.
7  *
8  * This file provdies Perm, Copy, Spill and Reload nodes.
9  *
10  * Copyright (C) 2005 Universitaet Karlsruhe
11  * Released under the GPL
12  */
13
14 #ifdef HAVE_CONFIG_H
15 #include "config.h"
16 #endif
17
18 #include <stdlib.h>
19
20 #include "obst.h"
21 #include "set.h"
22 #include "pmap.h"
23 #include "util.h"
24 #include "debug.h"
25 #include "fourcc.h"
26
27 #include "irop_t.h"
28 #include "irmode_t.h"
29 #include "irnode_t.h"
30 #include "ircons_t.h"
31 #include "irprintf.h"
32
33 #include "be_t.h"
34 #include "belive_t.h"
35 #include "besched_t.h"
36 #include "benode_t.h"
37
38 #include "beirgmod.h"
39
40 /* Sometimes we want to put const nodes into get_irn_generic_attr ... */
41 #define get_irn_attr(irn) get_irn_generic_attr((ir_node *) (irn))
42
43 static unsigned be_node_tag = FOURCC('B', 'E', 'N', 'O');
44
45 typedef enum _node_kind_t {
46         node_kind_spill,
47         node_kind_reload,
48         node_kind_perm,
49         node_kind_copy,
50         node_kind_kill,
51         node_kind_last
52 } node_kind_t;
53
54 typedef struct {
55         node_kind_t kind;
56         const arch_register_class_t *cls;
57         ir_op *op;
58         int n_pos;
59         int *pos;
60 } be_op_t;
61
62 typedef enum {
63         be_req_kind_old_limited,
64         be_req_kind_negate_old_limited,
65         be_req_kind_single_reg
66 } be_req_kind_t;
67
68 typedef struct {
69         arch_register_req_t req;
70         be_req_kind_t       kind;
71         union {
72                 struct {
73                         void (*old_limited)(void *ptr, bitset_t *bs);
74                         void *old_limited_env;
75                 } old_limited;
76
77                 const arch_register_t *single_reg;
78         } x;
79 } be_req_t;
80
81 typedef struct {
82         const arch_register_t *reg;
83         be_req_t              req;
84         be_req_t              in_req;
85 } be_reg_data_t;
86
87 typedef struct {
88         int                         n_outs;
89         const arch_register_class_t *cls;
90         be_reg_data_t               *reg_data;
91 } be_node_attr_t;
92
93 typedef struct {
94         be_node_attr_t node_attr;
95         ir_node *spill_ctx;  /**< The node in whose context this spill was introduced. */
96         entity *ent;     /**< The entity in the stack frame the spill writes to. */
97 } be_spill_attr_t;
98
99 static ir_op *op_Spill;
100 static ir_op *op_Reload;
101 static ir_op *op_Perm;
102 static ir_op *op_Copy;
103 static ir_op *op_Keep;
104 static ir_op *op_Call;
105 static ir_op *op_IncSP;
106 static ir_op *op_AddSP;
107
108 static int beo_base = -1;
109
110 static const ir_op_ops be_node_op_ops;
111
112 #define N   irop_flag_none
113 #define L   irop_flag_labeled
114 #define C   irop_flag_commutative
115 #define X   irop_flag_cfopcode
116 #define I   irop_flag_ip_cfopcode
117 #define F   irop_flag_fragile
118 #define Y   irop_flag_forking
119 #define H   irop_flag_highlevel
120 #define c   irop_flag_constlike
121 #define K   irop_flag_keep
122
123 void be_node_init(void) {
124         static int inited = 0;
125
126         if(inited)
127                 return;
128
129         inited = 1;
130
131         /* Acquire all needed opcodes. */
132         beo_base = get_next_ir_opcodes(beo_Last - 1);
133
134         op_Spill  = new_ir_op(beo_base + beo_Spill,  "Spill",  op_pin_state_mem_pinned, N, oparity_unary,    0, sizeof(be_spill_attr_t), &be_node_op_ops);
135         op_Reload = new_ir_op(beo_base + beo_Reload, "Reload", op_pin_state_mem_pinned, N, oparity_zero,     0, sizeof(be_node_attr_t),  &be_node_op_ops);
136         op_Perm   = new_ir_op(beo_base + beo_Perm,   "Perm",   op_pin_state_pinned,     N, oparity_variable, 0, sizeof(be_node_attr_t),  &be_node_op_ops);
137         op_Copy   = new_ir_op(beo_base + beo_Copy,   "Copy",   op_pin_state_pinned,     N, oparity_unary,    0, sizeof(be_node_attr_t),  &be_node_op_ops);
138         op_Keep   = new_ir_op(beo_base + beo_Keep,   "Keep",   op_pin_state_pinned,     K, oparity_variable, 0, sizeof(be_node_attr_t),  &be_node_op_ops);
139
140         set_op_tag(op_Spill,  &be_node_tag);
141         set_op_tag(op_Reload, &be_node_tag);
142         set_op_tag(op_Perm,   &be_node_tag);
143         set_op_tag(op_Copy,   &be_node_tag);
144         set_op_tag(op_Keep,   &be_node_tag);
145 }
146
147 static void *init_node_attr(ir_node* irn, const arch_register_class_t *cls, ir_graph *irg, int n_outs)
148 {
149         be_node_attr_t *a = get_irn_attr(irn);
150
151         a->n_outs   = n_outs;
152         a->cls      = cls;
153         a->reg_data = NULL;
154
155         if(n_outs > 0) {
156                 int i;
157
158                 a->reg_data = NEW_ARR_D(be_reg_data_t, get_irg_obstack(irg), n_outs);
159                 memset(a->reg_data, 0, n_outs * sizeof(a->reg_data[0]));
160                 for(i = 0; i < n_outs; ++i) {
161                         a->reg_data[i].req.req.cls  = cls;
162                         a->reg_data[i].req.req.type = arch_register_req_type_normal;
163                 }
164         }
165
166         return a;
167 }
168
169 static INLINE int is_be_node(const ir_node *irn)
170 {
171         return get_op_tag(get_irn_op(irn)) == &be_node_tag;
172 }
173
174 be_opcode_t get_irn_be_opcode(const ir_node *irn)
175 {
176         return is_be_node(irn) ? get_irn_opcode(irn) - beo_base : beo_NoBeOp;
177 }
178
179 ir_node *be_new_Spill(const arch_register_class_t *cls, ir_graph *irg, ir_node *bl, ir_node *to_spill, ir_node *ctx)
180 {
181         be_spill_attr_t *a;
182         ir_node *in[1];
183         ir_node *res;
184
185         in[0] = to_spill;
186         res   = new_ir_node(NULL, irg, bl, op_Spill, mode_M, 1, in);
187         a     = init_node_attr(res, cls, irg, 0);
188         a->ent       = NULL;
189         a->spill_ctx = ctx;
190         return res;
191 }
192
193 ir_node *be_new_Reload(const arch_register_class_t *cls, ir_graph *irg, ir_node *bl, ir_mode *mode, ir_node *mem)
194 {
195         ir_node *in[1];
196         ir_node *res;
197
198         in[0] = mem;
199         res   = new_ir_node(NULL, irg, bl, op_Reload, mode, 1, in);
200         init_node_attr(res, cls, irg, 1);
201         return res;
202 }
203
204 ir_node *be_new_Perm(const arch_register_class_t *cls, ir_graph *irg, ir_node *bl, int n, ir_node *in[])
205 {
206         ir_node *irn = new_ir_node(NULL, irg, bl, op_Perm, mode_T, n, in);
207         init_node_attr(irn, cls, irg, n);
208         return irn;
209 }
210
211 ir_node *be_new_Copy(const arch_register_class_t *cls, ir_graph *irg, ir_node *bl, ir_node *op)
212 {
213         ir_node *in[1];
214         ir_node *res;
215
216         in[0] = op;
217         res   = new_ir_node(NULL, irg, bl, op_Copy, get_irn_mode(op), 1, in);
218         init_node_attr(res, cls, irg, 1);
219         return res;
220 }
221
222 ir_node *be_new_Keep(const arch_register_class_t *cls, ir_graph *irg, ir_node *bl, int n, ir_node *in[])
223 {
224         ir_node *irn;
225
226         irn = new_ir_node(NULL, irg, bl, op_Keep, mode_ANY, n, in);
227         init_node_attr(irn, cls, irg, 0);
228         keep_alive(irn);
229         return irn;
230 }
231
232 int be_is_Spill(const ir_node *irn)
233 {
234         return get_irn_be_opcode(irn) == beo_Spill;
235 }
236
237 int be_is_Reload(const ir_node *irn)
238 {
239         return get_irn_be_opcode(irn) == beo_Reload;
240 }
241
242 int be_is_Copy(const ir_node *irn)
243 {
244         return get_irn_be_opcode(irn) == beo_Copy;
245 }
246
247 int be_is_Perm(const ir_node *irn)
248 {
249         return get_irn_be_opcode(irn) == beo_Perm;
250 }
251
252 int be_is_Keep(const ir_node *irn)
253 {
254         return get_irn_be_opcode(irn) == beo_Keep;
255 }
256
257 static void be_limited(void *data, bitset_t *bs)
258 {
259         be_req_t *req = data;
260
261         switch(req->kind) {
262         case be_req_kind_negate_old_limited:
263         case be_req_kind_old_limited:
264                 req->x.old_limited.old_limited(req->x.old_limited.old_limited_env, bs);
265                 if(req->kind == be_req_kind_negate_old_limited)
266                         bitset_flip_all(bs);
267                 break;
268         case be_req_kind_single_reg:
269                 bitset_clear_all(bs);
270                 bitset_set(bs, req->x.single_reg->index);
271                 break;
272         }
273 }
274
275 void be_set_constr_single_reg(ir_node *irn, int pos, const arch_register_t *reg)
276 {
277         int idx           = pos < 0 ? -(pos - 1) : pos;
278         be_node_attr_t *a = get_irn_attr(irn);
279         be_reg_data_t *rd = &a->reg_data[idx];
280         be_req_t       *r = pos < 0 ? &rd->req : &rd->in_req;
281
282         assert(is_be_node(irn));
283         assert(!(pos >= 0) || pos < get_irn_arity(irn));
284         assert(!(pos < 0)  || -(pos + 1) <= a->n_outs);
285
286         r->kind            = be_req_kind_single_reg;
287         r->x.single_reg    = reg;
288         r->req.limited     = be_limited;
289         r->req.limited_env = r;
290         r->req.type        = arch_register_req_type_limited;
291         r->req.cls         = reg->reg_class;
292 }
293
294 void be_set_constr_limited(ir_node *irn, int pos, const arch_register_req_t *req)
295 {
296         int idx           = pos < 0 ? -(pos - 1) : pos;
297         be_node_attr_t *a = get_irn_attr(irn);
298         be_reg_data_t *rd = &a->reg_data[idx];
299         be_req_t       *r = pos < 0 ? &rd->req : &rd->in_req;
300
301         assert(is_be_node(irn));
302         assert(!(pos >= 0) || pos < get_irn_arity(irn));
303         assert(!(pos < 0)  || -(pos + 1) <= a->n_outs);
304         assert(arch_register_req_is(req, limited));
305
306         r->kind            = be_req_kind_old_limited;
307         r->req.limited     = be_limited;
308         r->req.limited_env = r;
309         r->req.type        = arch_register_req_type_limited;
310         r->req.cls         = req->cls;
311
312         r->x.old_limited.old_limited     = req->limited;
313         r->x.old_limited.old_limited_env = req->limited_env;
314 }
315
316
317 void be_set_IncSP_offset(ir_node *irn, int offset)
318 {
319
320 }
321
322 int be_get_IncSP_offset(ir_node *irn)
323 {
324         return -1;
325 }
326
327 void be_set_Spill_entity(ir_node *irn, entity *ent)
328 {
329         be_spill_attr_t *a = get_irn_attr(irn);
330         assert(be_is_Spill(irn));
331         a->ent = ent;
332 }
333
334 static ir_node *find_a_spill_walker(ir_node *irn, unsigned visited_nr)
335 {
336         if(get_irn_visited(irn) < visited_nr) {
337                 set_irn_visited(irn, visited_nr);
338
339                 if(is_Phi(irn)) {
340                         int i, n;
341                         for(i = 0, n = get_irn_arity(irn); i < n; ++i) {
342                                 ir_node *n = find_a_spill_walker(get_irn_n(irn, i), visited_nr);
343                                 if(n != NULL)
344                                         return n;
345                         }
346                 }
347
348                 else if(get_irn_be_opcode(irn) == beo_Spill)
349                         return irn;
350         }
351
352         return NULL;
353 }
354
355 ir_node *be_get_Spill_context(const ir_node *irn) {
356         const be_spill_attr_t *a = get_irn_attr(irn);
357         assert(be_is_Spill(irn));
358         return a->spill_ctx;
359 }
360
361 /**
362  * Finds a spill for a reload.
363  * If the reload is directly using the spill, this is simple,
364  * else we perform DFS from the reload (over all PhiMs) and return
365  * the first spill node we find.
366  */
367 static INLINE ir_node *find_a_spill(ir_node *irn)
368 {
369         ir_graph *irg       = get_irn_irg(irn);
370         unsigned visited_nr = get_irg_visited(irg) + 1;
371
372         assert(be_is_Reload(irn));
373         set_irg_visited(irg, visited_nr);
374         return find_a_spill_walker(irn, visited_nr);
375 }
376
377 entity *be_get_spill_entity(ir_node *irn)
378 {
379         int opc           = get_irn_opcode(irn);
380
381         switch(get_irn_be_opcode(irn)) {
382         case beo_Reload:
383                 return be_get_spill_entity(find_a_spill(irn));
384         case beo_Spill:
385                 {
386                         be_spill_attr_t *a = get_irn_attr(irn);
387                         return a->ent;
388                 }
389         default:
390                 assert(0 && "Must give spill/reload node");
391         }
392
393         return NULL;
394 }
395
396 ir_node *be_spill(const arch_env_t *arch_env, ir_node *irn, ir_node *ctx)
397 {
398         const arch_register_class_t *cls = arch_get_irn_reg_class(arch_env, irn, -1);
399
400         ir_node *bl    = get_nodes_block(irn);
401         ir_graph *irg  = get_irn_irg(bl);
402         ir_node *spill = be_new_Spill(cls, irg, bl, irn, ctx);
403         ir_node *insert;
404
405         /*
406          * search the right insertion point. a spill of a phi cannot be put
407          * directly after the phi, if there are some phis behind the one which
408          * is spilled.
409          */
410         insert = sched_next(irn);
411         while(is_Phi(insert) && !sched_is_end(insert))
412                 insert = sched_next(insert);
413
414         sched_add_before(insert, spill);
415         return spill;
416 }
417
418 ir_node *be_reload(const arch_env_t *arch_env,
419                                    const arch_register_class_t *cls,
420                                    ir_node *irn, int pos, ir_mode *mode, ir_node *spill)
421 {
422         ir_node *reload;
423
424         ir_node *bl   = get_nodes_block(irn);
425         ir_graph *irg = get_irn_irg(bl);
426
427         assert(be_is_Spill(spill) || (is_Phi(spill) && get_irn_mode(spill) == mode_M));
428
429         reload = be_new_Reload(cls, irg, bl, mode, spill);
430
431         set_irn_n(irn, pos, reload);
432         sched_add_before(irn, reload);
433         return reload;
434 }
435
436 static int redir_proj(const ir_node **node, int pos)
437 {
438         const ir_node *n = *node;
439
440         if(is_Proj(n)) {
441                 assert(pos == -1 && "Illegal pos for a Proj");
442                 *node = get_Proj_pred(n);
443                 return get_Proj_proj(n);
444         }
445
446         return 0;
447 }
448
449 static void *put_out_reg_req(arch_register_req_t *req, const ir_node *irn, int out_pos)
450 {
451         const be_node_attr_t *a = get_irn_attr(irn);
452
453         if(out_pos < a->n_outs)
454                 memcpy(req, &a->reg_data[out_pos].req, sizeof(req[0]));
455         else {
456                 req->type = arch_register_req_type_none;
457                 req->cls  = NULL;
458         }
459
460         return req;
461 }
462
463 static void *put_in_reg_req(arch_register_req_t *req, const ir_node *irn, int pos)
464 {
465         const be_node_attr_t *a = get_irn_attr(irn);
466         int n                   = get_irn_arity(irn);
467
468         if(pos < get_irn_arity(irn))
469                 memcpy(req, &a->reg_data[pos].in_req, sizeof(req[0]));
470         else {
471                 req->type = arch_register_req_type_none;
472                 req->cls  = NULL;
473         }
474
475         return req;
476 }
477
478 static const arch_register_req_t *
479 be_node_get_irn_reg_req(const void *self, arch_register_req_t *req, const ir_node *irn, int pos)
480 {
481         int out_pos = pos;
482
483         if(pos < 0) {
484                 if(get_irn_mode(irn) == mode_T)
485                         return NULL;
486
487                 out_pos = redir_proj((const ir_node **) &irn, pos);
488                 assert(is_be_node(irn));
489                 return put_out_reg_req(req, irn, out_pos);
490         }
491
492         else {
493                 return is_be_node(irn) ? put_in_reg_req(req, irn, pos) : NULL;
494         }
495
496         return req;
497 }
498
499 static void
500 be_node_set_irn_reg(const void *_self, ir_node *irn, const arch_register_t *reg)
501 {
502         int out_pos;
503         be_node_attr_t *a;
504
505         out_pos = redir_proj((const ir_node **) &irn, -1);
506         a       = get_irn_attr(irn);
507
508         assert(is_be_node(irn));
509         assert(out_pos < a->n_outs && "position too high");
510         a->reg_data[out_pos].reg = reg;
511 }
512
513 const arch_register_t *
514 be_node_get_irn_reg(const void *_self, const ir_node *irn)
515 {
516         int out_pos;
517         be_node_attr_t *a;
518
519         out_pos = redir_proj((const ir_node **) &irn, -1);
520         a       = get_irn_attr(irn);
521
522         assert(is_be_node(irn));
523         assert(out_pos < a->n_outs && "position too high");
524
525         return a->reg_data[out_pos].reg;
526 }
527
528 arch_irn_class_t be_node_classify(const void *_self, const ir_node *irn)
529 {
530         redir_proj((const ir_node **) &irn, -1);
531
532         switch(get_irn_be_opcode(irn)) {
533 #define XXX(a,b) case beo_ ## a: return arch_irn_class_ ## b;
534                 XXX(Spill, spill)
535                 XXX(Reload, reload)
536                 XXX(Perm, perm)
537                 XXX(Copy, copy)
538 #undef XXX
539                 default:
540                 return 0;
541         }
542
543         return 0;
544 }
545
546 arch_irn_class_t be_node_get_flags(const void *_self, const ir_node *irn)
547 {
548         return 0;
549 }
550
551 static const arch_irn_ops_if_t be_node_irn_ops_if = {
552         be_node_get_irn_reg_req,
553         be_node_set_irn_reg,
554         be_node_get_irn_reg,
555         be_node_classify,
556         be_node_get_flags,
557 };
558
559 static const arch_irn_ops_t be_node_irn_ops = {
560         &be_node_irn_ops_if
561 };
562
563 const void *be_node_get_arch_ops(const arch_irn_handler_t *self, const ir_node *irn)
564 {
565         redir_proj((const ir_node **) &irn, -1);
566         return is_be_node(irn) ? &be_node_irn_ops : NULL;
567 }
568
569 const arch_irn_handler_t be_node_irn_handler = {
570         be_node_get_arch_ops
571 };
572
573 static int dump_node(ir_node *irn, FILE *f, dump_reason_t reason)
574 {
575         be_node_attr_t *at = get_irn_attr(irn);
576         int i;
577
578         assert(is_be_node(irn));
579
580         switch(reason) {
581                 case dump_node_opcode_txt:
582                         fprintf(f, get_op_name(get_irn_op(irn)));
583                         break;
584                 case dump_node_mode_txt:
585                         fprintf(f, get_mode_name(get_irn_mode(irn)));
586                         break;
587                 case dump_node_nodeattr_txt:
588                         break;
589                 case dump_node_info_txt:
590                         fprintf(f, "reg class: %s\n", at->cls->name);
591                         for(i = 0; i < at->n_outs; ++i) {
592                                 const arch_register_t *reg = at->reg_data[i].reg;
593                                 fprintf(f, "reg #%d: %s\n", i, reg ? reg->name : "n/a");
594                         }
595
596                         if(get_irn_be_opcode(irn) == beo_Spill) {
597                                 be_spill_attr_t *a = (be_spill_attr_t *) at;
598
599                                 ir_fprintf(f, "spill context: %+F\n", a->spill_ctx);
600                                 if (a->ent) {
601                                         unsigned ofs = get_entity_offset_bytes(a->ent);
602                                         ir_fprintf(f, "spill entity: %+F offset %x (%d)\n", a->ent, ofs, ofs);
603                                 }
604                                 else {
605                                         ir_fprintf(f, "spill entity: n/a\n");
606                                 }
607                         }
608                         break;
609         }
610
611         return 0;
612 }
613
614 static const ir_op_ops be_node_op_ops = {
615         NULL,
616         NULL,
617         NULL,
618         NULL,
619         NULL,
620         NULL,
621         NULL,
622         NULL,
623         NULL,
624         NULL,
625         NULL,
626         dump_node,
627         NULL
628 };
629
630 pset *nodes_live_at(const arch_env_t *arch_env, const arch_register_class_t *cls, const ir_node *pos, pset *live)
631 {
632         firm_dbg_module_t *dbg = firm_dbg_register("firm.be.node");
633         const ir_node *bl      = is_Block(pos) ? pos : get_nodes_block(pos);
634         ir_node *irn;
635         irn_live_t *li;
636
637         live_foreach(bl, li) {
638                 ir_node *irn = (ir_node *) li->irn;
639                 if(live_is_end(li) && arch_irn_consider_in_reg_alloc(arch_env, cls, irn))
640                         pset_insert_ptr(live, irn);
641         }
642
643         sched_foreach_reverse(bl, irn) {
644                 int i, n;
645                 ir_node *x;
646
647                 /*
648                  * If we encounter the node we want to insert the Perm after,
649                 * exit immediately, so that this node is still live
650                 */
651                 if(irn == pos)
652                         return live;
653
654                 DBG((dbg, LEVEL_1, "%+F\n", irn));
655                 for(x = pset_first(live); x; x = pset_next(live))
656                         DBG((dbg, LEVEL_1, "\tlive: %+F\n", x));
657
658                 if(arch_irn_has_reg_class(arch_env, irn, -1, cls))
659                         pset_remove_ptr(live, irn);
660
661                 for(i = 0, n = get_irn_arity(irn); i < n; ++i) {
662                         ir_node *op = get_irn_n(irn, i);
663
664                         if(arch_irn_consider_in_reg_alloc(arch_env, cls, op))
665                                 pset_insert_ptr(live, op);
666                 }
667         }
668
669         return live;
670 }
671
672 ir_node *insert_Perm_after(const arch_env_t *arch_env,
673                                                    const arch_register_class_t *cls,
674                                                    dom_front_info_t *dom_front,
675                                                    ir_node *pos)
676 {
677         ir_node *bl                 = is_Block(pos) ? pos : get_nodes_block(pos);
678         ir_graph *irg               = get_irn_irg(bl);
679         pset *live                  = pset_new_ptr_default();
680         firm_dbg_module_t *dbg      = firm_dbg_register("be.node");
681
682         ir_node *curr, *irn, *perm, **nodes;
683         int i, n;
684
685         DBG((dbg, LEVEL_1, "Insert Perm after: %+F\n", pos));
686
687         if(!nodes_live_at(arch_env, cls, pos, live));
688
689         n = pset_count(live);
690
691         if(n == 0)
692                 return NULL;
693
694         nodes = malloc(n * sizeof(nodes[0]));
695
696         DBG((dbg, LEVEL_1, "live:\n"));
697         for(irn = pset_first(live), i = 0; irn; irn = pset_next(live), i++) {
698                 DBG((dbg, LEVEL_1, "\t%+F\n", irn));
699                 nodes[i] = irn;
700         }
701
702         perm = be_new_Perm(cls, irg, bl, n, nodes);
703         sched_add_after(pos, perm);
704         free(nodes);
705
706         curr = perm;
707         for(i = 0; i < n; ++i) {
708                 ir_node *copies[1];
709                 ir_node *perm_op = get_irn_n(perm, i);
710                 const arch_register_t *reg = arch_get_irn_register(arch_env, perm_op);
711
712                 ir_mode *mode = get_irn_mode(perm_op);
713                 ir_node *proj = new_r_Proj(irg, bl, perm, mode, i);
714                 arch_set_irn_register(arch_env, proj, reg);
715
716                 sched_add_after(curr, proj);
717                 curr = proj;
718
719                 copies[0] = proj;
720                 be_ssa_constr_single(dom_front, perm_op, 1, copies);
721         }
722         return perm;
723 }