37 #include <llvm/IR/Function.h>
38 #include <llvm/IR/Instructions.h>
39 #include <llvm/IR/LLVMContext.h>
40 #include <llvm/IR/Module.h>
41 #include <llvm/Support/CommandLine.h>
42 #include <llvm/Support/raw_ostream.h>
43 #include <llvm/Pass.h>
47 using namespace tesla;
52 cl::Positional, cl::Required);
54 cl::opt<string>
OutputFile(
"o", cl::desc(
"<output file>"), cl::init(
"-"));
56 cl::opt<Automaton::Type>
Determinism(cl::desc(
"automata determinism:"),
58 clEnumValN(Automaton::Unlinked,
"u",
"unlinked NFA"),
59 clEnumValN(Automaton::Linked,
"l",
"linked NFA"),
60 clEnumValN(Automaton::Deterministic,
"d",
"DFA"),
62 cl::init(Automaton::Unlinked));
65 main(
int argc,
char *argv[]) {
66 cl::ParseCommandLineOptions(argc, argv);
69 OwningPtr<raw_fd_ostream> outfile;
73 outfile.reset(
new raw_fd_ostream(
OutputFile.c_str(), OutErrorInfo));
76 raw_ostream& out = UseFile ? *outfile : llvm::outs();
77 auto& err = llvm::errs();
83 err <<
"Unable to read manifest '" <<
ManifestName <<
"'\n";
87 for (
auto i : Manifest->AllAutomata()) {
89 auto *A = Manifest->FindAutomaton(ID);
92 out << A->Dot() <<
"\n\n";
96 google::protobuf::ShutdownProtobufLibrary();