aboutsummaryrefslogtreecommitdiff
path: root/gcc/sym-exec/expression-is-a-helper.h
blob: 90a5917c843ca755a9ec59869f38201b3bde05ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#ifndef SYM_EXEC_EXPRESSION_IS_A_HELPER_H
#define SYM_EXEC_EXPRESSION_IS_A_HELPER_H

#include "condition.h"
#include "is-a.h"


/* Defining test functions for value conversion via dyn_cast.  */

template <>
template <>
inline bool
is_a_helper <symbolic_bit *>::test (value * ptr)
{
  return ptr->get_type () == value_type::SYMBOLIC_BIT;
}


template <>
template <>
inline bool
is_a_helper <bit *>::test (value * ptr)
{
  return ptr->get_type () == value_type::BIT;
}


template <>
template <>
inline bool
is_a_helper <bit_expression *>::test (value * 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;
}


template <>
template <>
inline bool
is_a_helper <bit_and_expression *>::test (value * ptr)
{
  return ptr->get_type () == value_type::BIT_AND_EXPRESSION;
}


template <>
template <>
inline bool
is_a_helper <bit_or_expression *>::test (value * ptr)
{
  return ptr->get_type () == value_type::BIT_OR_EXPRESSION;
}


template <>
template <>
inline bool
is_a_helper <bit_xor_expression *>::test (value * ptr)
{
  return ptr->get_type () == value_type::BIT_XOR_EXPRESSION;
}


template <>
template <>
inline bool
is_a_helper <bit_complement_expression *>::test (value * ptr)
{
  return ptr->get_type () == value_type::BIT_COMPLEMENT_EXPRESSION;
}


template <>
template <>
inline bool
is_a_helper <shift_left_expression *>::test (value * ptr)
{
  return ptr->get_type () == value_type::SHIFT_LEFT_EXPRESSION;
}


template <>
template <>
inline bool
is_a_helper <shift_right_expression *>::test (value * ptr)
{
  return ptr->get_type () == value_type::SHIFT_RIGHT_EXPRESSION;
}


template <>
template <>
inline bool
is_a_helper <add_expression *>::test (value * ptr)
{
  return ptr->get_type () == value_type::ADD_EXPRESSION;
}


template <>
template <>
inline bool
is_a_helper <sub_expression *>::test (value * ptr)
{
  return ptr->get_type () == value_type::SUB_EXPRESSION;
}


template <>
template <>
inline bool
is_a_helper <bit_condition *>::test (value * ptr)
{
  return ptr->get_type () == value_type::BIT_CONDITION;
}


#endif /* SYM_EXEC_EXPRESSION_IS_A_HELPER_H.  */