21#include "llvm/IR/IRBuilder.h"
22#include "llvm/IR/IntrinsicsNVPTX.h"
23#include "llvm/Support/Casting.h"
35LogicalResult PMEventOp::verify() {
36 auto eventId = getEventId();
37 auto maskedEventId = getMaskedEventId();
38 if (!maskedEventId && !eventId) {
39 return emitOpError() <<
"either `id` or `mask` must be set";
42 if (maskedEventId && eventId) {
43 return emitOpError() <<
"`id` and `mask` cannot be set at the same time";
47 if (eventId < 0 || eventId > 15) {
48 return emitOpError() <<
"`id` must be between 0 and 15";
52 return llvm::success();
55LogicalResult NVVM::SetMaxRegisterOp::verify() {
56 if (getRegCount() % 8)
57 return emitOpError(
"new register size must be multiple of 8");
58 if (getRegCount() < 24 || getRegCount() > 256)
59 return emitOpError(
"new register size must be in between 24 to 256");
69 llvm::IRBuilderBase &builder) {
70 auto thisOp = cast<NVVM::PMEventOp>(op);
75 if (
auto eventAttr = thisOp.getEventIdAttr()) {
76 uint16_t mask =
static_cast<uint16_t
>(1u << eventAttr.getInt());
77 maskVal = llvm::ConstantInt::get(i16Ty, mask);
80 llvm::ConstantInt::get(i16Ty, thisOp.getMaskedEventIdAttr().getValue());
83 return {llvm::Intrinsic::nvvm_pm_event_mask, {maskVal}};
86bool NVVM::InlinePtxOp::getAsmValues(
90 for (
auto arg : getReadWriteArgs())
92 for (
auto arg : getResults())
94 for (
auto arg : getReadOnlyArgs())
101#define GET_OP_CLASSES
102#include "mlir/Dialect/LLVMIR/NVVMMiscOps.cpp.inc"
Implementation class for module translation.
llvm::LLVMContext & getLLVMContext() const
Returns the LLVM context in which the IR is being constructed.
Operation is the basic unit of execution within MLIR.
This class coordinates the application of a rewrite on a set of IR, providing a way for clients to tr...
@ Write
Write register with '=' modifier.
@ ReadWrite
ReadWrite register with '+' modifier.
@ Read
Read register with no modifier.
std::pair< llvm::Intrinsic::ID, llvm::SmallVector< llvm::Value * > > IDArgPair
A pair type of LLVM's Intrinsic ID and args (which are llvm values).
Include the generated interface declarations.