llvm/bolt/include/bolt/Core/BinaryContext.h

//===- bolt/Core/BinaryContext.h - Low-level context ------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
//
// Context for processing binary executable/library files.
//
//===----------------------------------------------------------------------===//

#ifndef BOLT_CORE_BINARY_CONTEXT_H
#define BOLT_CORE_BINARY_CONTEXT_H

#include "bolt/Core/AddressMap.h"
#include "bolt/Core/BinaryData.h"
#include "bolt/Core/BinarySection.h"
#include "bolt/Core/DebugData.h"
#include "bolt/Core/DynoStats.h"
#include "bolt/Core/JumpTable.h"
#include "bolt/Core/MCPlusBuilder.h"
#include "bolt/RuntimeLibs/RuntimeLibrary.h"
#include "llvm/ADT/AddressRanges.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/EquivalenceClasses.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/iterator.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/BinaryFormat/MachO.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCCodeEmitter.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/MC/MCPseudoProbe.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/RWMutex.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/Triple.h"
#include <functional>
#include <list>
#include <map>
#include <optional>
#include <set>
#include <string>
#include <system_error>
#include <type_traits>
#include <unordered_map>
#include <vector>

namespace llvm {
class MCDisassembler;
class MCInstPrinter;

usingnamespaceobject;

namespace bolt {

class BinaryFunction;

/// Information on loadable part of the file.
struct SegmentInfo {};

inline raw_ostream &operator<<(raw_ostream &OS, const SegmentInfo &SegInfo) {}

// AArch64-specific symbol markers used to delimit code/data in .text.
enum class MarkerSymType : char {};

enum class MemoryContentsType : char {};

/// Helper function to truncate a \p Value to given size in \p Bytes.
inline int64_t truncateToSize(int64_t Value, unsigned Bytes) {}

/// Filter iterator.
template <typename ItrType,
          typename PredType = std::function<bool(const ItrType &)>>
class FilterIterator {
  using inner_traits = std::iterator_traits<ItrType>;
  using Iterator = FilterIterator;

  PredType Pred;
  ItrType Itr, End;

  void prev() {}
  void next() {}
  void nextMatching() {}

public:
  using iterator_category = std::bidirectional_iterator_tag;
  using value_type = typename inner_traits::value_type;
  using difference_type = typename inner_traits::difference_type;
  using pointer = typename inner_traits::pointer;
  using reference = typename inner_traits::reference;

  Iterator &operator++() {}
  Iterator &operator--() {}
  Iterator operator++(int) {}
  Iterator operator--(int) {}
  bool operator==(const Iterator &Other) const {}
  bool operator!=(const Iterator &Other) const {}
  reference operator*() {}
  pointer operator->() {}
  FilterIterator(PredType Pred, ItrType Itr, ItrType End)
      :{}
};

/// BOLT-exclusive errors generated in core BOLT libraries, optionally holding a
/// string message and whether it is fatal or not. In case it is fatal and if
/// BOLT is running as a standalone process, the process might be killed as soon
/// as the error is checked.
class BOLTError : public ErrorInfo<BOLTError> {};

/// Streams used by BOLT to log regular or error events
struct JournalingStreams {};

Error createNonFatalBOLTError(const Twine &S);
Error createFatalBOLTError(const Twine &S);

class BinaryContext {};

template <typename T, typename = std::enable_if_t<sizeof(T) == 1>>
inline raw_ostream &operator<<(raw_ostream &OS, const ArrayRef<T> &ByteArray) {}

} // namespace bolt
} // namespace llvm

#endif