[llvm] 5702202 - [BPF] Triple::isBPF() utility method

Yonghong Song via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 6 22:37:36 PST 2023


Author: Eduard Zingerman
Date: 2023-01-06T22:36:52-08:00
New Revision: 5702202ad6662898d1b222a05e0a6e9d2efb428f

URL: https://github.com/llvm/llvm-project/commit/5702202ad6662898d1b222a05e0a6e9d2efb428f
DIFF: https://github.com/llvm/llvm-project/commit/5702202ad6662898d1b222a05e0a6e9d2efb428f.diff

LOG: [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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
index 3db4194de07b3..8d600989c8cf5 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -939,6 +939,11 @@ class Triple {
     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() ||


        


More information about the llvm-commits mailing list