26#define DEBUG_TYPE "asm-printer"
31#define PRINT_ALIAS_INSTR
32#include "AVRGenAsmWriter.inc"
37 unsigned Opcode =
MI->getOpcode();
47 printOperand(
MI, 0, O);
50 if (Opcode == AVR::LDRdPtrPd)
53 printOperand(
MI, 1, O);
55 if (Opcode == AVR::LDRdPtrPi)
60 printOperand(
MI, 0, O);
62 printOperand(
MI, 1, O);
68 if (Opcode == AVR::STPtrPdRr)
71 printOperand(
MI, 1, O);
73 if (Opcode == AVR::STPtrPiRr)
77 printOperand(
MI, 2, O);
94 Reg = (RegLo != AVR::NoRegister) ? RegLo :
Reg;
97 return getRegisterName(
Reg);
100void AVRInstPrinter::printOperand(
const MCInst *
MI,
unsigned OpNo,
103 if (MOI.
RegClass == AVR::ZREGRegClassID) {
110 if (OpNo >=
MI->size()) {
120 const MCOperand &
Op =
MI->getOperand(OpNo);
123 bool isPtrReg = (MOI.
RegClass == AVR::PTRREGSRegClassID) ||
124 (MOI.
RegClass == AVR::PTRDISPREGSRegClassID) ||
125 (MOI.
RegClass == AVR::ZREGRegClassID);
128 O << getRegisterName(
Op.getReg(), AVR::ptr);
132 }
else if (
Op.isImm()) {
135 assert(
Op.isExpr() &&
"Unknown operand kind in printOperand");
142void AVRInstPrinter::printPCRelImm(
const MCInst *
MI,
unsigned OpNo,
144 if (OpNo >=
MI->size()) {
154 const MCOperand &
Op =
MI->getOperand(OpNo);
157 int64_t
Imm =
Op.getImm();
167 assert(
Op.isExpr() &&
"Unknown pcrel immediate operand");
172void AVRInstPrinter::printMemri(
const MCInst *
MI,
unsigned OpNo,
174 assert(
MI->getOperand(OpNo).isReg() &&
175 "Expected a register for the first operand");
177 const MCOperand &OffsetOp =
MI->getOperand(OpNo + 1);
180 printOperand(
MI, OpNo, O);
183 if (OffsetOp.isImm()) {
184 int64_t
Offset = OffsetOp.getImm();
190 }
else if (OffsetOp.isExpr()) {
191 O << *OffsetOp.getExpr();
unsigned const MachineRegisterInfo * MRI
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void printInst(const MCInst *MI, uint64_t Address, StringRef Annot, const MCSubtargetInfo &STI, raw_ostream &O) override
Print the specified MCInst to the specified raw_ostream.
static const char * getPrettyRegisterName(MCRegister Reg, MCRegisterInfo const &MRI)
const MCRegisterInfo & MRI
void printAnnotation(raw_ostream &OS, StringRef Annot)
Utility function for printing annotations.
format_object< int64_t > formatImm(int64_t Value) const
Utility function to print immediates in decimal or hex.
Instances of this class represent a single low-level machine instruction.
unsigned getOpcode() const
ArrayRef< MCOperandInfo > operands() const
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode.
This holds information about one operand of a machine instruction, indicating the register class for ...
int16_t RegClass
This specifies the register class enumeration of the operand if the operand is a register.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
unsigned getNumSubRegIndices() const
Return the number of sub-register indices understood by the target.
MCRegister getSubReg(MCRegister Reg, unsigned Idx) const
Returns the physical register number of sub-register "Index" for physical register RegNo.
Wrapper class representing physical registers. Should be passed by value.
Generic base class for all target subtargets.
StringRef - Represent a constant reference to a string, i.e.
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.
DWARFExpression::Operation Op