xref: /freebsd/contrib/llvm-project/llvm/lib/Target/BPF/TargetInfo/BPFTargetInfo.cpp (revision 9c77fb6aaa366cbabc80ee1b834bcfe4df135491)
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 #include "llvm/Support/Compiler.h"
12 
13 using namespace llvm;
14 
15 Target &llvm::getTheBPFleTarget() {
16   static Target TheBPFleTarget;
17   return TheBPFleTarget;
18 }
19 Target &llvm::getTheBPFbeTarget() {
20   static Target TheBPFbeTarget;
21   return TheBPFbeTarget;
22 }
23 Target &llvm::getTheBPFTarget() {
24   static Target TheBPFTarget;
25   return TheBPFTarget;
26 }
27 
28 extern "C" LLVM_ABI LLVM_EXTERNAL_VISIBILITY void
29 LLVMInitializeBPFTargetInfo() {
30   TargetRegistry::RegisterTarget(getTheBPFTarget(), "bpf", "BPF (host endian)",
31                                  "BPF", [](Triple::ArchType) { return false; },
32                                  true);
33   RegisterTarget<Triple::bpfel, /*HasJIT=*/true> X(
34       getTheBPFleTarget(), "bpfel", "BPF (little endian)", "BPF");
35   RegisterTarget<Triple::bpfeb, /*HasJIT=*/true> Y(getTheBPFbeTarget(), "bpfeb",
36                                                    "BPF (big endian)", "BPF");
37 }
38