comparison include/llvm/ExecutionEngine/Interpreter.h @ 100:7d135dc70f03

LLVM 3.9
author Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
date Tue, 26 Jan 2016 22:53:40 +0900
parents 95c75e76d11b
children
comparison
equal deleted inserted replaced
96:6418606d0ead 100:7d135dc70f03
14 14
15 #ifndef LLVM_EXECUTIONENGINE_INTERPRETER_H 15 #ifndef LLVM_EXECUTIONENGINE_INTERPRETER_H
16 #define LLVM_EXECUTIONENGINE_INTERPRETER_H 16 #define LLVM_EXECUTIONENGINE_INTERPRETER_H
17 17
18 #include "llvm/ExecutionEngine/ExecutionEngine.h" 18 #include "llvm/ExecutionEngine/ExecutionEngine.h"
19 #include <cstdlib>
20 19
21 extern "C" void LLVMLinkInInterpreter(); 20 extern "C" void LLVMLinkInInterpreter();
22 21
23 namespace { 22 namespace {
24 struct ForceInterpreterLinking { 23 struct ForceInterpreterLinking {
25 ForceInterpreterLinking() { 24 ForceInterpreterLinking() { LLVMLinkInInterpreter(); }
26 // We must reference the interpreter in such a way that compilers will not
27 // delete it all as dead code, even with whole program optimization,
28 // yet is effectively a NO-OP. As the compiler isn't smart enough
29 // to know that getenv() never returns -1, this will do the job.
30 if (std::getenv("bar") != (char*) -1)
31 return;
32
33 LLVMLinkInInterpreter();
34 }
35 } ForceInterpreterLinking; 25 } ForceInterpreterLinking;
36 } 26 }
37 27
38 #endif 28 #endif