Computer Laboratory

graph.cpp File Reference

Detailed Description

Tool for graphing TESLA manifests.

Definition in file graph.cpp.

#include "Automaton.h"
#include "Manifest.h"
#include "tesla.pb.h"
#include <llvm/IR/Function.h>
#include <llvm/IR/Instructions.h>
#include <llvm/IR/LLVMContext.h>
#include <llvm/IR/Module.h>
#include <llvm/Support/CommandLine.h>
#include <llvm/Support/raw_ostream.h>
#include <llvm/Pass.h>
+ Include dependency graph for graph.cpp:

Go to the source code of this file.

Functions

cl::opt< string > ManifestName (cl::desc("<input file>"), cl::Positional, cl::Required)
 
cl::opt< string > OutputFile ("o", cl::desc("<output file>"), cl::init("-"))
 
cl::opt< Automaton::TypeDeterminism (cl::desc("automata determinism:"), cl::values("u", int(Automaton::Unlinked),"unlinked NFA","l", int(Automaton::Linked),"linked NFA","d", int(Automaton::Deterministic),"DFA",(reinterpret_cast< void * >(0))), cl::init(Automaton::Unlinked))
 
int main (int argc, char *argv[])
 

Function Documentation

cl::opt<Automaton::Type> Determinism ( cl::  desc"automata determinism:",
cl::  values"u", int(Automaton::Unlinked),"unlinked NFA","l", int(Automaton::Linked),"linked NFA","d", int(Automaton::Deterministic),"DFA",(reinterpret_cast< void * >(0)),
cl::  initAutomaton::Unlinked 
)

Referenced by main().

+ Here is the caller graph for this function:

int main ( int  argc,
char *  argv[] 
)

Definition at line 65 of file graph.cpp.

References Determinism(), tesla::ManifestName(), and OutputFile().

65  {
66  cl::ParseCommandLineOptions(argc, argv);
67 
68  bool UseFile = (OutputFile != "-");
69  OwningPtr<raw_fd_ostream> outfile;
70 
71  if (UseFile) {
72  string OutErrorInfo;
73  outfile.reset(new raw_fd_ostream(OutputFile.c_str(), OutErrorInfo));
74  }
75 
76  raw_ostream& out = UseFile ? *outfile : llvm::outs();
77  auto& err = llvm::errs();
78 
79  OwningPtr<Manifest> Manifest(
80  Manifest::load(llvm::errs(), Determinism, ManifestName));
81 
82  if (!Manifest) {
83  err << "Unable to read manifest '" << ManifestName << "'\n";
84  return false;
85  }
86 
87  for (auto i : Manifest->AllAutomata()) {
88  Identifier ID = i.first;
89  auto *A = Manifest->FindAutomaton(ID);
90  assert(A);
91 
92  out << A->Dot() << "\n\n";
93  out.flush();
94  }
95 
96  google::protobuf::ShutdownProtobufLibrary();
97  return 0;
98 }

+ Here is the call graph for this function:

cl::opt<string> ManifestName ( cl::  desc"<input file>",
cl::Positional  ,
cl::Required   
)
cl::opt<string> OutputFile ( "o"  ,
cl::  desc"<output file>",
cl::  init"-" 
)