pslang/libs/ir/source/node.cpp

65 lines
836 B
C++

#include <pslang/ir/node.hpp>
namespace pslang::ir
{
namespace
{
struct visitor
{
template <typename Node>
bool operator()(Node const &)
{
return true;
}
bool operator()(label const &)
{
return false;
}
bool operator()(global const &)
{
return false;
}
bool operator()(store const &)
{
return false;
}
bool operator()(assignment const &)
{
return false;
}
bool operator()(jump const &)
{
return false;
}
bool operator()(jump_if_zero const &)
{
return false;
}
bool operator()(jump_if_nonzero const &)
{
return false;
}
bool operator()(return_value const &)
{
return false;
}
};
}
bool is_value_instruction(instruction const & instruction)
{
return std::visit(visitor{}, instruction);
}
}