41 if (dyn_cast<::cir::BoolType>(type)) {
42 return std::make_shared<CIRBoolType>();
45 if (
const auto i = dyn_cast<::cir::IntType>(type)) {
46 return std::make_shared<CIRIntegerType>(
48 !type.isUnsignedInteger()
52 if (dyn_cast<::cir::FP16Type>(type)) {
53 return std::make_shared<CIRFloatType>(16);
55 if (dyn_cast<::cir::SingleType>(type)) {
56 return std::make_shared<CIRFloatType>(32);
58 if (dyn_cast<::cir::DoubleType>(type)) {
59 return std::make_shared<CIRFloatType>(64);
61 if (dyn_cast<::cir::FP128Type>(type)) {
62 return std::make_shared<CIRFloatType>(128);
65 if (
const auto pointer = dyn_cast<::cir::PointerType>(type)) {
66 return std::make_shared<CIRPointerType>(
From(pointer.getPointee(), module));
69 if (
const auto _struct = dyn_cast<::cir::RecordType>(type)) {
70 const ::mlir::DataLayout layout{
module->clone()};
71 const auto params =
module->getDataLayoutSpec().getEntries();
73 const auto size = _struct.getTypeSize(layout, module->getDataLayoutSpec().getEntries());
74 const auto align = _struct.getABIAlignment(layout, params);
76 const auto path = Split(_struct.getName().str(),
"::");
78 return std::make_shared<CIRStructType>(path, size, align);