Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Target/NVPTX/NVPTXTargetMachine.h
Line
Count
Source (jump to first uncovered line)
1
//===-- NVPTXTargetMachine.h - Define TargetMachine for NVPTX ---*- 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 file declares the NVPTX specific subclass of TargetMachine.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_LIB_TARGET_NVPTX_NVPTXTARGETMACHINE_H
14
#define LLVM_LIB_TARGET_NVPTX_NVPTXTARGETMACHINE_H
15
16
#include "ManagedStringPool.h"
17
#include "NVPTXSubtarget.h"
18
#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
19
#include "llvm/CodeGen/TargetFrameLowering.h"
20
#include "llvm/Target/TargetMachine.h"
21
22
namespace llvm {
23
24
/// NVPTXTargetMachine
25
///
26
class NVPTXTargetMachine : public LLVMTargetMachine {
27
  bool is64bit;
28
  // Use 32-bit pointers for accessing const/local/short AS.
29
  bool UseShortPointers;
30
  std::unique_ptr<TargetLoweringObjectFile> TLOF;
31
  NVPTX::DrvInterface drvInterface;
32
  NVPTXSubtarget Subtarget;
33
34
  // Hold Strings that can be free'd all together with NVPTXTargetMachine
35
  ManagedStringPool ManagedStrPool;
36
37
public:
38
  NVPTXTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
39
                     StringRef FS, const TargetOptions &Options,
40
                     Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
41
                     CodeGenOpt::Level OP, bool is64bit);
42
43
  ~NVPTXTargetMachine() override;
44
9.07k
  const NVPTXSubtarget *getSubtargetImpl(const Function &) const override {
45
9.07k
    return &Subtarget;
46
9.07k
  }
47
20.4k
  const NVPTXSubtarget *getSubtargetImpl() const { return &Subtarget; }
48
565
  bool is64Bit() const { return is64bit; }
49
20
  bool useShortPointers() const { return UseShortPointers; }
50
50.3k
  NVPTX::DrvInterface getDrvInterface() const { return drvInterface; }
51
2.65k
  ManagedStringPool *getManagedStrPool() const {
52
2.65k
    return const_cast<ManagedStringPool *>(&ManagedStrPool);
53
2.65k
  }
54
55
  TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
56
57
  // Emission of machine code through MCJIT is not supported.
58
  bool addPassesToEmitMC(PassManagerBase &, MCContext *&, raw_pwrite_stream &,
59
0
                         bool = true) override {
60
0
    return true;
61
0
  }
62
8.34k
  TargetLoweringObjectFile *getObjFileLowering() const override {
63
8.34k
    return TLOF.get();
64
8.34k
  }
65
66
  void adjustPassManager(PassManagerBuilder &) override;
67
68
  TargetTransformInfo getTargetTransformInfo(const Function &F) override;
69
70
0
  bool isMachineVerifierClean() const override {
71
0
    return false;
72
0
  }
73
}; // NVPTXTargetMachine.
74
75
class NVPTXTargetMachine32 : public NVPTXTargetMachine {
76
  virtual void anchor();
77
public:
78
  NVPTXTargetMachine32(const Target &T, const Triple &TT, StringRef CPU,
79
                       StringRef FS, const TargetOptions &Options,
80
                       Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
81
                       CodeGenOpt::Level OL, bool JIT);
82
};
83
84
class NVPTXTargetMachine64 : public NVPTXTargetMachine {
85
  virtual void anchor();
86
public:
87
  NVPTXTargetMachine64(const Target &T, const Triple &TT, StringRef CPU,
88
                       StringRef FS, const TargetOptions &Options,
89
                       Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
90
                       CodeGenOpt::Level OL, bool JIT);
91
};
92
93
} // end namespace llvm
94
95
#endif