Go to the documentation of this file.
18 using namespace msgpack;
21 : EW(OS,
Endianness), Compatible(Compatible) {}
33 if (
i >= FixMin::NegativeInt) {
34 EW.
write(
static_cast<int8_t
>(
i));
40 EW.
write(
static_cast<int8_t
>(
i));
45 EW.
write(FirstByte::Int16);
46 EW.
write(
static_cast<int16_t
>(
i));
51 EW.
write(FirstByte::Int32);
52 EW.
write(
static_cast<int32_t
>(
i));
56 EW.
write(FirstByte::Int64);
61 if (u <= FixMax::PositiveInt) {
62 EW.
write(
static_cast<uint8_t
>(u));
68 EW.
write(
static_cast<uint8_t
>(u));
72 if (u <= UINT16_MAX) {
73 EW.
write(FirstByte::UInt16);
78 if (u <= UINT32_MAX) {
79 EW.
write(FirstByte::UInt32);
84 EW.
write(FirstByte::UInt64);
90 double a = std::fabs(
d);
93 EW.
write(FirstByte::Float32);
94 EW.
write(
static_cast<float>(
d));
96 EW.
write(FirstByte::Float64);
102 size_t Size =
s.size();
104 if (Size <= FixMax::String)
105 EW.
write(
static_cast<uint8_t
>(FixBits::String | Size));
106 else if (!Compatible && Size <= UINT8_MAX) {
107 EW.
write(FirstByte::Str8);
108 EW.
write(
static_cast<uint8_t
>(Size));
109 }
else if (Size <= UINT16_MAX) {
110 EW.
write(FirstByte::Str16);
113 assert(Size <= UINT32_MAX &&
"String object too long to be encoded");
114 EW.
write(FirstByte::Str32);
122 assert(!Compatible &&
"Attempt to write Bin format in compatible mode");
126 if (Size <= UINT8_MAX) {
127 EW.
write(FirstByte::Bin8);
128 EW.
write(
static_cast<uint8_t
>(Size));
129 }
else if (Size <= UINT16_MAX) {
130 EW.
write(FirstByte::Bin16);
133 assert(Size <= UINT32_MAX &&
"Binary object too long to be encoded");
134 EW.
write(FirstByte::Bin32);
142 if (Size <= FixMax::Array) {
143 EW.
write(
static_cast<uint8_t
>(FixBits::Array | Size));
147 if (Size <= UINT16_MAX) {
148 EW.
write(FirstByte::Array16);
153 EW.
write(FirstByte::Array32);
158 if (Size <= FixMax::Map) {
159 EW.
write(
static_cast<uint8_t
>(FixBits::Map | Size));
163 if (Size <= UINT16_MAX) {
164 EW.
write(FirstByte::Map16);
169 EW.
write(FirstByte::Map32);
178 EW.
write(FirstByte::FixExt1);
181 EW.
write(FirstByte::FixExt2);
184 EW.
write(FirstByte::FixExt4);
187 EW.
write(FirstByte::FixExt8);
190 EW.
write(FirstByte::FixExt16);
193 if (Size <= UINT8_MAX) {
194 EW.
write(FirstByte::Ext8);
195 EW.
write(
static_cast<uint8_t
>(Size));
196 }
else if (Size <= UINT16_MAX) {
197 EW.
write(FirstByte::Ext16);
200 assert(Size <= UINT32_MAX &&
"Ext size too large to be encoded");
201 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