~pali/+junk/llvm-toolchain-3.7

« back to all changes in this revision

Viewing changes to include/llvm/LinkAllIR.h

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2015-07-15 17:51:08 UTC
  • Revision ID: package-import@ubuntu.com-20150715175108-l8mynwovkx4zx697
Tags: upstream-3.7~+rc2
ImportĀ upstreamĀ versionĀ 3.7~+rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//===----- LinkAllIR.h - Reference All VMCore Code --------------*- C++ -*-===//
 
2
//
 
3
//                      The LLVM Compiler Infrastructure
 
4
//
 
5
// This file is distributed under the University of Illinois Open Source
 
6
// 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_LINKALLIR_H
 
17
#define LLVM_LINKALLIR_H
 
18
 
 
19
#include "llvm/IR/InlineAsm.h"
 
20
#include "llvm/IR/Instructions.h"
 
21
#include "llvm/IR/IntrinsicInst.h"
 
22
#include "llvm/IR/LLVMContext.h"
 
23
#include "llvm/IR/Module.h"
 
24
#include "llvm/IR/Verifier.h"
 
25
#include "llvm/Support/Dwarf.h"
 
26
#include "llvm/Support/DynamicLibrary.h"
 
27
#include "llvm/Support/MathExtras.h"
 
28
#include "llvm/Support/Memory.h"
 
29
#include "llvm/Support/Mutex.h"
 
30
#include "llvm/Support/Path.h"
 
31
#include "llvm/Support/Process.h"
 
32
#include "llvm/Support/Program.h"
 
33
#include "llvm/Support/Signals.h"
 
34
#include "llvm/Support/TimeValue.h"
 
35
#include <cstdlib>
 
36
 
 
37
namespace {
 
38
  struct ForceVMCoreLinking {
 
39
    ForceVMCoreLinking() {
 
40
      // We must reference VMCore in such a way that compilers will not
 
41
      // delete it all as dead code, even with whole program optimization,
 
42
      // yet is effectively a NO-OP. As the compiler isn't smart enough
 
43
      // to know that getenv() never returns -1, this will do the job.
 
44
      if (std::getenv("bar") != (char*) -1)
 
45
        return;
 
46
      (void)new llvm::Module("", llvm::getGlobalContext());
 
47
      (void)new llvm::UnreachableInst(llvm::getGlobalContext());
 
48
      (void)    llvm::createVerifierPass(); 
 
49
    }
 
50
  } ForceVMCoreLinking;
 
51
}
 
52
 
 
53
#endif