Commit 9549767b by Arnaud Charlet

[multiple changes]

2009-04-20  Eric Botcazou  <ebotcazou@adacore.com>

	* adaint.h (__gnat_lwp_self): Declare on Linux.

	* adaint.c (__gnat_os_filename): Add ATTRIBUTE_UNUSED on 'filename'.

2009-04-20  Robert Dewar  <dewar@adacore.com>

	* exp_ch5.adb, usage.adb, back_end.adb, opt.ads: Implement
	front-end part of -fpreserve-control-flow switch.

From-SVN: r146376
parent d7f94401
2009-04-20 Eric Botcazou <ebotcazou@adacore.com>
* adaint.h (__gnat_lwp_self): Declare on Linux.
* adaint.c (__gnat_os_filename): Add ATTRIBUTE_UNUSED on 'filename'.
2009-04-20 Robert Dewar <dewar@adacore.com>
* exp_ch5.adb, usage.adb, back_end.adb, opt.ads: Implement
front-end part of -fpreserve-control-flow switch.
2009-04-20 Bob Duff <duff@adacore.com>
* rtsfind.adb: Minor comment fix
......@@ -666,7 +666,8 @@ __gnat_get_debuggable_suffix_ptr (int *len, const char **value)
/* Returns the OS filename and corresponding encoding. */
void
__gnat_os_filename (char *filename, char *w_filename ATTRIBUTE_UNUSED,
__gnat_os_filename (char *filename ATTRIBUTE_UNUSED,
char *w_filename ATTRIBUTE_UNUSED,
char *os_name, int *o_length,
char *encoding ATTRIBUTE_UNUSED, int *e_length)
{
......@@ -3512,7 +3513,8 @@ __gnat_pthread_setaffinity_np (pthread_t th ATTRIBUTE_UNUSED,
thread. We need to do a system call in order to retrieve this
information. */
#include <sys/syscall.h>
void *__gnat_lwp_self (void) {
void *__gnat_lwp_self (void)
{
return (void *) syscall (__NR_gettid);
}
#endif
......@@ -176,6 +176,9 @@ extern int __gnat_dup2 (int, int);
extern void __gnat_os_filename (char *, char *, char *,
int *, char *, int *);
#if defined (linux)
extern void *__gnat_lwp_self (void);
#endif
#if defined (__MINGW32__) && !defined (RTX)
extern void __gnat_plist_init (void);
......
......@@ -219,6 +219,13 @@ package body Back_End is
if Switch_Chars (First .. Last) = "fno-inline" then
Opt.Suppress_All_Inlining := True;
-- Another special check, the switch -fpreserve-control-flow
-- which is also a back end switch sets the front end flag
-- that inhibits improper control flow transformations.
elsif Switch_Chars (First .. Last) = "fpreserve-control-flow" then
Opt.Suppress_Control_Flow_Optimizations := True;
end if;
end if;
end Scan_Back_End_Switches;
......
......@@ -3272,9 +3272,12 @@ package body Exp_Ch5 is
-- return not (expression);
-- Only do these optimizations if we are at least at -O1 level
-- Only do these optimizations if we are at least at -O1 level and
-- do not do them if control flow optimizations are suppressed.
if Optimization_Level > 0 then
if Optimization_Level > 0
and then not Opt.Suppress_Control_Flow_Optimizations
then
if Nkind (N) = N_If_Statement
and then No (Elsif_Parts (N))
and then Present (Else_Statements (N))
......
......@@ -1061,6 +1061,11 @@ package Opt is
-- Set by -fno-inline. Suppresses all inlining, both front end and back end
-- regardless of any other switches that are set.
Suppress_Control_Flow_Optimizations : Boolean := False;
-- GNAT
-- Set by -fpreserve-control-flow. Suppresses control flow optimizations
-- that interfere with coverage analysis based on the object code.
System_Extend_Pragma_Arg : Node_Id := Empty;
-- GNAT
-- Set non-empty if and only if a correct Extend_System pragma was present
......
......@@ -99,6 +99,9 @@ begin
Write_Switch_Char ("fno-inline ", "");
Write_Line ("Inhibit all inlining (makes executable smaller)");
Write_Switch_Char ("fpreserve-control-flow ", "");
Write_Line ("Preserve control flow for coverage analysis");
end if;
-- Common switches available to both GCC and JGNAT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment