Fake Exit node

Is there a facility with which we may automagically create a "fake" exit
node, one that is the target of all BasicBlocks ending in return. This
would be very helpful to IP dataflow analysis...

Dave

There is a pass "UnifyFunctionExitNodes()" (you can add it to AnalysisUsage
of your pass) that does the trick.

-anand

There is a pass "UnifyFunctionExitNodes()" (you can add it to AnalysisUsage
of your pass) that does the trick.

Yup, just like Anand says, this pass will make it so that there is at most
one exit node from the function, which you can use for your analysis (it
will even tell you which BB that is too). Note that a function may _not_
have an exit node (if it contains an infinite loop, for example), so be
aware of that, but otherwise it should work for you with no problem.

-Chris

From: "David Crowe" <dcrowe@tremor.crhc.uiuc.edu>
To: <llvmdev@cs.uiuc.edu>
Sent: Friday, November 29, 2002 4:58 PM
Subject: [LLVMdev] Fake Exit node

> Is there a facility with which we may automagically create a "fake" exit
> node, one that is the target of all BasicBlocks ending in return. This
> would be very helpful to IP dataflow analysis...
>
> Dave
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
>

_______________________________________________
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev

-Chris

How do I get this pass to work within my own ModulePass?
I get this error:

Running getAnalysisUsage()
Assertion failed: 0 && "Pass available but not found! " "Perhaps this is a
module pass requiring a function pass?", file PassManagerT.h, line 395
Abort

Thanks,
Dave

This is probably because you are trying to "require" a FunctionPass from a
ModulePass, which is not currently implemented. Unfortunately there is no
good way to work around this, and it probably won't be fixed before the
end of the semester. Because of this, I think it's reasonable to point
out in your documentation that you require the pass to be run before your
pass, and in your code, add an assertion that fires if there is more than
one exit node.

Sorry about this. :frowning:

-Chris