2 -- { dg-options "-fdump-ipa-strub" }
3 -- { dg-require-effective-target strub }
5 -- Check that at-calls dispatching calls are transformed.
7 procedure Strub_Disp1
is
9 type A
is tagged null record;
11 procedure P
(I
: Integer; X
: A
);
12 pragma Machine_Attribute
(P
, "strub", "at-calls");
14 function F
(X
: access A
) return Integer;
15 pragma Machine_Attribute
(F
, "strub", "at-calls");
17 type B
is new A
with null record;
20 procedure P
(I
: Integer; X
: B
);
21 pragma Machine_Attribute
(P
, "strub", "at-calls");
24 function F
(X
: access B
) return Integer;
25 pragma Machine_Attribute
(F
, "strub", "at-calls");
30 procedure P
(I
: Integer; X
: A
) is
35 function F
(X
: access A
) return Integer is (0);
38 procedure P
(I
: Integer; X
: B
) is
40 P
(I
, A
(X
)); -- strub-at-calls non-dispatching call
44 function F
(X
: access B
) return Integer is (1);
49 procedure Q
(X
: A
'Class) is
51 P
(-1, X
); -- strub-at-calls dispatching call.
62 I
:= I
+ F
(XA
'Access); -- strub-at-calls non-dispatching call
63 I
:= I
+ F
(XB
'Access); -- strub-at-calls non-dispatching call
66 I
:= I
+ F
(XC
); -- strub-at-calls dispatching call.
69 I
:= I
+ F
(XC
); -- strub-at-calls dispatching call.
72 -- { dg-final { scan-ipa-dump-times "\[(\]strub \[(\]at-calls\[)\]\[)\]" 4 "strub" } }
74 -- Count the strub-at-calls non-dispatching calls
75 -- (+ 2 each, for the matching prototypes)
76 -- { dg-final { scan-ipa-dump-times "foo\.p \[(\]\[^\n\]*watermark" 3 "strub" } }
77 -- { dg-final { scan-ipa-dump-times "foo\.f \[(\]\[^\n\]*watermark" 4 "strub" } }
79 -- Count the strub-at-calls dispatching calls.
80 -- { dg-final { scan-ipa-dump-times "_\[0-9\]* \[(\]\[^\n\]*watermark" 3 "strub" } }