37 #include <google/protobuf/text_format.h>
39 #include <llvm/IR/Function.h>
40 #include <llvm/IR/Instructions.h>
41 #include <llvm/IR/LLVMContext.h>
42 #include <llvm/IR/Module.h>
43 #include <llvm/Support/CommandLine.h>
44 #include <llvm/Support/raw_ostream.h>
45 #include <llvm/Pass.h>
49 using namespace tesla;
53 cl::list<string>
InputFiles(cl::desc(
"<input files>"),
54 cl::Positional, cl::OneOrMore);
56 cl::opt<string>
OutputFile(
"o", cl::desc(
"<output file>"), cl::init(
"-"));
60 main(
int argc,
char *argv[]) {
61 cl::ParseCommandLineOptions(argc, argv);
63 auto& err = llvm::errs();
68 OwningPtr<Manifest>
Manifest(Manifest::load(llvm::errs(),
72 err <<
"Unable to read manifest '" << Filename <<
"'\n";
76 for (
auto i : Manifest->AllAutomata())
77 *Result.add_automaton() = *i.second;
79 for (
auto i : Manifest->RootAutomata())
80 *Result.add_root() = *i;
84 google::protobuf::TextFormat::PrintToString(Result, &ProtobufText);
87 OwningPtr<raw_fd_ostream> outfile;
91 outfile.reset(
new raw_fd_ostream(
OutputFile.c_str(), OutErrorInfo));
93 raw_ostream& out = UseFile ? *outfile : llvm::outs();
96 google::protobuf::ShutdownProtobufLibrary();