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: Boolean.h
//===--- Boolean.h - Wrapper for boolean types for the 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 // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_AST_INTERP_BOOLEAN_H #define LLVM_CLANG_AST_INTERP_BOOLEAN_H #include <cstddef> #include <cstdint> #include "Integral.h" #include "clang/AST/APValue.h" #include "clang/AST/ComparisonCategories.h" #include "llvm/ADT/APSInt.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" namespace clang { namespace interp { /// Wrapper around boolean types. class Boolean { private: /// Underlying boolean. bool V; /// Construct a wrapper from a boolean. explicit Boolean(bool V) : V(V) {} public: /// Zero-initializes a boolean. Boolean() : V(false) {} bool operator<(Boolean RHS) const { return V < RHS.V; } bool operator>(Boolean RHS) const { return V > RHS.V; } bool operator<=(Boolean RHS) const { return V <= RHS.V; } bool operator>=(Boolean RHS) const { return V >= RHS.V; } bool operator==(Boolean RHS) const { return V == RHS.V; } bool operator!=(Boolean RHS) const { return V != RHS.V; } bool operator>(unsigned RHS) const { return static_cast<unsigned>(V) > RHS; } Boolean operator-() const { return Boolean(V); } Boolean operator~() const { return Boolean(true); } explicit operator unsigned() const { return V; } explicit operator int64_t() const { return V; } explicit operator uint64_t() const { return V; } APSInt toAPSInt() const { return APSInt(APInt(1, static_cast<uint64_t>(V), false), true); } APSInt toAPSInt(unsigned NumBits) const { return APSInt(toAPSInt().zextOrTrunc(NumBits), true); } APValue toAPValue() const { return APValue(toAPSInt()); } Boolean toUnsigned() const { return *this; } constexpr static unsigned bitWidth() { return true; } bool isZero() const { return !V; } bool isMin() const { return isZero(); } constexpr static bool isMinusOne() { return false; } constexpr static bool isSigned() { return false; } constexpr static bool isNegative() { return false; } constexpr static bool isPositive() { return !isNegative(); } ComparisonCategoryResult compare(const Boolean &RHS) const { return Compare(V, RHS.V); } unsigned countLeadingZeros() const { return V ? 0 : 1; } Boolean truncate(unsigned TruncBits) const { return *this; } void print(llvm::raw_ostream &OS) const { OS << (V ? "true" : "false"); } static Boolean min(unsigned NumBits) { return Boolean(false); } static Boolean max(unsigned NumBits) { return Boolean(true); } template <typename T> static std::enable_if_t<std::is_integral<T>::value, Boolean> from(T Value) { return Boolean(Value != 0); } template <unsigned SrcBits, bool SrcSign> static std::enable_if_t<SrcBits != 0, Boolean> from(Integral<SrcBits, SrcSign> Value) { return Boolean(!Value.isZero()); } template <bool SrcSign> static Boolean from(Integral<0, SrcSign> Value) { return Boolean(!Value.isZero()); } static Boolean zero() { return from(false); } template <typename T> static Boolean from(T Value, unsigned NumBits) { return Boolean(Value); } static bool inRange(int64_t Value, unsigned NumBits) { return Value == 0 || Value == 1; } static bool increment(Boolean A, Boolean *R) { *R = Boolean(true); return false; } static bool decrement(Boolean A, Boolean *R) { llvm_unreachable("Cannot decrement booleans"); } static bool add(Boolean A, Boolean B, unsigned OpBits, Boolean *R) { *R = Boolean(A.V || B.V); return false; } static bool sub(Boolean A, Boolean B, unsigned OpBits, Boolean *R) { *R = Boolean(A.V ^ B.V); return false; } static bool mul(Boolean A, Boolean B, unsigned OpBits, Boolean *R) { *R = Boolean(A.V && B.V); return false; } }; inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Boolean &B) { B.print(OS); return OS; } } // namespace interp } // namespace clang #endif
Upload File
Create Folder