@@ -4448,7 +4448,7 @@ std::unique_ptr<cir::LowerModule> prepareLowerModule(mlir::ModuleOp module) {
4448
4448
// If the triple is not present, e.g. CIR modules parsed from text, we
4449
4449
// cannot init LowerModule properly.
4450
4450
assert (!cir::MissingFeatures::makeTripleAlwaysPresent ());
4451
- if (!module->hasAttr (" cir.triple " ))
4451
+ if (!module->hasAttr (cir::CIRDialect::getTripleAttrName () ))
4452
4452
return {};
4453
4453
return cir::createLowerModule (module, rewriter);
4454
4454
}
@@ -4706,7 +4706,8 @@ void ConvertCIRToLLVMPass::buildGlobalAnnotationsVar(
4706
4706
llvm::StringMap<mlir::LLVM::GlobalOp> &argStringGlobalsMap,
4707
4707
llvm::MapVector<mlir::ArrayAttr, mlir::LLVM::GlobalOp> &argsVarMap) {
4708
4708
mlir::ModuleOp module = getOperation ();
4709
- mlir::Attribute attr = module->getAttr (" cir.global_annotations" );
4709
+ mlir::Attribute attr =
4710
+ module->getAttr (cir::CIRDialect::getGlobalAnnotationsAttrName ());
4710
4711
if (!attr)
4711
4712
return ;
4712
4713
if (auto globalAnnotValues =
@@ -4834,8 +4835,8 @@ void ConvertCIRToLLVMPass::runOnOperation() {
4834
4835
// Allow operations that will be lowered directly to LLVM IR.
4835
4836
target.addLegalOp <mlir::LLVM::ZeroOp>();
4836
4837
4837
- getOperation ()->removeAttr (" cir.sob " );
4838
- getOperation ()->removeAttr (" cir.lang " );
4838
+ getOperation ()->removeAttr (cir::CIRDialect::getSOBAttrName () );
4839
+ getOperation ()->removeAttr (cir::CIRDialect::getLangAttrName () );
4839
4840
4840
4841
llvm::SmallVector<mlir::Operation *> ops;
4841
4842
ops.push_back (module);
@@ -4845,17 +4846,17 @@ void ConvertCIRToLLVMPass::runOnOperation() {
4845
4846
signalPassFailure ();
4846
4847
4847
4848
// Emit the llvm.global_ctors array.
4848
- buildCtorDtorList (module, " cir.global_ctors " , " llvm.global_ctors " ,
4849
- [](mlir::Attribute attr) {
4849
+ buildCtorDtorList (module, cir::CIRDialect::getGlobalCtorsAttrName () ,
4850
+ " llvm.global_ctors " , [](mlir::Attribute attr) {
4850
4851
assert (mlir::isa<cir::GlobalCtorAttr>(attr) &&
4851
4852
" must be a GlobalCtorAttr" );
4852
4853
auto ctorAttr = mlir::cast<cir::GlobalCtorAttr>(attr);
4853
4854
return std::make_pair (ctorAttr.getName (),
4854
4855
ctorAttr.getPriority ());
4855
4856
});
4856
4857
// Emit the llvm.global_dtors array.
4857
- buildCtorDtorList (module, " cir.global_dtors " , " llvm.global_dtors " ,
4858
- [](mlir::Attribute attr) {
4858
+ buildCtorDtorList (module, cir::CIRDialect::getGlobalDtorsAttrName () ,
4859
+ " llvm.global_dtors " , [](mlir::Attribute attr) {
4859
4860
assert (mlir::isa<cir::GlobalDtorAttr>(attr) &&
4860
4861
" must be a GlobalDtorAttr" );
4861
4862
auto dtorAttr = mlir::cast<cir::GlobalDtorAttr>(attr);
0 commit comments