26 BPFAsmBackend(
bool IsLittleEndian)
28 ~BPFAsmBackend()
override =
default;
30 void applyFixup(
const MCFixup &Fixup,
char *Data,
unsigned DataSize,
31 uint64_t
Value,
bool IsPCRel)
const override;
36 bool fixupNeedsRelaxation(
const MCFixup &Fixup, uint64_t
Value,
42 unsigned getNumFixupKinds()
const override {
return 1; }
44 bool mayNeedRelaxation(
const MCInst &Inst)
const override {
return false; }
47 MCInst &Res)
const override {}
49 bool writeNopData(uint64_t Count,
MCObjectWriter *OW)
const override;
54 bool BPFAsmBackend::writeNopData(uint64_t Count,
MCObjectWriter *OW)
const {
58 for (uint64_t
i = 0;
i < Count;
i += 8)
64 void BPFAsmBackend::applyFixup(
const MCFixup &Fixup,
char *Data,
65 unsigned DataSize, uint64_t
Value,
72 for (
unsigned i = 0;
i != Size; ++
i) {
73 unsigned Idx = IsLittleEndian ?
i : Size -
i;
74 Data[Fixup.
getOffset() + Idx] = uint8_t(Value >> (i * 8));
78 Value = (uint16_t)((Value - 8) / 8);
80 Data[Fixup.
getOffset() + 2] = Value & 0xFF;
84 Data[Fixup.
getOffset() + 3] = Value & 0xFF;
97 return new BPFAsmBackend(
true);
104 return new BPFAsmBackend(
false);
void write64(uint64_t Value)
MCObjectWriter * createBPFELFObjectWriter(raw_pwrite_stream &OS, uint8_t OSABI, bool IsLittleEndian)
Defines the object file and target independent interfaces used by the assembler backend to write nati...
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Encapsulates the layout of an assembly file at a particular point in time.
MCAsmBackend * createBPFAsmBackend(const Target &T, const MCRegisterInfo &MRI, const Triple &TT, StringRef CPU, const MCTargetOptions &Options)
A four-byte section relative fixup.
const MCSubtargetInfo * STI
uint32_t getOffset() const
Instances of this class represent a single low-level machine instruction.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
A relaxable fragment holds on to its MCInst, since it may need to be relaxed during the assembler lay...
unsigned const MachineRegisterInfo * MRI
MCFixupKind getKind() const
Triple - Helper class for working with autoconf configuration names.
MCAsmBackend * createBPFbeAsmBackend(const Target &T, const MCRegisterInfo &MRI, const Triple &TT, StringRef CPU, const MCTargetOptions &Options)
A two-byte pc relative fixup.
Target - Wrapper for Target specific information.
A eight-byte section relative fixup.
MCSubtargetInfo - Generic base class for all target subtargets.
An abstract base class for streams implementations that also support a pwrite operation.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
Generic interface to target specific assembler backends.
StringRef - Represent a constant reference to a string, i.e.