41#define DEBUG_TYPE "M68k-asm-backend"
46 bool Allows32BitBranch;
52 .
CasesLower(
"m68020",
"m68030",
"m68040",
true)
63 if (
Fixup.getOffset() +
Size > Data.size()) {
68 "Invalid fixup offset!");
75 if (!(
isIntN(
Size * 8 + 1,
static_cast<int64_t
>(
Value)) || IsResolved)) {
84 "Value does not fit in the Fixup field");
88 for (
unsigned i = 0; i !=
Size; ++i)
89 Data[
Fixup.getOffset() + i] =
207bool M68kAsmBackend::mayNeedRelaxation(
const MCInst &Inst,
227bool M68kAsmBackend::fixupNeedsRelaxation(
const MCFixup &
Fixup,
229 int64_t
Value =
static_cast<int64_t
>(UnsignedValue);
231 if (!isInt<32>(
Value) || (!Allows32BitBranch && !isInt<16>(
Value)))
238 bool FixupFieldTooSmall =
false;
239 if (!isInt<8>(
Value) && KindLog2Size == 0)
240 FixupFieldTooSmall =
true;
241 else if (!isInt<16>(
Value) && KindLog2Size <= 1)
242 FixupFieldTooSmall =
true;
248 bool ZeroDisplacementNeedsFixup =
Value == 0 && KindLog2Size == 0;
250 return ZeroDisplacementNeedsFixup || FixupFieldTooSmall;
255void M68kAsmBackend::relaxInstruction(
MCInst &Inst,
277 for (
uint64_t i = 0; i != NumNops; ++i) {
286class M68kELFAsmBackend :
public M68kAsmBackend {
290 : M68kAsmBackend(
T, STI), OSABI(OSABI) {}
292 std::unique_ptr<MCObjectTargetWriter>
293 createObjectTargetWriter()
const override {
306 return new M68kELFAsmBackend(
T, STI, OSABI);
unsigned const MachineRegisterInfo * MRI
static unsigned getRelaxedOpcodeBranch(const MCInst &Inst)
cc—Carry clear GE—Greater than or equal LS—Lower or same PL—Plus CS—Carry set GT—Greater than LT—Less...
static unsigned getRelaxedOpcodeArith(const MCInst &Inst)
static unsigned getRelaxedOpcode(const MCInst &Inst)
This file contains small standalone helper functions and enum definitions for the M68k target useful ...
This file contains M68k specific fixup entries.
PowerPC TLS Dynamic Call Fixup
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
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(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
Simple predicate for targets where !Resolved implies requiring relaxation.
virtual unsigned getNumFixupKinds() const =0
Get the number of target specific fixup kinds.
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...
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.
void dump_pretty(raw_ostream &OS, const MCInstPrinter *Printer=nullptr, StringRef Separator=" ", const MCRegisterInfo *RegInfo=nullptr) const
Dump the MCInst as prettily as possible using the additional MC structures, if given.
unsigned getNumOperands() const
unsigned getOpcode() const
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...
Generic base class for all target subtargets.
const Triple & getTargetTriple() const
This represents an "assembler immediate".
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
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.
A raw_ostream that writes to an SmallVector or SmallString.
#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)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
DWARFExpression::Operation Op