[clang] [CIR] floating-point, pointer, and function types (PR #120484)
David Olsen via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 18 16:46:36 PST 2024
================
@@ -18,6 +21,87 @@ mlir::MLIRContext &CIRGenTypes::getMLIRContext() const {
return *builder.getContext();
}
+/// Return true if the specified type in a function parameter or result position
+/// can be converted to a CIR type at this point. This boils down to being
+/// whether it is complete, as well as whether we've temporarily deferred
+/// expanding the type because we're in a recursive context.
+bool CIRGenTypes::isFuncParamTypeConvertible(clang::QualType type) {
+ // Some ABIs cannot have their member pointers represented in LLVM IR unless
+ // certain circumstances have been reached.
+ assert(!type->getAs<MemberPointerType>() && "NYI");
+
+ // If this isn't a tagged type, we can convert it!
----------------
dkolsen-pgi wrote:
I disagree about this one. If the source code uses a vector type as the type of a function parameter, ClangIR code gen will fail with a NYI error in `CIRGenTypes::convertType` when trying to convert the Clang vector type into a CIR type. There isn't a good reason to add a general-purpose check here in a function that is looking for a very specific condition that has only to do with function types.
Maybe this function should be renamed to `isConvertedTypeUsableInFunctionTypes`, to emphasize that it is not checking if a type is convertible, but checking whether or not a type is problematic if used as a return type or a parameter type within a function type.
https://github.com/llvm/llvm-project/pull/120484
More information about the cfe-commits
mailing list