Coverage Report

Created: 2019-02-21 13:17

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h
Line
Count
Source (jump to first uncovered line)
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/BuiltinGCs.h"
18
#include "llvm/CodeGen/Passes.h"
19
#include "llvm/CodeGen/SchedulerRegistry.h"
20
#include "llvm/Target/TargetMachine.h"
21
#include <cstdlib>
22
23
namespace {
24
  struct ForceCodegenLinking {
25
22.5k
    ForceCodegenLinking() {
26
22.5k
      // We must reference the passes in such a way that compilers will not
27
22.5k
      // delete it all as dead code, even with whole program optimization,
28
22.5k
      // yet is effectively a NO-OP. As the compiler isn't smart enough
29
22.5k
      // to know that getenv() never returns -1, this will do the job.
30
22.5k
      if (std::getenv("bar") != (char*) -1)
31
22.5k
        return;
32
0
33
0
      (void) llvm::createFastRegisterAllocator();
34
0
      (void) llvm::createBasicRegisterAllocator();
35
0
      (void) llvm::createGreedyRegisterAllocator();
36
0
      (void) llvm::createDefaultPBQPRegisterAllocator();
37
0
38
0
      llvm::linkAllBuiltinGCs();
39
0
40
0
      (void) llvm::createBURRListDAGScheduler(nullptr,
41
0
                                              llvm::CodeGenOpt::Default);
42
0
      (void) llvm::createSourceListDAGScheduler(nullptr,
43
0
                                                llvm::CodeGenOpt::Default);
44
0
      (void) llvm::createHybridListDAGScheduler(nullptr,
45
0
                                                llvm::CodeGenOpt::Default);
46
0
      (void) llvm::createFastDAGScheduler(nullptr, llvm::CodeGenOpt::Default);
47
0
      (void) llvm::createDefaultScheduler(nullptr, llvm::CodeGenOpt::Default);
48
0
      (void) llvm::createVLIWDAGScheduler(nullptr, llvm::CodeGenOpt::Default);
49
0
50
0
    }
51
  } ForceCodegenLinking; // Force link by creating a global definition.
52
}
53
54
#endif