1 /* Loglan82 Compiler&Interpreter
2 Copyright (C) 1993 Institute of Informatics, University of Warsaw
3 Copyright (C) 1993, 1994 LITA, Pau
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 =======================================================================
23 static void rsnuse(argnr);
24 static void ptnuse(argnr);
34 static void rsnuse(n) argnr n;{
36 /* if no next use - replace by 'nop' and exit to 55 */
40 quadruple * curr ; /* gsg for PASCAL WITH translation */
43 notrick = ipmem[ tuple[ qcurr ].arg[ n ] ] ;
44 /* with tuple[ qcurr ] do begin */
45 { curr = tuple + qcurr ; /* gsg PASCAL WITH translation */
47 nextuse = ipmem[ (curr->arg)[ n ] + 2 ] ;
48 (curr->nxtuse)[ n ] = nextuse ;
49 if ( (nextuse == 0) && (! slive(notrick)) )
51 if ((curr->opcode) > 5) /* #lslopen */
53 (curr->opcode) = 195 ;
58 { ipmem[ (curr->arg)[ n ] + 2 ] = 0 ;
59 if (ctpoint < nextuse)
61 putslocal(TRUE, notrick) ;
62 ipmem[ (curr->arg)[ n ] ] = notrick ;
70 static void ptnuse(n) argnr n;{
73 quadruple * curr ; /* gsg for PASCAL WITH translation */
75 /* with tuple[ qcurr ] do */
76 { curr = tuple + qcurr ; /* gsg PASCAL WITH translation */
77 nextuse = ipmem[ (curr->arg)[ n ] + 2 ] ;
78 ipmem[ (curr->arg)[ n ] + 2 ] = qcurr ;
79 (curr->nxtuse)[ n ] = nextuse ;
80 if (ctpoint < nextuse)
82 notrick = ipmem[ (curr->arg)[ n ] ] ;
83 putslocal(TRUE,notrick) ;
84 ipmem[ (curr->arg)[ n ] ] = notrick ;
92 /* SCANS DOWN THE QUADRUPLES TABLE TO ESTABLISH 'NEXT USE' INFORMATION */
93 /* OPERATIONS YIELDING NOT REFERENCED RESULTS ARE REPLACED BY 'NOP'==195*/
94 /* IF VALUE IS USED AFTER CONTROL TRANSMISSION, THE ATTRIBUTE 'SLOCAL' */
97 /* LABEL 55 ; */ /* EXIST FROM RSNUSE IF NO NEXT USE */
99 { quadruple * curr ; /* gsg for PASCAL WITH translation */
104 ctpoint = qlast + 1 ;
106 /* FOR QCURR = QLAST DOWNTO 1 */
107 while (qcurr > 0) /* DO WITH TUPLE [ QCURR ] DO */
108 { curr = tuple + qcurr ; /* PASCAL WITH translation */
110 switch ( opdescr[ curr->opcode ] )
122 if ( curr->opcode <= 160 )
133 case 10 : rsnuse(1) ;
137 case 12 : rsnuse(1) ;
143 case 13 : rsnuse(1) ;
151 case 15 : rsnuse(1) ;
157 if ( curr->opcode > 3 )