clang
6.0.0
include
clang
Basic
AddressSpaces.h
Go to the documentation of this file.
1
//===--- AddressSpaces.h - Language-specific address spaces -----*- C++ -*-===//
2
//
3
// The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
///
10
/// \file
11
/// \brief Provides definitions for the various language-specific address
12
/// spaces.
13
///
14
//===----------------------------------------------------------------------===//
15
16
#ifndef LLVM_CLANG_BASIC_ADDRESSSPACES_H
17
#define LLVM_CLANG_BASIC_ADDRESSSPACES_H
18
19
#include <assert.h>
20
21
namespace
clang
{
22
23
/// \brief Defines the address space values used by the address space qualifier
24
/// of QualType.
25
///
26
enum class
LangAS
: unsigned {
27
// The default value 0 is the value used in QualType for the the situation
28
// where there is no address space qualifier.
29
Default
= 0,
30
31
// OpenCL specific address spaces.
32
// In OpenCL each l-value must have certain non-default address space, each
33
// r-value must have no address space (i.e. the default address space). The
34
// pointee of a pointer must have non-default address space.
35
opencl_global
,
36
opencl_local
,
37
opencl_constant
,
38
opencl_private
,
39
opencl_generic
,
40
41
// CUDA specific address spaces.
42
cuda_device
,
43
cuda_constant
,
44
cuda_shared
,
45
46
// This denotes the count of language-specific address spaces and also
47
// the offset added to the target-specific address spaces, which are usually
48
// specified by address space attributes __attribute__(address_space(n))).
49
FirstTargetAddressSpace
50
};
51
52
/// The type of a lookup table which maps from language-specific address spaces
53
/// to target-specific ones.
54
typedef
unsigned
LangASMap
[(unsigned)
LangAS::FirstTargetAddressSpace
];
55
56
/// \return whether \p AS is a target-specific address space rather than a
57
/// clang AST address space
58
inline
bool
isTargetAddressSpace
(
LangAS
AS) {
59
return
(
unsigned
)AS >= (unsigned)
LangAS::FirstTargetAddressSpace
;
60
}
61
62
inline
unsigned
toTargetAddressSpace
(
LangAS
AS) {
63
assert(
isTargetAddressSpace
(AS));
64
return
(
unsigned
)AS - (unsigned)
LangAS::FirstTargetAddressSpace
;
65
}
66
67
inline
LangAS
getLangASFromTargetAS
(
unsigned
TargetAS) {
68
return
static_cast<
LangAS
>
((TargetAS) +
69
(
unsigned
)
LangAS::FirstTargetAddressSpace
);
70
}
71
72
}
// namespace clang
73
74
#endif
clang::getLangASFromTargetAS
LangAS getLangASFromTargetAS(unsigned TargetAS)
Definition:
AddressSpaces.h:67
clang::LangAS
LangAS
Defines the address space values used by the address space qualifier of QualType. ...
Definition:
AddressSpaces.h:26
clang::toTargetAddressSpace
unsigned toTargetAddressSpace(LangAS AS)
Definition:
AddressSpaces.h:62
clang::LangAS::opencl_private
clang::LangASMap
unsigned LangASMap[(unsigned) LangAS::FirstTargetAddressSpace]
The type of a lookup table which maps from language-specific address spaces to target-specific ones...
Definition:
AddressSpaces.h:54
clang::LangAS::opencl_local
clang::LangAS::cuda_constant
clang::LangAS::opencl_generic
clang::LangAS::cuda_shared
clang::LangAS::Default
clang::LangAS::cuda_device
clang::isTargetAddressSpace
bool isTargetAddressSpace(LangAS AS)
Definition:
AddressSpaces.h:58
clang
Dataflow Directional Tag Classes.
Definition:
CFGReachabilityAnalysis.h:22
clang::LangAS::opencl_global
clang::LangAS::FirstTargetAddressSpace
clang::LangAS::opencl_constant
Generated on Thu Feb 8 2018 09:14:02 for clang by
1.8.13