Record.clear();
}
+static uint64_t rotateSign(int64_t I) {
+ uint64_t U = I;
+ return I < 0 ? ~(U << 1) : U << 1;
+}
+
+static void WriteMDSubrange(const MDSubrange *N, const ValueEnumerator &,
+ BitstreamWriter &Stream,
+ SmallVectorImpl<uint64_t> &Record,
+ unsigned Abbrev) {
+ Record.push_back(N->isDistinct());
+ Record.push_back(N->getCount());
+ Record.push_back(rotateSign(N->getLo()));
+
+ Stream.EmitRecord(bitc::METADATA_SUBRANGE, Record, Abbrev);
+ Record.clear();
+}
+
+static void WriteMDEnumerator(const MDEnumerator *N, const ValueEnumerator &VE,
+ BitstreamWriter &Stream,
+ SmallVectorImpl<uint64_t> &Record,
+ unsigned Abbrev) {
+ Record.push_back(N->isDistinct());
+ Record.push_back(rotateSign(N->getValue()));
+ Record.push_back(VE.getMetadataOrNullID(N->getRawName()));
+
+ Stream.EmitRecord(bitc::METADATA_ENUMERATOR, Record, Abbrev);
+ Record.clear();
+}
+
+static void WriteMDBasicType(const MDBasicType *, const ValueEnumerator &,
+ BitstreamWriter &, SmallVectorImpl<uint64_t> &,
+ unsigned) {
+ llvm_unreachable("write not implemented");
+}
+static void WriteMDDerivedType(const MDDerivedType *, const ValueEnumerator &,
+ BitstreamWriter &, SmallVectorImpl<uint64_t> &,
+ unsigned) {
+ llvm_unreachable("write not implemented");
+}
+static void WriteMDCompositeType(const MDCompositeType *,
+ const ValueEnumerator &, BitstreamWriter &,
+ SmallVectorImpl<uint64_t> &, unsigned) {
+ llvm_unreachable("write not implemented");
+}
+static void WriteMDSubroutineType(const MDSubroutineType *,
+ const ValueEnumerator &, BitstreamWriter &,
+ SmallVectorImpl<uint64_t> &, unsigned) {
+ llvm_unreachable("write not implemented");
+}
+static void WriteMDFile(const MDFile *, const ValueEnumerator &,
+ BitstreamWriter &, SmallVectorImpl<uint64_t> &,
+ unsigned) {
+ llvm_unreachable("write not implemented");
+}
+static void WriteMDCompileUnit(const MDCompileUnit *, const ValueEnumerator &,
+ BitstreamWriter &, SmallVectorImpl<uint64_t> &,
+ unsigned) {
+ llvm_unreachable("write not implemented");
+}
+static void WriteMDSubprogram(const MDSubprogram *, const ValueEnumerator &,
+ BitstreamWriter &, SmallVectorImpl<uint64_t> &,
+ unsigned) {
+ llvm_unreachable("write not implemented");
+}
+static void WriteMDLexicalBlock(const MDLexicalBlock *, const ValueEnumerator &,
+ BitstreamWriter &, SmallVectorImpl<uint64_t> &,
+ unsigned) {
+ llvm_unreachable("write not implemented");
+}
+static void WriteMDLexicalBlockFile(const MDLexicalBlockFile *,
+ const ValueEnumerator &, BitstreamWriter &,
+ SmallVectorImpl<uint64_t> &, unsigned) {
+ llvm_unreachable("write not implemented");
+}
+static void WriteMDNamespace(const MDNamespace *, const ValueEnumerator &,
+ BitstreamWriter &, SmallVectorImpl<uint64_t> &,
+ unsigned) {
+ llvm_unreachable("write not implemented");
+}
+static void WriteMDTemplateTypeParameter(const MDTemplateTypeParameter *,
+ const ValueEnumerator &,
+ BitstreamWriter &,
+ SmallVectorImpl<uint64_t> &,
+ unsigned) {
+ llvm_unreachable("write not implemented");
+}
+static void WriteMDTemplateValueParameter(const MDTemplateValueParameter *,
+ const ValueEnumerator &,
+ BitstreamWriter &,
+ SmallVectorImpl<uint64_t> &,
+ unsigned) {
+ llvm_unreachable("write not implemented");
+}
+static void WriteMDGlobalVariable(const MDGlobalVariable *,
+ const ValueEnumerator &, BitstreamWriter &,
+ SmallVectorImpl<uint64_t> &, unsigned) {
+ llvm_unreachable("write not implemented");
+}
+static void WriteMDLocalVariable(const MDLocalVariable *,
+ const ValueEnumerator &, BitstreamWriter &,
+ SmallVectorImpl<uint64_t> &, unsigned) {
+ llvm_unreachable("write not implemented");
+}
+static void WriteMDExpression(const MDExpression *, const ValueEnumerator &,
+ BitstreamWriter &, SmallVectorImpl<uint64_t> &,
+ unsigned) {
+ llvm_unreachable("write not implemented");
+}
+static void WriteMDObjCProperty(const MDObjCProperty *, const ValueEnumerator &,
+ BitstreamWriter &, SmallVectorImpl<uint64_t> &,
+ unsigned) {
+ llvm_unreachable("write not implemented");
+}
+static void WriteMDImportedEntity(const MDImportedEntity *,
+ const ValueEnumerator &, BitstreamWriter &,
+ SmallVectorImpl<uint64_t> &, unsigned) {
+ llvm_unreachable("write not implemented");
+}
+
static void WriteModuleMetadata(const Module *M,
const ValueEnumerator &VE,
BitstreamWriter &Stream) {
MDSAbbrev = Stream.EmitAbbrev(Abbv);
}
- unsigned MDLocationAbbrev = 0;
+ // Initialize MDNode abbreviations.
+#define HANDLE_MDNODE_LEAF(CLASS) unsigned CLASS##Abbrev = 0;
+#include "llvm/IR/Metadata.def"
+
if (VE.hasMDLocation()) {
// Abbrev for METADATA_LOCATION.
//
MDLocationAbbrev = Stream.EmitAbbrev(Abbv);
}
- unsigned GenericDebugNodeAbbrev = 0;
if (VE.hasGenericDebugNode()) {
// Abbrev for METADATA_GENERIC_DEBUG.
//
NameAbbrev = Stream.EmitAbbrev(Abbv);
}
- unsigned MDTupleAbbrev = 0;
SmallVector<uint64_t, 64> Record;
for (const Metadata *MD : MDs) {
if (const MDNode *N = dyn_cast<MDNode>(MD)) {