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
13using namespace llvm;
14
15Target &llvm::getTheBPFleTarget() {
16 static Target TheBPFleTarget;
17 return TheBPFleTarget;
18}
19Target &llvm::getTheBPFbeTarget() {
20 static Target TheBPFbeTarget;
21 return TheBPFbeTarget;
22}
23Target &llvm::getTheBPFTarget() {
24 static Target TheBPFTarget;
25 return TheBPFTarget;
26}
27
28extern "C" LLVM_ABI LLVM_EXTERNAL_VISIBILITY void
29LLVMInitializeBPFTargetInfo() {
30 TargetRegistry::RegisterTarget(T&: getTheBPFTarget(), Name: "bpf", ShortDesc: "BPF (host endian)",
31 BackendName: "BPF", ArchMatchFn: [](Triple::ArchType) { return false; },
32 HasJIT: 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