LLVM API Documentation

Interpreter.h

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