46 using Writer = rapidjson::PrettyWriter<rapidjson::StringBuffer>;
47 using PathAndType = std::pair<cstring, cstring>;
51 bool operator()(
const PathAndType &lhs,
const PathAndType &rhs)
const;
59 std::set<cstring> m_includePaths;
60 std::set<cstring> m_defines;
72 GraphOutput(
const cstring path_in,
const gress_t gress_in,
const cstring type_in,
73 const cstring format_in =
".dot"_cs)
74 : m_path(path_in), m_gress(gress_in), m_type(type_in), m_format(format_in) {}
78 cstring getHash()
const {
return m_path + toString(m_gress) + m_type + m_format; }
81 struct GraphOutputCmp {
82 bool operator()(
const GraphOutput &lhs,
const GraphOutput &rhs)
const {
83 return std::less<const char *>()(lhs.getHash().c_str(), rhs.getHash().c_str());
92 std::set<PathAndType, PathCmp> m_resources;
94 std::set<PathAndType, PathCmp> m_logs;
95 std::set<GraphOutput, GraphOutputCmp> m_graphs;
102 std::map<unsigned int, cstring> m_pipes;
104 std::map<unsigned int, OutputFiles *> m_pipeOutputs;
105 InputFiles m_programInputs;
106 cstring m_eventLogPath, m_frontendIrLogPath;
112 std::ofstream m_manifestStream;
114 bool m_success =
false;
120 OutputFiles *getPipeOutputs(
unsigned int pipe);
126 void postorder(
const IR::BFN::TnaParser *parser)
override;
127 void postorder(
const IR::BFN::TnaControl *control)
override;
131 m_refMap = refMap_in;
134 void setPipe(
int pipe_ID,
const cstring pipe_name);
136 void setSuccess(
const bool success) { m_success = success; }
138 void addContext(
const int pipe,
const cstring path) { getPipeOutputs(pipe)->m_context = path; }
139 void addResources(
const int pipe,
const cstring path,
const cstring type =
"resources"_cs) {
140 getPipeOutputs(pipe)->m_resources.insert(PathAndType(path, type));
142 void addGraph(
int pipe,
const cstring graphType,
const cstring graphName,
const gress_t gress,
143 const cstring extension_including_the_leading_period =
".dot"_cs);
144 void addLog(
int pipe,
const cstring logType,
const cstring logName);
146 void setSourceInfo(
const cstring sourceInfo_in) {
147 BUG_CHECK(m_programInputs.m_sourceInfo.size() == 0,
148 "Trying to redefine path to source info!");
149 m_programInputs.m_sourceInfo = sourceInfo_in;
151 void setEventLog(
const cstring eventLogPath_in) {
152 BUG_CHECK(m_eventLogPath.size() == 0,
"Trying to redefine path to source info!");
153 m_eventLogPath = eventLogPath_in;
155 void setFrontendIrLog(
const cstring frontendIrLogPath_in) {
156 BUG_CHECK(m_frontendIrLogPath.size() == 0,
"Trying to redefine path to frontend IR!");
157 m_frontendIrLogPath = frontendIrLogPath_in;
164 void serialize_target_data(Writer &);
167 void serializePipes(Writer &);
169 void sendTo(Writer &,
int pipe, gress_t);