#include "LoongArchAsmBackend.h"
#include "LoongArchFixupKinds.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCELFObjectWriter.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCValue.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/MathExtras.h"
#define DEBUG_TYPE …
usingnamespacellvm;
std::optional<MCFixupKind>
LoongArchAsmBackend::getFixupKind(StringRef Name) const { … }
const MCFixupKindInfo &
LoongArchAsmBackend::getFixupKindInfo(MCFixupKind Kind) const { … }
static void reportOutOfRangeError(MCContext &Ctx, SMLoc Loc, unsigned N) { … }
static uint64_t adjustFixupValue(const MCFixup &Fixup, uint64_t Value,
MCContext &Ctx) { … }
static void fixupLeb128(MCContext &Ctx, const MCFixup &Fixup,
MutableArrayRef<char> Data, uint64_t Value) { … }
void LoongArchAsmBackend::applyFixup(const MCAssembler &Asm,
const MCFixup &Fixup,
const MCValue &Target,
MutableArrayRef<char> Data, uint64_t Value,
bool IsResolved,
const MCSubtargetInfo *STI) const { … }
bool LoongArchAsmBackend::shouldInsertExtraNopBytesForCodeAlign(
const MCAlignFragment &AF, unsigned &Size) { … }
bool LoongArchAsmBackend::shouldInsertFixupForCodeAlign(MCAssembler &Asm,
MCAlignFragment &AF) { … }
bool LoongArchAsmBackend::shouldForceRelocation(const MCAssembler &Asm,
const MCFixup &Fixup,
const MCValue &Target,
const MCSubtargetInfo *STI) { … }
static inline std::pair<MCFixupKind, MCFixupKind>
getRelocPairForSize(unsigned Size) { … }
std::pair<bool, bool> LoongArchAsmBackend::relaxLEB128(const MCAssembler &Asm,
MCLEBFragment &LF,
int64_t &Value) const { … }
bool LoongArchAsmBackend::relaxDwarfLineAddr(const MCAssembler &Asm,
MCDwarfLineAddrFragment &DF,
bool &WasRelaxed) const { … }
bool LoongArchAsmBackend::relaxDwarfCFA(const MCAssembler &Asm,
MCDwarfCallFrameFragment &DF,
bool &WasRelaxed) const { … }
bool LoongArchAsmBackend::writeNopData(raw_ostream &OS, uint64_t Count,
const MCSubtargetInfo *STI) const { … }
bool LoongArchAsmBackend::handleAddSubRelocations(const MCAssembler &Asm,
const MCFragment &F,
const MCFixup &Fixup,
const MCValue &Target,
uint64_t &FixedValue) const { … }
std::unique_ptr<MCObjectTargetWriter>
LoongArchAsmBackend::createObjectTargetWriter() const { … }
MCAsmBackend *llvm::createLoongArchAsmBackend(const Target &T,
const MCSubtargetInfo &STI,
const MCRegisterInfo &MRI,
const MCTargetOptions &Options) { … }