/* Defining test functions for value conversion via dyn_cast. Copyright (C) 2022-2025 Free Software Foundation, Inc. Contributed by Matevos Mehrabyan This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see . */ #ifndef SYM_EXEC_EXPRESSION_IS_A_HELPER_H #define SYM_EXEC_EXPRESSION_IS_A_HELPER_H #include "sym-exec-condition.h" /* Test function used by dyn_cast checks if the value_bit is of the value_type::SYMBOLIC_BIT type. */ template<> template<> inline bool is_a_helper::test (value_bit *ptr) { return ptr->get_type () == value_type::SYMBOLIC_BIT; } /* Test function used by dyn_cast checks if the value_bit is of the value_type::BIT type. */ template<> template<> inline bool is_a_helper::test (value_bit *ptr) { return ptr->get_type () == value_type::BIT; } /* Test function used by dyn_cast checks if the value_bit is a bit_expression. */ template<> template<> inline bool is_a_helper::test (value_bit *ptr) { value_type type = ptr->get_type (); return type == value_type::BIT_AND_EXPRESSION || type == value_type::BIT_OR_EXPRESSION || type == value_type::BIT_XOR_EXPRESSION || type == value_type::BIT_COMPLEMENT_EXPRESSION || type == value_type::SHIFT_RIGHT_EXPRESSION || type == value_type::SHIFT_LEFT_EXPRESSION || type == value_type::ADD_EXPRESSION || type == value_type::SUB_EXPRESSION || type == value_type::BIT_CONDITION; } /* Test function used by dyn_cast checks if the value_bit is a bit_and_expression. */ template<> template<> inline bool is_a_helper::test (value_bit *ptr) { return ptr->get_type () == value_type::BIT_AND_EXPRESSION; } /* Test function used by dyn_cast checks if the value_bit is a bit_or_expression. */ template<> template<> inline bool is_a_helper::test (value_bit *ptr) { return ptr->get_type () == value_type::BIT_OR_EXPRESSION; } /* Test function used by dyn_cast checks if the value_bit is a bit_xor_expression. */ template<> template<> inline bool is_a_helper::test (value_bit *ptr) { return ptr->get_type () == value_type::BIT_XOR_EXPRESSION; } /* Test function used by dyn_cast checks if the value_bit is a bit_complement_expression. */ template<> template<> inline bool is_a_helper::test (value_bit *ptr) { return ptr->get_type () == value_type::BIT_COMPLEMENT_EXPRESSION; } /* Test function used by dyn_cast checks if the value_bit is a shift_left_expression. */ template<> template<> inline bool is_a_helper::test (value_bit *ptr) { return ptr->get_type () == value_type::SHIFT_LEFT_EXPRESSION; } /* Test function used by dyn_cast checks if the value_bit is a shift_right_expression. */ template<> template<> inline bool is_a_helper::test (value_bit *ptr) { return ptr->get_type () == value_type::SHIFT_RIGHT_EXPRESSION; } /* Test function used by dyn_cast checks if the value_bit is an add_expression. */ template<> template<> inline bool is_a_helper::test (value_bit *ptr) { return ptr->get_type () == value_type::ADD_EXPRESSION; } /* Test function used by dyn_cast checks if the value_bit is a sub_expression. */ template<> template<> inline bool is_a_helper::test (value_bit *ptr) { return ptr->get_type () == value_type::SUB_EXPRESSION; } /* Test function used by dyn_cast checks if the value_bit is a bit_condition. */ template<> template<> inline bool is_a_helper::test (value_bit *ptr) { return ptr->get_type () == value_type::BIT_CONDITION; } /* Test function used by dyn_cast checks if the bit_expression is a bit_and_expression. */ template<> template<> inline bool is_a_helper::test (bit_expression *ptr) { return ptr->get_type () == value_type::BIT_AND_EXPRESSION; } /* Test function used by dyn_cast checks if the bit_expression is a bit_or_expression. */ template<> template<> inline bool is_a_helper::test (bit_expression *ptr) { return ptr->get_type () == value_type::BIT_OR_EXPRESSION; } /* Test function used by dyn_cast checks if the bit_expression is a bit_xor_expression. */ template<> template<> inline bool is_a_helper::test (bit_expression *ptr) { return ptr->get_type () == value_type::BIT_XOR_EXPRESSION; } /* Test function used by dyn_cast checks if the bit_expression is a bit_complement_expression. */ template<> template<> inline bool is_a_helper::test (bit_expression *ptr) { return ptr->get_type () == value_type::BIT_COMPLEMENT_EXPRESSION; } /* Test function used by dyn_cast checks if the bit_expression is a shift_left_expression. */ template<> template<> inline bool is_a_helper::test (bit_expression *ptr) { return ptr->get_type () == value_type::SHIFT_LEFT_EXPRESSION; } /* Test function used by dyn_cast checks if the bit_expression is a shift_right_expression. */ template<> template<> inline bool is_a_helper::test (bit_expression *ptr) { return ptr->get_type () == value_type::SHIFT_RIGHT_EXPRESSION; } /* Test function used by dyn_cast checks if the bit_expression is a add_expression. */ template<> template<> inline bool is_a_helper::test (bit_expression *ptr) { return ptr->get_type () == value_type::ADD_EXPRESSION; } /* Test function used by dyn_cast checks if the bit_expression is a sub_expression. */ template<> template<> inline bool is_a_helper::test (bit_expression *ptr) { return ptr->get_type () == value_type::SUB_EXPRESSION; } /* Test function used by dyn_cast checks if the bit_expression is a bit_condition_expression. */ template<> template<> inline bool is_a_helper::test (bit_expression *ptr) { return ptr->get_type () == value_type::BIT_CONDITION; } #endif /* SYM_EXEC_EXPRESSION_IS_A_HELPER_H. */