xref: /freebsd/contrib/llvm-project/llvm/lib/Target/BPF/TargetInfo/BPFTargetInfo.cpp (revision e6bfd18d21b225af6a0ed67ceeaf1293b7b9eba5)
1 //===-- BPFTargetInfo.cpp - BPF Target Implementation ---------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "TargetInfo/BPFTargetInfo.h"
10 #include "llvm/MC/TargetRegistry.h"
11 
12 using namespace llvm;
13 
14 Target &llvm::getTheBPFleTarget() {
15   static Target TheBPFleTarget;
16   return TheBPFleTarget;
17 }
18 Target &llvm::getTheBPFbeTarget() {
19   static Target TheBPFbeTarget;
20   return TheBPFbeTarget;
21 }
22 Target &llvm::getTheBPFTarget() {
23   static Target TheBPFTarget;
24   return TheBPFTarget;
25 }
26 
27 extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeBPFTargetInfo() {
28   TargetRegistry::RegisterTarget(getTheBPFTarget(), "bpf", "BPF (host endian)",
29                                  "BPF", [](Triple::ArchType) { return false; },
30                                  true);
31   RegisterTarget<Triple::bpfel, /*HasJIT=*/true> X(
32       getTheBPFleTarget(), "bpfel", "BPF (little endian)", "BPF");
33   RegisterTarget<Triple::bpfeb, /*HasJIT=*/true> Y(getTheBPFbeTarget(), "bpfeb",
34                                                    "BPF (big endian)", "BPF");
35 }
36