NVPTXBaseInfo.h revision 3639ce2575660a0e6938d2e84e8bd9a738fd7051
149683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski//===-- NVPTXBaseInfo.h - Top-level definitions for NVPTX -------*- C++ -*-===//
249683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski//
349683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski//                     The LLVM Compiler Infrastructure
449683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski//
549683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// This file is distributed under the University of Illinois Open Source
649683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// License. See LICENSE.TXT for details.
749683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski//
849683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski//===----------------------------------------------------------------------===//
949683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski//
1049683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// This file contains small standalone helper functions and enum definitions for
1149683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// the NVPTX target useful for the compiler back-end and the MC libraries.
1249683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// As such, it deliberately does not include references to LLVM core
1349683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// code gen types, passes, etc..
1449683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski//
1549683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski//===----------------------------------------------------------------------===//
1649683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski
1749683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski#ifndef NVPTXBASEINFO_H
1849683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski#define NVPTXBASEINFO_H
1949683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski
2049683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinskinamespace llvm {
2149683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski
2249683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinskienum AddressSpace {
2349683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  ADDRESS_SPACE_GENERIC = 0,
2449683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  ADDRESS_SPACE_GLOBAL = 1,
2549683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  ADDRESS_SPACE_CONST_NOT_GEN = 2, // Not part of generic space
2649683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  ADDRESS_SPACE_SHARED = 3,
2749683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  ADDRESS_SPACE_CONST = 4,
2849683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  ADDRESS_SPACE_LOCAL = 5,
2949683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski
3049683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  // NVVM Internal
3149683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  ADDRESS_SPACE_PARAM = 101
3249683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski};
3349683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski
3449683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinskienum PropertyAnnotation {
3549683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  PROPERTY_MAXNTID_X = 0,
3649683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  PROPERTY_MAXNTID_Y,
3749683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  PROPERTY_MAXNTID_Z,
3849683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  PROPERTY_REQNTID_X,
3949683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  PROPERTY_REQNTID_Y,
4049683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  PROPERTY_REQNTID_Z,
4149683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  PROPERTY_MINNCTAPERSM,
4249683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  PROPERTY_ISTEXTURE,
4349683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  PROPERTY_ISSURFACE,
4449683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  PROPERTY_ISSAMPLER,
4549683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  PROPERTY_ISREADONLY_IMAGE_PARAM,
4649683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  PROPERTY_ISWRITEONLY_IMAGE_PARAM,
4749683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  PROPERTY_ISKERNEL_FUNCTION,
4849683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  PROPERTY_ALIGN,
4949683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski
5049683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  // last property
5149683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski  PROPERTY_LAST
5249683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski};
5349683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski
5449683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinskiconst unsigned AnnotationNameLen = 8; // length of each annotation name
553639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinskiconst char PropertyAnnotationNames[PROPERTY_LAST + 1][AnnotationNameLen + 1] = {
563639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski  "maxntidx",                         // PROPERTY_MAXNTID_X
573639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski  "maxntidy",                         // PROPERTY_MAXNTID_Y
583639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski  "maxntidz",                         // PROPERTY_MAXNTID_Z
593639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski  "reqntidx",                         // PROPERTY_REQNTID_X
603639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski  "reqntidy",                         // PROPERTY_REQNTID_Y
613639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski  "reqntidz",                         // PROPERTY_REQNTID_Z
623639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski  "minctasm",                         // PROPERTY_MINNCTAPERSM
633639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski  "texture",                          // PROPERTY_ISTEXTURE
643639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski  "surface",                          // PROPERTY_ISSURFACE
653639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski  "sampler",                          // PROPERTY_ISSAMPLER
663639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski  "rdoimage",                         // PROPERTY_ISREADONLY_IMAGE_PARAM
673639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski  "wroimage",                         // PROPERTY_ISWRITEONLY_IMAGE_PARAM
683639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski  "kernel",                           // PROPERTY_ISKERNEL_FUNCTION
693639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski  "align",                            // PROPERTY_ALIGN
7049683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski
713639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski              // last property
723639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski  "proplast", // PROPERTY_LAST
7349683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski};
7449683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski
7549683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// name of named metadata used for global annotations
7649683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski#if defined(__GNUC__)
7749683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// As this is declared to be static but some of the .cpp files that
7849683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// include NVVM.h do not use this array, gcc gives a warning when
7949683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// compiling those .cpp files, hence __attribute__((unused)).
8049683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski__attribute__((unused))
8149683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski#endif
823639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski    static const char *NamedMDForAnnotations = "nvvm.annotations";
8349683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski
8449683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski}
8549683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski
8649683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski#endif
87