Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp
Show All 16 Lines | |||||
#include "llvm/MC/MCELFObjectWriter.h" | #include "llvm/MC/MCELFObjectWriter.h" | ||||
#include "llvm/Support/Endian.h" | #include "llvm/Support/Endian.h" | ||||
#include "llvm/Support/EndianStream.h" | #include "llvm/Support/EndianStream.h" | ||||
#define DEBUG_TYPE "loongarch-asmbackend" | #define DEBUG_TYPE "loongarch-asmbackend" | ||||
using namespace llvm; | using namespace llvm; | ||||
const MCFixupKindInfo & | |||||
LoongArchAsmBackend::getFixupKindInfo(MCFixupKind Kind) const { | |||||
const static MCFixupKindInfo Infos[] = { | |||||
// This table *must* be in the order that the fixup_* kinds are defined in | |||||
// LoongArchFixupKinds.h. | |||||
// | |||||
// {name, offset, bits, flags} | |||||
{"fixup_loongarch_b26", 0, 26, 0}, | |||||
{"fixup_loongarch_pcala_hi20", 5, 20, MCFixupKindInfo::FKF_IsPCRel}, | |||||
{"fixup_loongarch_pcala_lo12", 10, 12, MCFixupKindInfo::FKF_IsPCRel}, | |||||
// TODO: Add more fixup kinds. | |||||
}; | |||||
static_assert((array_lengthof(Infos)) == LoongArch::NumTargetFixupKinds, | |||||
"Not all fixup kinds added to Infos array"); | |||||
if (Kind < FirstTargetFixupKind) | |||||
return MCAsmBackend::getFixupKindInfo(Kind); | |||||
assert(unsigned(Kind - FirstTargetFixupKind) < getNumFixupKinds() && | |||||
"Invalid kind!"); | |||||
return Infos[Kind - FirstTargetFixupKind]; | |||||
} | |||||
void LoongArchAsmBackend::applyFixup(const MCAssembler &Asm, | void LoongArchAsmBackend::applyFixup(const MCAssembler &Asm, | ||||
const MCFixup &Fixup, | const MCFixup &Fixup, | ||||
const MCValue &Target, | const MCValue &Target, | ||||
MutableArrayRef<char> Data, uint64_t Value, | MutableArrayRef<char> Data, uint64_t Value, | ||||
bool IsResolved, | bool IsResolved, | ||||
const MCSubtargetInfo *STI) const { | const MCSubtargetInfo *STI) const { | ||||
// TODO: Apply the Value for given Fixup into the provided data fragment. | // TODO: Apply the Value for given Fixup into the provided data fragment. | ||||
return; | return; | ||||
Show All 36 Lines |