OSDN Git Service

New Language: Ada
[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 --                            $Revision: 1.10 $
10 --                                                                          --
11 --          Copyright (C) 1997-2000, Free Software Foundation, Inc.         --
12 --                                                                          --
13 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
14 -- terms of the  GNU General Public License as published  by the Free Soft- --
15 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
16 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
19 -- for  more details.  You should have  received  a copy of the GNU General --
20 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
21 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
22 -- MA 02111-1307, USA.                                                      --
23 --                                                                          --
24 -- GNAT was originally developed  by the GNAT team at  New York University. --
25 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
26 --                                                                          --
27 ------------------------------------------------------------------------------
28
29 with CStand;   use CStand;
30 with Einfo;    use Einfo;
31 with Opt;      use Opt;
32 with Stand;    use Stand;
33 with Targparm; use Targparm;
34 with Ttypef;   use Ttypef;
35 with Uintp;    use Uintp;
36
37 pragma Elaborate_All (Uintp);
38
39 package body Sem_VFpt is
40
41    T_Digits : constant Uint := UI_From_Int (IEEEL_Digits);
42    --  Digits for IEEE formats
43
44    -----------------
45    -- Set_D_Float --
46    -----------------
47
48    procedure Set_D_Float (E : Entity_Id) is
49    begin
50       Init_Size         (Base_Type (E), 64);
51       Init_Alignment    (Base_Type (E));
52       Init_Digits_Value (Base_Type (E), VAXDF_Digits);
53       Set_Vax_Float     (Base_Type (E), True);
54       Set_Float_Bounds  (Base_Type (E));
55
56       Init_Size         (E, 64);
57       Init_Alignment    (E);
58       Init_Digits_Value (E, VAXDF_Digits);
59       Set_Scalar_Range  (E, Scalar_Range (Base_Type (E)));
60    end Set_D_Float;
61
62    -----------------
63    -- Set_F_Float --
64    -----------------
65
66    procedure Set_F_Float (E : Entity_Id) is
67    begin
68       Init_Size         (Base_Type (E), 32);
69       Init_Alignment    (Base_Type (E));
70       Init_Digits_Value (Base_Type (E), VAXFF_Digits);
71       Set_Vax_Float     (Base_Type (E), True);
72       Set_Float_Bounds  (Base_Type (E));
73
74       Init_Size         (E, 32);
75       Init_Alignment    (E);
76       Init_Digits_Value (E, VAXFF_Digits);
77       Set_Scalar_Range  (E, Scalar_Range (Base_Type (E)));
78    end Set_F_Float;
79
80    -----------------
81    -- Set_G_Float --
82    -----------------
83
84    procedure Set_G_Float (E : Entity_Id) is
85    begin
86       Init_Size         (Base_Type (E), 64);
87       Init_Alignment    (Base_Type (E));
88       Init_Digits_Value (Base_Type (E), VAXGF_Digits);
89       Set_Vax_Float     (Base_Type (E), True);
90       Set_Float_Bounds  (Base_Type (E));
91
92       Init_Size         (E, 64);
93       Init_Alignment    (E);
94       Init_Digits_Value (E, VAXGF_Digits);
95       Set_Scalar_Range  (E, Scalar_Range (Base_Type (E)));
96    end Set_G_Float;
97
98    -------------------
99    -- Set_IEEE_Long --
100    -------------------
101
102    procedure Set_IEEE_Long (E : Entity_Id) is
103    begin
104       Init_Size         (Base_Type (E), 64);
105       Init_Alignment    (Base_Type (E));
106       Init_Digits_Value (Base_Type (E), IEEEL_Digits);
107       Set_Vax_Float     (Base_Type (E), False);
108       Set_Float_Bounds  (Base_Type (E));
109
110       Init_Size         (E, 64);
111       Init_Alignment    (E);
112       Init_Digits_Value (E, IEEEL_Digits);
113       Set_Scalar_Range  (E, Scalar_Range (Base_Type (E)));
114    end Set_IEEE_Long;
115
116    --------------------
117    -- Set_IEEE_Short --
118    --------------------
119
120    procedure Set_IEEE_Short (E : Entity_Id) is
121    begin
122       Init_Size         (Base_Type (E), 32);
123       Init_Alignment    (Base_Type (E));
124       Init_Digits_Value (Base_Type (E), IEEES_Digits);
125       Set_Vax_Float     (Base_Type (E), False);
126       Set_Float_Bounds  (Base_Type (E));
127
128       Init_Size         (E, 32);
129       Init_Alignment    (E);
130       Init_Digits_Value (E, IEEES_Digits);
131       Set_Scalar_Range  (E, Scalar_Range (Base_Type (E)));
132    end Set_IEEE_Short;
133
134    ------------------------------
135    -- Set_Standard_Fpt_Formats --
136    ------------------------------
137
138    procedure Set_Standard_Fpt_Formats is
139    begin
140       --  IEEE case
141
142       if Opt.Float_Format = 'I' then
143          Set_IEEE_Short (Standard_Float);
144          Set_IEEE_Long  (Standard_Long_Float);
145          Set_IEEE_Long  (Standard_Long_Long_Float);
146
147       --  Vax float case
148
149       else
150          Set_F_Float (Standard_Float);
151
152          if Opt.Float_Format_Long = 'D' then
153             Set_D_Float (Standard_Long_Float);
154          else
155             Set_G_Float (Standard_Long_Float);
156          end if;
157
158          --  Note: Long_Long_Float gets set only in the real VMS case,
159          --  because this gives better results for testing out the use
160          --  of VAX float on non-VMS environments with the -gnatdm switch.
161
162          if OpenVMS_On_Target then
163             Set_G_Float (Standard_Long_Long_Float);
164          end if;
165       end if;
166    end Set_Standard_Fpt_Formats;
167
168 end Sem_VFpt;