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