25#define DEBUG_TYPE "asm-printer"
30#define PRINT_ALIAS_INSTR
31#include "AVRGenAsmWriter.inc"
36 unsigned Opcode =
MI->getOpcode();
46 printOperand(
MI, 0, O);
49 if (Opcode == AVR::LDRdPtrPd)
52 printOperand(
MI, 1, O);
54 if (Opcode == AVR::LDRdPtrPi)
59 printOperand(
MI, 0, O);
61 printOperand(
MI, 1, O);
67 if (Opcode == AVR::STPtrPdRr)
70 printOperand(
MI, 1, O);
72 if (Opcode == AVR::STPtrPiRr)
76 printOperand(
MI, 2, O);
91 if (
MRI.getNumSubRegIndices() > 0) {
93 Reg = (RegLo != AVR::NoRegister) ? RegLo :
Reg;
96 return getRegisterName(
Reg);
99void AVRInstPrinter::printOperand(
const MCInst *
MI,
unsigned OpNo,
105 bool isPtrReg = (MOI.
RegClass == AVR::PTRREGSRegClassID) ||
106 (MOI.
RegClass == AVR::PTRDISPREGSRegClassID) ||
107 (MOI.
RegClass == AVR::ZREGRegClassID);
114 }
else if (
Op.isImm()) {
117 assert(
Op.isExpr() &&
"Unknown operand kind in printOperand");
118 MAI.printExpr(O, *
Op.getExpr());
124void AVRInstPrinter::printPCRelImm(
const MCInst *
MI,
unsigned OpNo,
126 if (OpNo >=
MI->size()) {
136 const MCOperand &
Op =
MI->getOperand(OpNo);
139 int64_t
Imm =
Op.getImm();
149 assert(
Op.isExpr() &&
"Unknown pcrel immediate operand");
150 MAI.printExpr(O, *
Op.getExpr());
154void AVRInstPrinter::printMemri(
const MCInst *
MI,
unsigned OpNo,
156 assert(
MI->getOperand(OpNo).isReg() &&
157 "Expected a register for the first operand");
159 const MCOperand &
OffsetOp =
MI->getOperand(OpNo + 1);
162 printOperand(
MI, OpNo, O);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
std::pair< Instruction::BinaryOps, Value * > OffsetOp
Find all possible pairs (BinOp, RHS) that BinOp V, RHS can be simplified.
static std::string getRegisterName(const TargetRegisterInfo *TRI, Register Reg)
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.
Instances of this class represent operands of the MCInst class.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Wrapper class representing physical registers. Should be passed by value.
Generic base class for all target subtargets.
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