74 Value = ((Value + 0x8000) >> 16) & 0xffff;
78 Value = ((Value + 0x80008000LL) >> 32) & 0xffff;
82 Value = ((Value + 0x800080008000LL) >> 48) & 0xffff;
104 bool _isLittle,
bool _is64Bit)
105 :
MCAsmBackend(), OSType(_OSType), IsLittle(_isLittle), Is64Bit(_is64Bit) {}
115 void applyFixup(
const MCFixup &Fixup,
char *Data,
unsigned DataSize,
116 uint64_t
Value)
const {
126 unsigned NumBytes = (getFixupKindInfo(Kind).TargetSize + 7) / 8;
130 switch ((
unsigned)
Kind) {
145 for (
unsigned i = 0; i != NumBytes; ++i) {
146 unsigned Idx = IsLittle ? i : (FullSize - 1 - i);
147 CurVal |= (uint64_t)((uint8_t)Data[Offset + Idx]) << (i*8);
150 uint64_t Mask = ((uint64_t)(-1) >>
151 (64 - getFixupKindInfo(Kind).TargetSize));
152 CurVal |= Value & Mask;
155 for (
unsigned i = 0; i != NumBytes; ++i) {
156 unsigned Idx = IsLittle ? i : (FullSize - 1 - i);
157 Data[Offset + Idx] = (uint8_t)((CurVal >> (i*8)) & 0xff);
169 {
"fixup_Mips_16", 0, 16, 0 },
170 {
"fixup_Mips_32", 0, 32, 0 },
171 {
"fixup_Mips_REL32", 0, 32, 0 },
172 {
"fixup_Mips_26", 0, 26, 0 },
173 {
"fixup_Mips_HI16", 0, 16, 0 },
174 {
"fixup_Mips_LO16", 0, 16, 0 },
175 {
"fixup_Mips_GPREL16", 0, 16, 0 },
176 {
"fixup_Mips_LITERAL", 0, 16, 0 },
177 {
"fixup_Mips_GOT_Global", 0, 16, 0 },
178 {
"fixup_Mips_GOT_Local", 0, 16, 0 },
180 {
"fixup_Mips_CALL16", 0, 16, 0 },
181 {
"fixup_Mips_GPREL32", 0, 32, 0 },
182 {
"fixup_Mips_SHIFT5", 6, 5, 0 },
183 {
"fixup_Mips_SHIFT6", 6, 5, 0 },
184 {
"fixup_Mips_64", 0, 64, 0 },
185 {
"fixup_Mips_TLSGD", 0, 16, 0 },
186 {
"fixup_Mips_GOTTPREL", 0, 16, 0 },
187 {
"fixup_Mips_TPREL_HI", 0, 16, 0 },
188 {
"fixup_Mips_TPREL_LO", 0, 16, 0 },
189 {
"fixup_Mips_TLSLDM", 0, 16, 0 },
190 {
"fixup_Mips_DTPREL_HI", 0, 16, 0 },
191 {
"fixup_Mips_DTPREL_LO", 0, 16, 0 },
193 {
"fixup_Mips_GPOFF_HI", 0, 16, 0 },
194 {
"fixup_Mips_GPOFF_LO", 0, 16, 0 },
195 {
"fixup_Mips_GOT_PAGE", 0, 16, 0 },
196 {
"fixup_Mips_GOT_OFST", 0, 16, 0 },
197 {
"fixup_Mips_GOT_DISP", 0, 16, 0 },
198 {
"fixup_Mips_HIGHER", 0, 16, 0 },
199 {
"fixup_Mips_HIGHEST", 0, 16, 0 },
200 {
"fixup_Mips_GOT_HI16", 0, 16, 0 },
201 {
"fixup_Mips_GOT_LO16", 0, 16, 0 },
202 {
"fixup_Mips_CALL_HI16", 0, 16, 0 },
203 {
"fixup_Mips_CALL_LO16", 0, 16, 0 },
204 {
"fixup_MICROMIPS_26_S1", 0, 26, 0 },
205 {
"fixup_MICROMIPS_HI16", 0, 16, 0 },
206 {
"fixup_MICROMIPS_LO16", 0, 16, 0 },
207 {
"fixup_MICROMIPS_GOT16", 0, 16, 0 },
209 {
"fixup_MICROMIPS_CALL16", 0, 16, 0 },
210 {
"fixup_MICROMIPS_GOT_DISP", 0, 16, 0 },
211 {
"fixup_MICROMIPS_GOT_PAGE", 0, 16, 0 },
212 {
"fixup_MICROMIPS_GOT_OFST", 0, 16, 0 },
213 {
"fixup_MICROMIPS_TLS_DTPREL_HI16", 0, 16, 0 },
214 {
"fixup_MICROMIPS_TLS_DTPREL_LO16", 0, 16, 0 },
215 {
"fixup_MICROMIPS_TLS_TPREL_HI16", 0, 16, 0 },
216 {
"fixup_MICROMIPS_TLS_TPREL_LO16", 0, 16, 0 }
234 bool mayNeedRelaxation(
const MCInst &Inst)
const {
240 bool fixupNeedsRelaxation(
const MCFixup &Fixup,
245 assert(0 &&
"RelaxInstruction() unimplemented");
255 void relaxInstruction(
const MCInst &Inst,
MCInst &Res)
const {
269 if (Count % 4)
return false;
271 uint64_t NumNops = Count / 4;
272 for (uint64_t i = 0; i != NumNops; ++i)
285 return new MipsAsmBackend(T,
Triple(TT).getOS(),
293 return new MipsAsmBackend(T,
Triple(TT).getOS(),
301 return new MipsAsmBackend(T,
Triple(TT).getOS(),
309 return new MipsAsmBackend(T,
Triple(TT).getOS(),
void Write32(uint32_t Value)
MCAsmBackend * createMipsAsmBackendEB64(const Target &T, const MCRegisterInfo &MRI, StringRef TT, StringRef CPU)
A four-byte gp relative fixup.
MCObjectWriter * createMipsELFObjectWriter(raw_ostream &OS, uint8_t OSABI, bool IsLittleEndian, bool Is64Bit)
uint32_t getOffset() const
MCFixupKind
MCFixupKind - Extensible enumeration to represent the type of a fixup.
MCFixupKind getKind() const
MCAsmBackend * createMipsAsmBackendEB32(const Target &T, const MCRegisterInfo &MRI, StringRef TT, StringRef CPU)
MCAsmBackend * createMipsAsmBackendEL64(const Target &T, const MCRegisterInfo &MRI, StringRef TT, StringRef CPU)
MCAsmBackend * createMipsAsmBackendEL32(const Target &T, const MCRegisterInfo &MRI, StringRef TT, StringRef CPU)
static unsigned adjustFixupValue(unsigned Kind, uint64_t Value)
MCFixupKindInfo - Target independent information on a fixup kind.
LLVM Value Representation.
MCAsmBackend - Generic interface to target specific assembler backends.
const MCRegisterInfo & MRI
virtual const MCFixupKindInfo & getFixupKindInfo(MCFixupKind Kind) const
getFixupKindInfo - Get information on a fixup kind.