OSDN Git Service

2009-10-01 Tobias Burnus <burnus@net-b.de>
[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-2007, 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 3,  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 COPYING3.  If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license.          --
20 --                                                                          --
21 -- GNAT was originally developed  by the GNAT team at  New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
23 --                                                                          --
24 ------------------------------------------------------------------------------
25
26 with CStand;   use CStand;
27 with Einfo;    use Einfo;
28 with Opt;      use Opt;
29 with Stand;    use Stand;
30 with Targparm; use Targparm;
31 with Ttypef;   use Ttypef;
32
33 package body Sem_VFpt is
34
35    -----------------
36    -- Set_D_Float --
37    -----------------
38
39    procedure Set_D_Float (E : Entity_Id) is
40    begin
41       Init_Size         (Base_Type (E), 64);
42       Init_Alignment    (Base_Type (E));
43       Init_Digits_Value (Base_Type (E), VAXDF_Digits);
44       Set_Vax_Float     (Base_Type (E), True);
45       Set_Float_Bounds  (Base_Type (E));
46
47       Init_Size         (E, 64);
48       Init_Alignment    (E);
49       Init_Digits_Value (E, VAXDF_Digits);
50       Set_Scalar_Range  (E, Scalar_Range (Base_Type (E)));
51    end Set_D_Float;
52
53    -----------------
54    -- Set_F_Float --
55    -----------------
56
57    procedure Set_F_Float (E : Entity_Id) is
58    begin
59       Init_Size         (Base_Type (E), 32);
60       Init_Alignment    (Base_Type (E));
61       Init_Digits_Value (Base_Type (E), VAXFF_Digits);
62       Set_Vax_Float     (Base_Type (E), True);
63       Set_Float_Bounds  (Base_Type (E));
64
65       Init_Size         (E, 32);
66       Init_Alignment    (E);
67       Init_Digits_Value (E, VAXFF_Digits);
68       Set_Scalar_Range  (E, Scalar_Range (Base_Type (E)));
69    end Set_F_Float;
70
71    -----------------
72    -- Set_G_Float --
73    -----------------
74
75    procedure Set_G_Float (E : Entity_Id) is
76    begin
77       Init_Size         (Base_Type (E), 64);
78       Init_Alignment    (Base_Type (E));
79       Init_Digits_Value (Base_Type (E), VAXGF_Digits);
80       Set_Vax_Float     (Base_Type (E), True);
81       Set_Float_Bounds  (Base_Type (E));
82
83       Init_Size         (E, 64);
84       Init_Alignment    (E);
85       Init_Digits_Value (E, VAXGF_Digits);
86       Set_Scalar_Range  (E, Scalar_Range (Base_Type (E)));
87    end Set_G_Float;
88
89    -------------------
90    -- Set_IEEE_Long --
91    -------------------
92
93    procedure Set_IEEE_Long (E : Entity_Id) is
94    begin
95       Init_Size         (Base_Type (E), 64);
96       Init_Alignment    (Base_Type (E));
97       Init_Digits_Value (Base_Type (E), IEEEL_Digits);
98       Set_Vax_Float     (Base_Type (E), False);
99       Set_Float_Bounds  (Base_Type (E));
100
101       Init_Size         (E, 64);
102       Init_Alignment    (E);
103       Init_Digits_Value (E, IEEEL_Digits);
104       Set_Scalar_Range  (E, Scalar_Range (Base_Type (E)));
105    end Set_IEEE_Long;
106
107    --------------------
108    -- Set_IEEE_Short --
109    --------------------
110
111    procedure Set_IEEE_Short (E : Entity_Id) is
112    begin
113       Init_Size         (Base_Type (E), 32);
114       Init_Alignment    (Base_Type (E));
115       Init_Digits_Value (Base_Type (E), IEEES_Digits);
116       Set_Vax_Float     (Base_Type (E), False);
117       Set_Float_Bounds  (Base_Type (E));
118
119       Init_Size         (E, 32);
120       Init_Alignment    (E);
121       Init_Digits_Value (E, IEEES_Digits);
122       Set_Scalar_Range  (E, Scalar_Range (Base_Type (E)));
123    end Set_IEEE_Short;
124
125    ------------------------------
126    -- Set_Standard_Fpt_Formats --
127    ------------------------------
128
129    procedure Set_Standard_Fpt_Formats is
130    begin
131       --  IEEE case
132
133       if Opt.Float_Format = 'I' then
134          Set_IEEE_Short (Standard_Float);
135          Set_IEEE_Long  (Standard_Long_Float);
136          Set_IEEE_Long  (Standard_Long_Long_Float);
137
138       --  Vax float case
139
140       else
141          Set_F_Float (Standard_Float);
142
143          if Opt.Float_Format_Long = 'D' then
144             Set_D_Float (Standard_Long_Float);
145          else
146             Set_G_Float (Standard_Long_Float);
147          end if;
148
149          --  Note: Long_Long_Float gets set only in the real VMS case,
150          --  because this gives better results for testing out the use
151          --  of VAX float on non-VMS environments with the -gnatdm switch.
152
153          if OpenVMS_On_Target then
154             Set_G_Float (Standard_Long_Long_Float);
155          end if;
156       end if;
157    end Set_Standard_Fpt_Formats;
158
159 end Sem_VFpt;