1 /* Copyright (C) 2017-2020 Free Software Foundation, Inc.
3 This file is part of GDB.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 #include "gdbsupport/tdesc.h"
23 /* Supported ARC ISAs. */
26 ARC_ISA_ARCV1
= 1, /* a.k.a. ARCompact (ARC600, ARC700) */
27 ARC_ISA_ARCV2
/* such as ARC EM and ARC HS */
30 struct arc_arch_features
32 arc_arch_features (int reg_size
, arc_isa isa
)
33 : reg_size (reg_size
), isa (isa
)
36 /* Register size in bytes. Possible values are 4, and 8. A 0 indicates
37 an uninitialised value. */
40 /* See ARC_ISA enum. */
43 /* Equality operator. */
44 bool operator== (const struct arc_arch_features
&rhs
) const
46 return (reg_size
== rhs
.reg_size
&& isa
== rhs
.isa
);
49 /* Inequality operator. */
50 bool operator!= (const struct arc_arch_features
&rhs
) const
52 return !(*this == rhs
);
55 /* Used by std::unordered_map to hash the feature sets. The hash is
56 calculated in the manner below:
60 std::size_t hash () const noexcept
62 std::size_t val
= ((reg_size
& 0x1f) << 8 | (isa
& 0xf) << 0);
69 /* Create and return a target description that is compatible with FEATURES.
70 The only external client of this must be the gdbserver which manipulates
73 target_desc
*arc_create_target_description
74 (const struct arc_arch_features
&features
);
78 /* Lookup the cache for a target description matching the FEATURES.
79 If nothing is found, then create one and return it. */
81 const target_desc
*arc_lookup_target_description
82 (const struct arc_arch_features
&features
);
84 #endif /* GDBSERVER */
87 #endif /* ARCH_ARC_H */