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:
Duncan P. N. Exon Smith 2016-03-27 23:56:04 +00:00
parent 80d153f6aa
commit cffd8cb9dc
1 changed files with 34 additions and 35 deletions

View File

@ -862,7 +862,7 @@ static uint64_t GetOptimizationFlags(const Value *V) {
return Flags;
}
static void WriteValueAsMetadata(const ValueAsMetadata *MD,
static void writeValueAsMetadata(const ValueAsMetadata *MD,
const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record) {
@ -874,7 +874,7 @@ static void WriteValueAsMetadata(const ValueAsMetadata *MD,
Record.clear();
}
static void WriteMDTuple(const MDTuple *N, const ValueEnumerator &VE,
static void writeMDTuple(const MDTuple *N, const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record, unsigned Abbrev) {
for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
@ -902,7 +902,7 @@ static unsigned createDILocationAbbrev(BitstreamWriter &Stream) {
return Stream.EmitAbbrev(Abbv);
}
static void WriteDILocation(const DILocation *N, const ValueEnumerator &VE,
static void writeDILocation(const DILocation *N, const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record,
unsigned &Abbrev) {
@ -933,7 +933,7 @@ static unsigned createGenericDINodeAbbrev(BitstreamWriter &Stream) {
return Stream.EmitAbbrev(Abbv);
}
static void WriteGenericDINode(const GenericDINode *N,
static void writeGenericDINode(const GenericDINode *N,
const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record,
@ -957,7 +957,7 @@ static uint64_t rotateSign(int64_t I) {
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,
SmallVectorImpl<uint64_t> &Record,
unsigned Abbrev) {
@ -969,7 +969,7 @@ static void WriteDISubrange(const DISubrange *N, const ValueEnumerator &,
Record.clear();
}
static void WriteDIEnumerator(const DIEnumerator *N, const ValueEnumerator &VE,
static void writeDIEnumerator(const DIEnumerator *N, const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record,
unsigned Abbrev) {
@ -981,7 +981,7 @@ static void WriteDIEnumerator(const DIEnumerator *N, const ValueEnumerator &VE,
Record.clear();
}
static void WriteDIBasicType(const DIBasicType *N, const ValueEnumerator &VE,
static void writeDIBasicType(const DIBasicType *N, const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record,
unsigned Abbrev) {
@ -996,7 +996,7 @@ static void WriteDIBasicType(const DIBasicType *N, const ValueEnumerator &VE,
Record.clear();
}
static void WriteDIDerivedType(const DIDerivedType *N,
static void writeDIDerivedType(const DIDerivedType *N,
const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record,
@ -1018,7 +1018,7 @@ static void WriteDIDerivedType(const DIDerivedType *N,
Record.clear();
}
static void WriteDICompositeType(const DICompositeType *N,
static void writeDICompositeType(const DICompositeType *N,
const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record,
@ -1044,7 +1044,7 @@ static void WriteDICompositeType(const DICompositeType *N,
Record.clear();
}
static void WriteDISubroutineType(const DISubroutineType *N,
static void writeDISubroutineType(const DISubroutineType *N,
const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record,
@ -1057,7 +1057,7 @@ static void WriteDISubroutineType(const DISubroutineType *N,
Record.clear();
}
static void WriteDIFile(const DIFile *N, const ValueEnumerator &VE,
static void writeDIFile(const DIFile *N, const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record, unsigned Abbrev) {
Record.push_back(N->isDistinct());
@ -1068,7 +1068,7 @@ static void WriteDIFile(const DIFile *N, const ValueEnumerator &VE,
Record.clear();
}
static void WriteDICompileUnit(const DICompileUnit *N,
static void writeDICompileUnit(const DICompileUnit *N,
const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record,
@ -1095,7 +1095,7 @@ static void WriteDICompileUnit(const DICompileUnit *N,
Record.clear();
}
static void WriteDISubprogram(const DISubprogram *N, const ValueEnumerator &VE,
static void writeDISubprogram(const DISubprogram *N, const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record,
unsigned Abbrev) {
@ -1122,7 +1122,7 @@ static void WriteDISubprogram(const DISubprogram *N, const ValueEnumerator &VE,
Record.clear();
}
static void WriteDILexicalBlock(const DILexicalBlock *N,
static void writeDILexicalBlock(const DILexicalBlock *N,
const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record,
@ -1137,7 +1137,7 @@ static void WriteDILexicalBlock(const DILexicalBlock *N,
Record.clear();
}
static void WriteDILexicalBlockFile(const DILexicalBlockFile *N,
static void writeDILexicalBlockFile(const DILexicalBlockFile *N,
const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record,
@ -1151,7 +1151,7 @@ static void WriteDILexicalBlockFile(const DILexicalBlockFile *N,
Record.clear();
}
static void WriteDINamespace(const DINamespace *N, const ValueEnumerator &VE,
static void writeDINamespace(const DINamespace *N, const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record,
unsigned Abbrev) {
@ -1165,7 +1165,7 @@ static void WriteDINamespace(const DINamespace *N, const ValueEnumerator &VE,
Record.clear();
}
static void WriteDIMacro(const DIMacro *N, const ValueEnumerator &VE,
static void writeDIMacro(const DIMacro *N, const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record, unsigned Abbrev) {
Record.push_back(N->isDistinct());
@ -1178,7 +1178,7 @@ static void WriteDIMacro(const DIMacro *N, const ValueEnumerator &VE,
Record.clear();
}
static void WriteDIMacroFile(const DIMacroFile *N, const ValueEnumerator &VE,
static void writeDIMacroFile(const DIMacroFile *N, const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record,
unsigned Abbrev) {
@ -1192,7 +1192,7 @@ static void WriteDIMacroFile(const DIMacroFile *N, const ValueEnumerator &VE,
Record.clear();
}
static void WriteDIModule(const DIModule *N, const ValueEnumerator &VE,
static void writeDIModule(const DIModule *N, const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record, unsigned Abbrev) {
Record.push_back(N->isDistinct());
@ -1203,7 +1203,7 @@ static void WriteDIModule(const DIModule *N, const ValueEnumerator &VE,
Record.clear();
}
static void WriteDITemplateTypeParameter(const DITemplateTypeParameter *N,
static void writeDITemplateTypeParameter(const DITemplateTypeParameter *N,
const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record,
@ -1216,7 +1216,7 @@ static void WriteDITemplateTypeParameter(const DITemplateTypeParameter *N,
Record.clear();
}
static void WriteDITemplateValueParameter(const DITemplateValueParameter *N,
static void writeDITemplateValueParameter(const DITemplateValueParameter *N,
const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record,
@ -1231,7 +1231,7 @@ static void WriteDITemplateValueParameter(const DITemplateValueParameter *N,
Record.clear();
}
static void WriteDIGlobalVariable(const DIGlobalVariable *N,
static void writeDIGlobalVariable(const DIGlobalVariable *N,
const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record,
@ -1252,7 +1252,7 @@ static void WriteDIGlobalVariable(const DIGlobalVariable *N,
Record.clear();
}
static void WriteDILocalVariable(const DILocalVariable *N,
static void writeDILocalVariable(const DILocalVariable *N,
const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record,
@ -1270,7 +1270,7 @@ static void WriteDILocalVariable(const DILocalVariable *N,
Record.clear();
}
static void WriteDIExpression(const DIExpression *N, const ValueEnumerator &,
static void writeDIExpression(const DIExpression *N, const ValueEnumerator &,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record,
unsigned Abbrev) {
@ -1283,7 +1283,7 @@ static void WriteDIExpression(const DIExpression *N, const ValueEnumerator &,
Record.clear();
}
static void WriteDIObjCProperty(const DIObjCProperty *N,
static void writeDIObjCProperty(const DIObjCProperty *N,
const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record,
@ -1301,7 +1301,7 @@ static void WriteDIObjCProperty(const DIObjCProperty *N,
Record.clear();
}
static void WriteDIImportedEntity(const DIImportedEntity *N,
static void writeDIImportedEntity(const DIImportedEntity *N,
const ValueEnumerator &VE,
BitstreamWriter &Stream,
SmallVectorImpl<uint64_t> &Record,
@ -1411,16 +1411,16 @@ static void writeMetadataRecords(ArrayRef<const Metadata *> MDs,
llvm_unreachable("Invalid MDNode subclass");
#define HANDLE_MDNODE_LEAF(CLASS) \
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;
#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,
BitstreamWriter &Stream) {
if (VE.getMDs().empty() && M.named_metadata_empty())
@ -1434,9 +1434,8 @@ static void WriteModuleMetadata(const Module &M,
Stream.ExitBlock();
}
static void WriteFunctionLocalMetadata(const Function &F,
const ValueEnumerator &VE,
BitstreamWriter &Stream) {
static void writeFunctionMetadata(const Function &F, const ValueEnumerator &VE,
BitstreamWriter &Stream) {
ArrayRef<const Metadata *> MDs = VE.getFunctionMDs();
if (MDs.empty())
return;
@ -1445,7 +1444,7 @@ static void WriteFunctionLocalMetadata(const Function &F,
SmallVector<uint64_t, 64> Record;
for (const Metadata *MD : VE.getFunctionMDs())
WriteValueAsMetadata(cast<LocalAsMetadata>(MD), VE, Stream, Record);
writeValueAsMetadata(cast<LocalAsMetadata>(MD), VE, Stream, Record);
Stream.ExitBlock();
}
@ -2561,7 +2560,7 @@ static void WriteFunction(
WriteConstants(CstStart, CstEnd, VE, Stream, false);
// 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.
unsigned InstID = CstEnd;
@ -3215,7 +3214,7 @@ static void WriteModule(const Module *M, BitstreamWriter &Stream,
WriteModuleConstants(VE, Stream);
// Emit metadata.
WriteModuleMetadata(*M, VE, Stream);
writeModuleMetadata(*M, VE, Stream);
// Emit metadata.
WriteModuleMetadataStore(M, Stream);