8#include <unordered_map>
32 std::string filename_;
33 std::string function_;
95 return static_cast<ElementType>(
static_cast<uint64_t
>(lhs) |
static_cast<uint64_t
>(rhs));
99 return static_cast<ElementType>(
static_cast<uint64_t
>(lhs) &
static_cast<uint64_t
>(rhs));
103 return static_cast<ElementType>(~static_cast<uint64_t>(type));
108 return (
static_cast<uint64_t
>(type) &
static_cast<uint64_t
>(mask)) != 0;
117 return "interstate_edge";
119 return "access_node";
121 return "constant_node";
125 return "library_node";
135 return "assignment_block";
185 const std::string&
metadata(
const std::string& key)
const;
189 const std::unordered_map<std::string, std::string>&
metadata()
const;
248 return (element !=
nullptr && Target::classof(*element)) ?
static_cast<Target*
>(element) :
nullptr;
254 return (element !=
nullptr && Target::classof(*element)) ?
static_cast<const Target*
>(element) :
nullptr;
261 if (!Target::classof(element)) {
264 return static_cast<Target&
>(element);
270 if (!Target::classof(element)) {
273 return static_cast<const Target&
>(element);
std::string filename() const
size_t end_column() const
std::string function() const
static DebugInfo merge(const DebugInfo &left, const DebugInfo &right)
DebugInfo(std::string filename, size_t start_line, size_t start_column, size_t end_line, size_t end_column)
size_t start_column() const
DebugInfo(std::string filename, std::string function, size_t start_line, size_t start_column, size_t end_line, size_t end_column)
size_t start_line() const
void remove_metadata(const std::string &key)
void set_debug_info(const DebugInfo &debug_info)
size_t element_id_
Definition element.h:166
const std::string * metadata_if_exists(const std::string &key) const
const std::unordered_map< std::string, std::string > & metadata() const
virtual void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression)=0
void add_metadata(const std::string &key, const std::string &value)
Element(size_t element_id, const DebugInfo &debug_info)
size_t element_id() const
const std::string & metadata(const std::string &key) const
const DebugInfo & debug_info() const
virtual void replace(const symbolic::ExpressionMapping &replacements)
DebugInfo debug_info_
Definition element.h:167
std::string_view element_type() const
Returns the type of the element as a human-readable string.
Definition element.h:199
virtual ~Element()=default
std::unordered_map< std::string, std::string > metadata_
Definition element.h:168
virtual void validate(const Function &function) const =0
Validates the element.
virtual ElementType type_id() const =0
Returns the type of the element.
Definition exceptions.h:8
Definition sdfg_builder.h:13
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 structured_sdfg_deep_copy.h:8
Definition json_serializer.h:22
SymEngine::RCP< const SymEngine::Basic > Expression
Reference-counted pointer to a symbolic expression (SymEngine Basic).
Definition symbolic.h:83
SymEngine::map_basic_basic ExpressionMapping
Definition symbolic.h:109
Definition function_builder.h:10
Definition structured_sdfg_deep_copy.h:6
Definition cutout_serializer.h:13
constexpr ElementType operator~(ElementType type)
Definition element.h:102
constexpr bool is_a(ElementType type, ElementType mask)
Tests whether type is contained in the category mask (efficient, branch-free type check).
Definition element.h:107
constexpr ElementType operator|(ElementType lhs, ElementType rhs)
Bitwise combination of element types, enabling category masks.
Definition element.h:94
constexpr std::string_view element_type_name(ElementType type)
Returns the type of an element as a human-readable string (no allocation).
Definition element.h:112
std::remove_pointer_t< std::remove_reference_t< T > > element_cast_target_t
Resolves the concrete target type for isa/dyn_cast, accepting the type itself (Block),...
Definition element.h:222
ElementType
Definition element.h:72
@ AccessNode
Definition element.h:75
@ IfElse
Definition element.h:84
@ For
Definition element.h:88
@ While
Definition element.h:85
@ Sequence
Definition element.h:82
@ State
Definition element.h:73
@ Map
Definition element.h:89
@ Tasklet
Definition element.h:77
@ AssignmentBlock
Definition element.h:83
@ LibraryNode
Definition element.h:78
@ Memlet
Definition element.h:79
@ Return
Definition element.h:80
@ Continue
Definition element.h:86
@ ConstantNode
Definition element.h:76
@ Block
Definition element.h:81
@ Break
Definition element.h:87
@ Reduce
Definition element.h:90
@ InterstateEdge
Definition element.h:74
element_cast_target_t< T > * dyn_cast(Element *element)
Efficient down-cast to T, or nullptr if element is not a T.
Definition element.h:246
bool isa(const Element &element)
LLVM-style RTTI check: true if element belongs to type category T.
Definition element.h:235
std::ostream & operator<<(std::ostream &os, ElementType type)
Definition element.h:154
constexpr ElementType operator&(ElementType lhs, ElementType rhs)
Definition element.h:98
size_t ElementId
Definition element.h:215
Symbolic system for integer-based symbol analysis.