This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: Reduce memory usage and compile time necessary for pruning
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Daniel Berlin <dberlin at dberlin dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 12 Mar 2006 21:19:44 +0100
- Subject: Re: [PATCH]: Reduce memory usage and compile time necessary for pruning
- References: <1140412891.17649.43.camel@linux.site> <200603041841.12151.ebotcazou@adacore.com> <1141964789.16883.18.camel@linux.site>
> Try the attached, and let me know if it fixes your problem.
Thanks. Unfortunately it doesn't, the SMT is call-clobbered. :-(
# A.3_310 = V_MAY_DEF <A.3_305>;
# HEAP.18_311 = V_MAY_DEF <HEAP.18_306>;
# SMT.22_312 = V_MAY_DEF <SMT.22_307>;
# SMT.23_313 = V_MAY_DEF <SMT.23_308>;
# SMT.24_314 = V_MAY_DEF <SMT.24_309>;
D.739_214->ARRAY[1] = q__node_to_element_new (arg_node_7) [return slot
optimization];
Variable: SMT.24, UID 919, struct ALLOC, is addressable, is global, call
clobbered, may aliases: { A.3 }
Variable: D.739, UID 739, struct ALLOC *, symbol memory tag: SMT.24
I've attached a reduced testcase, just compile with 'gcc -O2 p.adb' on x86 but
you will need to build the Ada compiler. :-)
--
Eric Botcazou
with q; use q;
package body p is
function foo (Arg_Kind : Element_Kinds) return Element_List
is
Arg_Node : Node_Id := Node (Arg_Kind);
begin
case Arg_Kind is
when A =>
return Element_List'(Node_To_Element_New (Arg_Node), Node_To_Element_New (Arg_Node));
when B =>
return Element_List'(Node_To_Element_New (Arg_Node), Node_To_Element_New (Arg_Node));
when others =>
declare
Path_List_Length : Integer := List_Length (Select_Alternatives (Arg_Node));
Path_List : Element_List (1 .. Path_List_Length);
begin
Path_List (1 .. Path_List_Length) := N_To_E_List_New (Select_Alternatives (Arg_Node));
return Path_List;
end;
end case;
end;
end p;
with q; use q;
package p is
function foo (Arg_Kind : Element_Kinds) return Element_List;
end p;
package q is
type Node_Id is new Natural;
type List_Id is new Natural;
type Element is record
Node_1 : Node_Id := 255;
Node_2 : Node_Id;
Node_3 : Node_Id;
end record;
type Element_List is array (Natural range <>) of Element;
type Element_Kinds is (A, B, C);
function Int_Kind return Element_Kinds;
function Node (Arg : Element_Kinds) return Node_Id;
function Select_Alternatives (Arg : Node_Id) return List_Id;
function List_Length (Arg : List_Id) return Integer;
function N_To_E_List_New (Arg1 : List_Id) return Element_List;
function Node_To_Element_New (Node : Node_Id) return Element;
end q;