4#include <nlohmann/json_fwd.hpp>
16#include "symengine/logic.h"
17#include "symengine/printers/codegen.h"
27 void json_to_map_node(
28 const nlohmann::json& j,
33 void json_to_reduce_node(
34 const nlohmann::json& j,
55 std::unique_ptr<sdfg::StructuredSDFG>
deserialize(nlohmann::json& j);
81 const nlohmann::json& j,
89 const nlohmann::json& j,
95 const nlohmann::json& j,
100 const nlohmann::json& j,
105 const nlohmann::json& j,
110 const nlohmann::json& j,
115 const nlohmann::json& j,
120 const nlohmann::json& j,
125 const nlohmann::json& j,
130 const nlohmann::json& j,
136 const nlohmann::json& j,
140 std::unique_ptr<sdfg::types::IType>
json_to_type(
const nlohmann::json& j);
157 using SymEngine::CodePrinter::apply;
158 using SymEngine::CodePrinter::bvisit;
159 using SymEngine::CodePrinter::str_;
162 void bvisit(
const SymEngine::BooleanAtom& x);
167 void bvisit(
const SymEngine::Equality& x);
168 void bvisit(
const SymEngine::Unequality& x);
170 void bvisit(
const SymEngine::LessThan& x);
171 void bvisit(
const SymEngine::StrictLessThan& x);
214 const nlohmann::json& j,
254 mutable std::mutex mutex_;
255 std::unordered_map<std::string, LibraryNodeSerializerFn> factory_map_;
Definition structured_sdfg.h:30
Note: Even though the class references unique_ptr, it will never delete an SDFG it has a reference to...
Definition structured_sdfg_builder.h:44
Definition data_flow_graph.h:29
Base class for all library nodes in the dataflow graph.
Definition library_node.h:106
JSONSerializer(bool recurse=true)
Definition json_serializer.h:40
void json_to_structured_loop_node(const nlohmann::json &j, sdfg::builder::StructuredSDFGBuilder &builder, sdfg::structured_control_flow::Sequence &parent)
void parse_legacy_transition_to_assignment_block(const nlohmann::json &j, sdfg::builder::StructuredSDFGBuilder &builder, sdfg::structured_control_flow::Sequence &parent)
ScheduleType json_to_schedule_type(const nlohmann::json &j)
types::StorageType json_to_storage_type(const nlohmann::json &j)
void return_node_to_json(nlohmann::json &j, const sdfg::structured_control_flow::Return &return_node)
void json_to_continue_node(const nlohmann::json &j, sdfg::builder::StructuredSDFGBuilder &builder, sdfg::structured_control_flow::Sequence &parent)
void json_to_dataflow(const nlohmann::json &j, sdfg::builder::StructuredSDFGBuilder &builder, sdfg::structured_control_flow::Block &parent)
static std::string expression(const symbolic::Expression expr)
void dataflow_to_json(nlohmann::json &j, const sdfg::data_flow::DataFlowGraph &dataflow)
symbolic::Expression json_to_expr(const nlohmann::json &j)
std::unique_ptr< sdfg::types::IType > json_to_type(const nlohmann::json &j)
virtual nlohmann::json serialize(const sdfg::StructuredSDFG &sdfg, analysis::AnalysisManager *analysis_manager=nullptr, structured_control_flow::Sequence *root=nullptr)
void structured_loop_to_json(nlohmann::json &j, const sdfg::structured_control_flow::StructuredLoop &loop_node)
void structure_definition_to_json(nlohmann::json &j, const sdfg::types::StructureDefinition &definition)
std::vector< std::pair< std::string, types::Scalar > > json_to_arguments(const nlohmann::json &j)
void block_to_json(nlohmann::json &j, const sdfg::structured_control_flow::Block &block)
void json_to_break_node(const nlohmann::json &j, sdfg::builder::StructuredSDFGBuilder &builder, sdfg::structured_control_flow::Sequence &parent)
static void element_metadata_to_json(nlohmann::json &j, const sdfg::Element &element)
void debug_info_to_json(nlohmann::json &j, const sdfg::DebugInfo &debug_info)
void json_to_return_node(const nlohmann::json &j, sdfg::builder::StructuredSDFGBuilder &builder, sdfg::structured_control_flow::Sequence &parent)
bool skip_empty_transitions
Definition json_serializer.h:43
void json_to_if_else_node(const nlohmann::json &j, sdfg::builder::StructuredSDFGBuilder &builder, sdfg::structured_control_flow::Sequence &parent)
void json_to_block_node(const nlohmann::json &j, sdfg::builder::StructuredSDFGBuilder &builder, sdfg::structured_control_flow::Sequence &parent)
void json_to_structure_definition(const nlohmann::json &j, sdfg::builder::StructuredSDFGBuilder &builder)
void type_to_json(nlohmann::json &j, const sdfg::types::IType &type)
void json_to_while_node(const nlohmann::json &j, sdfg::builder::StructuredSDFGBuilder &builder, sdfg::structured_control_flow::Sequence &parent)
DebugInfo json_to_debug_info(const nlohmann::json &j)
void storage_type_to_json(nlohmann::json &j, const sdfg::types::StorageType &storage_type)
void assignment_block_to_json(nlohmann::json &j, const structured_control_flow::AssignmentBlock &block)
void break_node_to_json(nlohmann::json &j, const sdfg::structured_control_flow::Break &break_node)
void json_to_sequence(const nlohmann::json &j, sdfg::builder::StructuredSDFGBuilder &builder, sdfg::structured_control_flow::Sequence &sequence)
void sequence_to_json(nlohmann::json &j, const sdfg::structured_control_flow::Sequence &sequence)
void while_node_to_json(nlohmann::json &j, const sdfg::structured_control_flow::While &while_node)
static void writeToFile(const StructuredSDFG &sdfg, const std::filesystem::path &file)
void serialize_node(nlohmann::json &j, const structured_control_flow::ControlFlowNode &node)
control_flow::Assignments parse_assignments(const nlohmann::json &assignments_arr)
void if_else_to_json(nlohmann::json &j, const sdfg::structured_control_flow::IfElse &if_else_node)
std::unique_ptr< sdfg::StructuredSDFG > deserialize(nlohmann::json &j)
void schedule_type_to_json(nlohmann::json &j, const sdfg::structured_control_flow::ScheduleType &schedule_type)
void continue_node_to_json(nlohmann::json &j, const sdfg::structured_control_flow::Continue &continue_node)
void json_to_assignment_block(const nlohmann::json &j, sdfg::builder::StructuredSDFGBuilder &builder, sdfg::structured_control_flow::Sequence &parent)
Definition json_serializer.h:155
void bvisit(const SymEngine::Min &x)
void bvisit(const SymEngine::Xor &expr)
void bvisit(const SymEngine::Unequality &x)
void bvisit(const SymEngine::StrictLessThan &x)
void bvisit(const SymEngine::BooleanAtom &x)
void bvisit(const SymEngine::Not &expr)
void bvisit(const SymEngine::And &expr)
void bvisit(const SymEngine::Max &x)
void bvisit(const SymEngine::Or &expr)
void bvisit(const SymEngine::Equality &x)
void bvisit(const SymEngine::LessThan &x)
Registry for library node serializers.
Definition json_serializer.h:252
void register_library_node_serializer(std::string library_node_code, LibraryNodeSerializerFn fn)
LibraryNodeSerializerFn get_library_node_serializer(std::string library_node_code)
static LibraryNodeSerializerRegistry & instance()
Definition json_serializer.h:258
Base class for library node serialization.
Definition json_serializer.h:195
virtual ~LibraryNodeSerializer()=default
virtual data_flow::LibraryNode & deserialize(const nlohmann::json &j, sdfg::builder::StructuredSDFGBuilder &builder, sdfg::structured_control_flow::Block &parent)=0
Deserialize a library node from JSON.
virtual nlohmann::json serialize(const sdfg::data_flow::LibraryNode &library_node)=0
Serialize a library node to JSON.
A control flow node representing a basic block with dataflow computations.
Definition block.h:42
Represents a break statement that exits the innermost loop.
Definition while.h:93
Represents a continue statement that skips to the next loop iteration.
Definition while.h:128
Base class for all structured control flow nodes in a StructuredSDFG.
Definition control_flow_node.h:44
Represents a conditional if-else control flow node with multiple cases.
Definition if_else.h:47
Represents a return statement that exits the function with a value.
Definition return.h:32
Represents a schedule type for Map nodes.
Definition structured_loop.h:31
A sequential container of control flow nodes.
Definition sequence.h:52
Base class for structured loop constructs.
Definition structured_loop.h:244
Represents a while-loop with condition-controlled iteration.
Definition while.h:37
Abstract base interface for all types in the sdfglib type system.
Definition type.h:625
Represents the storage location and management characteristics of data.
Definition type.h:64
Defines the layout and members of a structure type.
Definition structure.h:120
SymEngine::RCP< const SymEngine::Basic > Expression
Reference-counted pointer to a symbolic expression (SymEngine Basic).
Definition symbolic.h:83
Definition function_builder.h:10
symbolic::SymbolMap Assignments
Type alias for symbol assignments on interstate edges.
Definition interstate_edge.h:30
Definition cutout_serializer.h:13
std::function< std::unique_ptr< LibraryNodeSerializer >()> LibraryNodeSerializerFn
Definition json_serializer.h:220
void register_default_serializers()
Core type system definitions for sdfglib.