29#define DEBUG_TYPE "asm-printer"
31#include "NVPTXGenAsmWriter.inc"
72 }
else if (
Op.isImm()) {
75 assert(
Op.isExpr() &&
"Unknown operand kind in printOperand");
76 MAI.printExpr(O, *
Op.getExpr());
86 if (Modifier ==
"ftz") {
91 }
else if (Modifier ==
"sat") {
96 }
else if (Modifier ==
"satfinite") {
101 }
else if (Modifier ==
"relu") {
106 }
else if (Modifier ==
"base") {
166 if (
MI->getOperand(OpNum).getImm())
176 if (Modifier ==
"FCmp") {
224 if (Modifier ==
"ICmp") {
252 if (Modifier ==
"IType") {
282 if (Modifier ==
"sem") {
301 "NVPTX AtomicCode Printer does not support \"seq_cst\" ordering.");
307 O <<
".mmio.relaxed";
310 }
else if (Modifier ==
"scope") {
330 "NVPTX AtomicCode Printer does not support \"{}\" scope modifier.",
332 }
else if (Modifier ==
"addsp") {
348 "NVPTX AtomicCode Printer does not support \"{}\" addsp modifier.",
349 addressSpaceToString(
A)));
350 }
else if (Modifier ==
"sign") {
376 unsigned Hint = MO.
getImm();
385 if (Modifier ==
"l1") {
390 O <<
".L1::evict_unchanged";
393 O <<
".L1::evict_first";
396 O <<
".L1::evict_last";
399 O <<
".L1::no_allocate";
402 }
else if (Modifier ==
"l2") {
407 O <<
".L2::evict_first";
410 O <<
".L2::evict_last";
414 O <<
".L2::cache_hint";
416 }
else if (Modifier ==
"prefetch") {
450 if (Modifier.empty() || Modifier ==
"version") {
453 }
else if (Modifier ==
"aligned") {
467 if (Modifier ==
"add") {
471 if (
MI->getOperand(OpNum + 1).isImm() &&
472 MI->getOperand(OpNum + 1).getImm() == 0)
482 auto &
Op =
MI->getOperand(OpNum);
483 assert(
Op.isImm() &&
"Invalid operand");
485 if (
Imm != UINT32_MAX) {
486 O <<
".pragma \"used_bytes_mask " <<
format_hex(
Imm, 1) <<
"\";\n\t";
502 int64_t
Imm =
MI->getOperand(OpNum).getImm();
551 switch (
static_cast<CGTy
>(MO.
getImm())) {
556 O <<
".cta_group::1";
559 O <<
".cta_group::2";
584 if (Modifier ==
"RetList") {
585 assert((
Imm == 1 ||
Imm == 0) &&
"Invalid return list");
591 if (Modifier ==
"ParamList") {
592 assert(
Imm >= 0 &&
"Invalid parameter list");
594 [&](
const auto &
I) { O <<
"param" <<
I; });
600template <
unsigned Bits>
604 assert(MO.
isImm() &&
"Expected immediate operand");
606 "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 printEvictPolicy(const MCInst *MI, int OpNum, const MCSubtargetInfo &STI, raw_ostream &O, StringRef Modifier={})
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.
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 getEvictPolicyName(EvictPolicyType Policy)
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)
MachineInstr * getImm(const MachineOperand &MO, const MachineRegisterInfo *MRI)
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.