MCJIT.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //===-- MCJIT.h - MC-Based Just-In-Time Execution Engine --------*- C++ -*-===//
  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. // This file forces the MCJIT to link in on certain operating systems.
  10. // (Windows).
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_EXECUTIONENGINE_MCJIT_H
  14. #define LLVM_EXECUTIONENGINE_MCJIT_H
  15. #include "llvm/ExecutionEngine/ExecutionEngine.h"
  16. #include <cstdlib>
  17. extern "C" void LLVMLinkInMCJIT();
  18. namespace {
  19. struct ForceMCJITLinking {
  20. ForceMCJITLinking() {
  21. // We must reference MCJIT in such a way that compilers will not
  22. // delete it all as dead code, even with whole program optimization,
  23. // yet is effectively a NO-OP. As the compiler isn't smart enough
  24. // to know that getenv() never returns -1, this will do the job.
  25. if (std::getenv("bar") != (char*) -1)
  26. return;
  27. LLVMLinkInMCJIT();
  28. }
  29. } ForceMCJITLinking;
  30. }
  31. #endif