@@ -208,6 +208,7 @@ BPFTargetLowering::BPFTargetLowering(const TargetMachine &TM,
208208 HasMovsx = STI.hasMovsx ();
209209
210210 AllowsMisalignedMemAccess = STI.getAllowsMisalignedMemAccess ();
211+ AllowBuiltinCalls = STI.getAllowBuiltinCalls ();
211212}
212213
213214bool BPFTargetLowering::allowsMisalignedMemoryAccesses (EVT VT, unsigned , Align,
@@ -567,9 +568,10 @@ SDValue BPFTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
567568 } else if (ExternalSymbolSDNode *E = dyn_cast<ExternalSymbolSDNode>(Callee)) {
568569 if (StringRef (E->getSymbol ()) != BPF_TRAP) {
569570 Callee = DAG.getTargetExternalSymbol (E->getSymbol (), PtrVT, 0 );
570- fail (CLI.DL , DAG,
571- Twine (" A call to built-in function '" + StringRef (E->getSymbol ()) +
572- " ' is not supported." ));
571+ if (!AllowBuiltinCalls)
572+ fail (CLI.DL , DAG,
573+ Twine (" A call to built-in function '" + StringRef (E->getSymbol ()) +
574+ " ' is not supported." ));
573575 }
574576 }
575577
@@ -1196,3 +1198,18 @@ bool BPFTargetLowering::isLegalAddressingMode(const DataLayout &DL,
11961198
11971199 return true ;
11981200}
1201+
1202+ bool BPFTargetLowering::shouldSignExtendTypeInLibCall (Type *Ty,
1203+ bool IsSigned) const {
1204+ return IsSigned || Ty->isIntegerTy (32 );
1205+ }
1206+
1207+ bool BPFTargetLowering::CanLowerReturn (
1208+ CallingConv::ID CallConv, MachineFunction &MF, bool IsVarArg,
1209+ const SmallVectorImpl<ISD::OutputArg> &Outs, LLVMContext &Context,
1210+ const Type *RetTy) const {
1211+ // At minimal return Outs.size() <= 1, or check valid types in CC.
1212+ SmallVector<CCValAssign, 16 > RVLocs;
1213+ CCState CCInfo (CallConv, IsVarArg, MF, RVLocs, Context);
1214+ return CCInfo.CheckReturn (Outs, getHasAlu32 () ? RetCC_BPF32 : RetCC_BPF64);
1215+ }
0 commit comments