This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Implement -fpreserve-control-flow in front end


This switch is primarily a back end switch to preserve control
flow for object level coverage analysis. This patch implements
the switch in the front end to deal with suppressing a couple
of cases where the front end would otherwise do improper
control flow optimizations.

The following test program:

function Cflow (X : Boolean) return Boolean is
begin
   if X then
      return True;
   else
      return False;
   end if;
end;

compiled with -gnatG -O2 -fpreserve-control-flow (with a back-end that
implements this switch) must generate:

Source recreated from tree for Cflow (body)
-------------------------------------------


function cflow (x : boolean) return boolean is
begin
   if x then
      return true;
   else
      return false;
   end if;
end cflow;

In the absence of this patch, the front end yielded:

function cflow (x : boolean) return boolean is
begin
   return x;
end cflow;

Tested on x86_64-pc-linux-gnu, committed on trunk

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.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]