35 return (
Value >> 2) & 0x3fffffff;
37 case ELF::R_SPARC_WDISP22:
38 return (
Value >> 2) & 0x3fffff;
40 case ELF::R_SPARC_WDISP19:
41 return (
Value >> 2) & 0x7ffff;
43 case ELF::R_SPARC_WDISP16: {
47 unsigned d16hi = (
Value >> 16) & 0x3;
48 unsigned d16lo = (
Value >> 2) & 0x3fff;
49 return (d16hi << 20) | d16lo;
52 case ELF::R_SPARC_WDISP10: {
59 unsigned d10hi = (
Value >> 10) & 0x3;
60 unsigned d10lo = (
Value >> 2) & 0xff;
61 return (d10hi << 19) | (d10lo << 5);
64 case ELF::R_SPARC_HIX22:
65 return (~
Value >> 10) & 0x3fffff;
67 case ELF::R_SPARC_PC22:
68 case ELF::R_SPARC_HI22:
69 case ELF::R_SPARC_LM22:
70 return (
Value >> 10) & 0x3fffff;
73 return Value & 0x1fff;
78 case ELF::R_SPARC_LOX10:
79 return (
Value & 0x3ff) | 0x1c00;
81 case ELF::R_SPARC_PC10:
82 case ELF::R_SPARC_LO10:
85 case ELF::R_SPARC_H44:
86 return (
Value >> 22) & 0x3fffff;
87 case ELF::R_SPARC_M44:
88 return (
Value >> 12) & 0x3ff;
89 case ELF::R_SPARC_L44:
92 case ELF::R_SPARC_HH22:
93 return (
Value >> 42) & 0x3fffff;
94 case ELF::R_SPARC_HM10:
95 return (
Value >> 32) & 0x3ff;
124 Is64Bit(STI.getTargetTriple().isArch64Bit()),
125 IsV8Plus(STI.hasFeature(Sparc::FeatureV8Plus)) {}
141 for (
uint64_t i = 0; i != NumNops; ++i)
142 support::endian::write<uint32_t>(
OS, 0x01000000, Endian);
148class ELFSparcAsmBackend :
public SparcAsmBackend {
153 : SparcAsmBackend(STI), OSType(OSType) {}
155 std::unique_ptr<MCObjectTargetWriter>
156 createObjectTargetWriter()
const override {
163std::optional<MCFixupKind> SparcAsmBackend::getFixupKind(
StringRef Name)
const {
166#define ELF_RELOC(X, Y) .Case(#X, Y)
167#include "llvm/BinaryFormat/ELFRelocs/Sparc.def"
169 .
Case(
"BFD_RELOC_NONE", ELF::R_SPARC_NONE)
170 .
Case(
"BFD_RELOC_8", ELF::R_SPARC_8)
171 .
Case(
"BFD_RELOC_16", ELF::R_SPARC_16)
172 .
Case(
"BFD_RELOC_32", ELF::R_SPARC_32)
173 .
Case(
"BFD_RELOC_64", ELF::R_SPARC_64)
184 {
"fixup_sparc_call30", 2, 30, 0},
185 {
"fixup_sparc_13", 19, 13, 0},
190 {
"fixup_sparc_call30", 0, 30, 0},
191 {
"fixup_sparc_13", 0, 13, 0},
208 case ELF::R_SPARC_PC10:
209 Info = {
"", 22, 10, 0};
211 case ELF::R_SPARC_PC22:
212 Info = {
"", 10, 22, 0};
214 case ELF::R_SPARC_WDISP10:
215 Info = {
"", 0, 32, 0};
217 case ELF::R_SPARC_WDISP16:
218 Info = {
"", 0, 32, 0};
220 case ELF::R_SPARC_WDISP19:
221 Info = {
"", 13, 19, 0};
223 case ELF::R_SPARC_WDISP22:
224 Info = {
"", 10, 22, 0};
227 case ELF::R_SPARC_HI22:
228 Info = {
"", 10, 22, 0};
230 case ELF::R_SPARC_LO10:
231 Info = {
"", 22, 10, 0};
233 case ELF::R_SPARC_HH22:
234 Info = {
"", 10, 22, 0};
236 case ELF::R_SPARC_HM10:
237 Info = {
"", 22, 10, 0};
239 case ELF::R_SPARC_LM22:
240 Info = {
"", 10, 22, 0};
242 case ELF::R_SPARC_HIX22:
243 Info = {
"", 10, 22, 0};
245 case ELF::R_SPARC_LOX10:
246 Info = {
"", 19, 13, 0};
250 Info.TargetOffset = 32 -
Info.TargetOffset -
Info.TargetSize;
265 for (
unsigned i = 0; i != NumBytes; ++i) {
unsigned const MachineRegisterInfo * MRI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Analysis containing CSE Info
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
PowerPC TLS Dynamic Call Fixup
static unsigned adjustFixupValue(unsigned Kind, uint64_t Value)
static unsigned getFixupKindNumBytes(unsigned Kind)
getFixupKindNumBytes - The number of bytes the fixup may change.
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
Generic interface to target specific assembler backends.
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 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 MCFragment &, const MCFixup &, const MCValue &Target, uint8_t *Data, uint64_t Value, bool IsResolved)=0
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Generic base class for all target subtargets.
const Triple & getTargetTriple() const
StringRef - Represent a constant reference to a string, i.e.
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
Target - Wrapper for Target specific information.
OSType getOS() const
Get the parsed operating system type of this triple.
The instances of the Type class are immutable: once they are created, they are never changed.
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.
@ fixup_sparc_13
fixup_sparc_13 - 13-bit fixup
bool isRelocation(MCFixupKind FixupKind)
This is an optimization pass for GlobalISel generic memory operations.
@ FirstLiteralRelocationKind
@ FK_Data_8
A eight-byte fixup.
@ FK_Data_1
A one-byte fixup.
@ FK_Data_4
A four-byte fixup.
@ FK_Data_2
A two-byte fixup.
std::unique_ptr< MCObjectTargetWriter > createSparcELFObjectWriter(bool Is64Bit, bool IsV8Plus, uint8_t OSABI)
MCAsmBackend * createSparcAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options)
Target independent information on a fixup kind.