diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-23 08:46:08 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-23 08:46:08 +0000 |
commit | 6e3d50ccc62420a6e6e90cf4d62f6547653bc6f5 (patch) | |
tree | 133edf7db0b7358ff43b599d5a6a541f92fce9f4 /gcc/ada/g-pehage.adb | |
parent | a204eb6dd7e0975d76798b5153e33e7b49b775fd (diff) | |
download | gcc-6e3d50ccc62420a6e6e90cf4d62f6547653bc6f5.tar.gz |
2010-06-23 Thomas Quinot <quinot@adacore.com>
* sem_util.adb, sem_util.ads: Minor reformatting.
2010-06-23 Vincent Celier <celier@adacore.com>
* prj.ads (Gprclean_Flags.Missing_Source_Files): Set to Error to keep
the previous behavior of gprclean when there are missing files.
2010-06-23 Ed Schonberg <schonberg@adacore.com>
* sem_ch12.adb (Load_Body_Of_Generic): In CodePeer mode, a missing
generic body is not a fatal error.
(Mark_Context): Handle properly names of child units.
* sem.adb (Walk_Library_Items.Do_Action): Remove assertion on
instantiations.
2010-06-23 Vincent Celier <celier@adacore.com>
* ali.adb (Scan_ALI): When ignoring R lines, do not skip the next
non-empty line.
2010-06-23 Bob Duff <duff@adacore.com>
* g-pehage.ads, g-pehage.adb: Switch default optimization mode to
Memory_Space, because CPU_Time doesn't seem to provide any significant
speed advantage in practice. Cleanup: Get rid of constant
Default_Optimization; doesn't seem to add anything. Use case
statements instead of if statements; seems cleaner.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161259 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/g-pehage.adb')
-rw-r--r-- | gcc/ada/g-pehage.adb | 113 |
1 files changed, 59 insertions, 54 deletions
diff --git a/gcc/ada/g-pehage.adb b/gcc/ada/g-pehage.adb index 82cb6d03278..b59e1ecec98 100644 --- a/gcc/ada/g-pehage.adb +++ b/gcc/ada/g-pehage.adb @@ -1176,7 +1176,7 @@ package body GNAT.Perfect_Hash_Generators is procedure Initialize (Seed : Natural; K_To_V : Float := Default_K_To_V; - Optim : Optimization := CPU_Time; + Optim : Optimization := Memory_Space; Tries : Positive := Default_Tries) is begin @@ -1596,39 +1596,41 @@ package body GNAT.Perfect_Hash_Generators is New_Line (File); - if Opt = CPU_Time then - Put_Int_Matrix - (File, - Array_Img ("T1", Type_Img (NV), - Range_Img (0, T1_Len - 1), - Range_Img (0, T2_Len - 1, Type_Img (256))), - T1, T1_Len, T2_Len); - - else - Put_Int_Matrix - (File, - Array_Img ("T1", Type_Img (NV), - Range_Img (0, T1_Len - 1)), - T1, T1_Len, 0); - end if; + case Opt is + when CPU_Time => + Put_Int_Matrix + (File, + Array_Img ("T1", Type_Img (NV), + Range_Img (0, T1_Len - 1), + Range_Img (0, T2_Len - 1, Type_Img (256))), + T1, T1_Len, T2_Len); + + when Memory_Space => + Put_Int_Matrix + (File, + Array_Img ("T1", Type_Img (NV), + Range_Img (0, T1_Len - 1)), + T1, T1_Len, 0); + end case; New_Line (File); - if Opt = CPU_Time then - Put_Int_Matrix - (File, - Array_Img ("T2", Type_Img (NV), - Range_Img (0, T1_Len - 1), - Range_Img (0, T2_Len - 1, Type_Img (256))), - T2, T1_Len, T2_Len); - - else - Put_Int_Matrix - (File, - Array_Img ("T2", Type_Img (NV), - Range_Img (0, T1_Len - 1)), - T2, T1_Len, 0); - end if; + case Opt is + when CPU_Time => + Put_Int_Matrix + (File, + Array_Img ("T2", Type_Img (NV), + Range_Img (0, T1_Len - 1), + Range_Img (0, T2_Len - 1, Type_Img (256))), + T2, T1_Len, T2_Len); + + when Memory_Space => + Put_Int_Matrix + (File, + Array_Img ("T2", Type_Img (NV), + Range_Img (0, T1_Len - 1)), + T2, T1_Len, 0); + end case; New_Line (File); @@ -1650,11 +1652,12 @@ package body GNAT.Perfect_Hash_Generators is Put (File, " J : "); - if Opt = CPU_Time then - Put (File, Type_Img (256)); - else - Put (File, "Natural"); - end if; + case Opt is + when CPU_Time => + Put (File, Type_Img (256)); + when Memory_Space => + Put (File, "Natural"); + end case; Put (File, ";"); New_Line (File); @@ -1667,11 +1670,12 @@ package body GNAT.Perfect_Hash_Generators is New_Line (File); Put (File, " J := "); - if Opt = CPU_Time then - Put (File, "C"); - else - Put (File, "Character'Pos"); - end if; + case Opt is + when CPU_Time => + Put (File, "C"); + when Memory_Space => + Put (File, "Character'Pos"); + end case; Put (File, " (S (P (K) + F));"); New_Line (File); @@ -2490,20 +2494,21 @@ package body GNAT.Perfect_Hash_Generators is R : Natural; begin - if Opt = CPU_Time then - for J in 0 .. T1_Len - 1 loop - exit when Word (J + 1) = ASCII.NUL; - R := Get_Table (Table, J, Get_Used_Char (Word (J + 1))); - S := (S + R) mod NV; - end loop; + case Opt is + when CPU_Time => + for J in 0 .. T1_Len - 1 loop + exit when Word (J + 1) = ASCII.NUL; + R := Get_Table (Table, J, Get_Used_Char (Word (J + 1))); + S := (S + R) mod NV; + end loop; - else - for J in 0 .. T1_Len - 1 loop - exit when Word (J + 1) = ASCII.NUL; - R := Get_Table (Table, J, 0); - S := (S + R * Character'Pos (Word (J + 1))) mod NV; - end loop; - end if; + when Memory_Space => + for J in 0 .. T1_Len - 1 loop + exit when Word (J + 1) = ASCII.NUL; + R := Get_Table (Table, J, 0); + S := (S + R * Character'Pos (Word (J + 1))) mod NV; + end loop; + end case; return S; end Sum; |