Merge branch 'master' into merge-job
[deliverable/binutils-gdb.git] / gdb / amdgcn-rocm-tdep.h
1 /* Target-dependent code the amdgcn architecture.
2
3 Copyright (C) 2019-2020 Free Software Foundation, Inc.
4 Copyright (C) 2019-2020 Advanced Micro Devices, Inc. All rights reserved.
5
6 This file is part of GDB.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20
21 #ifndef AMDGCN_TDEP_H
22 #define AMDGCN_TDEP_H
23
24 #include <gdbsupport/gdb_unique_ptr.h>
25
26 #include <unordered_map>
27
28 #include <amd-dbgapi.h>
29
30 /* Provide std::unordered_map::Hash for amd_dbgapi_register_id_t. */
31 struct register_id_hash
32 {
33 size_t
34 operator() (const amd_dbgapi_register_id_t &register_id) const
35 {
36 return std::hash<decltype (register_id.handle)> () (register_id.handle);
37 }
38 };
39
40 /* Provide std::unordered_map::Equal for amd_dbgapi_register_id_t. */
41 struct register_id_equal_to
42 {
43 bool
44 operator() (const amd_dbgapi_register_id_t &lhs,
45 const amd_dbgapi_register_id_t &rhs) const
46 {
47 return std::equal_to<decltype (lhs.handle)> () (lhs.handle, rhs.handle);
48 }
49 };
50
51 /* amdgcn architecture specific information. */
52 struct gdbarch_tdep
53 {
54 /* This architecture's breakpoint instruction. */
55 gdb::unique_xmalloc_ptr<gdb_byte> breakpoint_instruction_bytes;
56 size_t breakpoint_instruction_size;
57
58 /* A vector of register_ids indexed by their equivalent gdb regnum. */
59 std::vector<amd_dbgapi_register_id_t> register_ids;
60 /* A vector of register names indexed by their equivalent gdb regnum. */
61 std::vector<std::string> register_names;
62 /* A map of gdb regnums keyed by they equivalent register_id. */
63 std::unordered_map<amd_dbgapi_register_id_t, int, register_id_hash,
64 register_id_equal_to>
65 regnum_map;
66 /* A map of register_class_ids keyed by their name. */
67 std::unordered_map<std::string, amd_dbgapi_register_class_id_t>
68 register_class_map;
69 /* A cache of vector types. */
70 std::unordered_map<std::string, struct type *> vector_type_map;
71 };
72
73 #endif /* amdgcn-rocm-tdep.h */
This page took 0.033296 seconds and 4 git commands to generate.