PandA-2024.02
|
Class used to write the C code representing a program, this class can't be directly instantiated since the backend is not specified yet. More...
#include <c_writer.hpp>
Public Member Functions | |
virtual | ~CWriter () |
virtual void | Initialize () |
Initialize data structure. More... | |
const InstructionWriterRef | getInstructionWriter () const |
Returns the instruction writer. More... | |
const CustomSet< unsigned int > | GetLocalVariables (const unsigned int function_id) const |
Compute the local variables of a function. More... | |
virtual void | WriteFunctionImplementation (unsigned int function_id) |
Write function implementation. More... | |
virtual void | StartFunctionBody (const unsigned int function_id) |
Writes the body of the function to the specified stream. More... | |
virtual void | WriteFunctionBody (const unsigned int function_id) |
Writes the body of a function. More... | |
virtual void | EndFunctionBody (unsigned int funId) |
Writes the code necessary to close a function (this function was a function also present in the original specification) More... | |
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. More... | |
virtual void | WriteFunctionDeclaration (const unsigned int funId) |
Writes the declaration of the function whose id in the tree is funId. More... | |
virtual void | WriteHeader () |
Writes the header of the file. More... | |
virtual void | WriteGlobalDeclarations () |
Writes the global declarations. More... | |
virtual void | writeInclude (const std::string &file_name) |
Writes an include directive. More... | |
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, in case the non built_in type hasn't been declared yet, it declares it; this method is used to declared new types with scope limited to a routine (be it a function of a task) More... | |
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 declared yet it get declared. More... | |
virtual void | declare_cast_types (unsigned int funId, CustomSet< std::string > &locally_declared_types) |
Declare all the types used in conversions. More... | |
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 declared yet it get declared. More... | |
virtual void | DeclareFunctionTypes (const tree_nodeConstRef &tn) |
Declares the types of the parameters of a function. More... | |
virtual void | WriteFile (const std::string &file_name) |
Writes the final C file. More... | |
virtual void | WriteBuiltinWaitCall () |
Writes implementation of __builtin_wait_call. More... | |
Static Public Member Functions | |
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. More... | |
Protected Member Functions | |
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. More... | |
virtual void | writePreInstructionInfo (const FunctionBehaviorConstRef, const vertex) |
Write additional information on the given statement vertex, before the statement itself. More... | |
virtual void | writePostInstructionInfo (const FunctionBehaviorConstRef, const vertex) |
Write additional information on the given statement vertex, after the statements itself. More... | |
virtual void | WriteBodyLoop (const unsigned int function_index, const unsigned int, vertex current_vertex, bool bracket) |
Write the instructions belonging to a body loop. More... | |
void | compute_phi_nodes (const FunctionBehaviorConstRef function_behavior, const OpVertexSet &instructions, var_pp_functorConstRef variableFunctor) |
Determines the instructions coming out from phi-node splitting. More... | |
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: More... | |
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. More... | |
unsigned int | create_new_identifier (std::map< unsigned int, std::string > &symbol_table) |
create an identifier for the temporaries created by phi node destruction More... | |
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 More... | |
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 More... | |
void | WriteHashTableImplementation () |
Write the implementation of a hash table with long long int as key and long long int as value. More... | |
virtual void | WriteBBHeader (const unsigned int bb_number, const unsigned int function_index) |
CWriter (const HLS_managerConstRef _HLSMgr, const InstructionWriterRef instruction_writer, const IndentedOutputStreamRef indented_output_stream, const ParameterConstRef Param, bool verbose=true) | |
Constructor of the class. More... | |
Protected Attributes | |
const HLS_managerConstRef | HLSMgr |
the hls manager More... | |
const tree_managerConstRef | TM |
The tree manager. More... | |
const IndentedOutputStreamRef | indented_output_stream |
Represents the stream we are currently writing to. More... | |
CustomSet< std::string > | globally_declared_types |
This set contains the list of the non built_in types already declared in the global scope. More... | |
CustomSet< unsigned int > | globallyDeclVars |
const InstructionWriterRef | instrWriter |
Contains the class used to write instructions. More... | |
size_t | bb_label_counter |
Counter of the invocations of writeRoutineInstructions; this counter allows to print different labels in differnt tasks to avoid problem due to multiple tasks inlineing. More... | |
bool | verbose |
Verbosity means that a comment is printed for each line in the output file. More... | |
const ParameterConstRef | Param |
set of parameters More... | |
int | debug_level |
the debug level More... | |
int | output_level |
the output level More... | |
unsigned int | fake_max_tree_node_id |
std::map< unsigned int, std::string > | basic_block_prefix |
string to be printed at the beginning of a given basic block More... | |
std::map< unsigned int, std::string > | basic_block_tail |
string to be printed at the end of a given basic block More... | |
std::map< vertex, std::map< unsigned int, std::string > > | renaming_table |
renaming table used by phi node destruction procedure More... | |
CustomOrderedSet< vertex > | bb_frontier |
CustomOrderedSet< vertex > | bb_analyzed |
std::map< unsigned int, std::string > | basic_blocks_labels |
CustomOrderedSet< vertex > | goto_list |
var_pp_functorConstRef | local_rec_variableFunctor |
FunctionBehaviorConstRef | local_rec_function_behavior |
CustomOrderedSet< vertex > | local_rec_instructions |
const dominance< BBGraph > * | dominators |
const dominance< BBGraph > * | post_dominators |
BBGraphConstRef | local_rec_bb_fcfgGraph |
OpGraphConstRef | local_rec_cfgGraph |
BehavioralHelperConstRef | local_rec_behavioral_helper |
std::vector< std::string > | additionalIncludes |
CustomOrderedSet< std::string > | writtenIncludes |
Class used to write the C code representing a program, this class can't be directly instantiated since the backend is not specified yet.
So a subclass must be created which redefines all the abstract methods of this class.
Definition at line 91 of file c_writer.hpp.
|
protected |
Constructor of the class.
HLSMgr | is the hls manager |
instruction_writer | is the instruction writer to use to print the single instruction |
indented_output_stream | is the stream where code has to be printed |
Param | is the set of parameters |
verbose | tells if annotations |
Definition at line 140 of file c_writer.cpp.
References ~CWriter().
Referenced by CreateCWriter().
|
virtualdefault |
|
protected |
Determines the instructions coming out from phi-node splitting.
compute the assignment introduced by the phi nodes destruction
in case we declare the variables introduced during the phi nodes destruction
Definition at line 1110 of file c_writer.cpp.
References IndentedOutputStream::Append(), FunctionBehavior::CGetBBGraph(), BBGraph::CGetBBGraphInfo(), FunctionBehavior::CGetBehavioralHelper(), FunctionBehavior::CGetOpGraph(), OpGraph::CGetOpNodeInfo(), FunctionBehavior::DOM_TREE, FunctionBehavior::FBB, FunctionBehavior::FCFG, GET_TYPE, tree_helper::get_type_index(), indented_output_stream, insert_copies(), tree_helper::print_type(), THROW_ASSERT, TM, and TYPE_PHI.
Referenced by DeclareLocalVariables().
|
protected |
create an identifier for the temporaries created by phi node destruction
symbol_table | is the symbol table where the new id is inserted return an id for the symbol created |
Definition at line 1641 of file c_writer.cpp.
References counter, fake_max_tree_node_id, tree_manager::find_identifier_nodeID(), STR, and TM.
Referenced by schedule_copies().
|
static |
Factory method.
c_backend_information | is the information about the backend we are creating |
hls_man | is the hls manager |
indented_output_stream | is the output stream |
parameters | is the set of input parameters |
verbose | tells if produced source code has to be commented |
Definition at line 159 of file c_writer.cpp.
References BA_NONE, InstructionWriter::CreateInstructionWriter(), CWriter(), and THROW_UNREACHABLE.
|
virtual |
Declare all the types used in conversions.
function_id | is the function to be condiered |
locally_declared_types | is the set of already declared types |
Definition at line 206 of file c_writer.cpp.
References DeclareType(), FunctionBehavior::DFG, and HLSMgr.
Referenced by StartFunctionBody().
|
virtual |
Declares the types of the parameters of a function.
fun_id | is the index of the function |
Definition at line 333 of file c_writer.cpp.
References debug_level, DEBUG_LEVEL_VERY_PEDANTIC, DeclareType(), tree_helper::GetFunctionReturnType(), globally_declared_types, HLSMgr, INDENT_DBG_MEX, tree_node::index, and STR.
|
virtual |
Declares the local variable; in case the variable used in the intialization of curVar hasn't been declared yet it get declared.
to_be_declared | is the set of variables which have to be declared |
already_decl_variables | is the set of already declared variables |
locally_declared_type | is the set of already declared types |
helper | is the behavioral helper associated with the function |
varFunc | is the printer functor |
Reimplemented in DiscrepancyAnalysisCWriter.
Definition at line 1393 of file c_writer.cpp.
References FunctionBehavior::CGetOpGraph(), tree_manager::CGetTreeReindex(), compute_phi_nodes(), debug_level, DEBUG_LEVEL_PEDANTIC, DeclareVariable(), FunctionBehavior::DFG, BehavioralHelper::get_function_index(), BehavioralHelper::get_function_name(), tree_node::get_kind(), GET_NODE, BehavioralHelper::get_parameters(), HLSMgr, INDENT_DBG_MEX, STR, THROW_ASSERT, and TM.
Referenced by DiscrepancyAnalysisCWriter::DeclareLocalVariables(), and StartFunctionBody().
|
virtual |
This method should be called only if the type associated with the variable is a non built_in type and, in case the non built_in type hasn't been declared yet, it declares it; this method is used to declared new types with scope limited to a routine (be it a function of a task)
varType | the type to be declared |
BH | the behavioral helper associated to the function which declare type |
locally_declared_type | is the set of type already declared in this function |
routine_name | is the name of the routina (function or thread) |
Definition at line 1278 of file c_writer.cpp.
References IndentedOutputStream::Append(), debug_level, DEBUG_LEVEL_VERY_PEDANTIC, GET_CONST_NODE, BehavioralHelper::get_function_name(), tree_helper::GetRealType(), tree_helper::GetSourcePath(), tree_helper::GetTypeName(), tree_helper::GetTypesToBeDeclaredAfter(), tree_helper::GetTypesToBeDeclaredBefore(), globally_declared_types, tree_helper::HasToBeDeclared(), INDENT_DBG_MEX, indented_output_stream, tree_helper::IsInLibbambu(), Param, BehavioralHelper::print_type_declaration(), STR, TM, ToString(), and verbose.
Referenced by declare_cast_types(), DeclareFunctionTypes(), and DeclareVariable().
|
virtual |
Declares the local variable; in case the variable used in the intialization of curVar hasn't been declared yet it get declared.
curVar | is the variable to be declared |
already_decl_variables | is the set of already declared variables |
locally_declared_type | is the set of already declared types |
behavioral_helper | is the behavioral helper |
varFunc | is the printer functor |
Definition at line 1330 of file c_writer.cpp.
References IndentedOutputStream::Append(), tree_manager::CGetTreeReindex(), tree_helper::CGetType(), debug_level, DEBUG_LEVEL_PEDANTIC, DEBUG_LEVEL_VERY_PEDANTIC, DeclareType(), GET_CONST_NODE, BehavioralHelper::GetInit(), globallyDeclVars, INDENT_DBG_MEX, indented_output_stream, tree_node::index, instrWriter, tree_helper::IsInLibbambu(), tree_helper::IsSystemType(), BehavioralHelper::PrintVarDeclaration(), STR, TM, and verbose.
Referenced by DeclareLocalVariables(), and WriteGlobalDeclarations().
|
virtual |
Writes the code necessary to close a function (this function was a function also present in the original specification)
Definition at line 409 of file c_writer.cpp.
References IndentedOutputStream::Append(), basic_block_prefix, basic_block_tail, indented_output_stream, renaming_table, STR, and verbose.
Referenced by WriteFunctionImplementation().
const InstructionWriterRef CWriter::getInstructionWriter | ( | ) | const |
Returns the instruction writer.
Definition at line 1378 of file c_writer.cpp.
References instrWriter.
const CustomSet< unsigned int > CWriter::GetLocalVariables | ( | const unsigned int | function_id | ) | const |
Compute the local variables of a function.
function_id | is the index of a function |
Definition at line 356 of file c_writer.cpp.
References FunctionBehavior::DFG, and HLSMgr.
Referenced by StartFunctionBody().
|
virtual |
Initialize data structure.
Reimplemented in EdgeCWriter.
Definition at line 228 of file c_writer.cpp.
References additionalIncludes, fake_max_tree_node_id, tree_manager::get_next_available_tree_node_id(), globally_declared_types, globallyDeclVars, instrWriter, TM, and writtenIncludes.
Referenced by EdgeCWriter::Initialize().
|
protected |
Compute the copy assignments needed by the phi nodes destruction Further details can be found in:
fill the renaming table for basic block b
Definition at line 1442 of file c_writer.cpp.
References pop_stack(), renaming_table, schedule_copies(), and lenet_tvm::target.
Referenced by compute_phi_nodes().
|
protected |
remove from the stack all the temporaries
pushed | is the list of variables to be renamed |
array_of_stacks | is the array of stacks used by the phi node destruction procedure |
Definition at line 1666 of file c_writer.cpp.
References THROW_ASSERT.
Referenced by insert_copies().
|
protected |
push on the stack of temporary variables that has to replaced
symbol_name | is the new identifier for dest_i |
dest_i | is the id of the variable to be renamed |
pushed | is the list of variables to be renamed |
array_of_stacks | is the array of stacks used by the phi node destruction procedure |
Definition at line 1658 of file c_writer.cpp.
References THROW_ASSERT.
Referenced by schedule_copies().
|
protected |
insert copies according the algorithm described in Briggs et.
al.
Pass One: initialize the data structures
Pass two: Set up the worklist of initial copies
Pass Three: Iterate over the worklist, inserting copies
if dest live_out(b) wrt the original algorithm an optimization has been added: in case b does not dominate any other node we can skip the creation of t
insert a copy from dest to a new temp t at phi-node defining dest
push(t, Stack[dest])
insert a copy operation from map[src] to dest at the end of b
check if dest_i is source of any other pair in copy_set this optimization is not described in the original algorithm
create a new symbol
insert a copy from dest to a new temp t at the end of b
Definition at line 1470 of file c_writer.cpp.
References basic_block_prefix, basic_block_tail, BBGraph::CGetBBNodeInfo(), create_new_identifier(), GET_INDEX_NODE, GET_NODE, map, push_stack(), renaming_table, and lenet_tvm::target.
Referenced by insert_copies().
|
virtual |
Writes the body of the function to the specified stream.
funId | is the index of the function |
Definition at line 384 of file c_writer.cpp.
References IndentedOutputStream::Append(), declare_cast_types(), DeclareLocalVariables(), GetLocalVariables(), HLSMgr, indented_output_stream, and instrWriter.
Referenced by WriteFunctionImplementation().
|
protectedvirtual |
Reimplemented in DiscrepancyAnalysisCWriter.
Definition at line 1918 of file c_writer.cpp.
Referenced by writeRoutineInstructions_rec().
|
protectedvirtual |
Write the instructions belonging to a body loop.
function_index | is the identifier of the function to which instructions belong |
loop_id | is the index of the loop to be printed |
current_vertex | is the first basic block of the loop |
bracket | tells if bracket should be added before and after this basic block |
Definition at line 238 of file c_writer.cpp.
References writeRoutineInstructions_rec().
Referenced by writeRoutineInstructions_rec().
|
virtual |
Writes implementation of __builtin_wait_call.
Reimplemented in HLSCWriter, and DiscrepancyAnalysisCWriter.
Definition at line 1922 of file c_writer.cpp.
References IndentedOutputStream::Append(), BUILTIN_WAIT_CALL, tree_manager::CGetTreeReindex(), tree_helper::CGetType(), tree_helper::GetFunctionReturnType(), HLSMgr, indented_output_stream, tree_helper::IsRealType(), tree_helper::IsSignedIntegerType(), tree_helper::IsUnsignedIntegerType(), tree_helper::PrintType(), tree_helper::Size(), STR, TM, and test_panda::type.
Referenced by DiscrepancyAnalysisCWriter::WriteBuiltinWaitCall().
|
virtual |
Writes the final C file.
file_name | is the name of the file to be generated |
Reimplemented in HLSCWriter.
Definition at line 1913 of file c_writer.cpp.
References indented_output_stream, and IndentedOutputStream::WriteFile().
Referenced by EdgeCWriter::writeRoutineInstructions().
|
virtual |
Writes the body of a function.
function_id | is the function whose body has to be printed |
Definition at line 243 of file c_writer.cpp.
References FunctionBehavior::CFG, FunctionBehavior::CGetBehavioralHelper(), FunctionBehavior::CGetOpGraph(), BehavioralHelper::get_function_name(), HLSMgr, THROW_ASSERT, and writeRoutineInstructions().
Referenced by WriteFunctionImplementation().
|
virtual |
Writes the declaration of the function whose id in the tree is funId.
Reimplemented in DiscrepancyAnalysisCWriter.
Definition at line 372 of file c_writer.cpp.
References IndentedOutputStream::Append(), HLSMgr, indented_output_stream, and instrWriter.
Referenced by DiscrepancyAnalysisCWriter::WriteFunctionDeclaration().
|
virtual |
Write function implementation.
function_id | is the index of the function to be written |
Reimplemented in HLSCWriter, and DiscrepancyAnalysisCWriter.
Definition at line 258 of file c_writer.cpp.
References EndFunctionBody(), StartFunctionBody(), and WriteFunctionBody().
Referenced by DiscrepancyAnalysisCWriter::WriteFunctionImplementation().
|
virtual |
Writes the global declarations.
Writing auxiliary variables used by instruction writer
Writing declarations of global variables
Reimplemented in HLSCWriter, BasicBlocksProfilingCWriter, and DiscrepancyAnalysisCWriter.
Definition at line 307 of file c_writer.cpp.
References IndentedOutputStream::Append(), BUILTIN_WAIT_CALL, DeclareVariable(), globally_declared_types, globallyDeclVars, HLSMgr, indented_output_stream, instrWriter, STR, and THROW_ASSERT.
Referenced by DiscrepancyAnalysisCWriter::WriteGlobalDeclarations(), and BasicBlocksProfilingCWriter::WriteGlobalDeclarations().
|
protected |
Write the implementation of a hash table with long long int as key and long long int as value.
Definition at line 1678 of file c_writer.cpp.
References IndentedOutputStream::Append(), and indented_output_stream.
|
virtual |
Writes the header of the file.
Reimplemented in EdgeCWriter, and HLSCWriter.
Definition at line 265 of file c_writer.cpp.
References IndentedOutputStream::Append(), BehavioralHelper::get_function_name(), HLSMgr, and indented_output_stream.
|
virtual |
Writes an include directive.
file_name | the name of the header file to be included |
Definition at line 1383 of file c_writer.cpp.
References IndentedOutputStream::Append(), indented_output_stream, and writtenIncludes.
|
protectedvirtual |
Write additional information on the given statement vertex, after the statements itself.
The default for this function is to do nothing, but every derived class can specify its own additional information to print
Reimplemented in DiscrepancyAnalysisCWriter.
Definition at line 426 of file c_writer.cpp.
Referenced by writeRoutineInstructions_rec().
|
protectedvirtual |
Write additional information on the given statement vertex, before the statement itself.
The default for this function is to do nothing, but every derived class can specify its own additional information to print
Reimplemented in DiscrepancyAnalysisCWriter.
Definition at line 422 of file c_writer.cpp.
Referenced by writeRoutineInstructions_rec().
|
virtual |
Writes the instructions of the current routine, being it a task or a function of the original program.
function_index | is the index of the function |
instructions | is the instructions which have to be printed |
variableFunctor | is the variable functor |
bb_start | is the first basic block to be printed |
bb_end | is the set of first basic block not to be printed |
Then I compute all the labels associated with a basic block with more than one entering edge.
set of basic block already analyzed
store for which basic block the goto has been used
basic block frontier over which writeRoutineInstructions_rec cannot go.
some statements can be in entry
Reimplemented in EdgeCWriter.
Definition at line 1150 of file c_writer.cpp.
References IndentedOutputStream::Append(), basic_blocks_labels, bb_analyzed, bb_frontier, bb_label_counter, FunctionBehavior::CGetBBGraph(), FunctionBehavior::CGetBehavioralHelper(), FunctionBehavior::CGetOpGraph(), debug_level, DEBUG_LEVEL_PEDANTIC, DEBUG_LEVEL_VERY_PEDANTIC, dominators, FunctionBehavior::dominators, bloc::EXIT_BLOCK_ID, FunctionBehavior::FBB, FunctionBehavior::FCFG, GET_TYPE, goto_list, HLSMgr, INDENT_DBG_MEX, indented_output_stream, local_rec_bb_fcfgGraph, local_rec_behavioral_helper, local_rec_cfgGraph, local_rec_function_behavior, local_rec_instructions, local_rec_variableFunctor, post_dominators, FunctionBehavior::post_dominators, STR, lenet_tvm::target, TYPE_ENTRY, and writeRoutineInstructions_rec().
Referenced by WriteFunctionBody().
|
protected |
Write recursively instructions belonging to a basic block of task or of a function.
current_vertex | is the basic block which is being printed |
bracket | tells if bracket should be added before and after this basic block |
function_index | is the identifier of the function to which instructions belong |
compute the last statement
check the feasibility
print each instruction
in case we have phi nodes we check if some assignments should be printed
Feedback edge on the false path of an if
Target is not a while or a for
now we can analyze the following basic blocks
then adjust post dominator
now we can analyze the following basic blocks
in case we have phi nodes we check if some assignments should be printed
Last basic block of a while/for loop
added a fake indent
Definition at line 430 of file c_writer.cpp.
References IndentedOutputStream::Append(), basic_block_prefix, basic_block_tail, basic_blocks_labels, bb_analyzed, bb_frontier, CFG_SELECTOR, BBGraph::CGetBBEdgeInfo(), BBGraph::CGetBBGraphInfo(), BBGraph::CGetBBNodeInfo(), FunctionBehavior::CGetBehavioralHelper(), FunctionBehavior::CGetLoops(), OpGraph::CGetOpNodeInfo(), tree_manager::CGetTreeReindex(), BehavioralHelper::clear_renaming_table(), debug_level, DEBUG_LEVEL_VERY_PEDANTIC, default_COND, DOALL_LOOP, dominators, BehavioralHelper::end_with_a_cond_or_goto(), FB_CFG_SELECTOR, BehavioralHelper::get_function_index(), dominance< GraphObj >::get_immediate_dominator(), GET_INDEX_NODE, tree_node::get_kind(), GET_NAME, tree_manager::get_tree_node_const(), GET_TYPE, graph::GetSelector(), goto_list, INDENT_DBG_MEX, indented_output_stream, instrWriter, local_rec_bb_fcfgGraph, local_rec_behavioral_helper, local_rec_cfgGraph, local_rec_function_behavior, local_rec_instructions, local_rec_variableFunctor, NULL_VERTEX, post_dominators, BehavioralHelper::PrintConstant(), BehavioralHelper::PrintVariable(), BehavioralHelper::rename_a_variable(), renaming_table, BehavioralHelper::start_with_a_label(), STR, lenet_tvm::target, THROW_ASSERT, THROW_ERROR, TM, TYPE_FOR, TYPE_IF, TYPE_INIT, TYPE_LABEL, TYPE_MULTIIF, TYPE_SWITCH, TYPE_VPHI, TYPE_WHILE, verbose, WriteBBHeader(), WriteBodyLoop(), writePostInstructionInfo(), and writePreInstructionInfo().
Referenced by WriteBodyLoop(), and writeRoutineInstructions().
|
protected |
Definition at line 190 of file c_writer.hpp.
Referenced by Initialize().
|
protected |
string to be printed at the beginning of a given basic block
Definition at line 130 of file c_writer.hpp.
Referenced by EndFunctionBody(), schedule_copies(), EdgeCWriter::writeRoutineInstructions_rec(), and writeRoutineInstructions_rec().
|
protected |
string to be printed at the end of a given basic block
Definition at line 133 of file c_writer.hpp.
Referenced by EndFunctionBody(), schedule_copies(), EdgeCWriter::writeRoutineInstructions_rec(), and writeRoutineInstructions_rec().
|
protected |
Definition at line 140 of file c_writer.hpp.
Referenced by EdgeCWriter::writeRoutineInstructions(), writeRoutineInstructions(), EdgeCWriter::writeRoutineInstructions_rec(), and writeRoutineInstructions_rec().
|
protected |
Definition at line 139 of file c_writer.hpp.
Referenced by EdgeCWriter::writeRoutineInstructions(), writeRoutineInstructions(), EdgeCWriter::writeRoutineInstructions_rec(), and writeRoutineInstructions_rec().
|
protected |
Definition at line 138 of file c_writer.hpp.
Referenced by EdgeCWriter::writeRoutineInstructions(), writeRoutineInstructions(), EdgeCWriter::writeRoutineInstructions_rec(), and writeRoutineInstructions_rec().
|
protected |
Counter of the invocations of writeRoutineInstructions; this counter allows to print different labels in differnt tasks to avoid problem due to multiple tasks inlineing.
Definition at line 113 of file c_writer.hpp.
Referenced by EdgeCWriter::writeRoutineInstructions(), and writeRoutineInstructions().
|
protected |
the debug level
Definition at line 122 of file c_writer.hpp.
Referenced by BasicBlocksProfilingCWriter::BasicBlocksProfilingCWriter(), DeclareFunctionTypes(), DeclareLocalVariables(), DeclareType(), DeclareVariable(), EdgeCWriter::EdgeCWriter(), HLSCWriter::HLSCWriter(), HLSCWriter::WriteMainTestbench(), DiscrepancyAnalysisCWriter::WriteMainTestbench(), HLSCWriter::WriteParamInitialization(), EdgeCWriter::writeRoutineInstructions(), writeRoutineInstructions(), EdgeCWriter::writeRoutineInstructions_rec(), writeRoutineInstructions_rec(), and HLSCWriter::WriteSimulatorInitMemory().
Definition at line 145 of file c_writer.hpp.
Referenced by EdgeCWriter::writeRoutineInstructions(), writeRoutineInstructions(), EdgeCWriter::writeRoutineInstructions_rec(), and writeRoutineInstructions_rec().
|
protected |
Definition at line 127 of file c_writer.hpp.
Referenced by create_new_identifier(), and Initialize().
|
protected |
This set contains the list of the non built_in types already declared in the global scope.
Definition at line 104 of file c_writer.hpp.
Referenced by DeclareFunctionTypes(), DeclareType(), Initialize(), and WriteGlobalDeclarations().
|
protected |
Definition at line 106 of file c_writer.hpp.
Referenced by DeclareVariable(), Initialize(), and WriteGlobalDeclarations().
|
protected |
Definition at line 141 of file c_writer.hpp.
Referenced by EdgeCWriter::writeRoutineInstructions(), writeRoutineInstructions(), EdgeCWriter::writeRoutineInstructions_rec(), and writeRoutineInstructions_rec().
|
protected |
the hls manager
Definition at line 95 of file c_writer.hpp.
Referenced by declare_cast_types(), DeclareFunctionTypes(), DiscrepancyAnalysisCWriter::DeclareLocalVariables(), DeclareLocalVariables(), GetLocalVariables(), EdgeCWriter::Initialize(), BasicBlocksProfilingCWriter::print_edge(), StartFunctionBody(), WriteBuiltinWaitCall(), DiscrepancyAnalysisCWriter::WriteExtraInitCode(), HLSCWriter::WriteFile(), WriteFunctionBody(), DiscrepancyAnalysisCWriter::WriteFunctionDeclaration(), WriteFunctionDeclaration(), DiscrepancyAnalysisCWriter::WriteFunctionImplementation(), BasicBlocksProfilingCWriter::WriteGlobalDeclarations(), WriteGlobalDeclarations(), HLSCWriter::WriteHeader(), WriteHeader(), HLSCWriter::WriteMainTestbench(), DiscrepancyAnalysisCWriter::WriteMainTestbench(), HLSCWriter::WriteParamInitialization(), DiscrepancyAnalysisCWriter::writePostInstructionInfo(), DiscrepancyAnalysisCWriter::writePreInstructionInfo(), EdgeCWriter::writeRoutineInstructions(), writeRoutineInstructions(), EdgeCWriter::writeRoutineInstructions_rec(), HLSCWriter::WriteSimulatorInitMemory(), and HLSCWriter::WriteTestbenchFunctionCall().
|
protected |
Represents the stream we are currently writing to.
Definition at line 101 of file c_writer.hpp.
Referenced by compute_phi_nodes(), DiscrepancyAnalysisCWriter::DeclareLocalVariables(), DeclareType(), DeclareVariable(), EndFunctionBody(), BasicBlocksProfilingCWriter::print_edge(), StartFunctionBody(), DiscrepancyAnalysisCWriter::WriteBBHeader(), WriteBuiltinWaitCall(), DiscrepancyAnalysisCWriter::WriteExtraCodeBeforeEveryMainCall(), DiscrepancyAnalysisCWriter::WriteExtraInitCode(), HLSCWriter::WriteFile(), WriteFile(), WriteFunctionDeclaration(), DiscrepancyAnalysisCWriter::WriteGlobalDeclarations(), BasicBlocksProfilingCWriter::WriteGlobalDeclarations(), WriteGlobalDeclarations(), WriteHashTableImplementation(), HLSCWriter::WriteHeader(), EdgeCWriter::WriteHeader(), WriteHeader(), writeInclude(), HLSCWriter::WriteMainTestbench(), DiscrepancyAnalysisCWriter::WriteMainTestbench(), HLSCWriter::WriteParamDecl(), HLSCWriter::WriteParamInitialization(), DiscrepancyAnalysisCWriter::writePostInstructionInfo(), DiscrepancyAnalysisCWriter::writePreInstructionInfo(), EdgeCWriter::writeRoutineInstructions(), writeRoutineInstructions(), EdgeCWriter::writeRoutineInstructions_rec(), writeRoutineInstructions_rec(), HLSCWriter::WriteSimulatorInitMemory(), HLSCWriter::WriteTestbenchFunctionCall(), and DiscrepancyAnalysisCWriter::WriteTestbenchHelperFunctions().
|
protected |
Contains the class used to write instructions.
Definition at line 109 of file c_writer.hpp.
Referenced by DeclareVariable(), getInstructionWriter(), Initialize(), StartFunctionBody(), WriteFunctionDeclaration(), HLSCWriter::WriteGlobalDeclarations(), WriteGlobalDeclarations(), EdgeCWriter::writeRoutineInstructions_rec(), and writeRoutineInstructions_rec().
|
protected |
Definition at line 147 of file c_writer.hpp.
Referenced by writeRoutineInstructions(), and writeRoutineInstructions_rec().
|
protected |
Definition at line 149 of file c_writer.hpp.
Referenced by writeRoutineInstructions(), and writeRoutineInstructions_rec().
|
protected |
Definition at line 148 of file c_writer.hpp.
Referenced by writeRoutineInstructions(), and writeRoutineInstructions_rec().
|
protected |
Definition at line 143 of file c_writer.hpp.
Referenced by EdgeCWriter::writeRoutineInstructions(), writeRoutineInstructions(), EdgeCWriter::writeRoutineInstructions_rec(), and writeRoutineInstructions_rec().
|
protected |
Definition at line 144 of file c_writer.hpp.
Referenced by EdgeCWriter::writeRoutineInstructions(), writeRoutineInstructions(), EdgeCWriter::writeRoutineInstructions_rec(), and writeRoutineInstructions_rec().
|
protected |
Definition at line 142 of file c_writer.hpp.
Referenced by EdgeCWriter::writeRoutineInstructions(), writeRoutineInstructions(), EdgeCWriter::writeRoutineInstructions_rec(), and writeRoutineInstructions_rec().
|
protected |
the output level
Definition at line 125 of file c_writer.hpp.
Referenced by HLSCWriter::WriteFile().
|
protected |
set of parameters
Definition at line 119 of file c_writer.hpp.
Referenced by DiscrepancyAnalysisCWriter::DeclareLocalVariables(), DeclareType(), DiscrepancyAnalysisCWriter::DiscrepancyAnalysisCWriter(), EdgeCWriter::EdgeCWriter(), DiscrepancyAnalysisCWriter::WriteExtraInitCode(), HLSCWriter::WriteFile(), DiscrepancyAnalysisCWriter::WriteGlobalDeclarations(), BasicBlocksProfilingCWriter::WriteGlobalDeclarations(), HLSCWriter::WriteMainTestbench(), DiscrepancyAnalysisCWriter::WriteMainTestbench(), DiscrepancyAnalysisCWriter::writePostInstructionInfo(), HLSCWriter::WriteSimulatorInitMemory(), and HLSCWriter::WriteTestbenchFunctionCall().
Definition at line 146 of file c_writer.hpp.
Referenced by EdgeCWriter::writeRoutineInstructions(), writeRoutineInstructions(), EdgeCWriter::writeRoutineInstructions_rec(), and writeRoutineInstructions_rec().
renaming table used by phi node destruction procedure
Definition at line 136 of file c_writer.hpp.
Referenced by EndFunctionBody(), insert_copies(), schedule_copies(), EdgeCWriter::writeRoutineInstructions_rec(), and writeRoutineInstructions_rec().
|
protected |
The tree manager.
Definition at line 98 of file c_writer.hpp.
Referenced by compute_phi_nodes(), create_new_identifier(), DiscrepancyAnalysisCWriter::DeclareLocalVariables(), DeclareLocalVariables(), DeclareType(), DeclareVariable(), Initialize(), WriteBuiltinWaitCall(), DiscrepancyAnalysisCWriter::WriteExtraInitCode(), HLSCWriter::WriteFile(), DiscrepancyAnalysisCWriter::WriteFunctionDeclaration(), DiscrepancyAnalysisCWriter::WriteFunctionImplementation(), BasicBlocksProfilingCWriter::WriteGlobalDeclarations(), HLSCWriter::WriteHeader(), HLSCWriter::WriteMainTestbench(), DiscrepancyAnalysisCWriter::WriteMainTestbench(), HLSCWriter::WriteParamDecl(), HLSCWriter::WriteParamInitialization(), DiscrepancyAnalysisCWriter::writePostInstructionInfo(), DiscrepancyAnalysisCWriter::writePreInstructionInfo(), EdgeCWriter::writeRoutineInstructions_rec(), writeRoutineInstructions_rec(), and HLSCWriter::WriteSimulatorInitMemory().
|
protected |
Verbosity means that a comment is printed for each line in the output file.
Definition at line 116 of file c_writer.hpp.
Referenced by DeclareType(), DeclareVariable(), EndFunctionBody(), EdgeCWriter::writeRoutineInstructions_rec(), and writeRoutineInstructions_rec().
|
protected |
Definition at line 191 of file c_writer.hpp.
Referenced by Initialize(), and writeInclude().