LLDB mainline
RegisterInfos_x86_64_with_base_shared.cpp
Go to the documentation of this file.
1//===-- RegisterInfos_x86_64_with_base_shared.cpp--------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10
11#include "lldb/lldb-defines.h"
12#include <cassert>
13#include <mutex>
14
15using namespace lldb;
16
17namespace lldb_private {
18
35
56
89
150
155
162
179
196
213
238
239RegInfo &GetRegInfoShared(llvm::Triple::ArchType arch_type, bool with_base) {
240 static std::once_flag once_flag_x86, once_flag_x86_64,
241 once_flag_x86_64_with_base;
242 static RegInfo reg_info_x86, reg_info_x86_64, reg_info_x86_64_with_base, reg_info_invalid;
243
244 switch (arch_type) {
245 case llvm::Triple::x86:
246 std::call_once(once_flag_x86, []() {
247 reg_info_x86.num_registers = k_num_registers_i386;
251 reg_info_x86.last_gpr = k_last_gpr_i386;
252 reg_info_x86.first_fpr = k_first_fpr_i386;
253 reg_info_x86.last_fpr = k_last_fpr_i386;
254 reg_info_x86.first_st = lldb_st0_i386;
255 reg_info_x86.last_st = lldb_st7_i386;
256 reg_info_x86.first_mm = lldb_mm0_i386;
257 reg_info_x86.last_mm = lldb_mm7_i386;
258 reg_info_x86.first_xmm = lldb_xmm0_i386;
259 reg_info_x86.last_xmm = lldb_xmm7_i386;
260 reg_info_x86.first_ymm = lldb_ymm0_i386;
261 reg_info_x86.last_ymm = lldb_ymm7_i386;
262 reg_info_x86.first_dr = lldb_dr0_i386;
263 reg_info_x86.gpr_flags = lldb_eflags_i386;
264 });
265
266 return reg_info_x86;
267 case llvm::Triple::x86_64:
268 if (with_base) {
269 std::call_once(once_flag_x86_64_with_base, []() {
270 reg_info_x86_64_with_base.num_registers =
272 reg_info_x86_64_with_base.num_gpr_registers =
274 reg_info_x86_64_with_base.num_fpr_registers =
276 reg_info_x86_64_with_base.num_avx_registers =
278 reg_info_x86_64_with_base.last_gpr = x86_64_with_base::k_last_gpr;
279 reg_info_x86_64_with_base.first_fpr = x86_64_with_base::k_first_fpr;
280 reg_info_x86_64_with_base.last_fpr = x86_64_with_base::k_last_fpr;
281 reg_info_x86_64_with_base.first_st = x86_64_with_base::lldb_st0;
282 reg_info_x86_64_with_base.last_st = x86_64_with_base::lldb_st7;
283 reg_info_x86_64_with_base.first_mm = x86_64_with_base::lldb_mm0;
284 reg_info_x86_64_with_base.last_mm = x86_64_with_base::lldb_mm7;
285 reg_info_x86_64_with_base.first_xmm = x86_64_with_base::lldb_xmm0;
286 reg_info_x86_64_with_base.last_xmm = x86_64_with_base::lldb_xmm15;
287 reg_info_x86_64_with_base.first_ymm = x86_64_with_base::lldb_ymm0;
288 reg_info_x86_64_with_base.last_ymm = x86_64_with_base::lldb_ymm15;
289 reg_info_x86_64_with_base.first_dr = x86_64_with_base::lldb_dr0;
290 reg_info_x86_64_with_base.gpr_flags = x86_64_with_base::lldb_rflags;
291 });
292
293 return reg_info_x86_64_with_base;
294 } else {
295 std::call_once(once_flag_x86_64, []() {
296 reg_info_x86_64.num_registers = k_num_registers_x86_64;
300 reg_info_x86_64.last_gpr = k_last_gpr_x86_64;
301 reg_info_x86_64.first_fpr = k_first_fpr_x86_64;
302 reg_info_x86_64.last_fpr = k_last_fpr_x86_64;
303 reg_info_x86_64.first_st = lldb_st0_x86_64;
304 reg_info_x86_64.last_st = lldb_st7_x86_64;
305 reg_info_x86_64.first_mm = lldb_mm0_x86_64;
306 reg_info_x86_64.last_mm = lldb_mm7_x86_64;
307 reg_info_x86_64.first_xmm = lldb_xmm0_x86_64;
308 reg_info_x86_64.last_xmm = lldb_xmm15_x86_64;
309 reg_info_x86_64.first_ymm = lldb_ymm0_x86_64;
310 reg_info_x86_64.last_ymm = lldb_ymm15_x86_64;
311 reg_info_x86_64.first_dr = lldb_dr0_x86_64;
312 reg_info_x86_64.gpr_flags = lldb_rflags_x86_64;
313 });
314 return reg_info_x86_64;
315 }
316 default:
317 assert(false && "Unhandled target architecture.");
318 return reg_info_invalid;
319 }
320}
321
322} // namespace lldb_private
#define LLDB_INVALID_REGNUM
A class that represents a running process on the host machine.
RegInfo & GetRegInfoShared(llvm::Triple::ArchType arch_type, bool with_base)