[LLVMdev] Question on parameters in RegisterPass

Byungchan An lionheart8470 at gmail.com
Sun Aug 10 18:39:01 PDT 2014


Hello. This is Byungchan An.
I have a question on meaning of parameters in RegisterPass.

In the LLVM Pass examples, I see the followings.

static RegisterPass<Hello> X("hello", "Hello World Pass",
                             false /* Only looks at CFG */,
                             false /* Analysis Pass */);

Here I have one question, what means by only looking at CFG?
If I set it third parameters as "true" what limitations I have?

Second, the last parameter, Analysis Pass means it doesn't change IR given
as input. Am I right? Then, why the following example I got from the llvm
website set the last parameter as false?

Thanks.

#include "llvm/Pass.h"#include "llvm/IR/Function.h"#include
"llvm/Support/raw_ostream.h"
using namespace llvm;
namespace {
  struct Hello : public FunctionPass {
    static char ID;
    Hello() : FunctionPass(ID) {}

    virtual bool runOnFunction(Function &F) {
      errs() << "Hello: ";
      errs().write_escaped(F.getName()) << '\n';
      return false;
    }
  };}
char Hello::ID = 0;static RegisterPass<Hello> X("hello", "Hello World
Pass", false, false);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140810/9d6c0b10/attachment.html>


More information about the llvm-dev mailing list