Go to the documentation of this file.
32 #ifndef LLVM_EXECUTIONENGINE_ORC_SHARED_SIMPLEPACKEDSERIALIZATION_H
33 #define LLVM_EXECUTIONENGINE_ORC_SHARED_SIMPLEPACKEDSERIALIZATION_H
45 #include <type_traits>
57 : Buffer(Buffer), Remaining(Remaining) {}
58 bool write(
const char *Data,
size_t Size) {
68 char *Buffer =
nullptr;
77 : Buffer(Buffer), Remaining(Remaining) {}
78 bool read(
char *Data,
size_t Size) {
87 const char *
data()
const {
return Buffer; }
97 const char *Buffer =
nullptr;
103 template <
typename SPSTagT,
typename ConcreteT,
typename _ =
void>
112 static size_t size() {
return 0; }
125 template <
typename SPSTagT,
typename... SPSTagTs>
132 template <
typename ArgT,
typename... ArgTs>
138 template <
typename ArgT,
typename... ArgTs>
140 const ArgTs &...
Args) {
145 template <
typename ArgT,
typename... ArgTs>
153 template <
typename SPSTagT>
156 std::enable_if_t<std::is_same<SPSTagT, bool>::value ||
157 std::is_same<SPSTagT, char>::value ||
158 std::is_same<SPSTagT, int8_t>::value ||
159 std::is_same<SPSTagT, int16_t>::value ||
160 std::is_same<SPSTagT, int32_t>::value ||
161 std::is_same<SPSTagT, int64_t>::value ||
162 std::is_same<SPSTagT, uint8_t>::value ||
163 std::is_same<SPSTagT, uint16_t>::value ||
164 std::is_same<SPSTagT, uint32_t>::value ||
165 std::is_same<SPSTagT, uint64_t>::value>> {
167 static size_t size(
const SPSTagT &
Value) {
return sizeof(SPSTagT); }
173 return OB.write(
reinterpret_cast<const char *
>(&Tmp),
sizeof(Tmp));
178 if (!IB.
read(
reinterpret_cast<char *
>(&Tmp),
sizeof(Tmp)))
212 template <
typename SPSTagT1,
typename SPSTagT2>
234 template <
typename SPSElementTagT,
typename ConcreteSequenceT>
250 template <
typename SPSElementTagT,
typename ConcreteSequenceT>
277 template <
typename SPSElementTagT,
typename T>
284 template <
typename SPSElementTagT,
typename T>
299 template <
typename SPSElementTagT,
typename T>
306 template <
typename SPSElementTagT,
typename T>
321 template <
typename SPSElementTagT,
typename T,
unsigned N>
324 SmallVectorImpl<T>> {};
327 template <
typename SPSElementTagT,
typename T,
unsigned N>
330 SmallVectorImpl<T>> {};
333 template <
typename SPSElementTagT,
typename T>
352 return OB.write(A.data(), A.size());
361 A = {IB.
data(),
static_cast<size_t>(Size)};
362 return IB.
skip(Size);
369 template <
typename SPSElementTagT,
typename SequenceT>
371 std::enable_if_t<TrivialSPSSequenceSerialization<
372 SPSElementTagT, SequenceT>::available>> {
374 static size_t size(
const SequenceT &
S) {
376 for (
const auto &
E :
S)
384 for (
const auto &
E :
S)
395 TBSD::reserve(
S, Size);
396 for (
size_t I = 0;
I != Size; ++
I) {
397 typename TBSD::element_type
E;
408 template <
typename... SPSTagTs,
typename... Ts>
411 using TupleArgList =
typename SPSTuple<SPSTagTs...>::AsArgList;
412 using ArgIndices = std::make_index_sequence<
sizeof...(Ts)>;
414 template <std::size_t...
I>
415 static size_t size(
const std::tuple<Ts...> &
T, std::index_sequence<I...>) {
419 template <std::size_t...
I>
421 std::index_sequence<I...>) {
422 return TupleArgList::serialize(
OB, std::get<I>(
T)...);
425 template <std::size_t...
I>
427 std::index_sequence<I...>) {
428 return TupleArgList::deserialize(IB, std::get<I>(
T)...);
432 static size_t size(
const std::tuple<Ts...> &T) {
433 return size(
T, ArgIndices{});
437 return serialize(
OB,
T, ArgIndices{});
441 return deserialize(IB,
T, ArgIndices{});
446 template <
typename SPSTagT1,
typename SPSTagT2,
typename T1,
typename T2>
449 static size_t size(
const std::pair<T1, T2> &
P) {
479 return OB.write(
S.data(),
S.size());
483 const char *
Data =
nullptr;
496 template <
typename SPSValueT,
typename ValueT>
520 assert(
M.empty() &&
"M already contains elements");
530 if (!
M.insert(std::make_pair(
S, V)).second)
584 template <
typename T>
592 template <
typename T>
637 template <
typename SPSTagT,
typename T>
639 detail::SPSSerializableExpected<T>> {
674 template <
typename SPSTagT>
676 detail::SPSSerializableError> {
679 assert(BSE.
HasError &&
"Cannot serialize expected from a success value");
686 assert(BSE.
HasError &&
"Cannot serialize expected from a success value");
694 template <
typename SPSTagT,
typename T>
712 #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 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)
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)
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)
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 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.
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)
Align max(MaybeAlign Lhs, Align Rhs)
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)