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;
 
 
  120  SparcAsmBackend(
const MCSubtargetInfo &STI)
 
  121      : MCAsmBackend(STI.getTargetTriple().isLittleEndian()
 
  124        Is64Bit(STI.getTargetTriple().isArch64Bit()),
 
  125        IsV8Plus(STI.hasFeature(Sparc::FeatureV8Plus)) {}
 
  127  std::optional<MCFixupKind> 
getFixupKind(StringRef Name) 
const override;
 
  128  MCFixupKindInfo getFixupKindInfo(
MCFixupKind Kind) 
const override;
 
  129  void applyFixup(
const MCFragment &, 
const MCFixup &, 
const MCValue &Target,
 
  130                  uint8_t *
Data, uint64_t 
Value, 
bool IsResolved) 
override;
 
  132  bool writeNopData(raw_ostream &OS, uint64_t 
Count,
 
  133                    const MCSubtargetInfo *STI)
 const override {
 
  140    uint64_t NumNops = 
Count / 4;
 
  141    for (uint64_t i = 0; i != NumNops; ++i)
 
  148class ELFSparcAsmBackend : 
public SparcAsmBackend {
 
  152  ELFSparcAsmBackend(
const MCSubtargetInfo &STI, 
Triple::OSType OSType)
 
  153      : SparcAsmBackend(STI), OSType(OSType) {}
 
  155  std::unique_ptr<MCObjectTargetWriter>
 
  156  createObjectTargetWriter()
 const override {
 
  163std::optional<MCFixupKind> SparcAsmBackend::getFixupKind(
StringRef Name)
 const {
 
  165  Type = llvm::StringSwitch<unsigned>(Name)
 
  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)
 
  180MCFixupKindInfo SparcAsmBackend::getFixupKindInfo(
MCFixupKind Kind)
 const {
 
  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},
 
  206  MCFixupKindInfo 
Info{};
 
  207  switch (uint16_t(Kind)) {
 
  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;
 
  254void SparcAsmBackend::applyFixup(
const MCFragment &
F, 
const MCFixup &
Fixup,
 
  255                                 const MCValue &Target, uint8_t *
Data,
 
  256                                 uint64_t 
Value, 
bool IsResolved) {
 
  257  maybeAddReloc(
F, 
Fixup, Target, 
Value, IsResolved);
 
  265  for (
unsigned i = 0; i != NumBytes; ++i) {
 
  267    Data[Idx] |= uint8_t((
Value >> (i * 8)) & 0xff);
 
unsigned const MachineRegisterInfo * MRI
static unsigned getFixupKindNumBytes(unsigned Kind)
The number of bytes the fixup may change.
static uint64_t adjustFixupValue(const MCFixup &Fixup, const MCValue &Target, uint64_t Value, MCContext &Ctx, const Triple &TheTriple, bool IsResolved)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Analysis containing CSE Info
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 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.
const Triple & getTargetTriple() const
StringRef - Represent a constant reference to a string, i.e.
Target - Wrapper for Target specific information.
OSType getOS() const
Get the parsed operating system type of this triple.
LLVM Value Representation.
raw_ostream & write_zeros(unsigned NumZeros)
write_zeros - Insert 'NumZeros' nulls.
@ fixup_sparc_13
fixup_sparc_13 - 13-bit fixup
VE::Fixups getFixupKind(uint8_t S)
Error applyFixup(LinkGraph &G, Block &B, const Edge &E, const ArmConfig &ArmCfg)
Apply fixup expression for edge to block content.
bool isRelocation(MCFixupKind FixupKind)
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
uint16_t MCFixupKind
Extensible enumeration to represent the type of a fixup.
std::unique_ptr< MCObjectTargetWriter > createSparcELFObjectWriter(bool Is64Bit, bool IsV8Plus, uint8_t OSABI)
FunctionAddr VTableAddr Count
@ 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.
FunctionAddr VTableAddr uintptr_t uintptr_t Data
MCAsmBackend * createSparcAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options)