Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:29

0001 //===- llvm/Codegen/LinkAllAsmWriterComponents.h ----------------*- 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 assembler writer related passes for tools like
0010 // llc that need this functionality.
0011 //
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_CODEGEN_LINKALLASMWRITERCOMPONENTS_H
0015 #define LLVM_CODEGEN_LINKALLASMWRITERCOMPONENTS_H
0016 
0017 #include "llvm/IR/BuiltinGCs.h"
0018 #include <cstdlib>
0019 
0020 namespace {
0021   struct ForceAsmWriterLinking {
0022     ForceAsmWriterLinking() {
0023       // We must reference the plug-ins in such a way that compilers will not
0024       // delete it all as dead code, even with whole program optimization,
0025       // yet is effectively a NO-OP. As the compiler isn't smart enough
0026       // to know that getenv() never returns -1, this will do the job.
0027       // This is so that globals in the translation units where these functions
0028       // are defined are forced to be initialized, populating various
0029       // registries.
0030       if (std::getenv("bar") != (char*) -1)
0031         return;
0032 
0033       llvm::linkOcamlGCPrinter();
0034       llvm::linkErlangGCPrinter();
0035 
0036     }
0037   } ForceAsmWriterLinking; // Force link by creating a global definition.
0038 }
0039 
0040 #endif // LLVM_CODEGEN_LINKALLASMWRITERCOMPONENTS_H