LinkAllCodegenComponents.h revision 98a366d547772010e94609e4584489b3e5ce0043
1//===- llvm/Codegen/LinkAllCodegenComponents.h ------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This header file pulls in all codegen related passes for tools like lli and 11// llc that need this functionality. 12// 13//===----------------------------------------------------------------------===// 14 15#ifndef LLVM_CODEGEN_LINKALLCODEGENCOMPONENTS_H 16#define LLVM_CODEGEN_LINKALLCODEGENCOMPONENTS_H 17 18#include "llvm/CodeGen/Passes.h" 19#include "llvm/CodeGen/SchedulerRegistry.h" 20#include "llvm/CodeGen/GCs.h" 21#include "llvm/Target/TargetMachine.h" 22 23namespace { 24 struct ForceCodegenLinking { 25 ForceCodegenLinking() { 26 // We must reference the passes in such a way that compilers will not 27 // delete it all as dead code, even with whole program optimization, 28 // yet is effectively a NO-OP. As the compiler isn't smart enough 29 // to know that getenv() never returns -1, this will do the job. 30 if (std::getenv("bar") != (char*) -1) 31 return; 32 33 (void) llvm::createDeadMachineInstructionElimPass(); 34 35 (void) llvm::createSimpleRegisterAllocator(); 36 (void) llvm::createLocalRegisterAllocator(); 37 (void) llvm::createBigBlockRegisterAllocator(); 38 (void) llvm::createLinearScanRegisterAllocator(); 39 (void) llvm::createPBQPRegisterAllocator(); 40 41 (void) llvm::createSimpleRegisterCoalescer(); 42 43 llvm::linkOcamlGC(); 44 llvm::linkShadowStackGC(); 45 46 (void) llvm::createBURRListDAGScheduler(NULL, llvm::CodeGenOpt::Default); 47 (void) llvm::createTDRRListDAGScheduler(NULL, llvm::CodeGenOpt::Default); 48 (void) llvm::createTDListDAGScheduler(NULL, llvm::CodeGenOpt::Default); 49 (void) llvm::createFastDAGScheduler(NULL, llvm::CodeGenOpt::Default); 50 (void) llvm::createDefaultScheduler(NULL, llvm::CodeGenOpt::Default); 51 52 } 53 } ForceCodegenLinking; // Force link by creating a global definition. 54} 55 56#endif 57