30#define DEBUG_TYPE "asm-printer"
32#include "NVPTXGenAsmWriter.inc"
73 }
else if (
Op.isImm()) {
76 assert(
Op.isExpr() &&
"Unknown operand kind in printOperand");
77 MAI.printExpr(O, *
Op.getExpr());
87 if (Modifier ==
"ftz") {
92 }
else if (Modifier ==
"sat") {
97 }
else if (Modifier ==
"satfinite") {
102 }
else if (Modifier ==
"relu") {
107 }
else if (Modifier ==
"base") {
152 const int Imm = MO.
getImm();
167 if (
MI->getOperand(OpNum).getImm())
175 int64_t Imm = MO.
getImm();
177 if (Modifier ==
"FCmp") {
225 if (Modifier ==
"ICmp") {
253 if (Modifier ==
"IType") {
282 int Imm = (int)MO.
getImm();
283 if (Modifier ==
"sem") {
302 "NVPTX AtomicCode Printer does not support \"seq_cst\" ordering.");
308 O <<
".mmio.relaxed";
311 }
else if (Modifier ==
"scope") {
331 "NVPTX AtomicCode Printer does not support \"{}\" scope modifier.",
333 }
else if (Modifier ==
"addsp") {
349 "NVPTX AtomicCode Printer does not support \"{}\" addsp modifier.",
350 addressSpaceToString(
A)));
351 }
else if (Modifier ==
"sign") {
377 unsigned Hint = MO.
getImm();
386 if (Modifier ==
"l1") {
391 O <<
".L1::evict_unchanged";
394 O <<
".L1::evict_first";
397 O <<
".L1::evict_last";
400 O <<
".L1::no_allocate";
403 }
else if (Modifier ==
"l2") {
408 O <<
".L2::evict_first";
411 O <<
".L2::evict_last";
415 O <<
".L2::cache_hint";
417 }
else if (Modifier ==
"prefetch") {
450 int Imm = (int)MO.
getImm();
451 if (Modifier.
empty() || Modifier ==
"version") {
454 }
else if (Modifier ==
"aligned") {
468 if (Modifier ==
"add") {
472 if (
MI->getOperand(OpNum + 1).isImm() &&
473 MI->getOperand(OpNum + 1).getImm() == 0)
483 auto &
Op =
MI->getOperand(OpNum);
484 assert(
Op.isImm() &&
"Invalid operand");
486 if (Imm != UINT32_MAX) {
487 O <<
".pragma \"used_bytes_mask " <<
format_hex(Imm, 1) <<
"\";\n\t";
503 int64_t Imm =
MI->getOperand(OpNum).getImm();
510 int64_t Imm = MO.
getImm();
552 switch (
static_cast<CGTy
>(MO.
getImm())) {
557 O <<
".cta_group::1";
560 O <<
".cta_group::2";
571 const auto Imm = MO.
getImm();
573 if (Modifier ==
"RetList") {
574 assert((Imm == 1 || Imm == 0) &&
"Invalid return list");
580 if (Modifier ==
"ParamList") {
581 assert(Imm >= 0 &&
"Invalid parameter list");
583 [&](
const auto &
I) { O <<
"param" <<
I; });
589template <
unsigned Bits>
593 assert(MO.
isImm() &&
"Expected immediate operand");
595 "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...
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.
MCRegister getReg() const
Returns the register number.
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.
constexpr bool isValid() const
static constexpr unsigned NoRegister
Generic base class for all target subtargets.
bool hasFeature(unsigned Feature) const
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 printCachePolicy(const MCInst *MI, int OpNum, 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 printMultimem(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 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 printEvictionAndPrefetchHint(const MCInst *MI, int OpNum, const MCSubtargetInfo &STI, raw_ostream &O, StringRef Modifier={})
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 printNegatedPredicate(const MCInst *MI, int OpNum, const MCSubtargetInfo &STI, raw_ostream &O)
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)
Represent a constant reference to a string, i.e.
constexpr bool empty() const
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.
L2Prefetch decodeL2Prefetch(unsigned Hint)
L1Eviction decodeL1Eviction(unsigned Hint)
L2Eviction decodeL2Eviction(unsigned Hint)
bool isL2CacheHintMode(unsigned Hint)
constexpr unsigned VirtualRegisterNumMask
constexpr unsigned VirtualRegisterKindShift
StringRef getVirtualRegisterPrefix(VirtualRegisterKind Kind)
The name prefix shared by all virtual registers of Kind.
StringRef getTMATensorReductionOpName(TMAReductionOp Op)
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
constexpr 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.