40#ifndef PROGRAM_GENERATION_ENGINE_H
41#define PROGRAM_GENERATION_ENGINE_H
44#include "data/dataHandlerPrinter.h"
45#include "data/primitiveTypeArray.h"
46#include "instructions/instruction.h"
47#include "program/programEngine.h"
124 const std::string& path =
"./")
150 const std::string& path =
"./")
165 fileH <<
"#endif" << std::endl;
199 const bool ignoreException =
false);
243 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:64
std::string getNameSourceData(const uint64_t &idx)
Method returning the name of the data source in the file generated.
Definition programGenerationEngine.cpp:255
void initGlobalVar(size_t nbConstant)
Set global variables in the file holding the programs.
Definition programGenerationEngine.cpp:172
ProgramGenerationEngine(const std::string &filename, const Program::Program &p, const std::string &path="./")
Constructor of the class.
Definition programGenerationEngine.h:148
ProgramGenerationEngine(const std::string &filename, const Environment &env, const std::string &path="./")
Constructor of the class.
Definition programGenerationEngine.h:122
std::string completeFormat(const Instructions::Instruction &instruction) const
Generates the line of C code that implements the instruction in parameter.
Definition programGenerationEngine.cpp:142
virtual void processLine() override
inherited from Program::ProgramEngine
Definition programGenerationEngine.cpp:277
void initOperandCurrentLine()
Function called to generate the initialization of all operands of an instruction.
Definition programGenerationEngine.cpp:233
static const std::string nameOperandVariable
name of the temporary operand used in the TPG's programs.
Definition programGenerationEngine.h:90
static const std::regex constant_regex
Definition programGenerationEngine.h:72
static const std::string nameConstantVariable
name of the array of constants in the TPG's programs.
Definition programGenerationEngine.h:87
void generateCurrentLine()
Generate the current line of the program.
Definition programGenerationEngine.cpp:50
static const std::regex operand_regex
Definition programGenerationEngine.h:68
std::ofstream fileC
The file in which programs will be added.
Definition programGenerationEngine.h:93
static const std::string nameRegVariable
name of the registers in the TPG's programs.
Definition programGenerationEngine.h:84
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:192
~ProgramGenerationEngine()
Destructor of the class.
Definition programGenerationEngine.h:163
Data::DataHandlerPrinter dataPrinter
Utility class used to print data accesses in generated code.
Definition programGenerationEngine.h:98
std::ofstream fileH
The file in which prototypes of programs will be added.
Definition programGenerationEngine.h:95
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:69
static const std::string nameDataVariable
Name given to the global variable in generated files.
Definition programGenerationEngine.h:81
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:86
const Learn::LearningParameters & getParams() const
Get the instance of parameters used.
Definition environment.cpp:168
This abstract class is the base class for any instruction to be used in a Program.
Definition instruction.h:61
This abstract class is the base class for any program engine (generation and execution)
Definition programEngine.h:55
void setProgram(const Program &prog)
Method for changing the Program executed by a ProgramExecutionEngin.
Definition programEngine.cpp:43
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:57
const Environment & getEnvironment() const
Get the environment associated to the Program at construction.
Definition program.cpp:126
Definition programGenerationEngine.h:49
size_t nbProgramConstant
Number of Constants available in a program.
Definition learningParameters.h:143