54 SIMCCodeEmitter(
const SIMCCodeEmitter &) =
delete;
55 SIMCCodeEmitter &operator=(
const SIMCCodeEmitter &) =
delete;
69 unsigned getSOPPBrEncoding(
const MCInst &
MI,
unsigned OpNo,
73 unsigned getSDWASrcEncoding(
const MCInst &
MI,
unsigned OpNo,
77 unsigned getSDWAVopcDstEncoding(
const MCInst &
MI,
unsigned OpNo,
87 return new SIMCCodeEmitter(MCII, MRI, Ctx);
92 template <
typename IntTy>
94 if (Imm >= 0 && Imm <= 64)
97 if (Imm >= -16 && Imm <= -1)
168 if (Val == 0x3e22f983 &&
204 if (Val == 0x3fc45f306dc9c882 &&
254 uint16_t Lo16 =
static_cast<uint16_t
>(Imm);
266 verifyInstructionPredicates(MI,
269 uint64_t Encoding = getBinaryCodeForInstr(MI, Fixups, STI);
271 unsigned bytes = Desc.
getSize();
273 for (
unsigned i = 0; i < bytes; i++) {
274 OS.
write((uint8_t) ((Encoding >> (8 * i)) & 0xff));
289 if (getLitEncoding(Op, Desc.
OpInfo[i], STI) != 255)
298 if (
const auto *
C = dyn_cast<MCConstantExpr>(Op.
getExpr()))
304 for (
unsigned j = 0; j < 4; j++) {
305 OS.
write((uint8_t) ((Imm >> (8 * j)) & 0xff));
313 unsigned SIMCCodeEmitter::getSOPPBrEncoding(
const MCInst &MI,
unsigned OpNo,
325 return getMachineOpValue(MI, MO, Fixups, STI);
329 SIMCCodeEmitter::getSDWASrcEncoding(
const MCInst &MI,
unsigned OpNo,
339 RegEnc |=
MRI.getEncodingValue(
Reg);
348 SIMCCodeEmitter::getSDWAVopcDstEncoding(
const MCInst &MI,
unsigned OpNo,
358 if (
Reg != AMDGPU::VCC) {
359 RegEnc |=
MRI.getEncodingValue(
Reg);
371 auto *BE = cast<MCBinaryExpr>(Expr);
377 return needsPCRel(cast<MCUnaryExpr>(Expr)->getSubExpr());
385 uint64_t SIMCCodeEmitter::getMachineOpValue(
const MCInst &MI,
390 return MRI.getEncodingValue(MO.
getReg());
421 if (Enc != ~0U && (Enc != 255 || Desc.
getSize() == 4))
424 }
else if (MO.
isImm())
void push_back(const T &Elt)
unsigned mc2PseudoReg(unsigned Reg)
Convert hardware register Reg to a pseudo register.
MCCodeEmitter * createSIMCCodeEmitter(const MCInstrInfo &MCII, const MCRegisterInfo &MRI, MCContext &Ctx)
Describe properties that are true of each instruction in the target description file.
MachineInstrBuilder MachineInstrBuilder &DefMI const MCInstrDesc & Desc
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Base class for the full range of assembler expressions which are needed for parsing.
Reg
All possible values of the reg field in the ModR/M byte.
Context object for machine code objects.
uint8_t OperandType
Information about the type of the operand.
unsigned getReg() const
Returns the register number.
static uint32_t getLit64Encoding(uint64_t Val, const MCSubtargetInfo &STI)
Instances of this class represent a single low-level machine instruction.
uint32_t FloatToBits(float Float)
This function takes a float and returns the bit equivalent 32-bit integer.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
const MCExpr * getExpr() const
unsigned const MachineRegisterInfo * MRI
static uint32_t getLit32Encoding(uint32_t Val, const MCSubtargetInfo &STI)
MCCodeEmitter - Generic instruction encoding interface.
unsigned getSize() const
Return the number of bytes in the encoding of this instruction, or zero if the encoding size cannot b...
Interface to description of machine instruction set.
MCFixupKind
Extensible enumeration to represent the type of a fixup.
static uint32_t getIntInlineImmEncoding(IntTy Imm)
static bool needsPCRel(const MCExpr *Expr)
static MCFixup create(uint32_t Offset, const MCExpr *Value, MCFixupKind Kind, SMLoc Loc=SMLoc())
Operands with register or inline constant.
raw_ostream & write(unsigned char C)
static uint32_t getLit16Encoding(uint16_t Val, const MCSubtargetInfo &STI)
A four-byte pc relative fixup.
const FeatureBitset & getFeatureBits() const
getFeatureBits - Return the feature bits.
uint64_t DoubleToBits(double Double)
This function takes a double and returns the bit equivalent 64-bit integer.
unsigned getOpcode() const
llvm_unreachable("Unknown RegBank!")
Provides AMDGPU specific target descriptions.
unsigned getNumOperands() const
16-bit PC relative fixup for SOPP branch instructions.
APFloat abs(APFloat X)
Returns the absolute value of the argument.
MCSubtargetInfo - Generic base class for all target subtargets.
CodeEmitter interface for R600 and SI codegen.
References to labels and assigned expressions.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Operands with register or 32-bit immediate.
bool isSISrcOperand(const MCInstrDesc &Desc, unsigned OpNo)
Can this operand also contain immediate values?
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const MCOperandInfo * OpInfo
This class implements an extremely fast bulk output stream that can only output to a stream...
Target specific expression.
bool isSGPR(unsigned Reg, const MCRegisterInfo *TRI)
Is Reg - scalar register.
This holds information about one operand of a machine instruction, indicating the register class for ...
Instances of this class represent operands of the MCInst class.
const MCOperand & getOperand(unsigned i) const