Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:54

0001 //===-- MCJIT.h - MC-Based Just-In-Time Execution Engine --------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file forces the MCJIT to link in on certain operating systems.
0010 // (Windows).
0011 //
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_EXECUTIONENGINE_MCJIT_H
0015 #define LLVM_EXECUTIONENGINE_MCJIT_H
0016 
0017 #include "llvm/ExecutionEngine/ExecutionEngine.h"
0018 #include <cstdlib>
0019 
0020 extern "C" void LLVMLinkInMCJIT();
0021 
0022 namespace {
0023   struct ForceMCJITLinking {
0024     ForceMCJITLinking() {
0025       // We must reference MCJIT in such a way that compilers will not
0026       // delete it all as dead code, even with whole program optimization,
0027       // yet is effectively a NO-OP. As the compiler isn't smart enough
0028       // to know that getenv() never returns -1, this will do the job.
0029       // This is so that globals in the translation units where these functions
0030       // are defined are forced to be initialized, populating various
0031       // registries.
0032       if (std::getenv("bar") != (char*) -1)
0033         return;
0034 
0035       LLVMLinkInMCJIT();
0036     }
0037   } ForceMCJITLinking;
0038 }
0039 
0040 #endif