29#define DEBUG_TYPE "asm-printer"
31#define GET_SUBTARGETINFO_ENUM
32#include "NVPTXGenSubtargetInfo.inc"
34#include "NVPTXGenAsmWriter.inc"
47 unsigned RCId = (Reg.id() >> 28);
78 unsigned VReg = Reg.id() & 0x0FFFFFFF;
97 }
else if (
Op.isImm()) {
100 assert(
Op.isExpr() &&
"Unknown operand kind in printOperand");
101 MAI.printExpr(O, *
Op.getExpr());
109 int64_t Imm = MO.
getImm();
111 if (Modifier ==
"ftz") {
116 }
else if (Modifier ==
"sat") {
121 }
else if (Modifier ==
"relu") {
126 }
else if (Modifier ==
"base") {
171 const int Imm = MO.
getImm();
180 int64_t Imm = MO.
getImm();
182 if (Modifier ==
"FCmp") {
230 if (Modifier ==
"ICmp") {
258 if (Modifier ==
"IType") {
287 int Imm = (int)MO.
getImm();
288 if (Modifier ==
"sem") {
307 "NVPTX AtomicCode Printer does not support \"seq_cst\" ordering.");
313 O <<
".mmio.relaxed";
316 }
else if (Modifier ==
"scope") {
336 "NVPTX AtomicCode Printer does not support \"{}\" scope modifier.",
338 }
else if (Modifier ==
"addsp") {
354 "NVPTX AtomicCode Printer does not support \"{}\" addsp modifier.",
355 addressSpaceToString(
A)));
356 }
else if (Modifier ==
"sign") {
381 int Imm = (int)MO.
getImm();
382 if (Modifier.
empty() || Modifier ==
"version") {
385 }
else if (Modifier ==
"aligned") {
399 if (Modifier ==
"add") {
403 if (
MI->getOperand(OpNum + 1).isImm() &&
404 MI->getOperand(OpNum + 1).getImm() == 0)
414 auto &
Op =
MI->getOperand(OpNum);
415 assert(
Op.isImm() &&
"Invalid operand");
417 if (Imm != UINT32_MAX) {
418 O <<
".pragma \"used_bytes_mask " <<
format_hex(Imm, 1) <<
"\";\n\t";
434 int64_t Imm =
MI->getOperand(OpNum).getImm();
442 assert(
Op.isExpr() &&
"Call prototype is not an MCExpr?");
451 int64_t Imm = MO.
getImm();
485 switch (
static_cast<RedTy
>(MO.
getImm())) {
512 "Invalid Reduction Op in printCpAsyncBulkTensorReductionMode");
520 switch (
static_cast<CGTy
>(MO.
getImm())) {
525 O <<
".cta_group::1";
528 O <<
".cta_group::2";
539 const auto Imm = MO.
getImm();
541 if (Modifier ==
"RetList") {
542 assert((Imm == 1 || Imm == 0) &&
"Invalid return list");
548 if (Modifier ==
"ParamList") {
549 assert(Imm >= 0 &&
"Invalid parameter list");
551 [&](
const auto &
I) { O <<
"param" <<
I; });
557template <
unsigned Bits>
561 assert(MO.
isImm() &&
"Expected immediate operand");
563 "Immediate value does not fit in specified bits");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static bool hasParamSubqualifiers(const MCSubtargetInfo &STI)
This file contains the definitions of the enumerations and flags associated with NVVM Intrinsics,...
This class is intended to be used as a base class for asm properties and features specific to the tar...
Base class for the full range of assembler expressions which are needed for parsing.
WithMarkup markup(raw_ostream &OS, Markup M)
format_object< int64_t > formatHex(int64_t Value) const
const MCRegisterInfo & MRI
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.
MCInstPrinter(const MCAsmInfo &mai, const MCInstrInfo &mii, const MCRegisterInfo &mri)
Instances of this class represent a single low-level machine instruction.
Interface to description of machine instruction set.
Instances of this class represent operands of the MCInst class.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Wrapper class representing physical registers. Should be passed by value.
static constexpr unsigned NoRegister
Generic base class for all target subtargets.
bool hasFeature(unsigned Feature) const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
StringRef getName() const
getName - Get the symbol name.
void printRegName(raw_ostream &OS, MCRegister Reg) override
Print the assembler register name.
void printMemOperand(const MCInst *MI, int OpNum, const MCSubtargetInfo &STI, raw_ostream &O, StringRef Modifier={})
void printAtomicCode(const MCInst *MI, int OpNum, const MCSubtargetInfo &STI, raw_ostream &O, StringRef Modifier={})
void printInstruction(const MCInst *MI, uint64_t Address, const MCSubtargetInfo &STI, raw_ostream &O)
void printMmaCode(const MCInst *MI, int OpNum, const MCSubtargetInfo &STI, raw_ostream &O, StringRef Modifier={})
void printTmaReductionMode(const MCInst *MI, int OpNum, const MCSubtargetInfo &STI, raw_ostream &O)
void printCallOperand(const MCInst *MI, int OpNum, const MCSubtargetInfo &STI, raw_ostream &O, StringRef Modifier={})
void printProtoIdent(const MCInst *MI, int OpNum, const MCSubtargetInfo &STI, raw_ostream &O)
void printCmpMode(const MCInst *MI, int OpNum, const MCSubtargetInfo &STI, raw_ostream &O, StringRef Modifier={})
static const char * getRegisterName(MCRegister Reg)
void printPrmtMode(const MCInst *MI, int OpNum, const MCSubtargetInfo &STI, raw_ostream &O)
void printUsedBytesMaskPragma(const MCInst *MI, int OpNum, const MCSubtargetInfo &STI, raw_ostream &O)
void printRegisterOrSinkSymbol(const MCInst *MI, int OpNum, const MCSubtargetInfo &STI, raw_ostream &O)
void printHexu32imm(const MCInst *MI, int OpNum, const MCSubtargetInfo &STI, raw_ostream &O)
void printCvtMode(const MCInst *MI, int OpNum, const MCSubtargetInfo &STI, raw_ostream &O, StringRef Modifier={})
void printFTZFlag(const MCInst *MI, int OpNum, const MCSubtargetInfo &STI, raw_ostream &O)
void printInst(const MCInst *MI, uint64_t Address, StringRef Annot, const MCSubtargetInfo &STI, raw_ostream &OS) override
Print the specified MCInst to the specified raw_ostream.
void printCTAGroup(const MCInst *MI, int OpNum, const MCSubtargetInfo &STI, raw_ostream &O)
NVPTXInstPrinter(const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
void printHexUImm(const MCInst *MI, int OpNum, const MCSubtargetInfo &STI, raw_ostream &O)
void printOperand(const MCInst *MI, unsigned OpNo, const MCSubtargetInfo &STI, raw_ostream &O)
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
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.
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
SmallVectorImpl< T >::const_pointer c_str(SmallVectorImpl< T > &str)
void interleaveComma(const Container &c, StreamT &os, UnaryFunctor each_fn)
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
FormattedNumber format_hex(uint64_t N, unsigned Width, bool Upper=false)
format_hex - Output N as a fixed width hexadecimal.
DWARFExpression::Operation Op
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
auto seq(T Begin, T End)
Iterate over an integral type from Begin up to - but not including - End.
constexpr T maskTrailingOnes(unsigned N)
Create a bitmask with the N right-most bits set to 1, and all other bits set to 0.