| 1 |
706 |
jeremybenn |
------------------------------------------------------------------------------
|
| 2 |
|
|
-- --
|
| 3 |
|
|
-- GNAT COMPILER COMPONENTS --
|
| 4 |
|
|
-- --
|
| 5 |
|
|
-- B A C K _ E N D --
|
| 6 |
|
|
-- --
|
| 7 |
|
|
-- S p e c --
|
| 8 |
|
|
-- --
|
| 9 |
|
|
-- Copyright (C) 1992-2011, 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 |
|
|
-- Call the back end with all the information needed. Also contains other
|
| 27 |
|
|
-- back-end specific interfaces required by the front end.
|
| 28 |
|
|
|
| 29 |
|
|
with Einfo; use Einfo;
|
| 30 |
|
|
|
| 31 |
|
|
package Back_End is
|
| 32 |
|
|
|
| 33 |
|
|
type Back_End_Mode_Type is (
|
| 34 |
|
|
Generate_Object,
|
| 35 |
|
|
-- Full back end operation with object file generation
|
| 36 |
|
|
|
| 37 |
|
|
Declarations_Only,
|
| 38 |
|
|
-- Partial back end operation with no object file generation. In this
|
| 39 |
|
|
-- mode the only useful action performed by gigi is to process all
|
| 40 |
|
|
-- declarations issuing any error messages (in particular those to
|
| 41 |
|
|
-- do with rep clauses), and to back annotate representation info.
|
| 42 |
|
|
|
| 43 |
|
|
Skip);
|
| 44 |
|
|
-- Back end call is skipped (syntax only, or errors found)
|
| 45 |
|
|
|
| 46 |
|
|
pragma Convention (C, Back_End_Mode_Type);
|
| 47 |
|
|
for Back_End_Mode_Type use (0, 1, 2);
|
| 48 |
|
|
|
| 49 |
|
|
type C_String is array (0 .. 255) of aliased Character;
|
| 50 |
|
|
pragma Convention (C, C_String);
|
| 51 |
|
|
|
| 52 |
|
|
type Register_Type_Proc is access procedure
|
| 53 |
|
|
(C_Name : C_String; -- Nul-terminated string with name of type
|
| 54 |
|
|
Digs : Natural; -- Nr or digits for floating point, 0 otherwise
|
| 55 |
|
|
Complex : Boolean; -- True iff type has real and imaginary parts
|
| 56 |
|
|
Count : Natural; -- Number of elements in vector, 0 otherwise
|
| 57 |
|
|
Float_Rep : Float_Rep_Kind; -- Representation used for fpt type
|
| 58 |
|
|
Size : Positive; -- Size of representation in bits
|
| 59 |
|
|
Alignment : Natural); -- Required alignment in bits
|
| 60 |
|
|
pragma Convention (C, Register_Type_Proc);
|
| 61 |
|
|
-- Call back procedure for Register_Back_End_Types. This is to be used by
|
| 62 |
|
|
-- Create_Standard to create predefined types for all types supported by
|
| 63 |
|
|
-- the back end.
|
| 64 |
|
|
|
| 65 |
|
|
procedure Register_Back_End_Types (Call_Back : Register_Type_Proc);
|
| 66 |
|
|
-- Calls the Call_Back function with information for each supported type.
|
| 67 |
|
|
|
| 68 |
|
|
procedure Call_Back_End (Mode : Back_End_Mode_Type);
|
| 69 |
|
|
-- Call back end, i.e. make call to driver traversing the tree and
|
| 70 |
|
|
-- outputting code. This call is made with all tables locked.
|
| 71 |
|
|
-- The back end is responsible for unlocking any tables it may need
|
| 72 |
|
|
-- to change, and locking them again before returning.
|
| 73 |
|
|
|
| 74 |
|
|
procedure Scan_Compiler_Arguments;
|
| 75 |
|
|
-- Acquires command-line parameters passed to the compiler and processes
|
| 76 |
|
|
-- them. Calls Scan_Front_End_Switches for any front-end switches found.
|
| 77 |
|
|
--
|
| 78 |
|
|
-- The processing of arguments is private to the back end, since the way
|
| 79 |
|
|
-- of acquiring the arguments as well as the set of allowable back end
|
| 80 |
|
|
-- switches is different depending on the particular back end being used.
|
| 81 |
|
|
--
|
| 82 |
|
|
-- Any processed switches that influence the result of a compilation must
|
| 83 |
|
|
-- be added to the Compilation_Arguments table.
|
| 84 |
|
|
|
| 85 |
|
|
procedure Gen_Or_Update_Object_File;
|
| 86 |
|
|
-- Is used to generate the object file (if generated directly by gnat1), or
|
| 87 |
|
|
-- update it if it has already been generated by the call to Call_Back_End,
|
| 88 |
|
|
-- so that its timestamp is updated by the call.
|
| 89 |
|
|
--
|
| 90 |
|
|
-- This is a no-op with the gcc back-end (the object file is generated by
|
| 91 |
|
|
-- the assembler afterwards), but is needed for back-ends that directly
|
| 92 |
|
|
-- generate the final object file (such as the .NET backend) so that the
|
| 93 |
|
|
-- object file's timestamp is correct when compared with the corresponding
|
| 94 |
|
|
-- ali file by gnatmake.
|
| 95 |
|
|
|
| 96 |
|
|
end Back_End;
|