LLVM API Documentation

LinkAllVMCore.h

Go to the documentation of this file.
00001 //===- LinkAllVMCore.h - Reference All VMCore Code --------------*- C++ -*-===//
00002 //
00003 //                      The LLVM Compiler Infrastructure
00004 //
00005 // This file was developed by Reid Spencer and is distributed under the
00006 // University of Illinois Open Source License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This header file pulls in all the object modules of the VMCore library so
00011 // that tools like llc, opt, and lli can ensure they are linked with all symbols
00012 // from libVMCore.a It should only be used from a tool's main program.
00013 //
00014 //===----------------------------------------------------------------------===//
00015 
00016 #ifndef LLVM_LINKALLVMCORE_H
00017 #define LLVM_LINKALLVMCORE_H
00018 
00019 #include "llvm/System/IncludeFile.h"
00020 
00021 #include "llvm/Module.h"
00022 #include "llvm/Instructions.h"
00023 #include "llvm/IntrinsicInst.h"
00024 #include "llvm/InlineAsm.h"
00025 #include "llvm/Analysis/Verifier.h"
00026 #include "llvm/System/Alarm.h"
00027 #include "llvm/System/DynamicLibrary.h"
00028 #include "llvm/System/MappedFile.h"
00029 #include "llvm/System/Memory.h"
00030 #include "llvm/System/Mutex.h"
00031 #include "llvm/System/Path.h"
00032 #include "llvm/System/Process.h"
00033 #include "llvm/System/Program.h"
00034 #include "llvm/System/Signals.h"
00035 #include "llvm/System/TimeValue.h"
00036 #include "llvm/Support/Dwarf.h"
00037 #include "llvm/Support/Mangler.h"
00038 #include "llvm/Support/MathExtras.h"
00039 #include "llvm/Support/SlowOperationInformer.h"
00040 
00041 namespace {
00042   struct ForceVMCoreLinking {
00043     ForceVMCoreLinking() {
00044       // We must reference VMCore in such a way that compilers will not
00045       // delete it all as dead code, even with whole program optimization,
00046       // yet is effectively a NO-OP. As the compiler isn't smart enough
00047       // to know that getenv() never returns -1, this will do the job.
00048       if (std::getenv("bar") != (char*) -1)
00049         return;
00050       (void)new llvm::Module("");
00051       (void)new llvm::UnreachableInst();
00052       (void)    llvm::createVerifierPass(); 
00053     }
00054   } ForceVMCoreLinking;
00055 }
00056 
00057 #endif