OSDN Git Service

* pa.h (LEGITIMATE_CONSTANT_P): Simplify.
[pf3gnuchains/gcc-fork.git] / gcc / ada / sem_vfpt.adb
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                             S E M _ V F P T                              --
6 --                                                                          --
7 --                                 B o d y                                  --
8 --                                                                          --
9 --          Copyright (C) 1997-2002, Free Software Foundation, Inc.         --
10 --                                                                          --
11 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
12 -- terms of the  GNU General Public License as published  by the Free Soft- --
13 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
14 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
17 -- for  more details.  You should have  received  a copy of the GNU General --
18 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
19 -- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
20 -- Boston, MA 02110-1301, USA.                                              --
21 --                                                                          --
22 -- GNAT was originally developed  by the GNAT team at  New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
24 --                                                                          --
25 ------------------------------------------------------------------------------
26
27 with CStand;   use CStand;
28 with Einfo;    use Einfo;
29 with Opt;      use Opt;
30 with Stand;    use Stand;
31 with Targparm; use Targparm;
32 with Ttypef;   use Ttypef;
33
34 package body Sem_VFpt is
35
36    -----------------
37    -- Set_D_Float --
38    -----------------
39
40    procedure Set_D_Float (E : Entity_Id) is
41    begin
42       Init_Size         (Base_Type (E), 64);
43       Init_Alignment    (Base_Type (E));
44       Init_Digits_Value (Base_Type (E), VAXDF_Digits);
45       Set_Vax_Float     (Base_Type (E), True);
46       Set_Float_Bounds  (Base_Type (E));
47
48       Init_Size         (E, 64);
49       Init_Alignment    (E);
50       Init_Digits_Value (E, VAXDF_Digits);
51       Set_Scalar_Range  (E, Scalar_Range (Base_Type (E)));
52    end Set_D_Float;
53
54    -----------------
55    -- Set_F_Float --
56    -----------------
57
58    procedure Set_F_Float (E : Entity_Id) is
59    begin
60       Init_Size         (Base_Type (E), 32);
61       Init_Alignment    (Base_Type (E));
62       Init_Digits_Value (Base_Type (E), VAXFF_Digits);
63       Set_Vax_Float     (Base_Type (E), True);
64       Set_Float_Bounds  (Base_Type (E));
65
66       Init_Size         (E, 32);
67       Init_Alignment    (E);
68       Init_Digits_Value (E, VAXFF_Digits);
69       Set_Scalar_Range  (E, Scalar_Range (Base_Type (E)));
70    end Set_F_Float;
71
72    -----------------
73    -- Set_G_Float --
74    -----------------
75
76    procedure Set_G_Float (E : Entity_Id) is
77    begin
78       Init_Size         (Base_Type (E), 64);
79       Init_Alignment    (Base_Type (E));
80       Init_Digits_Value (Base_Type (E), VAXGF_Digits);
81       Set_Vax_Float     (Base_Type (E), True);
82       Set_Float_Bounds  (Base_Type (E));
83
84       Init_Size         (E, 64);
85       Init_Alignment    (E);
86       Init_Digits_Value (E, VAXGF_Digits);
87       Set_Scalar_Range  (E, Scalar_Range (Base_Type (E)));
88    end Set_G_Float;
89
90    -------------------
91    -- Set_IEEE_Long --
92    -------------------
93
94    procedure Set_IEEE_Long (E : Entity_Id) is
95    begin
96       Init_Size         (Base_Type (E), 64);
97       Init_Alignment    (Base_Type (E));
98       Init_Digits_Value (Base_Type (E), IEEEL_Digits);
99       Set_Vax_Float     (Base_Type (E), False);
100       Set_Float_Bounds  (Base_Type (E));
101
102       Init_Size         (E, 64);
103       Init_Alignment    (E);
104       Init_Digits_Value (E, IEEEL_Digits);
105       Set_Scalar_Range  (E, Scalar_Range (Base_Type (E)));
106    end Set_IEEE_Long;
107
108    --------------------
109    -- Set_IEEE_Short --
110    --------------------
111
112    procedure Set_IEEE_Short (E : Entity_Id) is
113    begin
114       Init_Size         (Base_Type (E), 32);
115       Init_Alignment    (Base_Type (E));
116       Init_Digits_Value (Base_Type (E), IEEES_Digits);
117       Set_Vax_Float     (Base_Type (E), False);
118       Set_Float_Bounds  (Base_Type (E));
119
120       Init_Size         (E, 32);
121       Init_Alignment    (E);
122       Init_Digits_Value (E, IEEES_Digits);
123       Set_Scalar_Range  (E, Scalar_Range (Base_Type (E)));
124    end Set_IEEE_Short;
125
126    ------------------------------
127    -- Set_Standard_Fpt_Formats --
128    ------------------------------
129
130    procedure Set_Standard_Fpt_Formats is
131    begin
132       --  IEEE case
133
134       if Opt.Float_Format = 'I' then
135          Set_IEEE_Short (Standard_Float);
136          Set_IEEE_Long  (Standard_Long_Float);
137          Set_IEEE_Long  (Standard_Long_Long_Float);
138
139       --  Vax float case
140
141       else
142          Set_F_Float (Standard_Float);
143
144          if Opt.Float_Format_Long = 'D' then
145             Set_D_Float (Standard_Long_Float);
146          else
147             Set_G_Float (Standard_Long_Float);
148          end if;
149
150          --  Note: Long_Long_Float gets set only in the real VMS case,
151          --  because this gives better results for testing out the use
152          --  of VAX float on non-VMS environments with the -gnatdm switch.
153
154          if OpenVMS_On_Target then
155             Set_G_Float (Standard_Long_Long_Float);
156          end if;
157       end if;
158    end Set_Standard_Fpt_Formats;
159
160 end Sem_VFpt;