This is the mail archive of the gcc@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]

status of current_pass (notably in gates) .... [possible bug in 4.9]


Hello All,


I am a bit confused (or unhappy) about the current_pass variable 
(in GCC 4.9 svn rev.208447); I believe we have some incoherency about it.

It is generally (as it used to be in previous versions of GCC) 
a global pointer to some opt_pass, declared in gcc/tree-pass.h line 590.

It is also (and independently), a local integer in function 
connect_traces file gcc/bb-reorder.c line 1042. I feel that 
for readability reasons the local current_pass should be renamed 
current_pass_num in the function connect_traces.

But most importantly, I find confusing the way current_pass pointer is 
globally set (and reset). The obvious policy seems to set current_pass to 
"this" before calling any virtual methods on it (notably the gate and 
the exec functions).

However, if one use -fdump-passes program argument to gcc (i.e. to cc1), then
dump_passes (from gcc/passes.c line 892) gets called. It then calls function 
dump_one_pass (from gcc/passes.c line 851) which does line 857

  is_on = pass->has_gate ? pass->gate () : true;

But in other occasions, notably in function execute_one_pass 
(starting at gcc/passes.c line 2153) the global current_pass is 
set (line 2166) before calling its gate function line 2170

  gate_status = pass->has_gate ? pass->gate () : true;

I believe something should be done about this, since it seems to confuse 
plugins (like MELT). Either we decide that current_pass is always set 
before calling any virtual function on it (notably the gate) or we 
decide that current_pass global should disappear (but then, what 
about the curr_statistics_hash function from gcc/statistics.c line 93 
which uses it line 98)?


Comments are welcome. I think we should do something about this before 
releasing GCC 4.9...

The simplest thing would be to set current_pass in dump_one_pass....

Regards.
-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***


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