23#define DEBUG_TYPE "asm-printer"
33#define GET_INSTRUCTION_NAME
34#define PRINT_ALIAS_INSTR
35#include "SparcGenAsmWriter.inc"
38 return (STI.
hasFeature(Sparc::FeatureV9)) != 0;
46 unsigned AltIdx)
const {
62 switch (
MI->getOpcode()) {
63 default:
return false;
66 if (
MI->getNumOperands() != 3)
68 if (!
MI->getOperand(0).isReg())
70 switch (
MI->getOperand(0).getReg()) {
71 default:
return false;
73 if (
MI->getOperand(2).isImm() &&
74 MI->getOperand(2).getImm() == 8) {
75 switch(
MI->getOperand(1).getReg()) {
77 case SP::I7: O <<
"\tret";
return true;
78 case SP::O7: O <<
"\tretl";
return true;
88 case SP::V9FCMPS:
case SP::V9FCMPD:
case SP::V9FCMPQ:
89 case SP::V9FCMPES:
case SP::V9FCMPED:
case SP::V9FCMPEQ: {
91 || (
MI->getNumOperands() != 3)
92 || (!
MI->getOperand(0).isReg())
93 || (
MI->getOperand(0).getReg() != SP::FCC0))
96 switch(
MI->getOpcode()) {
98 case SP::V9FCMPS: O <<
"\tfcmps ";
break;
99 case SP::V9FCMPD: O <<
"\tfcmpd ";
break;
100 case SP::V9FCMPQ: O <<
"\tfcmpq ";
break;
101 case SP::V9FCMPES: O <<
"\tfcmpes ";
break;
102 case SP::V9FCMPED: O <<
"\tfcmped ";
break;
103 case SP::V9FCMPEQ: O <<
"\tfcmpeq ";
break;
119 unsigned Reg = MO.
getReg();
128 switch (
MI->getOpcode()) {
140 O << ((int) MO.
getImm() & 0x7f);
145 assert(MO.
isExpr() &&
"Unknown operand kind in printOperand");
155 bool PrintedFirstOperand =
false;
158 PrintedFirstOperand =
true;
163 const bool SkipSecondOperand =
164 PrintedFirstOperand && ((Op2.
isReg() && Op2.
getReg() == SP::G0) ||
167 if (!SkipSecondOperand) {
168 if (PrintedFirstOperand)
177 int CC = (int)
MI->getOperand(opNum).getImm();
178 switch (
MI->getOpcode()) {
188 case SP::MOVFCCrr:
case SP::V9MOVFCCrr:
189 case SP::MOVFCCri:
case SP::V9MOVFCCri:
190 case SP::FMOVS_FCC:
case SP::V9FMOVS_FCC:
191 case SP::FMOVD_FCC:
case SP::V9FMOVD_FCC:
192 case SP::FMOVQ_FCC:
case SP::V9FMOVQ_FCC:
227 static const char *
const TagNames[] = {
228 "#LoadLoad",
"#StoreLoad",
"#LoadStore",
"#StoreStore",
229 "#Lookaside",
"#MemIssue",
"#Sync"};
231 unsigned Imm =
MI->getOperand(opNum).getImm();
239 for (
unsigned i = 0; i < std::size(TagNames); i++) {
240 if (Imm & (1 << i)) {
241 O << (
First ?
"" :
" | ") << TagNames[i];
249 unsigned Imm =
MI->getOperand(opNum).getImm();
250 auto ASITag = SparcASITag::lookupASITagByEncoding(Imm);
251 if (
isV9(STI) && ASITag)
252 O <<
'#' << ASITag->Name;
260 unsigned Imm =
MI->getOperand(opNum).getImm();
261 auto PrefetchTag = SparcPrefetchTag::lookupPrefetchTagByEncoding(Imm);
263 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.
unsigned 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)
void printRegName(raw_ostream &OS, MCRegister Reg) const override
Print the assembler register name.
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)
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.