1249259Sdim//===----- LinkAllIR.h - Reference All VMCore Code --------------*- C++ -*-===//
2249259Sdim//
3249259Sdim//                      The LLVM Compiler Infrastructure
4249259Sdim//
5249259Sdim// This file is distributed under the University of Illinois Open Source
6249259Sdim// License. See LICENSE.TXT for details.
7249259Sdim//
8249259Sdim//===----------------------------------------------------------------------===//
9249259Sdim//
10249259Sdim// This header file pulls in all the object modules of the VMCore library so
11249259Sdim// that tools like llc, opt, and lli can ensure they are linked with all symbols
12249259Sdim// from libVMCore.a It should only be used from a tool's main program.
13249259Sdim//
14249259Sdim//===----------------------------------------------------------------------===//
15249259Sdim
16249259Sdim#ifndef LLVM_LINKALLIR_H
17249259Sdim#define LLVM_LINKALLIR_H
18249259Sdim
19249259Sdim#include "llvm/Analysis/Verifier.h"
20249259Sdim#include "llvm/IR/InlineAsm.h"
21249259Sdim#include "llvm/IR/Instructions.h"
22249259Sdim#include "llvm/IR/IntrinsicInst.h"
23249259Sdim#include "llvm/IR/LLVMContext.h"
24249259Sdim#include "llvm/IR/Module.h"
25249259Sdim#include "llvm/Support/Dwarf.h"
26249259Sdim#include "llvm/Support/DynamicLibrary.h"
27249259Sdim#include "llvm/Support/MathExtras.h"
28249259Sdim#include "llvm/Support/Memory.h"
29249259Sdim#include "llvm/Support/Mutex.h"
30249259Sdim#include "llvm/Support/Path.h"
31249259Sdim#include "llvm/Support/Process.h"
32249259Sdim#include "llvm/Support/Program.h"
33249259Sdim#include "llvm/Support/Signals.h"
34249259Sdim#include "llvm/Support/TimeValue.h"
35249259Sdim#include <cstdlib>
36249259Sdim
37249259Sdimnamespace {
38249259Sdim  struct ForceVMCoreLinking {
39249259Sdim    ForceVMCoreLinking() {
40249259Sdim      // We must reference VMCore in such a way that compilers will not
41249259Sdim      // delete it all as dead code, even with whole program optimization,
42249259Sdim      // yet is effectively a NO-OP. As the compiler isn't smart enough
43249259Sdim      // to know that getenv() never returns -1, this will do the job.
44249259Sdim      if (std::getenv("bar") != (char*) -1)
45249259Sdim        return;
46249259Sdim      (void)new llvm::Module("", llvm::getGlobalContext());
47249259Sdim      (void)new llvm::UnreachableInst(llvm::getGlobalContext());
48249259Sdim      (void)    llvm::createVerifierPass();
49249259Sdim    }
50249259Sdim  } ForceVMCoreLinking;
51249259Sdim}
52249259Sdim
53249259Sdim#endif
54