aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/NVPTX/MCTargetDesc/NVPTXBaseInfo.h
blob: b55664ed32a7706390b99aa0b258020712d24462 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//===-- NVPTXBaseInfo.h - Top-level definitions for NVPTX -------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains small standalone helper functions and enum definitions for
// the NVPTX target useful for the compiler back-end and the MC libraries.
// As such, it deliberately does not include references to LLVM core
// code gen types, passes, etc..
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIB_TARGET_NVPTX_MCTARGETDESC_NVPTXBASEINFO_H
#define LLVM_LIB_TARGET_NVPTX_MCTARGETDESC_NVPTXBASEINFO_H

namespace llvm {

enum AddressSpace {
  ADDRESS_SPACE_GENERIC = 0,
  ADDRESS_SPACE_GLOBAL = 1,
  ADDRESS_SPACE_SHARED = 3,
  ADDRESS_SPACE_CONST = 4,
  ADDRESS_SPACE_LOCAL = 5,

  // NVVM Internal
  ADDRESS_SPACE_PARAM = 101
};

enum PropertyAnnotation {
  PROPERTY_MAXNTID_X = 0,
  PROPERTY_MAXNTID_Y,
  PROPERTY_MAXNTID_Z,
  PROPERTY_REQNTID_X,
  PROPERTY_REQNTID_Y,
  PROPERTY_REQNTID_Z,
  PROPERTY_MINNCTAPERSM,
  PROPERTY_ISTEXTURE,
  PROPERTY_ISSURFACE,
  PROPERTY_ISSAMPLER,
  PROPERTY_ISREADONLY_IMAGE_PARAM,
  PROPERTY_ISWRITEONLY_IMAGE_PARAM,
  PROPERTY_ISREADWRITE_IMAGE_PARAM,
  PROPERTY_ISKERNEL_FUNCTION,
  PROPERTY_ALIGN,
  PROPERTY_MANAGED,

  // last property
  PROPERTY_LAST
};

const unsigned AnnotationNameLen = 9; // length of each annotation name
const char PropertyAnnotationNames[PROPERTY_LAST + 1][AnnotationNameLen + 1] = {
  "maxntidx",                         // PROPERTY_MAXNTID_X
  "maxntidy",                         // PROPERTY_MAXNTID_Y
  "maxntidz",                         // PROPERTY_MAXNTID_Z
  "reqntidx",                         // PROPERTY_REQNTID_X
  "reqntidy",                         // PROPERTY_REQNTID_Y
  "reqntidz",                         // PROPERTY_REQNTID_Z
  "minctasm",                         // PROPERTY_MINNCTAPERSM
  "texture",                          // PROPERTY_ISTEXTURE
  "surface",                          // PROPERTY_ISSURFACE
  "sampler",                          // PROPERTY_ISSAMPLER
  "rdoimage",                         // PROPERTY_ISREADONLY_IMAGE_PARAM
  "wroimage",                         // PROPERTY_ISWRITEONLY_IMAGE_PARAM
  "rdwrimage",                        // PROPERTY_ISREADWRITE_IMAGE_PARAM
  "kernel",                           // PROPERTY_ISKERNEL_FUNCTION
  "align",                            // PROPERTY_ALIGN
  "managed",                          // PROPERTY_MANAGED

              // last property
  "proplast", // PROPERTY_LAST
};

// name of named metadata used for global annotations
#if defined(__GNUC__)
// As this is declared to be static but some of the .cpp files that
// include NVVM.h do not use this array, gcc gives a warning when
// compiling those .cpp files, hence __attribute__((unused)).
__attribute__((unused))
#endif
    static const char *NamedMDForAnnotations = "nvvm.annotations";

namespace NVPTXII {
enum {
  // These must be kept in sync with TSFlags in NVPTXInstrFormats.td
  IsTexFlag = 0x80,
  IsSuldMask = 0x300,
  IsSuldShift = 8,
  IsSustFlag = 0x400,
  IsSurfTexQueryFlag = 0x800,
  IsTexModeUnifiedFlag = 0x1000
};
} // namespace NVPTXII
} // namespace llvm

#endif