22#define DEBUG_TYPE "loongarch-asm-printer"
25#define PRINT_ALIAS_INSTR
26#include "LoongArchGenAsmWriter.inc"
30 cl::desc(
"Disable the emission of assembler pseudo instructions"),
35 cl::desc(
"Print numeric register names rather than the ABI "
36 "names (such as $r0 instead of $zero)"),
41 cl::desc(
"Print human-readable annotations for some instructions "
42 "(such as the barrier semantics of dbar hints)"),
51 if (Opt ==
"no-aliases") {
56 if (Opt ==
"numeric") {
61 if (Opt ==
"annotate") {
82 if (Hint > 0x1f || (Hint & 0xf) == 0xf)
114void LoongArchInstPrinter::printOperand(
const MCInst *
MI,
unsigned OpNo,
129 assert(MO.
isExpr() &&
"Unknown operand kind in printOperand");
137 assert(MO.
isReg() &&
"printAtomicMemOp can only print register operands");
152 uint64_t
Address,
unsigned OpNo,
159 return printOperand(
MI, OpNo, STI, O);
165 : LoongArch::RegAliasName);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static cl::opt< bool > NumericReg("loongarch-numeric-reg", cl::desc("Print numeric register names rather than the ABI " "names (such as $r0 instead of $zero)"), cl::init(false), cl::Hidden)
static cl::opt< bool > NoAliases("loongarch-no-aliases", cl::desc("Disable the emission of assembler pseudo instructions"), cl::init(false), cl::Hidden)
static void printDbarAnnotation(uint64_t Hint, raw_ostream &OS)
static cl::opt< bool > Annotate("loongarch-annotate", cl::desc("Print human-readable annotations for some instructions " "(such as the barrier semantics of dbar hints)"), cl::init(false), cl::Hidden)
void printBranchOperand(const MCInst *MI, uint64_t Address, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
void printInstruction(const MCInst *MI, uint64_t Address, const MCSubtargetInfo &STI, raw_ostream &O)
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 printCFRSetDest(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.
bool printAliasInstr(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.
static const char * getRegisterName(MCRegister Reg)
void printAtomicMemOp(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
WithMarkup markup(raw_ostream &OS, Markup M)
raw_ostream * CommentStream
A stream that comments can be emitted to if desired.
bool SymbolizeOperands
If true, symbolize branch target and memory reference operands.
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.
bool PrintAliases
True if we prefer aliases (e.g. nop) to raw mnemonics.
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.
Represent a constant reference to a string, i.e.
StringRef rtrim(char Char) const
Return string with consecutive Char characters starting from the right removed.
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.