39#ifndef PROGRAM_GENERATION_ENGINE_H
40#define PROGRAM_GENERATION_ENGINE_H
43#include "data/dataHandlerPrinter.h"
44#include "data/primitiveTypeArray.h"
45#include "instructions/instruction.h"
46#include "program/programEngine.h"
119 const std::string& path =
"./")
145 const std::string& path =
"./")
159 fileH <<
"#endif" << std::endl;
193 const bool ignoreException =
false);
237 void openFile(
const std::string& filename,
const std::string& path,
Class in charge of generating inference C code for all the Program of a TPG.
Definition: programGenerationEngine.h:63
std::string getNameSourceData(const uint64_t &idx)
Method returning the name of the data source in the file generated.
Definition: programGenerationEngine.cpp:203
void initGlobalVar(size_t nbConstant)
Set global variables in the file holding the programs.
Definition: programGenerationEngine.cpp:134
ProgramGenerationEngine(const std::string &filename, const Program::Program &p, const std::string &path="./")
Constructor of the class.
Definition: programGenerationEngine.h:143
ProgramGenerationEngine(const std::string &filename, const Environment &env, const std::string &path="./")
Constructor of the class.
Definition: programGenerationEngine.h:117
std::string completeFormat(const Instructions::Instruction &instruction) const
Generates the line of C code that implements the instruction in parameter.
Definition: programGenerationEngine.cpp:104
virtual void processLine() override
inherited from Program::ProgramEngine
Definition: programGenerationEngine.cpp:223
void initOperandCurrentLine()
Function called to generate the initialization of all operands of an instruction.
Definition: programGenerationEngine.cpp:181
static const std::string nameOperandVariable
name of the temporary operand used in the TPG's programs.
Definition: programGenerationEngine.h:85
static const std::string nameConstantVariable
name of the array of constants in the TPG's programs.
Definition: programGenerationEngine.h:82
void generateCurrentLine()
Generate the current line of the program.
Definition: programGenerationEngine.cpp:46
static const std::regex operand_regex
Definition: programGenerationEngine.h:67
std::ofstream fileC
The file in which programs will be added.
Definition: programGenerationEngine.h:88
static const std::string nameRegVariable
name of the registers in the TPG's programs.
Definition: programGenerationEngine.h:79
void openFile(const std::string &filename, const std::string &path, size_t nbConstant)
Function used to open the file that is generated.
Definition: programGenerationEngine.cpp:154
~ProgramGenerationEngine()
Destructor of the class.
Definition: programGenerationEngine.h:157
Data::DataHandlerPrinter dataPrinter
Utility class used to print data accesses in generated code.
Definition: programGenerationEngine.h:93
std::ofstream fileH
The file in which prototypes of programs will be added.
Definition: programGenerationEngine.h:90
void generateProgram(uint64_t progID, const bool ignoreException=false)
Generate the C code that corresponds to the member program of the class.
Definition: programGenerationEngine.cpp:65
static const std::string nameDataVariable
Name given to the global variable in generated files.
Definition: programGenerationEngine.h:76
Class used to generate the declaration of operands of a line for the code gen.
Definition: dataHandlerPrinter.h:50
The Environment class contains all information needed to execute a Program.
Definition: environment.h:84
size_t getNbConstant() const
Get the number of constants used by programs.
Definition: environment.cpp:172
This abstract class is the base class for any instruction to be used in a Program.
Definition: instruction.h:59
This abstract class is the base class for any program engine (generation and execution)
Definition: programEngine.h:54
void setProgram(const Program &prog)
Method for changing the Program executed by a ProgramExecutionEngin.
Definition: programEngine.cpp:41
ProgramEngine()=delete
Default constructor is deleted.
The Program class contains a list of program lines that can be executed within a well defined Environ...
Definition: program.h:53
const Environment & getEnvironment() const
Get the environment associated to the Program at construction.
Definition: program.cpp:110
Definition: programGenerationEngine.h:48