LLVM API Documentation

include/llvm/ExecutionEngine/MCJIT.h
Go to the documentation of this file.
00001 //===-- MCJIT.h - MC-Based Just-In-Time Execution Engine --------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file forces the MCJIT to link in on certain operating systems.
00011 // (Windows).
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef LLVM_EXECUTIONENGINE_MCJIT_H
00016 #define LLVM_EXECUTIONENGINE_MCJIT_H
00017 
00018 #include "llvm/ExecutionEngine/ExecutionEngine.h"
00019 #include <cstdlib>
00020 
00021 extern "C" void LLVMLinkInMCJIT();
00022 
00023 namespace {
00024   struct ForceMCJITLinking {
00025     ForceMCJITLinking() {
00026       // We must reference MCJIT in such a way that compilers will not
00027       // delete it all as dead code, even with whole program optimization,
00028       // yet is effectively a NO-OP. As the compiler isn't smart enough
00029       // to know that getenv() never returns -1, this will do the job.
00030       if (std::getenv("bar") != (char*) -1)
00031         return;
00032 
00033       LLVMLinkInMCJIT();
00034     }
00035   } ForceMCJITLinking;
00036 }
00037 
00038 #endif