llvm/llvm/lib/CGData/CodeGenData.cpp

//===-- CodeGenData.cpp ---------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file contains support for codegen data that has stable summary which
// can be used to optimize the code in the subsequent codegen.
//
//===----------------------------------------------------------------------===//

#include "llvm/Bitcode/BitcodeWriter.h"
#include "llvm/CGData/CodeGenDataReader.h"
#include "llvm/CGData/OutlinedHashTreeRecord.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/Caching.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/WithColor.h"

#define DEBUG_TYPE

usingnamespacellvm;
usingnamespacecgdata;

cl::opt<bool>
    CodeGenDataGenerate("codegen-data-generate", cl::init(false), cl::Hidden,
                        cl::desc("Emit CodeGen Data into custom sections"));
cl::opt<std::string>
    CodeGenDataUsePath("codegen-data-use-path", cl::init(""), cl::Hidden,
                       cl::desc("File path to where .cgdata file is read"));
cl::opt<bool> CodeGenDataThinLTOTwoRounds(
    "codegen-data-thinlto-two-rounds", cl::init(false), cl::Hidden,
    cl::desc("Enable two-round ThinLTO code generation. The first round "
             "emits codegen data, while the second round uses the emitted "
             "codegen data for further optimizations."));

static std::string getCGDataErrString(cgdata_error Err,
                                      const std::string &ErrMsg = "") {}

namespace {

// FIXME: This class is only here to support the transition to llvm::Error. It
// will be removed once this transition is complete. Clients should prefer to
// deal with the Error value directly, rather than converting to error_code.
class CGDataErrorCategoryType : public std::error_category {};

} // end anonymous namespace

const std::error_category &llvm::cgdata_category() {}

std::string CGDataError::message() const {}

char CGDataError::ID =;

namespace {

const char *CodeGenDataSectNameCommon[] =;

const char *CodeGenDataSectNameCoff[] =;

const char *CodeGenDataSectNamePrefix[] =;

} // namespace

namespace llvm {

std::string getCodeGenDataSectionName(CGDataSectKind CGSK,
                                      Triple::ObjectFormatType OF,
                                      bool AddSegmentInfo) {}

std::unique_ptr<CodeGenData> CodeGenData::Instance =;
std::once_flag CodeGenData::OnceFlag;

CodeGenData &CodeGenData::getInstance() {}

namespace IndexedCGData {

Expected<Header> Header::readFromBuffer(const unsigned char *Curr) {}

} // end namespace IndexedCGData

namespace cgdata {

void warn(Twine Message, std::string Whence, std::string Hint) {}

void warn(Error E, StringRef Whence) {}

void saveModuleForTwoRounds(const Module &TheModule, unsigned Task,
                            AddStreamFn AddStream) {}

std::unique_ptr<Module> loadModuleForTwoRounds(BitcodeModule &OrigModule,
                                               unsigned Task,
                                               LLVMContext &Context,
                                               ArrayRef<StringRef> IRFiles) {}

Expected<stable_hash> mergeCodeGenData(ArrayRef<StringRef> ObjFiles) {}

} // end namespace cgdata

} // end namespace llvm