5 #ifndef LODESTAR_EXECUTOR_HPP
6 #define LODESTAR_EXECUTOR_HPP
8 #include "Lodestar/blocks/BlockPack.hpp"
9 #include "Lodestar/blocks/aux/StronglyConnectedComponents.hpp"
10 #include <Lodestar/cli/ExecuteCommand.hpp>
16 #define FMT_HEADER_ONLY
18 #include <fmt/format.h>
25 Executor() : blockPack(), executionOrder(1)
29 executionOrder(bp.blocks)
35 void computeExecutionOrder()
37 blockPack.makeGraph();
38 executionOrder = blockPack.blocks;
39 components = StronglyConnectedComponents::findComponents(blockPack.graph);
41 ::std::stable_sort(executionOrder.begin(),
49 ::std::reverse(executionOrder.begin(),
50 executionOrder.end());
53 void applyExecutionOrder()
56 for (
auto &blk: executionOrder) {
62 void resolveExecutionOrder()
64 computeExecutionOrder();
65 applyExecutionOrder();
73 for (
auto blk: executionOrder)
78 ::std::vector<BlockProto *> executionOrder{};
82 makeDotFile(::std::stringstream &ss,
bool lineLabels =
true,
83 bool slotLabels =
false,
float rankSep = 2,
87 makeSimpleDotFile(::std::stringstream &ss,
bool lineLabels =
true,
88 bool slotLabels =
false,
float rankSep = 2,
92 getAsciiGraph(
bool lineLabels =
true,
93 bool slotLabels =
false,
float rankSep = 2,
96 unsigned long getComponentSize()
const;
100 replace(::std::string &str, const ::std::string &from,
101 const ::std::string &to)
103 str = ::std::regex_replace(str, ::std::regex(from), to);
117 #endif //LODESTAR_EXECUTOR_HPP