<commit_before>//===-- llvm/MC/MCFixup.h - Instruction Relocation and Patching -*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_MC_MCFIXUP_H
#define LLVM_MC_MCFIXUP_H

#include <cassert>

namespace llvm {

// Private constants, do not use.
//
// This is currently laid out so that the MCFixup fields can be efficiently
// accessed, while keeping the offset field large enough that the assembler
// backend can reasonably use the MCFixup representation for an entire fragment
// (splitting any overly large fragments).
//
// The division of bits between the kind and the opindex can be tweaked if we
// end up needing more bits for target dependent kinds.
enum {
  MCFIXUP_NUM_GENERIC_KINDS = 128,
  MCFIXUP_NUM_KIND_BITS = 8,
  MCFIXUP_NUM_OPINDEX_BITS = 8,
  MCFIXUP_NUM_OFFSET_BITS = (32 - MCFIXUP_NUM_OPINDEX_BITS -
                             MCFIXUP_NUM_OPINDEX_BITS)
};

/// MCFixupKind - Extensible enumeration to represent the type of a fixup.
enum MCFixupKind {
  FK_Data_1 = 0, ///< A one-byte fixup.
  FK_Data_2,     ///< A two-byte fixup.
  FK_Data_4,     ///< A four-byte fixup.
  FK_Data_8,     ///< A eight-byte fixup.

  FirstTargetFixupKind = MCFIXUP_NUM_GENERIC_KINDS,

  MaxTargetFixupKind = (1 << MCFIXUP_NUM_KIND_BITS)
};

/// MCFixup - Encode information on a single operation to perform on an byte
/// sequence (e.g., an encoded instruction) which requires assemble- or run-
/// time patching.
///
/// Fixups are used any time the target instruction encoder needs to represent
/// some value in an instruction which is not yet concrete. The encoder will
/// encode the instruction assuming the value is 0, and emit a fixup which
/// communicates to the assembler backend how it should rewrite the encoded
/// value.
///
/// During the process of relaxation, the assembler will apply fixups as
/// symbolic values become concrete. When relaxation is complete, any remaining
/// fixups become relocations in the object file (or errors, if the fixup cannot
/// be encoded on the target).
class MCFixup {
  static const unsigned MaxOffset = 1 << MCFIXUP_NUM_KIND_BITS;

  /// The byte index of start of the relocation inside the encoded instruction.
  unsigned Offset : MCFIXUP_NUM_OFFSET_BITS;

  /// The index of the operand to encode into the instruction.
  unsigned OpIndex : MCFIXUP_NUM_OPINDEX_BITS;

  /// The target dependent kind of fixup item this is. The kind is used to
  /// determine how the operand value should be encoded into the instruction.
  unsigned Kind : MCFIXUP_NUM_KIND_BITS;

public:
  static MCFixup Create(unsigned Offset, unsigned OpIndex, MCFixupKind Kind) {
    MCFixup FI;
    FI.Offset = Offset;
    FI.OpIndex = OpIndex;
    FI.Kind = unsigned(Kind);

    assert(Offset == FI.Offset && "Offset out of range!");
    assert(OpIndex == FI.OpIndex && "Operand index out of range!");
    assert(Kind == FI.Kind && "Kind out of range!");
    return FI;
  }

  unsigned getOffset() const { return Offset; }

  unsigned getOpIndex() const { return OpIndex; }

  MCFixupKind getKind() const { return MCFixupKind(Kind); }
};

} // End llvm namespace

#endif<commit_msg>Fix a signed comparison warning.<commit_after>//===-- llvm/MC/MCFixup.h - Instruction Relocation and Patching -*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_MC_MCFIXUP_H
#define LLVM_MC_MCFIXUP_H

#include <cassert>

namespace llvm {

// Private constants, do not use.
//
// This is currently laid out so that the MCFixup fields can be efficiently
// accessed, while keeping the offset field large enough that the assembler
// backend can reasonably use the MCFixup representation for an entire fragment
// (splitting any overly large fragments).
//
// The division of bits between the kind and the opindex can be tweaked if we
// end up needing more bits for target dependent kinds.
enum {
  MCFIXUP_NUM_GENERIC_KINDS = 128,
  MCFIXUP_NUM_KIND_BITS = 8,
  MCFIXUP_NUM_OPINDEX_BITS = 8,
  MCFIXUP_NUM_OFFSET_BITS = (32 - MCFIXUP_NUM_OPINDEX_BITS -
                             MCFIXUP_NUM_OPINDEX_BITS)
};

/// MCFixupKind - Extensible enumeration to represent the type of a fixup.
enum MCFixupKind {
  FK_Data_1 = 0, ///< A one-byte fixup.
  FK_Data_2,     ///< A two-byte fixup.
  FK_Data_4,     ///< A four-byte fixup.
  FK_Data_8,     ///< A eight-byte fixup.

  FirstTargetFixupKind = MCFIXUP_NUM_GENERIC_KINDS,

  MaxTargetFixupKind = (1 << MCFIXUP_NUM_KIND_BITS)
};

/// MCFixup - Encode information on a single operation to perform on an byte
/// sequence (e.g., an encoded instruction) which requires assemble- or run-
/// time patching.
///
/// Fixups are used any time the target instruction encoder needs to represent
/// some value in an instruction which is not yet concrete. The encoder will
/// encode the instruction assuming the value is 0, and emit a fixup which
/// communicates to the assembler backend how it should rewrite the encoded
/// value.
///
/// During the process of relaxation, the assembler will apply fixups as
/// symbolic values become concrete. When relaxation is complete, any remaining
/// fixups become relocations in the object file (or errors, if the fixup cannot
/// be encoded on the target).
class MCFixup {
  static const unsigned MaxOffset = 1 << MCFIXUP_NUM_KIND_BITS;

  /// The byte index of start of the relocation inside the encoded instruction.
  unsigned Offset : MCFIXUP_NUM_OFFSET_BITS;

  /// The index of the operand to encode into the instruction.
  unsigned OpIndex : MCFIXUP_NUM_OPINDEX_BITS;

  /// The target dependent kind of fixup item this is. The kind is used to
  /// determine how the operand value should be encoded into the instruction.
  unsigned Kind : MCFIXUP_NUM_KIND_BITS;

public:
  static MCFixup Create(unsigned Offset, unsigned OpIndex, MCFixupKind Kind) {
    MCFixup FI;
    FI.Offset = Offset;
    FI.OpIndex = OpIndex;
    FI.Kind = unsigned(Kind);

    assert(Offset == FI.getOffset() && "Offset out of range!");
    assert(OpIndex == FI.getOpIndex() && "Operand index out of range!");
    assert(Kind == FI.getKind() && "Kind out of range!");
    return FI;
  }

  unsigned getOffset() const { return Offset; }

  unsigned getOpIndex() const { return OpIndex; }

  MCFixupKind getKind() const { return MCFixupKind(Kind); }
};

} // End llvm namespace

#endif
{'fraction_non_alphanumeric': 0.1122479240806643, 'fraction_numerical': 0.004448398576512456, 'mean_word_length': 2.949063231850117, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7287723', 'n_tokens_mistral': 2019, 'n_tokens_neox': 1924, 'n_words': 771}