forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
analyzer.cpp
32 lines (26 loc) · 823 Bytes
/
analyzer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IRReader/IRReader.h"
#include "llvm/Pass.h"
#include "llvm/PassRegistry.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/SourceMgr.h"
using namespace llvm;
namespace {
cl::opt<std::string> InputFilename(
cl::Positional,
cl::desc("<input bitcode file>"),
cl::init("-"),
cl::value_desc("filename"));
} // namespace
int main(int argc, char **argv) {
LLVMContext Context;
cl::ParseCommandLineOptions(argc, argv);
SMDiagnostic Err;
std::unique_ptr<Module> M = parseIRFile(InputFilename, Err, Context);
auto opDependencyPass = PassRegistry::getPassRegistry()
->getPassInfo(StringRef("op_dependency"))
->createPass();
static_cast<ModulePass*>(opDependencyPass)->runOnModule(*M);
return 0;
}