Don't inline if would lose /u on BLKmode target
Richard Kenner
kenner@vlsi1.ultra.nyu.edu
Mon Apr 14 21:33:00 GMT 2003
We can't do RTL inlining if we'd lose RTX_UNCHANGING_P on the target, which
will happen if it's set and we're passing the address of the RTL.
Tested on i686-pc-linux-gnu.
An Ada test case is:
with Ada.Text_Io;
package body Identifiers is
function Get_Identifier (
Class : in Class_Type;
Data : in Data_Type;
Tag : in Natural) return Identifier_Type is
begin
return (
Class_Field => Class,
Data_Field => Data,
Tag_Field => Tag);
end Get_Identifier;
function Identifier_Image (Identifier : in Identifier_Type) return String is
begin
Ada.Text_Io.Put_Line ("within Identifiers.Identifier_Image.");
Ada.Text_Io.Put_Line (
"class_field = " & Integer'Image (Class_Type'Pos (Identifier.Class_Field)));
Ada.Text_Io.Put_Line (
"Data_field = " & Integer'Image (Data_Type'Pos (Identifier.Data_Field)));
Ada.Text_Io.Put_Line (
"Tag_field = " & Natural'Image (Identifier.Tag_Field));
return "(" & Class_Type'Image (Identifier.Class_Field) & ", " &
Data_Type'Image (Identifier.Data_Field) & "," &
Natural'Image (Identifier.Tag_Field) & ")";
end Identifier_Image;
end Identifiers;
package Identifiers is
type Class_Type is ( Universal, Application, Context_Specific, Privat );
type Data_Type is ( Primitive, Constructed );
type Identifier_Type is private;
function Get_Identifier (
Class : in Class_Type;
Data : in Data_Type;
Tag : in Natural) return Identifier_Type;
pragma Inline (Get_Identifier);
function Identifier_Image (Identifier : in Identifier_Type) return String;
private
type Identifier_Type is
record
Class_Field : Class_Type;
Data_Field : Data_Type;
Tag_Field : Natural;
end record;
end Identifiers;
with Ada.Exceptions;
with Identifiers;
pragma Elaborate_All (Ada.Exceptions);
pragma Elaborate_All (Identifiers);
with Ada.Text_IO;
package body Requests is
type Request_Identifier_Table is array (Request_Kind) of
Identifiers.Identifier_Type;
Request_Identifiers : constant Request_Identifier_Table := (
Request_1 => Identifiers.Get_Identifier (
Class => Identifiers.Application,
Data => Identifiers.Primitive,
Tag => 9));
function Request_Identifier (Kind : Request_Kind)
return Identifiers.Identifier_Type is
begin
return Request_Identifiers (Kind);
end Request_Identifier;
procedure Send_Request (Request_Type : in Request_Kind) is
begin
Ada.Text_Io.Put_Line (
Identifiers.Identifier_Image (Request_Identifier (Request_Type)));
exception
when Exception_Raised : others =>
Ada.Text_Io.Put_Line (
Ada.Exceptions.Exception_Information (Exception_Raised));
end Send_Request;
end Requests;
package Requests is
type Request_Kind is (Request_1);
procedure Send_Request (Request_Type : in Request_Kind);
end Requests;
with Requests;
pragma Elaborate_All (Requests);
procedure Test_Request is
begin
Requests.Send_Request (Requests.Request_1);
end Test_Request;
2003-04-14 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* integrate.c (expand_inline_function): Don't inline if would
lose /u on a BLKmode TARGET.
*** gcc/integrate.c 2 Mar 2003 21:18:14 -0000 1.215
--- gcc/integrate.c 11 Apr 2003 20:17:16 -0000
*************** expand_inline_function (fndecl, parms, t
*** 737,740 ****
--- 737,748 ----
}
+ /* If there is a TARGET which is a readonly BLKmode MEM and DECL_RESULT
+ is also a mem, we are going to lose the readonly on the stores, so don't
+ inline. */
+ if (target != 0 && GET_CODE (target) == MEM && GET_MODE (target) == BLKmode
+ && RTX_UNCHANGING_P (target) && DECL_RTL_SET_P (DECL_RESULT (fndecl))
+ && GET_CODE (DECL_RTL (DECL_RESULT (fndecl))) == MEM)
+ return (rtx) (size_t) -1;
+
/* Extra arguments are valid, but will be ignored below, so we must
evaluate them here for side-effects. */
More information about the Gcc-patches
mailing list