32#define DEBUG_TYPE "csky-asm-printer"
35#define PRINT_ALIAS_INSTR
36#include "CSKYGenAsmWriter.inc"
40 cl::desc(
"Disable the emission of assembler pseudo instructions"),
45 cl::desc(
"Print architectural register names rather than the "
46 "ABI names (such as r14 instead of sp)"),
55 if (Opt ==
"no-aliases") {
59 if (Opt ==
"numeric") {
67 if (Opt ==
"abi-names") {
88 : CSKY::NoRegAltName);
105 unsigned Reg = MO.
getReg();
106 bool useABIName =
false;
108 useABIName = ABIRegNames;
115 if (Reg == CSKY::R23)
116 O << (useABIName ?
"fp" :
"r23");
117 else if (Reg == CSKY::R24)
118 O << (useABIName ?
"top" :
"r24");
119 else if (Reg == CSKY::R25)
120 O << (useABIName ?
"bsp" :
"r25");
140 assert(MO.
isExpr() &&
"Unknown operand kind in printOperand");
173 assert(MO.
isExpr() &&
"Unknown operand kind in printConstpool");
200 auto V =
MI->getOperand(OpNo).getImm();
225 auto V =
MI->getOperand(OpNum).getImm();
231 auto Offset = (V & 0xf) - 1;
238 if ((V >> 4) & 0x1) {
243 if ((V >> 5) & 0x7) {
247 auto Offset = ((V >> 5) & 0x7) - 1;
255 if ((V >> 8) & 0x1) {
263 : CSKY::ABIRegAltName);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static cl::opt< bool > NoAliases("csky-no-aliases", cl::desc("Disable the emission of assembler pseudo instructions"), cl::init(false), cl::Hidden)
static cl::opt< bool > ArchRegNames("csky-arch-reg-names", cl::desc("Print architectural register names rather than the " "ABI names (such as r14 instead of sp)"), cl::init(false), cl::Hidden)
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(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.
A helper class to return the specified delimiter string after the first invocation of operator String...
format_object< int64_t > formatHex(int64_t Value) const
void printAnnotation(raw_ostream &OS, StringRef Annot)
Utility function for printing annotations.
bool PrintBranchImmAsAddress
If true, a branch immediate (e.g.
Instances of this class represent a single low-level machine instruction.
Instances of this class represent operands of the MCInst class.
MCRegister getReg() const
Returns the register number.
const MCExpr * getExpr() const
Wrapper class representing physical registers. Should be passed by value.
Generic base class for all target subtargets.
bool hasFeature(unsigned Feature) const
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.
initializer< Ty > init(const Ty &Val)
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.