|
docc 0.8.3 (0d44999b)
C++ API Reference
|
Base class for code generators. More...
#include <sdfg/codegen/code_generator.h>
Public Member Functions | |
| CodeGenerator (StructuredSDFG &sdfg, analysis::AnalysisManager &analysis_manager, InstrumentationPlan &instrumentation_plan, ArgCapturePlan &arg_capture_plan, std::shared_ptr< CodeSnippetFactory > library_snippet_factory=std::make_shared< CodeSnippetFactory >(), const std::string &externals_prefix="") | |
| virtual | ~CodeGenerator ()=default |
| const StructuredSDFG & | sdfg () const |
| virtual bool | generate ()=0 |
| Generate the code. | |
| virtual std::string | function_definition ()=0 |
| Generate a function definition for the SDFG. | |
| virtual bool | emit_header (PrettyPrinter &out)=0 |
| write the contents of the main header into out | |
| virtual bool | emit_main_source (std::ostream &out, const std::filesystem::path &header_path)=0 |
| write the contents of the main source file into out. | |
| virtual bool | as_source (const std::filesystem::path &header_path, const std::filesystem::path &source_path)=0 |
| Generate the SDFG's code into source files. | |
| virtual void | append_function_source (std::ostream &ofs_source)=0 |
| Generate only the function source code and append it to the source file. | |
| const PrettyPrinter & | includes () const |
| Get the includes. | |
| const PrettyPrinter & | classes () const |
| Get the classes. | |
| const PrettyPrinter & | globals () const |
| Get the globals. | |
| const std::unordered_map< std::string, CodeSnippet > & | library_snippets () const |
| all created library snippets | |
| const PrettyPrinter & | main () const |
| Get the main stream. | |
Protected Attributes | |
| StructuredSDFG & | sdfg_ |
| Reference to the schedule. | |
| analysis::AnalysisManager & | analysis_manager_ |
| Analysis manager for the SDFG. | |
| InstrumentationPlan & | instrumentation_plan_ |
| Instrumentation strategy. | |
| ArgCapturePlan & | arg_capture_plan_ |
| PrettyPrinter | includes_stream_ |
| Stream for includes. | |
| PrettyPrinter | classes_stream_ |
| Stream for classes. | |
| PrettyPrinter | globals_stream_ |
| Stream for global variables and functions. | |
| std::shared_ptr< CodeSnippetFactory > | library_snippet_factory_ |
| Stream for library functions. | |
| PrettyPrinter | main_stream_ |
| Main stream. | |
| std::string | externals_prefix_ |
| Prefix to use for external functions. | |
Base class for code generators.
This class provides the basic structure for code generators. It contains the streams for the includes, classes, globals, library functions and main code.
|
inline |
|
virtualdefault |
|
pure virtual |
Generate only the function source code and append it to the source file.
as_source generates this into source_path after includes, globals and structs
Implemented in sdfg::codegen::CStyleBaseCodeGenerator.
|
pure virtual |
Generate the SDFG's code into source files.
Implemented in sdfg::codegen::CStyleBaseCodeGenerator.
|
inline |
Get the classes.
|
pure virtual |
write the contents of the main header into out
Implemented in sdfg::codegen::CStyleBaseCodeGenerator.
|
pure virtual |
write the contents of the main source file into out.
Can also generate additional source files (snippets) that also depend on the header
Implemented in sdfg::codegen::CStyleBaseCodeGenerator.
|
pure virtual |
Generate a function definition for the SDFG.
Implemented in sdfg::codegen::CCodeGenerator, and sdfg::codegen::CPPCodeGenerator.
|
pure virtual |
Generate the code.
Implemented in sdfg::codegen::CStyleBaseCodeGenerator.
|
inline |
Get the globals.
|
inline |
Get the includes.
|
inline |
all created library snippets
|
inline |
Get the main stream.
|
inlinenodiscard |
|
protected |
Analysis manager for the SDFG.
|
protected |
|
protected |
Stream for classes.
|
protected |
Prefix to use for external functions.
|
protected |
Stream for global variables and functions.
|
protected |
Stream for includes.
|
protected |
Instrumentation strategy.
|
protected |
Stream for library functions.
|
protected |
Main stream.
|
protected |
Reference to the schedule.