1 //===- llvm/Codegen/LinkAllCodegenComponents.h ------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This header file pulls in all codegen related passes for tools like lli and
10 // llc that need this functionality.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CODEGEN_LINKALLCODEGENCOMPONENTS_H
15 #define LLVM_CODEGEN_LINKALLCODEGENCOMPONENTS_H
17 #include "llvm/CodeGen/BuiltinGCs.h"
18 #include "llvm/CodeGen/Passes.h"
19 #include "llvm/CodeGen/SchedulerRegistry.h"
20 #include "llvm/Target/TargetMachine.h"
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)
33 (void) llvm::createFastRegisterAllocator();
34 (void) llvm::createBasicRegisterAllocator();
35 (void) llvm::createGreedyRegisterAllocator();
36 (void) llvm::createDefaultPBQPRegisterAllocator();
38 llvm::linkAllBuiltinGCs();
40 (void) llvm::createBURRListDAGScheduler(nullptr,
41 llvm::CodeGenOpt::Default
);
42 (void) llvm::createSourceListDAGScheduler(nullptr,
43 llvm::CodeGenOpt::Default
);
44 (void) llvm::createHybridListDAGScheduler(nullptr,
45 llvm::CodeGenOpt::Default
);
46 (void) llvm::createFastDAGScheduler(nullptr, llvm::CodeGenOpt::Default
);
47 (void) llvm::createDefaultScheduler(nullptr, llvm::CodeGenOpt::Default
);
48 (void) llvm::createVLIWDAGScheduler(nullptr, llvm::CodeGenOpt::Default
);
51 } ForceCodegenLinking
; // Force link by creating a global definition.