27#define DEBUG_TYPE "asm-printer"
32#define PRINT_ALIAS_INSTR
33#include "AVRGenAsmWriter.inc"
38 unsigned Opcode =
MI->getOpcode();
48 printOperand(
MI, 0, O);
51 if (Opcode == AVR::LDRdPtrPd)
54 printOperand(
MI, 1, O);
56 if (Opcode == AVR::LDRdPtrPi)
61 printOperand(
MI, 0, O);
63 printOperand(
MI, 1, O);
69 if (Opcode == AVR::STPtrPdRr)
72 printOperand(
MI, 1, O);
74 if (Opcode == AVR::STPtrPiRr)
78 printOperand(
MI, 2, O);
93 if (
MRI.getNumSubRegIndices() > 0) {
95 Reg = (RegLo != AVR::NoRegister) ? RegLo :
Reg;
98 return getRegisterName(
Reg);
101void AVRInstPrinter::printOperand(
const MCInst *
MI,
unsigned OpNo,
107 bool isPtrReg = (MOI.
RegClass == AVR::PTRREGSRegClassID) ||
108 (MOI.
RegClass == AVR::PTRDISPREGSRegClassID) ||
109 (MOI.
RegClass == AVR::ZREGRegClassID);
116 }
else if (
Op.isImm()) {
119 assert(
Op.isExpr() &&
"Unknown operand kind in printOperand");
120 MAI.printExpr(O, *
Op.getExpr());
126void AVRInstPrinter::printPCRelImm(
const MCInst *
MI,
unsigned OpNo,
128 if (OpNo >=
MI->size()) {
138 const MCOperand &
Op =
MI->getOperand(OpNo);
141 int64_t
Imm =
Op.getImm();
151 assert(
Op.isExpr() &&
"Unknown pcrel immediate operand");
152 MAI.printExpr(O, *
Op.getExpr());
156void AVRInstPrinter::printMemri(
const MCInst *
MI,
unsigned OpNo,
158 assert(
MI->getOperand(OpNo).isReg() &&
159 "Expected a register for the first operand");
161 const MCOperand &
OffsetOp =
MI->getOperand(OpNo + 1);
164 printOperand(
MI, OpNo, O);
unsigned const MachineRegisterInfo * MRI
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.
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