LinkAllCodegenComponents.h revision d3ead4329eaa46937245f5cc8402e749af2a37dc
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/ScheduleDAG.h" 20#include "llvm/CodeGen/GCs.h" 21 22namespace { 23 struct ForceCodegenLinking { 24 ForceCodegenLinking() { 25 // We must reference the passes in such a way that compilers will not 26 // delete it all as dead code, even with whole program optimization, 27 // yet is effectively a NO-OP. As the compiler isn't smart enough 28 // to know that getenv() never returns -1, this will do the job. 29 if (std::getenv("bar") != (char*) -1) 30 return; 31 32 (void) llvm::createDeadMachineInstructionElimPass(); 33 34 (void) llvm::createSimpleRegisterAllocator(); 35 (void) llvm::createLocalRegisterAllocator(); 36 (void) llvm::createBigBlockRegisterAllocator(); 37 (void) llvm::createLinearScanRegisterAllocator(); 38 39 (void) llvm::createSimpleRegisterCoalescer(); 40 41 llvm::linkOcamlGC(); 42 llvm::linkShadowStackGC(); 43 44 (void) llvm::createBURRListDAGScheduler(NULL, NULL, NULL, false); 45 (void) llvm::createTDRRListDAGScheduler(NULL, NULL, NULL, false); 46 (void) llvm::createTDListDAGScheduler(NULL, NULL, NULL, false); 47 (void) llvm::createDefaultScheduler(NULL, NULL, NULL, false); 48 49 } 50 } ForceCodegenLinking; // Force link by creating a global definition. 51} 52 53#endif 54