mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
X86: Encode the 'h' cpu subtype in the MachO header for x86.
llvm-svn: 194906
This commit is contained in:
parent
733e6d6386
commit
56d800bb1e
@ -948,7 +948,8 @@ namespace llvm {
|
|||||||
|
|
||||||
CPU_SUBTYPE_X86_ALL = 3,
|
CPU_SUBTYPE_X86_ALL = 3,
|
||||||
CPU_SUBTYPE_X86_64_ALL = 3,
|
CPU_SUBTYPE_X86_64_ALL = 3,
|
||||||
CPU_SUBTYPE_X86_ARCH1 = 4
|
CPU_SUBTYPE_X86_ARCH1 = 4,
|
||||||
|
CPU_SUBTYPE_X86_64_H = 8
|
||||||
};
|
};
|
||||||
static inline int CPU_SUBTYPE_INTEL(int Family, int Model) {
|
static inline int CPU_SUBTYPE_INTEL(int Family, int Model) {
|
||||||
return Family | (Model << 4);
|
return Family | (Model << 4);
|
||||||
|
@ -221,7 +221,7 @@ static Triple::ArchType parseArch(StringRef ArchName) {
|
|||||||
.Cases("i386", "i486", "i586", "i686", Triple::x86)
|
.Cases("i386", "i486", "i586", "i686", Triple::x86)
|
||||||
// FIXME: Do we need to support these?
|
// FIXME: Do we need to support these?
|
||||||
.Cases("i786", "i886", "i986", Triple::x86)
|
.Cases("i786", "i886", "i986", Triple::x86)
|
||||||
.Cases("amd64", "x86_64", Triple::x86_64)
|
.Cases("amd64", "x86_64", "x86_64h", Triple::x86_64)
|
||||||
.Case("powerpc", Triple::ppc)
|
.Case("powerpc", Triple::ppc)
|
||||||
.Cases("powerpc64", "ppu", Triple::ppc64)
|
.Cases("powerpc64", "ppu", Triple::ppc64)
|
||||||
.Case("powerpc64le", Triple::ppc64le)
|
.Case("powerpc64le", Triple::ppc64le)
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include "MCTargetDesc/X86BaseInfo.h"
|
#include "MCTargetDesc/X86BaseInfo.h"
|
||||||
#include "MCTargetDesc/X86FixupKinds.h"
|
#include "MCTargetDesc/X86FixupKinds.h"
|
||||||
|
#include "llvm/ADT/StringSwitch.h"
|
||||||
#include "llvm/MC/MCAsmBackend.h"
|
#include "llvm/MC/MCAsmBackend.h"
|
||||||
#include "llvm/MC/MCAssembler.h"
|
#include "llvm/MC/MCAssembler.h"
|
||||||
#include "llvm/MC/MCELFObjectWriter.h"
|
#include "llvm/MC/MCELFObjectWriter.h"
|
||||||
@ -732,17 +733,19 @@ public:
|
|||||||
|
|
||||||
class DarwinX86_64AsmBackend : public DarwinX86AsmBackend {
|
class DarwinX86_64AsmBackend : public DarwinX86AsmBackend {
|
||||||
bool SupportsCU;
|
bool SupportsCU;
|
||||||
|
const MachO::CPUSubTypeX86 Subtype;
|
||||||
public:
|
public:
|
||||||
DarwinX86_64AsmBackend(const Target &T, const MCRegisterInfo &MRI,
|
DarwinX86_64AsmBackend(const Target &T, const MCRegisterInfo &MRI,
|
||||||
StringRef CPU, bool SupportsCU)
|
StringRef CPU, bool SupportsCU,
|
||||||
: DarwinX86AsmBackend(T, MRI, CPU, true), SupportsCU(SupportsCU) {
|
MachO::CPUSubTypeX86 st)
|
||||||
|
: DarwinX86AsmBackend(T, MRI, CPU, true), SupportsCU(SupportsCU),
|
||||||
|
Subtype(st) {
|
||||||
HasReliableSymbolDifference = true;
|
HasReliableSymbolDifference = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
|
MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
|
||||||
return createX86MachObjectWriter(OS, /*Is64Bit=*/true,
|
return createX86MachObjectWriter(OS, /*Is64Bit=*/true,
|
||||||
MachO::CPU_TYPE_X86_64,
|
MachO::CPU_TYPE_X86_64, Subtype);
|
||||||
MachO::CPU_SUBTYPE_X86_64_ALL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool doesSectionRequireSymbols(const MCSection &Section) const {
|
virtual bool doesSectionRequireSymbols(const MCSection &Section) const {
|
||||||
@ -811,10 +814,15 @@ MCAsmBackend *llvm::createX86_64AsmBackend(const Target &T,
|
|||||||
StringRef CPU) {
|
StringRef CPU) {
|
||||||
Triple TheTriple(TT);
|
Triple TheTriple(TT);
|
||||||
|
|
||||||
if (TheTriple.isOSDarwin() || TheTriple.getEnvironment() == Triple::MachO)
|
if (TheTriple.isOSDarwin() || TheTriple.getEnvironment() == Triple::MachO) {
|
||||||
|
MachO::CPUSubTypeX86 CS =
|
||||||
|
StringSwitch<MachO::CPUSubTypeX86>(TheTriple.getArchName())
|
||||||
|
.Case("x86_64h", MachO::CPU_SUBTYPE_X86_64_H)
|
||||||
|
.Default(MachO::CPU_SUBTYPE_X86_64_ALL);
|
||||||
return new DarwinX86_64AsmBackend(T, MRI, CPU,
|
return new DarwinX86_64AsmBackend(T, MRI, CPU,
|
||||||
TheTriple.isMacOSX() &&
|
TheTriple.isMacOSX() &&
|
||||||
!TheTriple.isMacOSXVersionLT(10, 7));
|
!TheTriple.isMacOSXVersionLT(10, 7), CS);
|
||||||
|
}
|
||||||
|
|
||||||
if (TheTriple.isOSWindows() && TheTriple.getEnvironment() != Triple::ELF)
|
if (TheTriple.isOSWindows() && TheTriple.getEnvironment() != Triple::ELF)
|
||||||
return new WindowsX86AsmBackend(T, true, CPU);
|
return new WindowsX86AsmBackend(T, true, CPU);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user