Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Target/NVPTX/NVPTXMachineFunctionInfo.h
Line
Count
Source (jump to first uncovered line)
1
//===-- NVPTXMachineFunctionInfo.h - NVPTX-specific Function Info  --------===//
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 class is attached to a MachineFunction instance and tracks target-
10
// dependent information
11
//
12
//===----------------------------------------------------------------------===//
13
14
#ifndef LLVM_LIB_TARGET_NVPTX_NVPTXMACHINEFUNCTIONINFO_H
15
#define LLVM_LIB_TARGET_NVPTX_NVPTXMACHINEFUNCTIONINFO_H
16
17
#include "llvm/CodeGen/MachineFunction.h"
18
19
namespace llvm {
20
class NVPTXMachineFunctionInfo : public MachineFunctionInfo {
21
private:
22
  /// Stores a mapping from index to symbol name for removing image handles
23
  /// on Fermi.
24
  SmallVector<std::string, 8> ImageHandleList;
25
26
public:
27
17
  NVPTXMachineFunctionInfo(MachineFunction &MF) {}
28
29
  /// Returns the index for the symbol \p Symbol. If the symbol was previously,
30
  /// added, the same index is returned. Otherwise, the symbol is added and the
31
  /// new index is returned.
32
11
  unsigned getImageHandleSymbolIndex(const char *Symbol) {
33
11
    // Is the symbol already present?
34
12
    for (unsigned i = 0, e = ImageHandleList.size(); i != e; 
++i1
)
35
1
      if (ImageHandleList[i] == std::string(Symbol))
36
0
        return i;
37
11
    // Nope, insert it
38
11
    ImageHandleList.push_back(Symbol);
39
11
    return ImageHandleList.size()-1;
40
11
  }
41
42
  /// Returns the symbol name at the given index.
43
11
  const char *getImageHandleSymbol(unsigned Idx) const {
44
11
    assert(ImageHandleList.size() > Idx && "Bad index");
45
11
    return ImageHandleList[Idx].c_str();
46
11
  }
47
};
48
}
49
50
#endif