clang
20.0.0git
lib
CIR
CodeGen
CIRGenTypes.h
Go to the documentation of this file.
1
//===--- CIRGenTypes.h - Type translation for CIR CodeGen -------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// This is the code that handles AST -> CIR type lowering.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_CLANG_LIB_CODEGEN_CODEGENTYPES_H
14
#define LLVM_CLANG_LIB_CODEGEN_CODEGENTYPES_H
15
16
#include "
clang/CIR/Dialect/IR/CIRTypes.h
"
17
18
#include "llvm/ADT/SmallPtrSet.h"
19
20
namespace
clang
{
21
class
ASTContext;
22
class
FunctionType;
23
class
QualType;
24
class
Type
;
25
}
// namespace clang
26
27
namespace
mlir
{
28
class
Type
;
29
}
30
31
namespace
clang::CIRGen
{
32
33
class
CIRGenBuilderTy;
34
class
CIRGenModule;
35
36
/// This class organizes the cross-module state that is used while lowering
37
/// AST types to CIR types.
38
class
CIRGenTypes
{
39
CIRGenModule
&cgm;
40
clang::ASTContext
&astContext;
41
CIRGenBuilderTy
&builder;
42
43
/// Heper for ConvertType.
44
mlir::Type ConvertFunctionTypeInternal(
clang::QualType
ft);
45
46
public
:
47
CIRGenTypes
(
CIRGenModule
&cgm);
48
~CIRGenTypes
();
49
50
/// Utility to check whether a function type can be converted to a CIR type
51
/// (i.e. doesn't depend on an incomplete tag type).
52
bool
isFuncTypeConvertible
(
const
clang::FunctionType
*ft);
53
bool
isFuncParamTypeConvertible
(
clang::QualType
type
);
54
55
/// This map of clang::Type to mlir::Type (which includes CIR type) is a
56
/// cache of types that have already been processed.
57
using
TypeCacheTy
= llvm::DenseMap<const clang::Type *, mlir::Type>;
58
TypeCacheTy
typeCache
;
59
60
mlir::MLIRContext &
getMLIRContext
()
const
;
61
62
/// Convert a Clang type into a mlir::Type.
63
mlir::Type
convertType
(
clang::QualType
type
);
64
};
65
66
}
// namespace clang::CIRGen
67
68
#endif
Type
MatchType Type
Definition:
ASTMatchFinder.cpp:73
CIRTypes.h
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition:
ASTContext.h:188
clang::CIRGen::CIRGenBuilderTy
Definition:
CIRGenBuilder.h:18
clang::CIRGen::CIRGenModule
This class organizes the cross-function state that is used while generating CIR code.
Definition:
CIRGenModule.h:39
clang::CIRGen::CIRGenTypes
This class organizes the cross-module state that is used while lowering AST types to CIR types.
Definition:
CIRGenTypes.h:38
clang::CIRGen::CIRGenTypes::typeCache
TypeCacheTy typeCache
Definition:
CIRGenTypes.h:58
clang::CIRGen::CIRGenTypes::isFuncTypeConvertible
bool isFuncTypeConvertible(const clang::FunctionType *ft)
Utility to check whether a function type can be converted to a CIR type (i.e.
Definition:
CIRGenTypes.cpp:47
clang::CIRGen::CIRGenTypes::getMLIRContext
mlir::MLIRContext & getMLIRContext() const
Definition:
CIRGenTypes.cpp:20
clang::CIRGen::CIRGenTypes::isFuncParamTypeConvertible
bool isFuncParamTypeConvertible(clang::QualType type)
Return true if the specified type in a function parameter or result position can be converted to a CI...
Definition:
CIRGenTypes.cpp:28
clang::CIRGen::CIRGenTypes::~CIRGenTypes
~CIRGenTypes()
Definition:
CIRGenTypes.cpp:18
clang::CIRGen::CIRGenTypes::convertType
mlir::Type convertType(clang::QualType type)
Convert a Clang type into a mlir::Type.
Definition:
CIRGenTypes.cpp:88
clang::CIRGen::CIRGenTypes::TypeCacheTy
llvm::DenseMap< const clang::Type *, mlir::Type > TypeCacheTy
This map of clang::Type to mlir::Type (which includes CIR type) is a cache of types that have already...
Definition:
CIRGenTypes.h:57
clang::FunctionType
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition:
Type.h:4321
clang::QualType
A (possibly-)qualified type.
Definition:
Type.h:929
clang::CIRGen
Definition:
CIRGenerator.h:28
clang::ast_matchers::type
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Definition:
ASTMatchersInternal.cpp:801
clang
The JSON file list parser is used to communicate input to InstallAPI.
Definition:
CalledOnceCheck.h:17
mlir
Definition:
CIRGenerator.h:33
Generated on Fri Jan 17 2025 17:47:33 for clang by
1.9.6