mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-26 05:32:25 +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 "X86InstrBuilder.h"
|
||||
#include "X86ISelLowering.h"
|
||||
#include "X86RegisterInfo.h"
|
||||
#include "X86Subtarget.h"
|
||||
#include "X86TargetMachine.h"
|
||||
@ -1493,7 +1494,8 @@ bool X86FastISel::DoSelectCall(const Instruction *I, const char *MemIntName) {
|
||||
return false;
|
||||
|
||||
// Fast-isel doesn't know about callee-pop yet.
|
||||
if (Subtarget->IsCalleePop(isVarArg, CC))
|
||||
if (X86::isCalleePop(CC, Subtarget->is64Bit(), isVarArg,
|
||||
GuaranteedTailCallOpt))
|
||||
return false;
|
||||
|
||||
// Check whether the function can return without sret-demotion.
|
||||
|
@ -1898,7 +1898,7 @@ X86TargetLowering::LowerFormalArguments(SDValue Chain,
|
||||
}
|
||||
|
||||
// Some CCs need callee pop.
|
||||
if (Subtarget->IsCalleePop(isVarArg, CallConv)) {
|
||||
if (X86::isCalleePop(CallConv, Is64Bit, isVarArg, GuaranteedTailCallOpt)) {
|
||||
FuncInfo->setBytesToPopOnReturn(StackSize); // Callee pops everything.
|
||||
} else {
|
||||
FuncInfo->setBytesToPopOnReturn(0); // Callee pops nothing.
|
||||
@ -2383,7 +2383,7 @@ X86TargetLowering::LowerCall(SDValue Chain, SDValue Callee,
|
||||
|
||||
// Create the CALLSEQ_END node.
|
||||
unsigned NumBytesForCalleeToPush;
|
||||
if (Subtarget->IsCalleePop(isVarArg, CallConv))
|
||||
if (X86::isCalleePop(CallConv, Is64Bit, isVarArg, GuaranteedTailCallOpt))
|
||||
NumBytesForCalleeToPush = NumBytes; // Callee pops everything
|
||||
else if (!Is64Bit && !IsTailCallConvention(CallConv) && IsStructRet)
|
||||
// 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;
|
||||
}
|
||||
|
||||
/// 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
|
||||
/// specific condition code, returning the condition code and the LHS/RHS of the
|
||||
/// comparison to make.
|
||||
|
@ -466,6 +466,12 @@ namespace llvm {
|
||||
/// fit into displacement field of the instruction.
|
||||
bool isOffsetSuitableForCodeModel(int64_t Offset, CodeModel::Model M,
|
||||
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/Host.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
using namespace llvm;
|
||||
|
||||
@ -286,7 +285,7 @@ void X86Subtarget::AutoDetectSubtargetFeatures() {
|
||||
}
|
||||
|
||||
X86Subtarget::X86Subtarget(const std::string &TT, const std::string &FS,
|
||||
bool is64Bit)
|
||||
bool is64Bit, unsigned StackAlignOverride)
|
||||
: PICStyle(PICStyles::None)
|
||||
, X86SSELevel(NoMMXSSE)
|
||||
, X863DNowLevel(NoThreeDNow)
|
||||
@ -308,10 +307,6 @@ X86Subtarget::X86Subtarget(const std::string &TT, const std::string &FS,
|
||||
, TargetTriple(TT)
|
||||
, Is64Bit(is64Bit) {
|
||||
|
||||
// default to hard float ABI
|
||||
if (FloatABIType == FloatABI::Default)
|
||||
FloatABIType = FloatABI::Hard;
|
||||
|
||||
// Determine default and user specified characteristics
|
||||
if (!FS.empty()) {
|
||||
// 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
|
||||
// 32 and 64 bit) and for all 64-bit targets.
|
||||
if (isTargetDarwin() || isTargetFreeBSD() || isTargetLinux() ||
|
||||
isTargetSolaris() || Is64Bit)
|
||||
if (StackAlignOverride)
|
||||
stackAlignment = StackAlignOverride;
|
||||
else if (isTargetDarwin() || isTargetFreeBSD() || isTargetLinux() ||
|
||||
isTargetSolaris() || Is64Bit)
|
||||
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
|
||||
/// 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
|
||||
/// 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
|
||||
/// should be attempted.
|
||||
unsigned getSpecialAddressLatency() const;
|
||||
|
||||
/// IsCalleePop - Test whether a function should pop its own arguments.
|
||||
bool IsCalleePop(bool isVarArg, CallingConv::ID CallConv) const;
|
||||
};
|
||||
|
||||
} // 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,
|
||||
const std::string &FS, bool is64Bit)
|
||||
: LLVMTargetMachine(T, TT),
|
||||
Subtarget(TT, FS, is64Bit),
|
||||
Subtarget(TT, FS, is64Bit, StackAlignment),
|
||||
FrameLowering(*this, Subtarget),
|
||||
ELFWriterInfo(is64Bit, true) {
|
||||
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.
|
||||
if (Subtarget.getPICStyle() == PICStyles::None)
|
||||
setRelocationModel(Reloc::Static);
|
||||
|
||||
// default to hard float ABI
|
||||
if (FloatABIType == FloatABI::Default)
|
||||
FloatABIType = FloatABI::Hard;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
Loading…
Reference in New Issue
Block a user