MCPcopy Create free account
hub / github.com/NVIDIA/cuda-tile / writeAPInt

Function writeAPInt

lib/Bytecode/Writer/BytecodeWriter.cpp:214–227  ·  view source on GitHub ↗

Helper function to serialize an APInt.

Source from the content-addressed store, hash-verified

212
213/// Helper function to serialize an APInt.
214static void writeAPInt(const APInt &apInt, EncodingWriter &writer) {
215 unsigned bitWidth = apInt.getBitWidth();
216 if (bitWidth <= 8) {
217 writer.writeByte(static_cast<uint8_t>(apInt.getLimitedValue()));
218 } else if (bitWidth <= 64) {
219 writer.writeSignedVarInt(apInt.getLimitedValue());
220 } else {
221 unsigned numActiveWords = apInt.getActiveWords();
222 writer.writeVarInt(numActiveWords);
223 const uint64_t *rawValueData = apInt.getRawData();
224 for (unsigned i = 0; i < numActiveWords; ++i)
225 writer.writeSignedVarInt(rawValueData[i]);
226 }
227}
228
229/// Helper function to serialize the APFloat representation of a FloatAttr.
230static void writeAPFloatRepresentation(const APFloat &apFloat,

Callers 1

Calls 3

writeByteMethod · 0.80
writeSignedVarIntMethod · 0.80
writeVarIntMethod · 0.80

Tested by

no test coverage detected