15 : cgm(genModule), astContext(genModule.getASTContext()),
16 builder(cgm.getBuilder()) {}
21 return *builder.getContext();
39 return !
tagType->isIncompleteType();
51 if (
const auto *fpt = dyn_cast<FunctionProtoType>(ft))
52 for (
unsigned i = 0, e = fpt->getNumParams(); i != e; i++)
59mlir::Type CIRGenTypes::ConvertFunctionTypeInternal(
QualType qft) {
75 if (
const auto *fpt = dyn_cast<FunctionProtoType>(ft)) {
77 for (
unsigned i = 0; i < fpt->getNumParams(); ++i) {
78 mlirParamTypes.push_back(
convertType(fpt->getParamType(i)));
80 return cir::FuncType::get(
81 mlirParamTypes,
convertType(fpt->getReturnType().getUnqualifiedType()),
93 TypeCacheTy::iterator tci =
typeCache.find(ty);
100 mlir::Type resultType =
nullptr;
102 case Type::Builtin: {
103 switch (cast<BuiltinType>(ty)->
getKind()) {
106 case BuiltinType::Void:
111 case BuiltinType::Char_S:
112 case BuiltinType::Int:
113 case BuiltinType::Int128:
114 case BuiltinType::Long:
115 case BuiltinType::LongLong:
116 case BuiltinType::SChar:
117 case BuiltinType::Short:
118 case BuiltinType::WChar_S:
124 case BuiltinType::Char8:
125 case BuiltinType::Char16:
126 case BuiltinType::Char32:
127 case BuiltinType::Char_U:
128 case BuiltinType::UChar:
129 case BuiltinType::UInt:
130 case BuiltinType::UInt128:
131 case BuiltinType::ULong:
132 case BuiltinType::ULongLong:
133 case BuiltinType::UShort:
134 case BuiltinType::WChar_U:
141 case BuiltinType::Float16:
144 case BuiltinType::Half:
153 case BuiltinType::BFloat16:
156 case BuiltinType::Float:
158 &llvm::APFloat::IEEEsingle() &&
159 "ClangIR NYI: 'float' in a format other than IEEE 32-bit");
162 case BuiltinType::Double:
164 &llvm::APFloat::IEEEdouble() &&
165 "ClangIR NYI: 'double' in a format other than IEEE 64-bit");
168 case BuiltinType::LongDouble:
172 case BuiltinType::Float128:
175 case BuiltinType::Ibm128:
188 case Type::Pointer: {
199 case Type::FunctionNoProto:
200 case Type::FunctionProto:
201 resultType = ConvertFunctionTypeInternal(
type);
205 const auto *bitIntTy = cast<BitIntType>(
type);
206 if (bitIntTy->getNumBits() > cir::IntType::maxBitwidth()) {
210 resultType = cir::IntType::get(&
getMLIRContext(), bitIntTy->getNumBits(),
211 bitIntTy->isSigned());
222 assert(resultType &&
"Type conversion not yet implemented");
Defines the clang::ASTContext interface.
static Decl::Kind getKind(const Decl *D)
C Language Family Type Representation.
cir::PointerType getPointerTo(mlir::Type ty)
const llvm::fltSemantics & getFloatTypeSemantics(QualType T) const
Return the APFloat 'semantics' for the specified scalar floating point type.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
const LangOptions & getLangOpts() const
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
const TargetInfo & getTargetInfo() const
cir::LongDoubleType getLongDoubleTy(const llvm::fltSemantics &format) const
This class organizes the cross-function state that is used while generating CIR code.
DiagnosticBuilder errorNYI(SourceLocation, llvm::StringRef)
Helpers to emit "not yet implemented" error diagnostics.
bool isFuncTypeConvertible(const clang::FunctionType *ft)
Utility to check whether a function type can be converted to a CIR type (i.e.
CIRGenTypes(CIRGenModule &cgm)
mlir::MLIRContext & getMLIRContext() const
bool isFuncParamTypeConvertible(clang::QualType type)
Return true if the specified type in a function parameter or result position can be converted to a CI...
mlir::Type convertType(clang::QualType type)
Convert a Clang type into a mlir::Type.
FunctionType - C99 6.7.5.3 - Function Declarators.
QualType getReturnType() const
A pointer to member type per C++ 8.3.3 - Pointers to members.
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getPointeeType() const
A (possibly-)qualified type.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Encodes a location in the source.
virtual bool useFP16ConversionIntrinsics() const
Check whether llvm intrinsics such as llvm.convert.to.fp16 should be used to convert to and from __fp...
The base class of the type hierarchy.
bool isConstantMatrixType() const
TypeClass getTypeClass() const
Defines the clang::TargetInfo interface.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const AstTypeMatcher< TagType > tagType
Matches tag types (record and enum types).
The JSON file list parser is used to communicate input to InstallAPI.