Skip to content

Commit 2aee3e7

Browse files
committed
Revert "[BPF] Allow libcalls behind a feature gate (#168442)"
This reverts commit 23907a2.
1 parent 3d596ad commit 2aee3e7

File tree

9 files changed

+7
-79
lines changed

9 files changed

+7
-79
lines changed

llvm/lib/Target/BPF/BPF.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ def MisalignedMemAccess : SubtargetFeature<"allows-misaligned-mem-access",
3434
"AllowsMisalignedMemAccess", "true",
3535
"Allows misaligned memory access">;
3636

37-
def AllowBuiltinCall : SubtargetFeature<"allow-builtin-calls",
38-
"AllowBuiltinCalls", "true",
39-
"Allow calls to builtin functions">;
40-
4137
def : Proc<"generic", []>;
4238
def : Proc<"v1", []>;
4339
def : Proc<"v2", []>;

llvm/lib/Target/BPF/BPFISelLowering.cpp

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ BPFTargetLowering::BPFTargetLowering(const TargetMachine &TM,
208208
HasMovsx = STI.hasMovsx();
209209

210210
AllowsMisalignedMemAccess = STI.getAllowsMisalignedMemAccess();
211-
AllowBuiltinCalls = STI.getAllowBuiltinCalls();
212211
}
213212

214213
bool BPFTargetLowering::allowsMisalignedMemoryAccesses(EVT VT, unsigned, Align,
@@ -568,10 +567,9 @@ SDValue BPFTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
568567
} else if (ExternalSymbolSDNode *E = dyn_cast<ExternalSymbolSDNode>(Callee)) {
569568
if (StringRef(E->getSymbol()) != BPF_TRAP) {
570569
Callee = DAG.getTargetExternalSymbol(E->getSymbol(), PtrVT, 0);
571-
if (!AllowBuiltinCalls)
572-
fail(CLI.DL, DAG,
573-
Twine("A call to built-in function '" + StringRef(E->getSymbol()) +
574-
"' is not supported."));
570+
fail(CLI.DL, DAG,
571+
Twine("A call to built-in function '" + StringRef(E->getSymbol()) +
572+
"' is not supported."));
575573
}
576574
}
577575

@@ -1198,18 +1196,3 @@ bool BPFTargetLowering::isLegalAddressingMode(const DataLayout &DL,
11981196

11991197
return true;
12001198
}
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-
}

llvm/lib/Target/BPF/BPFISelLowering.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ class BPFTargetLowering : public TargetLowering {
6868
// Allows Misalignment
6969
bool AllowsMisalignedMemAccess;
7070

71-
bool AllowBuiltinCalls;
72-
7371
SDValue LowerSDIVSREM(SDValue Op, SelectionDAG &DAG) const;
7472
SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const;
7573
SDValue LowerBR_CC(SDValue Op, SelectionDAG &DAG) const;
@@ -165,14 +163,6 @@ class BPFTargetLowering : public TargetLowering {
165163
MachineBasicBlock *
166164
EmitInstrWithCustomInserterLDimm64(MachineInstr &MI,
167165
MachineBasicBlock *BB) const;
168-
169-
// Returns true if arguments should be sign-extended in lib calls.
170-
bool shouldSignExtendTypeInLibCall(Type *Ty, bool IsSigned) const override;
171-
172-
bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
173-
bool IsVarArg,
174-
const SmallVectorImpl<ISD::OutputArg> &Outs,
175-
LLVMContext &Context, const Type *RetTy) const override;
176166
};
177167
}
178168

llvm/lib/Target/BPF/BPFSubtarget.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ void BPFSubtarget::initializeEnvironment() {
7070
HasLoadAcqStoreRel = false;
7171
HasGotox = false;
7272
AllowsMisalignedMemAccess = false;
73-
AllowBuiltinCalls = false;
7473
}
7574

7675
void BPFSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {

llvm/lib/Target/BPF/BPFSubtarget.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ class BPFSubtarget : public BPFGenSubtargetInfo {
7070
bool HasLdsx, HasMovsx, HasBswap, HasSdivSmod, HasGotol, HasStoreImm,
7171
HasLoadAcqStoreRel, HasGotox;
7272

73-
bool AllowBuiltinCalls;
74-
7573
std::unique_ptr<CallLowering> CallLoweringInfo;
7674
std::unique_ptr<InstructionSelector> InstSelector;
7775
std::unique_ptr<LegalizerInfo> Legalizer;
@@ -103,7 +101,6 @@ class BPFSubtarget : public BPFGenSubtargetInfo {
103101
bool hasStoreImm() const { return HasStoreImm; }
104102
bool hasLoadAcqStoreRel() const { return HasLoadAcqStoreRel; }
105103
bool hasGotox() const { return HasGotox; }
106-
bool getAllowBuiltinCalls() const { return AllowBuiltinCalls; }
107104

108105
bool isLittleEndian() const { return IsLittleEndian; }
109106

llvm/test/CodeGen/BPF/atomic-oversize.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
; RUN: llc -mtriple=bpf < %s | FileCheck %s
2+
; XFAIL: *
3+
; Doesn't currently build, with error 'only small returns supported'.
24

35
define void @test(ptr %a) nounwind {
46
; CHECK-LABEL: test:

llvm/test/CodeGen/BPF/builtin_calls.ll

Lines changed: 0 additions & 39 deletions
This file was deleted.

llvm/test/CodeGen/BPF/struct_ret1.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; RUN: not llc -mtriple=bpf < %s 2> %t1
22
; RUN: FileCheck %s < %t1
3-
; CHECK: error: <unknown>:0:0: in function bar { i64, i32 } (i32, i32, i32, i32, i32): stack arguments are not supported
3+
; CHECK: error: <unknown>:0:0: in function bar { i64, i32 } (i32, i32, i32, i32, i32): aggregate returns are not supported
44

55
%struct.S = type { i32, i32, i32 }
66

llvm/test/CodeGen/BPF/struct_ret2.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; RUN: not llc -mtriple=bpf < %s 2> %t1
22
; RUN: FileCheck %s < %t1
3-
; CHECK: too many arguments
3+
; CHECK: only small returns
44

55
; Function Attrs: nounwind uwtable
66
define { i64, i32 } @foo(i32 %a, i32 %b, i32 %c) #0 {

0 commit comments

Comments
 (0)