32 #define DEBUG_TYPE "mccodeemitter" 42 mutable unsigned Offset;
46 uint64_t getBinaryCodeForInstr(
const MCInst &
MI,
58 unsigned getMemOpValue(
const MCInst &MI,
unsigned Op,
62 unsigned getPCRelImmOpValue(
const MCInst &MI,
unsigned Op,
66 unsigned getCGImmOpValue(
const MCInst &MI,
unsigned Op,
70 unsigned getCCOpValue(
const MCInst &MI,
unsigned Op,
76 : Ctx(ctx), MCII(MCII) {}
93 uint64_t BinaryOpCode = getBinaryCodeForInstr(MI, Fixups, STI);
94 size_t WordCount = Size / 2;
102 unsigned MSP430MCCodeEmitter::getMachineOpValue(
const MCInst &
MI,
121 unsigned MSP430MCCodeEmitter::getMemOpValue(
const MCInst &MI,
unsigned Op,
125 assert(MO1.
isReg() &&
"Register operand expected");
131 return ((
unsigned)MO2.
getImm() << 4) | Reg;
153 unsigned MSP430MCCodeEmitter::getPCRelImmOpValue(
const MCInst &MI,
unsigned Op,
166 unsigned MSP430MCCodeEmitter::getCGImmOpValue(
const MCInst &MI,
unsigned Op,
172 int64_t Imm = MO.
getImm();
181 case -1:
return 0x33;
185 unsigned MSP430MCCodeEmitter::getCCOpValue(
const MCInst &MI,
unsigned Op,
189 assert(MO.
isImm() &&
"Immediate operand expected");
209 #include "MSP430GenMCCodeEmitter.inc"
This class represents lattice values for constants.
void push_back(const T &Elt)
Describe properties that are true of each instruction in the target description file.
void encodeInstruction(const MCInst &MI, raw_ostream &OS, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const override
EncodeInstruction - Encode the given Inst to bytes on the output stream OS.
MCCodeEmitter * createMSP430MCCodeEmitter(const MCInstrInfo &MCII, const MCRegisterInfo &MRI, MCContext &Ctx)
Creates a machine code emitter for MSP430.
static Lanai::Fixups FixupKind(const MCExpr *Expr)
MSP430MCCodeEmitter(MCContext &ctx, MCInstrInfo const &MCII)
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
unsigned getReg() const
Returns the register number.
Context object for machine code objects.
const MCExpr * getExpr() const
Instances of this class represent a single low-level machine instruction.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
void write(void *memory, value_type value, endianness endian)
Write a value to memory with a particular endianness.
unsigned const MachineRegisterInfo * MRI
MCCodeEmitter - Generic instruction encoding interface.
Interface to description of machine instruction set.
MCFixupKind
Extensible enumeration to represent the type of a fixup.
This file declares a class to represent arbitrary precision floating point values and provide a varie...
static MCFixup create(uint32_t Offset, const MCExpr *Value, MCFixupKind Kind, SMLoc Loc=SMLoc())
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
const MCOperand & getOperand(unsigned i) const
uint16_t getEncodingValue(unsigned RegNo) const
Returns the encoding for RegNo.
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
Generic base class for all target subtargets.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const MCRegisterInfo * getRegisterInfo() const
This class implements an extremely fast bulk output stream that can only output to a stream...
unsigned getOpcode() const
Instances of this class represent operands of the MCInst class.
unsigned getSize() const
Return the number of bytes in the encoding of this instruction, or zero if the encoding size cannot b...