fa7c39995b60321347bb6467583cc5018130fec2
[oota-llvm.git] / include / llvm / LinkAllVMCore.h
1 //===- LinkAllVMCore.h - Reference All VMCore Code --------------*- C++ -*-===//
2 //
3 //                      The LLVM Compiler Infrastructure
4 //
5 // This file was developed by Reid Spencer and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This header file pulls in all the object modules of the VMCore library so
11 // that tools like llc, opt, and lli can ensure they are linked with all symbols
12 // from libVMCore.a It should only be used from a tool's main program.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_LINKALLVMCORE_H
17 #define LLVM_LINKALLVMCORE_H
18
19 #include "llvm/Support/IncludeFile.h"
20 #include "llvm/Module.h"
21 #include "llvm/Instructions.h"
22 #include "llvm/IntrinsicInst.h"
23 #include "llvm/Analysis/Verifier.h"
24
25 namespace {
26   struct ForceVMCoreLinking {
27     ForceVMCoreLinking() {
28       // We must reference VMCore in such a way that compilers will not
29       // delete it all as dead code, even with whole program optimization,
30       // yet is effectively a NO-OP. As the compiler isn't smart enough
31       // to know that getenv() never returns -1, this will do the job.
32       if (std::getenv("bar") != (char*) -1)
33         return;
34       (void)new llvm::Module("");
35       (void)new llvm::UnreachableInst();
36       (void)    llvm::createVerifierPass(); 
37     }
38   } ForceVMCoreLinking;
39 }
40
41 #endif