let extraClassDeclaration = [{
/// Name of the data layout attributes.
static StringRef getDataLayoutAttrName() { return "llvm.data_layout"; }
+ static StringRef getAlignAttrName() { return "llvm.align"; }
+ static StringRef getNoAliasAttrName() { return "llvm.noalias"; }
/// Verifies if the given string is a well-formed data layout descriptor.
/// Uses `reportError` to report errors.
unsigned argIdx,
NamedAttribute argAttr) {
// Check that llvm.noalias is a boolean attribute.
- if (argAttr.first == "llvm.noalias" && !argAttr.second.isa<BoolAttr>())
+ if (argAttr.first == LLVMDialect::getNoAliasAttrName() &&
+ !argAttr.second.isa<BoolAttr>())
return op->emitError()
<< "llvm.noalias argument attribute of non boolean type";
// Check that llvm.align is an integer attribute.
- if (argAttr.first == "llvm.align" && !argAttr.second.isa<IntegerAttr>())
+ if (argAttr.first == LLVMDialect::getAlignAttrName() &&
+ !argAttr.second.isa<IntegerAttr>())
return op->emitError()
<< "llvm.align argument attribute of non integer type";
return success();
llvm::Argument &llvmArg = std::get<1>(kvp);
BlockArgument mlirArg = std::get<0>(kvp);
- if (auto attr = func.getArgAttrOfType<BoolAttr>(argIdx, "llvm.noalias")) {
+ if (auto attr = func.getArgAttrOfType<BoolAttr>(
+ argIdx, LLVMDialect::getNoAliasAttrName())) {
// NB: Attribute already verified to be boolean, so check if we can indeed
// attach the attribute to this argument, based on its type.
auto argTy = mlirArg.getType().dyn_cast<LLVM::LLVMType>();
llvmArg.addAttr(llvm::Attribute::AttrKind::NoAlias);
}
- if (auto attr = func.getArgAttrOfType<IntegerAttr>(argIdx, "llvm.align")) {
+ if (auto attr = func.getArgAttrOfType<IntegerAttr>(
+ argIdx, LLVMDialect::getAlignAttrName())) {
// NB: Attribute already verified to be int, so check if we can indeed
// attach the attribute to this argument, based on its type.
auto argTy = mlirArg.getType().dyn_cast<LLVM::LLVMType>();