41#define DEBUG_TYPE "M68k-asm-backend"
46 bool Allows32BitBranch;
52 .
CasesLower(
"m68020",
"m68030",
"m68040",
true)
92 "Value does not fit in the Fixup field");
95 for (
unsigned i = 0; i !=
Size; ++i)
191bool M68kAsmBackend::fixupNeedsRelaxation(
const MCFixup &
Fixup,
193 int64_t
Value =
static_cast<int64_t
>(UnsignedValue);
195 if (!isInt<32>(
Value) || (!Allows32BitBranch && !isInt<16>(
Value)))
202 bool FixupFieldTooSmall =
false;
203 if (!isInt<8>(
Value) && KindLog2Size == 0)
204 FixupFieldTooSmall =
true;
205 else if (!isInt<16>(
Value) && KindLog2Size <= 1)
206 FixupFieldTooSmall =
true;
212 bool ZeroDisplacementNeedsFixup =
Value == 0 && KindLog2Size == 0;
214 return ZeroDisplacementNeedsFixup || FixupFieldTooSmall;
219void M68kAsmBackend::relaxInstruction(
MCInst &Inst,
233 for (
uint64_t i = 0; i != NumNops; ++i) {
242class M68kELFAsmBackend :
public M68kAsmBackend {
246 : M68kAsmBackend(
T, STI), OSABI(OSABI) {}
248 std::unique_ptr<MCObjectTargetWriter>
249 createObjectTargetWriter()
const override {
262 return new M68kELFAsmBackend(
T, STI, OSABI);
unsigned const MachineRegisterInfo * MRI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static unsigned getRelaxedOpcodeBranch(unsigned Op)
cc—Carry clear GE—Greater than or equal LS—Lower or same PL—Plus CS—Carry set GT—Greater than LT—Less...
static unsigned getRelaxedOpcode(unsigned Opcode)
This file contains small standalone helper functions and enum definitions for the M68k target useful ...
This file contains M68k specific fixup entries.
mir Rename Register Operands
PowerPC TLS Dynamic Call Fixup
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
This class represents an Operation in the Expression.
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(unsigned Opcode, ArrayRef< MCOperand > Operands, const MCSubtargetInfo &STI) const
Check whether the given instruction (encoded as Opcode+Operands) may need relaxation.
virtual bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value) const
Simple predicate for targets where !Resolved implies requiring relaxation.
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)...
Instances of this class represent a single low-level machine instruction.
unsigned getOpcode() const
void setOpcode(unsigned Op)
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
A switch()-like statement whose cases are string literals.
StringSwitch & CasesLower(StringLiteral S0, StringLiteral S1, T Value)
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
OSType getOS() const
Get the parsed operating system type of this triple.
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
static unsigned getFixupKindLog2Size(unsigned Kind)
std::unique_ptr< MCObjectTargetWriter > createM68kELFObjectWriter(uint8_t OSABI)
Construct an M68k ELF object writer.
MCAsmBackend * createM68kAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options)
DWARFExpression::Operation Op
constexpr bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.