mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-07 14:33:15 +00:00
[X86] Remove GetCpuIDAndInfo, GetCpuIDAndInfoEx and DetectFamilyModel functions from X86 MC layer. They haven't been used since CPU autodetection was removed from X86Subtarget.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233170 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
afb57c0251
commit
5238b7f47a
@ -55,143 +55,6 @@ std::string X86_MC::ParseX86Triple(StringRef TT) {
|
||||
return FS;
|
||||
}
|
||||
|
||||
/// GetCpuIDAndInfo - Execute the specified cpuid and return the 4 values in the
|
||||
/// specified arguments. If we can't run cpuid on the host, return true.
|
||||
bool X86_MC::GetCpuIDAndInfo(unsigned value, unsigned *rEAX,
|
||||
unsigned *rEBX, unsigned *rECX, unsigned *rEDX) {
|
||||
#if defined(__x86_64__) || defined(_M_AMD64) || defined (_M_X64)
|
||||
#if defined(__GNUC__)
|
||||
// gcc doesn't know cpuid would clobber ebx/rbx. Preseve it manually.
|
||||
asm ("movq\t%%rbx, %%rsi\n\t"
|
||||
"cpuid\n\t"
|
||||
"xchgq\t%%rbx, %%rsi\n\t"
|
||||
: "=a" (*rEAX),
|
||||
"=S" (*rEBX),
|
||||
"=c" (*rECX),
|
||||
"=d" (*rEDX)
|
||||
: "a" (value));
|
||||
return false;
|
||||
#elif defined(_MSC_VER)
|
||||
int registers[4];
|
||||
__cpuid(registers, value);
|
||||
*rEAX = registers[0];
|
||||
*rEBX = registers[1];
|
||||
*rECX = registers[2];
|
||||
*rEDX = registers[3];
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
#elif defined(i386) || defined(__i386__) || defined(__x86__) || defined(_M_IX86)
|
||||
#if defined(__GNUC__)
|
||||
asm ("movl\t%%ebx, %%esi\n\t"
|
||||
"cpuid\n\t"
|
||||
"xchgl\t%%ebx, %%esi\n\t"
|
||||
: "=a" (*rEAX),
|
||||
"=S" (*rEBX),
|
||||
"=c" (*rECX),
|
||||
"=d" (*rEDX)
|
||||
: "a" (value));
|
||||
return false;
|
||||
#elif defined(_MSC_VER)
|
||||
__asm {
|
||||
mov eax,value
|
||||
cpuid
|
||||
mov esi,rEAX
|
||||
mov dword ptr [esi],eax
|
||||
mov esi,rEBX
|
||||
mov dword ptr [esi],ebx
|
||||
mov esi,rECX
|
||||
mov dword ptr [esi],ecx
|
||||
mov esi,rEDX
|
||||
mov dword ptr [esi],edx
|
||||
}
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// GetCpuIDAndInfoEx - Execute the specified cpuid with subleaf and return the
|
||||
/// 4 values in the specified arguments. If we can't run cpuid on the host,
|
||||
/// return true.
|
||||
bool X86_MC::GetCpuIDAndInfoEx(unsigned value, unsigned subleaf, unsigned *rEAX,
|
||||
unsigned *rEBX, unsigned *rECX, unsigned *rEDX) {
|
||||
#if defined(__x86_64__) || defined(_M_AMD64) || defined (_M_X64)
|
||||
#if defined(__GNUC__)
|
||||
// gcc desn't know cpuid would clobber ebx/rbx. Preseve it manually.
|
||||
asm ("movq\t%%rbx, %%rsi\n\t"
|
||||
"cpuid\n\t"
|
||||
"xchgq\t%%rbx, %%rsi\n\t"
|
||||
: "=a" (*rEAX),
|
||||
"=S" (*rEBX),
|
||||
"=c" (*rECX),
|
||||
"=d" (*rEDX)
|
||||
: "a" (value),
|
||||
"c" (subleaf));
|
||||
return false;
|
||||
#elif defined(_MSC_VER)
|
||||
int registers[4];
|
||||
__cpuidex(registers, value, subleaf);
|
||||
*rEAX = registers[0];
|
||||
*rEBX = registers[1];
|
||||
*rECX = registers[2];
|
||||
*rEDX = registers[3];
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
#elif defined(i386) || defined(__i386__) || defined(__x86__) || defined(_M_IX86)
|
||||
#if defined(__GNUC__)
|
||||
asm ("movl\t%%ebx, %%esi\n\t"
|
||||
"cpuid\n\t"
|
||||
"xchgl\t%%ebx, %%esi\n\t"
|
||||
: "=a" (*rEAX),
|
||||
"=S" (*rEBX),
|
||||
"=c" (*rECX),
|
||||
"=d" (*rEDX)
|
||||
: "a" (value),
|
||||
"c" (subleaf));
|
||||
return false;
|
||||
#elif defined(_MSC_VER)
|
||||
__asm {
|
||||
mov eax,value
|
||||
mov ecx,subleaf
|
||||
cpuid
|
||||
mov esi,rEAX
|
||||
mov dword ptr [esi],eax
|
||||
mov esi,rEBX
|
||||
mov dword ptr [esi],ebx
|
||||
mov esi,rECX
|
||||
mov dword ptr [esi],ecx
|
||||
mov esi,rEDX
|
||||
mov dword ptr [esi],edx
|
||||
}
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void X86_MC::DetectFamilyModel(unsigned EAX, unsigned &Family,
|
||||
unsigned &Model) {
|
||||
Family = (EAX >> 8) & 0xf; // Bits 8 - 11
|
||||
Model = (EAX >> 4) & 0xf; // Bits 4 - 7
|
||||
if (Family == 6 || Family == 0xf) {
|
||||
if (Family == 0xf)
|
||||
// Examine extended family ID if family ID is F.
|
||||
Family += (EAX >> 20) & 0xff; // Bits 20 - 27
|
||||
// Examine extended model ID if family ID is 6 or F.
|
||||
Model += ((EAX >> 16) & 0xf) << 4; // Bits 16 - 19
|
||||
}
|
||||
}
|
||||
|
||||
unsigned X86_MC::getDwarfRegFlavour(Triple TT, bool isEH) {
|
||||
if (TT.getArch() == Triple::x86_64)
|
||||
return DWARFFlavour::X86_64;
|
||||
|
@ -53,18 +53,6 @@ namespace N86 {
|
||||
namespace X86_MC {
|
||||
std::string ParseX86Triple(StringRef TT);
|
||||
|
||||
/// GetCpuIDAndInfo - Execute the specified cpuid and return the 4 values in
|
||||
/// the specified arguments. If we can't run cpuid on the host, return true.
|
||||
bool GetCpuIDAndInfo(unsigned value, unsigned *rEAX,
|
||||
unsigned *rEBX, unsigned *rECX, unsigned *rEDX);
|
||||
/// GetCpuIDAndInfoEx - Execute the specified cpuid with subleaf and return
|
||||
/// the 4 values in the specified arguments. If we can't run cpuid on the
|
||||
/// host, return true.
|
||||
bool GetCpuIDAndInfoEx(unsigned value, unsigned subleaf, unsigned *rEAX,
|
||||
unsigned *rEBX, unsigned *rECX, unsigned *rEDX);
|
||||
|
||||
void DetectFamilyModel(unsigned EAX, unsigned &Family, unsigned &Model);
|
||||
|
||||
unsigned getDwarfRegFlavour(Triple TT, bool isEH);
|
||||
|
||||
void InitLLVM2SEHRegisterMapping(MCRegisterInfo *MRI);
|
||||
|
Loading…
x
Reference in New Issue
Block a user