Skip to content

Commit b2aa848

Browse files
committed
[Xtensa] Handle musttail
1 parent 74626ba commit b2aa848

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
@@ -23,6 +23,7 @@
2323
#include "llvm/CodeGen/MachineJumpTableInfo.h"
2424
#include "llvm/CodeGen/MachineRegisterInfo.h"
2525
#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
26+
#include "llvm/IR/DiagnosticInfo.h"
2627
#include "llvm/Support/Debug.h"
2728
#include "llvm/Support/ErrorHandling.h"
2829
#include "llvm/Support/raw_ostream.h"
@@ -1044,6 +1045,12 @@ SDValue XtensaTargetLowering::getAddrPCRel(SDValue Op,
10441045
return DAG.getNode(XtensaISD::PCREL_WRAPPER, DL, Ty, Op);
10451046
}
10461047

1048+
static void fail(const SDLoc &DL, SelectionDAG &DAG, const char *Msg) {
1049+
MachineFunction &MF = DAG.getMachineFunction();
1050+
DAG.getContext()->diagnose(
1051+
DiagnosticInfoUnsupported(MF.getFunction(), Msg, DL.getDebugLoc()));
1052+
}
1053+
10471054
SDValue
10481055
XtensaTargetLowering::LowerCall(CallLoweringInfo &CLI,
10491056
SmallVectorImpl<SDValue> &InVals) const {
@@ -1063,7 +1070,11 @@ XtensaTargetLowering::LowerCall(CallLoweringInfo &CLI,
10631070
const TargetFrameLowering *TFL = Subtarget.getFrameLowering();
10641071

10651072
// TODO: Support tail call optimization.
1066-
IsTailCall = false;
1073+
if (IsTailCall) {
1074+
if (CLI.CB && CLI.CB->isMustTailCall())
1075+
fail(DL, DAG, "tail call is not implemented");
1076+
IsTailCall = false;
1077+
}
10671078

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

0 commit comments

Comments
 (0)