File indexing completed on 2026-05-10 08:36:51
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef LLVM_CLANG_BASIC_XRAYINSTR_H
0015 #define LLVM_CLANG_BASIC_XRAYINSTR_H
0016
0017 #include "clang/Basic/LLVM.h"
0018 #include "llvm/ADT/StringRef.h"
0019 #include "llvm/Support/MathExtras.h"
0020 #include <cassert>
0021 #include <cstdint>
0022
0023 namespace clang {
0024
0025 using XRayInstrMask = uint32_t;
0026
0027 namespace XRayInstrKind {
0028
0029
0030 enum XRayInstrOrdinal : XRayInstrMask {
0031 XRIO_FunctionEntry,
0032 XRIO_FunctionExit,
0033 XRIO_Custom,
0034 XRIO_Typed,
0035 XRIO_Count
0036 };
0037
0038 constexpr XRayInstrMask None = 0;
0039 constexpr XRayInstrMask FunctionEntry = 1U << XRIO_FunctionEntry;
0040 constexpr XRayInstrMask FunctionExit = 1U << XRIO_FunctionExit;
0041 constexpr XRayInstrMask Custom = 1U << XRIO_Custom;
0042 constexpr XRayInstrMask Typed = 1U << XRIO_Typed;
0043 constexpr XRayInstrMask All = FunctionEntry | FunctionExit | Custom | Typed;
0044
0045 }
0046
0047 struct XRayInstrSet {
0048 bool has(XRayInstrMask K) const {
0049 assert(llvm::isPowerOf2_32(K));
0050 return Mask & K;
0051 }
0052
0053 bool hasOneOf(XRayInstrMask K) const { return Mask & K; }
0054
0055 void set(XRayInstrMask K, bool Value) {
0056 Mask = Value ? (Mask | K) : (Mask & ~K);
0057 }
0058
0059 void clear(XRayInstrMask K = XRayInstrKind::All) { Mask &= ~K; }
0060
0061 bool empty() const { return Mask == 0; }
0062
0063 bool full() const { return Mask == XRayInstrKind::All; }
0064
0065 XRayInstrMask Mask = 0;
0066 };
0067
0068
0069 XRayInstrMask parseXRayInstrValue(StringRef Value);
0070
0071
0072 void serializeXRayInstrValue(XRayInstrSet Set,
0073 SmallVectorImpl<StringRef> &Values);
0074
0075 }
0076
0077 #endif