0

I am performing an optimization in llvm that requires the InstNamer pass to be run before my optimization. Currently, I am running it by manually passing "-instnamer" to opt. Is there a way I can add InstNamer as a required pass in the code?

I tried doing AU.addRequired();

But that doesn't compile as it throws "undeclared identifier 'InstNamer'".

Is there a way I can do this?

Nitin Bhat
  • 11
  • 1

1 Answers1

0

If the pass is decleared in include/llvm, then you can use AU.addRequired<PassClassName>();, which is actually AU.addRequiredID(PassClassName::ID);

If the pass is declared and defined in lib/, then you have to use AU.addRequiredID(PassClassID);

In this case, you have to use:

#include "llvm/Transforms/Scalar.h"

AU.addRequiredID(InstructionNamerID);
hailinzeng
  • 966
  • 9
  • 24