#include "mlir/TableGen/GenInfo.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/CodeGenTypes/MachineValueType.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Regex.h"
#include "llvm/Support/Signals.h"
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/Main.h"
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"
Record;
RecordKeeper;
Regex;
usingnamespacemlir;
static llvm::cl::OptionCategory intrinsicGenCat("Intrinsics Generator Options");
static llvm::cl::opt<std::string>
nameFilter("llvmir-intrinsics-filter",
llvm::cl::desc("Only keep the intrinsics with the specified "
"substring in their record name"),
llvm::cl::cat(intrinsicGenCat));
static llvm::cl::opt<std::string>
opBaseClass("dialect-opclass-base",
llvm::cl::desc("The base class for the ops in the dialect we "
"are planning to emit"),
llvm::cl::init("LLVM_IntrOp"), llvm::cl::cat(intrinsicGenCat));
static llvm::cl::opt<std::string> accessGroupRegexp(
"llvmir-intrinsics-access-group-regexp",
llvm::cl::desc("Mark intrinsics that match the specified "
"regexp as taking an access group metadata"),
llvm::cl::cat(intrinsicGenCat));
static llvm::cl::opt<std::string> aliasAnalysisRegexp(
"llvmir-intrinsics-alias-analysis-regexp",
llvm::cl::desc("Mark intrinsics that match the specified "
"regexp as taking alias.scopes, noalias, and tbaa metadata"),
llvm::cl::cat(intrinsicGenCat));
IndicesTy;
static llvm::MVT::SimpleValueType getValueType(const Record *rec) { … }
static IndicesTy getOverloadableTypeIdxs(const Record &record,
const char *listName) { … }
namespace {
class LLVMIntrinsic { … };
}
template <typename Range>
void printBracketedRange(const Range &range, llvm::raw_ostream &os) { … }
static bool emitIntrinsic(const Record &record, llvm::raw_ostream &os) { … }
static bool emitIntrinsics(const RecordKeeper &records, llvm::raw_ostream &os) { … }
static mlir::GenRegistration genLLVMIRIntrinsics("gen-llvmir-intrinsics",
"Generate LLVM IR intrinsics",
emitIntrinsics);