003 File Manager
Current Path:
/usr/src/contrib/llvm-project/clang/lib/AST/Interp
usr
/
src
/
contrib
/
llvm-project
/
clang
/
lib
/
AST
/
Interp
/
📁
..
📄
Boolean.h
(4.12 KB)
📄
ByteCodeEmitter.cpp
(5.38 KB)
📄
ByteCodeEmitter.h
(3.13 KB)
📄
ByteCodeExprGen.cpp
(16.6 KB)
📄
ByteCodeExprGen.h
(10.2 KB)
📄
ByteCodeGenError.cpp
(483 B)
📄
ByteCodeGenError.h
(1.36 KB)
📄
ByteCodeStmtGen.cpp
(7.21 KB)
📄
ByteCodeStmtGen.h
(2.39 KB)
📄
Context.cpp
(3.28 KB)
📄
Context.h
(2.39 KB)
📄
Descriptor.cpp
(10.31 KB)
📄
Descriptor.h
(7.82 KB)
📄
Disasm.cpp
(1.95 KB)
📄
EvalEmitter.cpp
(7.6 KB)
📄
EvalEmitter.h
(3.7 KB)
📄
Frame.cpp
(464 B)
📄
Frame.h
(1.28 KB)
📄
Function.cpp
(1.73 KB)
📄
Function.h
(4.91 KB)
📄
Integral.h
(8.38 KB)
📄
Interp.cpp
(11.54 KB)
📄
Interp.h
(30.64 KB)
📄
InterpBlock.cpp
(1.91 KB)
📄
InterpBlock.h
(4.11 KB)
📄
InterpFrame.cpp
(5.32 KB)
📄
InterpFrame.h
(4.54 KB)
📄
InterpStack.cpp
(1.81 KB)
📄
InterpStack.h
(3.43 KB)
📄
InterpState.cpp
(2.03 KB)
📄
InterpState.h
(3.29 KB)
📄
Opcode.h
(817 B)
📄
Opcodes.td
(11.02 KB)
📄
Pointer.cpp
(4.97 KB)
📄
Pointer.h
(11.08 KB)
📄
PrimType.cpp
(648 B)
📄
PrimType.h
(4.66 KB)
📄
Program.cpp
(11.29 KB)
📄
Program.h
(6.66 KB)
📄
Record.cpp
(1.54 KB)
📄
Record.h
(3.76 KB)
📄
Source.cpp
(1.15 KB)
📄
Source.h
(3.25 KB)
📄
State.cpp
(5.34 KB)
📄
State.h
(4.01 KB)
Editing: PrimType.h
//===--- PrimType.h - Types for the constexpr VM --------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // Defines the VM types and helpers operating on types. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_AST_INTERP_TYPE_H #define LLVM_CLANG_AST_INTERP_TYPE_H #include <climits> #include <cstddef> #include <cstdint> #include "Boolean.h" #include "Integral.h" #include "Pointer.h" namespace clang { namespace interp { /// Enumeration of the primitive types of the VM. enum PrimType : unsigned { PT_Sint8, PT_Uint8, PT_Sint16, PT_Uint16, PT_Sint32, PT_Uint32, PT_Sint64, PT_Uint64, PT_Bool, PT_Ptr, }; /// Mapping from primitive types to their representation. template <PrimType T> struct PrimConv; template <> struct PrimConv<PT_Sint8> { using T = Integral<8, true>; }; template <> struct PrimConv<PT_Uint8> { using T = Integral<8, false>; }; template <> struct PrimConv<PT_Sint16> { using T = Integral<16, true>; }; template <> struct PrimConv<PT_Uint16> { using T = Integral<16, false>; }; template <> struct PrimConv<PT_Sint32> { using T = Integral<32, true>; }; template <> struct PrimConv<PT_Uint32> { using T = Integral<32, false>; }; template <> struct PrimConv<PT_Sint64> { using T = Integral<64, true>; }; template <> struct PrimConv<PT_Uint64> { using T = Integral<64, false>; }; template <> struct PrimConv<PT_Bool> { using T = Boolean; }; template <> struct PrimConv<PT_Ptr> { using T = Pointer; }; /// Returns the size of a primitive type in bytes. size_t primSize(PrimType Type); /// Aligns a size to the pointer alignment. constexpr size_t align(size_t Size) { return ((Size + alignof(void *) - 1) / alignof(void *)) * alignof(void *); } inline bool isPrimitiveIntegral(PrimType Type) { switch (Type) { case PT_Bool: case PT_Sint8: case PT_Uint8: case PT_Sint16: case PT_Uint16: case PT_Sint32: case PT_Uint32: case PT_Sint64: case PT_Uint64: return true; default: return false; } } } // namespace interp } // namespace clang /// Helper macro to simplify type switches. /// The macro implicitly exposes a type T in the scope of the inner block. #define TYPE_SWITCH_CASE(Name, B) \ case Name: { using T = PrimConv<Name>::T; do {B;} while(0); break; } #define TYPE_SWITCH(Expr, B) \ switch (Expr) { \ TYPE_SWITCH_CASE(PT_Sint8, B) \ TYPE_SWITCH_CASE(PT_Uint8, B) \ TYPE_SWITCH_CASE(PT_Sint16, B) \ TYPE_SWITCH_CASE(PT_Uint16, B) \ TYPE_SWITCH_CASE(PT_Sint32, B) \ TYPE_SWITCH_CASE(PT_Uint32, B) \ TYPE_SWITCH_CASE(PT_Sint64, B) \ TYPE_SWITCH_CASE(PT_Uint64, B) \ TYPE_SWITCH_CASE(PT_Bool, B) \ TYPE_SWITCH_CASE(PT_Ptr, B) \ } #define COMPOSITE_TYPE_SWITCH(Expr, B, D) \ switch (Expr) { \ TYPE_SWITCH_CASE(PT_Ptr, B) \ default: do { D; } while(0); break; \ } #define INT_TYPE_SWITCH(Expr, B) \ switch (Expr) { \ TYPE_SWITCH_CASE(PT_Sint8, B) \ TYPE_SWITCH_CASE(PT_Uint8, B) \ TYPE_SWITCH_CASE(PT_Sint16, B) \ TYPE_SWITCH_CASE(PT_Uint16, B) \ TYPE_SWITCH_CASE(PT_Sint32, B) \ TYPE_SWITCH_CASE(PT_Uint32, B) \ TYPE_SWITCH_CASE(PT_Sint64, B) \ TYPE_SWITCH_CASE(PT_Uint64, B) \ default: llvm_unreachable("not an integer"); \ } #endif
Upload File
Create Folder