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 { 15 Target &getTheBPFleTarget() { 16 static Target TheBPFleTarget; 17 return TheBPFleTarget; 18 } 19 Target &getTheBPFbeTarget() { 20 static Target TheBPFbeTarget; 21 return TheBPFbeTarget; 22 } 23 Target &getTheBPFTarget() { 24 static Target TheBPFTarget; 25 return TheBPFTarget; 26 } 27 } // namespace llvm 28 29 extern "C" void LLVMInitializeBPFTargetInfo() { 30 TargetRegistry::RegisterTarget(getTheBPFTarget(), "bpf", "BPF (host endian)", 31 [](Triple::ArchType) { return false; }, true); 32 RegisterTarget<Triple::bpfel, /*HasJIT=*/true> X(getTheBPFleTarget(), "bpfel", 33 "BPF (little endian)"); 34 RegisterTarget<Triple::bpfeb, /*HasJIT=*/true> Y(getTheBPFbeTarget(), "bpfeb", 35 "BPF (big endian)"); 36 } 37