Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / gnat.dg / opt8.adb
blob72145fd6b795896932848f459e2fda53181de867
1 -- { dg-do compile }
2 -- { dg-options "-O2" }
4 with Opt8_Pkg;
6 package body Opt8 is
8 function Content_Value (Rec : Kappa_Component_Rec)
9 return Value_Number is
10 begin
11 return Opt8_Pkg.Id_To_VN (Rec.Content_VN);
12 end;
14 function Possible_Values_Count (V: Kappa_Component_Ptr) return Natural is
15 Result : Natural := 0;
16 List : Kappa_Component_Ptr := V;
17 begin
18 while List /= null loop
19 Result := Result +1;
20 List := List.Next;
21 end loop;
22 return Result;
23 end;
25 function VN_Complexity (Val : Value_Number; N : Natural)
26 return Natural is
27 Result : Natural := 0;
28 begin
29 case Val.Kind is
30 when Membership_VN =>
31 Result := VN_Complexity(Val, N);
32 when Selected_Address_VN =>
33 Result := VN_Complexity(Val, N) + 1;
34 when Kappa_VN =>
35 Result := Possible_Values_Count(Val.Possible_New_Values)*3;
36 if Val.Use_Default then
37 if Result < N then
38 Result := Result +
39 VN_Complexity(Content_Value (Val.old_Value), N);
40 end if;
41 end if;
42 when others =>
43 Result := 0;
44 end case;
45 return Result;
46 end;
48 end Opt8;