souffle  2.0.2-371-g6315b36
Public Member Functions | Protected Attributes
souffle::ram::TranslationUnit Class Reference

Translating a RAM program. More...

#include <TranslationUnit.h>

Collaboration diagram for souffle::ram::TranslationUnit:
Collaboration graph

Public Member Functions

std::set< const analysis::Analysis * > getAliveAnalyses () const
 Get all alive analyses. More...
 
template<class Analysis >
AnalysisgetAnalysis () const
 Get an analysis. More...
 
DebugReportgetDebugReport ()
 Obtain debug report. More...
 
ErrorReportgetErrorReport ()
 Obtain error report. More...
 
ProgramgetProgram () const
 Get the RAM Program of the translation unit
More...
 
souffle::SymbolTablegetSymbolTable ()
 Obtain symbol table
More...
 
void invalidateAnalyses ()
 Invalidate all alive analyses of the translation unit. More...
 
 TranslationUnit (Own< Program > prog, SymbolTable sym, ErrorReport &e, DebugReport &d)
 
virtual ~TranslationUnit ()=default
 

Protected Attributes

std::map< std::string, Own< analysis::Analysis > > analyses
 
DebugReportdebugReport
 
ErrorReporterrorReport
 
Own< Programprogram
 
souffle::SymbolTable symbolTable
 

Detailed Description

Translating a RAM program.

Comprises the program, symbol table, error report, debug report, and analyses

Definition at line 55 of file TranslationUnit.h.

Constructor & Destructor Documentation

◆ TranslationUnit()

souffle::ram::TranslationUnit::TranslationUnit ( Own< Program prog,
SymbolTable  sym,
ErrorReport e,
DebugReport d 
)
inline

Definition at line 57 of file TranslationUnit.h.

58  {
59  // analysis does not exist yet, create instance and run it.
60  auto analysis = mk<Analysis>(Analysis::name);

◆ ~TranslationUnit()

virtual souffle::ram::TranslationUnit::~TranslationUnit ( )
virtualdefault

Member Function Documentation

◆ getAliveAnalyses()

std::set<const analysis::Analysis*> souffle::ram::TranslationUnit::getAliveAnalyses ( ) const
inline

Get all alive analyses.

Definition at line 93 of file TranslationUnit.h.

95  {
96  return *program;
97  }
98 
99  /** @brief Obtain symbol table */

References program.

◆ getAnalysis()

template<class Analysis >
Analysis* souffle::ram::TranslationUnit::getAnalysis ( ) const
inline

Get an analysis.

Definition at line 66 of file TranslationUnit.h.

66  {
68  analysis->getName(), "RAM Analysis " + analysis->getName(), ramAnalysisStr.str());
69  }
70  }
71  // check it hasn't been created by someone else, and insert if not
72  it = analyses.find(name);
73  if (it == analyses.end()) {
74  analyses[name] = std::move(analysis);
75  }
76  }
77  return dynamic_cast<Analysis*>(analyses[name].get());
78  }
79 
80  /** @brief Get all alive analyses */
81  std::set<const analysis::Analysis*> getAliveAnalyses() const {
82  std::set<const analysis::Analysis*> result;
83  for (auto const& a : analyses) {
84  result.insert(a.second.get());
85  }
86  return result;
87  }
88 
89  /** @brief Invalidate all alive analyses of the translation unit */
90  void invalidateAnalyses() {

References souffle::DebugReport::addSection(), and debugReport.

Referenced by souffle::ram::transform::ReportIndexTransformer::getName().

Here is the call graph for this function:

◆ getDebugReport()

DebugReport& souffle::ram::TranslationUnit::getDebugReport ( )
inline

Obtain debug report.

Definition at line 122 of file TranslationUnit.h.

◆ getErrorReport()

ErrorReport& souffle::ram::TranslationUnit::getErrorReport ( )
inline

Obtain error report.

Definition at line 117 of file TranslationUnit.h.

◆ getProgram()

Program& souffle::ram::TranslationUnit::getProgram ( ) const
inline

Get the RAM Program of the translation unit

Definition at line 107 of file TranslationUnit.h.

110  {

Referenced by souffle::ram::analysis::RelationAnalysis::lookup().

◆ getSymbolTable()

souffle::SymbolTable& souffle::ram::TranslationUnit::getSymbolTable ( )
inline

Obtain symbol table

Definition at line 112 of file TranslationUnit.h.

114  :
115  /* Cached analyses */

◆ invalidateAnalyses()

void souffle::ram::TranslationUnit::invalidateAnalyses ( )
inline

Invalidate all alive analyses of the translation unit.

Definition at line 102 of file TranslationUnit.h.

105  {

Field Documentation

◆ analyses

std::map<std::string, Own<analysis::Analysis> > souffle::ram::TranslationUnit::analyses
mutableprotected

Definition at line 128 of file TranslationUnit.h.

◆ debugReport

DebugReport& souffle::ram::TranslationUnit::debugReport
protected

Definition at line 140 of file TranslationUnit.h.

Referenced by getAnalysis().

◆ errorReport

ErrorReport& souffle::ram::TranslationUnit::errorReport
protected

Definition at line 137 of file TranslationUnit.h.

◆ program

Own<Program> souffle::ram::TranslationUnit::program
protected

Definition at line 131 of file TranslationUnit.h.

Referenced by getAliveAnalyses().

◆ symbolTable

souffle::SymbolTable souffle::ram::TranslationUnit::symbolTable
protected

Definition at line 134 of file TranslationUnit.h.


The documentation for this class was generated from the following file:
souffle::ram::TranslationUnit::getAliveAnalyses
std::set< const analysis::Analysis * > getAliveAnalyses() const
Get all alive analyses.
Definition: TranslationUnit.h:93
souffle::DebugReport::addSection
void addSection(DebugReportSection section)
Definition: DebugReport.h:93
souffle::ram::TranslationUnit::program
Own< Program > program
Definition: TranslationUnit.h:131
souffle::ram::TranslationUnit::invalidateAnalyses
void invalidateAnalyses()
Invalidate all alive analyses of the translation unit.
Definition: TranslationUnit.h:102
souffle::ram::TranslationUnit::debugReport
DebugReport & debugReport
Definition: TranslationUnit.h:140
souffle::ram::TranslationUnit::analyses
std::map< std::string, Own< analysis::Analysis > > analyses
Definition: TranslationUnit.h:128