Go to the documentation of this file.
32 #ifndef LLVM_EXECUTIONENGINE_ORC_SHARED_SIMPLEPACKEDSERIALIZATION_H
33 #define LLVM_EXECUTIONENGINE_ORC_SHARED_SIMPLEPACKEDSERIALIZATION_H
46 #include <type_traits>
58 : Buffer(Buffer), Remaining(Remaining) {}
59 bool write(
const char *Data,
size_t Size) {
70 char *Buffer =
nullptr;
79 : Buffer(Buffer), Remaining(Remaining) {}
80 bool read(
char *Data,
size_t Size) {
89 const char *
data()
const {
return Buffer; }
99 const char *Buffer =
nullptr;
100 size_t Remaining = 0;
105 template <
typename SPSTagT,
typename ConcreteT,
typename _ =
void>
114 static size_t size() {
return 0; }
127 template <
typename SPSTagT,
typename... SPSTagTs>
134 template <
typename ArgT,
typename... ArgTs>
140 template <
typename ArgT,
typename... ArgTs>
142 const ArgTs &...
Args) {
147 template <
typename ArgT,
typename... ArgTs>
155 template <
typename SPSTagT>
158 std::enable_if_t<std::is_same<SPSTagT, bool>::value ||
159 std::is_same<SPSTagT, char>::value ||
160 std::is_same<SPSTagT, int8_t>::value ||
161 std::is_same<SPSTagT, int16_t>::value ||
162 std::is_same<SPSTagT, int32_t>::value ||
163 std::is_same<SPSTagT, int64_t>::value ||
164 std::is_same<SPSTagT, uint8_t>::value ||
165 std::is_same<SPSTagT, uint16_t>::value ||
166 std::is_same<SPSTagT, uint32_t>::value ||
167 std::is_same<SPSTagT, uint64_t>::value>> {
169 static size_t size(
const SPSTagT &
Value) {
return sizeof(SPSTagT); }
175 return OB.write(
reinterpret_cast<const char *
>(&Tmp),
sizeof(Tmp));
180 if (!
IB.read(
reinterpret_cast<char *
>(&Tmp),
sizeof(Tmp)))
222 template <
typename SPSTagT1,
typename SPSTagT2>
244 template <
typename SPSElementTagT,
typename ConcreteSequenceT>
260 template <
typename SPSElementTagT,
typename ConcreteSequenceT>
287 template <
typename SPSElementTagT,
typename T>
294 template <
typename SPSElementTagT,
typename T>
309 template <
typename SPSElementTagT,
typename T>
316 template <
typename SPSElementTagT,
typename T>
331 template <
typename SPSElementTagT,
typename T,
unsigned N>
334 SmallVectorImpl<T>> {};
337 template <
typename SPSElementTagT,
typename T,
unsigned N>
340 SmallVectorImpl<T>> {};
343 template <
typename SPSElementTagT,
typename T>
364 return OB.write(A.data(), A.size());
373 A = {Size ?
IB.data() :
nullptr,
static_cast<size_t>(Size)};
374 return IB.skip(Size);
381 template <
typename SPSElementTagT,
typename SequenceT>
383 std::enable_if_t<TrivialSPSSequenceSerialization<
384 SPSElementTagT, SequenceT>::available>> {
386 static size_t size(
const SequenceT &
S) {
388 for (
const auto &
E :
S)
396 for (
const auto &
E :
S)
407 TBSD::reserve(
S, Size);
408 for (
size_t I = 0;
I != Size; ++
I) {
409 typename TBSD::element_type
E;
420 template <
typename... SPSTagTs,
typename... Ts>
423 using TupleArgList =
typename SPSTuple<SPSTagTs...>::AsArgList;
424 using ArgIndices = std::make_index_sequence<
sizeof...(Ts)>;
426 template <std::size_t...
I>
427 static size_t size(
const std::tuple<Ts...> &
T, std::index_sequence<I...>) {
431 template <std::size_t...
I>
433 std::index_sequence<I...>) {
434 return TupleArgList::serialize(
OB, std::get<I>(
T)...);
437 template <std::size_t...
I>
439 std::index_sequence<I...>) {
440 return TupleArgList::deserialize(
IB, std::get<I>(
T)...);
444 static size_t size(
const std::tuple<Ts...> &T) {
445 return size(
T, ArgIndices{});
449 return serialize(
OB,
T, ArgIndices{});
453 return deserialize(
IB,
T, ArgIndices{});
458 template <
typename SPSTagT1,
typename SPSTagT2,
typename T1,
typename T2>
461 static size_t size(
const std::pair<T1, T2> &
P) {
478 template <
typename SPSTagT,
typename T>
504 Value = std::optional<T>();
525 return OB.write(
S.data(),
S.size());
529 const char *
Data =
nullptr;
542 template <
typename SPSValueT,
typename ValueT>
566 assert(
M.empty() &&
"M already contains elements");
576 if (!
M.insert(std::make_pair(
S, V)).second)
630 template <
typename T>
638 template <
typename T>
683 template <
typename SPSTagT,
typename T>
685 detail::SPSSerializableExpected<T>> {
720 template <
typename SPSTagT>
722 detail::SPSSerializableError> {
725 assert(BSE.
HasError &&
"Cannot serialize expected from a success value");
732 assert(BSE.
HasError &&
"Cannot serialize expected from a success value");
740 template <
typename SPSTagT,
typename T>
758 #endif // LLVM_EXECUTIONENGINE_ORC_SHARED_SIMPLEPACKEDSERIALIZATION_H
static bool serialize(SPSOutputBuffer &OB, const detail::SPSSerializableExpected< T > &BSE)
This is an optimization pass for GlobalISel generic memory operations.
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
constexpr bool IsBigEndianHost
SPS tag type for sequences.
void swapByteOrder(T &Value)
Specialize this to implement 'trivial' sequence serialization for a concrete sequence type.
Specialize to describe how to serialize/deserialize to/from the given concrete type.
static void reserve(std::vector< T > &V, uint64_t Size)
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Output char buffer with overflow check.
static ErrorSuccess success()
Create a success value.
static bool deserialize(SPSInputBuffer &IB, StringMap< ValueT > &M)
static bool serialize(SPSOutputBuffer &OB)
static bool deserialize(SPSInputBuffer &IB, std::optional< T > &Value)
static size_t size(const std::tuple< Ts... > &T)
static bool serialize(SPSOutputBuffer &OB, const std::pair< T1, T2 > &P)
static bool serialize(SPSOutputBuffer &OB, const ArrayRef< char > &A)
static size_t size(const SequenceT &S)
Expected< ExpressionValue > max(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
Tagged union holding either a T or a Error.
static bool deserialize(SPSInputBuffer &IB, ArrayRef< char > &A)
static size_t size(const StringMap< ValueT > &M)
static bool serialize(SPSOutputBuffer &OB, const std::optional< T > &Value)
void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
static size_t size(const ArgT &Arg, const ArgTs &...Args)
typename std::vector< T >::value_type element_type
static bool deserialize(SPSInputBuffer &IB, std::pair< T1, T2 > &P)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Error fromSPSSerializable(SPSSerializableError BSE)
(vector float) vec_cmpeq(*A, *B) C
Helper type for serializing Errors.
llvm::orc::shared::SPSSerializationTraits< SPSTagT, SPSTagT, std::enable_if_t< std::is_same< SPSTagT, bool >::value||std::is_same< SPSTagT, char >::value||std::is_same< SPSTagT, int8_t >::value||std::is_same< SPSTagT, int16_t >::value||std::is_same< SPSTagT, int32_t >::value||std::is_same< SPSTagT, int64_t >::value||std::is_same< SPSTagT, uint8_t >::value||std::is_same< SPSTagT, uint16_t >::value||std::is_same< SPSTagT, uint32_t >::value||std::is_same< SPSTagT, uint64_t >::value > >::deserialize static bool deserialize(SPSInputBuffer &IB, SPSTagT &Value)
bool write(const char *Data, size_t Size)
static size_t size(const detail::SPSSerializableError &BSE)
static bool append(SmallVectorImpl< T > &V, T E)
static void reserve(SmallVectorImpl< T > &V, uint64_t Size)
SPS tag type for optionals.
static size_t size(const ArrayRef< char > &A)
static size_t size(const StringRef &S)
static bool append(std::string &S, char C)
SPSOutputBuffer(char *Buffer, size_t Remaining)
static size_t size(const detail::SPSSerializableError &BSE)
llvm::orc::shared::SPSSerializationTraits< SPSTagT, SPSTagT, std::enable_if_t< std::is_same< SPSTagT, bool >::value||std::is_same< SPSTagT, char >::value||std::is_same< SPSTagT, int8_t >::value||std::is_same< SPSTagT, int16_t >::value||std::is_same< SPSTagT, int32_t >::value||std::is_same< SPSTagT, int64_t >::value||std::is_same< SPSTagT, uint8_t >::value||std::is_same< SPSTagT, uint16_t >::value||std::is_same< SPSTagT, uint32_t >::value||std::is_same< SPSTagT, uint64_t >::value > >::size static size_t size(const SPSTagT &Value)
static bool deserialize(SPSInputBuffer &IB)
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
static bool deserialize(SPSInputBuffer &IB, ArgT &Arg, ArgTs &...Args)
static constexpr bool available
static bool serialize(SPSOutputBuffer &OB, const T &Value)
static bool serialize(SPSOutputBuffer &OB, StringRef S)
static constexpr bool available
static size_t size(const std::optional< T > &Value)
static size_t size(const T &Value)
llvm::orc::shared::SPSSerializationTraits< SPSTagT, SPSTagT, std::enable_if_t< std::is_same< SPSTagT, bool >::value||std::is_same< SPSTagT, char >::value||std::is_same< SPSTagT, int8_t >::value||std::is_same< SPSTagT, int16_t >::value||std::is_same< SPSTagT, int32_t >::value||std::is_same< SPSTagT, int64_t >::value||std::is_same< SPSTagT, uint8_t >::value||std::is_same< SPSTagT, uint16_t >::value||std::is_same< SPSTagT, uint32_t >::value||std::is_same< SPSTagT, uint64_t >::value > >::serialize static bool serialize(SPSOutputBuffer &OB, const SPSTagT &Value)
static bool deserialize(SPSInputBuffer &IB, SPSEmpty &BE)
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
SPS tag type for expecteds, which are either a T or a string representing an error.
static bool serialize(SPSOutputBuffer &OB, const detail::SPSSerializableError &BSE)
static bool serialize(SPSOutputBuffer &OB, const SequenceT &S)
static bool deserializeFromSmallVector(const SmallVectorImpl< char > &V)
static bool deserialize(SPSInputBuffer &IB, detail::SPSSerializableError &BSE)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
<%struct.s * > cast struct s *S to sbyte *< sbyte * > sbyte uint cast struct s *agg result to sbyte *< sbyte * > sbyte uint cast struct s *memtmp to sbyte *< sbyte * > sbyte uint ret void llc ends up issuing two memcpy or custom lower memcpy(of small size) to be ldmia/stmia. I think option 2 is better but the current register allocator cannot allocate a chunk of registers at a time. A feasible temporary solution is to use specific physical registers at the lowering time for small(<
typename SmallVectorImpl< T >::value_type element_type
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
static bool deserialize(SPSInputBuffer &IB, detail::SPSSerializableExpected< T > &BSE)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
StringRef - Represent a constant reference to a string, i.e.
static bool serialize(SPSOutputBuffer &OB, const ArgT &Arg, const ArgTs &...Args)
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
SPSArgList< SPSTagTs... > AsArgList
Convenience typedef of the corresponding arg list.
static bool serialize(SPSOutputBuffer &OB, const StringMap< ValueT > &M)
static bool append(std::vector< T > &V, T E)
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
static bool deserialize(SPSInputBuffer &IB, StringRef &S)
const char * toString(DWARFSectionKind Kind)
Lightweight error class with error context and mandatory checking.
Specialize this to implement 'trivial' sequence deserialization for a concrete sequence type.
SPSSerializableError toSPSSerializable(Error Err)
static bool serialize(SPSOutputBuffer &OB, const detail::SPSSerializableError &BSE)
static bool serializeToSmallVector(SmallVectorImpl< char > &V)
Helper type for serializing Expected<T>s.
detail::ValueMatchesPoly< M > HasValue(M Matcher)
static bool deserialize(SPSInputBuffer &IB, SequenceT &S)
static bool deserialize(SPSInputBuffer &IB, std::tuple< Ts... > &T)
static size_t size(const detail::SPSSerializableExpected< T > &BSE)
static size_t size(const std::pair< T1, T2 > &P)
static void reserve(std::string &S, uint64_t Size)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
static bool serialize(SPSOutputBuffer &OB, const std::tuple< Ts... > &T)
void reserve(size_type N)
LLVM Value Representation.
A utility class for serializing to a blob from a variadic list.
static size_t size(const SPSEmpty &EP)
static bool serialize(SPSOutputBuffer &OB, const SPSEmpty &BE)