clang 22.0.0git
Classes | Functions
cir::direct Namespace Reference

Classes

class  CIRAttrToValue
 
class  CIRDialectLLVMIRTranslationInterface
 Implementation of the dialect interface that converts CIR attributes to LLVM IR metadata. More...
 
class  CIRToLLVMAllocaOpLowering
 
class  CIRToLLVMAssumeAlignedOpLowering
 
class  CIRToLLVMAssumeOpLowering
 
class  CIRToLLVMAssumeSepStorageOpLowering
 
class  CIRToLLVMBaseClassAddrOpLowering
 
class  CIRToLLVMBinOpLowering
 
class  CIRToLLVMBitClrsbOpLowering
 
class  CIRToLLVMBitClzOpLowering
 
class  CIRToLLVMBitCtzOpLowering
 
class  CIRToLLVMBitFfsOpLowering
 
class  CIRToLLVMBitParityOpLowering
 
class  CIRToLLVMBitPopcountOpLowering
 
class  CIRToLLVMBitReverseOpLowering
 
class  CIRToLLVMBrCondOpLowering
 
class  CIRToLLVMBrOpLowering
 
class  CIRToLLVMByteSwapOpLowering
 
class  CIRToLLVMCallOpLowering
 
class  CIRToLLVMCastOpLowering
 
class  CIRToLLVMCmpOpLowering
 
class  CIRToLLVMComplexAddOpLowering
 
class  CIRToLLVMComplexCreateOpLowering
 
class  CIRToLLVMComplexImagOpLowering
 
class  CIRToLLVMComplexImagPtrOpLowering
 
class  CIRToLLVMComplexRealOpLowering
 
class  CIRToLLVMComplexRealPtrOpLowering
 
class  CIRToLLVMComplexSubOpLowering
 
class  CIRToLLVMConstantOpLowering
 
class  CIRToLLVMExpectOpLowering
 
class  CIRToLLVMFAbsOpLowering
 
class  CIRToLLVMFrameAddrOpLowering
 
class  CIRToLLVMFuncOpLowering
 
class  CIRToLLVMGetBitfieldOpLowering
 
class  CIRToLLVMGetGlobalOpLowering
 
class  CIRToLLVMGetMemberOpLowering
 
class  CIRToLLVMGlobalOpLowering
 
class  CIRToLLVMInlineAsmOpLowering
 
class  CIRToLLVMLoadOpLowering
 
class  CIRToLLVMPtrStrideOpLowering
 
class  CIRToLLVMReturnAddrOpLowering
 
class  CIRToLLVMReturnOpLowering
 
class  CIRToLLVMRotateOpLowering
 
class  CIRToLLVMSelectOpLowering
 
class  CIRToLLVMSetBitfieldOpLowering
 
class  CIRToLLVMShiftOpLowering
 
class  CIRToLLVMStackRestoreOpLowering
 
class  CIRToLLVMStackSaveOpLowering
 
class  CIRToLLVMStoreOpLowering
 
class  CIRToLLVMSwitchFlatOpLowering
 
class  CIRToLLVMThrowOpLowering
 
class  CIRToLLVMTrapOpLowering
 
class  CIRToLLVMUnaryOpLowering
 
class  CIRToLLVMUnreachableOpLowering
 
class  CIRToLLVMVAArgOpLowering
 
class  CIRToLLVMVAEndOpLowering
 
class  CIRToLLVMVAStartOpLowering
 
class  CIRToLLVMVecCmpOpLowering
 
class  CIRToLLVMVecCreateOpLowering
 
class  CIRToLLVMVecExtractOpLowering
 
class  CIRToLLVMVecInsertOpLowering
 
class  CIRToLLVMVecShuffleDynamicOpLowering
 
class  CIRToLLVMVecShuffleOpLowering
 
class  CIRToLLVMVecSplatOpLowering
 
class  CIRToLLVMVecTernaryOpLowering
 
class  CIRToLLVMVTableAddrPointOpLowering
 
class  CIRToLLVMVTableGetVirtualFnAddrOpLowering
 
class  CIRToLLVMVTableGetVPtrOpLowering
 
class  CIRToLLVMVTTAddrPointOpLowering
 
struct  ConvertCIRToLLVMPass
 
class  GlobalInitAttrRewriter
 

Functions

std::unique_ptr< llvm::Module > lowerDirectlyFromCIRToLLVMIR (mlir::ModuleOp mlirModule, llvm::LLVMContext &llvmCtx)
 
std::unique_ptr< mlir::Pass > createConvertCIRToLLVMPass ()
 Create a pass that fully lowers CIR to the LLVMIR dialect.
 
void populateCIRToLLVMPasses (mlir::OpPassManager &pm)
 Adds passes that fully lower CIR to the LLVMIR dialect.
 
static mlir::Type convertTypeForMemory (const mlir::TypeConverter &converter, mlir::DataLayout const &dataLayout, mlir::Type type)
 Given a type convertor and a data layout, convert the given type to a type that is suitable for memory operations.
 
static mlir::Value createIntCast (mlir::OpBuilder &bld, mlir::Value src, mlir::IntegerType dstTy, bool isSigned=false)
 
static mlir::LLVM::Visibility lowerCIRVisibilityToLLVMVisibility (cir::VisibilityKind visibilityKind)
 
static mlir::Value emitFromMemory (mlir::ConversionPatternRewriter &rewriter, mlir::DataLayout const &dataLayout, cir::LoadOp op, mlir::Value value)
 Emits the value from memory as expected by its users.
 
static mlir::Value emitToMemory (mlir::ConversionPatternRewriter &rewriter, mlir::DataLayout const &dataLayout, mlir::Type origType, mlir::Value value)
 Emits a value to memory with the expected scalar type.
 
mlir::LLVM::Linkage convertLinkage (cir::GlobalLinkageKind linkage)
 
static mlir::Value getLLVMIntCast (mlir::ConversionPatternRewriter &rewriter, mlir::Value llvmSrc, mlir::Type llvmDstIntTy, bool isUnsigned, uint64_t cirSrcWidth, uint64_t cirDstIntWidth)
 
mlir::Value lowerCirAttrAsValue (mlir::Operation *parentOp, const mlir::Attribute attr, mlir::ConversionPatternRewriter &rewriter, const mlir::TypeConverter *converter)
 Switches on the type of attribute and calls the appropriate conversion.
 
void convertSideEffectForCall (mlir::Operation *callOp, bool isNothrow, cir::SideEffect sideEffect, mlir::LLVM::MemoryEffectsAttr &memoryEffect, bool &noUnwind, bool &willReturn)
 
static mlir::LLVM::CallIntrinsicOp createCallLLVMIntrinsicOp (mlir::ConversionPatternRewriter &rewriter, mlir::Location loc, const llvm::Twine &intrinsicName, mlir::Type resultTy, mlir::ValueRange operands)
 
static mlir::LLVM::CallIntrinsicOp replaceOpWithCallLLVMIntrinsicOp (mlir::ConversionPatternRewriter &rewriter, mlir::Operation *op, const llvm::Twine &intrinsicName, mlir::Type resultTy, mlir::ValueRange operands)
 
static mlir::LogicalResult rewriteCallOrInvoke (mlir::Operation *op, mlir::ValueRange callOperands, mlir::ConversionPatternRewriter &rewriter, const mlir::TypeConverter *converter, mlir::FlatSymbolRefAttr calleeAttr)
 
static mlir::LLVM::AtomicOrdering getLLVMMemOrder (std::optional< cir::MemOrder > memorder)
 
bool hasTrailingZeros (cir::ConstArrayAttr attr)
 
static bool isIntTypeUnsigned (mlir::Type type)
 
static mlir::LLVM::ICmpPredicate convertCmpKindToICmpPredicate (cir::CmpOpKind kind, bool isSigned)
 Convert from a CIR comparison kind to an LLVM IR integral comparison kind.
 
static mlir::LLVM::FCmpPredicate convertCmpKindToFCmpPredicate (cir::CmpOpKind kind)
 Convert from a CIR comparison kind to an LLVM IR floating-point comparison kind.
 
static void prepareTypeConverter (mlir::LLVMTypeConverter &converter, mlir::DataLayout &dataLayout)
 
static void collectUnreachable (mlir::Operation *parent, llvm::SmallVector< mlir::Operation * > &ops)
 
void createLLVMFuncOpIfNotExist (mlir::ConversionPatternRewriter &rewriter, mlir::Operation *srcOp, llvm::StringRef fnName, mlir::Type fnTy)
 
static mlir::Value getValueForVTableSymbol (mlir::Operation *op, mlir::ConversionPatternRewriter &rewriter, const mlir::TypeConverter *converter, mlir::FlatSymbolRefAttr nameAttr, mlir::Type &eltType)
 
mlir::IntegerType computeBitfieldIntType (mlir::Type storageType, mlir::MLIRContext *context, unsigned &storageSize)
 
std::unique_ptr< llvm::Module > lowerDirectlyFromCIRToLLVMIR (mlir::ModuleOp mlirModule, LLVMContext &llvmCtx)
 
void registerCIRDialectTranslation (mlir::DialectRegistry &registry)
 

Function Documentation

◆ collectUnreachable()

static void cir::direct::collectUnreachable ( mlir::Operation *  parent,
llvm::SmallVector< mlir::Operation * > &  ops 
)
static

Definition at line 2330 of file LowerToLLVM.cpp.

Referenced by cir::direct::ConvertCIRToLLVMPass::runOnOperation().

◆ computeBitfieldIntType()

mlir::IntegerType cir::direct::computeBitfieldIntType ( mlir::Type  storageType,
mlir::MLIRContext *  context,
unsigned storageSize 
)

◆ convertCmpKindToFCmpPredicate()

static mlir::LLVM::FCmpPredicate cir::direct::convertCmpKindToFCmpPredicate ( cir::CmpOpKind  kind)
static

Convert from a CIR comparison kind to an LLVM IR floating-point comparison kind.

Definition at line 1989 of file LowerToLLVM.cpp.

Referenced by cir::direct::CIRToLLVMCmpOpLowering::matchAndRewrite(), and cir::direct::CIRToLLVMVecCmpOpLowering::matchAndRewrite().

◆ convertCmpKindToICmpPredicate()

static mlir::LLVM::ICmpPredicate cir::direct::convertCmpKindToICmpPredicate ( cir::CmpOpKind  kind,
bool  isSigned 
)
static

Convert from a CIR comparison kind to an LLVM IR integral comparison kind.

Definition at line 1966 of file LowerToLLVM.cpp.

Referenced by cir::direct::CIRToLLVMCmpOpLowering::matchAndRewrite(), and cir::direct::CIRToLLVMVecCmpOpLowering::matchAndRewrite().

◆ convertLinkage()

mlir::LLVM::Linkage cir::direct::convertLinkage ( cir::GlobalLinkageKind  linkage)

◆ convertSideEffectForCall()

void cir::direct::convertSideEffectForCall ( mlir::Operation *  callOp,
bool  isNothrow,
cir::SideEffect  sideEffect,
mlir::LLVM::MemoryEffectsAttr &  memoryEffect,
bool noUnwind,
bool willReturn 
)

Definition at line 239 of file LowerToLLVM.cpp.

Referenced by rewriteCallOrInvoke().

◆ convertTypeForMemory()

static mlir::Type cir::direct::convertTypeForMemory ( const mlir::TypeConverter &  converter,
mlir::DataLayout const &  dataLayout,
mlir::Type  type 
)
static

◆ createCallLLVMIntrinsicOp()

static mlir::LLVM::CallIntrinsicOp cir::direct::createCallLLVMIntrinsicOp ( mlir::ConversionPatternRewriter &  rewriter,
mlir::Location  loc,
const llvm::Twine &  intrinsicName,
mlir::Type  resultTy,
mlir::ValueRange  operands 
)
static

Definition at line 273 of file LowerToLLVM.cpp.

Referenced by replaceOpWithCallLLVMIntrinsicOp().

◆ createConvertCIRToLLVMPass()

std::unique_ptr< mlir::Pass > cir::direct::createConvertCIRToLLVMPass ( )

Create a pass that fully lowers CIR to the LLVMIR dialect.

Definition at line 3276 of file LowerToLLVM.cpp.

Referenced by populateCIRToLLVMPasses().

◆ createIntCast()

static mlir::Value cir::direct::createIntCast ( mlir::OpBuilder &  bld,
mlir::Value  src,
mlir::IntegerType  dstTy,
bool  isSigned = false 
)
static

◆ createLLVMFuncOpIfNotExist()

void cir::direct::createLLVMFuncOpIfNotExist ( mlir::ConversionPatternRewriter &  rewriter,
mlir::Operation *  srcOp,
llvm::StringRef  fnName,
mlir::Type  fnTy 
)

◆ emitFromMemory()

static mlir::Value cir::direct::emitFromMemory ( mlir::ConversionPatternRewriter &  rewriter,
mlir::DataLayout const &  dataLayout,
cir::LoadOp  op,
mlir::Value  value 
)
static

Emits the value from memory as expected by its users.

Should be called when the memory represetnation of a CIR type is not equal to its scalar representation.

Definition at line 115 of file LowerToLLVM.cpp.

References createIntCast().

Referenced by cir::direct::CIRToLLVMLoadOpLowering::matchAndRewrite().

◆ emitToMemory()

static mlir::Value cir::direct::emitToMemory ( mlir::ConversionPatternRewriter &  rewriter,
mlir::DataLayout const &  dataLayout,
mlir::Type  origType,
mlir::Value  value 
)
static

Emits a value to memory with the expected scalar type.

Should be called when the memory represetnation of a CIR type is not equal to its scalar representation.

Definition at line 132 of file LowerToLLVM.cpp.

References createIntCast().

Referenced by cir::direct::CIRToLLVMStoreOpLowering::matchAndRewrite().

◆ getLLVMIntCast()

static mlir::Value cir::direct::getLLVMIntCast ( mlir::ConversionPatternRewriter &  rewriter,
mlir::Value  llvmSrc,
mlir::Type  llvmDstIntTy,
bool  isUnsigned,
uint64_t  cirSrcWidth,
uint64_t  cirDstIntWidth 
)
static

◆ getLLVMMemOrder()

static mlir::LLVM::AtomicOrdering cir::direct::getLLVMMemOrder ( std::optional< cir::MemOrder >  memorder)
static

◆ getValueForVTableSymbol()

static mlir::Value cir::direct::getValueForVTableSymbol ( mlir::Operation *  op,
mlir::ConversionPatternRewriter &  rewriter,
const mlir::TypeConverter *  converter,
mlir::FlatSymbolRefAttr  nameAttr,
mlir::Type &  eltType 
)
static

◆ hasTrailingZeros()

bool cir::direct::hasTrailingZeros ( cir::ConstArrayAttr  attr)

◆ isIntTypeUnsigned()

static bool cir::direct::isIntTypeUnsigned ( mlir::Type  type)
static

◆ lowerCirAttrAsValue()

mlir::Value cir::direct::lowerCirAttrAsValue ( mlir::Operation *  parentOp,
mlir::Attribute  attr,
mlir::ConversionPatternRewriter &  rewriter,
const mlir::TypeConverter *  converter 
)

Switches on the type of attribute and calls the appropriate conversion.

Convert a CIR attribute to an LLVM attribute.

May use the datalayout for lowering attributes to-be-stored in memory.

Definition at line 228 of file LowerToLLVM.cpp.

References cir::direct::CIRAttrToValue::visit().

Referenced by cir::direct::CIRToLLVMConstantOpLowering::matchAndRewrite().

◆ lowerCIRVisibilityToLLVMVisibility()

static mlir::LLVM::Visibility cir::direct::lowerCIRVisibilityToLLVMVisibility ( cir::VisibilityKind  visibilityKind)
static

◆ lowerDirectlyFromCIRToLLVMIR() [1/2]

std::unique_ptr< llvm::Module > cir::direct::lowerDirectlyFromCIRToLLVMIR ( mlir::ModuleOp  mlirModule,
llvm::LLVMContext &  llvmCtx 
)

◆ lowerDirectlyFromCIRToLLVMIR() [2/2]

std::unique_ptr< llvm::Module > cir::direct::lowerDirectlyFromCIRToLLVMIR ( mlir::ModuleOp  mlirModule,
LLVMContext &  llvmCtx 
)

◆ populateCIRToLLVMPasses()

void cir::direct::populateCIRToLLVMPasses ( mlir::OpPassManager &  pm)

Adds passes that fully lower CIR to the LLVMIR dialect.

Definition at line 3280 of file LowerToLLVM.cpp.

References createConvertCIRToLLVMPass(), and mlir::populateCIRPreLoweringPasses().

Referenced by lowerDirectlyFromCIRToLLVMIR().

◆ prepareTypeConverter()

static void cir::direct::prepareTypeConverter ( mlir::LLVMTypeConverter &  converter,
mlir::DataLayout &  dataLayout 
)
static

◆ registerCIRDialectTranslation()

void cir::direct::registerCIRDialectTranslation ( mlir::DialectRegistry &  registry)

Definition at line 52 of file LowerToLLVMIR.cpp.

Referenced by mlir::registerCIRDialectTranslation().

◆ replaceOpWithCallLLVMIntrinsicOp()

static mlir::LLVM::CallIntrinsicOp cir::direct::replaceOpWithCallLLVMIntrinsicOp ( mlir::ConversionPatternRewriter &  rewriter,
mlir::Operation *  op,
const llvm::Twine &  intrinsicName,
mlir::Type  resultTy,
mlir::ValueRange  operands 
)
static

◆ rewriteCallOrInvoke()

static mlir::LogicalResult cir::direct::rewriteCallOrInvoke ( mlir::Operation *  op,
mlir::ValueRange  callOperands,
mlir::ConversionPatternRewriter &  rewriter,
const mlir::TypeConverter *  converter,
mlir::FlatSymbolRefAttr  calleeAttr 
)
static