Subversion Repositories tendra.SVN

Rev

Rev 5 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5 Rev 6
Line -... Line 1...
-
 
1
/*
-
 
2
 * Copyright (c) 2002-2005 The TenDRA Project <http://www.tendra.org/>.
-
 
3
 * All rights reserved.
-
 
4
 *
-
 
5
 * Redistribution and use in source and binary forms, with or without
-
 
6
 * modification, are permitted provided that the following conditions are met:
-
 
7
 *
-
 
8
 * 1. Redistributions of source code must retain the above copyright notice,
-
 
9
 *    this list of conditions and the following disclaimer.
-
 
10
 * 2. Redistributions in binary form must reproduce the above copyright notice,
-
 
11
 *    this list of conditions and the following disclaimer in the documentation
-
 
12
 *    and/or other materials provided with the distribution.
-
 
13
 * 3. Neither the name of The TenDRA Project nor the names of its contributors
-
 
14
 *    may be used to endorse or promote products derived from this software
-
 
15
 *    without specific, prior written permission.
-
 
16
 *
-
 
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
-
 
18
 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-
 
19
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-
 
20
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
-
 
21
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-
 
22
 * EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-
 
23
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-
 
24
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-
 
25
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-
 
26
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-
 
27
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
 
28
 *
-
 
29
 * $Id$
-
 
30
 */
1
/*
31
/*
2
    Copyright (c) 1993 Open Software Foundation, Inc.
32
    Copyright (c) 1993 Open Software Foundation, Inc.
3
 
33
 
4
 
34
 
5
    All Rights Reserved
35
    All Rights Reserved
Line 24... Line 54...
24
    WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
54
    WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
25
*/
55
*/
26
 
56
 
27
/*
57
/*
28
    		 Crown Copyright (c) 1997
58
    		 Crown Copyright (c) 1997
29
    
59
 
30
    This TenDRA(r) Computer Program is subject to Copyright
60
    This TenDRA(r) Computer Program is subject to Copyright
31
    owned by the United Kingdom Secretary of State for Defence
61
    owned by the United Kingdom Secretary of State for Defence
32
    acting through the Defence Evaluation and Research Agency
62
    acting through the Defence Evaluation and Research Agency
33
    (DERA).  It is made available to Recipients with a
63
    (DERA).  It is made available to Recipients with a
34
    royalty-free licence for its use, reproduction, transfer
64
    royalty-free licence for its use, reproduction, transfer
35
    to other parties and amendment for any purpose not excluding
65
    to other parties and amendment for any purpose not excluding
36
    product development provided that any such use et cetera
66
    product development provided that any such use et cetera
37
    shall be deemed to be acceptance of the following conditions:-
67
    shall be deemed to be acceptance of the following conditions:-
38
    
68
 
39
        (1) Its Recipients shall ensure that this Notice is
69
        (1) Its Recipients shall ensure that this Notice is
40
        reproduced upon any copies or amended versions of it;
70
        reproduced upon any copies or amended versions of it;
41
    
71
 
42
        (2) Any amended version of it shall be clearly marked to
72
        (2) Any amended version of it shall be clearly marked to
43
        show both the nature of and the organisation responsible
73
        show both the nature of and the organisation responsible
44
        for the relevant amendment or amendments;
74
        for the relevant amendment or amendments;
45
    
75
 
46
        (3) Its onward transfer from a recipient to another
76
        (3) Its onward transfer from a recipient to another
47
        party shall be deemed to be that party's acceptance of
77
        party shall be deemed to be that party's acceptance of
48
        these conditions;
78
        these conditions;
49
    
79
 
50
        (4) DERA gives no warranty or assurance as to its
80
        (4) DERA gives no warranty or assurance as to its
51
        quality or suitability for any purpose and DERA accepts
81
        quality or suitability for any purpose and DERA accepts
52
        no liability whatsoever in relation to any use to which
82
        no liability whatsoever in relation to any use to which
53
        it may be put.
83
        it may be put.
54
*/
84
*/
Line 88... Line 118...
88
#include "stack.h"
118
#include "stack.h"
89
#include "locate.h"
119
#include "locate.h"
90
#include "frames.h"
120
#include "frames.h"
91
/******************************************************************************
121
/******************************************************************************
92
For non globals, boff encodes things in the following way.
122
For non globals, boff encodes things in the following way.
93
The number of bytes gives a displacement from different positions on 
123
The number of bytes gives a displacement from different positions on
94
the stack depending on whether it is relative to R_SP R_FP or R_TP
124
the stack depending on whether it is relative to R_SP R_FP or R_TP
95
 
125
 
96
The stack below gives the worst case of the stack i.e a general_proc with 
126
The stack below gives the worst case of the stack i.e a general_proc with
97
alloca
127
alloca
98
  |           |
128
  |           |
99
  |           | #
129
  |           | #
100
  |           | |  x relative to R_TP i.e caller parameters
130
  |           | |  x relative to R_TP i.e caller parameters
101
  |-----------| |                     in input caller parameter area
131
  |-----------| |                     in input caller parameter area
Line 130... Line 160...
130
  | AREA      | |
160
  | AREA      | |
131
  |-----------|<--------R_SP
161
  |-----------|<--------R_SP
132
******************************************************************************/
162
******************************************************************************/
133
 
163
 
134
/* decodes e to give a baseoff suitable for xxx_ins functions */
164
/* decodes e to give a baseoff suitable for xxx_ins functions */
135
baseoff boff PROTO_N ((e)) PROTO_T (exp e)
165
baseoff boff(exp e)
136
{
166
{
137
  baseoff an;
167
  baseoff an;
138
 
168
 
139
  if (isglob(e))
169
  if (isglob(e))
140
  {
170
  {
141
    dec *gl = brog(e);
171
    dec *gl = brog(e);
142
    long sno = gl->dec_u.dec_val.sym_number;
172
    long sno = gl->dec_u.dec_val.sym_number;
143
 
173
 
144
    /* an.base is negated global sym number, positive used for base reg number */
174
    /* an.base is negated global sym number, positive used for base reg number */
145
    an.base = -(sno + 1);
175
    an.base = - (sno + 1);
146
    an.offset = 0;
176
    an.offset = 0;
147
  }
177
  }
148
  else
178
  else
149
  {
179
  {
150
    return boff_location(no(e));
180
    return boff_location(no(e));
151
  }
181
  }
152
  return an;
182
  return an;
153
}
183
}
154
baseoff boff_location PROTO_N ((n)) PROTO_T (int n)
184
baseoff boff_location(int n)
155
{ 
185
{
156
  baseoff an;
186
  baseoff an;
157
  int br = n & 0x3f;		/* base reg in bottom 6 bits */
187
  int br = n & 0x3f;		/* base reg in bottom 6 bits */
158
  long off = (n>>6);		/* offset in bytes from br in rest */
188
  long off = (n>>6);		/* offset in bytes from br in rest */
159
  
189
 
160
  ASSERT((n<0)==(off<0));	/* any sign propagated */
190
  ASSERT((n<0)==(off<0));	/* any sign propagated */
161
  if(br<0)
191
  if (br<0)
162
    br = -br;
192
    br = -br;
163
  
193
 
164
  /* There are three possiblilities for br */
194
  /* There are three possiblilities for br */
165
  /* i.e R_TP R_FP R_SP */
195
  /* i.e R_TP R_FP R_SP */
166
  /* R_TP|
196
  /* R_TP|
167
     -----
197
     -----
168
     if something is relative to R_TP it is a caller of the previous proc
198
     if something is relative to R_TP it is a caller of the previous proc
Line 171... Line 201...
171
     -----
201
     -----
172
     This is all locals to the current procedure
202
     This is all locals to the current procedure
173
     R_SP|
203
     R_SP|
174
     -----
204
     -----
175
     This is used for constructing argument lists for calling parameters
205
     This is used for constructing argument lists for calling parameters
176
     
206
 
177
     It is possible that all three are the same
207
     It is possible that all three are the same
178
     i.e they are all calculated from the stack pointer.
208
     i.e they are all calculated from the stack pointer.
179
     However in a general_proc
209
     However in a general_proc
180
     things get nasty and all three will point to different places
210
     things get nasty and all three will point to different places
181
     */
211
     */
Line 183... Line 213...
183
  {
213
  {
184
    an.base = R_SP;
214
    an.base = R_SP;
185
    an.offset = off;
215
    an.offset = off;
186
    ASSERT(off >= 0);
216
    ASSERT(off >= 0);
187
  }
217
  }
188
  else if(br == R_FP)
218
  else if (br == R_FP)
189
  {
219
  {
190
    if(p_has_fp)
220
    if (p_has_fp)
191
    {
221
    {
192
      an.base = R_FP;
222
      an.base = R_FP;
193
      an.offset = p_locals_offset + off - p_frame_size;
223
      an.offset = p_locals_offset + off - p_frame_size;
194
    }
224
    }
195
    else
225
    else
196
    {
226
    {
197
      an.base = R_SP;
227
      an.base = R_SP;
198
      an.offset = p_locals_offset + off;
228
      an.offset = p_locals_offset + off;
199
    }
229
    }
200
  }
230
  }
201
  else if(br == R_TP)
231
  else if (br == R_TP)
202
  {
232
  {
203
    if (p_has_tp)
233
    if (p_has_tp)
204
    {
234
    {
205
      an.base = R_TP;
235
      an.base = R_TP;
206
      an.offset = off;
236
      an.offset = off;
207
    }
237
    }
208
    else if(p_has_fp)
238
    else if (p_has_fp)
209
    {
239
    {
210
      an.base = R_FP;
240
      an.base = R_FP;
211
      an.offset = off;
241
      an.offset = off;
212
    }
242
    }
213
    else 
243
    else
214
    {
244
    {
215
      an.base = R_SP;
245
      an.base = R_SP;
216
      an.offset = off + p_frame_size;
246
      an.offset = off + p_frame_size;
217
    }
247
    }
218
  }
248
  }
Line 220... Line 250...
220
  {
250
  {
221
    fail("Error:boff_location: Unknown base");
251
    fail("Error:boff_location: Unknown base");
222
  }
252
  }
223
  return an;
253
  return an;
224
}
254
}
225
int ENCODE_FOR_BOFF PROTO_N ((off,type)) PROTO_T (int off X int type)
255
int ENCODE_FOR_BOFF(int off, int type)
226
{
256
{
227
  
257
 
228
  /* type is either */
258
  /* type is either */
229
  /* INPUT_CALLER_PARAMETER, INPUT_CALLEE_PARAMETER, OUTPUT_CALLER_PARAMETER */
259
  /* INPUT_CALLER_PARAMETER, INPUT_CALLEE_PARAMETER, OUTPUT_CALLER_PARAMETER */
230
  /* offset shoulb be in bytes */
260
  /* offset shoulb be in bytes */
231
  int encode_offset;
261
  int encode_offset;
232
  int encode_base;
262
  int encode_base;
233
  
263
 
234
  switch(type)
264
  switch (type)
235
  {
265
  {
236
   case INPUT_CALLER_PARAMETER:
266
   case INPUT_CALLER_PARAMETER:
237
    {
267
    {
238
      encode_base = R_TP;
268
      encode_base = R_TP;
239
      encode_offset = off + STACK_ARG_AREA;
269
      encode_offset = off + STACK_ARG_AREA;
Line 252... Line 282...
252
      break;
282
      break;
253
    }
283
    }
254
   default:
284
   default:
255
    fail("Unknown encodeing for ENCODE_FOR_BOFF");
285
    fail("Unknown encodeing for ENCODE_FOR_BOFF");
256
  }
286
  }
257
  return (encode_offset<<6) + encode_base;
287
  return(encode_offset<<6) + encode_base;
258
}
288
}
259
 
289
 
260
      
290
 
261
 
291
 
262
/* mutual recursion between locate1() and locate() */
292
/* mutual recursion between locate1() and locate() */
263
where locate PROTO_S ((exp, space, shape, int));
293
where locate(exp, space, shape, int);
264
 
294
 
265
 
295
 
266
 /*
296
 /*
267
  * finds the address of e using shape s; sp gives available t-regs for any
297
  * finds the address of e using shape s; sp gives available t-regs for any
268
  * inner evaluation. dreg is historical.
298
  * inner evaluation. dreg is historical.
269
  */
299
  */
270
static where locate1 PROTO_N ((e,sp,s,dreg)) PROTO_T (exp e X space sp X shape s X int dreg)
300
static where locate1(exp e, space sp, shape s, int dreg)
271
{
301
{
272
  ash a;
302
  ash a;
273
  ans aa;
303
  ans aa;
274
  where wans;
304
  where wans;
275
  
305
 
276
  FULLCOMMENT3("locate1: name(e)=%d, name(s)=%d, dreg=%d", name(e), name(s), dreg);
306
  FULLCOMMENT3("locate1: name(e) =%d, name(s) =%d, dreg=%d", name(e), name(s), dreg);
277
  
307
 
278
  a = ashof(s);
308
  a = ashof(s);
279
  
309
 
280
  switch (name(e))
310
  switch (name(e))
281
  {
311
  {
282
    /***********************************************/
312
    /***********************************************/
283
   case name_tag:
313
   case name_tag:
284
    { 
314
    {
285
      /* NAME_TAG */
315
      /* NAME_TAG */
286
      exp dc = son(e);
316
      exp dc = son(e);
287
      bool var = isvar(dc);
317
      bool var = isvar(dc);
288
 
318
 
289
      FULLCOMMENT2("locate1 name_tag: name(dc)=%d, var=%d", name(dc), var);
319
      FULLCOMMENT2("locate1 name_tag: name(dc) =%d, var=%d", name(dc), var);
290
 
320
 
291
      if (props(dc) & defer_bit)
321
      if (props(dc) & defer_bit)
292
      {
322
      {
293
	/*
323
	/*
294
	 * ... it has been identified with a simple expression which is
324
	 * ... it has been identified with a simple expression which is
295
	 * better evaluated every time
325
	 * better evaluated every time
296
	 */
326
	 */
297
	where w;
327
	where w;
298
	
328
 
299
	w = locate(son(dc), sp, sh(son(dc)), dreg);
329
	w = locate(son(dc), sp, sh(son(dc)), dreg);
300
	
330
 
301
	if (no(e) == 0)
331
	if (no(e) == 0)
302
	{
332
	{
303
	  aa = w.answhere;
333
	  aa = w.answhere;
304
	}
334
	}
305
	else
335
	else
306
	{
336
	{
307
	  instore is;
337
	  instore is;
308
	  
338
 
309
	  switch (w.answhere.discrim)
339
	  switch (w.answhere.discrim)
310
	  {
340
	  {
311
	   case notinreg:
341
	   case notinreg:
312
	    {
342
	    {
313
	      is = insalt(w.answhere);
343
	      is = insalt(w.answhere);
Line 315... Line 345...
315
	      break;
345
	      break;
316
	    }
346
	    }
317
	   default:
347
	   default:
318
	    fail("name not deferable");
348
	    fail("name not deferable");
319
	  }
349
	  }
320
	  
350
 
321
	  setinsalt(aa, is);
351
	  setinsalt(aa, is);
322
	}
352
	}
323
      }
353
      }
324
      else if (props(dc) & inreg_bits)
354
      else if (props(dc) & inreg_bits)
325
      {
355
      {
326
	/* ... it has been allocated in a fixed point reg */
356
	/* ... it has been allocated in a fixed point reg */
327
	if (var)
357
	if (var)
328
	{
358
	{
329
	  setregalt(aa, no(dc));
359
	  setregalt(aa, no(dc));
330
	}
360
	}
331
	else
361
	else
332
	{
362
	{
333
	  instore b;
363
	  instore b;
334
	  
364
 
335
	  b.b.base = no(dc);
365
	  b.b.base = no(dc);
336
	  b.b.offset = 0;
366
	  b.b.offset = 0;
337
	  b.adval = 1;
367
	  b.adval = 1;
338
	  setinsalt(aa, b);
368
	  setinsalt(aa, b);
339
	}
369
	}
340
      }
370
      }
341
      else if (props(dc) & infreg_bits)
371
      else if (props(dc) & infreg_bits)
342
      {
372
      {
343
	/* ... it has been allocated in a floating point reg */
373
	/* ... it has been allocated in a floating point reg */
344
	freg fr;
374
	freg fr;
345
	
375
 
346
	fr.fr = no(dc);
376
	fr.fr = no(dc);
347
	fr.dble = (a.ashsize == 64) ? 1 : 0;
377
	fr.dble = (a.ashsize == 64)? 1 : 0;
348
	setfregalt(aa, fr);
378
	setfregalt(aa, fr);
349
      }
379
      }
350
      else
380
      else
351
      {
381
      {
352
	/* ... it is in memory */
382
	/* ... it is in memory */
353
	instore is;
383
	instore is;
354
	
384
 
355
	if (var|| (name(sh(e)) == prokhd &&
385
	if (var|| (name(sh(e)) == prokhd &&
356
		      (son(dc) == nilexp || IS_A_PROC(son(dc)))))
386
		     (son(dc) == nilexp || IS_A_PROC(son(dc)))))
357
	{
387
	{
358
	  is.adval = 1;
388
	  is.adval = 1;
359
	  /* If it is a var tag you can get address of it */
389
	  /* If it is a var tag you can get address of it */
360
	}
390
	}
361
	else
391
	else
362
	{
392
	{
363
	  is.adval = 0;
393
	  is.adval = 0;
364
	}
394
	}
365
	is.b = boff(dc);
395
	is.b = boff(dc);
366
	
396
 
367
	is.b.offset += (no(e) / 8);
397
	is.b.offset += (no(e) / 8);
368
	
398
 
369
#if 1
399
#if 1
370
	if (var && name(sh(e)) != prokhd && !IS_FIXREG(is.b.base) && is.b.offset == 0)
400
	if (var && name(sh(e))!= prokhd && !IS_FIXREG(is.b.base) && is.b.offset == 0)
371
	{
401
	{
372
	  /*
402
	  /*
373
	   * A global which has to be accessed via TOC.
403
	   * A global which has to be accessed via TOC.
374
	   * We load it explicitly into reg here so we can
404
	   * We load it explicitly into reg here so we can
375
	   * use the reg contents tracking mechanism for
405
	   * use the reg contents tracking mechanism for
Line 378... Line 408...
378
	   * but needlessly reload from TOC.
408
	   * but needlessly reload from TOC.
379
	   * +++ offset != 0 -> keepglob for 0 offset & keepreg for offset
409
	   * +++ offset != 0 -> keepglob for 0 offset & keepreg for offset
380
	   */
410
	   */
381
	  if (dreg == 0)
411
	  if (dreg == 0)
382
	    dreg = getreg(sp.fixed);
412
	    dreg = getreg(sp.fixed);
383
	  
413
 
384
	  set_ins(is.b, dreg);
414
	  set_ins(is.b, dreg);
385
	  keepreg(e, dreg);
415
	  keepreg(e, dreg);
386
	  FULLCOMMENT3("locate1 name_tag: keepreg glob adval=%d bo={%d,%d}", is.adval, is.b.base, is.b.offset);
416
	  FULLCOMMENT3("locate1 name_tag: keepreg glob adval=%d bo={%d,%d}", is.adval, is.b.base, is.b.offset);
387
	  is.b.base = dreg;
417
	  is.b.base = dreg;
388
	  is.b.offset = 0;
418
	  is.b.offset = 0;
389
	}
419
	}
390
#endif
420
#endif
391
	setinsalt(aa, is);
421
	setinsalt(aa, is);
392
	
422
 
393
      }
423
      }
394
      
424
 
395
      wans.answhere = aa;
425
      wans.answhere = aa;
396
      wans.ashwhere = a;
426
      wans.ashwhere = a;
397
      return wans;
427
      return wans;
398
    }
428
    }
399
    /***********************************************/
429
    /***********************************************/
400
  case addptr_tag:
430
  case addptr_tag:
401
    {
431
    {
402
      exp sum = son(e);
432
      exp sum = son(e);
403
      where wsum;
433
      where wsum;
404
      int addend;
434
      int addend;
405
      space nsp;
435
      space nsp;
406
      int reg;
436
      int reg;
407
      int ind = R_NO_REG;
437
      int ind = R_NO_REG;
Line 417... Line 447...
417
       */
447
       */
418
 
448
 
419
      switch (asum.discrim)
449
      switch (asum.discrim)
420
      {
450
      {
421
      case notinreg:
451
      case notinreg:
422
	{
452
	{
423
	  is = insalt(asum);
453
	  is = insalt(asum);
424
	  if (is.adval)
454
	  if (is.adval)
425
	  {
455
	  {
426
	    /* wsum is a literal address in store ... */
456
	    /* wsum is a literal address in store ... */
427
	    baseoff b;
457
	    baseoff b;
Line 461... Line 491...
461
	    /* wsum represents an actual pointer in store... */
491
	    /* wsum represents an actual pointer in store... */
462
	    /* ... so load it into a good register */
492
	    /* ... so load it into a good register */
463
	    ind = getreg(sp.fixed);
493
	    ind = getreg(sp.fixed);
464
	    ld_ins(i_l, is.b, ind);
494
	    ld_ins(i_l, is.b, ind);
465
	  }
495
	  }
466
	  break;
496
	  break;
467
	}			/* end notinreg */
497
	}			/* end notinreg */
468
 
498
 
469
      case inreg:
499
      case inreg:
470
	{
500
	{
471
	  /* wsum is already in reg */
501
	  /* wsum is already in reg */
Line 480... Line 510...
480
      }				/* end case */
510
      }				/* end case */
481
 
511
 
482
      /* register ind contains the evaluation of 1st operand of addptr */
512
      /* register ind contains the evaluation of 1st operand of addptr */
483
      nsp = guardreg(ind, sp);
513
      nsp = guardreg(ind, sp);
484
 
514
 
485
      if (name(bro(sum)) == env_offset_tag || name(bro(sum))==general_env_offset_tag)
515
      if (name(bro(sum)) == env_offset_tag || name(bro(sum)) ==general_env_offset_tag)
486
      {
516
      {
487
	is.b.base = ind;
517
	is.b.base = ind;
488
	is.b.offset = frame_offset(son(bro(sum)));
518
	is.b.offset = frame_offset(son(bro(sum)));
489
      }
519
      }
490
      else
520
      else
491
      {
521
      {
492
	addend = reg_operand(bro(sum), nsp);
522
	addend = reg_operand(bro(sum), nsp);
493
 
523
 
494
	/* evaluate displacement, add it to ind in new reg */
524
	/* evaluate displacement, add it to ind in new reg */
495
	if (dreg == 0)
525
	if (dreg == 0)
496
	  dreg = getreg(nsp.fixed);
526
	  dreg = getreg(nsp.fixed);
497
	rrr_ins(i_a, ind, addend, dreg);
527
	rrr_ins(i_a, ind, addend, dreg);
498
 
528
 
499
	is.b.base = dreg;
529
	is.b.base = dreg;
500
	is.b.offset = 0;
530
	is.b.offset = 0;
501
      }
531
      }
502
 
532
 
503
      is.adval = 1;
533
      is.adval = 1;
504
      setinsalt(aa, is);
534
      setinsalt(aa, is);
505
 
535
 
506
      wans.answhere = aa;
536
      wans.answhere = aa;
507
      wans.ashwhere = a;
537
      wans.ashwhere = a;
Line 574... Line 604...
574
	  }
604
	  }
575
 
605
 
576
	  /*
606
	  /*
577
	   * ... and add appropriate displacement to give result
607
	   * ... and add appropriate displacement to give result
578
	   */
608
	   */
579
 
609
 
580
	  isa.b.offset += no(e) / 8;
610
	  isa.b.offset += no(e) / 8;
581
	  setinsalt(wans.answhere, isa);
611
	  setinsalt(wans.answhere, isa);
582
	  keepexp(e, wans.answhere);
612
	  keepexp(e, wans.answhere);
583
	  break;
613
	  break;
584
	}
614
	}
Line 589... Line 619...
589
	  isa.adval = 1;
619
	  isa.adval = 1;
590
 
620
 
591
	  isa.b.offset = no(e) / 8;
621
	  isa.b.offset = no(e) / 8;
592
	  setinsalt(wans.answhere, isa);
622
	  setinsalt(wans.answhere, isa);
593
	  break;
623
	  break;
594
	}
624
	}
595
      default:
625
      default:
596
	{
626
	{
597
	  fail("locate ? reg ");
627
	  fail("locate ? reg ");
598
	}
628
	}
599
      }
629
      }
600
      wans.ashwhere = a;
630
      wans.ashwhere = a;
601
      return wans;
631
      return wans;
602
    }				/* end reff */
632
    }				/* end reff */
603
	
633
 
604
   case cont_tag:
634
   case cont_tag:
605
   case contvol_tag:
635
   case contvol_tag:
606
    {
636
    {
607
      exp p = son(e);
637
      exp p = son(e);
608
      ans ason;
638
      ans ason;
609
      instore isa;
639
      instore isa;
610
      int reg;
640
      int reg;
611
      where fc;
641
      where fc;
612
 
642
 
613
      fc = locate(p, sp, sh(e) , 0);
643
      fc = locate(p, sp, sh(e), 0);
614
      ason = fc.answhere;
644
      ason = fc.answhere;
615
 
645
 
616
 
646
 
617
      /*
647
      /*
618
       * answer is going to be the contents of address represented by fc
648
       * answer is going to be the contents of address represented by fc
Line 639... Line 669...
639
	    reg = getreg(sp.fixed);
669
	    reg = getreg(sp.fixed);
640
	    ld_ins(i_l, isa.b, reg);
670
	    ld_ins(i_l, isa.b, reg);
641
	    isa.b.base = reg;
671
	    isa.b.base = reg;
642
	    isa.b.offset = 0;
672
	    isa.b.offset = 0;
643
	    setinsalt(aa, isa);
673
	    setinsalt(aa, isa);
644
	    if (name(e) != contvol_tag && fc.ashwhere.ashalign != 1)
674
	    if (name(e)!= contvol_tag && fc.ashwhere.ashalign != 1)
645
	      keepexp(e, aa);
675
	      keepexp(e, aa);
646
	  }
676
	  }
647
	  goto breakson;
677
	  goto breakson;
648
 
678
 
649
	}			/* end notinrg */
679
	}			/* end notinrg */
Line 718... Line 748...
718
    }				/* end field */
748
    }				/* end field */
719
 
749
 
720
  default:
750
  default:
721
    {
751
    {
722
      /*
752
      /*
723
       * general catch all; 
753
       * general catch all;
724
       * evaluate e into register and deliver it as a literal
754
       * evaluate e into register and deliver it as a literal
725
       * store address
755
       * store address
726
       */
756
       */
727
      int r = reg_operand(e, sp);
757
      int r = reg_operand(e, sp);
728
      instore is;
758
      instore is;
Line 751... Line 781...
751
 
781
 
752
 /*
782
 /*
753
  * locate differs from locate1 only in that it looks to see if e has already
783
  * locate differs from locate1 only in that it looks to see if e has already
754
  * been evaluated and remembered by register contents tracking scheme
784
  * been evaluated and remembered by register contents tracking scheme
755
  */
785
  */
756
where locate PROTO_N ((e,sp,s,dreg)) PROTO_T (exp e X space sp X shape s X int dreg)
786
where locate(exp e, space sp, shape s, int dreg)
757
{
787
{
758
  ans ak;
788
  ans ak;
759
  where w;
789
  where w;
760
  
790
 
761
  /* Check to see if e has already been evaluated and remembered */
791
  /* Check to see if e has already been evaluated and remembered */
762
  if (!IS_R_NO_REG(dreg))
792
  if (!IS_R_NO_REG(dreg))
763
  {
793
  {
764
    /* first try for exact reg */
794
    /* first try for exact reg */
765
    ak = iskept_inreg(e, dreg);
795
    ak = iskept_inreg(e, dreg);