11#include "ir/gen-tree-macro.h"
12#include "lib/castable.h"
13#include "lib/cstring.h"
14#include "lib/exceptions.h"
16#include "lib/source_file.h"
32template <
class,
class =
void>
45 virtual const Node *getNode()
const = 0;
46 virtual Node *getNode() = 0;
48 virtual cstring node_type_name()
const = 0;
49 virtual void validate()
const {}
53 std::enable_if_t<!has_static_type_name_v<T>,
const T *> checkedTo()
const {
60 std::enable_if_t<has_static_type_name_v<T>,
const T *> checkedTo()
const {
61 const auto *result =
to<T>();
62 BUG_CHECK(result,
"Cast failed: %1% with type %2% is not a %3%.",
this, node_type_name(),
63 T::static_type_name());
68 bool hasAnnotation(
cstring)
const;
69 const Annotation *getAnnotation(
cstring)
const;
72 DECLARE_TYPEINFO_WITH_TYPEID(
INode, NodeKind::INode);
const T * checkedTo() const
Performs a checked cast. A BUG occurs if the cast fails.
Definition castable.h:45
Definition stringify.h:33
Definition ir/vector.h:59
Definition json_generator.h:30
Definition json_loader.h:32
Definition source_file.h:223
Definition constantParsing.h:22
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:13
T * to() noexcept
Definition rtti.h:226