mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 23:31:37 +00:00
Make Triple's isOSBinFormatXXX functions partition triple-space.
Most users would be surprised if "isCOFF" and "isMachO" were simultaneously true, unless they'd put the compiler in a box with a gun attached to a photon detector. This makes sure precisely one of the three formats is true for any triple and simplifies some target logic based on that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196934 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8b71466c43
commit
7af55ad434
@ -341,17 +341,17 @@ public:
|
||||
|
||||
/// \brief Tests whether the OS uses the ELF binary format.
|
||||
bool isOSBinFormatELF() const {
|
||||
return !isOSDarwin() && !isOSWindows();
|
||||
return !isOSBinFormatMachO() && !isOSBinFormatCOFF();
|
||||
}
|
||||
|
||||
/// \brief Tests whether the OS uses the COFF binary format.
|
||||
bool isOSBinFormatCOFF() const {
|
||||
return isOSWindows();
|
||||
return getEnvironment() != Triple::ELF &&
|
||||
getEnvironment() != Triple::MachO && isOSWindows();
|
||||
}
|
||||
|
||||
/// \brief Tests whether the environment is MachO.
|
||||
// FIXME: Should this be an OSBinFormat predicate?
|
||||
bool isEnvironmentMachO() const {
|
||||
bool isOSBinFormatMachO() const {
|
||||
return getEnvironment() == Triple::MachO || isOSDarwin();
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,7 @@ public:
|
||||
bool isTargetDarwin() const { return TargetTriple.isOSDarwin(); }
|
||||
bool isTargetNaCl() const { return TargetTriple.isOSNaCl(); }
|
||||
bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
|
||||
bool isTargetELF() const { return !isTargetDarwin(); }
|
||||
bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
|
||||
// ARM EABI is the bare-metal EABI described in ARM ABI documents and
|
||||
// can be accessed via -target arm-none-eabi. This is NOT GNUEABI.
|
||||
// FIXME: Add a flag for bare-metal for that target and set Triple::EABI
|
||||
|
@ -268,7 +268,7 @@ static MCInstPrinter *createARMMCInstPrinter(const Target &T,
|
||||
static MCRelocationInfo *createARMMCRelocationInfo(StringRef TT,
|
||||
MCContext &Ctx) {
|
||||
Triple TheTriple(TT);
|
||||
if (TheTriple.isEnvironmentMachO())
|
||||
if (TheTriple.isOSBinFormatMachO())
|
||||
return createARMMachORelocationInfo(Ctx);
|
||||
// Default to the stock relocation info.
|
||||
return llvm::createMCRelocationInfo(TT, Ctx);
|
||||
|
@ -387,7 +387,7 @@ static MCInstPrinter *createX86MCInstPrinter(const Target &T,
|
||||
static MCRelocationInfo *createX86MCRelocationInfo(StringRef TT,
|
||||
MCContext &Ctx) {
|
||||
Triple TheTriple(TT);
|
||||
if (TheTriple.isEnvironmentMachO() && TheTriple.getArch() == Triple::x86_64)
|
||||
if (TheTriple.isOSBinFormatMachO() && TheTriple.getArch() == Triple::x86_64)
|
||||
return createX86_64MachORelocationInfo(Ctx);
|
||||
else if (TheTriple.isOSBinFormatELF())
|
||||
return createX86_64ELFRelocationInfo(Ctx);
|
||||
|
@ -51,7 +51,7 @@ using namespace llvm;
|
||||
bool X86AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||
SetupMachineFunction(MF);
|
||||
|
||||
if (Subtarget->isTargetCOFF() && !Subtarget->isTargetEnvMacho()) {
|
||||
if (Subtarget->isTargetCOFF()) {
|
||||
bool Intrn = MF.getFunction()->hasInternalLinkage();
|
||||
OutStreamer.BeginCOFFSymbolDef(CurrentFnSym);
|
||||
OutStreamer.EmitCOFFSymbolStorageClass(Intrn ? COFF::IMAGE_SYM_CLASS_STATIC
|
||||
@ -503,7 +503,7 @@ bool X86AsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
|
||||
}
|
||||
|
||||
void X86AsmPrinter::EmitStartOfAsmFile(Module &M) {
|
||||
if (Subtarget->isTargetEnvMacho())
|
||||
if (Subtarget->isTargetMacho())
|
||||
OutStreamer.SwitchSection(getObjFileLowering().getTextSection());
|
||||
|
||||
if (Subtarget->isTargetCOFF()) {
|
||||
@ -530,7 +530,7 @@ void X86AsmPrinter::EmitStartOfAsmFile(Module &M) {
|
||||
|
||||
|
||||
void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
|
||||
if (Subtarget->isTargetEnvMacho()) {
|
||||
if (Subtarget->isTargetMacho()) {
|
||||
// All darwin targets use mach-o.
|
||||
MachineModuleInfoMachO &MMIMacho =
|
||||
MMI->getObjFileInfo<MachineModuleInfoMachO>();
|
||||
@ -631,7 +631,7 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
|
||||
OutStreamer.EmitSymbolAttribute(S, MCSA_Global);
|
||||
}
|
||||
|
||||
if (Subtarget->isTargetCOFF() && !Subtarget->isTargetEnvMacho()) {
|
||||
if (Subtarget->isTargetCOFF()) {
|
||||
X86COFFMachineModuleInfo &COFFMMI =
|
||||
MMI->getObjFileInfo<X86COFFMachineModuleInfo>();
|
||||
|
||||
|
@ -606,7 +606,7 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF) const {
|
||||
// responsible for adjusting the stack pointer. Touching the stack at 4K
|
||||
// increments is necessary to ensure that the guard pages used by the OS
|
||||
// virtual memory manager are allocated in correct sequence.
|
||||
if (NumBytes >= 4096 && STI.isOSWindows() && !STI.isTargetEnvMacho()) {
|
||||
if (NumBytes >= 4096 && STI.isOSWindows() && !STI.isTargetMacho()) {
|
||||
const char *StackProbeSymbol;
|
||||
bool isSPUpdateNeeded = false;
|
||||
|
||||
|
@ -180,7 +180,7 @@ static TargetLoweringObjectFile *createTLOF(X86TargetMachine &TM) {
|
||||
const X86Subtarget *Subtarget = &TM.getSubtarget<X86Subtarget>();
|
||||
bool is64Bit = Subtarget->is64Bit();
|
||||
|
||||
if (Subtarget->isTargetEnvMacho()) {
|
||||
if (Subtarget->isTargetMacho()) {
|
||||
if (is64Bit)
|
||||
return new X86_64MachoTargetObjectFile();
|
||||
return new TargetLoweringObjectFileMachO();
|
||||
@ -190,7 +190,7 @@ static TargetLoweringObjectFile *createTLOF(X86TargetMachine &TM) {
|
||||
return new X86LinuxTargetObjectFile();
|
||||
if (Subtarget->isTargetELF())
|
||||
return new TargetLoweringObjectFileELF();
|
||||
if (Subtarget->isTargetCOFF() && !Subtarget->isTargetEnvMacho())
|
||||
if (Subtarget->isTargetCOFF())
|
||||
return new TargetLoweringObjectFileCOFF();
|
||||
llvm_unreachable("unknown subtarget type");
|
||||
}
|
||||
@ -632,7 +632,7 @@ void X86TargetLowering::resetOperationActions() {
|
||||
setOperationAction(ISD::STACKSAVE, MVT::Other, Expand);
|
||||
setOperationAction(ISD::STACKRESTORE, MVT::Other, Expand);
|
||||
|
||||
if (Subtarget->isOSWindows() && !Subtarget->isTargetEnvMacho())
|
||||
if (Subtarget->isOSWindows() && !Subtarget->isTargetMacho())
|
||||
setOperationAction(ISD::DYNAMIC_STACKALLOC, Subtarget->is64Bit() ?
|
||||
MVT::i64 : MVT::i32, Custom);
|
||||
else if (TM.Options.EnableSegmentedStacks)
|
||||
@ -10799,7 +10799,7 @@ X86TargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op,
|
||||
getTargetMachine().Options.EnableSegmentedStacks) &&
|
||||
"This should be used only on Windows targets or when segmented stacks "
|
||||
"are being used");
|
||||
assert(!Subtarget->isTargetEnvMacho() && "Not implemented");
|
||||
assert(!Subtarget->isTargetMacho() && "Not implemented");
|
||||
SDLoc dl(Op);
|
||||
|
||||
// Get the inputs.
|
||||
@ -15512,7 +15512,7 @@ X86TargetLowering::EmitLoweredWinAlloca(MachineInstr *MI,
|
||||
const TargetInstrInfo *TII = getTargetMachine().getInstrInfo();
|
||||
DebugLoc DL = MI->getDebugLoc();
|
||||
|
||||
assert(!Subtarget->isTargetEnvMacho());
|
||||
assert(!Subtarget->isTargetMacho());
|
||||
|
||||
// The lowering is pretty easy: we're just emitting the call to _alloca. The
|
||||
// non-trivial part is impdef of ESP.
|
||||
|
@ -319,10 +319,11 @@ public:
|
||||
bool isTargetSolaris() const {
|
||||
return TargetTriple.getOS() == Triple::Solaris;
|
||||
}
|
||||
bool isTargetELF() const {
|
||||
return (TargetTriple.getEnvironment() == Triple::ELF ||
|
||||
TargetTriple.isOSBinFormatELF());
|
||||
}
|
||||
|
||||
bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
|
||||
bool isTargetCOFF() const { return TargetTriple.isOSBinFormatCOFF(); }
|
||||
bool isTargetMacho() const { return TargetTriple.isOSBinFormatMachO(); }
|
||||
|
||||
bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
|
||||
bool isTargetNaCl() const { return TargetTriple.isOSNaCl(); }
|
||||
bool isTargetNaCl32() const { return isTargetNaCl() && !is64Bit(); }
|
||||
@ -331,11 +332,6 @@ public:
|
||||
bool isTargetMingw() const { return TargetTriple.getOS() == Triple::MinGW32; }
|
||||
bool isTargetCygwin() const { return TargetTriple.getOS() == Triple::Cygwin; }
|
||||
bool isTargetCygMing() const { return TargetTriple.isOSCygMing(); }
|
||||
bool isTargetCOFF() const {
|
||||
return (TargetTriple.getEnvironment() != Triple::ELF &&
|
||||
TargetTriple.isOSBinFormatCOFF());
|
||||
}
|
||||
bool isTargetEnvMacho() const { return TargetTriple.isEnvironmentMachO(); }
|
||||
|
||||
bool isOSWindows() const { return TargetTriple.isOSWindows(); }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user