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/algol60/src/installers/alpha/common/pseudo.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: pseudo.c,v 1.1.1.1 1998/01/17 15:56:01 release Exp $	 */
32
 
33
#ifndef lint
34
static char vcid[] = "$Id: pseudo.c,v 1.1.1.1 1998/01/17 15:56:01 release Exp $";
35
#endif /* lint */
36
/* 
37
   psu_ops.c
38
   Output various psuedo operations to assembler 
39
*/
40
 
41
/*
42
$Log: pseudo.c,v $
43
 * Revision 1.1.1.1  1998/01/17  15:56:01  release
44
 * First version to be checked into rolling release.
45
 *
46
 * Revision 1.9  1995/12/04  09:12:44  john
47
 * Fix to diagnostics
48
 *
49
 * Revision 1.8  1995/08/30  16:14:58  john
50
 * Fix for use of AT register
51
 *
52
 * Revision 1.7  1995/05/23  13:25:06  john
53
 * Reformatting
54
 *
55
 * Revision 1.6  1995/05/16  10:54:43  john
56
 * Cosmetic changes
57
 *
58
 * Revision 1.5  1995/04/10  14:13:47  john
59
 * Minor changes
60
 *
61
 * Revision 1.4  1995/04/07  11:05:25  john
62
 * Changed assembler output.
63
 *
64
 * Revision 1.3  1995/03/29  14:08:19  john
65
 * Added inclusion of bool.h
66
 *
67
 * Revision 1.2  1995/03/29  10:31:38  john
68
 * Added code for handling of new noat/at block
69
 *
70
 * Revision 1.1.1.1  1995/03/23  10:39:18  john
71
 * Entered into CVS
72
 *
73
 * Revision 1.9  1995/03/23  10:11:35  john
74
 * Changed to support scheduler
75
 *
76
*/
77
 
78
#include "config.h"
79
#include "cross.h"
80
#include "frames.h"
81
#include "pseudo.h"
82
#include "ibinasm.h"
83
#include "out_ba.h"
84
#include "reg_defs.h"
85
#include "xalloc.h"
86
#include "bool.h"
87
#if DO_SCHEDULE
88
#include "scheduler.h"
89
#endif
90
#include "inst_fmt.h"
91
extern  FILE * as_file;
92
extern bool in_noat_block;
93
 
94
void setprologue
95
    PROTO_N ( ( lvl ) )
96
    PROTO_T ( int lvl )
97
{
98
#if DO_SCHEDULE
99
  char * outline = (char*)xcalloc(20,sizeof(char));
100
#endif
101
  if(as_file){
102
#if !DO_SCHEDULE
103
    fprintf(as_file,"\t.prologue %d\n",lvl);
104
#else
105
    sprintf(outline,"\t.prologue %d\n",lvl);
106
#endif
107
  }
108
  output_instruction(class_null,outline,out_value(0,iprologue,
109
						  make_INT64(0,lvl),0));
110
  /*out_value(0,iprologue,lvl,0);*/
111
  return;
112
}
113
 
114
 
115
void setnoreorder
116
    PROTO_Z ()
117
{
118
#if DO_SCHEDULE
119
  char * outline = (char*)xcalloc(20,sizeof(char));
120
#endif
121
  if(as_file){
122
#if !DO_SCHEDULE
123
    fprintf (as_file, "\t.set\tnoreorder\n");
124
#else
125
    sprintf(outline,"\t.set\tnoreorder\n");
126
#endif
127
  }
128
  output_instruction(class_null,outline,out_value(0,iset,
129
						  make_INT64(0,set_noreorder)
130
						  ,0));
131
  return;
132
}
133
 
134
void setreorder
135
    PROTO_Z ()
136
{
137
#if DO_SCHEDULE
138
  char * outline = (char*)xcalloc(20,sizeof(char));
139
#endif
140
  if(as_file){
141
#if !DO_SCHEDULE
142
    fprintf (as_file, "\t.set\treorder\n");
143
#else
144
    sprintf(outline,"\t.set\treorder\n");
145
#endif
146
  }
147
  output_instruction(class_null,outline,out_value(0,iset,
148
						  make_INT64(0,set_reorder)
149
						  ,0));
150
  return;
151
}
152
 
153
void setnomove
154
    PROTO_Z ()
155
{
156
#if DO_SCHEDULE
157
  char * outline = (char*)xcalloc(20,sizeof(char));
158
#endif
159
  if(as_file){
160
#if !DO_SCHEDULE
161
    fprintf (as_file, "\t.set\tnomove\n");
162
#else
163
    sprintf(outline,"\t.set\tnomove\n");
164
#endif
165
  }
166
  output_instruction(class_null,outline,out_value(0,iset,
167
						  make_INT64(0,set_nomove),0));
168
  return;
169
}
170
 
171
void setmove
172
    PROTO_Z ()
173
{
174
#if DO_SCHEDULE
175
  char * outline = (char*)xcalloc(20,sizeof(char));
176
#endif
177
  if(as_file){
178
#if !DO_SCHEDULE
179
    fprintf (as_file, "\t.set\tmove\n");
180
#else
181
    sprintf(outline,"\t.set\tmove\n");
182
#endif
183
  }
184
  output_instruction(class_null,outline,out_value(0,iset,
185
						  make_INT64(0,set_move),0));
186
  return;
187
}
188
 
189
#if 0
190
void setvolatile
191
    PROTO_Z ()
192
{
193
/*    fprintf (as_file, "\t.set\tvolatile\n");*/
194
  return;
195
}
196
 
197
void setnovolatile
198
    PROTO_Z ()
199
{
200
  fprintf (as_file, "\t.set\tnovolatile\n");
201
  return;
202
}
203
#endif
204
 
205
void setnoat
206
    PROTO_Z ()
207
{
208
  char *outline;
209
  if (in_noat_block == TRUE) {
210
    return;
211
  }
212
  else {
213
    in_noat_block = TRUE;
214
  }
215
  outline = (char*)xcalloc(20,sizeof(char));
216
  sprintf(outline,"\t.set\tnoat\n");
217
  if(as_file){
218
#if !DO_SCHEDULE
219
    fprintf (as_file, "\t.set\tnoat\n");
220
#endif
221
  }
222
  output_instruction(class_null,outline,out_value(0,iset,
223
						  make_INT64(0,set_noat),0));
224
  return;
225
}
226
 
227
void setat
228
    PROTO_Z ()
229
{
230
  char *outline;
231
  if (in_noat_block == FALSE) {
232
    return;
233
  }
234
  else {
235
    in_noat_block = FALSE;
236
  }
237
  outline = (char*)xcalloc(20,sizeof(char));
238
  sprintf(outline,"\t.set\tat\n");
239
  if(as_file){
240
#if !DO_SCHEDULE
241
    fprintf (as_file, "\t.set\tat\n");
242
#endif
243
  }
244
  output_instruction(class_null,outline,out_value(0,iset,
245
						  make_INT64(0,set_at),0));
246
  return;
247
}
248
 
249
void comment
250
    PROTO_N ( ( mess ) )
251
    PROTO_T ( char *mess )
252
{
253
  if(as_file){
254
    fprintf (as_file, " # %s\n", mess);
255
  }
256
  return;
257
}
258
 
259
void setframe
260
    PROTO_N ( ( st,loc ) )
261
    PROTO_T ( int32 st X int32 loc )
262
{
263
#if DO_SCHEDULE
264
  char * outline = (char*)xcalloc(80,sizeof(char));
265
#endif
266
  if(Has_fp){
267
    if(as_file){
268
#if !DO_SCHEDULE
269
      fprintf(as_file,"\t.frame\t$fp, %d, $26, %d\n",st,loc);
270
#else
271
      sprintf(outline,"\t.frame\t$fp, %d, $26, %d\n",st,loc);
272
#endif
273
    }
274
    output_instruction(class_null,outline,out_frame(0,iframe,st,FP,26));
275
  }
276
  else{
277
    if(as_file){
278
#if !DO_SCHEDULE
279
      fprintf (as_file, "\t.frame\t$sp, %d, $26, %d\n", st,loc);
280
#else
281
      sprintf(outline,"\t.frame\t$sp, %d, $26, %d\n", st,loc);
282
#endif
283
    }
284
    output_instruction(class_null,outline,out_frame(0,iframe,st,SP,26));
285
  }
286
  return;
287
}
288
 
289
void set_text_section
290
    PROTO_Z ()
291
{
292
  if(as_file){
293
#if !DO_SCHEDULE
294
    fprintf(as_file, "\t.text\n");
295
#endif
296
  }
297
#if DO_SCHEDULE
298
  output_instruction(class_null,"\t.text\n",out_common(0,itext));
299
#else
300
  out_common(0,itext);
301
#endif
302
  set_align(128);
303
  return;
304
}
305
 
306
void setmask
307
    PROTO_N ( ( mask,disp ) )
308
    PROTO_T ( int32 mask X int32 disp )
309
{
310
#if DO_SCHEDULE
311
  char * outline = (char*)xcalloc(20,sizeof(char));
312
#endif
313
  if(as_file){
314
#if !DO_SCHEDULE
315
    fprintf (as_file, "\t.mask\t0x%x,%d\n", mask, disp);
316
#else
317
    sprintf (outline, "\t.mask\t0x%x,%d\n", mask, disp);
318
#endif
319
  }
320
  output_instruction(class_null,outline,out_mask(0,imask,mask,disp));
321
  return;
322
}
323
 
324
 
325
void setfmask
326
    PROTO_N ( ( mask, disp ) )
327
    PROTO_T ( int32 mask X int32 disp )
328
{
329
#if DO_SCHEDULE
330
  char * outline = (char*)xcalloc(20,sizeof(char));
331
#endif
332
  if(as_file){
333
#if !DO_SCHEDULE
334
    fprintf (as_file, "\t.fmask\t0x%x,%d\n", mask, disp);
335
#else
336
    sprintf(outline,"\t.fmask\t0x%x,%d\n", mask, disp);
337
#endif
338
  }
339
  output_instruction(class_null,outline,out_mask(0,ifmask,mask,disp));
340
  return;
341
}
342
 
343
 
344
 
345
void set_file
346
    PROTO_N ( ( fname,fno ) )
347
    PROTO_T ( char *fname X int fno )
348
{
349
  if(as_file){
350
#if !DO_SCHEDULE
351
    fprintf(as_file,"\t.file\t%d \"%s\"\n",fno,fname+1);
352
#endif
353
  }
354
  return;
355
}
356
 
357
 
358
void set_lineno
359
    PROTO_N ( ( lineno,fileno ) )
360
    PROTO_T ( int lineno X int fileno )
361
{
362
  if(as_file){
363
#if DO_SCHEDULE
364
    fprintf(as_file,"\t.loc\t%d %d\n",fileno,lineno);
365
#endif
366
  }
367
  return;
368
}
369
 
370
 
371
 
372
 
373
/*
374
  This function outputs an appropriate .align directive 
375
  depending on the value of al.
376
*/
377
void set_align
378
    PROTO_N ( ( al ) )
379
    PROTO_T ( int al )
380
{
381
  extern int current_alignment;
382
#if DO_SCHEDULE
383
  Instruction new_ins = getinst();
384
  Instruction_data ins_dat = get_new_ins_data();
385
#endif
386
  char * binasm_data;
387
#if DO_SCHEDULE
388
  char *outline = (char*)xcalloc(80,sizeof(char));
389
#endif
390
  if(al!=current_alignment){
391
    switch(al){
392
     case 8:
393
       if(as_file){
394
#if !DO_SCHEDULE
395
	 fprintf(as_file,"\t.align 0\n");
396
#else
397
	 sprintf(outline,"\t.align 0\n");
398
#endif
399
       }
400
       binasm_data = out_value(0,ialign,make_INT64(0,0),0);
401
       break;
402
     case 16:
403
       if(as_file){
404
#if !DO_SCHEDULE
405
	 fprintf(as_file,"\t.align 1\n");
406
#else
407
	 sprintf(outline,"\t.align 1\n");
408
#endif
409
       }
410
       binasm_data = out_value(0,ialign,make_INT64(0,1),0);
411
       break;
412
     case 32:
413
       if(as_file){
414
#if !DO_SCHEDULE
415
	 fprintf(as_file,"\t.align 2\n");
416
#else
417
	 sprintf(outline,"\t.align 2\n");
418
#endif
419
       }
420
       binasm_data = out_value(0,ialign,make_INT64(0,2),0);
421
       break;
422
     case 64:
423
       if(as_file){
424
#if !DO_SCHEDULE
425
	 fprintf(as_file,"\t.align 3\n");
426
#else
427
	 sprintf(outline,"\t.align 3\n");
428
#endif	
429
       }
430
       binasm_data = out_value(0,ialign,make_INT64(0,3),0);
431
       break;
432
     case 128:
433
       if(as_file){
434
#if DO_SCHEDULE
435
	 sprintf(outline,"\t.align 4\n");
436
#else
437
	 fprintf(as_file,"\t.align 4\n");
438
#endif
439
       }
440
       binasm_data = out_value(0,ialign,make_INT64(0,4),0);
441
       break;
442
     default:;
443
    }
444
#if DO_SCHEDULE
445
    setclass(new_ins,class_null);
446
    set_instruction_text(ins_dat,outline);
447
    set_instruction_binasm(ins_dat,binasm_data);
448
    setdata(new_ins,ins_dat);
449
    process_instruction(new_ins);
450
#endif
451
    current_alignment = al;
452
  }
453
  return;
454
}