public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* CFG not taken care
@ 2003-12-10 10:36 Vimal Kumar
  2003-12-10 11:48 ` Jan Hubicka
  0 siblings, 1 reply; 3+ messages in thread
From: Vimal Kumar @ 2003-12-10 10:36 UTC (permalink / raw)
  To: gcc

Hi,

 I was just going through the GCC code when I happen
to notice something strange. It may not be bug, but
I'm confused.

  Defined in rtlanal.c, the function reg_set_between_p
returns true if a register is set between two insns;
all three things passed in its arguments. To my
surprise, there was just a loop like:

 for (insn = (NEXT_INSN (from_insn); insn != to_insn;
insn = NEXT_INSN (insn))
  {
    ........
  }

 It is called by many passes; but the important point
is that its traversal is linear. The CFG is not taken
care of. For example, consider the scenario:

.L1
from_insn;
bra .L2         (unconditional jump)

.L3
......
to_insn;

.L2
.....
/* set the reg here */
bra .L2

  Certainly, these cases cannot be caught by
reg_set_between_p. There is a whole set of such
functions like reg_referenced_between_p, etc. Is there
any other set of functions covering CFG??

  I may be missing some important observation. Sorry
for my ignorance!!

Thanks and Regards,


=====


__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: CFG not taken care
  2003-12-10 10:36 CFG not taken care Vimal Kumar
@ 2003-12-10 11:48 ` Jan Hubicka
  2003-12-10 12:28   ` Theodore Papadopoulo
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Hubicka @ 2003-12-10 11:48 UTC (permalink / raw)
  To: Vimal Kumar; +Cc: gcc

> Hi,
> 
>  I was just going through the GCC code when I happen
> to notice something strange. It may not be bug, but
> I'm confused.
> 
>   Defined in rtlanal.c, the function reg_set_between_p
> returns true if a register is set between two insns;
> all three things passed in its arguments. To my
> surprise, there was just a loop like:
> 
>  for (insn = (NEXT_INSN (from_insn); insn != to_insn;
> insn = NEXT_INSN (insn))
>   {
>     ........
>   }
> 
>  It is called by many passes; but the important point
> is that its traversal is linear. The CFG is not taken
> care of. For example, consider the scenario:
> 
> .L1
> from_insn;
> bra .L2         (unconditional jump)
> 
> .L3
> ......
> to_insn;
> 
> .L2
> .....
> /* set the reg here */
> bra .L2
> 
>   Certainly, these cases cannot be caught by
> reg_set_between_p. There is a whole set of such
> functions like reg_referenced_between_p, etc. Is there
> any other set of functions covering CFG??
> 
>   I may be missing some important observation. Sorry
> for my ignorance!!

These functions are supposed to be used only locally inside superblock
where this don't matter.  We do similar local analysis at many places in
GCC still :(

Honza
> 
> Thanks and Regards,
> 
> 
> =====
> 
> 
> __________________________________
> Do you Yahoo!?
> New Yahoo! Photos - easier uploading and sharing.
> http://photos.yahoo.com/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: CFG not taken care
  2003-12-10 11:48 ` Jan Hubicka
@ 2003-12-10 12:28   ` Theodore Papadopoulo
  0 siblings, 0 replies; 3+ messages in thread
From: Theodore Papadopoulo @ 2003-12-10 12:28 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc, Vimal Kumar


hubicka@ucw.cz said:
> These functions are supposed to be used only locally inside superblock
> where this don't matter.  We do similar local analysis at many places
> in GCC still :( 

Can we deduce of this sentence (and the question) that the name of the 
function and/or the comment should be updated to explicitly give this 
information ??

--------------------------------------------------------------------
Theodore Papadopoulo
Email: Theodore.Papadopoulo@sophia.inria.fr Tel: (33) 04 92 38 76 01
 --------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-12-10 11:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-10 10:36 CFG not taken care Vimal Kumar
2003-12-10 11:48 ` Jan Hubicka
2003-12-10 12:28   ` Theodore Papadopoulo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).