BPFTargetInfo.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  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. #include "TargetInfo/BPFTargetInfo.h"
  9. #include "llvm/MC/TargetRegistry.h"
  10. using namespace llvm;
  11. Target &llvm::getTheBPFleTarget() {
  12. static Target TheBPFleTarget;
  13. return TheBPFleTarget;
  14. }
  15. Target &llvm::getTheBPFbeTarget() {
  16. static Target TheBPFbeTarget;
  17. return TheBPFbeTarget;
  18. }
  19. Target &llvm::getTheBPFTarget() {
  20. static Target TheBPFTarget;
  21. return TheBPFTarget;
  22. }
  23. extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeBPFTargetInfo() {
  24. TargetRegistry::RegisterTarget(getTheBPFTarget(), "bpf", "BPF (host endian)",
  25. "BPF", [](Triple::ArchType) { return false; },
  26. true);
  27. RegisterTarget<Triple::bpfel, /*HasJIT=*/true> X(
  28. getTheBPFleTarget(), "bpfel", "BPF (little endian)", "BPF");
  29. RegisterTarget<Triple::bpfeb, /*HasJIT=*/true> Y(getTheBPFbeTarget(), "bpfeb",
  30. "BPF (big endian)", "BPF");
  31. }