37 :
MRI(mri), MCII(mcii) {}
38 R600MCCodeEmitter(
const R600MCCodeEmitter &) =
delete;
39 R600MCCodeEmitter &
operator=(
const R600MCCodeEmitter &) =
delete;
55 unsigned getHWReg(
unsigned regNo)
const;
86void R600MCCodeEmitter::encodeInstruction(
const MCInst &
MI,
91 if (
MI.getOpcode() == R600::RETURN ||
92 MI.getOpcode() == R600::FETCH_CLAUSE ||
93 MI.getOpcode() == R600::ALU_CLAUSE ||
94 MI.getOpcode() == R600::BUNDLE ||
95 MI.getOpcode() == R600::KILL) {
99 uint64_t InstWord01 = getBinaryCodeForInstr(
MI, Fixups, STI);
100 uint32_t InstWord2 =
MI.getOperand(2).getImm();
101 if (!(STI.
hasFeature(R600::FeatureCaymanISA))) {
102 InstWord2 |= 1 << 19;
105 emit(InstWord01, CB);
109 int64_t
Sampler =
MI.getOperand(14).getImm();
111 int64_t SrcSelect[4] = {
112 MI.getOperand(2).getImm(),
MI.getOperand(3).getImm(),
113 MI.getOperand(4).getImm(),
MI.getOperand(5).getImm()};
114 int64_t
Offsets[3] = {
MI.getOperand(6).getImm() & 0x1F,
115 MI.getOperand(7).getImm() & 0x1F,
116 MI.getOperand(8).getImm() & 0x1F};
118 uint64_t Word01 = getBinaryCodeForInstr(
MI, Fixups, STI);
128 uint64_t Inst = getBinaryCodeForInstr(
MI, Fixups, STI);
129 if ((STI.
hasFeature(R600::FeatureR600ALUInst)) &&
132 uint64_t ISAOpCode = Inst & (0x3FFULL << 39);
133 Inst &= ~(0x3FFULL << 39);
134 Inst |= ISAOpCode << 1;
148unsigned R600MCCodeEmitter::getHWReg(
unsigned RegNo)
const {
158 return MRI.getEncodingValue(MO.
getReg());
169 const unsigned offset = (&MO == &
MI.getOperand(0)) ? 0 : 4;
178#include "R600GenMCCodeEmitter.inc"
unsigned const MachineRegisterInfo * MRI
Given that RA is a live value
static unsigned getHWReg(const SIInstrInfo *TII, const MachineInstr &RegInstr)
#define HAS_NATIVE_OPERANDS(Flags)
#define HW_REG_MASK
Defines for extracting register information from register encoding.
Provides R600 specific target descriptions.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MCCodeEmitter - Generic instruction encoding interface.
virtual void encodeInstruction(const MCInst &Inst, SmallVectorImpl< char > &CB, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI) const =0
Encode the given Inst to bytes and append to CB.
MCCodeEmitter & operator=(const MCCodeEmitter &)=delete
Context object for machine code objects.
const MCRegisterInfo * getRegisterInfo() const
static MCFixup create(uint32_t Offset, const MCExpr *Value, MCFixupKind Kind, SMLoc Loc=SMLoc())
Instances of this class represent a single low-level machine instruction.
Describe properties that are true of each instruction in the target description file.
Interface to description of machine instruction set.
Instances of this class represent operands of the MCInst class.
unsigned getReg() const
Returns the register number.
const MCExpr * getExpr() const
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Generic base class for all target subtargets.
bool hasFeature(unsigned Feature) const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
LLVM Value Representation.
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.
MCCodeEmitter * createR600MCCodeEmitter(const MCInstrInfo &MCII, MCContext &Ctx)
@ FK_SecRel_4
A four-byte section relative fixup.
Description of the encoding of one expression Op.