clang 23.0.0git
OMPClauseMappableExprCommon Class Reference

Struct that defines common infrastructure to handle mappable expressions used in OpenMP clauses. More...

#include "clang/AST/OpenMPClause.h"

Inheritance diagram for OMPClauseMappableExprCommon:
[legend]

Classes

class  MappableComponent
 Class that represents a component of a mappable expression. E.g. for an expression S.a, the first component is a declaration reference expression associated with 'S' and the second is a member expression associated with the field declaration 'a'. If the expression is an array subscript it may not have any associated declaration. In that case the associated declaration is set to nullptr. More...

Public Types

using MappableExprComponentList = SmallVector<MappableComponent, 8>
using MappableExprComponentListRef = ArrayRef<MappableComponent>
using MappableExprComponentLists = SmallVector<MappableExprComponentList, 8>
using MappableExprComponentListsRef = ArrayRef<MappableExprComponentList>

Static Public Member Functions

static QualType getComponentExprElementType (const Expr *Exp)
 Get the type of an element of a ComponentList Expr Exp.
static std::pair< const Expr *, std::optional< size_t > > findAttachPtrExpr (MappableExprComponentListRef Components, OpenMPDirectiveKind CurDirKind)
 Find the attach pointer expression from a list of mappable expression components.

Static Protected Member Functions

static unsigned getComponentsTotalNumber (MappableExprComponentListsRef ComponentLists)
static unsigned getUniqueDeclarationsTotalNumber (ArrayRef< const ValueDecl * > Declarations)

Friends

llvm::hash_code hash_value (const MappableComponent &MC)

Detailed Description

Struct that defines common infrastructure to handle mappable expressions used in OpenMP clauses.

Definition at line 5875 of file OpenMPClause.h.

Member Typedef Documentation

◆ MappableExprComponentList

◆ MappableExprComponentListRef

◆ MappableExprComponentLists

◆ MappableExprComponentListsRef

Member Function Documentation

◆ findAttachPtrExpr()

std::pair< const Expr *, std::optional< size_t > > OMPClauseMappableExprCommon::findAttachPtrExpr ( MappableExprComponentListRef Components,
OpenMPDirectiveKind CurDirKind )
static

Find the attach pointer expression from a list of mappable expression components.

This function traverses the component list to find the first expression that has a pointer type, which represents the attach base pointer expr for the current component-list.

For example, given the following:

struct S {
int a;
int b[10];
int c[10][10];
int *p;
int **pp;
}
S s, *ps, **pps, *(pas[10]), ***ppps;
int i;
__device__ __2f16 b
__device__ __2f16 float __ockl_bool s
__device__ __2f16 float c

The base-pointers for the following map operands would be: map list-item | attach base-pointer | attach base-pointer | for directives except | target_update (if | target_update | different) -------------—|--------------------—|------------------— s | N/A | s.a | N/A | s.p | N/A | ps | N/A | ps->p | ps | ps[1] | ps | *(ps + 1) | ps | (ps + 1)[1] | ps | ps[1:10] | ps | ps->b[10] | ps | ps->p[10] | ps->p | ps->c[1][2] | ps | ps->c[1:2][2] | (error diagnostic) | N/A, TODO: ps ps->c[1:1][2] | ps | N/A, TODO: ps pps[1][2] | pps[1] | pps[1:1][2] | pps[1:1] | N/A, TODO: pps[1:1] pps[1:i][2] | pps[1:i] | N/A, TODO: pps[1:i] pps[1:2][2] | (error diagnostic) | N/A pps[1]->p | pps[1] | pps[1]->p[10] | pps[1] | pas[1] | N/A | pas[1][2] | pas[1] | ppps[1][2] | ppps[1] | ppps[1][2][3] | ppps[1][2] | ppps[1][2:1][3] | ppps[1][2:1] | N/A, TODO: ppps[1][2:1] ppps[1][2:2][3] | (error diagnostic) | N/A Returns a pair of the attach pointer expression and its depth in the component list. TODO: This may need to be updated to handle ref_ptr/ptee cases for byref map operands. TODO: Handle cases for target-update, where the list-item is a non-contiguous array-section that still has a base-pointer.

Definition at line 1220 of file OpenMPClause.cpp.

References getComponentExprElementType(), clang::isa(), and clang::Type::isPointerType().

Referenced by clang::SemaOpenMP::ActOnOpenMPUseDeviceAddrClause().

◆ getComponentExprElementType()

QualType OMPClauseMappableExprCommon::getComponentExprElementType ( const Expr * Exp)
static

Get the type of an element of a ComponentList Expr Exp.

For something like the following:

int *p, **p;

The types for the following Exprs would be:

Expr Type
p int *
*p int
p[0] int
p[0:1] int
pp int **
pp[0] int *
pp[0:1] int *

Note: this assumes that if Exp is an array-section, it is contiguous.

Definition at line 1194 of file OpenMPClause.cpp.

References clang::cast(), clang::ArraySectionExpr::getBaseOriginalType(), clang::QualType::getCanonicalType(), clang::QualType::getNonReferenceType(), clang::Type::getPointeeType(), clang::Expr::getType(), and clang::isa().

Referenced by findAttachPtrExpr().

◆ getComponentsTotalNumber()

◆ getUniqueDeclarationsTotalNumber()

◆ hash_value


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