diff options
author | Tristan Gingold <tgingold@free.fr> | 2018-11-25 20:07:00 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2018-11-26 20:19:15 +0100 |
commit | 44404214d370d226428e315da946d41ccf141507 (patch) | |
tree | 5741a66f5e0def695965664dbe0397e309a2cfad /src/ghdldrv | |
parent | d570ee98eaa200cc1bbf481035aa3bb1680504db (diff) | |
download | ghdl-44404214d370d226428e315da946d41ccf141507.tar.gz ghdl-44404214d370d226428e315da946d41ccf141507.tar.bz2 ghdl-44404214d370d226428e315da946d41ccf141507.zip |
Keep source file entry in design file to avoid searching the file.
Diffstat (limited to 'src/ghdldrv')
-rw-r--r-- | src/ghdldrv/ghdllocal.adb | 17 | ||||
-rw-r--r-- | src/ghdldrv/ghdlprint.adb | 6 |
2 files changed, 17 insertions, 6 deletions
diff --git a/src/ghdldrv/ghdllocal.adb b/src/ghdldrv/ghdllocal.adb index 2f7cf1f54..1c3059b73 100644 --- a/src/ghdldrv/ghdllocal.adb +++ b/src/ghdldrv/ghdllocal.adb @@ -1218,8 +1218,12 @@ package body Ghdllocal is File := Get_Design_File_Chain (Lib); while File /= Null_Iir loop Next_File := Get_Chain (File); - Fe := Read_Source_File (Get_Design_File_Directory (File), - Get_Design_File_Filename (File)); + Fe := Get_Design_File_Source (File); + if Fe = No_Source_File_Entry then + Fe := Read_Source_File (Get_Design_File_Directory (File), + Get_Design_File_Filename (File)); + Set_Design_File_Source (File, Fe); + end if; if Fe = No_Source_File_Entry then -- FIXME: should remove all the design file from the library. null; @@ -1230,6 +1234,7 @@ package body Ghdllocal is -- Extract libraries. -- Note: we can't parse it only, since we need to keep the -- date. + Set_Design_File_Source (File, Fe); Unit := Get_First_Design_Unit (File); while Unit /= Null_Iir loop Sem_Lib.Load_Parse_Design_Unit (Unit, Null_Iir); @@ -1427,8 +1432,12 @@ package body Ghdllocal is Fe : Source_File_Entry; begin -- 2) file has been modified. - Fe := Read_Source_File (Get_Design_File_Directory (File), - Get_Design_File_Filename (File)); + Fe := Get_Design_File_Source (File); + if Fe = No_Source_File_Entry then + Fe := Read_Source_File (Get_Design_File_Directory (File), + Get_Design_File_Filename (File)); + Set_Design_File_Source (File, Fe); + end if; if not Is_Eq (Get_File_Checksum (Fe), Get_File_Checksum (File)) then diff --git a/src/ghdldrv/ghdlprint.adb b/src/ghdldrv/ghdlprint.adb index 29d7f7e29..ce0433204 100644 --- a/src/ghdldrv/ghdlprint.adb +++ b/src/ghdldrv/ghdlprint.adb @@ -559,6 +559,8 @@ package body Ghdlprint is pragma Unreferenced (Cmd); use Ada.Characters.Latin_1; + Files : Iir_Array (Args'Range); + function Build_File_Name_Length (Lib : Iir) return Natural is Id : constant Name_Id := Get_Identifier (Lib); @@ -682,6 +684,7 @@ package body Ghdlprint is if Design_File = Null_Iir then raise Compile_Error; end if; + Files (I) := Design_File; Unit := Get_First_Design_Unit (Design_File); while Unit /= Null_Iir loop Lib := Get_Library_Unit (Unit); @@ -707,8 +710,7 @@ package body Ghdlprint is -- Second loop: do the real work. for I in Args'Range loop - Id := Get_Identifier (Args (I).all); - Design_File := Load_File (Id); + Design_File := Files (I); Unit := Get_First_Design_Unit (Design_File); declare use Files_Map; |