clang 24.0.0git
cir::RecordType Class Reference

C++ view class that accepts both !cir.struct and !cir.union types. More...

#include "clang/CIR/Dialect/IR/CIRTypes.h"

Inheritance diagram for cir::RecordType:
[legend]

Public Member Functions

 RecordType (StructType t)
 RecordType (UnionType t)
llvm::ArrayRef< mlir::Type > getMembers () const
mlir::StringAttr getName () const
bool isIncomplete () const
bool isComplete () const
bool getPacked () const
bool getPadded () const
llvm::ArrayRef< RecordMemberKind > getMemberKinds () const
bool isClass () const
bool isStruct () const
bool isUnion () const
bool isEmptyForABI () const
 Whether no member holds data.
size_t getNumElements () const
mlir::Type getElementType (size_t idx) const
std::string getKindAsStr () const
std::string getPrefixedName () const
void complete (llvm::ArrayRef< mlir::Type > members, bool packed, mlir::Type padding, llvm::ArrayRef< RecordMemberKind > memberKinds)
 padding is union-only.
uint64_t getElementOffset (const mlir::DataLayout &dataLayout, unsigned idx) const
bool isLayoutIdentical (const RecordType &other)
bool isABIConvertedRecord () const
mlir::StringAttr getABIConvertedName () const
void removeABIConversionNamePrefix ()

Static Public Member Functions

static bool classof (mlir::Type t)
static llvm::SmallVector< RecordMemberKind > getAllDataKinds (llvm::ArrayRef< mlir::Type > members)
 One Data kind per member.

Detailed Description

C++ view class that accepts both !cir.struct and !cir.union types.

Follows the MLIR BaseMemRefType pattern: StructType and UnionType are the concrete tablegen types; RecordType is a hand-written view class that covers both. Use it when code must handle either kind generically.

Methods that are common to both types are forwarded through dyn_cast dispatch. Type-specific methods (getPadding, getUnionStorageType) are only available on the concrete type.

Definition at line 143 of file CIRTypes.h.

Constructor & Destructor Documentation

◆ RecordType() [1/2]

cir::RecordType::RecordType ( StructType t)
inline

Definition at line 151 of file CIRTypes.h.

Referenced by isLayoutIdentical().

◆ RecordType() [2/2]

cir::RecordType::RecordType ( UnionType t)
inline

Definition at line 153 of file CIRTypes.h.

Member Function Documentation

◆ classof()

bool cir::RecordType::classof ( mlir::Type t)
inlinestatic

Definition at line 155 of file CIRTypes.h.

◆ complete()

void RecordType::complete ( llvm::ArrayRef< mlir::Type > members,
bool packed,
mlir::Type padding,
llvm::ArrayRef< RecordMemberKind > memberKinds )

padding is union-only.

A struct carries its padding as a member marked pad.

Definition at line 651 of file CIRTypes.cpp.

Referenced by clang::CIRGen::CIRGenTypes::computeRecordLayout().

◆ getABIConvertedName()

mlir::StringAttr RecordType::getABIConvertedName ( ) const

Definition at line 685 of file CIRTypes.cpp.

◆ getAllDataKinds()

◆ getElementOffset()

uint64_t RecordType::getElementOffset ( const mlir::DataLayout & dataLayout,
unsigned idx ) const

Definition at line 661 of file CIRTypes.cpp.

Referenced by clang::CIRGen::CIRGenFunction::emitAddrOfFieldStorage().

◆ getElementType()

mlir::Type cir::RecordType::getElementType ( size_t idx) const
inline

Definition at line 182 of file CIRTypes.h.

References getMembers().

◆ getKindAsStr()

std::string RecordType::getKindAsStr ( ) const

Definition at line 643 of file CIRTypes.cpp.

Referenced by getPrefixedName().

◆ getMemberKinds()

llvm::ArrayRef< RecordMemberKind > RecordType::getMemberKinds ( ) const

Definition at line 628 of file CIRTypes.cpp.

Referenced by isEmptyForABI().

◆ getMembers()

llvm::ArrayRef< mlir::Type > RecordType::getMembers ( ) const

◆ getName()

mlir::StringAttr RecordType::getName ( ) const

◆ getNumElements()

size_t cir::RecordType::getNumElements ( ) const
inline

Definition at line 181 of file CIRTypes.h.

References getMembers().

◆ getPacked()

bool RecordType::getPacked ( ) const

Definition at line 618 of file CIRTypes.cpp.

◆ getPadded()

bool RecordType::getPadded ( ) const

Definition at line 623 of file CIRTypes.cpp.

◆ getPrefixedName()

std::string RecordType::getPrefixedName ( ) const

Definition at line 648 of file CIRTypes.cpp.

References getKindAsStr(), and getName().

◆ isABIConvertedRecord()

bool RecordType::isABIConvertedRecord ( ) const

Definition at line 680 of file CIRTypes.cpp.

◆ isClass()

bool RecordType::isClass ( ) const

Definition at line 633 of file CIRTypes.cpp.

◆ isComplete()

bool cir::RecordType::isComplete ( ) const
inline

Definition at line 162 of file CIRTypes.h.

References isIncomplete().

Referenced by clang::CIRGen::CIRGenTypes::convertRecordDeclType().

◆ isEmptyForABI()

bool RecordType::isEmptyForABI ( ) const

Whether no member holds data.

Vacuously true for a complete record with no members, and false for an incomplete one, whose members are not known yet. A union's tail-padding slot is not a member and does not count.

Definition at line 703 of file CIRTypes.cpp.

References cir::anyMemberHoldsDataForABI(), getMemberKinds(), getMembers(), and isIncomplete().

Referenced by marksMatchABIEmptiness().

◆ isIncomplete()

bool RecordType::isIncomplete ( ) const

◆ isLayoutIdentical()

bool RecordType::isLayoutIdentical ( const RecordType & other)

Definition at line 667 of file CIRTypes.cpp.

References RecordType().

◆ isStruct()

bool RecordType::isStruct ( ) const

Definition at line 638 of file CIRTypes.cpp.

Referenced by cir::CIRABIRewriteContext::rewriteCallSite().

◆ isUnion()

bool cir::RecordType::isUnion ( ) const
inline

Definition at line 169 of file CIRTypes.h.

◆ removeABIConversionNamePrefix()

void RecordType::removeABIConversionNamePrefix ( )

Definition at line 690 of file CIRTypes.cpp.


The documentation for this class was generated from the following files: