LLVM: lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

17#include

18#include

19

20using namespace llvm;

21

22namespace {

23

25public:

26 BPFAsmBackend(llvm::endianness Endian) : MCAsmBackend(Endian) {}

27 ~BPFAsmBackend() override = default;

28

29 void applyFixup(const MCFragment &, const MCFixup &, const MCValue &Target,

30 uint8_t *Data, uint64_t Value, bool IsResolved) override;

31

32 std::unique_ptr

33 createObjectTargetWriter() const override;

34

35 MCFixupKindInfo getFixupKindInfo(MCFixupKind Kind) const override;

36

37 bool writeNopData(raw_ostream &OS, uint64_t Count,

38 const MCSubtargetInfo *STI) const override;

39};

40

41}

42

45 {"FK_BPF_PCRel_4", 0, 32, 0},

46 };

47

50

52 "Invalid kind!");

54}

55

56bool BPFAsmBackend::writeNopData(raw_ostream &OS, uint64_t Count,

57 const MCSubtargetInfo *STI) const {

58 if ((Count % 8) != 0)

59 return false;

60

61 for (uint64_t i = 0; i < Count; i += 8)

63

64 return true;

65}

66

67void BPFAsmBackend::applyFixup(const MCFragment &F, const MCFixup &Fixup,

68 const MCValue &Target, uint8_t *Data,

69 uint64_t Value, bool IsResolved) {

70 maybeAddReloc(F, Fixup, Target, Value, IsResolved);

72

73

76 Endian);

84 Data[1] = 0x10;

86 } else {

87 Data[1] = 0x1;

89 }

91

94 } else {

96

97 int64_t ByteOff = (int64_t)Value - 8;

98 if (ByteOff > INT16_MAX * 8 || ByteOff < INT16_MIN * 8)

100

103 }

104}

105

106std::unique_ptr

107BPFAsmBackend::createObjectTargetWriter() const {

109}

110

117

unsigned const MachineRegisterInfo * MRI

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

PowerPC TLS Dynamic Call Fixup

Generic interface to target specific assembler backends.

virtual MCFixupKindInfo getFixupKindInfo(MCFixupKind Kind) const

Get information on a fixup kind.

MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...

Generic base class for all target subtargets.

Target - Wrapper for Target specific information.

Error applyFixup(LinkGraph &G, Block &B, const Edge &E, const ArmConfig &ArmCfg)

Apply fixup expression for edge to block content.

void write32le(void *P, uint32_t V)

void write32be(void *P, uint32_t V)

void write(void *memory, value_type value, endianness endian)

Write a value to memory with a particular endianness.

This is an optimization pass for GlobalISel generic memory operations.

FunctionAddr VTableAddr Value

MCAsmBackend * createBPFAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options)

Definition BPFAsmBackend.cpp:111

uint16_t MCFixupKind

Extensible enumeration to represent the type of a fixup.

MCAsmBackend * createBPFbeAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options)

Definition BPFAsmBackend.cpp:118

LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)

FunctionAddr VTableAddr Count

@ FK_Data_8

A eight-byte fixup.

@ FK_Data_4

A four-byte fixup.

@ FK_SecRel_8

A eight-byte section relative fixup.

@ FK_Data_2

A two-byte fixup.

FunctionAddr VTableAddr uintptr_t uintptr_t Data

std::unique_ptr< MCObjectTargetWriter > createBPFELFObjectWriter(uint8_t OSABI)

Target independent information on a fixup kind.