Good day and welcome to the FIRM XMALLOC*() macros. These macros are provided for...
[libfirm] / ir / opt / tailrec.c
1 /*
2  * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
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.
10  *
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.
14  *
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
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief   Tail-recursion call optimization.
23  * @date    08.06.2004
24  * @author  Michael Beck
25  * @version $Id$
26  */
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30
31 #include <string.h>
32 #include <assert.h>
33
34 #include "debug.h"
35 #include "iroptimize.h"
36 #include "scalar_replace.h"
37 #include "array_t.h"
38 #include "irprog_t.h"
39 #include "irgwalk.h"
40 #include "irgmod.h"
41 #include "irop.h"
42 #include "irnode_t.h"
43 #include "irgraph_t.h"
44 #include "ircons.h"
45 #include "irflag.h"
46 #include "trouts.h"
47 #include "irouts.h"
48 #include "irhooks.h"
49 #include "ircons_t.h"
50
51 DEBUG_ONLY(static firm_dbg_module_t *dbg);
52
53 /**
54  * the environment for collecting data
55  */
56 typedef struct _collect_t {
57         ir_node *proj_X;      /**< initial exec proj */
58         ir_node *block;       /**< old first block */
59         int     blk_idx;      /**< cfgpred index of the initial exec in block */
60         ir_node *proj_m;      /**< memory from start proj's */
61         ir_node *proj_data;   /**< linked list of all parameter access proj's */
62 } collect_t;
63
64 /**
65  * walker for collecting data, fills a collect_t environment
66  */
67 static void collect_data(ir_node *node, void *env) {
68         collect_t *data = env;
69         ir_node *pred;
70         ir_op *op;
71
72         switch (get_irn_opcode(node)) {
73         case iro_Proj:
74                 pred = get_Proj_pred(node);
75
76                 op = get_irn_op(pred);
77                 if (op == op_Proj) {
78                         ir_node *start = get_Proj_pred(pred);
79
80                         if (is_Start(start)) {
81                                 if (get_Proj_proj(pred) == pn_Start_T_args) {
82                                         /* found Proj(ProjT(Start)) */
83                                         set_irn_link(node, data->proj_data);
84                                         data->proj_data = node;
85                                 }
86                         }
87                 } else if (op == op_Start) {
88                         if (get_Proj_proj(node) == pn_Start_X_initial_exec) {
89                                 /* found ProjX(Start) */
90                                 data->proj_X = node;
91                         }
92                 }
93                 break;
94         case iro_Block: {
95                 int i, n_pred = get_Block_n_cfgpreds(node);
96
97                 /*
98                  * the first block has the initial exec as cfg predecessor
99                  */
100                 if (node != get_irg_start_block(current_ir_graph)) {
101                         for (i = 0; i < n_pred; ++i) {
102                                 if (get_Block_cfgpred(node, i) == data->proj_X) {
103                                         data->block   = node;
104                                         data->blk_idx = i;
105                                         break;
106                                 }
107                         }
108                 }
109                 break;
110         }
111         default:
112                 break;
113         }
114 }
115
116 typedef enum tail_rec_variants {
117         TR_DIRECT,  /**< direct return value, i.e. return func(). */
118         TR_ADD,     /**< additive return value, i.e. return x +/- func() */
119         TR_MUL,     /**< multiplicative return value, i.e. return x * func() or return -func() */
120         TR_BAD,     /**< any other transformation */
121         TR_UNKNOWN  /**< during construction */
122 } tail_rec_variants;
123
124 typedef struct tr_env {
125         int               n_tail_calls;  /**< number of tail calls found */
126         int               n_ress;        /**< number of return values */
127         tail_rec_variants *variants;     /**< return value variants */
128         ir_node           *rets;         /**< list of returns that can be transformed */
129 } tr_env;
130
131
132 /**
133  * do the graph reconstruction for tail-recursion elimination
134  *
135  * @param irg           the graph that will reconstructed
136  * @param rets          linked list of all rets
137  * @param n_tail_calls  number of tail-recursion calls
138  */
139 static void do_opt_tail_rec(ir_graph *irg, tr_env *env) {
140         ir_node *end_block = get_irg_end_block(irg);
141         ir_node *block, *jmp, *call, *calls;
142         ir_node **in;
143         ir_node **phis;
144         ir_node ***call_params;
145         ir_node *p, *n;
146         int i, j, n_params, n_locs;
147         collect_t data;
148         int rem            = get_optimize();
149         ir_entity *ent     = get_irg_entity(irg);
150         ir_type *method_tp = get_entity_type(ent);
151         ir_graph *old      = current_ir_graph;
152
153         current_ir_graph = irg;
154
155         assert(env->n_tail_calls > 0);
156
157         /* we add new nodes, so the outs are inconsistent */
158         set_irg_outs_inconsistent(irg);
159
160         /* we add new blocks and change the control flow */
161         set_irg_doms_inconsistent(irg);
162         set_irg_extblk_inconsistent(irg);
163
164         /* we add a new loop */
165         set_irg_loopinfo_inconsistent(irg);
166
167         /* calls are removed */
168         set_trouts_inconsistent();
169
170         /* we must build some new nodes WITHOUT CSE */
171         set_optimize(0);
172
173         /* collect needed data */
174         data.proj_X    = NULL;
175         data.block     = NULL;
176         data.blk_idx   = -1;
177         data.proj_m    = get_irg_initial_mem(irg);
178         data.proj_data = NULL;
179         irg_walk_graph(irg, NULL, collect_data, &data);
180
181         /* check number of arguments */
182         call = get_irn_link(end_block);
183         n_params = get_Call_n_params(call);
184
185         assert(data.proj_X && "Could not find initial exec from Start");
186         assert(data.block  && "Could not find first block");
187         assert(data.proj_m && "Could not find initial memory");
188         assert((data.proj_data || n_params == 0) && "Could not find Proj(ProjT(Start)) of non-void function");
189
190         /* allocate in's for phi and block construction */
191         NEW_ARR_A(ir_node *, in, env->n_tail_calls + 1);
192
193         in[0] = data.proj_X;
194
195         /* turn Return's into Jmp's */
196         for (i = 1, p = env->rets; p; p = n) {
197                 ir_node *block = get_nodes_block(p);
198
199                 n = get_irn_link(p);
200                 in[i++] = new_r_Jmp(irg, block);
201
202                 // exchange(p, new_r_Bad(irg));
203
204                 /* we might generate an endless loop, so add
205                  * the block to the keep-alive list */
206                 add_End_keepalive(get_irg_end(irg), block);
207         }
208
209         /* create a new block at start */
210         block = new_r_Block(irg, env->n_tail_calls + 1, in);
211         jmp   = new_r_Jmp(irg, block);
212
213         /* the old first block is now the second one */
214         set_Block_cfgpred(data.block, data.blk_idx, jmp);
215
216         /* allocate phi's, position 0 contains the memory phi */
217         NEW_ARR_A(ir_node *, phis, n_params + 1);
218
219         /* build the memory phi */
220         i = 0;
221         in[i] = new_r_Proj(irg, get_irg_start_block(irg), get_irg_start(irg), mode_M, pn_Start_M);
222         set_irg_initial_mem(irg, in[i]);
223         ++i;
224
225         for (calls = call; calls; calls = get_irn_link(calls)) {
226                 in[i] = get_Call_mem(calls);
227                 ++i;
228         }
229         assert(i == env->n_tail_calls + 1);
230
231         phis[0] = new_r_Phi(irg, block, env->n_tail_calls + 1, in, mode_M);
232
233         /* build the data Phi's */
234         if (n_params > 0) {
235                 ir_node *calls;
236                 ir_node *args;
237                 ir_node *args_bl;
238
239                 NEW_ARR_A(ir_node **, call_params, env->n_tail_calls);
240
241                 /* collect all parameters */
242                 for (i = 0, calls = call; calls; calls = get_irn_link(calls)) {
243                         call_params[i] = get_Call_param_arr(calls);
244                         ++i;
245                 }
246
247                 /* build new Proj's and Phi's */
248                 args    = get_irg_args(irg);
249                 args_bl = get_nodes_block(args);
250                 for (i = 0; i < n_params; ++i) {
251                         ir_mode *mode = get_type_mode(get_method_param_type(method_tp, i));
252
253                         in[0] = new_r_Proj(irg, args_bl, args, mode, i);
254                         for (j = 0; j < env->n_tail_calls; ++j)
255                                 in[j + 1] = call_params[j][i];
256
257                         phis[i + 1] = new_r_Phi(irg, block, env->n_tail_calls + 1, in, mode);
258                 }
259         }
260
261         /*
262          * ok, we are here, so we have build and collected all needed Phi's
263          * now exchange all Projs into links to Phi
264          */
265         exchange(data.proj_m, phis[0]);
266         for (p = data.proj_data; p; p = n) {
267                 long proj = get_Proj_proj(p);
268
269                 assert(0 <= proj && proj < n_params);
270                 n = get_irn_link(p);
271                 exchange(p, phis[proj + 1]);
272         }
273
274         /* tail recursion was done, all info is invalid */
275         set_irg_doms_inconsistent(irg);
276         set_irg_outs_inconsistent(irg);
277         set_irg_extblk_inconsistent(irg);
278         set_irg_loopinfo_state(current_ir_graph, loopinfo_cf_inconsistent);
279         set_trouts_inconsistent();
280         set_irg_callee_info_state(irg, irg_callee_info_inconsistent);
281
282         set_optimize(rem);
283
284         /* check if we need new values */
285         n_locs = 0;
286         for (i = 0; i < env->n_ress; ++i) {
287                 if (env->variants[i] != TR_DIRECT)
288                         ++n_locs;
289         }
290
291         if (n_locs > 0) {
292                 ir_node *bad, *start_block;
293                 ir_node **in;
294                 ir_mode **modes;
295
296                 NEW_ARR_A(ir_node *, in, n_locs);
297                 NEW_ARR_A(ir_mode *, modes, n_locs);
298                 ssa_cons_start(irg, n_locs);
299
300                 start_block = get_irg_start_block(irg);
301                 set_cur_block(start_block);
302
303                 for (i = 0; i < env->n_ress; ++i) {
304                         ir_type *tp = get_method_res_type(method_tp, i);
305                         ir_mode *mode = get_type_mode(tp);
306
307                         modes[i] = mode;
308                         if (env->variants[i] == TR_ADD) {
309                                 set_value(i, new_Const(mode, get_mode_null(mode)));
310                         } else if (env->variants[i] == TR_MUL) {
311                                 set_value(i, new_Const(mode, get_mode_one(mode)));
312                         }
313                 }
314                 mature_immBlock(start_block);
315
316                 /* no: we can kill all returns */
317                 bad = get_irg_bad(irg);
318
319                 for (p = env->rets; p; p = n) {
320                         ir_node *block = get_nodes_block(p);
321                         ir_node *call, *mem, *jmp, *tuple;
322
323                         set_cur_block(block);
324                         n = get_irn_link(p);
325
326                         call = skip_Proj(get_Return_mem(p));
327                         assert(is_Call(call));
328
329                         mem = get_Call_mem(call);
330
331                         /* create a new jump, free of CSE */
332                         set_optimize(0);
333                         jmp = new_Jmp();
334                         set_optimize(rem);
335
336                         for (i = 0; i < env->n_ress; ++i) {
337                                 if (env->variants[i] != TR_DIRECT) {
338                                         in[i] = get_value(i, modes[i]);
339                                 } else {
340                                         in[i] = bad;
341                                 }
342                         }
343                         /* create a new tuple for the return values */
344                         tuple = new_Tuple(env->n_ress, in);
345
346                         turn_into_tuple(call, pn_Call_max);
347                         set_Tuple_pred(call, pn_Call_M,                mem);
348                         set_Tuple_pred(call, pn_Call_X_regular,        jmp);
349                         set_Tuple_pred(call, pn_Call_X_except,         bad);
350                         set_Tuple_pred(call, pn_Call_T_result,         tuple);
351                         set_Tuple_pred(call, pn_Call_M_except,         mem);
352                         set_Tuple_pred(call, pn_Call_P_value_res_base, bad);
353
354                         for (i = 0; i < env->n_ress; ++i) {
355                                 ir_node *res = get_Return_res(p, i);
356                                 if (env->variants[i] != TR_DIRECT) {
357                                         set_value(i, res);
358                                 }
359                         }
360
361                         exchange(p, bad);
362                 }
363
364                 /* finally fix all other returns */
365                 end_block = get_irg_end_block(irg);
366                 for (i = get_Block_n_cfgpreds(end_block) - 1; i >= 0; --i) {
367                         ir_node *ret = get_Block_cfgpred(end_block, i);
368
369                         /* search all Returns of a block */
370                         if (! is_Return(ret))
371                                 continue;
372
373                         set_cur_block(get_nodes_block(ret));
374                         for (j = 0; j < env->n_ress; ++j) {
375                                 ir_node *pred = get_Return_res(ret, j);
376                                 ir_node *n;
377
378                                 switch (env->variants[j]) {
379                                 case TR_DIRECT:
380                                         continue;
381
382                                 case TR_ADD:
383                                         n = get_value(j, modes[j]);
384                                         n = new_Add(n, pred, modes[j]);
385                                         set_Return_res(ret, j, n);
386                                         break;
387
388                                 case TR_MUL:
389                                         n = get_value(j, modes[j]);
390                                         n = new_Mul(n, pred, modes[j]);
391                                         set_Return_res(ret, j, n);
392                                         break;
393
394                                 default:
395                                         assert(!"unexpected tail recursion variant");
396                                 }
397                         }
398                 }
399                 ssa_cons_finish(irg);
400         } else {
401                 ir_node *bad = get_irg_bad(irg);
402
403                 /* no: we can kill all returns */
404                 for (p = env->rets; p; p = n) {
405                         n = get_irn_link(p);
406                         exchange(p, bad);
407                 }
408         }
409         current_ir_graph = old;
410 }
411
412 /**
413  * Check the lifetime of locals in the given graph.
414  * Tail recursion can only be done, if we can prove that
415  * the lifetime of locals end with the recursive call.
416  * We do this by checking that no address of a local variable is
417  * stored or transmitted as an argument to a call.
418  *
419  * @return non-zero if it's ok to do tail recursion
420  */
421 static int check_lifetime_of_locals(ir_graph *irg) {
422         ir_node *irg_frame, *irg_val_param_base;
423         int i;
424
425         irg_frame = get_irg_frame(irg);
426         for (i = get_irn_n_outs(irg_frame) - 1; i >= 0; --i) {
427                 ir_node *succ = get_irn_out(irg_frame, i);
428
429                 if (is_Sel(succ) && is_address_taken(succ))
430                         return 0;
431         }
432
433         /* Check if we have compound arguments.
434            For now, we cannot handle them, */
435         irg_val_param_base = get_irg_value_param_base(irg);
436         if (get_irn_n_outs(irg_val_param_base) > 0)
437                 return 0;
438
439         return 1;
440 }
441
442 /**
443  * Examine irn and detect the recursion variant.
444  */
445 static tail_rec_variants find_variant(ir_node *irn, ir_node *call) {
446         ir_node           *a, *b;
447         tail_rec_variants va, vb, res;
448
449         if (skip_Proj(skip_Proj(irn)) == call) {
450                 /* found it */
451                 return TR_DIRECT;
452         }
453         switch (get_irn_opcode(irn)) {
454         case iro_Add:
455                 /* try additive */
456                 a = get_Add_left(irn);
457                 if (get_irn_MacroBlock(a) != get_irn_MacroBlock(call)) {
458                         /* we are outside, ignore */
459                         va = TR_UNKNOWN;
460                 } else {
461                         va = find_variant(a, call);
462                         if (va == TR_BAD)
463                                 return TR_BAD;
464                 }
465                 b = get_Add_right(irn);
466                 if (get_irn_MacroBlock(b) != get_irn_MacroBlock(call)) {
467                         /* we are outside, ignore */
468                         vb = TR_UNKNOWN;
469                 } else {
470                         vb = find_variant(b, call);
471                         if (vb == TR_BAD)
472                                 return TR_BAD;
473                 }
474                 if (va == vb) {
475                         res = va;
476                 }
477                 else if (va == TR_UNKNOWN)
478                         res = vb;
479                 else if (vb == TR_UNKNOWN)
480                         res = va;
481                 else {
482                         /* they are different but none is TR_UNKNOWN -> incompatible */
483                         return TR_BAD;
484                 }
485                 if (res == TR_DIRECT || res == TR_ADD)
486                         return TR_ADD;
487                 /* not compatible */
488                 return TR_BAD;
489
490         case iro_Sub:
491                 /* try additive, but return value must be left */
492                 a = get_Sub_left(irn);
493                 if (get_irn_MacroBlock(a) != get_irn_MacroBlock(call)) {
494                         /* we are outside, ignore */
495                         va = TR_UNKNOWN;
496                 } else {
497                         va = find_variant(a, call);
498                         if (va == TR_BAD)
499                                 return TR_BAD;
500                 }
501                 b = get_Sub_right(irn);
502                 if (get_irn_MacroBlock(b) != get_irn_MacroBlock(call)) {
503                         /* we are outside, ignore */
504                         vb = TR_UNKNOWN;
505                 } else {
506                         vb = find_variant(b, call);
507                         if (vb != TR_UNKNOWN)
508                                 return TR_BAD;
509                 }
510                 res = va;
511                 if (res == TR_DIRECT || res == TR_ADD)
512                         return res;
513                 /* not compatible */
514                 return TR_BAD;
515
516         case iro_Mul:
517                 /* try multiplicative */
518                 a = get_Mul_left(irn);
519                 if (get_irn_MacroBlock(a) != get_irn_MacroBlock(call)) {
520                         /* we are outside, ignore */
521                         va = TR_UNKNOWN;
522                 } else {
523                         va = find_variant(a, call);
524                         if (va == TR_BAD)
525                                 return TR_BAD;
526                 }
527                 b = get_Mul_right(irn);
528                 if (get_irn_MacroBlock(b) != get_irn_MacroBlock(call)) {
529                         /* we are outside, ignore */
530                         vb = TR_UNKNOWN;
531                 } else {
532                         vb = find_variant(b, call);
533                         if (vb == TR_BAD)
534                                 return TR_BAD;
535                 }
536                 if (va == vb) {
537                         res = va;
538                 }
539                 else if (va == TR_UNKNOWN)
540                         res = vb;
541                 else if (vb == TR_UNKNOWN)
542                         res = va;
543                 else {
544                         /* they are different but none is TR_UNKNOWN -> incompatible */
545                         return TR_BAD;
546                 }
547                 if (res == TR_DIRECT || res == TR_MUL)
548                         return TR_MUL;
549                 /* not compatible */
550                 return TR_BAD;
551
552         case iro_Minus:
553                 /* try multiplicative */
554                 a = get_Minus_op(irn);
555                 res =  find_variant(a, call);
556                 if (res == TR_DIRECT)
557                         return TR_MUL;
558                 if (res == TR_MUL || res == TR_UNKNOWN)
559                         return res;
560                 /* not compatible */
561                 return TR_BAD;
562
563         default:
564                 return TR_UNKNOWN;
565         }
566 }
567
568
569 /*
570  * convert simple tail-calls into loops
571  */
572 int opt_tail_rec_irg(ir_graph *irg) {
573         tr_env            env;
574         ir_node           *end_block;
575         int               i, n_ress, n_tail_calls = 0;
576         ir_node           *rets = NULL;
577         ir_type           *mtd_type, *call_type;
578         ir_entity         *ent;
579
580         assure_irg_outs(irg);
581
582         if (! check_lifetime_of_locals(irg))
583                 return 0;
584
585
586         ent      = get_irg_entity(irg);
587         mtd_type = get_entity_type(ent);
588     n_ress   = get_method_n_ress(mtd_type);
589
590         env.variants = NULL;
591         env.n_ress   = n_ress;
592
593         if (n_ress > 0) {
594                 NEW_ARR_A(tail_rec_variants, env.variants, n_ress);
595
596                 for (i = 0; i < n_ress; ++i)
597                         env.variants[i] = TR_DIRECT;
598         }
599
600         /*
601          * This tail recursion optimization works best
602          * if the Returns are normalized.
603          */
604         normalize_n_returns(irg);
605
606         end_block = get_irg_end_block(irg);
607         set_irn_link(end_block, NULL);
608
609         for (i = get_Block_n_cfgpreds(end_block) - 1; i >= 0; --i) {
610                 ir_node *ret = get_Block_cfgpred(end_block, i);
611                 ir_node *call, *call_ptr;
612                 int j;
613                 ir_node **ress;
614
615                 /* search all Returns of a block */
616                 if (! is_Return(ret))
617                         continue;
618
619                 /* check, if it's a Return self() */
620                 call = skip_Proj(get_Return_mem(ret));
621                 if (! is_Call(call))
622                         continue;
623
624                 /* the call must be in the same block as the return */
625                 if (get_nodes_block(call) != get_nodes_block(ret))
626                         continue;
627
628                 /* check if it's a recursive call */
629                 call_ptr = get_Call_ptr(call);
630
631                 if (! is_Global(call_ptr))
632                         continue;
633
634                 ent = get_Global_entity(call_ptr);
635                 if (!ent || get_entity_irg(ent) != irg)
636                         continue;
637
638                 /*
639                  * Check, that the types match. At least in C
640                  * this might fail.
641                  */
642                 mtd_type  = get_entity_type(ent);
643                 call_type = get_Call_type(call);
644
645                 if (mtd_type != call_type) {
646                         /*
647                          * Hmm, the types did not match, bad.
648                          * This can happen in C when no prototype is given
649                          * or K&R style is used.
650                          */
651 #if 0
652                         printf("Warning: Tail recursion fails because of different method and call types:\n");
653                         dump_type(mtd_type);
654                         dump_type(call_type);
655 #endif
656                         continue;
657                 }
658
659                 /* ok, mem is routed to a recursive call, check return args */
660                 ress = get_Return_res_arr(ret);
661                 for (j = get_Return_n_ress(ret) - 1; j >= 0; --j) {
662                         tail_rec_variants var = find_variant(ress[j], call);
663
664                         if (var >= TR_BAD) {
665                                 /* cannot be transformed */
666                                 break;
667                         }
668                         if (var == TR_DIRECT)
669                                 var = env.variants[j];
670                         else if (env.variants[j] == TR_DIRECT)
671                                 env.variants[j] = var;
672                         if (env.variants[j] != var) {
673                                 /* not compatible */
674                                 break;
675                         }
676                 }
677                 if (j >= 0)
678                         continue;
679
680                 /* here, we have found a call */
681                 set_irn_link(call, get_irn_link(end_block));
682                 set_irn_link(end_block, call);
683                 ++n_tail_calls;
684
685                 /* link all returns, we will need this */
686                 set_irn_link(ret, rets);
687                 rets = ret;
688         }
689
690         /* now, end_block->link contains the list of all tail calls */
691         if (n_tail_calls <= 0)
692                 return 0;
693
694         DB((dbg, LEVEL_2, "  Performing tail recursion for graph %s and %d Calls\n",
695             get_entity_ld_name(get_irg_entity(irg)), n_tail_calls));
696
697         hook_tail_rec(irg, n_tail_calls);
698
699         env.n_tail_calls = n_tail_calls;
700         env.rets         = rets;
701         do_opt_tail_rec(irg, &env);
702
703         return n_tail_calls;
704 }
705
706 /*
707  * optimize tail recursion away
708  */
709 void opt_tail_recursion(void) {
710         int i;
711         int n_opt_applications = 0;
712         ir_graph *irg;
713
714         FIRM_DBG_REGISTER(dbg, "firm.opt.tailrec");
715
716         for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
717                 irg = get_irp_irg(i);
718
719                 current_ir_graph = irg;
720
721                 ir_reserve_resources(irg, IR_RESOURCE_IRN_LINK);
722                 if (opt_tail_rec_irg(irg))
723                         ++n_opt_applications;
724
725                 ir_free_resources(irg, IR_RESOURCE_IRN_LINK);
726         }
727
728         DB((dbg, LEVEL_1, "Performed tail recursion for %d of %d graphs\n",
729             n_opt_applications, get_irp_n_irgs()));
730 }