llvm/bolt/lib/Rewrite/MachORewriteInstance.cpp

//===- bolt/Rewrite/MachORewriteInstance.cpp - MachO rewriter -------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#include "bolt/Rewrite/MachORewriteInstance.h"
#include "bolt/Core/BinaryContext.h"
#include "bolt/Core/BinaryEmitter.h"
#include "bolt/Core/BinaryFunction.h"
#include "bolt/Core/JumpTable.h"
#include "bolt/Core/MCPlusBuilder.h"
#include "bolt/Passes/Instrumentation.h"
#include "bolt/Passes/PatchEntries.h"
#include "bolt/Profile/DataReader.h"
#include "bolt/Rewrite/BinaryPassManager.h"
#include "bolt/Rewrite/ExecutableFileMemoryManager.h"
#include "bolt/Rewrite/JITLinkLinker.h"
#include "bolt/Rewrite/RewriteInstance.h"
#include "bolt/RuntimeLibs/InstrumentationRuntimeLibrary.h"
#include "bolt/Utils/Utils.h"
#include "llvm/MC/MCObjectStreamer.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/ToolOutputFile.h"
#include <memory>
#include <optional>

namespace opts {

usingnamespacellvm;
extern cl::opt<unsigned> AlignText;
//FIXME! Upstream change
//extern cl::opt<bool> CheckOverlappingElements;
extern cl::opt<bool> ForcePatch;
extern cl::opt<bool> Instrument;
extern cl::opt<bool> InstrumentCalls;
extern cl::opt<bolt::JumpTableSupportLevel> JumpTables;
extern cl::opt<bool> KeepTmp;
extern cl::opt<bool> NeverPrint;
extern cl::opt<std::string> OutputFilename;
extern cl::opt<bool> PrintAfterBranchFixup;
extern cl::opt<bool> PrintFinalized;
extern cl::opt<bool> PrintNormalized;
extern cl::opt<bool> PrintReordered;
extern cl::opt<bool> PrintSections;
extern cl::opt<bool> PrintDisasm;
extern cl::opt<bool> PrintCFG;
extern cl::opt<std::string> RuntimeInstrumentationLib;
extern cl::opt<unsigned> Verbosity;
} // namespace opts

namespace llvm {
namespace bolt {

#define DEBUG_TYPE

Expected<std::unique_ptr<MachORewriteInstance>>
MachORewriteInstance::create(object::MachOObjectFile *InputFile,
                             StringRef ToolPath) {}

MachORewriteInstance::MachORewriteInstance(object::MachOObjectFile *InputFile,
                                           StringRef ToolPath, Error &Err)
    :{}

Error MachORewriteInstance::setProfile(StringRef Filename) {}

void MachORewriteInstance::preprocessProfileData() {}

void MachORewriteInstance::processProfileDataPreCFG() {}

void MachORewriteInstance::processProfileData() {}

void MachORewriteInstance::readSpecialSections() {}

namespace {

struct DataInCodeRegion {};

std::vector<DataInCodeRegion> readDataInCode(const MachOObjectFile &O) {}

std::optional<uint64_t> readStartAddress(const MachOObjectFile &O) {}

} // anonymous namespace

void MachORewriteInstance::discoverFileObjects() {}

void MachORewriteInstance::disassembleFunctions() {}

void MachORewriteInstance::buildFunctionsCFG() {}

void MachORewriteInstance::postProcessFunctions() {}

void MachORewriteInstance::runOptimizationPasses() {}

void MachORewriteInstance::mapInstrumentationSection(
    StringRef SectionName, BOLTLinker::SectionMapper MapSection) {}

void MachORewriteInstance::mapCodeSections(
    BOLTLinker::SectionMapper MapSection) {}

void MachORewriteInstance::emitAndLink() {}

void MachORewriteInstance::writeInstrumentationSection(StringRef SectionName,
                                                       raw_pwrite_stream &OS) {}

void MachORewriteInstance::rewriteFile() {}

void MachORewriteInstance::adjustCommandLineOptions() {}

void MachORewriteInstance::run() {}

MachORewriteInstance::~MachORewriteInstance() {}

} // namespace bolt
} // namespace llvm