61void AMDGPUAsmBackend::relaxInstruction(
MCInst &Inst,
67 Inst = std::move(Res);
70bool AMDGPUAsmBackend::fixupNeedsRelaxation(
const MCFixup &
Fixup,
77 return (((int64_t(
Value)/4)-1) == 0x3f);
80bool AMDGPUAsmBackend::mayNeedRelaxation(
const MCInst &Inst,
82 if (!STI.
hasFeature(AMDGPU::FeatureOffset3fBug))
115 int64_t SignedValue =
static_cast<int64_t
>(
Value);
117 switch (
Fixup.getTargetKind()) {
119 int64_t BrImm = (SignedValue - 4) / 4;
121 if (Ctx && !isInt<16>(BrImm))
161 for (
unsigned i = 0; i != NumBytes; ++i)
165std::optional<MCFixupKind>
170#include
"llvm/BinaryFormat/ELFRelocs/AMDGPU.def"
191bool AMDGPUAsmBackend::shouldForceRelocation(
const MCAssembler &,
197unsigned AMDGPUAsmBackend::getMinimumNopSize()
const {
213 const uint32_t Encoded_S_NOP_0 = 0xbf800000;
216 support::endian::write<uint32_t>(
OS, Encoded_S_NOP_0, Endian);
227class ELFAMDGPUAsmBackend :
public AMDGPUAsmBackend {
229 bool HasRelocationAddend;
231 uint8_t ABIVersion = 0;
234 ELFAMDGPUAsmBackend(
const Target &
T,
const Triple &TT, uint8_t ABIVersion) :
235 AMDGPUAsmBackend(
T), Is64Bit(
TT.getArch() ==
Triple::amdgcn),
236 HasRelocationAddend(
TT.getOS() ==
Triple::AMDHSA),
237 ABIVersion(ABIVersion) {
238 switch (
TT.getOS()) {
253 std::unique_ptr<MCObjectTargetWriter>
254 createObjectTargetWriter()
const override {
unsigned const MachineRegisterInfo * MRI
#define ELF_RELOC(Name, Value)
static uint64_t adjustFixupValue(const MCFixup &Fixup, uint64_t Value, MCContext *Ctx)
static unsigned getFixupKindNumBytes(unsigned Kind)
Provides AMDGPU specific target descriptions.
Analysis containing CSE Info
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
PowerPC TLS Dynamic Call Fixup
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Generic interface to target specific assembler backends.
virtual unsigned getMinimumNopSize() const
Returns the minimum size of a nop in bytes on this target.
virtual bool writeNopData(raw_ostream &OS, uint64_t Count, const MCSubtargetInfo *STI) const =0
Write an (optimal) nop sequence of Count bytes to the given output.
virtual void relaxInstruction(MCInst &Inst, const MCSubtargetInfo &STI) const
Relax the instruction in the given fragment to the next wider instruction.
virtual bool mayNeedRelaxation(const MCInst &Inst, const MCSubtargetInfo &STI) const
Check whether the given instruction may need relaxation.
virtual bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value, const MCRelaxableFragment *DF, const MCAsmLayout &Layout) const =0
Simple predicate for targets where !Resolved implies requiring relaxation.
virtual bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup, const MCValue &Target)
Hook to check if a relocation is needed for some target specific reason.
virtual unsigned getNumFixupKinds() const =0
Get the number of target specific fixup kinds.
virtual const MCFixupKindInfo & getFixupKindInfo(MCFixupKind Kind) const
Get information on a fixup kind.
virtual std::optional< MCFixupKind > getFixupKind(StringRef Name) const
Map a relocation name used in .reloc to a fixup kind.
virtual void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup, const MCValue &Target, MutableArrayRef< char > Data, uint64_t Value, bool IsResolved, const MCSubtargetInfo *STI) const =0
Apply the Value for given Fixup into the provided data fragment, at the offset specified by the fixup...
Encapsulates the layout of an assembly file at a particular point in time.
Context object for machine code objects.
void reportError(SMLoc L, const Twine &Msg)
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Instances of this class represent a single low-level machine instruction.
unsigned getOpcode() const
void addOperand(const MCOperand Op)
void setOpcode(unsigned Op)
const MCOperand & getOperand(unsigned i) const
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...
Generic base class for all target subtargets.
bool hasFeature(unsigned Feature) const
const Triple & getTargetTriple() const
This represents an "assembler immediate".
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
StringRef - Represent a constant reference to a string, i.e.
A switch()-like statement whose cases are string literals.
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream.
raw_ostream & write_zeros(unsigned NumZeros)
write_zeros - Insert 'NumZeros' nulls.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ fixup_si_sopp_br
16-bit PC relative fixup for SOPP branch instructions.
std::optional< uint8_t > getHsaAbiVersion(const MCSubtargetInfo *STI)
LLVM_READONLY int getSOPPWithRelaxation(uint16_t Opcode)
This is an optimization pass for GlobalISel generic memory operations.
MCAsmBackend * createAMDGPUAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options)
std::unique_ptr< MCObjectTargetWriter > createAMDGPUELFObjectWriter(bool Is64Bit, uint8_t OSABI, bool HasRelocationAddend, uint8_t ABIVersion)
MCFixupKind
Extensible enumeration to represent the type of a fixup.
@ FK_PCRel_4
A four-byte pc relative fixup.
@ FK_SecRel_2
A two-byte section relative fixup.
@ FirstLiteralRelocationKind
The range [FirstLiteralRelocationKind, MaxTargetFixupKind) is used for relocations coming from ....
@ FK_Data_8
A eight-byte fixup.
@ FK_Data_1
A one-byte fixup.
@ FK_Data_4
A four-byte fixup.
@ FK_SecRel_8
A eight-byte section relative fixup.
@ FK_SecRel_4
A four-byte section relative fixup.
@ FK_SecRel_1
A one-byte section relative fixup.
@ FK_Data_2
A two-byte fixup.
Target independent information on a fixup kind.
@ FKF_IsPCRel
Is this fixup kind PCrelative? This is used by the assembler backend to evaluate fixup values in a ta...