31#define DEBUG_TYPE "csky-asm-printer"
34#define PRINT_ALIAS_INSTR
35#include "CSKYGenAsmWriter.inc"
43 CLOpts(
CSKY_MC::getCLOpts(
MAI.getTargetOptions())) {}
51 if (Opt ==
"no-aliases") {
55 if (Opt ==
"numeric") {
63 if (Opt ==
"abi-names") {
85 : CSKY::NoRegAltName);
102 unsigned Reg = MO.
getReg();
103 bool useABIName =
false;
105 useABIName = ABIRegNames;
112 if (Reg == CSKY::R23)
113 O << (useABIName ?
"fp" :
"r23");
114 else if (Reg == CSKY::R24)
115 O << (useABIName ?
"top" :
"r24");
116 else if (Reg == CSKY::R25)
117 O << (useABIName ?
"bsp" :
"r25");
127 uint64_t TSFlags =
MII.get(
MI->getOpcode()).TSFlags;
137 assert(MO.
isExpr() &&
"Unknown operand kind in printOperand");
170 assert(MO.
isExpr() &&
"Unknown operand kind in printConstpool");
197 auto V =
MI->getOperand(OpNo).getImm();
222 auto V =
MI->getOperand(OpNum).getImm();
228 auto Offset = (V & 0xf) - 1;
235 if ((V >> 4) & 0x1) {
240 if ((V >> 5) & 0x7) {
244 auto Offset = ((V >> 5) & 0x7) - 1;
252 if ((V >> 8) & 0x1) {
262 : CSKY::ABIRegAltName);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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.
void printRegisterSeq(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printFPRRegName(raw_ostream &O, unsigned RegNo) const
static const char * getRegisterName(const CSKYMCOptions &CLOpts, MCRegister Reg)
void printDataSymbol(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
bool applyTargetSpecificCLOption(StringRef Opt) override
Customize the printer according to a command line option.
void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printPSRFlag(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printCSKYSymbolOperand(const MCInst *MI, uint64_t Address, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printFPR(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printConstpool(const MCInst *MI, uint64_t Address, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
bool printAliasInstr(const MCInst *MI, uint64_t Address, const MCSubtargetInfo &STI, raw_ostream &O)
void printRegisterList(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printInstruction(const MCInst *MI, uint64_t Address, const MCSubtargetInfo &STI, raw_ostream &O)
void printRegName(raw_ostream &O, MCRegister Reg) override
Print the assembler register name.
CSKYInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
A helper class to return the specified delimiter string after the first invocation of operator String...
This class is intended to be used as a base class for asm properties and features specific to the tar...
format_object< int64_t > formatHex(int64_t Value) const
const MCRegisterInfo & MRI
void printAnnotation(raw_ostream &OS, StringRef Annot)
Utility function for printing annotations.
bool PrintBranchImmAsAddress
If true, a branch immediate (e.g.
MCInstPrinter(const MCAsmInfo &mai, const MCInstrInfo &mii, const MCRegisterInfo &mri)
bool PrintAliases
True if we prefer aliases (e.g. nop) to raw mnemonics.
Instances of this class represent a single low-level machine instruction.
Interface to description of machine instruction set.
Instances of this class represent operands of the MCInst class.
MCRegister getReg() const
Returns the register number.
const MCExpr * getExpr() const
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.
bool hasFeature(unsigned Feature) const
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.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI bool DebugFlag
This boolean is set to true if the '-debug' command line option is specified.