22#define DEBUG_TYPE "asm-printer"
32#define GET_INSTRUCTION_NAME
33#define PRINT_ALIAS_INSTR
34#include "SparcGenAsmWriter.inc"
37 return (STI.
hasFeature(Sparc::FeatureV9)) != 0;
45 unsigned AltIdx)
const {
61 switch (
MI->getOpcode()) {
62 default:
return false;
65 if (
MI->getNumOperands() != 3)
67 if (!
MI->getOperand(0).isReg())
69 switch (
MI->getOperand(0).getReg()) {
70 default:
return false;
72 if (
MI->getOperand(2).isImm() &&
73 MI->getOperand(2).getImm() == 8) {
74 switch(
MI->getOperand(1).getReg()) {
76 case SP::I7: O <<
"\tret";
return true;
77 case SP::O7: O <<
"\tretl";
return true;
87 case SP::V9FCMPS:
case SP::V9FCMPD:
case SP::V9FCMPQ:
88 case SP::V9FCMPES:
case SP::V9FCMPED:
case SP::V9FCMPEQ: {
90 || (
MI->getNumOperands() != 3)
91 || (!
MI->getOperand(0).isReg())
92 || (
MI->getOperand(0).getReg() != SP::FCC0))
95 switch(
MI->getOpcode()) {
97 case SP::V9FCMPS: O <<
"\tfcmps ";
break;
98 case SP::V9FCMPD: O <<
"\tfcmpd ";
break;
99 case SP::V9FCMPQ: O <<
"\tfcmpq ";
break;
100 case SP::V9FCMPES: O <<
"\tfcmpes ";
break;
101 case SP::V9FCMPED: O <<
"\tfcmped ";
break;
102 case SP::V9FCMPEQ: O <<
"\tfcmpeq ";
break;
118 unsigned Reg = MO.
getReg();
127 switch (
MI->getOpcode()) {
139 O << ((int) MO.
getImm() & 0x7f);
144 assert(MO.
isExpr() &&
"Unknown operand kind in printOperand");
154 bool PrintedFirstOperand =
false;
157 PrintedFirstOperand =
true;
162 const bool SkipSecondOperand =
163 PrintedFirstOperand && ((Op2.
isReg() && Op2.
getReg() == SP::G0) ||
166 if (!SkipSecondOperand) {
167 if (PrintedFirstOperand)
176 int CC = (int)
MI->getOperand(opNum).getImm();
177 switch (
MI->getOpcode()) {
187 case SP::MOVFCCrr:
case SP::V9MOVFCCrr:
188 case SP::MOVFCCri:
case SP::V9MOVFCCri:
189 case SP::FMOVS_FCC:
case SP::V9FMOVS_FCC:
190 case SP::FMOVD_FCC:
case SP::V9FMOVD_FCC:
191 case SP::FMOVQ_FCC:
case SP::V9FMOVQ_FCC:
226 static const char *
const TagNames[] = {
227 "#LoadLoad",
"#StoreLoad",
"#LoadStore",
"#StoreStore",
228 "#Lookaside",
"#MemIssue",
"#Sync"};
230 unsigned Imm =
MI->getOperand(opNum).getImm();
238 for (
unsigned i = 0; i < std::size(TagNames); i++) {
239 if (Imm & (1 << i)) {
240 O << (
First ?
"" :
" | ") << TagNames[i];
248 unsigned Imm =
MI->getOperand(opNum).getImm();
249 auto ASITag = SparcASITag::lookupASITagByEncoding(Imm);
250 if (
isV9(STI) && ASITag)
251 O <<
'#' << ASITag->Name;
259 unsigned Imm =
MI->getOperand(opNum).getImm();
260 auto PrefetchTag = SparcPrefetchTag::lookupPrefetchTagByEncoding(Imm);
262 O <<
'#' << PrefetchTag->Name;
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens=false) const
void printAnnotation(raw_ostream &OS, StringRef Annot)
Utility function for printing annotations.
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
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.
bool printAliasInstr(const MCInst *MI, uint64_t Address, const MCSubtargetInfo &STI, raw_ostream &O)
void printOperand(const MCInst *MI, int opNum, const MCSubtargetInfo &STI, raw_ostream &OS)
void printASITag(const MCInst *MI, int opNum, const MCSubtargetInfo &STI, raw_ostream &O)
bool isV9(const MCSubtargetInfo &STI) const
void printMemOperand(const MCInst *MI, int opNum, const MCSubtargetInfo &STI, raw_ostream &OS)
static const char * getRegisterName(MCRegister Reg, unsigned AltIdx=SP::NoRegAltName)
bool printSparcAliasInstr(const MCInst *MI, const MCSubtargetInfo &STI, raw_ostream &OS)
void printCCOperand(const MCInst *MI, int opNum, const MCSubtargetInfo &STI, raw_ostream &OS)
bool printGetPCX(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &OS)
void printPrefetchTag(const MCInst *MI, int opNum, const MCSubtargetInfo &STI, raw_ostream &O)
void printInstruction(const MCInst *MI, uint64_t Address, const MCSubtargetInfo &STI, raw_ostream &O)
void printMembarTag(const MCInst *MI, int opNum, const MCSubtargetInfo &STI, raw_ostream &O)
void printRegName(raw_ostream &OS, MCRegister Reg) override
Print the assembler register name.
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.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
static const char * SPARCCondCodeToString(SPCC::CondCodes CC)
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.