LLVM API Documentation
00001 //===- llvm/Codegen/LinkAllAsmWriterComponents.h ----------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This header file pulls in all assembler writer related passes for tools like 00011 // llc that need this functionality. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef LLVM_CODEGEN_LINKALLASMWRITERCOMPONENTS_H 00016 #define LLVM_CODEGEN_LINKALLASMWRITERCOMPONENTS_H 00017 00018 #include "llvm/CodeGen/GCs.h" 00019 00020 namespace { 00021 struct ForceAsmWriterLinking { 00022 ForceAsmWriterLinking() { 00023 // We must reference the plug-ins in such a way that compilers will not 00024 // delete it all as dead code, even with whole program optimization, 00025 // yet is effectively a NO-OP. As the compiler isn't smart enough 00026 // to know that getenv() never returns -1, this will do the job. 00027 if (std::getenv("bar") != (char*) -1) 00028 return; 00029 00030 llvm::linkOcamlGCPrinter(); 00031 00032 } 00033 } ForceAsmWriterLinking; // Force link by creating a global definition. 00034 } 00035 00036 #endif // LLVM_CODEGEN_LINKALLASMWRITERCOMPONENTS_H