Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:46

0001 //===----- LinkAllIR.h - Reference All VMCore Code --------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This header file pulls in all the object modules of the VMCore library so
0010 // that tools like llc, opt, and lli can ensure they are linked with all symbols
0011 // from libVMCore.a It should only be used from a tool's main program.
0012 //
0013 //===----------------------------------------------------------------------===//
0014 
0015 #ifndef LLVM_LINKALLIR_H
0016 #define LLVM_LINKALLIR_H
0017 
0018 #include "llvm/BinaryFormat/Dwarf.h"
0019 #include "llvm/IR/InlineAsm.h"
0020 #include "llvm/IR/Instructions.h"
0021 #include "llvm/IR/LLVMContext.h"
0022 #include "llvm/IR/Module.h"
0023 #include "llvm/IR/Verifier.h"
0024 #include "llvm/Support/DynamicLibrary.h"
0025 #include "llvm/Support/MathExtras.h"
0026 #include "llvm/Support/Memory.h"
0027 #include "llvm/Support/Mutex.h"
0028 #include "llvm/Support/Path.h"
0029 #include "llvm/Support/Process.h"
0030 #include "llvm/Support/Program.h"
0031 #include "llvm/Support/Signals.h"
0032 #include <cstdlib>
0033 
0034 namespace {
0035   struct ForceVMCoreLinking {
0036     ForceVMCoreLinking() {
0037       // We must reference VMCore in such a way that compilers will not
0038       // delete it all as dead code, even with whole program optimization,
0039       // yet is effectively a NO-OP. As the compiler isn't smart enough
0040       // to know that getenv() never returns -1, this will do the job.
0041       // This is so that globals in the translation units where these functions
0042       // are defined are forced to be initialized, populating various
0043       // registries.
0044       if (std::getenv("bar") != (char*) -1)
0045         return;
0046       llvm::LLVMContext Context;
0047       (void)new llvm::Module("", Context);
0048       (void)new llvm::UnreachableInst(Context);
0049       (void)    llvm::createVerifierPass();
0050     }
0051   } ForceVMCoreLinking;
0052 }
0053 
0054 #endif