Custom Made CFGs

hi,

I wish to create a CFG in which each node consists of a a block of sequential statements [as opposed to the one node per statement that Phoenix builds on its own]. Is it better to create it from scratch ?, or manipulate the CFG built by Phoenix by merging nodes etc. For e.g, a program which has a bunch of sequential statements, a loop, and then another bunch of sequential statements will have a CFG with 3 nodes, in addition to the start/end nodes.

Also, in the code sample for enumerating the aliases of a particular tag

Code Snippet

Alias::Info ^ info = func->AliasInfo;
Alias::Tag tag;

BitVector::Sparse::Position sbvPos;
Alias::Tag aliasTag;
for (aliasTag = info->GetFirstMayPartialAlias(tag, sbvPos);
aliasTag != safe_cast(Alias::Constants::InvalidTag);
aliasTag = info->GetNextMayPartialAlias(tag, sbvPos))
{
// Enumerating all the direct and indirect aliased locations
}

the first condition in the for loop gives me the following error :

Code Snippet

error C2664: 'Phx::Alias::Info::GetNextMayPartialAlias' : cannot convert parameter 2 from 'Phx::BitVector::Sparse::Position' to 'cli::interior_ptr'

1> with

1> [

1> Type=Phx::BitVector::Sparse::Position

1> ]

Any help will be much appreciated.

regards ...

[1899 byte] By [optControl] at [2008-2-15]
# 1

Phoenix's CFGs aren't a block per statement. It's a block per basic block. You do need to build this flow graph though with FunctionUnit.BuildFlowGraph(...). After you build the CFG you can walk the basic blocks and such.

Let me know if that's not what you were looking for.

Thanks,

KangSuGatlin at 2007-10-2 > top of Msdn Tech,Visual Studio,Phoenix...
# 2

Kang Su,

Thanks a lot for the input. Could you comment on the error in the second part of the post ?

regards

optControl at 2007-10-2 > top of Msdn Tech,Visual Studio,Phoenix...
# 3

Kang Su,

Thanks a lot for the input. Could you possible comment on the nature of the error I posted ?

regards ...

optControl at 2007-10-2 > top of Msdn Tech,Visual Studio,Phoenix...
# 4

Try putting a & before the sbv_pos argument, since it's passed by reference. Also make sure to get the right syntax for safe_cast.

Code Snippet

Alias::Info ^ info = func->AliasInfo;
Alias::Tag tag;

BitVector::Sparse::Position sbvPos;
Alias::Tag aliasTag;
for (aliasTag = info->GetFirstMayPartialAlias(tag, &sbvPos);
aliasTag != safe_cast<Alias::Tag>(Alias::Constants::InvalidTag);
aliasTag = info->GetNextMayPartialAlias(tag, &sbvPos))
{
// Enumerating all the direct and indirect aliased locations
}

AndyAyers-MSFT at 2007-10-2 > top of Msdn Tech,Visual Studio,Phoenix...
# 5
Thanks Andy, that was most helpful.
optControl at 2007-10-2 > top of Msdn Tech,Visual Studio,Phoenix...

Visual Studio

Site Classified