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 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 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 parseGlobalMemorySpace (mlir::AsmParser &p, mlir::ptr::MemorySpaceAttrInterface &attr)
void printGlobalMemorySpace (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 120 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 1371 of file CIRTypes.cpp.

◆ getMethodLayoutType()

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

Definition at line 1326 of file CIRTypes.cpp.

References cir::RecordType::getAllDataKinds().

◆ isPureCIRType()

bool isPureCIRType ( mlir::Type ty)
static

Definition at line 64 of file CIRTypes.cpp.

◆ parseFuncTypeParams()

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

Definition at line 1243 of file CIRTypes.cpp.

◆ parseGlobalMemorySpace()

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

Definition at line 1705 of file CIRTypes.cpp.

References parseMemorySpace().

◆ parseMemberKind()

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

Definition at line 185 of file CIRTypes.cpp.

References kind.

Referenced by parseRecordBody().

◆ parseMemorySpace()

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

Definition at line 1637 of file CIRTypes.cpp.

Referenced by 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 200 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 1263 of file CIRTypes.cpp.

◆ printGlobalMemorySpace()

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

Definition at line 1714 of file CIRTypes.cpp.

References printMemorySpace().

◆ printMemorySpace()

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

Definition at line 1685 of file CIRTypes.cpp.

Referenced by 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 224 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 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 181 of file CIRTypes.cpp.