Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
14 pmbaty 1
//===- llvm/Codegen/LinkAllCodegenComponents.h ------------------*- C++ -*-===//
2
//
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
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// This header file pulls in all codegen related passes for tools like lli and
10
// llc that need this functionality.
11
//
12
//===----------------------------------------------------------------------===//
13
 
14
#ifndef LLVM_CODEGEN_LINKALLCODEGENCOMPONENTS_H
15
#define LLVM_CODEGEN_LINKALLCODEGENCOMPONENTS_H
16
 
17
#include "llvm/CodeGen/Passes.h"
18
#include "llvm/CodeGen/SchedulerRegistry.h"
19
#include "llvm/Target/TargetMachine.h"
20
#include <cstdlib>
21
 
22
namespace {
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
      // This is so that globals in the translation units where these functions
30
      // are defined are forced to be initialized, populating various
31
      // registries.
32
      if (std::getenv("bar") != (char*) -1)
33
        return;
34
 
35
      (void) llvm::createFastRegisterAllocator();
36
      (void) llvm::createBasicRegisterAllocator();
37
      (void) llvm::createGreedyRegisterAllocator();
38
      (void) llvm::createDefaultPBQPRegisterAllocator();
39
 
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);
49
 
50
    }
51
  } ForceCodegenLinking; // Force link by creating a global definition.
52
}
53
 
54
#endif