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);
102 const char *Modifier) {
103 assert((Modifier == 0 || Modifier[0] == 0) &&
"No modifiers supported");
107 unsigned Reg = MO.
getReg();
108 bool useABIName =
false;
110 useABIName = ABIRegNames;
117 if (Reg == CSKY::R23)
118 O << (useABIName ?
"fp" :
"r23");
119 else if (Reg == CSKY::R24)
120 O << (useABIName ?
"top" :
"r24");
121 else if (Reg == CSKY::R25)
122 O << (useABIName ?
"bsp" :
"r25");
142 assert(MO.
isExpr() &&
"Unknown operand kind in printOperand");
175 assert(MO.
isExpr() &&
"Unknown operand kind in printConstpool");
202 auto V =
MI->getOperand(OpNo).getImm();
227 auto V =
MI->getOperand(OpNum).getImm();
233 auto Offset = (V & 0xf) - 1;
240 if ((V >> 4) & 0x1) {
245 if ((V >> 5) & 0x7) {
249 auto Offset = ((V >> 5) & 0x7) - 1;
257 if ((V >> 8) & 0x1) {
265 : CSKY::ABIRegAltName);
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)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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 printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O, const char *Modifier=nullptr)
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 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.
void print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens=false) const
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.
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode.
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.
Target - Wrapper for Target specific information.
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.
bool DebugFlag
This boolean is set to true if the '-debug' command line option is specified.