33 #define DEBUG_TYPE "avr-asm-printer" 41 std::unique_ptr<MCStreamer> Streamer)
42 :
AsmPrinter(TM,
std::move(Streamer)), MRI(*TM.getMCRegisterInfo()) { }
47 const char *Modifier = 0);
50 unsigned AsmVariant,
const char *ExtraCode,
54 unsigned AsmVariant,
const char *ExtraCode,
89 unsigned AsmVariant,
const char *ExtraCode,
95 if (Error && ExtraCode && ExtraCode[0]) {
96 if (ExtraCode[1] != 0)
99 if (ExtraCode[0] >=
'A' && ExtraCode[0] <=
'Z') {
102 assert(RegOp.
isReg() &&
"Operand must be a register when you're" 103 "using 'A'..'Z' operand extracodes.");
106 unsigned ByteNumber = ExtraCode[0] -
'A';
116 unsigned BytesPerReg = TRI.getRegSizeInBits(*RC) / 8;
117 assert(BytesPerReg <= 2 &&
"Only 8 and 16 bit regs are supported.");
119 unsigned RegIdx = ByteNumber / BytesPerReg;
120 assert(RegIdx < NumOpRegs &&
"Multibyte index out of range.");
124 if (BytesPerReg == 2) {
125 Reg = TRI.getSubReg(Reg, ByteNumber % BytesPerReg ? AVR::sub_hi
141 unsigned OpNum,
unsigned AsmVariant,
142 const char *ExtraCode,
144 if (ExtraCode && ExtraCode[0]) {
150 assert(MO.
isReg() &&
"Unexpected inline asm memory operand");
160 "Wrong register class for memory operand.");
169 if (NumOpRegs == 2) {
void EmitInstruction(const MachineInstr *MI) override
Targets should implement this to emit instructions.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
MachineBasicBlock * getMBB() const
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
MCSymbol * GetExternalSymbolSymbol(StringRef Sym) const
Return the MCSymbol for the specified ExternalSymbol.
This class represents lattice values for constants.
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum, unsigned AsmVariant, const char *ExtraCode, raw_ostream &O) override
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant as...
void lowerInstruction(const MachineInstr &MI, MCInst &OutMI) const
Lowers a MachineInstr into a MCInst.
MCContext & OutContext
This is the context for the output file that we are streaming.
unsigned getReg() const
getReg - Returns the register number.
MachineBasicBlock reference.
unsigned const TargetRegisterInfo * TRI
MachineFunction * MF
The current machine function.
Target & getTheAVRTarget()
Name of external global symbol.
const char * getSymbolName() const
Instances of this class represent a single low-level machine instruction.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
void printOperand(const MachineInstr *MI, unsigned OpNo, raw_ostream &O, const char *Modifier=0)
void LLVMInitializeAVRAsmPrinter()
Address of a global value.
Lowers MachineInstr objects into MCInst objects.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
const GlobalValue * getGlobal() const
virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode, raw_ostream &OS)
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant...
AVRAsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer)
TargetMachine & TM
Target machine description.
This class is intended to be used as a driving class for all asm writers.
static unsigned getNumOperandRegisters(unsigned Flag)
getNumOperandRegisters - Extract the number of registers field from the inline asm operand flag...
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
MCSymbol * getSymbol(const GlobalValue *GV) const
MachineOperand class - Representation of each machine instruction operand.
void EmitToStreamer(MCStreamer &S, const MCInst &Inst)
An AVR assembly code printer.
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNum, unsigned AsmVariant, const char *ExtraCode, raw_ostream &O) override
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant...
A specific AVR target MCU.
Representation of each machine instruction.
MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
static const char * getPrettyRegisterName(unsigned RegNo, MCRegisterInfo const &MRI)
bool isReg() const
isReg - Tests if this is a MO_Register operand.
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Lightweight error class with error context and mandatory checking.
const AVRRegisterInfo * getRegisterInfo() const override
This class implements an extremely fast bulk output stream that can only output to a stream...
Primary interface to the complete machine description for the target machine.
StringRef - Represent a constant reference to a string, i.e.
const MachineOperand & getOperand(unsigned i) const
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.