LLVM API Documentation
00001 //===- llvm/Codegen/LinkAllCodegenComponents.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 codegen related passes for tools like lli and 00011 // llc that need this functionality. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef LLVM_CODEGEN_LINKALLCODEGENCOMPONENTS_H 00016 #define LLVM_CODEGEN_LINKALLCODEGENCOMPONENTS_H 00017 00018 #include "llvm/CodeGen/GCs.h" 00019 #include "llvm/CodeGen/Passes.h" 00020 #include "llvm/CodeGen/SchedulerRegistry.h" 00021 #include "llvm/Target/TargetMachine.h" 00022 #include <cstdlib> 00023 00024 namespace { 00025 struct ForceCodegenLinking { 00026 ForceCodegenLinking() { 00027 // We must reference the passes in such a way that compilers will not 00028 // delete it all as dead code, even with whole program optimization, 00029 // yet is effectively a NO-OP. As the compiler isn't smart enough 00030 // to know that getenv() never returns -1, this will do the job. 00031 if (std::getenv("bar") != (char*) -1) 00032 return; 00033 00034 (void) llvm::createFastRegisterAllocator(); 00035 (void) llvm::createBasicRegisterAllocator(); 00036 (void) llvm::createGreedyRegisterAllocator(); 00037 (void) llvm::createDefaultPBQPRegisterAllocator(); 00038 00039 llvm::linkOcamlGC(); 00040 llvm::linkErlangGC(); 00041 llvm::linkShadowStackGC(); 00042 00043 (void) llvm::createBURRListDAGScheduler(nullptr, 00044 llvm::CodeGenOpt::Default); 00045 (void) llvm::createSourceListDAGScheduler(nullptr, 00046 llvm::CodeGenOpt::Default); 00047 (void) llvm::createHybridListDAGScheduler(nullptr, 00048 llvm::CodeGenOpt::Default); 00049 (void) llvm::createFastDAGScheduler(nullptr, llvm::CodeGenOpt::Default); 00050 (void) llvm::createDefaultScheduler(nullptr, llvm::CodeGenOpt::Default); 00051 (void) llvm::createVLIWDAGScheduler(nullptr, llvm::CodeGenOpt::Default); 00052 00053 } 00054 } ForceCodegenLinking; // Force link by creating a global definition. 00055 } 00056 00057 #endif