[LLVMdev] Trouble with using Region::element_iterator();

Paul Vario paul.paul.mit at gmail.com
Wed Jan 29 16:42:17 PST 2014


Hi,

   I wrote a FunctionPass that addRequired<RegionInfo>, and inside my
runOnFunction(F). The pass was able to print out the region tree via
RegionInfo's builtin print function. However, when I try iterating over
subregions/basicblocks myself, like this

         Region *TLR = RI->getTopLevelRegion();
         Region::element_iterator EI = TLR->element_begin();
         Region::element_iterator EE = TLR->element_end();

         for (; I != E; ++I) {
           errs() << **I << " , ";
          }

    I got the following errors, and would like to ask for some suggestions:

In file included from
/home/pvario/LLVM/llvm-3.3.src/include/llvm/Analysis/LoopInfo.h:35:0,
                 from structure_formation.h:8,
                 from structure_formation.cpp:20:
/home/pvario/LLVM/llvm-3.3.src/include/llvm/ADT/GraphTraits.h: In
instantiation of 'llvm::GraphTraits<llvm::RegionNode*>':
/home/pvario/LLVM/llvm-3.3.src/include/llvm/ADT/DepthFirstIterator.h:65:7:
instantiated from 'llvm::df_iterator<llvm::RegionNode*,
llvm::SmallPtrSet<llvm::RegionNode*, 8u>, false,
llvm::GraphTraits<llvm::RegionNode*> >'
structure_formation.cpp:64:30:   instantiated from here
/home/pvario/LLVM/llvm-3.3.src/include/llvm/ADT/GraphTraits.h:60:53: error:
'llvm::RegionNode*' is not a class, struct, or union type
In file included from
/home/pvario/LLVM/llvm-3.3.src/include/llvm/Analysis/Dominators.h:19:0,
                 from
/home/pvario/LLVM/llvm-3.3.src/include/llvm/Analysis/LoopInfo.h:37,
                 from structure_formation.h:8,
                 from structure_formation.cpp:20:
/home/pvario/LLVM/llvm-3.3.src/include/llvm/ADT/DepthFirstIterator.h: In
instantiation of 'llvm::df_iterator<llvm::RegionNode*,
llvm::SmallPtrSet<llvm::RegionNode*, 8u>, false,
llvm::GraphTraits<llvm::RegionNode*> >':
structure_formation.cpp:64:30:   instantiated from here
/home/pvario/LLVM/llvm-3.3.src/include/llvm/ADT/DepthFirstIterator.h:72:42:
error: no type named 'ChildIteratorType' in 'struct
llvm::GraphTraits<llvm::RegionNode*>'
make: *** [structure_formation.o] Error 1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140129/76b30e4f/attachment.html>


More information about the llvm-dev mailing list