Bump GDB's version number to 15.0.91.DATE-git.
[binutils-gdb.git] / gdb / amdgpu-tdep.h
blob2656d18e72752c76d1bd9d0263a421374a5f9ff8
1 /* Target-dependent code for the AMDGPU architectures.
3 Copyright (C) 2019-2024 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 #ifndef AMDGPU_TDEP_H
21 #define AMDGPU_TDEP_H
23 #include "gdbarch.h"
25 #include <amd-dbgapi/amd-dbgapi.h>
26 #include <unordered_map>
28 /* Provide std::unordered_map::Hash for amd_dbgapi_register_id_t. */
29 struct register_id_hash
31 size_t
32 operator() (const amd_dbgapi_register_id_t &register_id) const
34 return std::hash<decltype (register_id.handle)> () (register_id.handle);
38 /* Provide std::unordered_map::Equal for amd_dbgapi_register_id_t. */
39 struct register_id_equal_to
41 bool
42 operator() (const amd_dbgapi_register_id_t &lhs,
43 const amd_dbgapi_register_id_t &rhs) const
45 return std::equal_to<decltype (lhs.handle)> () (lhs.handle, rhs.handle);
49 /* AMDGPU architecture specific information. */
50 struct amdgpu_gdbarch_tdep : gdbarch_tdep_base
52 /* This architecture's breakpoint instruction. */
53 gdb::unique_xmalloc_ptr<gdb_byte> breakpoint_instruction_bytes;
54 size_t breakpoint_instruction_size;
56 /* A vector of register_ids indexed by their equivalent gdb regnum. */
57 std::vector<amd_dbgapi_register_id_t> register_ids;
59 /* A vector of register_properties indexed by their equivalent gdb regnum. */
60 std::vector<amd_dbgapi_register_properties_t> register_properties;
62 /* A vector of register names indexed by their equivalent gdb regnum. */
63 std::vector<std::string> register_names;
65 /* A vector of register types created from the amd-dbgapi type strings,
66 indexed by their equivalent gdb regnum. These are computed lazily by
67 amdgpu_register_type, entries that haven't been computed yet are
68 nullptr. */
69 std::vector<type *> register_types;
71 /* A vector of GDB register numbers indexed by DWARF register number.
73 Unused DWARF register numbers map to value -1. */
74 std::vector<int> dwarf_regnum_to_gdb_regnum;
76 /* A map of gdb regnums keyed by they equivalent register_id. */
77 std::unordered_map<amd_dbgapi_register_id_t, int, register_id_hash,
78 register_id_equal_to>
79 regnum_map;
81 /* A map of register_class_ids keyed by their name. */
82 std::unordered_map<std::string, amd_dbgapi_register_class_id_t>
83 register_class_map;
86 /* Return true if GDBARCH is of an AMDGPU architecture. */
87 bool is_amdgpu_arch (struct gdbarch *gdbarch);
89 /* Return the amdgpu-specific data associated to ARCH. */
91 amdgpu_gdbarch_tdep *get_amdgpu_gdbarch_tdep (gdbarch *arch);
93 #endif /* AMDGPU_TDEP_H */