================
@@ -107,15 +161,29 @@ static mlir::Type abiTypeToCIR(const llvm::abi::Type *ty,
MLIRContext *ctx) {
.Case([&](const llvm::abi::PointerType *) {
return cir::PointerType::get(cir::VoidType::get(ctx));
})
+ .Case([&](const llvm::abi::RecordType *recTy) -> mlir::Type {
+ SmallVector<mlir::Type> fieldTypes;
+ fieldTypes.reserve(recTy->getFields().size());
+ for (const auto &field : recTy->getFields()) {
+ mlir::Type fieldCIR = abiTypeToCIR(field.FieldType, ctx);
+ if (!fieldCIR)
+ return nullptr;
+ fieldTypes.push_back(fieldCIR);
+ }
+ // Coercion types are plain register tuples, not the source record.
+ return cir::StructType::get(ctx, fieldTypes, /*packed=*/false,
+ /*padded=*/false, /*is_class=*/false);
+ })
.Default([](const llvm::abi::Type *) -> mlir::Type { return nullptr; });
}
-/// Map a scalar CIR type to an llvm::abi::Type. classifyX86_64Function
-/// pre-filters the signature, so only the scalar types handled here can
+/// Map a CIR type to an llvm::abi::Type. classifyX86_64Function pre-filters
+/// the signature, so only the scalar and struct/array types handled here can
/// reach this function.
static const llvm::abi::Type *mapCIRType(mlir::Type type,
mlir::abi::ABITypeMapper &typeMapper,
- const DataLayout &dl) {
+ const DataLayout &dl,
+ ModuleOp module) {
----------------
adams381 wrote:
Done, renamed it in the other two functions that took the same parameter as
well.
https://github.com/llvm/llvm-project/pull/210528
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits