Skip to content

Commit 4cd5e09

Browse files
committed
[Xtensa] Handle musttail
1 parent aa0b017 commit 4cd5e09

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

llvm/lib/Target/Xtensa/XtensaISelLowering.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "llvm/CodeGen/MachineRegisterInfo.h"
2323
#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
2424
#include "llvm/IR/GlobalVariable.h"
25+
#include "llvm/IR/DiagnosticInfo.h"
2526
#include "llvm/Support/Debug.h"
2627
#include "llvm/Support/ErrorHandling.h"
2728
#include "llvm/Support/MathExtras.h"
@@ -991,6 +992,12 @@ SDValue XtensaTargetLowering::LowerFormalArguments(
991992
return Chain;
992993
}
993994

995+
static void fail(const SDLoc &DL, SelectionDAG &DAG, const char *Msg) {
996+
MachineFunction &MF = DAG.getMachineFunction();
997+
DAG.getContext()->diagnose(
998+
DiagnosticInfoUnsupported(MF.getFunction(), Msg, DL.getDebugLoc()));
999+
}
1000+
9941001
SDValue
9951002
XtensaTargetLowering::LowerCall(CallLoweringInfo &CLI,
9961003
SmallVectorImpl<SDValue> &InVals) const {
@@ -1010,7 +1017,11 @@ XtensaTargetLowering::LowerCall(CallLoweringInfo &CLI,
10101017
const TargetFrameLowering *TFL = Subtarget.getFrameLowering();
10111018

10121019
// TODO: Support tail call optimization.
1013-
IsTailCall = false;
1020+
if (IsTailCall) {
1021+
if (CLI.CB && CLI.CB->isMustTailCall())
1022+
fail(DL, DAG, "tail call is not implemented");
1023+
IsTailCall = false;
1024+
}
10141025

10151026
// Analyze the operands of the call, assigning locations to each operand.
10161027
SmallVector<CCValAssign, 16> ArgLocs;

0 commit comments

Comments
 (0)