Skip to content

Commit 9052f26

Browse files
committed
add doc to helper functions
1 parent 181fb6b commit 9052f26

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mlir/lib/Target/LLVMIR/ModuleImport.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,8 @@ static Attribute convertCGProfileModuleFlagValue(ModuleOp mlirModule,
554554
return ArrayAttr::get(mlirModule->getContext(), cgProfile);
555555
}
556556

557+
/// Extract a two element `MDTuple` from a `MDOperand`. Emit a warning in case
558+
/// something else is found.
557559
static llvm::MDTuple *getTwoElementMDTuple(ModuleOp mlirModule,
558560
const llvm::Module *llvmModule,
559561
const llvm::MDOperand &md) {
@@ -564,6 +566,9 @@ static llvm::MDTuple *getTwoElementMDTuple(ModuleOp mlirModule,
564566
return tupleEntry;
565567
}
566568

569+
/// Extract a constant metadata value from a two element tuple (<key, value>).
570+
/// Return nullptr if requirements are not met. A warning is emitted if the
571+
/// `matchKey` is different from the tuple's key.
567572
static llvm::ConstantAsMetadata *getConstantMDFromKeyValueTuple(
568573
ModuleOp mlirModule, const llvm::Module *llvmModule,
569574
const llvm::MDOperand &md, StringRef matchKey, bool optional = false) {
@@ -582,6 +587,9 @@ static llvm::ConstantAsMetadata *getConstantMDFromKeyValueTuple(
582587
return dyn_cast<llvm::ConstantAsMetadata>(tupleEntry->getOperand(1));
583588
}
584589

590+
/// Extract an integer value from a two element tuple (<key, value>).
591+
/// Fail if requirements are not met. A warning is emitted if the
592+
/// found value isn't a LLVM constant integer.
585593
static FailureOr<uint64_t>
586594
convertInt64FromKeyValueTuple(ModuleOp mlirModule,
587595
const llvm::Module *llvmModule,

0 commit comments

Comments
 (0)