clang 24.0.0git
CIRTypes.cpp File Reference
#include "clang/CIR/Dialect/IR/CIRTypes.h"
#include "mlir/Dialect/Ptr/IR/MemorySpaceInterfaces.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/MLIRContext.h"
#include "mlir/Support/LLVM.h"
#include "clang/Basic/AddressSpaces.h"
#include "clang/CIR/Dialect/IR/CIRAttrs.h"
#include "clang/CIR/Dialect/IR/CIRDialect.h"
#include "clang/CIR/Dialect/IR/CIROpsEnums.h"
#include "clang/CIR/Dialect/IR/CIRTypesDetails.h"
#include "clang/CIR/MissingFeatures.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/MathExtras.h"
#include "clang/CIR/Dialect/IR/CIRTypeConstraints.cpp.inc"
#include "clang/CIR/Dialect/IR/CIROpsTypes.cpp.inc"

Go to the source code of this file.

Namespaces

namespace  cir

Macros

#define GET_TYPEDEF_CLASSES
#define GET_TYPEDEF_LIST

Functions

static bool isPureCIRType (mlir::Type ty)
static mlir::ParseResult parseFuncTypeParams (mlir::AsmParser &p, llvm::SmallVector< mlir::Type > &params, bool &isVarArg)
static void printFuncTypeParams (mlir::AsmPrinter &p, mlir::ArrayRef< mlir::Type > params, bool isVarArg)
mlir::ParseResult parseAddressSpaceValue (mlir::AsmParser &p, mlir::ptr::MemorySpaceAttrInterface &attr)
void printAddressSpaceValue (mlir::AsmPrinter &printer, mlir::ptr::MemorySpaceAttrInterface attr)
mlir::ParseResult parseTargetAddressSpace (mlir::AsmParser &p, cir::TargetAddressSpaceAttr &attr)
void printTargetAddressSpace (mlir::AsmPrinter &p, cir::TargetAddressSpaceAttr attr)
static mlir::LogicalResult verifyRecordMemberKinds (function_ref< mlir::InFlightDiagnostic()> emitError, size_t numMembers, llvm::ArrayRef< RecordMemberKind > memberKinds)
 An incomplete record has no members, so a kind for one is caught by the same check.
static std::optional< RecordMemberKind > parseMemberKind (mlir::AsmParser &parser)
static mlir::ParseResult parseRecordBody (mlir::AsmParser &parser, bool &incomplete, llvm::SmallVector< mlir::Type > &members, llvm::SmallVectorImpl< RecordMemberKind > &memberKinds)
 Parse "incomplete" or "{mark type, mark type, ...}", writing results into incomplete, members and memberKinds.
template<typename RecordTy>
static void printRecordBody (mlir::AsmPrinter &printer, RecordTy self, mlir::StringAttr name, bool hasClassPrefix, bool isPacked, bool isIncomplete, llvm::ArrayRef< mlir::Type > members, mlir::Type padding, llvm::ArrayRef< RecordMemberKind > memberKinds)
 Print a complete CIR record body: '<' ['class '] [name] ['packed '] body '>' where body is "incomplete" or "{[mark] members}[, padding = {type}]".
static mlir::Type getMethodLayoutType (mlir::MLIRContext *ctx)
static mlir::Type getDataMemberLayoutType (const mlir::DataLayout &dataLayout, mlir::MLIRContext *ctx)
mlir::OptionalParseResult parseGlobalAddressSpaceValue (mlir::AsmParser &p, mlir::ptr::MemorySpaceAttrInterface &attr)
void printGlobalAddressSpaceValue (mlir::AsmPrinter &printer, cir::GlobalOp, mlir::ptr::MemorySpaceAttrInterface attr)

Variables

static const llvm::StringRef memberKindMarks []
 The keywords that spell a member kind.

Macro Definition Documentation

◆ GET_TYPEDEF_CLASSES

#define GET_TYPEDEF_CLASSES

Definition at line 126 of file CIRTypes.cpp.

◆ GET_TYPEDEF_LIST

#define GET_TYPEDEF_LIST

Function Documentation

◆ getDataMemberLayoutType()

mlir::Type getDataMemberLayoutType ( const mlir::DataLayout & dataLayout,
mlir::MLIRContext * ctx )
static

Definition at line 1321 of file CIRTypes.cpp.

◆ getMethodLayoutType()

mlir::Type getMethodLayoutType ( mlir::MLIRContext * ctx)
static

Definition at line 1276 of file CIRTypes.cpp.

References cir::RecordType::getAllDataKinds().

◆ isPureCIRType()

bool isPureCIRType ( mlir::Type ty)
static

Definition at line 64 of file CIRTypes.cpp.

◆ parseAddressSpaceValue()

mlir::ParseResult parseAddressSpaceValue ( mlir::AsmParser & p,
mlir::ptr::MemorySpaceAttrInterface & attr )

Definition at line 1530 of file CIRTypes.cpp.

◆ parseFuncTypeParams()

mlir::ParseResult parseFuncTypeParams ( mlir::AsmParser & p,
llvm::SmallVector< mlir::Type > & params,
bool & isVarArg )
static

Definition at line 1193 of file CIRTypes.cpp.

◆ parseGlobalAddressSpaceValue()

mlir::OptionalParseResult parseGlobalAddressSpaceValue ( mlir::AsmParser & p,
mlir::ptr::MemorySpaceAttrInterface & attr )

Definition at line 1598 of file CIRTypes.cpp.

References parseAddressSpaceValue().

◆ parseMemberKind()

std::optional< RecordMemberKind > parseMemberKind ( mlir::AsmParser & parser)
static

Definition at line 191 of file CIRTypes.cpp.

References kind.

Referenced by parseRecordBody().

◆ parseRecordBody()

mlir::ParseResult parseRecordBody ( mlir::AsmParser & parser,
bool & incomplete,
llvm::SmallVector< mlir::Type > & members,
llvm::SmallVectorImpl< RecordMemberKind > & memberKinds )
static

Parse "incomplete" or "{mark type, mark type, ...}", writing results into incomplete, members and memberKinds.

Returns failure if member parsing fails.

Definition at line 206 of file CIRTypes.cpp.

References kind, and parseMemberKind().

◆ parseTargetAddressSpace()

mlir::ParseResult parseTargetAddressSpace ( mlir::AsmParser & p,
cir::TargetAddressSpaceAttr & attr )

◆ printAddressSpaceValue()

void printAddressSpaceValue ( mlir::AsmPrinter & printer,
mlir::ptr::MemorySpaceAttrInterface attr )

Definition at line 1578 of file CIRTypes.cpp.

◆ printFuncTypeParams()

void printFuncTypeParams ( mlir::AsmPrinter & p,
mlir::ArrayRef< mlir::Type > params,
bool isVarArg )
static

Definition at line 1213 of file CIRTypes.cpp.

◆ printGlobalAddressSpaceValue()

void printGlobalAddressSpaceValue ( mlir::AsmPrinter & printer,
cir::GlobalOp op,
mlir::ptr::MemorySpaceAttrInterface attr )

Definition at line 1607 of file CIRTypes.cpp.

References printAddressSpaceValue().

◆ printRecordBody()

template<typename RecordTy>
void printRecordBody ( mlir::AsmPrinter & printer,
RecordTy self,
mlir::StringAttr name,
bool hasClassPrefix,
bool isPacked,
bool isIncomplete,
llvm::ArrayRef< mlir::Type > members,
mlir::Type padding,
llvm::ArrayRef< RecordMemberKind > memberKinds )
static

Print a complete CIR record body: '<' ['class '] [name] ['packed '] body '>' where body is "incomplete" or "{[mark] members}[, padding = {type}]".

RecordTy must be a mutable MLIR type (StructType or UnionType).

Definition at line 230 of file CIRTypes.cpp.

◆ printTargetAddressSpace()

void printTargetAddressSpace ( mlir::AsmPrinter & p,
cir::TargetAddressSpaceAttr attr )

◆ verifyRecordMemberKinds()

mlir::LogicalResult verifyRecordMemberKinds ( function_ref< mlir::InFlightDiagnostic()> emitError,
size_t numMembers,
llvm::ArrayRef< RecordMemberKind > memberKinds )
static

An incomplete record has no members, so a kind for one is caught by the same check.

Definition at line 176 of file CIRTypes.cpp.

Variable Documentation

◆ memberKindMarks

const llvm::StringRef memberKindMarks[]
static
Initial value:
= {"data", "pad", "empty",
"bitfield"}

The keywords that spell a member kind.

A union's tail-padding slot probes for one of these to reject it, since that slot is not a member.

Definition at line 187 of file CIRTypes.cpp.