9#ifndef LLVM_OBJECT_FAULTMAPPARSER_H
10#define LLVM_OBJECT_FAULTMAPPARSER_H
26 using FaultMapVersionType = uint8_t;
27 using Reserved0Type = uint8_t;
31 static const size_t FaultMapVersionOffset = 0;
32 static const size_t Reserved0Offset =
33 FaultMapVersionOffset +
sizeof(FaultMapVersionType);
34 static const size_t Reserved1Offset = Reserved0Offset +
sizeof(Reserved0Type);
35 static const size_t NumFunctionsOffset =
37 static const size_t FunctionInfosOffset =
43 template <
typename T>
static T read(
const uint8_t *
P,
const uint8_t *E) {
44 assert(
P +
sizeof(
T) <= E &&
"out of bounds read!");
45 return support::endian::read<T, llvm::endianness::little>(
P);
61 static const size_t FaultKindOffset = 0;
62 static const size_t FaultingPCOffsetOffset =
64 static const size_t HandlerPCOffsetOffset =
78 return read<FaultKindType>(
P + FaultKindOffset, E);
82 return read<FaultingPCOffsetType>(
P + FaultingPCOffsetOffset, E);
86 return read<HandlerPCOffsetType>(
P + HandlerPCOffsetOffset, E);
95 static const size_t FunctionAddrOffset = 0;
96 static const size_t NumFaultingPCsOffset =
98 static const size_t ReservedOffset =
100 static const size_t FunctionFaultInfosOffset =
102 static const size_t FunctionInfoHeaderSize = FunctionFaultInfosOffset;
104 const uint8_t *
P =
nullptr;
105 const uint8_t *E =
nullptr;
114 return read<FunctionAddrType>(
P + FunctionAddrOffset, E);
118 return read<NumFaultingPCsType>(
P + NumFaultingPCsOffset, E);
123 const uint8_t *Begin =
P + FunctionFaultInfosOffset +
129 size_t MySize = FunctionInfoHeaderSize +
132 const uint8_t *Begin =
P + MySize;
133 assert(Begin < E &&
"out of bounds!");
139 :
P(Begin), E(
End) {}
142 auto Version = read<FaultMapVersionType>(
P + FaultMapVersionOffset, E);
148 return read<NumFunctionsType>(
P + NumFunctionsOffset, E);
152 const uint8_t *Begin =
P + FunctionInfosOffset;
158 const FaultMapParser::FunctionFaultInfoAccessor &);
161 const FaultMapParser::FunctionInfoAccessor &);
163raw_ostream &
operator<<(raw_ostream &
OS,
const FaultMapParser &);
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
FunctionFaultInfoAccessor(const uint8_t *P, const uint8_t *E)
FaultKindType getFaultKind() const
HandlerPCOffsetType getHandlerPCOffset() const
FaultingPCOffsetType getFaultingPCOffset() const
FunctionInfoAccessor(const uint8_t *P, const uint8_t *E)
FunctionInfoAccessor getNextFunctionInfo() const
FunctionAddrType getFunctionAddr() const
NumFaultingPCsType getNumFaultingPCs() const
FunctionFaultInfoAccessor getFunctionFaultInfoAt(uint32_t Index) const
FunctionInfoAccessor()=default
A parser for the __llvm_faultmaps section generated by the FaultMaps class declared in llvm/CodeGen/F...
NumFunctionsType getNumFunctions() const
FunctionInfoAccessor getFirstFunctionInfo() const
FaultMapParser(const uint8_t *Begin, const uint8_t *End)
FaultMapVersionType getFaultMapVersion() const
This is an optimization pass for GlobalISel generic memory operations.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)