#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 {
class CGDataErrorCategoryType : public std::error_category { … };
}
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 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) { … }
}
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) { … }
}
}