FLANG
Public Types | Public Member Functions | Static Public Member Functions | List of all members
EmboxCommonConversion< OP > Struct Template Reference

Common base class for embox to descriptor conversion. More...

Inheritance diagram for EmboxCommonConversion< OP >:
fir::FIROpConversion< OP > fir::ConvertFIRToLLVMPattern

Public Types

using TypePair = typename fir::FIROpConversion< OP >::TypePair
 
- Public Types inherited from fir::FIROpConversion< OP >
using OpAdaptor = typename SourceOp::Adaptor
 
using OneToNOpAdaptor = typename SourceOp::template GenericAdaptor< mlir::ArrayRef< mlir::ValueRange > >
 

Public Member Functions

mlir::Value getCharacterByteSize (mlir::Location loc, mlir::ConversionPatternRewriter &rewriter, fir::CharacterType charTy, mlir::ValueRange lenParams) const
 
std::tuple< mlir::Value, mlir::Value > getSizeAndTypeCode (mlir::Location loc, mlir::ConversionPatternRewriter &rewriter, mlir::Type boxEleTy, mlir::ValueRange lenParams={}) const
 
mlir::Value insertField (mlir::ConversionPatternRewriter &rewriter, mlir::Location loc, mlir::Value dest, llvm::ArrayRef< std::int64_t > fldIndexes, mlir::Value value, bool bitcast=false) const
 Basic pattern to write a field in the descriptor.
 
mlir::Value insertBaseAddress (mlir::ConversionPatternRewriter &rewriter, mlir::Location loc, mlir::Value dest, mlir::Value base) const
 
mlir::Value insertLowerBound (mlir::ConversionPatternRewriter &rewriter, mlir::Location loc, mlir::Value dest, unsigned dim, mlir::Value lb) const
 
mlir::Value insertExtent (mlir::ConversionPatternRewriter &rewriter, mlir::Location loc, mlir::Value dest, unsigned dim, mlir::Value extent) const
 
mlir::Value insertStride (mlir::ConversionPatternRewriter &rewriter, mlir::Location loc, mlir::Value dest, unsigned dim, mlir::Value stride) const
 
template<typename ModOpTy >
mlir::Value getTypeDescriptor (ModOpTy mod, mlir::ConversionPatternRewriter &rewriter, mlir::Location loc, fir::RecordType recType) const
 
template<typename ModOpTy >
mlir::Value populateDescriptor (mlir::Location loc, ModOpTy mod, fir::BaseBoxType boxTy, mlir::Type inputType, mlir::ConversionPatternRewriter &rewriter, unsigned rank, mlir::Value eleSize, mlir::Value cfiTy, mlir::Value typeDesc, int allocatorIdx=kDefaultAllocator, mlir::Value extraField={}) const
 
template<typename BOX >
std::tuple< fir::BaseBoxType, mlir::Value, mlir::Value > consDescriptorPrefix (BOX box, mlir::Type inputType, mlir::ConversionPatternRewriter &rewriter, unsigned rank, mlir::ValueRange substrParams, mlir::ValueRange lenParams, mlir::Value sourceBox={}, mlir::Type sourceBoxType={}) const
 
std::tuple< fir::BaseBoxType, mlir::Value, mlir::Value > consDescriptorPrefix (fir::cg::XReboxOp box, mlir::Value loweredBox, mlir::ConversionPatternRewriter &rewriter, unsigned rank, mlir::ValueRange substrParams, mlir::ValueRange lenParams, mlir::Value typeDesc={}) const
 
mlir::Value genBoxOffsetGep (mlir::ConversionPatternRewriter &rewriter, mlir::Location loc, mlir::Value base, mlir::Type llvmBaseObjectType, mlir::Value outerOffset, mlir::ValueRange cstInteriorIndices, mlir::ValueRange componentIndices, std::optional< mlir::Value > substringOffset) const
 
template<typename BOX >
void getSubcomponentIndices (BOX xbox, mlir::Value memref, mlir::ValueRange operands, mlir::SmallVectorImpl< mlir::Value > &indices) const
 
mlir::Value placeInMemoryIfNotGlobalInit (mlir::ConversionPatternRewriter &rewriter, mlir::Location loc, mlir::Type boxTy, mlir::Value boxValue, bool needDeviceAllocation=false) const
 
- Public Member Functions inherited from fir::FIROpConversion< OP >
 FIROpConversion (const LLVMTypeConverter &typeConverter, const fir::FIRToLLVMPassOptions &options, mlir::PatternBenefit benefit=1)
 
void rewrite (mlir::Operation *op, mlir::ArrayRef< mlir::Value > operands, mlir::ConversionPatternRewriter &rewriter) const final
 Wrappers around the RewritePattern methods that pass the derived op type.
 
void rewrite (mlir::Operation *op, mlir::ArrayRef< mlir::ValueRange > operands, mlir::ConversionPatternRewriter &rewriter) const final
 
virtual void rewrite (OP op, OpAdaptor adaptor, mlir::ConversionPatternRewriter &rewriter) const
 
virtual void rewrite (OP op, OneToNOpAdaptor adaptor, mlir::ConversionPatternRewriter &rewriter) const
 
llvm::LogicalResult match (mlir::Operation *op) const final
 
virtual llvm::LogicalResult match (OP op) const
 
llvm::LogicalResult matchAndRewrite (mlir::Operation *op, mlir::ArrayRef< mlir::Value > operands, mlir::ConversionPatternRewriter &rewriter) const final
 
llvm::LogicalResult matchAndRewrite (mlir::Operation *op, mlir::ArrayRef< mlir::ValueRange > operands, mlir::ConversionPatternRewriter &rewriter) const final
 
virtual llvm::LogicalResult matchAndRewrite (OP op, OpAdaptor adaptor, mlir::ConversionPatternRewriter &rewriter) const
 
virtual llvm::LogicalResult matchAndRewrite (OP op, OneToNOpAdaptor adaptor, mlir::ConversionPatternRewriter &rewriter) const
 
- Public Member Functions inherited from fir::ConvertFIRToLLVMPattern
 ConvertFIRToLLVMPattern (llvm::StringRef rootOpName, mlir::MLIRContext *context, const fir::LLVMTypeConverter &typeConverter, const fir::FIRToLLVMPassOptions &options, mlir::PatternBenefit benefit=1)
 

Static Public Member Functions

static int getCFIAttr (fir::BaseBoxType boxTy)
 
static bool isInGlobalOp (mlir::ConversionPatternRewriter &rewriter)
 

Additional Inherited Members

- Protected Member Functions inherited from fir::ConvertFIRToLLVMPattern
mlir::Type convertType (mlir::Type ty) const
 
mlir::Type convertObjectType (mlir::Type firType) const
 
mlir::LLVM::ConstantOp genI32Constant (mlir::Location loc, mlir::ConversionPatternRewriter &rewriter, int value) const
 
mlir::LLVM::ConstantOp genConstantOffset (mlir::Location loc, mlir::ConversionPatternRewriter &rewriter, int offset) const
 
mlir::Value integerCast (mlir::Location loc, mlir::ConversionPatternRewriter &rewriter, mlir::Type ty, mlir::Value val, bool fold=false) const
 
TypePair getBoxTypePair (mlir::Type firBoxTy) const
 
mlir::Value getValueFromBox (mlir::Location loc, TypePair boxTy, mlir::Value box, mlir::Type resultTy, mlir::ConversionPatternRewriter &rewriter, int boxValue) const
 Construct code sequence to extract the specific value from a fir.box.
 
llvm::SmallVector< mlir::Value, 3 > getDimsFromBox (mlir::Location loc, llvm::ArrayRef< mlir::Type > retTys, TypePair boxTy, mlir::Value box, mlir::Value dim, mlir::ConversionPatternRewriter &rewriter) const
 
llvm::SmallVector< mlir::Value, 3 > getDimsFromBox (mlir::Location loc, llvm::ArrayRef< mlir::Type > retTys, TypePair boxTy, mlir::Value box, int dim, mlir::ConversionPatternRewriter &rewriter) const
 
mlir::Value loadDimFieldFromBox (mlir::Location loc, TypePair boxTy, mlir::Value box, mlir::Value dim, int off, mlir::Type ty, mlir::ConversionPatternRewriter &rewriter) const
 
mlir::Value getDimFieldFromBox (mlir::Location loc, TypePair boxTy, mlir::Value box, int dim, int off, mlir::Type ty, mlir::ConversionPatternRewriter &rewriter) const
 
mlir::Value getStrideFromBox (mlir::Location loc, TypePair boxTy, mlir::Value box, unsigned dim, mlir::ConversionPatternRewriter &rewriter) const
 
mlir::Value getBaseAddrFromBox (mlir::Location loc, TypePair boxTy, mlir::Value box, mlir::ConversionPatternRewriter &rewriter) const
 Read base address from a fir.box. Returned address has type ty.
 
mlir::Value getElementSizeFromBox (mlir::Location loc, mlir::Type resultTy, TypePair boxTy, mlir::Value box, mlir::ConversionPatternRewriter &rewriter) const
 
mlir::Value getRankFromBox (mlir::Location loc, TypePair boxTy, mlir::Value box, mlir::ConversionPatternRewriter &rewriter) const
 Read base address from a fir.box. Returned address has type ty.
 
mlir::Value getExtraFromBox (mlir::Location loc, TypePair boxTy, mlir::Value box, mlir::ConversionPatternRewriter &rewriter) const
 Read the extra field from a fir.box.
 
mlir::Type getBoxEleTy (mlir::Type type, llvm::ArrayRef< std::int64_t > indexes) const
 
mlir::Type getLlvmObjectTypeFromBoxType (mlir::Type boxType) const
 
mlir::Value loadTypeDescAddress (mlir::Location loc, TypePair boxTy, mlir::Value box, mlir::ConversionPatternRewriter &rewriter) const
 Read the address of the type descriptor from a box.
 
mlir::Value genBoxAttributeCheck (mlir::Location loc, TypePair boxTy, mlir::Value box, mlir::ConversionPatternRewriter &rewriter, unsigned maskValue) const
 
mlir::Value computeBoxSize (mlir::Location, TypePair boxTy, mlir::Value box, mlir::ConversionPatternRewriter &rewriter) const
 
template<typename... ARGS>
mlir::LLVM::GEPOp genGEP (mlir::Location loc, mlir::Type ty, mlir::ConversionPatternRewriter &rewriter, mlir::Value base, ARGS... args) const
 
mlir::Block * getBlockForAllocaInsert (mlir::Operation *op, mlir::Region *parentRegion) const
 
mlir::Value genAllocaAndAddrCastWithType (mlir::Location loc, mlir::Type llvmObjectTy, unsigned alignment, mlir::ConversionPatternRewriter &rewriter) const
 
const fir::LLVMTypeConverterlowerTy () const
 
void attachTBAATag (mlir::LLVM::AliasAnalysisOpInterface op, mlir::Type baseFIRType, mlir::Type accessFIRType, mlir::LLVM::GEPOp gep) const
 
unsigned getAllocaAddressSpace (mlir::ConversionPatternRewriter &rewriter) const
 
unsigned getProgramAddressSpace (mlir::ConversionPatternRewriter &rewriter) const
 
- Protected Attributes inherited from fir::ConvertFIRToLLVMPattern
const fir::FIRToLLVMPassOptionsoptions
 

Detailed Description

template<typename OP>
struct EmboxCommonConversion< OP >

Common base class for embox to descriptor conversion.

Member Function Documentation

◆ getTypeDescriptor()

template<typename OP >
template<typename ModOpTy >
mlir::Value EmboxCommonConversion< OP >::getTypeDescriptor ( ModOpTy  mod,
mlir::ConversionPatternRewriter &  rewriter,
mlir::Location  loc,
fir::RecordType  recType 
) const
inline

Get the address of the type descriptor global variable that was created by lowering for derived type recType.

◆ placeInMemoryIfNotGlobalInit()

template<typename OP >
mlir::Value EmboxCommonConversion< OP >::placeInMemoryIfNotGlobalInit ( mlir::ConversionPatternRewriter &  rewriter,
mlir::Location  loc,
mlir::Type  boxTy,
mlir::Value  boxValue,
bool  needDeviceAllocation = false 
) const
inline

If the embox is not in a globalOp body, allocate storage for the box; store the value inside and return the generated alloca. Return the input value otherwise.


The documentation for this struct was generated from the following file: