<div dir="ltr"><div><div>Hi,<br><br></div><div> 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<br>
</div><div><br> Region *TLR = RI->getTopLevelRegion();<br></div> Region::element_iterator EI = TLR->element_begin();<br> Region::element_iterator EE = TLR->element_end();<br> <br> for (; I != E; ++I) {<br>
errs() << **I << " , ";<br> }<br><br></div> I got the following errors, and would like to ask for some suggestions:<br><br>In file included from /home/pvario/LLVM/llvm-3.3.src/include/llvm/Analysis/LoopInfo.h:35:0,<br>
from structure_formation.h:8,<br> from structure_formation.cpp:20:<br>/home/pvario/LLVM/llvm-3.3.src/include/llvm/ADT/GraphTraits.h: In instantiation of ‘llvm::GraphTraits<llvm::RegionNode*>’:<br>
/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*> >’<br>
structure_formation.cpp:64:30: instantiated from here<br>/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<br>In file included from /home/pvario/LLVM/llvm-3.3.src/include/llvm/Analysis/Dominators.h:19:0,<br>
from /home/pvario/LLVM/llvm-3.3.src/include/llvm/Analysis/LoopInfo.h:37,<br> from structure_formation.h:8,<br> from structure_formation.cpp:20:<br>/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*> >’:<br>
structure_formation.cpp:64:30: instantiated from here<br>/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*>’<br>
make: *** [structure_formation.o] Error 1<br><br><br><br></div>