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 |
/*
|
|
|
32 |
$Log: hppains.h,v $
|
|
|
33 |
* Revision 1.1.1.1 1998/01/17 15:56:02 release
|
|
|
34 |
* First version to be checked into rolling release.
|
|
|
35 |
*
|
|
|
36 |
* Revision 1.4 1996/11/14 15:22:15 wfs
|
|
|
37 |
* Fixed a bug in regexps.c which was common to most of the installers and
|
|
|
38 |
* has only just come to light due to PWE's work on powertrans. (There was
|
|
|
39 |
* previously only a patch.) Cosmetic changes to other files.
|
|
|
40 |
*
|
|
|
41 |
* Revision 1.3 1996/08/30 09:02:20 wfs
|
|
|
42 |
* Various fixes of bugs arising from avs and pl_tdf tests.
|
|
|
43 |
*
|
|
|
44 |
* Revision 1.2 1995/12/18 13:11:34 wfs
|
|
|
45 |
* Put hppatrans uder cvs control. Major Changes made since last release
|
|
|
46 |
* include:
|
|
|
47 |
* (i) PIC code generation.
|
|
|
48 |
* (ii) Profiling.
|
|
|
49 |
* (iii) Dynamic Initialization.
|
|
|
50 |
* (iv) Debugging of Exception Handling and Diagnostics.
|
|
|
51 |
*
|
|
|
52 |
* Revision 5.2 1995/10/09 13:10:27 wfs
|
|
|
53 |
* Cosmetic changes.
|
|
|
54 |
*
|
|
|
55 |
* Revision 5.1 1995/09/15 14:05:29 wfs
|
|
|
56 |
* Minor changes to stop gcc compiler from complaining.
|
|
|
57 |
*
|
|
|
58 |
* Revision 5.0 1995/08/25 13:56:17 wfs
|
|
|
59 |
* Preperation for August 95 Glue release
|
|
|
60 |
*
|
|
|
61 |
* Revision 4.0 1995/08/25 13:34:00 wfs
|
|
|
62 |
* *** empty log message ***
|
|
|
63 |
*
|
|
|
64 |
* Revision 4.0 1995/08/25 13:34:00 wfs
|
|
|
65 |
* *** empty log message ***
|
|
|
66 |
*
|
|
|
67 |
* Revision 3.4 1995/08/25 11:04:28 wfs
|
|
|
68 |
* Mostly cosmetic changes
|
|
|
69 |
*
|
|
|
70 |
* Revision 3.4 1995/08/25 11:04:28 wfs
|
|
|
71 |
* Mostly cosmetic changes
|
|
|
72 |
*
|
|
|
73 |
* Revision 3.1 95/04/10 16:26:48 16:26:48 wfs (William Simmonds)
|
|
|
74 |
* Apr95 tape version.
|
|
|
75 |
*
|
|
|
76 |
* Revision 3.0 95/03/30 11:17:25 11:17:25 wfs (William Simmonds)
|
|
|
77 |
* Mar95 tape version with CRCR95_178 bug fix.
|
|
|
78 |
*
|
|
|
79 |
* Revision 2.0 95/03/15 15:27:12 15:27:12 wfs (William Simmonds)
|
|
|
80 |
* spec 3.1 changes implemented, tests outstanding.
|
|
|
81 |
*
|
|
|
82 |
* Revision 1.2 95/01/25 12:18:45 12:18:45 wfs (William Simmonds)
|
|
|
83 |
* Added floating point exception code macros.
|
|
|
84 |
*
|
|
|
85 |
* Revision 1.1 95/01/17 14:05:57 14:05:57 wfs (William Simmonds)
|
|
|
86 |
* Initial revision
|
|
|
87 |
*
|
|
|
88 |
*/
|
|
|
89 |
|
|
|
90 |
|
|
|
91 |
#ifndef HPPAINS_INCLUDED
|
|
|
92 |
#define HPPAINS_INCLUDED
|
|
|
93 |
|
|
|
94 |
|
|
|
95 |
/* This header file defines all the HPPA RISC instructions, formats,
|
|
|
96 |
** field selectors, conditions and completers which the translator might
|
|
|
97 |
** require. Not all the instruction set is included. **/
|
|
|
98 |
|
|
|
99 |
|
|
|
100 |
/* Personal preferences */
|
|
|
101 |
|
|
|
102 |
#define STRCMP(S1,S2) !strcmp((S1),(S2))
|
|
|
103 |
|
|
|
104 |
|
|
|
105 |
/* Types representing instructions */
|
|
|
106 |
|
|
|
107 |
typedef CONST char ins_t [] ;
|
|
|
108 |
typedef CONST char *ins_p ;
|
|
|
109 |
|
|
|
110 |
#define I_NIL null /* The nil instruction */
|
|
|
111 |
|
|
|
112 |
|
|
|
113 |
/*
|
|
|
114 |
* Instruction specification. If INS_DEFINE is defined then the instructions
|
|
|
115 |
* i_add etc. are defined, otherwise they are declared.
|
|
|
116 |
*/
|
|
|
117 |
|
|
|
118 |
#ifdef INS_DEFINE
|
|
|
119 |
#define INS( I, S ) ins_t I = S
|
|
|
120 |
#else
|
|
|
121 |
#define INS( I, S ) extern ins_t I
|
|
|
122 |
#endif
|
|
|
123 |
|
|
|
124 |
|
|
|
125 |
/* Basic instruction set */
|
|
|
126 |
|
|
|
127 |
INS ( i_add, "add" ) ;
|
|
|
128 |
INS ( i_and, "and" ) ;
|
|
|
129 |
INS ( i_addb, "addb" ) ;
|
|
|
130 |
INS ( i_addi, "addi" ) ;
|
|
|
131 |
INS ( i_addib, "addib" ) ;
|
|
|
132 |
INS ( i_addil, "addil" ) ;
|
|
|
133 |
INS ( i_andcm, "andcm" ) ;
|
|
|
134 |
INS ( i_b, "b" ) ;
|
|
|
135 |
INS ( i_bl, "bl" ) ;
|
|
|
136 |
INS ( i_bv, "bv" ) ;
|
|
|
137 |
INS ( i_bb, "bb" ) ;
|
|
|
138 |
INS ( i_ble, "ble" ) ;
|
|
|
139 |
INS ( i_blr, "blr" ) ;
|
|
|
140 |
INS ( i_copy, "copy");
|
|
|
141 |
INS ( i_comb, "comb");
|
|
|
142 |
INS ( i_comclr, "comclr");
|
|
|
143 |
INS ( i_comib, "comib");
|
|
|
144 |
INS ( i_comiclr, "comiclr");
|
|
|
145 |
INS ( i_ub, "ub");
|
|
|
146 |
INS ( i_cj, "cj");
|
|
|
147 |
INS ( i_cij, "cij");
|
|
|
148 |
INS ( i_dep, "dep");
|
|
|
149 |
INS ( i_depi, "depi");
|
|
|
150 |
INS ( directive, "" );
|
|
|
151 |
INS ( i_extrs, "extrs" );
|
|
|
152 |
INS ( i_extru, "extru" );
|
|
|
153 |
INS ( i_fabs, "fabs" ) ;
|
|
|
154 |
INS ( i_fadd, "fadd" ) ;
|
|
|
155 |
INS ( i_fcmp, "fcmp" ) ;
|
|
|
156 |
INS ( i_fcpy, "fcpy" ) ;
|
|
|
157 |
INS ( i_fdiv, "fdiv" ) ;
|
|
|
158 |
INS ( i_fmpy, "fmpy" ) ;
|
|
|
159 |
INS ( i_frnd, "frnd" ) ;
|
|
|
160 |
INS ( i_fsub, "fsub" ) ;
|
|
|
161 |
INS ( i_fldds, "fldds" );
|
|
|
162 |
INS ( i_flddx, "flddx" );
|
|
|
163 |
INS ( i_fldws, "fldws" );
|
|
|
164 |
INS ( i_fldwx, "fldwx" );
|
|
|
165 |
INS ( i_fstds, "fstds" );
|
|
|
166 |
INS ( i_fstdx, "fstdx" );
|
|
|
167 |
INS ( i_fstws, "fstws" );
|
|
|
168 |
INS ( i_fstwx, "fstwx" );
|
|
|
169 |
INS ( i_ftest, "ftest" ) ;
|
|
|
170 |
INS ( i_fcnvxf, "fcnvxf" ) ;
|
|
|
171 |
INS ( i_fcnvff, "fcnvff" ) ;
|
|
|
172 |
INS ( i_fcnvfx, "fcnvfx" ) ;
|
|
|
173 |
INS ( i_fcnvfxt, "fcnvfxt" ) ;
|
|
|
174 |
INS ( i_ldb, "ldb" ) ;
|
|
|
175 |
INS ( i_ldbs, "ldbs" ) ;
|
|
|
176 |
INS ( i_ldd, "ldd" ) ;
|
|
|
177 |
INS ( i_ldf, "ldf" ) ;
|
|
|
178 |
INS ( i_ldh, "ldh" ) ;
|
|
|
179 |
INS ( i_ldhs, "ldhs" ) ;
|
|
|
180 |
INS ( i_ldo, "ldo" ) ;
|
|
|
181 |
INS ( i_ldw, "ldw" ) ;
|
|
|
182 |
INS ( i_ldwm, "ldwm" ) ;
|
|
|
183 |
INS ( i_ldws, "ldws" ) ;
|
|
|
184 |
INS ( i_ldbx, "ldbx" );
|
|
|
185 |
INS ( i_ldhx, "ldhx" );
|
|
|
186 |
INS ( i_ldwx, "ldwx" );
|
|
|
187 |
INS ( i_ldi, "ldi" ) ;
|
|
|
188 |
INS ( i_ldil, "ldil" ) ;
|
|
|
189 |
INS ( i_ldsid, "ldsid" ) ;
|
|
|
190 |
INS ( i_mtsp, "mtsp" );
|
|
|
191 |
INS ( i_mtsar, "mtsar" );
|
|
|
192 |
INS ( i_nop, "nop" ) ;
|
|
|
193 |
INS ( i_or, "or" ) ;
|
|
|
194 |
INS ( i_shd, "shd" ) ;
|
|
|
195 |
INS ( i_sh1add, "sh1add" ) ;
|
|
|
196 |
INS ( i_sh2add, "sh2add" ) ;
|
|
|
197 |
INS ( i_sh3add, "sh3add" ) ;
|
|
|
198 |
INS ( i_stb, "stb" ) ;
|
|
|
199 |
INS ( i_sth, "sth" ) ;
|
|
|
200 |
INS ( i_stw, "stw" ) ;
|
|
|
201 |
INS ( i_stwm, "stwm" ) ;
|
|
|
202 |
INS ( i_stbs, "stbs" ) ;
|
|
|
203 |
INS ( i_sths, "sths" ) ;
|
|
|
204 |
INS ( i_stws, "stws" ) ;
|
|
|
205 |
INS ( i_sub, "sub" ) ;
|
|
|
206 |
INS ( i_subi, "subi" ) ;
|
|
|
207 |
INS ( i_subt, "subt" ) ;
|
|
|
208 |
INS ( i_uaddcm, "uaddcm" );
|
|
|
209 |
INS ( i_vshd, "vshd" ) ;
|
|
|
210 |
INS ( i_vextrs, "vextrs" ) ;
|
|
|
211 |
INS ( i_xor, "xor" ) ;
|
|
|
212 |
INS ( i_xmpyu, "xmpyu");
|
|
|
213 |
INS ( i_zdep, "zdep" ) ;
|
|
|
214 |
INS ( i_zdepi, "zdepi" ) ;
|
|
|
215 |
INS ( i_zvdep, "zvdep" ) ;
|
|
|
216 |
INS ( i_zvdepi, "zvdepi" ) ;
|
|
|
217 |
|
|
|
218 |
/*
|
|
|
219 |
* The following are translator internal psuedo "instructions" which
|
|
|
220 |
* do not appear in the PA RISC instruction set.
|
|
|
221 |
*/
|
|
|
222 |
|
|
|
223 |
INS ( i_lb, "lb" ); /* load byte */
|
|
|
224 |
INS ( i_lh, "lh" ); /* load halfword */
|
|
|
225 |
INS ( i_lo, "lo" ); /* load offset */
|
|
|
226 |
INS ( i_lw, "lw" ); /* load word */
|
|
|
227 |
INS ( i_lwm, "lwm" ); /* load word and modify */
|
|
|
228 |
INS ( i_fldw, "fldw" ); /* load float single */
|
|
|
229 |
INS ( i_fldd, "fldd" ); /* load float double */
|
|
|
230 |
INS ( i_sb, "sb" ); /* store byte */
|
|
|
231 |
INS ( i_sh, "sh" ); /* store halfword */
|
|
|
232 |
INS ( i_sw, "sw" ); /* store word */
|
|
|
233 |
INS ( i_fstw, "fstw" ); /* store float single */
|
|
|
234 |
INS ( i_fstd, "fstd" ); /* store float double */
|
|
|
235 |
|
|
|
236 |
INS( i_lab, "" );
|
|
|
237 |
INS( i_, "" );
|
|
|
238 |
|
|
|
239 |
|
|
|
240 |
/* Millicode - compiler generated routines, not instructions */
|
|
|
241 |
|
|
|
242 |
INS ( milli_mulU,"$$mulU" );
|
|
|
243 |
INS ( milli_mulI, "$$mulI" );
|
|
|
244 |
INS ( milli_divU, "$$divU" );
|
|
|
245 |
INS ( milli_divI, "$$divI" );
|
|
|
246 |
INS ( milli_remU, "$$remU" );
|
|
|
247 |
INS ( milli_remI, "$$remI" );
|
|
|
248 |
INS ( milli_dyncall, "$$dyncall" );
|
|
|
249 |
INS ( milli_mcount, "mcount" );
|
|
|
250 |
|
|
|
251 |
#define MILLI_MULU 0
|
|
|
252 |
#define MILLI_MULI 1
|
|
|
253 |
#define MILLI_DIVU 2
|
|
|
254 |
#define MILLI_DIVI 3
|
|
|
255 |
#define MILLI_REMU 4
|
|
|
256 |
#define MILLI_REMI 5
|
|
|
257 |
#define MILLI_DYNCALL 6
|
|
|
258 |
|
|
|
259 |
|
|
|
260 |
/* Floating point formats */
|
|
|
261 |
|
|
|
262 |
INS ( f_, "" );
|
|
|
263 |
INS ( f_sgl, ",SGL" );
|
|
|
264 |
INS ( f_dbl, ",DBL" );
|
|
|
265 |
INS ( f_quad, ",QUAD" );
|
|
|
266 |
|
|
|
267 |
|
|
|
268 |
/* Field selectors */
|
|
|
269 |
|
|
|
270 |
INS ( fs_, "" );
|
|
|
271 |
INS ( fs_L, "L'" );
|
|
|
272 |
INS ( fs_R, "R'" );
|
|
|
273 |
INS ( fs_LR, "L'" );
|
|
|
274 |
INS ( fs_RR, "R'" );
|
|
|
275 |
INS ( fs_LP, "LP'" ); /* left plabel constructor */
|
|
|
276 |
INS ( fs_RP, "RP'" ); /* right plabel constructor */
|
|
|
277 |
INS ( fs_T, "T'" );
|
|
|
278 |
INS ( fs_LT, "LT'" );
|
|
|
279 |
INS ( fs_RT, "RT'" );
|
|
|
280 |
|
|
|
281 |
|
|
|
282 |
/* Condition codes */
|
|
|
283 |
|
|
|
284 |
INS ( c_, "" ); /* the default condition code */
|
|
|
285 |
INS ( c_TR, ",TR" );
|
|
|
286 |
INS ( c_g, ",>" );
|
|
|
287 |
INS ( c_l, ",<" );
|
|
|
288 |
INS ( c_eq, ",=" );
|
|
|
289 |
INS ( c_gu, ",>>" );
|
|
|
290 |
INS ( c_lu, ",<<" );
|
|
|
291 |
INS ( c_geq, ",>=" );
|
|
|
292 |
INS ( c_leq, ",<=" );
|
|
|
293 |
INS ( c_neq, ",<>" );
|
|
|
294 |
INS ( c_fneq, ",!=" );
|
|
|
295 |
INS ( c_gequ, ",>>=" );
|
|
|
296 |
INS ( c_lequ, ",<<=" );
|
|
|
297 |
INS ( bit_is_0, ",>=" );
|
|
|
298 |
INS ( bit_is_1, ",<" );
|
|
|
299 |
INS ( c_OD, ",OD" );
|
|
|
300 |
INS ( c_EV, ",EV" );
|
|
|
301 |
INS ( c_NSV, ",NSV" );
|
|
|
302 |
INS ( c_NUV, ",NUV" );
|
|
|
303 |
INS ( c_UV, ",UV" );
|
|
|
304 |
INS ( c_SV, ",SV" );
|
|
|
305 |
|
|
|
306 |
|
|
|
307 |
/* Logical opposites of condition codes */
|
|
|
308 |
|
|
|
309 |
#define opp(C) ( C==c_g ? c_leq : ( C==c_leq ? c_g : ( C==c_l ? c_geq :\
|
|
|
310 |
( C==c_geq ? c_l : ( C==c_eq ? c_neq : ( C==c_neq ? c_eq :\
|
|
|
311 |
( C==c_gu ? c_lequ : ( C==c_lequ ? c_gu :\
|
|
|
312 |
( C==c_lu ? c_gequ : c_lu ) ) ) ) ) ) ) ) )
|
|
|
313 |
|
|
|
314 |
|
|
|
315 |
/* Completers */
|
|
|
316 |
|
|
|
317 |
INS ( cmplt_, "" ); /* the default completer */
|
|
|
318 |
INS ( cmplt_M, ",M" );
|
|
|
319 |
INS ( cmplt_S, ",S" );
|
|
|
320 |
INS ( cmplt_SM, ",SM" );
|
|
|
321 |
INS ( cmplt_MA, ",MA" );
|
|
|
322 |
INS ( cmplt_MB, ",MB" );
|
|
|
323 |
INS ( cmplt_N, ",N" ); /* the nullify completer */
|
|
|
324 |
|
|
|
325 |
|
|
|
326 |
/* Some macros */
|
|
|
327 |
|
|
|
328 |
#define SIMM5( N ) ( (long)(N)>-17 && (long)(N)<16 )
|
|
|
329 |
#define SIMM11( N ) ( (long)(N)>-1025 && (long)(N)<1024 )
|
|
|
330 |
#define SIMM13( N ) ( (long)(N)>-4097 && (long)(N)<4096 )
|
|
|
331 |
#define SIMM14( N ) ( (long)(N)>-8193 && (long)(N)<8192 )
|
|
|
332 |
#define SIMM19( N ) ( (long)(N)>-262145 && (long)(N)<262144 )
|
|
|
333 |
#define IS_POW2(c) ((c) != 0 && ((c) & ((c)-1)) == 0)
|
|
|
334 |
#define SIGNED 1
|
|
|
335 |
#define UNSIGNED 0
|
|
|
336 |
|
|
|
337 |
|
|
|
338 |
/* Exception Codes for floating point operations */
|
|
|
339 |
|
|
|
340 |
#define NO_EXCEPTION 0
|
|
|
341 |
#define INVALID_OPERATION 128
|
|
|
342 |
#define DIVISION_BY_ZERO 64
|
|
|
343 |
#define OVERFLOW 32
|
|
|
344 |
#define UNDERFLOW 16
|
|
|
345 |
#define INEXACT 8
|
|
|
346 |
#define UNIMPLEMENTED 4
|
|
|
347 |
|
|
|
348 |
|
|
|
349 |
/* Essential exception codes for the floating point operations */
|
|
|
350 |
|
|
|
351 |
#define EXCEPTION_CODE ( UNDERFLOW | OVERFLOW | DIVISION_BY_ZERO )
|
|
|
352 |
|
|
|
353 |
|
|
|
354 |
|
|
|
355 |
|
|
|
356 |
INS ( empty_ltrl, "" ); /* empty literal */
|
|
|
357 |
INS ( label_LB, "LB$" );
|
|
|
358 |
INS ( label_LD, "LD$" );
|
|
|
359 |
|
|
|
360 |
#endif /* HPPAINS_INCLUDED */
|
|
|
361 |
|
|
|
362 |
|
|
|
363 |
|
|
|
364 |
|
|
|
365 |
|
|
|
366 |
|
|
|
367 |
|
|
|
368 |
|
|
|
369 |
|
|
|
370 |
|
|
|
371 |
|
|
|
372 |
|
|
|
373 |
|
|
|
374 |
|
|
|
375 |
|
|
|
376 |
|
|
|
377 |
|
|
|
378 |
|
|
|
379 |
|
|
|
380 |
|