Commit c3048783 by Eric Botcazou Committed by Eric Botcazou

Mapped location support

	Mapped location support
	* back_end.adb (Call_Back_End): Pass information about source
	files instead of units to gigi.
	* gigi.h (struct File_Info_Type): New.
	(gigi): Rename and change type of number_units parameter, change
	type of file_info_ptr parameter.
	* trans.c (number_files): New global variable.
	(gigi): Rename and change type of number_units parameter, change
	type of file_info_ptr parameter.
	If mapped location support is enabled, create the isomorphic mapping
	between source files and line maps.
	(Sloc_to_locus): If mapped location support is enabled, translate
	source location into mapped location.
	(annotate_with_node): Rename into set_expr_location_from_node.
	Call set_expr_location instead of annotate_with_locus.
	(Pragma_to_gnu): Adjust for above change.
	(Loop_Statement_to_gnu): Likewise.
	(call_to_gnu): Likewise.
	(Handled_Sequence_Of_Statements_to_gnu): Likewise.
	(gnat_to_gnu): Likewise.
	(add_stmt_with_node): Likewise.
	(add_cleanup): Likewise.
	* utils.c (gnat_init_decl_processing): Do not set input_line.

From-SVN: r128839
parent 3c1eb9eb
2007-09-27 Eric Botcazou <ebotcazou@adacore.com>
Mapped location support
* back_end.adb (Call_Back_End): Pass information about source
files instead of units to gigi.
* gigi.h (struct File_Info_Type): New.
(gigi): Rename and change type of number_units parameter, change
type of file_info_ptr parameter.
* trans.c (number_files): New global variable.
(gigi): Rename and change type of number_units parameter, change
type of file_info_ptr parameter.
If mapped location support is enabled, create the isomorphic mapping
between source files and line maps.
(Sloc_to_locus): If mapped location support is enabled, translate
source location into mapped location.
(annotate_with_node): Rename into set_expr_location_from_node.
Call set_expr_location instead of annotate_with_locus.
(Pragma_to_gnu): Adjust for above change.
(Loop_Statement_to_gnu): Likewise.
(call_to_gnu): Likewise.
(Handled_Sequence_Of_Statements_to_gnu): Likewise.
(gnat_to_gnu): Likewise.
(add_stmt_with_node): Likewise.
(add_cleanup): Likewise.
* utils.c (gnat_init_decl_processing): Do not set input_line.
2007-09-26 Hristian Kirtchev <kirtchev@adacore.com> 2007-09-26 Hristian Kirtchev <kirtchev@adacore.com>
* sem_ch8.adb (Analyze_Use_Type): Code cleanup. * sem_ch8.adb (Analyze_Use_Type): Code cleanup.
...@@ -48,19 +48,16 @@ package body Back_End is ...@@ -48,19 +48,16 @@ package body Back_End is
procedure Call_Back_End (Mode : Back_End_Mode_Type) is procedure Call_Back_End (Mode : Back_End_Mode_Type) is
-- The File_Record type has a lot of components that are meaningless -- The Source_File_Record type has a lot of components that are
-- to the back end, so a new record is created here to contain the -- meaningless to the back end, so a new record type is created
-- needed information for each file. -- here to contain the needed information for each file.
type Needed_File_Info_Type is record type File_Info_Type is record
File_Name : File_Name_Type; File_Name : File_Name_Type;
First_Sloc : Source_Ptr;
Last_Sloc : Source_Ptr;
Num_Source_Lines : Nat; Num_Source_Lines : Nat;
end record; end record;
File_Info_Array : File_Info_Array : array (1 .. Last_Source_File) of File_Info_Type;
array (Main_Unit .. Last_Unit) of Needed_File_Info_Type;
procedure gigi ( procedure gigi (
gnat_root : Int; gnat_root : Int;
...@@ -76,7 +73,7 @@ package body Back_End is ...@@ -76,7 +73,7 @@ package body Back_End is
strings_ptr : Address; strings_ptr : Address;
string_chars_ptr : Address; string_chars_ptr : Address;
list_headers_ptr : Address; list_headers_ptr : Address;
number_units : Int; number_file : Nat;
file_info_ptr : Address; file_info_ptr : Address;
gigi_standard_integer : Entity_Id; gigi_standard_integer : Entity_Id;
...@@ -86,8 +83,6 @@ package body Back_End is ...@@ -86,8 +83,6 @@ package body Back_End is
pragma Import (C, gigi); pragma Import (C, gigi);
S : Source_File_Index;
begin begin
-- Skip call if in -gnatdH mode -- Skip call if in -gnatdH mode
...@@ -95,12 +90,9 @@ package body Back_End is ...@@ -95,12 +90,9 @@ package body Back_End is
return; return;
end if; end if;
for J in Main_Unit .. Last_Unit loop for I in 1 .. Last_Source_File loop
S := Source_Index (J); File_Info_Array (I).File_Name := Full_Debug_Name (I);
File_Info_Array (J).File_Name := File_Name (S); File_Info_Array (I).Num_Source_Lines := Num_Source_Lines (I);
File_Info_Array (J).First_Sloc := Source_Text (S)'First;
File_Info_Array (J).Last_Sloc := Source_Text (S)'Last;
File_Info_Array (J).Num_Source_Lines := Num_Source_Lines (S);
end loop; end loop;
gigi ( gigi (
...@@ -117,7 +109,7 @@ package body Back_End is ...@@ -117,7 +109,7 @@ package body Back_End is
strings_ptr => Strings_Address, strings_ptr => Strings_Address,
string_chars_ptr => String_Chars_Address, string_chars_ptr => String_Chars_Address,
list_headers_ptr => Lists_Address, list_headers_ptr => Lists_Address,
number_units => Num_Units, number_file => Num_Source_Files,
file_info_ptr => File_Info_Array'Address, file_info_ptr => File_Info_Array'Address,
gigi_standard_integer => Standard_Integer, gigi_standard_integer => Standard_Integer,
......
...@@ -192,6 +192,13 @@ extern bool type_annotate_only; ...@@ -192,6 +192,13 @@ extern bool type_annotate_only;
/* Current file name without path */ /* Current file name without path */
extern const char *ref_filename; extern const char *ref_filename;
/* This structure must be kept synchronized with Call_Back_End. */
struct File_Info_Type
{
File_Name_Type File_Name;
Nat Num_Source_Lines;
};
/* This is the main program of the back-end. It sets up all the table /* This is the main program of the back-end. It sets up all the table
structures and then generates code. structures and then generates code.
...@@ -204,8 +211,8 @@ extern void gigi (Node_Id gnat_root, int max_gnat_node, int number_name, ...@@ -204,8 +211,8 @@ extern void gigi (Node_Id gnat_root, int max_gnat_node, int number_name,
struct String_Entry *strings_ptr, struct String_Entry *strings_ptr,
Char_Code *strings_chars_ptr, Char_Code *strings_chars_ptr,
struct List_Header *list_headers_ptr, struct List_Header *list_headers_ptr,
Int number_units ATTRIBUTE_UNUSED, Nat number_file,
char *file_info_ptr ATTRIBUTE_UNUSED, struct File_Info_Type *file_info_ptr ATTRIBUTE_UNUSED,
Entity_Id standard_integer, Entity_Id standard_integer,
Entity_Id standard_long_long_float, Entity_Id standard_long_long_float,
Entity_Id standard_exception_type, Entity_Id standard_exception_type,
...@@ -229,11 +236,9 @@ extern int gnat_gimplify_expr (tree *expr_p, tree *pre_p, ...@@ -229,11 +236,9 @@ extern int gnat_gimplify_expr (tree *expr_p, tree *pre_p,
make a GCC type for GNAT_ENTITY and set up the correspondence. */ make a GCC type for GNAT_ENTITY and set up the correspondence. */
extern void process_type (Entity_Id gnat_entity); extern void process_type (Entity_Id gnat_entity);
/* Convert Sloc into *LOCUS (a location_t). Return true if this Sloc /* Convert SLOC into LOCUS. Return true if SLOC corresponds to a source code
corresponds to a source code location and false if it doesn't. In the location and false if it doesn't. In the former case, set the Gigi global
latter case, we don't update *LOCUS. We also set the Gigi global variable variable REF_FILENAME to the simple debug file name as given by sinput. */
REF_FILENAME to the reference file name as given by sinput (i.e no
directory). */
extern bool Sloc_to_locus (Source_Ptr Sloc, location_t *locus); extern bool Sloc_to_locus (Source_Ptr Sloc, location_t *locus);
/* Post an error message. MSG is the error message, properly annotated. /* Post an error message. MSG is the error message, properly annotated.
......
...@@ -478,8 +478,6 @@ gnat_pushdecl (tree decl, Node_Id gnat_node) ...@@ -478,8 +478,6 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
void void
gnat_init_decl_processing (void) gnat_init_decl_processing (void)
{ {
input_line = 0;
/* Make the binding_level structure for global names. */ /* Make the binding_level structure for global names. */
current_function_decl = 0; current_function_decl = 0;
current_binding_level = 0; current_binding_level = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment