//===-- W65816FixupKinds.h - W65816 Specific Fixup Entries ------*- 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
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIB_TARGET_W65816_MCTARGETDESC_W65816FIXUPKINDS_H
#define LLVM_LIB_TARGET_W65816_MCTARGETDESC_W65816FIXUPKINDS_H

#include "llvm/MC/MCFixup.h"

#undef W65816

namespace llvm {
namespace W65816 {

// This table must stay in sync with the MCFixupKindInfo table in
// W65816AsmBackend.cpp.  Only a bare minimum is defined for the skeleton.
enum Fixups {
  // 8-bit absolute fixup (immediate byte).
  fixup_8 = FirstTargetFixupKind,
  // 16-bit absolute fixup (low two bytes of a 24-bit address).
  fixup_16,
  // 24-bit absolute fixup (long address).
  fixup_24,
  // 8-bit PC-relative fixup (short branch).
  fixup_8_pcrel,
  // 16-bit PC-relative fixup (long branch / BRL).
  fixup_16_pcrel,
  // 16-bit fixup that materialises (bankByte, 0) of a 24-bit target
  // address into 2 little-endian bytes.  Used for the high half of a
  // 32-bit pointer constant: `ldx #@bank(symbol)` so &symbol's bank
  // byte tracks the OMF Loader's actual placement at runtime.
  fixup_bank16,
  // 32-bit absolute fixup (4 little-endian bytes).  Generated for the
  // generic FK_Data_4 kind when the caller is not PC-relative.  Used
  // by DWARF .debug_* sections (section-relative absolute addresses)
  // and by user .long directives.  link816 patches the low 24 bits
  // of `target` into the first 3 bytes; the high byte is zero (the
  // 65816 address space is only 24 bits wide).
  fixup_32,
  // 32-bit PC-relative fixup (4 little-endian bytes, signed).
  // Generated for the generic FK_Data_4 kind when the caller is
  // PC-relative.  DWARF section-relative diffs convert to PC-relative
  // when the assembler can't resolve them in-section.
  fixup_32_pcrel,

  // Marker
  LastTargetFixupKind,
  NumTargetFixupKinds = LastTargetFixupKind - FirstTargetFixupKind
};

} // end namespace W65816
} // end namespace llvm

#endif
