@@ -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,11 @@ 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." ));
575+ }
573576 }
574577 }
575578
@@ -1196,3 +1199,18 @@ bool BPFTargetLowering::isLegalAddressingMode(const DataLayout &DL,
11961199
11971200 return true ;
11981201}
1202+
1203+ bool BPFTargetLowering::shouldSignExtendTypeInLibCall (Type *Ty,
1204+ bool IsSigned) const {
1205+ return IsSigned || Ty->isIntegerTy (32 );
1206+ }
1207+
1208+ bool BPFTargetLowering::CanLowerReturn (
1209+ CallingConv::ID CallConv, MachineFunction &MF, bool IsVarArg,
1210+ const SmallVectorImpl<ISD::OutputArg> &Outs, LLVMContext &Context,
1211+ const Type *RetTy) const {
1212+ // At minimal return Outs.size() <= 1, or check valid types in CC.
1213+ SmallVector<CCValAssign, 16 > RVLocs;
1214+ CCState CCInfo (CallConv, IsVarArg, MF, RVLocs, Context);
1215+ return CCInfo.CheckReturn (Outs, getHasAlu32 () ? RetCC_BPF32 : RetCC_BPF64);
1216+ }
0 commit comments