Re: [DynInst_API:] getLoopHead interface in BPatch_basicBlockLoop class


Date: Tue, 28 Jul 2015 10:37:28 -0500
From: Xiaozhu Meng <xmeng@xxxxxxxxxxx>
Subject: Re: [DynInst_API:] getLoopHead interface in BPatch_basicBlockLoop class
Hi Jim,

The old getLoopHead() method has been replaced by the following new
interface to appropriately represent irreducible loops:

int BPatch_basicBlockLoop::getLoopEntries(BPatch_Vector<BPatch_basicBlock*> &e);

The new interface returns the number of entry blocks of this loop and
the entries blocks are returned as the output parameter.

On Tue, Jul 28, 2015 at 8:42 AM, Jim Galarowicz <jeg@xxxxxxxxxxxxx> wrote:
> Hi all,
>
> I've downloaded the git source version of dyninst and built it on NASA's pfe
> machine and my laptop in an attempt to run it on Intel MIC binaries.  The
> 8.2.1 asserts in switches related to the architecture type.
>
> However, I ran into a compile error with our loop code:
>
> [ 16%] Building CXX object
> libopenss-framework/CMakeFiles/openss-framework-symtabapi.dir/DyninstSymbols.cxx.o
> cd /u/jgalarow/OpenSpeedShop/build_mic_offline_fe/libopenss-framework &&
> /nasa/pkgsrc/2014Q3/gcc49/bin/g++   -DHAVE_DYNINST -DHAVE_STDINT_H=1
> -DHAVE_SYS_STAT_H=1 -DOPENSS_USE_SYMTABAPI=1
> -DOpenSpeedShop_LIBRARY_FILE_DIR=\"/nobackupp8/jgalarow/maia/pfe_ossoffline/lib64\"
> -DPACKAGE=1 -DPACKAGE_VERSION=1 -DVERSION=\"2.1\" -D_GNU_SOURCE
> -Dopenss_framework_symtabapi_EXPORTS -g -fPIC
> -I/u/jgalarow/OpenSpeedShop/libopenss-framework
> -I/u/jgalarow/OpenSpeedShop/build_mic_offline_fe/libopenss-framework
> -I/u/jgalarow/OpenSpeedShop/build_mic_offline_fe/libopenss-framework/offline
> -I/nasa/boost/1.50.0/include
> -I/nobackup/jgalarow/dyninst-9.0.0/include/dyninst
> -I/nobackup/jgalarow/dyninst-9.0.0/include
> -I/u/jgalarow/krellroot_v2.1u8/include
> -I/u/jgalarow/OpenSpeedShop/build_mic_offline_fe/libopenss-framework/../libopenss-framework
> -o CMakeFiles/openss-framework-symtabapi.dir/DyninstSymbols.cxx.o -c
> /u/jgalarow/OpenSpeedShop/libopenss-framework/DyninstSymbols.cxx
> /u/jgalarow/OpenSpeedShop/libopenss-framework/DyninstSymbols.cxx: In
> function 'std::vector<LoopInfo> getLoopsAt(const
> OpenSpeedShop::Framework::Address&, BPatch_image&)':
> /u/jgalarow/OpenSpeedShop/libopenss-framework/DyninstSymbols.cxx:140:49:
> error: 'class BPatch_basicBlockLoop' has no member named 'getLoopHead'
>                  BPatch_basicBlock* head = loop->getLoopHead();
>                                                  ^
> make[2]: ***
> [libopenss-framework/CMakeFiles/openss-framework-symtabapi.dir/DyninstSymbols.cxx.o]
> Error 1
> make[2]: Leaving directory
> `/home4/jgalarow/OpenSpeedShop/build_mic_offline_fe'
> make[1]: ***
> [libopenss-framework/CMakeFiles/openss-framework-symtabapi.dir/all] Error 2
> make[1]: Leaving directory
> `/home4/jgalarow/OpenSpeedShop/build_mic_offline_fe'
>
> I found this in my emails about dyninst:
>
> Hi,
>
> We are planing to improve our current loop detection algorithm to be able to
> handle irreducible loops. Such loops can have multiple entry blocks. For
> this matter, the original interface to get the loop head needs to be changed
> to return a vector of heads of a loop.
>
> The involved interface is:
>
> BPatch_basicBlock*  BPatch_basicBlockLoop::getLoopHead();
>
> We plan to change it to:
>
> bool BPatch_basicBlockLoop::getLoopHead(std::vector<BPatch_basicBlock*>&
> entries);
>
> Let us know if you are using the interface and if the interface change will
> cause significant inconvenience to you.
>
> Thanks
>
> --Xiaozhu
>
>
> However, I can't find any examples of the new getLoopHead code in the latest
> Dyninst source.   Can someone point me to it?
>
>
> pfe21-101>pwd
> /nobackupp8/jgalarow/OpenSpeedShop_ROOT/BUILD/pfe20/dyninst-9.0.0
>
> pfe21-94>grep basicBlockLoop::getLoopHead *
> pfe21-95>!!/*
> grep basicBlockLoop::getLoopHead */*
> pfe21-96>!!/*
> grep basicBlockLoop::getLoopHead */*/*
> pfe21-97>!!/*
> grep basicBlockLoop::getLoopHead */*/*/*
> pfe21-98>!!/*
> grep basicBlockLoop::getLoopHead */*/*/*/*
> pfe21-99>!!/*
> grep basicBlockLoop::getLoopHead */*/*/*/*/*
> pfe21-100>!!/*
> grep basicBlockLoop::getLoopHead */*/*/*/*/*/*
> pfe21-101>pwd
> /nobackupp8/jgalarow/OpenSpeedShop_ROOT/BUILD/pfe20/dyninst-9.0.0
>
> pfe21-104>grep getLoopHead *
> pfe21-105>!!/*
> grep getLoopHead */*
> pfe21-106>!!/*
> grep getLoopHead */*/*
> !!/*
>
> LOOKS LIKE THE OLD INTERFACE:
>
> dyninstAPI/src/hybridOverwrites.C://
> (*lIter)->getLoopHead()->getStartAddress(),
> dyninstAPI/src/hybridOverwrites.C://
> writeLoop->getLoopHead()->getStartAddress(),
> pfe21-107>!!/*
> grep getLoopHead */*/*/*
> pfe21-108>!!/*
> grep getLoopHead */*/*/*/*
> pfe21-109>!!/*
> grep getLoopHead */*/*/*/*/*
> pfe21-110>
>
>
> I need to change this to work with the new API:
> cat -n /u/jgalarow/OpenSpeedShop/libopenss-framework/DyninstSymbols.cxx
> ...
> ...
>
>   122                BPatch_Vector<BPatch_basicBlockLoop*> loops;
>    123                cfg->getLoops(loops);
>    124
>    125                for (unsigned int l = 0; l < loops.size(); ++l)
>    126                {
>    127                    BPatch_basicBlockLoop* loop = loops[l];
>    128
>    129                    if ((loop == NULL) ||
> !loop->containsAddressInclusive(
>    130                            (module_base + address).getValue()
>    131                            ))
>    132                    {
>    133                        continue;
>    134                    }
>    135
>    136                    // A loop containing this address has been found!
> Rejoice!
>    137                    // And, of course, obtain the loop's head address
> and basic
>    138                    // block address ranges...
>    139
>    140                    BPatch_basicBlock* head = loop->getLoopHead();
>    141
>    142                    if (head == NULL)
>    143                    {
>    144                        continue;
>    145                    }
>    146
>    147                    LoopInfo info(Address(head->getStartAddress()) -
> module_base);
>    148
>    149                    BPatch_Vector<BPatch_basicBlock*> blocks;
>    150                    loop->getLoopBasicBlocks(blocks);
>    151
>    152                    for (unsigned int i = 0; i < blocks.size(); ++i)
>    153                    {
> ...
> ...
>
>
> Thanks,
> Jim G
>
>
> On 09/23/2014 04:57 PM, Xiaozhu Meng wrote:
>
> Hi,
>
> We are planing to improve our current loop detection algorithm to be able to
> handle irreducible loops. Such loops can have multiple entry blocks. For
> this matter, the original interface to get the loop head needs to be changed
> to return a vector of heads of a loop.
>
> The involved interface is:
>
> BPatch_basicBlock*  BPatch_basicBlockLoop::getLoopHead();
>
> We plan to change it to:
>
> bool BPatch_basicBlockLoop::getLoopHead(std::vector<BPatch_basicBlock*>&
> entries);
>
> Let us know if you are using the interface and if the interface change will
> cause significant inconvenience to you.
>
> Thanks
>
> --Xiaozhu
>
>
> _______________________________________________
> Dyninst-api mailing list
> Dyninst-api@xxxxxxxxxxx
> https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api
>
>
[← Prev in Thread] Current Thread [Next in Thread→]