mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-28 19:25:00 +00:00
Some ARM implementaions, e.g. A-series, does return stack prediction. That is,
the processor keeps a return addresses stack (RAS) which stores the address and the instruction execution state of the instruction after a function-call type branch instruction. Calling a "noreturn" function with normal call instructions (e.g. bl) can corrupt RAS and causes 100% return misprediction so LLVM should use a unconditional branch instead. i.e. mov lr, pc b _foo The "mov lr, pc" is issued in order to get proper backtrace. rdar://8979299 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151623 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -5081,7 +5081,8 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
|
||||
std::pair<SDValue, SDValue> Result =
|
||||
TLI.LowerCallTo(getRoot(), I.getType(),
|
||||
false, false, false, false, 0, CallingConv::C,
|
||||
/*isTailCall=*/false, /*isReturnValueUsed=*/true,
|
||||
/*isTailCall=*/false,
|
||||
/*doesNotRet=*/false, /*isReturnValueUsed=*/true,
|
||||
DAG.getExternalSymbol(TrapFuncName.data(), TLI.getPointerTy()),
|
||||
Args, DAG, getCurDebugLoc());
|
||||
DAG.setRoot(Result.second);
|
||||
@@ -5244,6 +5245,7 @@ void SelectionDAGBuilder::LowerCallTo(ImmutableCallSite CS, SDValue Callee,
|
||||
CS.paramHasAttr(0, Attribute::InReg), FTy->getNumParams(),
|
||||
CS.getCallingConv(),
|
||||
isTailCall,
|
||||
CS.doesNotReturn(),
|
||||
!CS.getInstruction()->use_empty(),
|
||||
Callee, Args, DAG, getCurDebugLoc());
|
||||
assert((isTailCall || Result.second.getNode()) &&
|
||||
@@ -6360,7 +6362,7 @@ TargetLowering::LowerCallTo(SDValue Chain, Type *RetTy,
|
||||
bool RetSExt, bool RetZExt, bool isVarArg,
|
||||
bool isInreg, unsigned NumFixedArgs,
|
||||
CallingConv::ID CallConv, bool isTailCall,
|
||||
bool isReturnValueUsed,
|
||||
bool doesNotRet, bool isReturnValueUsed,
|
||||
SDValue Callee,
|
||||
ArgListTy &Args, SelectionDAG &DAG,
|
||||
DebugLoc dl) const {
|
||||
@@ -6457,7 +6459,7 @@ TargetLowering::LowerCallTo(SDValue Chain, Type *RetTy,
|
||||
}
|
||||
|
||||
SmallVector<SDValue, 4> InVals;
|
||||
Chain = LowerCall(Chain, Callee, CallConv, isVarArg, isTailCall,
|
||||
Chain = LowerCall(Chain, Callee, CallConv, isVarArg, doesNotRet, isTailCall,
|
||||
Outs, OutVals, Ins, dl, DAG, InVals);
|
||||
|
||||
// Verify that the target's LowerCall behaved as expected.
|
||||
|
Reference in New Issue
Block a user