Overview
Comment:More efficient generation of optimised code (I hope)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: b9e695d384b5e9b09dfe4caa499cff00304ace5c8975229a5dbaf45a4ddd41d1
User & Date: gawthrop@users.sourceforge.net on 2001-07-23 23:27:49
Other Links: branch diff | manifest | tags
Context
2001-07-23
23:29:20
Don't read "params.r" check-in: 837ec716f1 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
23:27:49
More efficient generation of optimised code (I hope) check-in: b9e695d384 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
23:26:23
Removed some boring user feedback check-in: 4b6be1b1fb user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/cse2smx_lang from [2254554969] to [840ce4dc3c].

26
27
28
29
30
31
32
33
34

35
36
37
38
39
40
41
	matrix='yes';
	;;
    -optimise)
	optimise='LOAD SCOPE; ON GENTRANOPT;';
        iname='INAME mtt_o;';
	;;
    -fixcc )
        include=`echo 'in "'$MTT_LIB'/reduce/fix_c.r";'`
        blurb2='fixing c and cc code';

		;;
    *)
	echo $1 is an unknown option
        exit;;
  esac
  shift
done







|

>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
	matrix='yes';
	;;
    -optimise)
	optimise='LOAD SCOPE; ON GENTRANOPT;';
        iname='INAME mtt_o;';
	;;
    -fixcc )
        fix_pow='FOR ALL x,y LET x^y = pow(x,y);'
        blurb2='fixing c and cc code';
        unfix_pow='FOR ALL x,y CLEAR x^y;'
		;;
    *)
	echo $1 is an unknown option
        exit;;
  esac
  shift
done
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
lang := $lang;

in "$1_subs.r";
in "$1_def.r";
in "$1_cse.r";
in "$1_cr.r";

%% Fixes for c and cc (if needed)
$include;


clear mttx; % Dont need this now - use mkid instead

OFF Echo;

% Load the general translator package
LOAD GENTRAN;







<
<
<







111
112
113
114
115
116
117



118
119
120
121
122
123
124
lang := $lang;

in "$1_subs.r";
in "$1_def.r";
in "$1_cse.r";
in "$1_cr.r";





clear mttx; % Dont need this now - use mkid instead

OFF Echo;

% Load the general translator package
LOAD GENTRAN;
163
164
165
166
167
168
169


170
171
172
173
174
175

176
177
178
179

180
181
182
183
184
185
186
    BEGIN
      write "matrix mtta(", mttnx, ",", mttnx, ");";    
      write "matrix mttb(", mttnx, ",", mttnu, ");";    
      write "matrix mttc(", mttny, ",", mttnx, ");";    
      write "matrix mttd(", mttny, ",", mttnu, ");";    
    END;



% find MTTA : the A matrix
  FOR i := 1:MTTNx DO
  BEGIN
    mttAAx_i := 0;
    FOR j := 1:MTTNx DO
    BEGIN

      ij := i + MTTNx*(j-1);
      xj := mkid(mttx,j);
      a_ij := df(MTTEdx(i,1), xj, 1);
      aa_ij := MTTE(i,j) - mttt*a_ij;

      IF (aa_ij NEQ 0) THEN
        IF ($nmatrix EQ 1) THEN
        BEGIN
          %% Write a  with full indexing
          $iname
          GENTRAN mtta(i,j) ::=: aa_ij;
        END;







>
>






>




>







161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
    BEGIN
      write "matrix mtta(", mttnx, ",", mttnx, ");";    
      write "matrix mttb(", mttnx, ",", mttnu, ");";    
      write "matrix mttc(", mttny, ",", mttnx, ");";    
      write "matrix mttd(", mttny, ",", mttnu, ");";    
    END;

  ${fix_pow} %% set x^y to pow(x,y)

% find MTTA : the A matrix
  FOR i := 1:MTTNx DO
  BEGIN
    mttAAx_i := 0;
    FOR j := 1:MTTNx DO
    BEGIN
      ${unfix_pow} %% Revert to x^y form
      ij := i + MTTNx*(j-1);
      xj := mkid(mttx,j);
      a_ij := df(MTTEdx(i,1), xj, 1);
      aa_ij := MTTE(i,j) - mttt*a_ij;
      ${fix_pow} %% set x^y to pow(x,y)
      IF (aa_ij NEQ 0) THEN
        IF ($nmatrix EQ 1) THEN
        BEGIN
          %% Write a  with full indexing
          $iname
          GENTRAN mtta(i,j) ::=: aa_ij;
        END;
194
195
196
197
198
199
200


201
202
203
204
205
206
207
      END;
      IF (mttAAx_i NEQ 0) THEN
        IF (($nrep EQ 0) OR ($nrep EQ 2)) THEN
        BEGIN
          $iname
          GENTRAN mttax(i) ::=: mttAAx_i;
        END;


  END;

%Shut the  output according to the language.
 GENTRANSHUT "$1_$rep.body";
EOF

fix_broken_numbers ( ) {







>
>







196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
      END;
      IF (mttAAx_i NEQ 0) THEN
        IF (($nrep EQ 0) OR ($nrep EQ 2)) THEN
        BEGIN
          $iname
          GENTRAN mttax(i) ::=: mttAAx_i;
        END;


  END;

%Shut the  output according to the language.
 GENTRANSHUT "$1_$rep.body";
EOF

fix_broken_numbers ( ) {


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]