Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – tendra.SVN – Blame – //branches/tendra5/src/installers/alpha/common/code_here.c – Rev 2

Subversion Repositories tendra.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
/* 	$Id: code_here.c,v 1.1.1.1 1998/01/17 15:55:58 release Exp $	 */
32
 
33
#ifndef lint
34
static char vcid[] = "$Id: code_here.c,v 1.1.1.1 1998/01/17 15:55:58 release Exp $";
35
#endif /* lint */
36
 
37
/*
38
** code_here.c
39
*/
40
 
41
/*
42
$Log: code_here.c,v $
43
 * Revision 1.1.1.1  1998/01/17  15:55:58  release
44
 * First version to be checked into rolling release.
45
 *
46
 * Revision 1.3  1995/08/21  08:42:55  john
47
 * Changed include files
48
 *
49
 * Revision 1.2  1995/05/23  10:53:17  john
50
 * Changes for spec 3.1
51
 *
52
 * Revision 1.1.1.1  1995/03/23  10:39:02  john
53
 * Entered into CVS
54
 *
55
 * Revision 1.7  1995/03/23  09:59:49  john
56
 * Fixed so the assignment of a := (top_tag) gives zero.
57
 *
58
*/
59
 
60
#include "config.h"
61
#include "common_types.h"
62
#include "addresstypes.h"
63
#include "procrectypes.h"
64
#include "labels.h"
65
#include "expmacs.h"
66
#include "tags.h"
67
#include "coder.h"
68
#include "exp.h"
69
#include "bitsmacs.h"
70
#include "locate.h"
71
#include "inst_fmt.h"
72
#include "alpha_ins.h"
73
#include "shapemacs.h"
74
#include "special.h"
75
#include "handle_sregs.h"
76
#include "regexps.h"
77
#include "code_here.h"
78
#include "reg_defs.h"
79
 
80
 
81
/*
82
  regofval
83
  The procedure regofval checks to see if an exp is a load_tag
84
  that has been allocated into a fixpnt register and if so return 
85
  it or else 100.
86
*/
87
int   regofval
88
    PROTO_N ( ( e ) )
89
    PROTO_T ( exp e )
90
{
91
  exp decx = son (e);
92
  if (name (e) == name_tag && name (decx) == ident_tag) {/* ident tag */
93
    if ((props (decx) & defer_bit) != 0) {
94
      return regofval (son (decx));
95
    }
96
    if ((props (decx) & inreg_bits) != 0) {
97
      return ((isvar (decx)) ? (-no (decx)) : (no (decx)));
98
    }
99
    return 100;
100
  }
101
  else
102
  if ((name (e) == val_tag && no (e) == 0) || name(e) == clear_tag ||
103
    name(e) == top_tag) {
104
	return 31;
105
  }
106
  else {
107
	return 100;
108
  }
109
}
110
 
111
/*
112
  add code to return 31 if fval is 0.0
113
*/
114
int   fregofval
115
    PROTO_N ( ( e ) )
116
    PROTO_T ( exp e )
117
{
118
  exp decx = son (e);
119
  if (name (e) == name_tag && name (decx) == ident_tag) {
120
    if ((props (decx) & infreg_bits) != 0) {
121
      return no (decx);
122
    }
123
#if 0
124
    if((props(decx) & infreg_bits) != 0){
125
      return ((isvar(decx))?(-no(decx)):(no(decx)));
126
    }
127
#endif
128
    return 100;
129
  }
130
  else
131
    if(name(e) == clear_tag || name(e) == top_tag){
132
      return 0;
133
    }
134
    else {
135
      return 100;
136
    }
137
}
138
 
139
 
140
 
141
 
142
/*
143
  code_here
144
  The procedure code_here calls make_code and ensures that
145
  any internal exit labels are tied up after the call.
146
*/
147
int   code_here
148
    PROTO_N ( ( e, sp, dest ) )
149
    PROTO_T ( exp e X space sp X where dest )
150
{
151
  makeans mka;
152
#if DO_SCHEDULE && ENCAPSULATE_LABELS
153
  if(name(e) == rep_tag) start_new_capsule(true);
154
#endif
155
  mka = make_code (e, sp, dest, 0);
156
  if (mka.lab != 0) {
157
    (void)set_label (mka.lab);
158
#if DO_SCHEDULE && ENCAPSULATE_LABELS
159
    if(name(e) == rep_tag) close_capsule();
160
#endif    
161
  }
162
  return mka.regmove;
163
}
164
 
165
ash ash0 = {
166
  0, 0
167
};
168
ash ash32 = {
169
  32, 32
170
};
171
 
172
ash ash64 = {
173
  64,64
174
};
175
 
176
 
177
int reg_operand
178
    PROTO_N ( ( e, sp ) )
179
    PROTO_T ( exp e X space sp )
180
{
181
 
182
  int   x = regofval (e);
183
  ans aa;
184
  where w;
185
  if (x >= 0 && x < 100) {
186
    return x;
187
  }				/* x is a register for e */
188
  if (name (e) == cont_tag) {
189
    x = regofval (son (e));
190
    if (x < 0) {
191
      return (-x);
192
    }
193
  }
194
  else
195
    if (name (e) == apply_tag || (name(e) == apply_general_tag && 
196
	specialfn (son (e)) == 0)) {
197
				/* apply proc */
198
      setregalt (aa, RESULT_REG);
199
      w.answhere = aa;
200
      w.ashwhere = ash0;
201
      (void)make_code (e, sp, w, 0);
202
      return RESULT_REG;	/* simple proc calls give result in reg 0
203
				*/
204
    }
205
 
206
  aa = iskept (e);
207
  if (aa.discrim == inreg && regalt (aa) != NO_REG) {
208
				/* the same expression has already been
209
				   evaluated into a reg */
210
    return regalt (aa);
211
  }
212
  if (aa.discrim == notinreg) {
213
    instore is;
214
    is = insalt (aa);
215
    if (is.adval && is.b.offset == 0) {
216
      int   r = is.b.base;
217
      /* the same expression has already been evaluated into a reg */
218
      return r;
219
    }
220
  }
221
 
222
  {
223
    int   reg = -1;
224
    setsomeregalt (aa, &reg);
225
    /* allow code_here to evaluate e into reg of its choice */
226
    w.answhere = aa;
227
    w.ashwhere = ashof (sh (e));
228
    (void)code_here (e, sp, w);	
229
    Assert(reg!=-1);
230
    keepreg (e, reg);
231
    return reg;
232
  }
233
}
234
 
235
 
236
int   freg_operand
237
    PROTO_N ( ( e, sp ) )
238
    PROTO_T ( exp e X space sp )
239
{
240
 
241
  int   x = fregofval (e);
242
  ans aa;
243
  where w;
244
  freg fr;
245
  w.ashwhere = ashof (sh (e));
246
  if (x >= 0 && x < 100) {
247
    return x;
248
  }
249
  if (name (e) == cont_tag) {
250
    x = fregofval (son (e));
251
    if (x < 100) {
252
      return (x);
253
    }
254
  }
255
  else
256
    if (name (e) == apply_tag || name(e) == apply_general_tag) {
257
      if(is_floating(name(sh(e)))) {
258
	freg fr;
259
	fr.fr = 0;
260
	fr.type = (name(e)==realhd)?IEEE_double:IEEE_single;
261
	setfregalt(aa,fr);
262
      }
263
      else{
264
	setregalt (aa, 0);
265
      }
266
      w.answhere = aa;
267
      w.ashwhere = ash0;
268
      (void)make_code (e, sp, w, 0);
269
      return 0;
270
    }
271
 
272
  aa = iskept (e);
273
  if (aa.discrim == infreg) {	/* e already evaluated in fl reg */
274
    return regalt (aa) /* cheat */ ;
275
  }
276
 
277
 { int reg = -1;
278
   somefreg sfr;
279
   sfr.fr = &reg;
280
   if(w.ashwhere.ashsize==64)
281
     fr.type = IEEE_double;
282
   else
283
     fr.type = IEEE_single;
284
   sfr.type = fr.type;
285
   setsomefregalt (aa, sfr);
286
   w.answhere = aa;
287
  /* evaluate e into reg ... */
288
  (void)code_here (e, sp, w);
289
   fr.fr = reg;
290
   setfregalt(aa, fr);
291
   keepexp (e, aa);
292
   return reg;
293
 }
294
}