Pristine Ack-5.5
[Ack-5.5.git] / util / ego / sr / sr.h
1 /* $Id: sr.h,v 1.8 1994/06/24 10:32:00 ceriel Exp $ */
2 /*
3  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
4  * See the copyright notice in the ACK home directory, in the file "Copyright".
5  */
6 /* I N T E R N A L   D A T A S T R U C T U R E S   O F
7  *
8  *       S T R E N G T H   R E D U C T I O N
9  *
10  */
11
12 typedef struct iv       *iv_p;
13 typedef struct code_info *code_p;
14
15 /* An induction variable */
16
17 struct iv {
18         offset   iv_off;        /* offset of the induction variable */
19         line_p   iv_incr;       /* pointer to last instr. of EM-code that
20                                  * increments the induction variable    */
21         offset   iv_step;       /* step value                           */
22 };
23
24
25 /* All information about a reducible piece of code is collected in
26  * a single structure.
27  */
28
29 struct code_info {
30         loop_p    co_loop;      /* the loop the code is in              */
31         bblock_p  co_block;     /* the basic block the code is in       */
32         line_p    co_lfirst;    /* first instruction of the code        */
33         line_p    co_llast;     /* last  instruction of the code        */
34         line_p    co_ivexpr;    /* start of linear expr. using iv       */
35         line_p    co_endexpr;   /* end of the expression                */
36         int       co_sign;      /* sign of iv in above expr             */
37         iv_p      co_iv;        /* the induction variable               */
38         offset    co_temp;      /* temporary variable                   */
39         int       co_tmpsize;   /* size of the temp. variable (ws or ps)*/
40         int       co_instr;     /* the expensive instruction (mli,lar..)*/
41         union {
42                 line_p  co_loadlc;      /* LOC lc instruction (for mult.)*/
43                 line_p  co_desc;        /* load address of descriptor
44                                          *   (for lar etc.)             */
45         } c_o;
46 };
47
48 #define LOAD 0
49 #define STORE 1
50
51 #define DLINK(l1,l2)    l1->l_next=l2; l2->l_prev=l1
52
53 #define same_local(l1,l2)       (off_set(l1) == off_set(l2))
54
55 #define LP_BLOCKS       lp_extend->lpx_sr.lpx_blocks
56 #define LP_DONE         lp_extend->lpx_sr.lpx_done
57 #define LP_HEADER       lp_extend->lpx_sr.lpx_header
58 #define LP_INSTR        lp_extend->lpx_sr.lpx_instr
59
60 /* Parameters to be provided by environment: */
61
62 extern int ovfl_harmful;  /* Does overflow during multiplication
63                             * cause a trap ?
64                             */
65 extern int arrbound_harmful;  /* Is it harmful to take the address of
66                                 * a non-existing array element ?
67                                 */
68 extern int sli_threshold; /* Try to optimize SLI if shift-count larger than
69                             * this
70                             */
71 extern int Ssr;  /* #optimizations found */
72
73 /* core allocation macros */
74 #define newiv()         (iv_p)          newstruct(iv)
75 #define newcinfo()      (code_p)        newstruct(code_info)
76 #define newsrlpx()      (lpext_p)       newstruct(lpext_sr)
77 #define oldiv(x)        oldstruct(iv,x)
78 #define oldcinfo(x)     oldstruct(code_info,x)
79 #define oldsrlpx(x)     oldstruct(lpext_sr,x)