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/Support/MathExtras.h"
#include "CIROpDefinitions.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 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 parseMemorySpace (mlir::AsmParser &p, mlir::ptr::MemorySpaceAttrInterface &attr)
void printMemorySpace (mlir::AsmPrinter &printer, mlir::ptr::MemorySpaceAttrInterface 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 mlir::LogicalResult verifyRecordMemberTypes (function_ref< mlir::InFlightDiagnostic()> emitError, llvm::ArrayRef< mlir::Type > members)
 Members must be CIR types other than void, which has no layout.
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)

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 109 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 1408 of file CIRTypes.cpp.

◆ getMethodLayoutType()

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

Definition at line 1363 of file CIRTypes.cpp.

References cir::RecordType::getAllDataKinds().

◆ parseFuncTypeParams()

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

Definition at line 1283 of file CIRTypes.cpp.

◆ parseMemberKind()

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

Definition at line 189 of file CIRTypes.cpp.

References kind.

Referenced by parseRecordBody().

◆ parseMemorySpace()

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

Definition at line 1723 of file CIRTypes.cpp.

Referenced by cir::parseGlobalMemorySpace().

◆ 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 204 of file CIRTypes.cpp.

References kind, and parseMemberKind().

◆ printFuncTypeParams()

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

Definition at line 1303 of file CIRTypes.cpp.

◆ printMemorySpace()

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

Definition at line 1771 of file CIRTypes.cpp.

Referenced by cir::printGlobalMemorySpace().

◆ 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 228 of file CIRTypes.cpp.

◆ 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 159 of file CIRTypes.cpp.

◆ verifyRecordMemberTypes()

mlir::LogicalResult verifyRecordMemberTypes ( function_ref< mlir::InFlightDiagnostic()> emitError,
llvm::ArrayRef< mlir::Type > members )
static

Members must be CIR types other than void, which has no layout.

Definition at line 170 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 185 of file CIRTypes.cpp.