clang 22.0.0git
CIRCXXABI.h
Go to the documentation of this file.
1//===----- CIRCXXABI.h - Interface to C++ ABIs for CIR Dialect --*- 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 file partially mimics the CodeGen/CGCXXABI.h class. The main difference
10// is that this is adapted to operate on the CIR dialect.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef CLANG_LIB_CIR_DIALECT_TRANSFORMS_TARGETLOWERING_CIRCXXABI_H
15#define CLANG_LIB_CIR_DIALECT_TRANSFORMS_TARGETLOWERING_CIRCXXABI_H
16
17#include "mlir/Transforms/DialectConversion.h"
20
21namespace cir {
22
23// Forward declarations.
24class LowerModule;
25
26class CIRCXXABI {
27 friend class LowerModule;
28
29protected:
31
33
34public:
35 virtual ~CIRCXXABI();
36
37 /// Lower the given data member pointer type to its ABI type. The returned
38 /// type is also a CIR type.
39 virtual mlir::Type
40 lowerDataMemberType(cir::DataMemberType type,
41 const mlir::TypeConverter &typeConverter) const = 0;
42
43 /// Lower the given data member pointer constant to a constant of the ABI
44 /// type. The returned constant is represented as an attribute as well.
45 virtual mlir::TypedAttr
46 lowerDataMemberConstant(cir::DataMemberAttr attr,
47 const mlir::DataLayout &layout,
48 const mlir::TypeConverter &typeConverter) const = 0;
49
50 /// Lower the given cir.get_runtime_member op to a sequence of more
51 /// "primitive" CIR operations that act on the ABI types.
52 virtual mlir::Operation *
53 lowerGetRuntimeMember(cir::GetRuntimeMemberOp op, mlir::Type loweredResultTy,
54 mlir::Value loweredAddr, mlir::Value loweredMember,
55 mlir::OpBuilder &builder) const = 0;
56};
57
58/// Creates an Itanium-family ABI.
59std::unique_ptr<CIRCXXABI> createItaniumCXXABI(LowerModule &lm);
60
61} // namespace cir
62
63#endif // CLANG_LIB_CIR_DIALECT_TRANSFORMS_TARGETLOWERING_CIRCXXABI_H
virtual ~CIRCXXABI()
Definition CIRCXXABI.cpp:18
virtual mlir::Operation * lowerGetRuntimeMember(cir::GetRuntimeMemberOp op, mlir::Type loweredResultTy, mlir::Value loweredAddr, mlir::Value loweredMember, mlir::OpBuilder &builder) const =0
Lower the given cir.get_runtime_member op to a sequence of more "primitive" CIR operations that act o...
virtual mlir::TypedAttr lowerDataMemberConstant(cir::DataMemberAttr attr, const mlir::DataLayout &layout, const mlir::TypeConverter &typeConverter) const =0
Lower the given data member pointer constant to a constant of the ABI type.
CIRCXXABI(LowerModule &lm)
Definition CIRCXXABI.h:32
LowerModule & lm
Definition CIRCXXABI.h:30
friend class LowerModule
Definition CIRCXXABI.h:27
virtual mlir::Type lowerDataMemberType(cir::DataMemberType type, const mlir::TypeConverter &typeConverter) const =0
Lower the given data member pointer type to its ABI type.
std::unique_ptr< CIRCXXABI > createItaniumCXXABI(LowerModule &lm)
Creates an Itanium-family ABI.