mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-03 14:31:10 +00:00
Rename the PerformTailCallOpt variable to GuaranteedTailCallOpt to reflect
its current purpose. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95564 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7edd8e38c4
commit
1797ed50f4
@ -116,10 +116,13 @@ namespace llvm {
|
||||
/// be emitted for all functions.
|
||||
extern bool UnwindTablesMandatory;
|
||||
|
||||
/// PerformTailCallOpt - This flag is enabled when -tailcallopt is specified
|
||||
/// on the commandline. When the flag is on, the target will perform tail call
|
||||
/// optimization (pop the caller's stack) providing it supports it.
|
||||
extern bool PerformTailCallOpt;
|
||||
/// GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is
|
||||
/// specified on the commandline. When the flag is on, participating targets
|
||||
/// will perform tail call optimization on all calls which use the fastcc
|
||||
/// calling convention and which satisfy certain target-independent
|
||||
/// criteria (being at the end of a function, having the same return type
|
||||
/// as their parent function, etc.), using an alternate ABI if necessary.
|
||||
extern bool GuaranteedTailCallOpt;
|
||||
|
||||
/// StackAlignment - Override default stack alignment for target.
|
||||
extern unsigned StackAlignment;
|
||||
|
@ -1572,7 +1572,7 @@ PPCTargetLowering::LowerFormalArguments_SVR4(
|
||||
|
||||
EVT PtrVT = DAG.getTargetLoweringInfo().getPointerTy();
|
||||
// Potential tail calls could cause overwriting of argument stack slots.
|
||||
bool isImmutable = !(PerformTailCallOpt && (CallConv==CallingConv::Fast));
|
||||
bool isImmutable = !(GuaranteedTailCallOpt && (CallConv==CallingConv::Fast));
|
||||
unsigned PtrByteSize = 4;
|
||||
|
||||
// Assign locations to all of the incoming arguments.
|
||||
@ -1773,7 +1773,7 @@ PPCTargetLowering::LowerFormalArguments_Darwin(
|
||||
EVT PtrVT = DAG.getTargetLoweringInfo().getPointerTy();
|
||||
bool isPPC64 = PtrVT == MVT::i64;
|
||||
// Potential tail calls could cause overwriting of argument stack slots.
|
||||
bool isImmutable = !(PerformTailCallOpt && (CallConv==CallingConv::Fast));
|
||||
bool isImmutable = !(GuaranteedTailCallOpt && (CallConv==CallingConv::Fast));
|
||||
unsigned PtrByteSize = isPPC64 ? 8 : 4;
|
||||
|
||||
unsigned ArgOffset = PPCFrameInfo::getLinkageSize(isPPC64, true);
|
||||
@ -2164,7 +2164,7 @@ CalculateParameterAndLinkageAreaSize(SelectionDAG &DAG,
|
||||
PPCFrameInfo::getMinCallFrameSize(isPPC64, true));
|
||||
|
||||
// Tail call needs the stack to be aligned.
|
||||
if (CC==CallingConv::Fast && PerformTailCallOpt) {
|
||||
if (CC==CallingConv::Fast && GuaranteedTailCallOpt) {
|
||||
unsigned TargetAlign = DAG.getMachineFunction().getTarget().getFrameInfo()->
|
||||
getStackAlignment();
|
||||
unsigned AlignMask = TargetAlign-1;
|
||||
@ -2200,7 +2200,7 @@ PPCTargetLowering::IsEligibleForTailCallOptimization(SDValue Callee,
|
||||
bool isVarArg,
|
||||
const SmallVectorImpl<ISD::InputArg> &Ins,
|
||||
SelectionDAG& DAG) const {
|
||||
if (!PerformTailCallOpt)
|
||||
if (!GuaranteedTailCallOpt)
|
||||
return false;
|
||||
|
||||
// Variable argument functions are not supported.
|
||||
@ -2604,7 +2604,7 @@ PPCTargetLowering::FinishCall(CallingConv::ID CallConv, DebugLoc dl,
|
||||
// the stack. Account for this here so these bytes can be pushed back on in
|
||||
// PPCRegisterInfo::eliminateCallFramePseudoInstr.
|
||||
int BytesCalleePops =
|
||||
(CallConv==CallingConv::Fast && PerformTailCallOpt) ? NumBytes : 0;
|
||||
(CallConv==CallingConv::Fast && GuaranteedTailCallOpt) ? NumBytes : 0;
|
||||
|
||||
if (InFlag.getNode())
|
||||
Ops.push_back(InFlag);
|
||||
@ -2720,7 +2720,7 @@ PPCTargetLowering::LowerCall_SVR4(SDValue Chain, SDValue Callee,
|
||||
// and restoring the callers stack pointer in this functions epilog. This is
|
||||
// done because by tail calling the called function might overwrite the value
|
||||
// in this function's (MF) stack pointer stack slot 0(SP).
|
||||
if (PerformTailCallOpt && CallConv==CallingConv::Fast)
|
||||
if (GuaranteedTailCallOpt && CallConv==CallingConv::Fast)
|
||||
MF.getInfo<PPCFunctionInfo>()->setHasFastCall();
|
||||
|
||||
// Count how many bytes are to be pushed on the stack, including the linkage
|
||||
@ -2923,7 +2923,7 @@ PPCTargetLowering::LowerCall_Darwin(SDValue Chain, SDValue Callee,
|
||||
// and restoring the callers stack pointer in this functions epilog. This is
|
||||
// done because by tail calling the called function might overwrite the value
|
||||
// in this function's (MF) stack pointer stack slot 0(SP).
|
||||
if (PerformTailCallOpt && CallConv==CallingConv::Fast)
|
||||
if (GuaranteedTailCallOpt && CallConv==CallingConv::Fast)
|
||||
MF.getInfo<PPCFunctionInfo>()->setHasFastCall();
|
||||
|
||||
unsigned nAltivecParamsAtEnd = 0;
|
||||
|
@ -406,7 +406,7 @@ PPCRegisterInfo::getCalleeSavedRegClasses(const MachineFunction *MF) const {
|
||||
static bool needsFP(const MachineFunction &MF) {
|
||||
const MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||
return NoFramePointerElim || MFI->hasVarSizedObjects() ||
|
||||
(PerformTailCallOpt && MF.getInfo<PPCFunctionInfo>()->hasFastCall());
|
||||
(GuaranteedTailCallOpt && MF.getInfo<PPCFunctionInfo>()->hasFastCall());
|
||||
}
|
||||
|
||||
static bool spillsCR(const MachineFunction &MF) {
|
||||
@ -486,7 +486,7 @@ static bool MustSaveLR(const MachineFunction &MF, unsigned LR) {
|
||||
void PPCRegisterInfo::
|
||||
eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator I) const {
|
||||
if (PerformTailCallOpt && I->getOpcode() == PPC::ADJCALLSTACKUP) {
|
||||
if (GuaranteedTailCallOpt && I->getOpcode() == PPC::ADJCALLSTACKUP) {
|
||||
// Add (actually subtract) back the amount the callee popped on return.
|
||||
if (int CalleeAmt = I->getOperand(1).getImm()) {
|
||||
bool is64Bit = Subtarget.isPPC64();
|
||||
@ -1050,7 +1050,7 @@ PPCRegisterInfo::processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
|
||||
|
||||
// Reserve stack space to move the linkage area to in case of a tail call.
|
||||
int TCSPDelta = 0;
|
||||
if (PerformTailCallOpt && (TCSPDelta = FI->getTailCallSPDelta()) < 0) {
|
||||
if (GuaranteedTailCallOpt && (TCSPDelta = FI->getTailCallSPDelta()) < 0) {
|
||||
MF.getFrameInfo()->CreateFixedObject(-1 * TCSPDelta, TCSPDelta,
|
||||
true, false);
|
||||
}
|
||||
@ -1160,7 +1160,7 @@ PPCRegisterInfo::processFunctionBeforeFrameFinalized(MachineFunction &MF)
|
||||
|
||||
// Take into account stack space reserved for tail calls.
|
||||
int TCSPDelta = 0;
|
||||
if (PerformTailCallOpt && (TCSPDelta = PFI->getTailCallSPDelta()) < 0) {
|
||||
if (GuaranteedTailCallOpt && (TCSPDelta = PFI->getTailCallSPDelta()) < 0) {
|
||||
LowerBound = TCSPDelta;
|
||||
}
|
||||
|
||||
@ -1575,7 +1575,7 @@ void PPCRegisterInfo::emitEpilogue(MachineFunction &MF,
|
||||
// The loaded (or persistent) stack pointer value is offset by the 'stwu'
|
||||
// on entry to the function. Add this offset back now.
|
||||
if (!isPPC64) {
|
||||
// If this function contained a fastcc call and PerformTailCallOpt is
|
||||
// If this function contained a fastcc call and GuaranteedTailCallOpt is
|
||||
// enabled (=> hasFastCall()==true) the fastcc call might contain a tail
|
||||
// call which invalidates the stack pointer value in SP(0). So we use the
|
||||
// value of R31 in this case.
|
||||
@ -1654,7 +1654,7 @@ void PPCRegisterInfo::emitEpilogue(MachineFunction &MF,
|
||||
|
||||
// Callee pop calling convention. Pop parameter/linkage area. Used for tail
|
||||
// call optimization
|
||||
if (PerformTailCallOpt && RetOpcode == PPC::BLR &&
|
||||
if (GuaranteedTailCallOpt && RetOpcode == PPC::BLR &&
|
||||
MF.getFunction()->getCallingConv() == CallingConv::Fast) {
|
||||
PPCFunctionInfo *FI = MF.getInfo<PPCFunctionInfo>();
|
||||
unsigned CallerAllocatedAmt = FI->getMinReservedArea();
|
||||
|
@ -40,7 +40,7 @@ namespace llvm {
|
||||
bool UnwindTablesMandatory;
|
||||
Reloc::Model RelocationModel;
|
||||
CodeModel::Model CMModel;
|
||||
bool PerformTailCallOpt;
|
||||
bool GuaranteedTailCallOpt;
|
||||
unsigned StackAlignment;
|
||||
bool RealignStack;
|
||||
bool DisableJumpTables;
|
||||
@ -173,9 +173,9 @@ DefCodeModel("code-model",
|
||||
"Large code model"),
|
||||
clEnumValEnd));
|
||||
static cl::opt<bool, true>
|
||||
EnablePerformTailCallOpt("tailcallopt",
|
||||
EnableGuaranteedTailCallOpt("tailcallopt",
|
||||
cl::desc("Turn fastcc calls into tail calls by (potentially) changing ABI."),
|
||||
cl::location(PerformTailCallOpt),
|
||||
cl::location(GuaranteedTailCallOpt),
|
||||
cl::init(false));
|
||||
static cl::opt<unsigned, true>
|
||||
OverrideStackAlignment("stack-alignment",
|
||||
|
@ -1247,7 +1247,7 @@ bool X86FastISel::X86SelectCall(Instruction *I) {
|
||||
|
||||
// fastcc with -tailcallopt is intended to provide a guaranteed
|
||||
// tail call optimization. Fastisel doesn't know how to do that.
|
||||
if (CC == CallingConv::Fast && PerformTailCallOpt)
|
||||
if (CC == CallingConv::Fast && GuaranteedTailCallOpt)
|
||||
return false;
|
||||
|
||||
// Let SDISel handle vararg functions.
|
||||
|
@ -1391,7 +1391,7 @@ bool X86TargetLowering::IsCalleePop(bool IsVarArg, CallingConv::ID CallingConv){
|
||||
case CallingConv::X86_FastCall:
|
||||
return !Subtarget->is64Bit();
|
||||
case CallingConv::Fast:
|
||||
return PerformTailCallOpt;
|
||||
return GuaranteedTailCallOpt;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1441,7 +1441,7 @@ CreateCopyOfByValArgument(SDValue Src, SDValue Dst, SDValue Chain,
|
||||
/// FuncIsMadeTailCallSafe - Return true if the function is being made into
|
||||
/// a tailcall target by changing its ABI.
|
||||
static bool FuncIsMadeTailCallSafe(CallingConv::ID CC) {
|
||||
return PerformTailCallOpt && CC == CallingConv::Fast;
|
||||
return GuaranteedTailCallOpt && CC == CallingConv::Fast;
|
||||
}
|
||||
|
||||
SDValue
|
||||
@ -1797,7 +1797,7 @@ X86TargetLowering::LowerCall(SDValue Chain, SDValue Callee,
|
||||
|
||||
// Sibcalls are automatically detected tailcalls which do not require
|
||||
// ABI changes.
|
||||
if (!PerformTailCallOpt && isTailCall)
|
||||
if (!GuaranteedTailCallOpt && isTailCall)
|
||||
IsSibcall = true;
|
||||
|
||||
if (isTailCall)
|
||||
@ -1819,7 +1819,7 @@ X86TargetLowering::LowerCall(SDValue Chain, SDValue Callee,
|
||||
// This is a sibcall. The memory operands are available in caller's
|
||||
// own caller's stack.
|
||||
NumBytes = 0;
|
||||
else if (PerformTailCallOpt && CallConv == CallingConv::Fast)
|
||||
else if (GuaranteedTailCallOpt && CallConv == CallingConv::Fast)
|
||||
NumBytes = GetAlignedArgumentStackSize(NumBytes, DAG);
|
||||
|
||||
int FPDiff = 0;
|
||||
@ -1986,7 +1986,7 @@ X86TargetLowering::LowerCall(SDValue Chain, SDValue Callee,
|
||||
int FI = 0;
|
||||
// Do not flag preceeding copytoreg stuff together with the following stuff.
|
||||
InFlag = SDValue();
|
||||
if (PerformTailCallOpt) {
|
||||
if (GuaranteedTailCallOpt) {
|
||||
for (unsigned i = 0, e = ArgLocs.size(); i != e; ++i) {
|
||||
CCValAssign &VA = ArgLocs[i];
|
||||
if (VA.isRegLoc())
|
||||
@ -2311,7 +2311,7 @@ X86TargetLowering::IsEligibleForTailCallOptimization(SDValue Callee,
|
||||
|
||||
// If -tailcallopt is specified, make fastcc functions tail-callable.
|
||||
const Function *CallerF = DAG.getMachineFunction().getFunction();
|
||||
if (PerformTailCallOpt) {
|
||||
if (GuaranteedTailCallOpt) {
|
||||
if (CalleeCC == CallingConv::Fast &&
|
||||
CallerF->getCallingConv() == CalleeCC)
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user