Go to the documentation of this file.
20 using namespace msgpack;
23 : EW(OS,
Endianness), Compatible(Compatible) {}
35 if (
i >= FixMin::NegativeInt) {
36 EW.
write(
static_cast<int8_t
>(
i));
42 EW.
write(
static_cast<int8_t
>(
i));
47 EW.
write(FirstByte::Int16);
48 EW.
write(
static_cast<int16_t
>(
i));
53 EW.
write(FirstByte::Int32);
54 EW.
write(
static_cast<int32_t
>(
i));
58 EW.
write(FirstByte::Int64);
63 if (u <= FixMax::PositiveInt) {
64 EW.
write(
static_cast<uint8_t
>(u));
70 EW.
write(
static_cast<uint8_t
>(u));
74 if (u <= UINT16_MAX) {
75 EW.
write(FirstByte::UInt16);
80 if (u <= UINT32_MAX) {
81 EW.
write(FirstByte::UInt32);
86 EW.
write(FirstByte::UInt64);
92 double a = std::fabs(
d);
95 EW.
write(FirstByte::Float32);
96 EW.
write(
static_cast<float>(
d));
98 EW.
write(FirstByte::Float64);
104 size_t Size =
s.size();
106 if (Size <= FixMax::String)
107 EW.
write(
static_cast<uint8_t
>(FixBits::String | Size));
108 else if (!Compatible && Size <= UINT8_MAX) {
109 EW.
write(FirstByte::Str8);
110 EW.
write(
static_cast<uint8_t
>(Size));
111 }
else if (Size <= UINT16_MAX) {
112 EW.
write(FirstByte::Str16);
115 assert(Size <= UINT32_MAX &&
"String object too long to be encoded");
116 EW.
write(FirstByte::Str32);
124 assert(!Compatible &&
"Attempt to write Bin format in compatible mode");
128 if (Size <= UINT8_MAX) {
129 EW.
write(FirstByte::Bin8);
130 EW.
write(
static_cast<uint8_t
>(Size));
131 }
else if (Size <= UINT16_MAX) {
132 EW.
write(FirstByte::Bin16);
135 assert(Size <= UINT32_MAX &&
"Binary object too long to be encoded");
136 EW.
write(FirstByte::Bin32);
144 if (Size <= FixMax::Array) {
145 EW.
write(
static_cast<uint8_t
>(FixBits::Array | Size));
149 if (Size <= UINT16_MAX) {
150 EW.
write(FirstByte::Array16);
155 EW.
write(FirstByte::Array32);
160 if (Size <= FixMax::Map) {
161 EW.
write(
static_cast<uint8_t
>(FixBits::Map | Size));
165 if (Size <= UINT16_MAX) {
166 EW.
write(FirstByte::Map16);
171 EW.
write(FirstByte::Map32);
180 EW.
write(FirstByte::FixExt1);
183 EW.
write(FirstByte::FixExt2);
186 EW.
write(FirstByte::FixExt4);
189 EW.
write(FirstByte::FixExt8);
192 EW.
write(FirstByte::FixExt16);
195 if (Size <= UINT8_MAX) {
196 EW.
write(FirstByte::Ext8);
197 EW.
write(
static_cast<uint8_t
>(Size));
198 }
else if (Size <= UINT16_MAX) {
199 EW.
write(FirstByte::Ext16);
202 assert(Size <= UINT32_MAX &&
"Ext size too large to be encoded");
203 EW.
write(FirstByte::Ext32);
const char * getBufferStart() const
This is an optimization pass for GlobalISel generic memory operations.
constexpr support::endianness Endianness
The endianness of all multi-byte encoded values in MessagePack.
void writeMapSize(uint32_t Size)
Write the header for a Map of the given size.
size_t getBufferSize() const
Expected< ExpressionValue > max(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
Writer(raw_ostream &OS, bool Compatible=false)
Construct a writer, optionally enabling "Compatibility Mode" as defined in the MessagePack specificat...
=0.0 ? 0.0 :(a > 0.0 ? 1.0 :-1.0) a
the resulting code requires compare and branches when and if the revised code is with conditional branches instead of More there is a byte word extend before each where there should be only and the condition codes are not remembered when the same two values are compared twice More LSR enhancements i8 and i32 load store addressing modes are identical int b
raw_ostream & write(unsigned char C)
This class implements an extremely fast bulk output stream that can only output to a stream.
void writeExt(int8_t Type, MemoryBufferRef Buffer)
Write a typed memory buffer (an extension type) to the output stream.
void writeArraySize(uint32_t Size)
Write the header for an Array of the given size.
multiplies can be turned into SHL s
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void writeNil()
Write a Nil to the output stream.
Expected< ExpressionValue > min(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
StringRef - Represent a constant reference to a string, i.e.
void write(ArrayRef< value_type > Val)
void write(bool b)
Write a Boolean to the output stream.
Type
MessagePack types as defined in the standard, with the exception of Integer being divided into a sign...
the resulting code requires compare and branches when and if the revised code is with conditional branches instead of More there is a byte word extend before each where there should be only and the condition codes are not remembered when the same two values are compared twice More LSR enhancements i8 and i32 load store addressing modes are identical int int int d