LLDB mainline
ArchSpec.cpp File Reference
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StringList.h"
#include "lldb/lldb-defines.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/BinaryFormat/COFF.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/BinaryFormat/MachO.h"
#include "llvm/BinaryFormat/XCOFF.h"
#include "llvm/Support/Compiler.h"
#include "llvm/TargetParser/ARMTargetParser.h"

Go to the source code of this file.

Classes

struct  lldb_private::CoreDefinition
struct  ArchSpecValidator< I >
struct  ArchSpecValidator< ArchSpec::kNumCores >
struct  ArchDefinitionEntry
struct  ArchDefinition

Namespaces

namespace  lldb_private
 A class that represents a running process on the host machine.

Macros

#define AMD_GPU_CORE_DEF_R600(sub)
#define AMD_GPU_CORE_DEF_GCN(sub)
#define CPU_ANY   (UINT32_MAX)
#define SUBTYPE_MASK   0x00FFFFFFu
#define AMD_GPU_ARCH_DEF_R600(sub)
#define AMD_GPU_ARCH_DEF_GCN(sub)

Functions

static bool cores_match (const ArchSpec::Core core1, const ArchSpec::Core core2, bool try_inverse, bool enforce_exact_match)
static const ArchDefinitionFindArchDefinition (ArchitectureType arch_type)
static const CoreDefinitionFindCoreDefinition (llvm::StringRef name)
static const CoreDefinitionFindCoreDefinition (ArchSpec::Core core)
static const ArchDefinitionEntryFindArchDefinitionEntry (const ArchDefinition *def, uint32_t cpu, uint32_t sub)
static const ArchDefinitionEntryFindArchDefinitionEntry (const ArchDefinition *def, ArchSpec::Core core)
static llvm::StringRef GetAMDGPUVariantName (uint32_t sub)
static const ArchDefinitionEntryFindArchDefEntryIfCoreIsValid (const ArchDefinition *def, ArchSpec::Core core)
static uint32_t GetCPUType (const ArchDefinition *def, ArchSpec::Core core)
static uint32_t GetCPUSubType (const ArchDefinition *def, ArchSpec::Core core)
static ArchSpec::Core GetAMDGPUVariantToCoreR600 (llvm::StringRef core_name)
static ArchSpec::Core GetAMDGPUVariantToCoreGCN (llvm::StringRef core_name)
static bool IsCompatibleEnvironment (llvm::Triple::EnvironmentType lhs, llvm::Triple::EnvironmentType rhs)

Variables

static constexpr const CoreDefinition g_core_definitions []
ArchSpecValidator< ArchSpec::eCore_arm_generic > validator
static const ArchDefinitionEntry g_macho_arch_entries []
static const ArchDefinition g_macho_arch_def
static const ArchDefinitionEntry g_elf_arch_entries []
static const ArchDefinition g_elf_arch_def
static const ArchDefinitionEntry g_coff_arch_entries []
static const ArchDefinition g_coff_arch_def
static const ArchDefinitionEntry g_xcoff_arch_entries []
static const ArchDefinition g_xcoff_arch_def
static const ArchDefinitiong_arch_definitions []

Macro Definition Documentation

◆ AMD_GPU_ARCH_DEF_GCN

#define AMD_GPU_ARCH_DEF_GCN ( sub)
Value:
{ArchSpec::eCore_amd_gpu_gcn_##sub, llvm::ELF::EM_AMDGPU, \
llvm::ELF::EF_AMDGPU_MACH_AMDGCN_##sub}

Definition at line 485 of file ArchSpec.cpp.

◆ AMD_GPU_ARCH_DEF_R600

#define AMD_GPU_ARCH_DEF_R600 ( sub)
Value:
{ArchSpec::eCore_amd_gpu_r600_##sub, llvm::ELF::EM_AMDGPU, \
llvm::ELF::EF_AMDGPU_MACH_R600_##sub}

Definition at line 482 of file ArchSpec.cpp.

◆ AMD_GPU_CORE_DEF_GCN

#define AMD_GPU_CORE_DEF_GCN ( sub)
Value:
8, \
4, \
16, \
llvm::Triple::amdgpu, \
ArchSpec::eCore_amd_gpu_gcn_##sub, \
"amdgpu"}

Definition at line 52 of file ArchSpec.cpp.

◆ AMD_GPU_CORE_DEF_R600

#define AMD_GPU_CORE_DEF_R600 ( sub)
Value:
4, \
4, \
16, \
llvm::Triple::r600, \
ArchSpec::eCore_amd_gpu_r600_##sub, \
"r600"}

Definition at line 44 of file ArchSpec.cpp.

◆ CPU_ANY

#define CPU_ANY   (UINT32_MAX)

Definition at line 396 of file ArchSpec.cpp.

◆ SUBTYPE_MASK

#define SUBTYPE_MASK   0x00FFFFFFu

Definition at line 403 of file ArchSpec.cpp.

Function Documentation

◆ cores_match()

bool cores_match ( const ArchSpec::Core core1,
const ArchSpec::Core core2,
bool try_inverse,
bool enforce_exact_match )
static

Definition at line 1568 of file ArchSpec.cpp.

References cores_match(), lldb_private::ArchSpec::eCore_arm_aarch64, lldb_private::ArchSpec::eCore_arm_arm64, lldb_private::ArchSpec::eCore_arm_arm64_32, lldb_private::ArchSpec::eCore_arm_arm64e, lldb_private::ArchSpec::eCore_arm_armv6m, lldb_private::ArchSpec::eCore_arm_armv7, lldb_private::ArchSpec::eCore_arm_armv7em, lldb_private::ArchSpec::eCore_arm_armv7f, lldb_private::ArchSpec::eCore_arm_armv7k, lldb_private::ArchSpec::eCore_arm_armv7l, lldb_private::ArchSpec::eCore_arm_armv7m, lldb_private::ArchSpec::eCore_arm_armv7s, lldb_private::ArchSpec::eCore_arm_armv8, lldb_private::ArchSpec::eCore_arm_armv8l, lldb_private::ArchSpec::eCore_arm_generic, lldb_private::ArchSpec::eCore_mips32, lldb_private::ArchSpec::eCore_mips32el, lldb_private::ArchSpec::eCore_mips32r2, lldb_private::ArchSpec::eCore_mips32r2el, lldb_private::ArchSpec::eCore_mips32r3, lldb_private::ArchSpec::eCore_mips32r3el, lldb_private::ArchSpec::eCore_mips32r5, lldb_private::ArchSpec::eCore_mips32r5el, lldb_private::ArchSpec::eCore_mips32r6, lldb_private::ArchSpec::eCore_mips32r6el, lldb_private::ArchSpec::eCore_mips64, lldb_private::ArchSpec::eCore_mips64el, lldb_private::ArchSpec::eCore_mips64r2, lldb_private::ArchSpec::eCore_mips64r2el, lldb_private::ArchSpec::eCore_mips64r3, lldb_private::ArchSpec::eCore_mips64r3el, lldb_private::ArchSpec::eCore_mips64r5, lldb_private::ArchSpec::eCore_mips64r5el, lldb_private::ArchSpec::eCore_mips64r6, lldb_private::ArchSpec::eCore_mips64r6el, lldb_private::ArchSpec::eCore_x86_64_amd64, lldb_private::ArchSpec::eCore_x86_64_x86_64, lldb_private::ArchSpec::eCore_x86_64_x86_64h, lldb_private::ArchSpec::kCore_any, lldb_private::ArchSpec::kCore_arm_any, lldb_private::ArchSpec::kCore_arm_first, lldb_private::ArchSpec::kCore_arm_last, lldb_private::ArchSpec::kCore_hexagon_any, lldb_private::ArchSpec::kCore_hexagon_first, lldb_private::ArchSpec::kCore_hexagon_last, lldb_private::ArchSpec::kCore_mips32_first, lldb_private::ArchSpec::kCore_mips32_last, lldb_private::ArchSpec::kCore_mips32el_first, lldb_private::ArchSpec::kCore_mips32el_last, lldb_private::ArchSpec::kCore_mips64_first, lldb_private::ArchSpec::kCore_mips64_last, lldb_private::ArchSpec::kCore_mips64el_first, lldb_private::ArchSpec::kCore_mips64el_last, lldb_private::ArchSpec::kCore_ppc64_any, lldb_private::ArchSpec::kCore_ppc64_first, lldb_private::ArchSpec::kCore_ppc64_last, lldb_private::ArchSpec::kCore_ppc_any, lldb_private::ArchSpec::kCore_ppc_first, lldb_private::ArchSpec::kCore_ppc_last, lldb_private::ArchSpec::kCore_thumb_first, lldb_private::ArchSpec::kCore_thumb_last, lldb_private::ArchSpec::kCore_x86_32_any, lldb_private::ArchSpec::kCore_x86_32_first, lldb_private::ArchSpec::kCore_x86_32_last, lldb_private::ArchSpec::kCore_x86_64_any, lldb_private::ArchSpec::kCore_x86_64_first, and lldb_private::ArchSpec::kCore_x86_64_last.

Referenced by cores_match(), and lldb_private::ArchSpec::IsMatch().

◆ FindArchDefEntryIfCoreIsValid()

const ArchDefinitionEntry * FindArchDefEntryIfCoreIsValid ( const ArchDefinition * def,
ArchSpec::Core core )
static

Definition at line 848 of file ArchSpec.cpp.

References FindArchDefinitionEntry(), and FindCoreDefinition().

Referenced by GetCPUSubType(), and GetCPUType().

◆ FindArchDefinition()

const ArchDefinition * FindArchDefinition ( ArchitectureType arch_type)
static

Definition at line 657 of file ArchSpec.cpp.

References g_arch_definitions.

Referenced by lldb_private::ArchSpec::SetArchitecture().

◆ FindArchDefinitionEntry() [1/2]

const ArchDefinitionEntry * FindArchDefinitionEntry ( const ArchDefinition * def,
ArchSpec::Core core )
static

Definition at line 696 of file ArchSpec.cpp.

References ArchDefinition::entries, and ArchDefinition::num_entries.

◆ FindArchDefinitionEntry() [2/2]

const ArchDefinitionEntry * FindArchDefinitionEntry ( const ArchDefinition * def,
uint32_t cpu,
uint32_t sub )
static

◆ FindCoreDefinition() [1/2]

const CoreDefinition * FindCoreDefinition ( ArchSpec::Core core)
inlinestatic

Definition at line 674 of file ArchSpec.cpp.

References g_core_definitions.

◆ FindCoreDefinition() [2/2]

◆ GetAMDGPUVariantName()

llvm::StringRef GetAMDGPUVariantName ( uint32_t sub)
static

◆ GetAMDGPUVariantToCoreGCN()

ArchSpec::Core GetAMDGPUVariantToCoreGCN ( llvm::StringRef core_name)
static

Definition at line 1234 of file ArchSpec.cpp.

References lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1010, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1011, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1012, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1013, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1030, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1031, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1032, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1033, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1034, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1035, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1036, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX10_1_GENERIC, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX10_3_GENERIC, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1100, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1101, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1102, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1103, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1150, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1151, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1152, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1153, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1154, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1170, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1171, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1172, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX11_7_GENERIC, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX11_GENERIC, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1200, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1201, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1250, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1251, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX12_5_GENERIC, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX12_GENERIC, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX1310, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX13_GENERIC, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX600, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX601, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX602, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX700, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX701, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX702, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX703, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX704, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX705, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX801, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX802, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX803, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX805, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX810, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX900, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX902, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX904, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX906, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX908, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX909, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX90A, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX90C, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX942, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX950, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX9_4_GENERIC, lldb_private::ArchSpec::eCore_amd_gpu_gcn_GFX9_GENERIC, and lldb_private::ArchSpec::eCore_amd_gpu_unknown.

Referenced by lldb_private::ArchSpec::UpdateCore().

◆ GetAMDGPUVariantToCoreR600()

◆ GetCPUSubType()

◆ GetCPUType()

uint32_t GetCPUType ( const ArchDefinition * def,
ArchSpec::Core core )
static

◆ IsCompatibleEnvironment()

bool IsCompatibleEnvironment ( llvm::Triple::EnvironmentType lhs,
llvm::Triple::EnvironmentType rhs )
static

Definition at line 1411 of file ArchSpec.cpp.

Referenced by lldb_private::ArchSpec::IsMatch().

Variable Documentation

◆ g_arch_definitions

const ArchDefinition* g_arch_definitions[]
static
Initial value:
= {
static const ArchDefinition g_elf_arch_def
Definition ArchSpec.cpp:608
static const ArchDefinition g_xcoff_arch_def
Definition ArchSpec.cpp:641
static const ArchDefinition g_coff_arch_def
Definition ArchSpec.cpp:627
static const ArchDefinition g_macho_arch_def
Definition ArchSpec.cpp:478

Definition at line 650 of file ArchSpec.cpp.

Referenced by FindArchDefinition().

◆ g_coff_arch_def

const ArchDefinition g_coff_arch_def
static
Initial value:
= {
std::size(g_coff_arch_entries),
"pe-coff",
}
static const ArchDefinitionEntry g_coff_arch_entries[]
Definition ArchSpec.cpp:615

Definition at line 627 of file ArchSpec.cpp.

◆ g_coff_arch_entries

const ArchDefinitionEntry g_coff_arch_entries[]
static
Initial value:
= {
{ArchSpec::eCore_x86_32_i386, llvm::COFF::IMAGE_FILE_MACHINE_I386},
{ArchSpec::eCore_ppc_generic, llvm::COFF::IMAGE_FILE_MACHINE_POWERPC},
{ArchSpec::eCore_ppc_generic, llvm::COFF::IMAGE_FILE_MACHINE_POWERPCFP},
{ArchSpec::eCore_arm_generic, llvm::COFF::IMAGE_FILE_MACHINE_ARM},
{ArchSpec::eCore_arm_armv7, llvm::COFF::IMAGE_FILE_MACHINE_ARMNT},
{ArchSpec::eCore_thumb, llvm::COFF::IMAGE_FILE_MACHINE_THUMB},
{ArchSpec::eCore_x86_64_x86_64, llvm::COFF::IMAGE_FILE_MACHINE_AMD64},
{ArchSpec::eCore_arm_arm64, llvm::COFF::IMAGE_FILE_MACHINE_ARM64}
}

Definition at line 615 of file ArchSpec.cpp.

◆ g_core_definitions

◆ g_elf_arch_def

const ArchDefinition g_elf_arch_def
static
Initial value:
= {
std::size(g_elf_arch_entries),
"elf",
}
static const ArchDefinitionEntry g_elf_arch_entries[]
Definition ArchSpec.cpp:494

Definition at line 608 of file ArchSpec.cpp.

Referenced by lldb_private::ArchSpec::GetElfCPUSubType().

◆ g_elf_arch_entries

const ArchDefinitionEntry g_elf_arch_entries[]
static

Definition at line 494 of file ArchSpec.cpp.

◆ g_macho_arch_def

const ArchDefinition g_macho_arch_def
static
Initial value:
static const ArchDefinitionEntry g_macho_arch_entries[]
Definition ArchSpec.cpp:406

Definition at line 478 of file ArchSpec.cpp.

Referenced by lldb_private::ArchSpec::GetMachOCPUSubType(), and lldb_private::ArchSpec::GetMachOCPUType().

◆ g_macho_arch_entries

const ArchDefinitionEntry g_macho_arch_entries[]
static

Definition at line 406 of file ArchSpec.cpp.

◆ g_xcoff_arch_def

const ArchDefinition g_xcoff_arch_def
static
Initial value:
= {
"xcoff",
}
static const ArchDefinitionEntry g_xcoff_arch_entries[]
Definition ArchSpec.cpp:635

Definition at line 641 of file ArchSpec.cpp.

◆ g_xcoff_arch_entries

const ArchDefinitionEntry g_xcoff_arch_entries[]
static
Initial value:
= {
{ArchSpec::eCore_ppc_generic, llvm::XCOFF::TCPU_PPC},
{ArchSpec::eCore_ppc64_generic, llvm::XCOFF::TCPU_PPC64}
}

Definition at line 635 of file ArchSpec.cpp.

◆ validator

ArchSpecValidator<ArchSpec::eCore_arm_generic> validator

Definition at line 369 of file ArchSpec.cpp.