1 //===-- BPFTargetInfo.cpp - BPF Target Implementation ---------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "BPF.h"
11 #include "llvm/Support/TargetRegistry.h"
12 using namespace llvm;
13
14 namespace llvm {
getTheBPFleTarget()15 Target &getTheBPFleTarget() {
16 static Target TheBPFleTarget;
17 return TheBPFleTarget;
18 }
getTheBPFbeTarget()19 Target &getTheBPFbeTarget() {
20 static Target TheBPFbeTarget;
21 return TheBPFbeTarget;
22 }
getTheBPFTarget()23 Target &getTheBPFTarget() {
24 static Target TheBPFTarget;
25 return TheBPFTarget;
26 }
27 } // namespace llvm
28
LLVMInitializeBPFTargetInfo()29 extern "C" void 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