Skip to content

Commit

Permalink
[BitcodeWriter] Fix cases of some functions
Browse files Browse the repository at this point in the history
`WriteIndexToFile` is used by external projects so I do not touch it.
  • Loading branch information
MaskRay committed Feb 1, 2022
1 parent 85dfe19 commit 7aaf024
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/BackendUtil.cpp
Expand Up @@ -1746,7 +1746,7 @@ void clang::EmbedBitcode(llvm::Module *M, const CodeGenOptions &CGOpts,
llvm::MemoryBufferRef Buf) {
if (CGOpts.getEmbedBitcode() == CodeGenOptions::Embed_Off)
return;
llvm::EmbedBitcodeInModule(
llvm::embedBitcodeInModule(
*M, Buf, CGOpts.getEmbedBitcode() != CodeGenOptions::Embed_Marker,
CGOpts.getEmbedBitcode() != CodeGenOptions::Embed_Bitcode,
CGOpts.CmdArgs);
Expand Down
2 changes: 1 addition & 1 deletion lld/ELF/LTO.cpp
Expand Up @@ -292,7 +292,7 @@ static void thinLTOCreateEmptyIndexFiles() {

ModuleSummaryIndex m(/*HaveGVs*/ false);
m.setSkipModuleByDistributedBackend();
WriteIndexToFile(m, *os);
writeIndexToFile(m, *os);
if (config->thinLTOEmitImportsFiles)
openFile(path + ".imports");
}
Expand Down
6 changes: 3 additions & 3 deletions llvm/include/llvm/Bitcode/BitcodeWriter.h
Expand Up @@ -139,7 +139,7 @@ class raw_ostream;
///
/// ModHash is for use in ThinLTO incremental build, generated while the IR
/// bitcode file writing.
void WriteThinLinkBitcodeToFile(const Module &M, raw_ostream &Out,
void writeThinLinkBitcodeToFile(const Module &M, raw_ostream &Out,
const ModuleSummaryIndex &Index,
const ModuleHash &ModHash);

Expand All @@ -148,7 +148,7 @@ class raw_ostream;
/// writing the combined index file for ThinLTO. When writing a subset of the
/// index for a distributed backend, provide the \p ModuleToSummariesForIndex
/// map.
void WriteIndexToFile(const ModuleSummaryIndex &Index, raw_ostream &Out,
void writeIndexToFile(const ModuleSummaryIndex &Index, raw_ostream &Out,
const std::map<std::string, GVSummaryMapTy>
*ModuleToSummariesForIndex = nullptr);

Expand All @@ -161,7 +161,7 @@ class raw_ostream;
/// If EmbedCmdline is set, the command line is also exported in
/// the corresponding section (__LLVM,_cmdline / .llvmcmd) - even if CmdArgs
/// were empty.
void EmbedBitcodeInModule(Module &M, MemoryBufferRef Buf, bool EmbedBitcode,
void embedBitcodeInModule(Module &M, MemoryBufferRef Buf, bool EmbedBitcode,
bool EmbedCmdline,
const std::vector<uint8_t> &CmdArgs);

Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
Expand Up @@ -4669,7 +4669,7 @@ void IndexBitcodeWriter::write() {
// where it will be written in a new bitcode block. This is used when
// writing the combined index file for ThinLTO. When writing a subset of the
// index for a distributed backend, provide a \p ModuleToSummariesForIndex map.
void llvm::WriteIndexToFile(
void llvm::writeIndexToFile(
const ModuleSummaryIndex &Index, raw_ostream &Out,
const std::map<std::string, GVSummaryMapTy> *ModuleToSummariesForIndex) {
SmallVector<char, 0> Buffer;
Expand Down Expand Up @@ -4829,7 +4829,7 @@ void BitcodeWriter::writeThinLinkBitcode(const Module &M,
// Write the specified thin link bitcode file to the given raw output stream,
// where it will be written in a new bitcode block. This is used when
// writing the per-module index file for ThinLTO.
void llvm::WriteThinLinkBitcodeToFile(const Module &M, raw_ostream &Out,
void llvm::writeThinLinkBitcodeToFile(const Module &M, raw_ostream &Out,
const ModuleSummaryIndex &Index,
const ModuleHash &ModHash) {
SmallVector<char, 0> Buffer;
Expand Down Expand Up @@ -4881,7 +4881,7 @@ static const char *getSectionNameForCommandline(const Triple &T) {
llvm_unreachable("Unimplemented ObjectFormatType");
}

void llvm::EmbedBitcodeInModule(llvm::Module &M, llvm::MemoryBufferRef Buf,
void llvm::embedBitcodeInModule(llvm::Module &M, llvm::MemoryBufferRef Buf,
bool EmbedBitcode, bool EmbedCmdline,
const std::vector<uint8_t> &CmdArgs) {
// Save llvm.compiler.used and remove it.
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/LTO/LTO.cpp
Expand Up @@ -1372,7 +1372,7 @@ class WriteIndexesThinBackend : public ThinBackendProc {
sys::fs::OpenFlags::OF_None);
if (EC)
return errorCodeToError(EC);
WriteIndexToFile(CombinedIndex, OS, &ModuleToSummariesForIndex);
writeIndexToFile(CombinedIndex, OS, &ModuleToSummariesForIndex);

if (ShouldEmitImportsFiles) {
EC = EmitImportsFiles(ModulePath, NewModulePath + ".imports",
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/LTO/LTOBackend.cpp
Expand Up @@ -144,7 +144,7 @@ Error Config::addSaveTemps(std::string OutputFileName,
// directly and exit.
if (EC)
reportOpenError(Path, EC.message());
WriteIndexToFile(Index, OS);
writeIndexToFile(Index, OS);

Path = OutputFileName + "index.dot";
raw_fd_ostream OSDot(Path, EC, sys::fs::OpenFlags::OF_None);
Expand Down Expand Up @@ -359,7 +359,7 @@ bool lto::opt(const Config &Conf, TargetMachine *TM, unsigned Task, Module &Mod,
LLVM_DEBUG(
dbgs() << "Post-(Thin)LTO merge bitcode embedding was requested, but "
"command line arguments are not available");
llvm::EmbedBitcodeInModule(Mod, llvm::MemoryBufferRef(),
llvm::embedBitcodeInModule(Mod, llvm::MemoryBufferRef(),
/*EmbedBitcode*/ true, /*EmbedCmdline*/ true,
/*Cmdline*/ CmdArgs);
}
Expand All @@ -380,7 +380,7 @@ static void codegen(const Config &Conf, TargetMachine *TM,
return;

if (EmbedBitcode == LTOBitcodeEmbedding::EmbedOptimized)
llvm::EmbedBitcodeInModule(Mod, llvm::MemoryBufferRef(),
llvm::embedBitcodeInModule(Mod, llvm::MemoryBufferRef(),
/*EmbedBitcode*/ true,
/*EmbedCmdline*/ false,
/*CmdArgs*/ std::vector<uint8_t>());
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/LTO/ThinLTOCodeGenerator.cpp
Expand Up @@ -1052,7 +1052,7 @@ void ThinLTOCodeGenerator::run() {
if (EC)
report_fatal_error(Twine("Failed to open ") + SaveTempPath +
" to save optimized bitcode\n");
WriteIndexToFile(*Index, OS);
writeIndexToFile(*Index, OS);
}


Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
Expand Up @@ -535,7 +535,7 @@ void writeThinLTOBitcode(raw_ostream &OS, raw_ostream *ThinLinkOS,
// the information that is needed by thin link will be written in the
// given OS.
if (ThinLinkOS && Index)
WriteThinLinkBitcodeToFile(M, *ThinLinkOS, *Index, ModHash);
writeThinLinkBitcodeToFile(M, *ThinLinkOS, *Index, ModHash);
}

class WriteThinLTOBitcode : public ModulePass {
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
Expand Up @@ -970,7 +970,7 @@ bool DevirtModule::runForTesting(
if (StringRef(ClWriteSummary).endswith(".bc")) {
raw_fd_ostream OS(ClWriteSummary, EC, sys::fs::OF_None);
ExitOnErr(errorCodeToError(EC));
WriteIndexToFile(*Summary, OS);
writeIndexToFile(*Summary, OS);
} else {
raw_fd_ostream OS(ClWriteSummary, EC, sys::fs::OF_TextWithCRLF);
ExitOnErr(errorCodeToError(EC));
Expand Down
2 changes: 1 addition & 1 deletion llvm/tools/gold/gold-plugin.cpp
Expand Up @@ -995,7 +995,7 @@ static void writeEmptyDistributedBuildOutputs(const std::string &ModulePath,
if (SkipModule) {
ModuleSummaryIndex Index(/*HaveGVs*/ false);
Index.setSkipModuleByDistributedBackend();
WriteIndexToFile(Index, OS, nullptr);
writeIndexToFile(Index, OS, nullptr);
}
}
if (options::thinlto_emit_imports_files) {
Expand Down
2 changes: 1 addition & 1 deletion llvm/tools/llvm-as/llvm-as.cpp
Expand Up @@ -106,7 +106,7 @@ static void WriteOutputFile(const Module *M, const ModuleSummaryIndex *Index) {
else
// Otherwise, with an empty Module but non-empty Index, we write a
// combined index.
WriteIndexToFile(*IndexToWrite, Out->os());
writeIndexToFile(*IndexToWrite, Out->os());
}

// Declare success.
Expand Down
6 changes: 3 additions & 3 deletions llvm/tools/llvm-lto/llvm-lto.cpp
Expand Up @@ -497,7 +497,7 @@ static void createCombinedModuleSummaryIndex() {
raw_fd_ostream OS(OutputFilename + ".thinlto.bc", EC,
sys::fs::OpenFlags::OF_None);
error(EC, "error opening the file '" + OutputFilename + ".thinlto.bc'");
WriteIndexToFile(CombinedIndex, OS);
writeIndexToFile(CombinedIndex, OS);
OS.close();
}

Expand Down Expand Up @@ -660,7 +660,7 @@ class ThinLTOProcessing {
std::error_code EC;
raw_fd_ostream OS(OutputFilename, EC, sys::fs::OpenFlags::OF_None);
error(EC, "error opening the file '" + OutputFilename + "'");
WriteIndexToFile(*CombinedIndex, OS);
writeIndexToFile(*CombinedIndex, OS);
}

/// Load the combined index from disk, then compute and generate
Expand Down Expand Up @@ -698,7 +698,7 @@ class ThinLTOProcessing {
std::error_code EC;
raw_fd_ostream OS(OutputName, EC, sys::fs::OpenFlags::OF_None);
error(EC, "error opening the file '" + OutputName + "'");
WriteIndexToFile(*Index, OS, &ModuleToSummariesForIndex);
writeIndexToFile(*Index, OS, &ModuleToSummariesForIndex);
}
}

Expand Down

0 comments on commit 7aaf024

Please sign in to comment.