mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
Enable tail call optimization for functions that return a struct (bug 3664) and for functions that return types that need extending (e.g i1).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67934 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -2571,3 +2571,27 @@ SDValue TargetLowering::BuildUDIV(SDNode *N, SelectionDAG &DAG,
|
||||
DAG.getConstant(magics.s-1, getShiftAmountTy()));
|
||||
}
|
||||
}
|
||||
|
||||
bool TargetLowering::CheckTailCallReturnConstraints(CallSDNode *TheCall, SDValue Ret) {
|
||||
unsigned NumOps = Ret.getNumOperands();
|
||||
// Struct return.
|
||||
if(NumOps >= 5&&
|
||||
Ret.getOperand(1).getOpcode()==ISD::MERGE_VALUES &&
|
||||
Ret.getOperand(1).getOperand(0) == SDValue(TheCall, 0))
|
||||
return true;
|
||||
if ((NumOps == 1 &&
|
||||
(Ret.getOperand(0) == SDValue(TheCall,1) ||
|
||||
Ret.getOperand(0) == SDValue(TheCall,0))) ||
|
||||
(NumOps == 3 &&
|
||||
Ret.getOperand(1).getOpcode() == ISD::ANY_EXTEND &&
|
||||
Ret.getOperand(1).getNumOperands()>0 &&
|
||||
Ret.getOperand(1).getOperand(0).getOpcode() == ISD::TRUNCATE &&
|
||||
Ret.getOperand(1).getOperand(0).getNumOperands()>0 &&
|
||||
Ret.getOperand(1).getOperand(0).getOperand(0) == SDValue(TheCall, 0)) ||
|
||||
(NumOps > 1 &&
|
||||
Ret.getOperand(0) == SDValue(TheCall,
|
||||
TheCall->getNumValues()-1) &&
|
||||
Ret.getOperand(1) == SDValue(TheCall,0)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user