forked from OSchip/llvm-project
BitcodeWriter: Rename some functions for consistency, NFC
To match writeMetadataRecords, writeNamedMetadata and writeMetadataStrings, change: WriteModuleMetadata => writeModuleMetadata WriteFunctionLocalMetadata => writeFunctionMetadata Write##CLASS => write##CLASS The only major change is "FunctionLocal" => "Function". The point is to be less specific, in preparation for emitting normal metadata records inside function metadata blocks (currently we only emit `LocalAsMetadata` there). llvm-svn: 264556
This commit is contained in:
parent
80d153f6aa
commit
cffd8cb9dc
|
@ -862,7 +862,7 @@ static uint64_t GetOptimizationFlags(const Value *V) {
|
||||||
return Flags;
|
return Flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteValueAsMetadata(const ValueAsMetadata *MD,
|
static void writeValueAsMetadata(const ValueAsMetadata *MD,
|
||||||
const ValueEnumerator &VE,
|
const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record) {
|
SmallVectorImpl<uint64_t> &Record) {
|
||||||
|
@ -874,7 +874,7 @@ static void WriteValueAsMetadata(const ValueAsMetadata *MD,
|
||||||
Record.clear();
|
Record.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteMDTuple(const MDTuple *N, const ValueEnumerator &VE,
|
static void writeMDTuple(const MDTuple *N, const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record, unsigned Abbrev) {
|
SmallVectorImpl<uint64_t> &Record, unsigned Abbrev) {
|
||||||
for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
|
for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
|
||||||
|
@ -902,7 +902,7 @@ static unsigned createDILocationAbbrev(BitstreamWriter &Stream) {
|
||||||
return Stream.EmitAbbrev(Abbv);
|
return Stream.EmitAbbrev(Abbv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDILocation(const DILocation *N, const ValueEnumerator &VE,
|
static void writeDILocation(const DILocation *N, const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record,
|
SmallVectorImpl<uint64_t> &Record,
|
||||||
unsigned &Abbrev) {
|
unsigned &Abbrev) {
|
||||||
|
@ -933,7 +933,7 @@ static unsigned createGenericDINodeAbbrev(BitstreamWriter &Stream) {
|
||||||
return Stream.EmitAbbrev(Abbv);
|
return Stream.EmitAbbrev(Abbv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteGenericDINode(const GenericDINode *N,
|
static void writeGenericDINode(const GenericDINode *N,
|
||||||
const ValueEnumerator &VE,
|
const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record,
|
SmallVectorImpl<uint64_t> &Record,
|
||||||
|
@ -957,7 +957,7 @@ static uint64_t rotateSign(int64_t I) {
|
||||||
return I < 0 ? ~(U << 1) : U << 1;
|
return I < 0 ? ~(U << 1) : U << 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDISubrange(const DISubrange *N, const ValueEnumerator &,
|
static void writeDISubrange(const DISubrange *N, const ValueEnumerator &,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record,
|
SmallVectorImpl<uint64_t> &Record,
|
||||||
unsigned Abbrev) {
|
unsigned Abbrev) {
|
||||||
|
@ -969,7 +969,7 @@ static void WriteDISubrange(const DISubrange *N, const ValueEnumerator &,
|
||||||
Record.clear();
|
Record.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDIEnumerator(const DIEnumerator *N, const ValueEnumerator &VE,
|
static void writeDIEnumerator(const DIEnumerator *N, const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record,
|
SmallVectorImpl<uint64_t> &Record,
|
||||||
unsigned Abbrev) {
|
unsigned Abbrev) {
|
||||||
|
@ -981,7 +981,7 @@ static void WriteDIEnumerator(const DIEnumerator *N, const ValueEnumerator &VE,
|
||||||
Record.clear();
|
Record.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDIBasicType(const DIBasicType *N, const ValueEnumerator &VE,
|
static void writeDIBasicType(const DIBasicType *N, const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record,
|
SmallVectorImpl<uint64_t> &Record,
|
||||||
unsigned Abbrev) {
|
unsigned Abbrev) {
|
||||||
|
@ -996,7 +996,7 @@ static void WriteDIBasicType(const DIBasicType *N, const ValueEnumerator &VE,
|
||||||
Record.clear();
|
Record.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDIDerivedType(const DIDerivedType *N,
|
static void writeDIDerivedType(const DIDerivedType *N,
|
||||||
const ValueEnumerator &VE,
|
const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record,
|
SmallVectorImpl<uint64_t> &Record,
|
||||||
|
@ -1018,7 +1018,7 @@ static void WriteDIDerivedType(const DIDerivedType *N,
|
||||||
Record.clear();
|
Record.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDICompositeType(const DICompositeType *N,
|
static void writeDICompositeType(const DICompositeType *N,
|
||||||
const ValueEnumerator &VE,
|
const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record,
|
SmallVectorImpl<uint64_t> &Record,
|
||||||
|
@ -1044,7 +1044,7 @@ static void WriteDICompositeType(const DICompositeType *N,
|
||||||
Record.clear();
|
Record.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDISubroutineType(const DISubroutineType *N,
|
static void writeDISubroutineType(const DISubroutineType *N,
|
||||||
const ValueEnumerator &VE,
|
const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record,
|
SmallVectorImpl<uint64_t> &Record,
|
||||||
|
@ -1057,7 +1057,7 @@ static void WriteDISubroutineType(const DISubroutineType *N,
|
||||||
Record.clear();
|
Record.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDIFile(const DIFile *N, const ValueEnumerator &VE,
|
static void writeDIFile(const DIFile *N, const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record, unsigned Abbrev) {
|
SmallVectorImpl<uint64_t> &Record, unsigned Abbrev) {
|
||||||
Record.push_back(N->isDistinct());
|
Record.push_back(N->isDistinct());
|
||||||
|
@ -1068,7 +1068,7 @@ static void WriteDIFile(const DIFile *N, const ValueEnumerator &VE,
|
||||||
Record.clear();
|
Record.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDICompileUnit(const DICompileUnit *N,
|
static void writeDICompileUnit(const DICompileUnit *N,
|
||||||
const ValueEnumerator &VE,
|
const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record,
|
SmallVectorImpl<uint64_t> &Record,
|
||||||
|
@ -1095,7 +1095,7 @@ static void WriteDICompileUnit(const DICompileUnit *N,
|
||||||
Record.clear();
|
Record.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDISubprogram(const DISubprogram *N, const ValueEnumerator &VE,
|
static void writeDISubprogram(const DISubprogram *N, const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record,
|
SmallVectorImpl<uint64_t> &Record,
|
||||||
unsigned Abbrev) {
|
unsigned Abbrev) {
|
||||||
|
@ -1122,7 +1122,7 @@ static void WriteDISubprogram(const DISubprogram *N, const ValueEnumerator &VE,
|
||||||
Record.clear();
|
Record.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDILexicalBlock(const DILexicalBlock *N,
|
static void writeDILexicalBlock(const DILexicalBlock *N,
|
||||||
const ValueEnumerator &VE,
|
const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record,
|
SmallVectorImpl<uint64_t> &Record,
|
||||||
|
@ -1137,7 +1137,7 @@ static void WriteDILexicalBlock(const DILexicalBlock *N,
|
||||||
Record.clear();
|
Record.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDILexicalBlockFile(const DILexicalBlockFile *N,
|
static void writeDILexicalBlockFile(const DILexicalBlockFile *N,
|
||||||
const ValueEnumerator &VE,
|
const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record,
|
SmallVectorImpl<uint64_t> &Record,
|
||||||
|
@ -1151,7 +1151,7 @@ static void WriteDILexicalBlockFile(const DILexicalBlockFile *N,
|
||||||
Record.clear();
|
Record.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDINamespace(const DINamespace *N, const ValueEnumerator &VE,
|
static void writeDINamespace(const DINamespace *N, const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record,
|
SmallVectorImpl<uint64_t> &Record,
|
||||||
unsigned Abbrev) {
|
unsigned Abbrev) {
|
||||||
|
@ -1165,7 +1165,7 @@ static void WriteDINamespace(const DINamespace *N, const ValueEnumerator &VE,
|
||||||
Record.clear();
|
Record.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDIMacro(const DIMacro *N, const ValueEnumerator &VE,
|
static void writeDIMacro(const DIMacro *N, const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record, unsigned Abbrev) {
|
SmallVectorImpl<uint64_t> &Record, unsigned Abbrev) {
|
||||||
Record.push_back(N->isDistinct());
|
Record.push_back(N->isDistinct());
|
||||||
|
@ -1178,7 +1178,7 @@ static void WriteDIMacro(const DIMacro *N, const ValueEnumerator &VE,
|
||||||
Record.clear();
|
Record.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDIMacroFile(const DIMacroFile *N, const ValueEnumerator &VE,
|
static void writeDIMacroFile(const DIMacroFile *N, const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record,
|
SmallVectorImpl<uint64_t> &Record,
|
||||||
unsigned Abbrev) {
|
unsigned Abbrev) {
|
||||||
|
@ -1192,7 +1192,7 @@ static void WriteDIMacroFile(const DIMacroFile *N, const ValueEnumerator &VE,
|
||||||
Record.clear();
|
Record.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDIModule(const DIModule *N, const ValueEnumerator &VE,
|
static void writeDIModule(const DIModule *N, const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record, unsigned Abbrev) {
|
SmallVectorImpl<uint64_t> &Record, unsigned Abbrev) {
|
||||||
Record.push_back(N->isDistinct());
|
Record.push_back(N->isDistinct());
|
||||||
|
@ -1203,7 +1203,7 @@ static void WriteDIModule(const DIModule *N, const ValueEnumerator &VE,
|
||||||
Record.clear();
|
Record.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDITemplateTypeParameter(const DITemplateTypeParameter *N,
|
static void writeDITemplateTypeParameter(const DITemplateTypeParameter *N,
|
||||||
const ValueEnumerator &VE,
|
const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record,
|
SmallVectorImpl<uint64_t> &Record,
|
||||||
|
@ -1216,7 +1216,7 @@ static void WriteDITemplateTypeParameter(const DITemplateTypeParameter *N,
|
||||||
Record.clear();
|
Record.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDITemplateValueParameter(const DITemplateValueParameter *N,
|
static void writeDITemplateValueParameter(const DITemplateValueParameter *N,
|
||||||
const ValueEnumerator &VE,
|
const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record,
|
SmallVectorImpl<uint64_t> &Record,
|
||||||
|
@ -1231,7 +1231,7 @@ static void WriteDITemplateValueParameter(const DITemplateValueParameter *N,
|
||||||
Record.clear();
|
Record.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDIGlobalVariable(const DIGlobalVariable *N,
|
static void writeDIGlobalVariable(const DIGlobalVariable *N,
|
||||||
const ValueEnumerator &VE,
|
const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record,
|
SmallVectorImpl<uint64_t> &Record,
|
||||||
|
@ -1252,7 +1252,7 @@ static void WriteDIGlobalVariable(const DIGlobalVariable *N,
|
||||||
Record.clear();
|
Record.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDILocalVariable(const DILocalVariable *N,
|
static void writeDILocalVariable(const DILocalVariable *N,
|
||||||
const ValueEnumerator &VE,
|
const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record,
|
SmallVectorImpl<uint64_t> &Record,
|
||||||
|
@ -1270,7 +1270,7 @@ static void WriteDILocalVariable(const DILocalVariable *N,
|
||||||
Record.clear();
|
Record.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDIExpression(const DIExpression *N, const ValueEnumerator &,
|
static void writeDIExpression(const DIExpression *N, const ValueEnumerator &,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record,
|
SmallVectorImpl<uint64_t> &Record,
|
||||||
unsigned Abbrev) {
|
unsigned Abbrev) {
|
||||||
|
@ -1283,7 +1283,7 @@ static void WriteDIExpression(const DIExpression *N, const ValueEnumerator &,
|
||||||
Record.clear();
|
Record.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDIObjCProperty(const DIObjCProperty *N,
|
static void writeDIObjCProperty(const DIObjCProperty *N,
|
||||||
const ValueEnumerator &VE,
|
const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record,
|
SmallVectorImpl<uint64_t> &Record,
|
||||||
|
@ -1301,7 +1301,7 @@ static void WriteDIObjCProperty(const DIObjCProperty *N,
|
||||||
Record.clear();
|
Record.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteDIImportedEntity(const DIImportedEntity *N,
|
static void writeDIImportedEntity(const DIImportedEntity *N,
|
||||||
const ValueEnumerator &VE,
|
const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream,
|
BitstreamWriter &Stream,
|
||||||
SmallVectorImpl<uint64_t> &Record,
|
SmallVectorImpl<uint64_t> &Record,
|
||||||
|
@ -1411,16 +1411,16 @@ static void writeMetadataRecords(ArrayRef<const Metadata *> MDs,
|
||||||
llvm_unreachable("Invalid MDNode subclass");
|
llvm_unreachable("Invalid MDNode subclass");
|
||||||
#define HANDLE_MDNODE_LEAF(CLASS) \
|
#define HANDLE_MDNODE_LEAF(CLASS) \
|
||||||
case Metadata::CLASS##Kind: \
|
case Metadata::CLASS##Kind: \
|
||||||
Write##CLASS(cast<CLASS>(N), VE, Stream, Record, CLASS##Abbrev); \
|
write##CLASS(cast<CLASS>(N), VE, Stream, Record, CLASS##Abbrev); \
|
||||||
continue;
|
continue;
|
||||||
#include "llvm/IR/Metadata.def"
|
#include "llvm/IR/Metadata.def"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WriteValueAsMetadata(cast<ConstantAsMetadata>(MD), VE, Stream, Record);
|
writeValueAsMetadata(cast<ConstantAsMetadata>(MD), VE, Stream, Record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteModuleMetadata(const Module &M,
|
static void writeModuleMetadata(const Module &M,
|
||||||
const ValueEnumerator &VE,
|
const ValueEnumerator &VE,
|
||||||
BitstreamWriter &Stream) {
|
BitstreamWriter &Stream) {
|
||||||
if (VE.getMDs().empty() && M.named_metadata_empty())
|
if (VE.getMDs().empty() && M.named_metadata_empty())
|
||||||
|
@ -1434,9 +1434,8 @@ static void WriteModuleMetadata(const Module &M,
|
||||||
Stream.ExitBlock();
|
Stream.ExitBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WriteFunctionLocalMetadata(const Function &F,
|
static void writeFunctionMetadata(const Function &F, const ValueEnumerator &VE,
|
||||||
const ValueEnumerator &VE,
|
BitstreamWriter &Stream) {
|
||||||
BitstreamWriter &Stream) {
|
|
||||||
ArrayRef<const Metadata *> MDs = VE.getFunctionMDs();
|
ArrayRef<const Metadata *> MDs = VE.getFunctionMDs();
|
||||||
if (MDs.empty())
|
if (MDs.empty())
|
||||||
return;
|
return;
|
||||||
|
@ -1445,7 +1444,7 @@ static void WriteFunctionLocalMetadata(const Function &F,
|
||||||
|
|
||||||
SmallVector<uint64_t, 64> Record;
|
SmallVector<uint64_t, 64> Record;
|
||||||
for (const Metadata *MD : VE.getFunctionMDs())
|
for (const Metadata *MD : VE.getFunctionMDs())
|
||||||
WriteValueAsMetadata(cast<LocalAsMetadata>(MD), VE, Stream, Record);
|
writeValueAsMetadata(cast<LocalAsMetadata>(MD), VE, Stream, Record);
|
||||||
|
|
||||||
Stream.ExitBlock();
|
Stream.ExitBlock();
|
||||||
}
|
}
|
||||||
|
@ -2561,7 +2560,7 @@ static void WriteFunction(
|
||||||
WriteConstants(CstStart, CstEnd, VE, Stream, false);
|
WriteConstants(CstStart, CstEnd, VE, Stream, false);
|
||||||
|
|
||||||
// If there is function-local metadata, emit it now.
|
// If there is function-local metadata, emit it now.
|
||||||
WriteFunctionLocalMetadata(F, VE, Stream);
|
writeFunctionMetadata(F, VE, Stream);
|
||||||
|
|
||||||
// Keep a running idea of what the instruction ID is.
|
// Keep a running idea of what the instruction ID is.
|
||||||
unsigned InstID = CstEnd;
|
unsigned InstID = CstEnd;
|
||||||
|
@ -3215,7 +3214,7 @@ static void WriteModule(const Module *M, BitstreamWriter &Stream,
|
||||||
WriteModuleConstants(VE, Stream);
|
WriteModuleConstants(VE, Stream);
|
||||||
|
|
||||||
// Emit metadata.
|
// Emit metadata.
|
||||||
WriteModuleMetadata(*M, VE, Stream);
|
writeModuleMetadata(*M, VE, Stream);
|
||||||
|
|
||||||
// Emit metadata.
|
// Emit metadata.
|
||||||
WriteModuleMetadataStore(M, Stream);
|
WriteModuleMetadataStore(M, Stream);
|
||||||
|
|
Loading…
Reference in New Issue