289a994bb9
2013-04-11 Robert Dewar <dewar@adacore.com> * back_end.adb (Register_Back_End_Types): Moved to Get_Targ * back_end.ads (C_String): Moved to Get_Targ (Register_Type_Proc): Moved to Get_Targ (Register_Back_End_Types): Moved to Get_Targ. * cstand.adb (Register_Float_Type): New interface (Create_Back_End_Float_Types): Use entries in FPT_Mode_Table. * get_targ.adb (Register_Back_End_Types): Moved here from Back_End. * get_targ.ads (C_String): Moved here from Back_End (Register_Type_Proc): Moved here from Back_End (Register_Back_End_Types): here from Back_End. * gnat1drv.adb (GGnat11drv): Add call to Write_Target_Dependent_Values; * lib-writ.ads, lib-writ.adb (Write_ALI): Remove section writing obsolete target dependent info. * opt.ads (Generate_Target_Dependent_Info): Removed (Target_Dependent_Info_Read): New flag (Target_Dependent_Info_Write): New flag * output.adb: Minor comment change * s-os_lib.ads: Minor reformatting * set_targ.ads, set_targ.adb: Minor reformatting. * switch-c.adb (Scan_Switches.First_Ptr): New variable (Scan_Front_End_Switches): Check -gnatd.b, -gnateT come first (Scan_Front_End_Switches): Handle -gnatet, -gnateT * ttypes.ads: Remove documentation section on target dependent info in ali file Remove four letter codes, no longer used Instead of using Get_Targ.Get_xxx, we use Set_Targ.xxx * usage.adb: Add usage lines for -gnatet/-gnateT * gcc-interface/Make-lang.in: Update dependencies. 2013-04-11 Thomas Quinot <quinot@adacore.com> * sem_ch4.adb: Update documentation. * sinfo.ads (N_Expression_With_Actions): Ditto. 2013-04-11 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch13.adb (Analyze_Aspect_Specifications): Add a guard to prevent the double insertion of the same aspect into a rep item list. This previously led to a circularity. 2013-04-11 Ed Schonberg <schonberg@adacore.com> * sem_attr.adb (Eval_Attribute, case 'Access): Reject attribute reference if the prefix is the dereference of an anonymous access to subprogram type. * exp_attr.adb (Expand_N_Attribute_Reference, Access_Cases): Handle properly a reference to the current instance of a protected type from within a protected subprogram. * sem_res.adb (Find_Unique_Access_Type): Treat Attribute_Access_Type like Allocator_Type when resolving an equality operator. From-SVN: r197791
344 lines
10 KiB
Ada
344 lines
10 KiB
Ada
------------------------------------------------------------------------------
|
|
-- --
|
|
-- GNAT COMPILER COMPONENTS --
|
|
-- --
|
|
-- G E T _ T A R G --
|
|
-- --
|
|
-- B o d y --
|
|
-- --
|
|
-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
|
|
-- --
|
|
-- GNAT is free software; you can redistribute it and/or modify it under --
|
|
-- terms of the GNU General Public License as published by the Free Soft- --
|
|
-- ware Foundation; either version 3, or (at your option) any later ver- --
|
|
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
|
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
|
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
|
|
-- for more details. You should have received a copy of the GNU General --
|
|
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
|
|
-- http://www.gnu.org/licenses for a complete copy of the license. --
|
|
-- --
|
|
-- GNAT was originally developed by the GNAT team at New York University. --
|
|
-- Extensive contributions were provided by Ada Core Technologies Inc. --
|
|
-- --
|
|
------------------------------------------------------------------------------
|
|
|
|
package body Get_Targ is
|
|
|
|
-- Functions returning individual runtime. For the standard (GCC) back
|
|
-- end these come from C interface functions (one for each value).
|
|
|
|
-----------------------
|
|
-- Get_Bits_Per_Unit --
|
|
-----------------------
|
|
|
|
function Get_Bits_Per_Unit return Pos is
|
|
function C_Get_Bits_Per_Unit return Pos;
|
|
pragma Import (C, C_Get_Bits_Per_Unit,
|
|
"get_target_bits_per_unit");
|
|
begin
|
|
return C_Get_Bits_Per_Unit;
|
|
end Get_Bits_Per_Unit;
|
|
|
|
-----------------------
|
|
-- Get_Bits_Per_Word --
|
|
-----------------------
|
|
|
|
function Get_Bits_Per_Word return Pos is
|
|
function C_Get_Bits_Per_Word return Pos;
|
|
pragma Import (C, C_Get_Bits_Per_Word,
|
|
"get_target_bits_per_word");
|
|
begin
|
|
return C_Get_Bits_Per_Word;
|
|
end Get_Bits_Per_Word;
|
|
|
|
-------------------
|
|
-- Get_Char_Size --
|
|
-------------------
|
|
|
|
function Get_Char_Size return Pos is
|
|
function C_Get_Char_Size return Pos;
|
|
pragma Import (C, C_Get_Char_Size,
|
|
"get_target_char_size");
|
|
begin
|
|
return C_Get_Char_Size;
|
|
end Get_Char_Size;
|
|
|
|
----------------------
|
|
-- Get_Wchar_T_Size --
|
|
----------------------
|
|
|
|
function Get_Wchar_T_Size return Pos is
|
|
function C_Get_Wchar_T_Size return Pos;
|
|
pragma Import (C, C_Get_Wchar_T_Size,
|
|
"get_target_wchar_t_size");
|
|
begin
|
|
return C_Get_Wchar_T_Size;
|
|
end Get_Wchar_T_Size;
|
|
|
|
--------------------
|
|
-- Get_Short_Size --
|
|
--------------------
|
|
|
|
function Get_Short_Size return Pos is
|
|
function C_Get_Short_Size return Pos;
|
|
pragma Import (C, C_Get_Short_Size,
|
|
"get_target_short_size");
|
|
begin
|
|
return C_Get_Short_Size;
|
|
end Get_Short_Size;
|
|
|
|
------------------
|
|
-- Get_Int_Size --
|
|
------------------
|
|
|
|
function Get_Int_Size return Pos is
|
|
function C_Get_Int_Size return Pos;
|
|
pragma Import (C, C_Get_Int_Size,
|
|
"get_target_int_size");
|
|
begin
|
|
return C_Get_Int_Size;
|
|
end Get_Int_Size;
|
|
|
|
-------------------
|
|
-- Get_Long_Size --
|
|
-------------------
|
|
|
|
function Get_Long_Size return Pos is
|
|
function C_Get_Long_Size return Pos;
|
|
pragma Import (C, C_Get_Long_Size,
|
|
"get_target_long_size");
|
|
begin
|
|
return C_Get_Long_Size;
|
|
end Get_Long_Size;
|
|
|
|
------------------------
|
|
-- Get_Long_Long_Size --
|
|
------------------------
|
|
|
|
function Get_Long_Long_Size return Pos is
|
|
function C_Get_Long_Long_Size return Pos;
|
|
pragma Import (C, C_Get_Long_Long_Size,
|
|
"get_target_long_long_size");
|
|
begin
|
|
return C_Get_Long_Long_Size;
|
|
end Get_Long_Long_Size;
|
|
|
|
--------------------
|
|
-- Get_Float_Size --
|
|
--------------------
|
|
|
|
function Get_Float_Size return Pos is
|
|
function C_Get_Float_Size return Pos;
|
|
pragma Import (C, C_Get_Float_Size,
|
|
"get_target_float_size");
|
|
begin
|
|
return C_Get_Float_Size;
|
|
end Get_Float_Size;
|
|
|
|
---------------------
|
|
-- Get_Double_Size --
|
|
---------------------
|
|
|
|
function Get_Double_Size return Pos is
|
|
function C_Get_Double_Size return Pos;
|
|
pragma Import (C, C_Get_Double_Size,
|
|
"get_target_double_size");
|
|
begin
|
|
return C_Get_Double_Size;
|
|
end Get_Double_Size;
|
|
|
|
--------------------------
|
|
-- Get_Long_Double_Size --
|
|
--------------------------
|
|
|
|
function Get_Long_Double_Size return Pos is
|
|
function C_Get_Long_Double_Size return Pos;
|
|
pragma Import (C, C_Get_Long_Double_Size,
|
|
"get_target_long_double_size");
|
|
begin
|
|
return C_Get_Long_Double_Size;
|
|
end Get_Long_Double_Size;
|
|
|
|
----------------------
|
|
-- Get_Pointer_Size --
|
|
----------------------
|
|
|
|
function Get_Pointer_Size return Pos is
|
|
function C_Get_Pointer_Size return Pos;
|
|
pragma Import (C, C_Get_Pointer_Size,
|
|
"get_target_pointer_size");
|
|
begin
|
|
return C_Get_Pointer_Size;
|
|
end Get_Pointer_Size;
|
|
|
|
---------------------------
|
|
-- Get_Maximum_Alignment --
|
|
---------------------------
|
|
|
|
function Get_Maximum_Alignment return Pos is
|
|
function C_Get_Maximum_Alignment return Pos;
|
|
pragma Import (C, C_Get_Maximum_Alignment,
|
|
"get_target_maximum_alignment");
|
|
begin
|
|
return C_Get_Maximum_Alignment;
|
|
end Get_Maximum_Alignment;
|
|
|
|
------------------------
|
|
-- Get_Float_Words_BE --
|
|
------------------------
|
|
|
|
function Get_Float_Words_BE return Nat is
|
|
function C_Get_Float_Words_BE return Nat;
|
|
pragma Import (C, C_Get_Float_Words_BE,
|
|
"get_float_words_be");
|
|
begin
|
|
return C_Get_Float_Words_BE;
|
|
end Get_Float_Words_BE;
|
|
|
|
------------------
|
|
-- Get_Words_BE --
|
|
------------------
|
|
|
|
function Get_Words_BE return Nat is
|
|
function C_Get_Words_BE return Nat;
|
|
pragma Import (C, C_Get_Words_BE,
|
|
"get_words_be");
|
|
begin
|
|
return C_Get_Words_BE;
|
|
end Get_Words_BE;
|
|
|
|
------------------
|
|
-- Get_Bytes_BE --
|
|
------------------
|
|
|
|
function Get_Bytes_BE return Nat is
|
|
function C_Get_Bytes_BE return Nat;
|
|
pragma Import (C, C_Get_Bytes_BE,
|
|
"get_bytes_be");
|
|
begin
|
|
return C_Get_Bytes_BE;
|
|
end Get_Bytes_BE;
|
|
|
|
-----------------
|
|
-- Get_Bits_BE --
|
|
-----------------
|
|
|
|
function Get_Bits_BE return Nat is
|
|
function C_Get_Bits_BE return Nat;
|
|
pragma Import (C, C_Get_Bits_BE,
|
|
"get_bits_be");
|
|
begin
|
|
return C_Get_Bits_BE;
|
|
end Get_Bits_BE;
|
|
|
|
--------------------------
|
|
-- Get_Strict_Alignment --
|
|
--------------------------
|
|
|
|
function Get_Strict_Alignment return Nat is
|
|
function C_Get_Strict_Alignment return Nat;
|
|
pragma Import (C, C_Get_Strict_Alignment,
|
|
"get_target_strict_alignment");
|
|
begin
|
|
return C_Get_Strict_Alignment;
|
|
end Get_Strict_Alignment;
|
|
|
|
------------------------------------
|
|
-- Get_System_Allocator_Alignment --
|
|
------------------------------------
|
|
|
|
function Get_System_Allocator_Alignment return Nat is
|
|
function C_Get_System_Allocator_Alignment return Nat;
|
|
pragma Import (C, C_Get_System_Allocator_Alignment,
|
|
"get_target_system_allocator_alignment");
|
|
begin
|
|
return C_Get_System_Allocator_Alignment;
|
|
end Get_System_Allocator_Alignment;
|
|
|
|
--------------------------------
|
|
-- Get_Double_Float_Alignment --
|
|
--------------------------------
|
|
|
|
function Get_Double_Float_Alignment return Nat is
|
|
function C_Get_Double_Float_Alignment return Nat;
|
|
pragma Import (C, C_Get_Double_Float_Alignment,
|
|
"get_target_double_float_alignment");
|
|
begin
|
|
return C_Get_Double_Float_Alignment;
|
|
end Get_Double_Float_Alignment;
|
|
|
|
---------------------------------
|
|
-- Get_Double_Scalar_Alignment --
|
|
---------------------------------
|
|
|
|
function Get_Double_Scalar_Alignment return Nat is
|
|
function C_Get_Double_Scalar_Alignment return Nat;
|
|
pragma Import (C, C_Get_Double_Scalar_Alignment,
|
|
"get_target_double_scalar_alignment");
|
|
begin
|
|
return C_Get_Double_Scalar_Alignment;
|
|
end Get_Double_Scalar_Alignment;
|
|
|
|
----------------------
|
|
-- Digits_From_Size --
|
|
----------------------
|
|
|
|
function Digits_From_Size (Size : Pos) return Pos is
|
|
begin
|
|
if Size = 32 then
|
|
return 6;
|
|
elsif Size = 48 then
|
|
return 9;
|
|
elsif Size = 64 then
|
|
return 15;
|
|
elsif Size = 96 then
|
|
return 18;
|
|
elsif Size = 128 then
|
|
return 18;
|
|
else
|
|
raise Program_Error;
|
|
end if;
|
|
end Digits_From_Size;
|
|
|
|
-----------------------------
|
|
-- Get_Max_Unaligned_Field --
|
|
-----------------------------
|
|
|
|
function Get_Max_Unaligned_Field return Pos is
|
|
begin
|
|
return 64; -- Can be different on some targets (e.g., AAMP)
|
|
end Get_Max_Unaligned_Field;
|
|
|
|
-----------------------------
|
|
-- Register_Back_End_Types --
|
|
-----------------------------
|
|
|
|
procedure Register_Back_End_Types (Call_Back : Register_Type_Proc) is
|
|
procedure Enumerate_Modes (Call_Back : Register_Type_Proc);
|
|
pragma Import (C, Enumerate_Modes, "enumerate_modes");
|
|
begin
|
|
Enumerate_Modes (Call_Back);
|
|
end Register_Back_End_Types;
|
|
|
|
---------------------
|
|
-- Width_From_Size --
|
|
---------------------
|
|
|
|
function Width_From_Size (Size : Pos) return Pos is
|
|
begin
|
|
if Size = 8 then
|
|
return 4;
|
|
elsif Size = 16 then
|
|
return 6;
|
|
elsif Size = 32 then
|
|
return 11;
|
|
elsif Size = 64 then
|
|
return 21;
|
|
else
|
|
raise Program_Error;
|
|
end if;
|
|
end Width_From_Size;
|
|
|
|
end Get_Targ;
|