[LLVMdev] Function Pass Manager

Ralf Karrenberg Chareos at gmx.de
Tue Jun 5 08:39:13 PDT 2012


Hi John,

On 6/5/12 4:31 PM, John Criswell wrote:
> On 4/12/12 3:32 AM, Ivan Llopard wrote:
>> Hi again,
>>
>> I come back to this issue with an example. It's a pass which does
>> nothing but throw the 'Unable to schedule' error.
>>
>> namespace {
>>      struct MyPass : public FunctionPass {
>>        static char ID; // Pass identification, replacement for typeid
>>        MyPass() : FunctionPass(ID) {
>>          initializeMyPassPass(*PassRegistry::getPassRegistry());
>>        }
>>        virtual void getAnalysisUsage(AnalysisUsage&AU) const {
>>          AU.addRequiredID(LoopSimplifyID);
>>          AU.addPreservedID(LoopSimplifyID);
>>        }
>>        virtual bool runOnFunction(Function&F);
>>      };
>> }
>
> Is LoopSimplifyID an analysis pass or a transform (optimization) pass?

It is a transform pass (it can alter the CFG).

> You cannot reliably use the addRequired() method to force a transform
> pass to run before another pass; there are cases in which the
> PassManager cannot schedule the required passes.  You must simply ensure
> that LoopSimplify is executed before your pass.

I am afraid I do not understand this. What is the purpose of 
addRequired() if not ensuring that the pass is run before execution of 
my own pass?

I would be perfectly happy with *any* solution that allows me to ensure 
that LoopSimplify is executed before my FunctionPass.

Thanks,
Ralf



More information about the llvm-dev mailing list