Skip to content

Commit 5702202

Browse files
eddyz87yonghong-song
authored andcommitted
[BPF] Triple::isBPF() utility method
Adds a utility method llvm::Triple::isBPF() aggregating Triple::bpfel and Triple::bpfeb architectures. Similar to other predicates in this class. Differential Revision: https://reviews.llvm.org/D140969
1 parent 2c174a5 commit 5702202

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llvm/include/llvm/TargetParser/Triple.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,11 @@ class Triple {
939939
return Env == Triple::GNUX32 || Env == Triple::MuslX32;
940940
}
941941

942+
/// Tests whether the target is eBPF.
943+
bool isBPF() const {
944+
return getArch() == Triple::bpfel || getArch() == Triple::bpfeb;
945+
}
946+
942947
/// Tests whether the target supports comdat
943948
bool supportsCOMDAT() const {
944949
return !(isOSBinFormatMachO() || isOSBinFormatXCOFF() ||

0 commit comments

Comments
 (0)