1 //===- llvm/Codegen/LinkAllCodegenComponents.h ------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This header file pulls in all codegen related passes for tools like lli and
11 // llc that need this functionality.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CODEGEN_LINKALLCODEGENCOMPONENTS_H
16 #define LLVM_CODEGEN_LINKALLCODEGENCOMPONENTS_H
18 #include "llvm/CodeGen/GCs.h"
19 #include "llvm/CodeGen/Passes.h"
20 #include "llvm/CodeGen/SchedulerRegistry.h"
21 #include "llvm/Target/TargetMachine.h"
25 struct ForceCodegenLinking {
26 ForceCodegenLinking() {
27 // We must reference the passes in such a way that compilers will not
28 // delete it all as dead code, even with whole program optimization,
29 // yet is effectively a NO-OP. As the compiler isn't smart enough
30 // to know that getenv() never returns -1, this will do the job.
31 if (std::getenv("bar") != (char*) -1)
34 (void) llvm::createFastRegisterAllocator();
35 (void) llvm::createBasicRegisterAllocator();
36 (void) llvm::createGreedyRegisterAllocator();
37 (void) llvm::createDefaultPBQPRegisterAllocator();
39 llvm::linkCoreCLRGC();
42 llvm::linkShadowStackGC();
43 llvm::linkStatepointExampleGC();
45 (void) llvm::createBURRListDAGScheduler(nullptr,
46 llvm::CodeGenOpt::Default);
47 (void) llvm::createSourceListDAGScheduler(nullptr,
48 llvm::CodeGenOpt::Default);
49 (void) llvm::createHybridListDAGScheduler(nullptr,
50 llvm::CodeGenOpt::Default);
51 (void) llvm::createFastDAGScheduler(nullptr, llvm::CodeGenOpt::Default);
52 (void) llvm::createDefaultScheduler(nullptr, llvm::CodeGenOpt::Default);
53 (void) llvm::createVLIWDAGScheduler(nullptr, llvm::CodeGenOpt::Default);
56 } ForceCodegenLinking; // Force link by creating a global definition.