LLVM 20.0.0git
MCJIT.h
Go to the documentation of this file.
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
14#ifndef LLVM_EXECUTIONENGINE_MCJIT_H
15#define LLVM_EXECUTIONENGINE_MCJIT_H
16
18#include <cstdlib>
19
20extern "C" void LLVMLinkInMCJIT();
21
22namespace {
23 struct ForceMCJITLinking {
24 ForceMCJITLinking() {
25 // We must reference MCJIT in such a way that compilers will not
26 // delete it all as dead code, even with whole program optimization,
27 // yet is effectively a NO-OP. As the compiler isn't smart enough
28 // to know that getenv() never returns -1, this will do the job.
29 // This is so that globals in the translation units where these functions
30 // are defined are forced to be initialized, populating various
31 // registries.
32 if (std::getenv("bar") != (char*) -1)
33 return;
34
36 }
37 } ForceMCJITLinking;
38}
39
40#endif
void LLVMLinkInMCJIT()
Definition: MCJIT.cpp:41