public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Data-flow informations (CFG)
@ 2011-10-25  3:55 Harry Trinta
  2011-10-25  5:25 ` Ian Lance Taylor
  0 siblings, 1 reply; 5+ messages in thread
From: Harry Trinta @ 2011-10-25  3:55 UTC (permalink / raw)
  To: gcc-help

Dear,

A program can be represented by a CFG (Control Flow Graph).
Within source file Profile.c, for example, is easy to navigate within
CFG and obtain certain information.
However, I would like some more specific information, for example,
what are the the declarations and what are the uses of variables
within a given node of the CFG.

Can I get this information somewhere in the building?

The goal is to calculate the viability of creating a "module" for
software testing based on the data flow.

Thanks,
Harry

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

* Re: Data-flow informations (CFG)
  2011-10-25  3:55 Data-flow informations (CFG) Harry Trinta
@ 2011-10-25  5:25 ` Ian Lance Taylor
  2011-10-25  6:20   ` Harry Trinta
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Lance Taylor @ 2011-10-25  5:25 UTC (permalink / raw)
  To: Harry Trinta; +Cc: gcc-help

Harry Trinta <harrytpc@gmail.com> writes:

> A program can be represented by a CFG (Control Flow Graph).
> Within source file Profile.c, for example, is easy to navigate within
> CFG and obtain certain information.
> However, I would like some more specific information, for example,
> what are the the declarations and what are the uses of variables
> within a given node of the CFG.
>
> Can I get this information somewhere in the building?
>
> The goal is to calculate the viability of creating a "module" for
> software testing based on the data flow.

The CFG doesn't have any declarations.  In effect all declarations are
moved to the outer-most block of a function, renamed as necessary.

You can indeed find the uses of variables within a block of the CFG, by
scanning the instructions in the block.

Ian

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

* Re: Data-flow informations (CFG)
  2011-10-25  5:25 ` Ian Lance Taylor
@ 2011-10-25  6:20   ` Harry Trinta
  2011-10-25  6:21     ` Harry Trinta
  0 siblings, 1 reply; 5+ messages in thread
From: Harry Trinta @ 2011-10-25  6:20 UTC (permalink / raw)
  To: gcc-help

> The CFG doesn't have any declarations.  In effect all declarations are
> moved to the outer-most block of a function, renamed as necessary.

Truth. The CFC of GCC does not have the statements. =(

I know that declarations is not in a block of the CFG in fact. But if
we analyze the code, a declaration always is a "part" of a block too.
So, there is no way to see in which block a declaration was made?

Thanks,
Harry

2011/10/25 Ian Lance Taylor <iant@google.com>:
> Harry Trinta <harrytpc@gmail.com> writes:
>
>> A program can be represented by a CFG (Control Flow Graph).
>> Within source file Profile.c, for example, is easy to navigate within
>> CFG and obtain certain information.
>> However, I would like some more specific information, for example,
>> what are the the declarations and what are the uses of variables
>> within a given node of the CFG.
>>
>> Can I get this information somewhere in the building?
>>
>> The goal is to calculate the viability of creating a "module" for
>> software testing based on the data flow.
>
> The CFG doesn't have any declarations.  In effect all declarations are
> moved to the outer-most block of a function, renamed as necessary.
>
> You can indeed find the uses of variables within a block of the CFG, by
> scanning the instructions in the block.
>
> Ian
>

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

* Re: Data-flow informations (CFG)
  2011-10-25  6:20   ` Harry Trinta
@ 2011-10-25  6:21     ` Harry Trinta
  2011-10-25 13:43       ` Ian Lance Taylor
  0 siblings, 1 reply; 5+ messages in thread
From: Harry Trinta @ 2011-10-25  6:21 UTC (permalink / raw)
  To: gcc-help

> The CFG doesn't have any declarations.  In effect all declarations are
> moved to the outer-most block of a function, renamed as necessary.

Truth. The CFC of GCC does not have the DECLARATIONS. =(

I know that declarations is not in a block of the CFG in fact. But if
we analyze the code, a declaration always is a "part" of a block too.
So, there is no way to see in which block a declaration was made?

Thanks,
Harry


> 2011/10/25 Ian Lance Taylor <iant@google.com>:
>> Harry Trinta <harrytpc@gmail.com> writes:
>>
>>> A program can be represented by a CFG (Control Flow Graph).
>>> Within source file Profile.c, for example, is easy to navigate within
>>> CFG and obtain certain information.
>>> However, I would like some more specific information, for example,
>>> what are the the declarations and what are the uses of variables
>>> within a given node of the CFG.
>>>
>>> Can I get this information somewhere in the building?
>>>
>>> The goal is to calculate the viability of creating a "module" for
>>> software testing based on the data flow.
>>
>> The CFG doesn't have any declarations.  In effect all declarations are
>> moved to the outer-most block of a function, renamed as necessary.
>>
>> You can indeed find the uses of variables within a block of the CFG, by
>> scanning the instructions in the block.
>>
>> Ian
>>
>

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

* Re: Data-flow informations (CFG)
  2011-10-25  6:21     ` Harry Trinta
@ 2011-10-25 13:43       ` Ian Lance Taylor
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Lance Taylor @ 2011-10-25 13:43 UTC (permalink / raw)
  To: Harry Trinta; +Cc: gcc-help

Harry Trinta <harrytpc@gmail.com> writes:

>> The CFG doesn't have any declarations.  In effect all declarations are
>> moved to the outer-most block of a function, renamed as necessary.
>
> Truth. The CFC of GCC does not have the DECLARATIONS. =(
>
> I know that declarations is not in a block of the CFG in fact. But if
> we analyze the code, a declaration always is a "part" of a block too.
> So, there is no way to see in which block a declaration was made?

Assuming we are talking about C or C++, then if you look at GENERIC
immediately after parsing, you can find the declarations by looking for
DECL_EXPR statements.  However, at that point there is no CFG, and the
DECL_EXPR statements are dropped when moving to GIMPLE.  So, no, gcc
does not have any representation of the program which includes both a
CFG and records which block contains a declaration.  At least as far as
I know.

Ian

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

end of thread, other threads:[~2011-10-25 13:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-25  3:55 Data-flow informations (CFG) Harry Trinta
2011-10-25  5:25 ` Ian Lance Taylor
2011-10-25  6:20   ` Harry Trinta
2011-10-25  6:21     ` Harry Trinta
2011-10-25 13:43       ` Ian Lance Taylor

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).