-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
executable file
·32 lines (27 loc) · 898 Bytes
/
Copy pathmain.cpp
File metadata and controls
executable file
·32 lines (27 loc) · 898 Bytes
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 <stdio.h>
#include <string>
#include <iostream>
#include "cfg/builder.h"
//#include <google/protobuf/def.inc>
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/Module.h"
#include "llvm/IRReader/IRReader.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Transforms/IPO/PassManagerBuilder.h"
int main()
{
printf("Hello llvm! \n");
::llvm::legacy::PassManager passManager;
::llvm::PassManagerBuilder passManagerBuilder;
// passManagerBuilder.OptLevel = options.opt_level();
passManagerBuilder.populateModulePassManager(passManager);
// Create a graph builder pass. Ownership of this pointer is transferred to
auto cfg_pass = new CfgBuilder();
passManager.add(cfg_pass);
//llvm::Instruction()
::llvm::SMDiagnostic error;
::llvm::LLVMContext ctx;
auto module = ::llvm::parseIRFile("./data/test1.bc", error, ctx);
passManager.run(*module);
return 0;
}