mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 00:32:55 +00:00
Remove TargetOptions.h dependency from X86Subtarget.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133726 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
75d33878ab
commit
ef41ff618f
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "X86.h"
|
#include "X86.h"
|
||||||
#include "X86InstrBuilder.h"
|
#include "X86InstrBuilder.h"
|
||||||
|
#include "X86ISelLowering.h"
|
||||||
#include "X86RegisterInfo.h"
|
#include "X86RegisterInfo.h"
|
||||||
#include "X86Subtarget.h"
|
#include "X86Subtarget.h"
|
||||||
#include "X86TargetMachine.h"
|
#include "X86TargetMachine.h"
|
||||||
@ -1493,7 +1494,8 @@ bool X86FastISel::DoSelectCall(const Instruction *I, const char *MemIntName) {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Fast-isel doesn't know about callee-pop yet.
|
// Fast-isel doesn't know about callee-pop yet.
|
||||||
if (Subtarget->IsCalleePop(isVarArg, CC))
|
if (X86::isCalleePop(CC, Subtarget->is64Bit(), isVarArg,
|
||||||
|
GuaranteedTailCallOpt))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Check whether the function can return without sret-demotion.
|
// Check whether the function can return without sret-demotion.
|
||||||
|
@ -1898,7 +1898,7 @@ X86TargetLowering::LowerFormalArguments(SDValue Chain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Some CCs need callee pop.
|
// Some CCs need callee pop.
|
||||||
if (Subtarget->IsCalleePop(isVarArg, CallConv)) {
|
if (X86::isCalleePop(CallConv, Is64Bit, isVarArg, GuaranteedTailCallOpt)) {
|
||||||
FuncInfo->setBytesToPopOnReturn(StackSize); // Callee pops everything.
|
FuncInfo->setBytesToPopOnReturn(StackSize); // Callee pops everything.
|
||||||
} else {
|
} else {
|
||||||
FuncInfo->setBytesToPopOnReturn(0); // Callee pops nothing.
|
FuncInfo->setBytesToPopOnReturn(0); // Callee pops nothing.
|
||||||
@ -2383,7 +2383,7 @@ X86TargetLowering::LowerCall(SDValue Chain, SDValue Callee,
|
|||||||
|
|
||||||
// Create the CALLSEQ_END node.
|
// Create the CALLSEQ_END node.
|
||||||
unsigned NumBytesForCalleeToPush;
|
unsigned NumBytesForCalleeToPush;
|
||||||
if (Subtarget->IsCalleePop(isVarArg, CallConv))
|
if (X86::isCalleePop(CallConv, Is64Bit, isVarArg, GuaranteedTailCallOpt))
|
||||||
NumBytesForCalleeToPush = NumBytes; // Callee pops everything
|
NumBytesForCalleeToPush = NumBytes; // Callee pops everything
|
||||||
else if (!Is64Bit && !IsTailCallConvention(CallConv) && IsStructRet)
|
else if (!Is64Bit && !IsTailCallConvention(CallConv) && IsStructRet)
|
||||||
// If this is a call to a struct-return function, the callee
|
// If this is a call to a struct-return function, the callee
|
||||||
@ -2876,6 +2876,29 @@ bool X86::isOffsetSuitableForCodeModel(int64_t Offset, CodeModel::Model M,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// isCalleePop - Determines whether the callee is required to pop its
|
||||||
|
/// own arguments. Callee pop is necessary to support tail calls.
|
||||||
|
bool X86::isCalleePop(CallingConv::ID CallingConv,
|
||||||
|
bool is64Bit, bool IsVarArg, bool TailCallOpt) {
|
||||||
|
if (IsVarArg)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
switch (CallingConv) {
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
case CallingConv::X86_StdCall:
|
||||||
|
return !is64Bit;
|
||||||
|
case CallingConv::X86_FastCall:
|
||||||
|
return !is64Bit;
|
||||||
|
case CallingConv::X86_ThisCall:
|
||||||
|
return !is64Bit;
|
||||||
|
case CallingConv::Fast:
|
||||||
|
return TailCallOpt;
|
||||||
|
case CallingConv::GHC:
|
||||||
|
return TailCallOpt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// TranslateX86CC - do a one to one translation of a ISD::CondCode to the X86
|
/// TranslateX86CC - do a one to one translation of a ISD::CondCode to the X86
|
||||||
/// specific condition code, returning the condition code and the LHS/RHS of the
|
/// specific condition code, returning the condition code and the LHS/RHS of the
|
||||||
/// comparison to make.
|
/// comparison to make.
|
||||||
|
@ -466,6 +466,12 @@ namespace llvm {
|
|||||||
/// fit into displacement field of the instruction.
|
/// fit into displacement field of the instruction.
|
||||||
bool isOffsetSuitableForCodeModel(int64_t Offset, CodeModel::Model M,
|
bool isOffsetSuitableForCodeModel(int64_t Offset, CodeModel::Model M,
|
||||||
bool hasSymbolicDisplacement = true);
|
bool hasSymbolicDisplacement = true);
|
||||||
|
|
||||||
|
|
||||||
|
/// isCalleePop - Determines whether the callee is required to pop its
|
||||||
|
/// own arguments. Callee pop is necessary to support tail calls.
|
||||||
|
bool isCalleePop(CallingConv::ID CallingConv,
|
||||||
|
bool is64Bit, bool IsVarArg, bool TailCallOpt);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include "llvm/Support/Host.h"
|
#include "llvm/Support/Host.h"
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
#include "llvm/Target/TargetOptions.h"
|
|
||||||
#include "llvm/ADT/SmallVector.h"
|
#include "llvm/ADT/SmallVector.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -286,7 +285,7 @@ void X86Subtarget::AutoDetectSubtargetFeatures() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
X86Subtarget::X86Subtarget(const std::string &TT, const std::string &FS,
|
X86Subtarget::X86Subtarget(const std::string &TT, const std::string &FS,
|
||||||
bool is64Bit)
|
bool is64Bit, unsigned StackAlignOverride)
|
||||||
: PICStyle(PICStyles::None)
|
: PICStyle(PICStyles::None)
|
||||||
, X86SSELevel(NoMMXSSE)
|
, X86SSELevel(NoMMXSSE)
|
||||||
, X863DNowLevel(NoThreeDNow)
|
, X863DNowLevel(NoThreeDNow)
|
||||||
@ -308,10 +307,6 @@ X86Subtarget::X86Subtarget(const std::string &TT, const std::string &FS,
|
|||||||
, TargetTriple(TT)
|
, TargetTriple(TT)
|
||||||
, Is64Bit(is64Bit) {
|
, Is64Bit(is64Bit) {
|
||||||
|
|
||||||
// default to hard float ABI
|
|
||||||
if (FloatABIType == FloatABI::Default)
|
|
||||||
FloatABIType = FloatABI::Hard;
|
|
||||||
|
|
||||||
// Determine default and user specified characteristics
|
// Determine default and user specified characteristics
|
||||||
if (!FS.empty()) {
|
if (!FS.empty()) {
|
||||||
// If feature string is not empty, parse features string.
|
// If feature string is not empty, parse features string.
|
||||||
@ -346,33 +341,9 @@ X86Subtarget::X86Subtarget(const std::string &TT, const std::string &FS,
|
|||||||
|
|
||||||
// Stack alignment is 16 bytes on Darwin, FreeBSD, Linux and Solaris (both
|
// Stack alignment is 16 bytes on Darwin, FreeBSD, Linux and Solaris (both
|
||||||
// 32 and 64 bit) and for all 64-bit targets.
|
// 32 and 64 bit) and for all 64-bit targets.
|
||||||
if (isTargetDarwin() || isTargetFreeBSD() || isTargetLinux() ||
|
if (StackAlignOverride)
|
||||||
isTargetSolaris() || Is64Bit)
|
stackAlignment = StackAlignOverride;
|
||||||
|
else if (isTargetDarwin() || isTargetFreeBSD() || isTargetLinux() ||
|
||||||
|
isTargetSolaris() || Is64Bit)
|
||||||
stackAlignment = 16;
|
stackAlignment = 16;
|
||||||
|
|
||||||
if (StackAlignment)
|
|
||||||
stackAlignment = StackAlignment;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// IsCalleePop - Determines whether the callee is required to pop its
|
|
||||||
/// own arguments. Callee pop is necessary to support tail calls.
|
|
||||||
bool X86Subtarget::IsCalleePop(bool IsVarArg,
|
|
||||||
CallingConv::ID CallingConv) const {
|
|
||||||
if (IsVarArg)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
switch (CallingConv) {
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
case CallingConv::X86_StdCall:
|
|
||||||
return !is64Bit();
|
|
||||||
case CallingConv::X86_FastCall:
|
|
||||||
return !is64Bit();
|
|
||||||
case CallingConv::X86_ThisCall:
|
|
||||||
return !is64Bit();
|
|
||||||
case CallingConv::Fast:
|
|
||||||
return GuaranteedTailCallOpt;
|
|
||||||
case CallingConv::GHC:
|
|
||||||
return GuaranteedTailCallOpt;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,8 @@ public:
|
|||||||
/// This constructor initializes the data members to match that
|
/// This constructor initializes the data members to match that
|
||||||
/// of the specified triple.
|
/// of the specified triple.
|
||||||
///
|
///
|
||||||
X86Subtarget(const std::string &TT, const std::string &FS, bool is64Bit);
|
X86Subtarget(const std::string &TT, const std::string &FS, bool is64Bit,
|
||||||
|
unsigned StackAlignOverride);
|
||||||
|
|
||||||
/// getStackAlignment - Returns the minimum alignment known to hold of the
|
/// getStackAlignment - Returns the minimum alignment known to hold of the
|
||||||
/// stack frame on entry to the function and which must be maintained by every
|
/// stack frame on entry to the function and which must be maintained by every
|
||||||
@ -248,9 +249,6 @@ public:
|
|||||||
/// indicating the number of scheduling cycles of backscheduling that
|
/// indicating the number of scheduling cycles of backscheduling that
|
||||||
/// should be attempted.
|
/// should be attempted.
|
||||||
unsigned getSpecialAddressLatency() const;
|
unsigned getSpecialAddressLatency() const;
|
||||||
|
|
||||||
/// IsCalleePop - Test whether a function should pop its own arguments.
|
|
||||||
bool IsCalleePop(bool isVarArg, CallingConv::ID CallConv) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
@ -117,7 +117,7 @@ X86_64TargetMachine::X86_64TargetMachine(const Target &T, const std::string &TT,
|
|||||||
X86TargetMachine::X86TargetMachine(const Target &T, const std::string &TT,
|
X86TargetMachine::X86TargetMachine(const Target &T, const std::string &TT,
|
||||||
const std::string &FS, bool is64Bit)
|
const std::string &FS, bool is64Bit)
|
||||||
: LLVMTargetMachine(T, TT),
|
: LLVMTargetMachine(T, TT),
|
||||||
Subtarget(TT, FS, is64Bit),
|
Subtarget(TT, FS, is64Bit, StackAlignment),
|
||||||
FrameLowering(*this, Subtarget),
|
FrameLowering(*this, Subtarget),
|
||||||
ELFWriterInfo(is64Bit, true) {
|
ELFWriterInfo(is64Bit, true) {
|
||||||
DefRelocModel = getRelocationModel();
|
DefRelocModel = getRelocationModel();
|
||||||
@ -182,6 +182,10 @@ X86TargetMachine::X86TargetMachine(const Target &T, const std::string &TT,
|
|||||||
// Finally, if we have "none" as our PIC style, force to static mode.
|
// Finally, if we have "none" as our PIC style, force to static mode.
|
||||||
if (Subtarget.getPICStyle() == PICStyles::None)
|
if (Subtarget.getPICStyle() == PICStyles::None)
|
||||||
setRelocationModel(Reloc::Static);
|
setRelocationModel(Reloc::Static);
|
||||||
|
|
||||||
|
// default to hard float ABI
|
||||||
|
if (FloatABIType == FloatABI::Default)
|
||||||
|
FloatABIType = FloatABI::Hard;
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user