[PATCH] D140969: [BPF] Triple::isBPF() utility method

Eduard Zingerman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 4 05:15:07 PST 2023


eddyz87 created this revision.
Herald added a project: All.
eddyz87 published this revision for review.
eddyz87 added a reviewer: yonghong-song.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Adds a utility method llvm::Triple::isBPF() aggregating Triple::bpfel
and Triple::bpfeb architectures. Similar to other predicates in this class.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140969

Files:
  llvm/include/llvm/TargetParser/Triple.h


Index: llvm/include/llvm/TargetParser/Triple.h
===================================================================
--- llvm/include/llvm/TargetParser/Triple.h
+++ llvm/include/llvm/TargetParser/Triple.h
@@ -939,6 +939,11 @@
     return Env == Triple::GNUX32 || Env == Triple::MuslX32;
   }
 
+  /// Tests whether the target is eBPF.
+  bool isBPF() const {
+    return getArch() == Triple::bpfel || getArch() == Triple::bpfeb;
+  }
+
   /// Tests whether the target supports comdat
   bool supportsCOMDAT() const {
     return !(isOSBinFormatMachO() || isOSBinFormatXCOFF() ||


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140969.486242.patch
Type: text/x-patch
Size: 577 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230104/b058b09f/attachment.bin>


More information about the llvm-commits mailing list