Subversion Repositories tendra.SVN

Rev

Rev 2 | Details | Compare with Previous | 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
/*
32
$Log: regable.c,v $
33
 * Revision 1.1.1.1  1998/01/17  15:56:03  release
34
 * First version to be checked into rolling release.
35
 *
36
 * Revision 1.3  1996/03/14  16:18:48  wfs
37
 * tophed is not valregable + ptr position in apply_general case of scan() + superfluous "set -x" in bl_install script.
38
 *
39
 * Revision 1.2  1995/12/18  13:12:25  wfs
40
 * Put hppatrans uder cvs control. Major Changes made since last release
41
 * include:
42
 * (i) PIC code generation.
43
 * (ii) Profiling.
44
 * (iii) Dynamic Initialization.
45
 * (iv) Debugging of Exception Handling and Diagnostics.
46
 *
47
 * Revision 5.1  1995/10/05  08:59:34  wfs
48
 * "isoutpar" check added to "fixregable()" and "floatregable()".
49
 *
50
 * Revision 5.0  1995/08/25  13:42:58  wfs
51
 * Preperation for August 25 Glue release
52
 *
53
 * Revision 3.4  1995/08/25  10:25:41  wfs
54
 * *** empty log message ***
55
 *
56
 * Revision 3.4  1995/08/25  10:25:41  wfs
57
 * *** empty log message ***
58
 *
59
 * Revision 3.1  95/04/10  16:27:56  16:27:56  wfs (William Simmonds)
60
 * Apr95 tape version.
61
 * 
62
 * Revision 3.0  95/03/30  11:18:47  11:18:47  wfs (William Simmonds)
63
 * Mar95 tape version with CRCR95_178 bug fix.
64
 * 
65
 * Revision 2.0  95/03/15  15:28:37  15:28:37  wfs (William Simmonds)
66
 * spec 3.1 changes implemented, tests outstanding.
67
 * 
68
 * Revision 1.1  95/01/11  13:15:06  13:15:06  wfs (William Simmonds)
69
 * Initial revision
70
 * 
71
*/
72
 
73
 
74
#define HPPATRANS_CODE
75
#include "config.h"
76
#include "expmacs.h"
77
#include "common_types.h"
78
#include "shapemacs.h"
79
#include "regable.h"
80
#include "tags.h"
81
 
82
/*
83
    DOES A VALUE OF SHAPE s FIT INTO A FIXED REGISTER?
84
*/
85
 
86
bool valregable 
87
    PROTO_N ( ( s ) )
88
    PROTO_T ( shape s )
89
{
90
    int n = name(s);
91
    if ( is_floating(n) )
92
    {
93
	return 0 ; /* floats don't go in fixed point registers */
94
    } 
95
    else
96
    {
97
	ash a ;
98
	a = ashof(s) ;
99
	if ( a.ashsize > 32 )
100
	{
101
	    return (0) ; /* too big for a 32 bit register */
102
	} 
103
	else if ( n==cpdhd || n==nofhd )
104
	{
105
	    return 0 ; /* Compound shapes are not put in registers */
106
	}
107
	else if ( n==tophd )
108
	{
109
	    return 0 ;
110
	}
111
	else
112
	{
113
	    return 1 ;
114
	}
115
    }
116
}
117
 
118
/*
119
    DOES THE EXPRESSION e FIT INTO A FIXED REGISTER?
120
*/
121
 
122
bool fixregable 
123
    PROTO_N ( ( e ) )
124
    PROTO_T ( exp e )
125
{
126
    if ( !isvis ( e ) && !isoutpar( e ) && !isglob ( e ) && !isenvoff(e)
127
		      && (name(son(e))!=caller_name_tag) ) {
128
	shape s = sh ( son ( e ) ) ;
129
	return ( valregable ( s ) ) ;
130
    }
131
    return ( 0 ) ;
132
}
133
 
134
 
135
/*
136
    DOES THE EXPRESSION e FIT INTO A FLOATING POINT REGISTER?
137
*/
138
 
139
bool floatregable 
140
    PROTO_N ( ( e ) )
141
    PROTO_T ( exp e )
142
{
143
    if ( !isvis ( e ) && !isoutpar( e ) && !isglob ( e ) && !isenvoff(e)
144
		      && (name(son(e))!=caller_name_tag) ) {
145
	shape s = sh ( son ( e ) ) ;
146
	if ( is_floating ( name ( s ) ) ) {
147
#if use_long_double
148
	   if ( shape_size ( s ) > 64 )
149
	   {
150
	      return ( 0 ) ;
151
	   }
152
#endif
153
	   return ( 1 ) ;
154
	} else {
155
	    return ( 0 ) ;
156
	}
157
    }
158
    return (0) ;
159
}