80 class instrumented_call_instr_writer;
82 template <
typename Graph>
181 virtual void WriteBodyLoop(
const unsigned int function_index,
const unsigned int,
vertex current_vertex,
202 std::map<unsigned int, unsigned int>& created_variables,
203 std::map<unsigned int, std::string>& symbol_table,
204 std::map<
unsigned int, std::deque<std::string>>& array_of_stacks);
211 std::map<unsigned int, unsigned int>& created_variables,
212 std::map<unsigned int, std::string>& symbol_table, std::list<unsigned int>& pushed,
213 std::map<
unsigned int, std::deque<std::string>>& array_of_stacks);
229 void push_stack(std::string symbol_name,
unsigned int dest_i, std::list<unsigned int>& pushed,
230 std::map<
unsigned int, std::deque<std::string>>& array_of_stacks);
237 void pop_stack(std::list<unsigned int>& pushed,
std::map<
unsigned int, std::deque<std::string>>& array_of_stacks);
250 virtual void WriteBBHeader(
const unsigned int bb_number,
const unsigned int function_index);
353 virtual void writeInclude(
const std::string& file_name);
414 virtual void WriteFile(
const std::string& file_name);
OpGraphConstRef local_rec_cfgGraph
const dominance< BBGraph > * dominators
Dominator o post-dominator data structure.
CustomOrderedSet< vertex > goto_list
Definition of the node_info object for the basic_block graph.
int debug_level
the debug level
const dominance< BBGraph > * post_dominators
virtual void Initialize()
Initialize data structure.
Class used to write the C code representing a program, this class can't be directly instantiated sinc...
This class manages the tree structures extracted from the raw file.
const CustomSet< unsigned int > GetLocalVariables(const unsigned int function_id) const
Compute the local variables of a function.
CustomOrderedSet< vertex > bb_frontier
virtual void WriteBBHeader(const unsigned int bb_number, const unsigned int function_index)
void WriteHashTableImplementation()
Write the implementation of a hash table with long long int as key and long long int as value...
Class specification of the graph structures.
CustomSet< unsigned int > globallyDeclVars
CONSTREF_FORWARD_DECL(BBGraph)
bool verbose
Verbosity means that a comment is printed for each line in the output file.
void push_stack(std::string symbol_name, unsigned int dest_i, std::list< unsigned int > &pushed, std::map< unsigned int, std::deque< std::string >> &array_of_stacks)
push on the stack of temporary variables that has to replaced
const tree_managerConstRef TM
The tree manager.
void pop_stack(std::list< unsigned int > &pushed, std::map< unsigned int, std::deque< std::string >> &array_of_stacks)
remove from the stack all the temporaries
redefinition of map to manage ordered/unordered structures
A set of operation vertices.
virtual void WriteFunctionDeclaration(const unsigned int funId)
Writes the declaration of the function whose id in the tree is funId.
Abstract pure class for the tree structure.
void schedule_copies(vertex b, const BBGraphConstRef bb_domGraph, const BBGraphConstRef bb_fcfgGraph, var_pp_functorConstRef variableFunctor, const CustomSet< unsigned int > &phi_instructions, std::map< unsigned int, unsigned int > &created_variables, std::map< unsigned int, std::string > &symbol_table, std::list< unsigned int > &pushed, std::map< unsigned int, std::deque< std::string >> &array_of_stacks)
insert copies according the algorithm described in Briggs et.
virtual void WriteFile(const std::string &file_name)
Writes the final C file.
const IndentedOutputStreamRef indented_output_stream
Represents the stream we are currently writing to.
Class used to describe a particular graph with basic blocks as nodes.
virtual void EndFunctionBody(unsigned int funId)
Writes the code necessary to close a function (this function was a function also present in the origi...
unsigned map[NUM_VERTICES]
const ParameterConstRef Param
set of parameters
virtual void StartFunctionBody(const unsigned int function_id)
Writes the body of the function to the specified stream.
void compute_phi_nodes(const FunctionBehaviorConstRef function_behavior, const OpVertexSet &instructions, var_pp_functorConstRef variableFunctor)
Determines the instructions coming out from phi-node splitting.
CustomSet< std::string > globally_declared_types
This set contains the list of the non built_in types already declared in the global scope...
virtual void DeclareType(const tree_nodeConstRef &varType, const BehavioralHelperConstRef &behavioral_helper, CustomSet< std::string > &locally_declared_type)
This method should be called only if the type associated with the variable is a non built_in type and...
redefinition of set to manage ordered/unordered structures
boost::graph_traits< graph >::vertex_descriptor vertex
vertex definition.
CWriter(const HLS_managerConstRef _HLSMgr, const InstructionWriterRef instruction_writer, const IndentedOutputStreamRef indented_output_stream, const ParameterConstRef Param, bool verbose=true)
Constructor of the class.
General class used to describe a graph in PandA.
virtual void DeclareVariable(const tree_nodeConstRef &curVar, CustomSet< unsigned int > &already_declared_variables, CustomSet< std::string > &locally_declared_type, const BehavioralHelperConstRef &behavioral_helper, const var_pp_functorConstRef &varFunc)
Declares the local variable; in case the variable used in the intialization of curVar hasn't been dec...
CustomOrderedSet< std::string > writtenIncludes
Base class functor used by prettyPrintVertex to print variables.
void insert_copies(vertex b, const BBGraphConstRef bb_domGraph, const BBGraphConstRef bb_fcfgGraph, var_pp_functorConstRef variableFunctor, const CustomSet< unsigned int > &phi_instructions, std::map< unsigned int, unsigned int > &created_variables, std::map< unsigned int, std::string > &symbol_table, std::map< unsigned int, std::deque< std::string >> &array_of_stacks)
Compute the copy assignments needed by the phi nodes destruction Further details can be found in: ...
virtual void WriteBodyLoop(const unsigned int function_index, const unsigned int, vertex current_vertex, bool bracket)
Write the instructions belonging to a body loop.
static CWriterRef CreateCWriter(const CBackendInformationConstRef c_backend_information, const HLS_managerConstRef hls_man, const IndentedOutputStreamRef indented_output_stream, const ParameterConstRef parameters, const bool verbose)
Factory method.
void writeRoutineInstructions_rec(vertex current_vertex, bool bracket, const unsigned int function_index)
Write recursively instructions belonging to a basic block of task or of a function.
virtual void DeclareFunctionTypes(const tree_nodeConstRef &tn)
Declares the types of the parameters of a function.
Template definition of refcount.
const HLS_managerConstRef HLSMgr
the hls manager
virtual void WriteHeader()
Writes the header of the file.
unsigned int create_new_identifier(std::map< unsigned int, std::string > &symbol_table)
create an identifier for the temporaries created by phi node destruction
std::map< unsigned int, std::string > basic_blocks_labels
virtual void declare_cast_types(unsigned int funId, CustomSet< std::string > &locally_declared_types)
Declare all the types used in conversions.
size_t bb_label_counter
Counter of the invocations of writeRoutineInstructions; this counter allows to print different labels...
CustomOrderedSet< vertex > bb_analyzed
FunctionBehaviorConstRef local_rec_function_behavior
virtual void DeclareLocalVariables(const CustomSet< unsigned int > &to_be_declared, CustomSet< unsigned int > &already_declared_variables, CustomSet< std::string > &already_declared_types, const BehavioralHelperConstRef behavioral_helper, const var_pp_functorConstRef varFunc)
Declares the local variable; in case the variable used in the intialization of curVar hasn't been dec...
REF_FORWARD_DECL(CWriter)
virtual void WriteFunctionBody(const unsigned int function_id)
Writes the body of a function.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
virtual void WriteBuiltinWaitCall()
Writes implementation of __builtin_wait_call.
std::map< unsigned int, std::string > basic_block_prefix
string to be printed at the beginning of a given basic block
virtual void writeInclude(const std::string &file_name)
Writes an include directive.
std::vector< std::string > additionalIncludes
virtual void WriteGlobalDeclarations()
Writes the global declarations.
unsigned int fake_max_tree_node_id
Class to print indented code.
std::map< vertex, std::map< unsigned int, std::string > > renaming_table
renaming table used by phi node destruction procedure
Class used to describe a particular graph with operations as nodes.
const InstructionWriterRef getInstructionWriter() const
Returns the instruction writer.
BBGraphConstRef local_rec_bb_fcfgGraph
virtual void writeRoutineInstructions(const unsigned int function_index, const OpVertexSet &instructions, var_pp_functorConstRef variableFunctor, vertex bb_start=NULL_VERTEX, CustomOrderedSet< vertex > bb_end=CustomOrderedSet< vertex >())
Writes the instructions of the current routine, being it a task or a function of the original program...
BehavioralHelperConstRef local_rec_behavioral_helper
var_pp_functorConstRef local_rec_variableFunctor
#define NULL_VERTEX
null vertex definition
int output_level
the output level
virtual void WriteFunctionImplementation(unsigned int function_id)
Write function implementation.
virtual void writePostInstructionInfo(const FunctionBehaviorConstRef, const vertex)
Write additional information on the given statement vertex, after the statements itself.
CustomOrderedSet< vertex > local_rec_instructions
virtual void writePreInstructionInfo(const FunctionBehaviorConstRef, const vertex)
Write additional information on the given statement vertex, before the statement itself.
std::map< unsigned int, std::string > basic_block_tail
string to be printed at the end of a given basic block
const InstructionWriterRef instrWriter
Contains the class used to write instructions.