13#ifndef LLVM_CLANG_AST_INTERP_TYPE_H
14#define LLVM_CLANG_AST_INTERP_TYPE_H
16#include "llvm/Support/raw_ostream.h"
28template <
unsigned Bits,
bool Signed>
class Integral;
49inline llvm::raw_ostream &
operator<<(llvm::raw_ostream &OS,
53 OS <<
"reinterpret_cast";
82constexpr size_t align(
size_t Size) {
83 return ((Size +
alignof(
void *) - 1) /
alignof(
void *)) *
alignof(
void *);
87static_assert(
aligned(
sizeof(
void *)));
98#define TYPE_SWITCH_CASE(Name, B) \
99 case Name: { using T = PrimConv<Name>::T; B; break; }
100#define TYPE_SWITCH(Expr, B) \
103 TYPE_SWITCH_CASE(PT_Sint8, B) \
104 TYPE_SWITCH_CASE(PT_Uint8, B) \
105 TYPE_SWITCH_CASE(PT_Sint16, B) \
106 TYPE_SWITCH_CASE(PT_Uint16, B) \
107 TYPE_SWITCH_CASE(PT_Sint32, B) \
108 TYPE_SWITCH_CASE(PT_Uint32, B) \
109 TYPE_SWITCH_CASE(PT_Sint64, B) \
110 TYPE_SWITCH_CASE(PT_Uint64, B) \
111 TYPE_SWITCH_CASE(PT_Float, B) \
112 TYPE_SWITCH_CASE(PT_Bool, B) \
113 TYPE_SWITCH_CASE(PT_Ptr, B) \
114 TYPE_SWITCH_CASE(PT_FnPtr, B) \
118#define INT_TYPE_SWITCH(Expr, B) \
121 TYPE_SWITCH_CASE(PT_Sint8, B) \
122 TYPE_SWITCH_CASE(PT_Uint8, B) \
123 TYPE_SWITCH_CASE(PT_Sint16, B) \
124 TYPE_SWITCH_CASE(PT_Uint16, B) \
125 TYPE_SWITCH_CASE(PT_Sint32, B) \
126 TYPE_SWITCH_CASE(PT_Uint32, B) \
127 TYPE_SWITCH_CASE(PT_Sint64, B) \
128 TYPE_SWITCH_CASE(PT_Uint64, B) \
129 TYPE_SWITCH_CASE(PT_Bool, B) \
131 llvm_unreachable("Not an integer value"); \
135#define COMPOSITE_TYPE_SWITCH(Expr, B, D) \
138 TYPE_SWITCH_CASE(PT_Ptr, B) \
139 default: { D; break; } \
The base class of the type hierarchy.
Wrapper around boolean types.
Wrapper around numeric types.
A pointer to a memory block, live or dead.
constexpr bool aligned(uintptr_t Value)
constexpr size_t align(size_t Size)
Aligns a size to the pointer alignment.
PrimType
Enumeration of the primitive types of the VM.
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const Boolean &B)
size_t primSize(PrimType Type)
Returns the size of a primitive type in bytes.
constexpr bool isIntegralType(PrimType T)
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
Mapping from primitive types to their representation.