loops - LLVM: usage of getUniqueExitBlock() -


how use function loops::getuniqueexitblock() loopinfo.h in llvm pass?
i not understand, how call function particular loop.

the documentation getuniqueexitblock() states:

getuniqueexitblock - if getuniqueexitblocks return 1 block, return block.

otherwise return null.

this tells getuniqueexitblock() convenience method check see if loop has 1 exit block. if does, return - otherwise return null.

assuming have way loop objects, can use function doing like

auto loop = get_loop() // have write part auto exit = loop->getuniqueexitblock() // calls function if(exit != nullptr) {     // exit points block loop jumps when exits } else {     // exit null - means loop either has more 1 exit block or no exit blocks. deal case } 

documentation of llvm api can found here. api isn't documented well, case new attribute api. in case, it's useful through code examples of function being used within llvm codebase itself. example, documentation getuniqueexitblock() tells it's referenced internally llvm::unrollruntimeloopprolog(). example can understand how use getuniqueexitblock().


Comments