Commit 945ef240 authored by guruhegde's avatar guruhegde
Browse files

Add main.cpp

Build executable to run the pass.
parent 110f4cf7
......@@ -42,5 +42,7 @@ include_directories(${LLVM_INCLUDE_DIRS})
include_directories(src/)
add_subdirectory(src/)
llvm_map_components_to_libnames(llvm_libs support core irreader)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/examples DESTINATION ${CMAKE_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/scripts/run_test.sh DESTINATION ${CMAKE_BINARY_DIR})
add_library(TASPrototypePasses MODULE SimplePrototypePasses.cpp
LoopFission.cpp
Util.cpp)
llvm_map_components_to_libnames(llvm_libs support core irreader)
add_executable(TASTest main.cpp)
target_link_libraries(TASTest ${llvm_libs})
#include <llvm/IR/LegacyPassManager.h>
#include <llvm/IRReader/IRReader.h>
#include <llvm/Support/raw_ostream.h>
#include <llvm/Pass.h>
#include <llvm/Support/SourceMgr.h>
#include <llvm/IR/Module.h>
using namespace llvm;
int main(int argc, char **argv) {
if (argc < 2) {
errs() << "Usage: " << argv[0] << " <IR file>\n";
return 1;
}
// Parse the input LLVM IR file into a module.
SMDiagnostic Err;
LLVMContext Context;
std::unique_ptr<Module> Mod(parseIRFile(argv[1], Err, Context));
if (!Mod) {
Err.print(argv[0], errs());
return 1;
}
// Create a pass manager and fill it with the passes we want to run.
legacy::PassManager PM;
//PM.add(new TASLoopFission());
PM.run(*Mod);
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment