[Mlir-commits] [mlir] [MLIR][LLVM] Add CG Profile module flags support (PR #137115)
Tobias Gysi
llvmlistbot at llvm.org
Thu Apr 24 10:51:35 PDT 2025
================
@@ -271,6 +271,31 @@ static void convertLinkerOptionsOp(ArrayAttr options,
linkerMDNode->addOperand(listMDNode);
}
+static llvm::Metadata *
+convertModuleFlagValue(StringRef key, ArrayAttr arrayAttr,
+ llvm::IRBuilderBase &builder,
+ LLVM::ModuleTranslation &moduleTranslation) {
+ llvm::LLVMContext &context = builder.getContext();
+ llvm::MDBuilder mdb(context);
+ SmallVector<llvm::Metadata *> nodes;
+
+ if (key == "CG Profile") {
----------------
gysit wrote:
Not sure if there is a great place. In the LLVMDialect.td we define a couple of attribute names. Maybe this could be extended with metadata keywords if there are many more.
In theory we could also use an I32EnumAttr. Tablegen generates symbolize and stringify functions for them to convert between string and enum. However, the module flag attr then stores a string attribute. So I am unsure if that makes sense. Maybe if there are many more keywords?
LLVM seems to use the string literal everywhere so there is not really a way to generate an LLVM enum attr...
https://github.com/llvm/llvm-project/pull/137115
More information about the Mlir-commits
mailing list