@@ -114,12 +114,6 @@ class Util {
114
114
// / \param Tmpl whether the class is template instantiation or simple record
115
115
static bool isSyclType (QualType Ty, StringRef Name, bool Tmpl = false );
116
116
117
- // / Checks whether given function is a standard SYCL API function with given
118
- // / name.
119
- // / \param FD the function being checked.
120
- // / \param Name the function name to be checked against.
121
- static bool isSyclFunction (const FunctionDecl *FD, StringRef Name);
122
-
123
117
// / Checks whether given clang type is a full specialization of the SYCL
124
118
// / specialization constant class.
125
119
static bool isSyclSpecConstantType (QualType Ty);
@@ -3143,60 +3137,6 @@ class SyclKernelIntHeaderCreator : public SyclKernelFieldHandler {
3143
3137
return !SemaRef.getASTContext ().hasSameType (FD->getType (), Ty);
3144
3138
}
3145
3139
3146
- // Sets a flag if the kernel is a parallel_for that calls the
3147
- // free function API "this_item".
3148
- void setThisItemIsCalled (FunctionDecl *KernelFunc) {
3149
- if (getKernelInvocationKind (KernelFunc) != InvokeParallelFor)
3150
- return ;
3151
-
3152
- // The call graph for this translation unit.
3153
- CallGraph SYCLCG;
3154
- SYCLCG.addToCallGraph (SemaRef.getASTContext ().getTranslationUnitDecl ());
3155
- using ChildParentPair =
3156
- std::pair<const FunctionDecl *, const FunctionDecl *>;
3157
- llvm::SmallPtrSet<const FunctionDecl *, 16 > Visited;
3158
- llvm::SmallVector<ChildParentPair, 16 > WorkList;
3159
- WorkList.push_back ({KernelFunc, nullptr });
3160
-
3161
- while (!WorkList.empty ()) {
3162
- const FunctionDecl *FD = WorkList.back ().first ;
3163
- WorkList.pop_back ();
3164
- if (!Visited.insert (FD).second )
3165
- continue ; // We've already seen this Decl
3166
-
3167
- // Check whether this call is to free functions (sycl::this_item(),
3168
- // this_id, etc.).
3169
- if (Util::isSyclFunction (FD, " this_id" )) {
3170
- Header.setCallsThisId (true );
3171
- return ;
3172
- }
3173
- if (Util::isSyclFunction (FD, " this_item" )) {
3174
- Header.setCallsThisItem (true );
3175
- return ;
3176
- }
3177
- if (Util::isSyclFunction (FD, " this_nd_item" )) {
3178
- Header.setCallsThisNDItem (true );
3179
- return ;
3180
- }
3181
- if (Util::isSyclFunction (FD, " this_group" )) {
3182
- Header.setCallsThisGroup (true );
3183
- return ;
3184
- }
3185
-
3186
- CallGraphNode *N = SYCLCG.getNode (FD);
3187
- if (!N)
3188
- continue ;
3189
-
3190
- for (const CallGraphNode *CI : *N) {
3191
- if (auto *Callee = dyn_cast<FunctionDecl>(CI->getDecl ())) {
3192
- Callee = Callee->getMostRecentDecl ();
3193
- if (!Visited.count (Callee))
3194
- WorkList.push_back ({Callee, FD});
3195
- }
3196
- }
3197
- }
3198
- }
3199
-
3200
3140
public:
3201
3141
static constexpr const bool VisitInsideSimpleContainers = false ;
3202
3142
SyclKernelIntHeaderCreator (Sema &S, SYCLIntegrationHeader &H,
@@ -3206,7 +3146,6 @@ class SyclKernelIntHeaderCreator : public SyclKernelFieldHandler {
3206
3146
bool IsSIMDKernel = isESIMDKernelType (KernelObj);
3207
3147
Header.startKernel (KernelFunc, NameType, KernelObj->getLocation (),
3208
3148
IsSIMDKernel, IsSYCLUnnamedKernel (S, KernelFunc));
3209
- setThisItemIsCalled (KernelFunc);
3210
3149
}
3211
3150
3212
3151
bool handleSyclSpecialType (const CXXRecordDecl *RD,
@@ -4687,16 +4626,6 @@ void SYCLIntegrationHeader::emit(raw_ostream &O) {
4687
4626
O << " __SYCL_DLL_LOCAL\n " ;
4688
4627
O << " static constexpr bool isESIMD() { return " << K.IsESIMDKernel
4689
4628
<< " ; }\n " ;
4690
- O << " __SYCL_DLL_LOCAL\n " ;
4691
- O << " static constexpr bool callsThisItem() { return " ;
4692
- O << K.FreeFunctionCalls .CallsThisItem << " ; }\n " ;
4693
- O << " __SYCL_DLL_LOCAL\n " ;
4694
- O << " static constexpr bool callsAnyThisFreeFunction() { return " ;
4695
- O << (K.FreeFunctionCalls .CallsThisId ||
4696
- K.FreeFunctionCalls .CallsThisItem ||
4697
- K.FreeFunctionCalls .CallsThisNDItem ||
4698
- K.FreeFunctionCalls .CallsThisGroup )
4699
- << " ; }\n " ;
4700
4629
O << " };\n " ;
4701
4630
CurStart += N;
4702
4631
}
@@ -4751,30 +4680,6 @@ void SYCLIntegrationHeader::addSpecConstant(StringRef IDName, QualType IDType) {
4751
4680
SpecConsts.emplace_back (std::make_pair (IDType, IDName.str ()));
4752
4681
}
4753
4682
4754
- void SYCLIntegrationHeader::setCallsThisId (bool B) {
4755
- KernelDesc *K = getCurKernelDesc ();
4756
- assert (K && " no kernel" );
4757
- K->FreeFunctionCalls .CallsThisId = B;
4758
- }
4759
-
4760
- void SYCLIntegrationHeader::setCallsThisItem (bool B) {
4761
- KernelDesc *K = getCurKernelDesc ();
4762
- assert (K && " no kernel" );
4763
- K->FreeFunctionCalls .CallsThisItem = B;
4764
- }
4765
-
4766
- void SYCLIntegrationHeader::setCallsThisNDItem (bool B) {
4767
- KernelDesc *K = getCurKernelDesc ();
4768
- assert (K && " no kernel" );
4769
- K->FreeFunctionCalls .CallsThisNDItem = B;
4770
- }
4771
-
4772
- void SYCLIntegrationHeader::setCallsThisGroup (bool B) {
4773
- KernelDesc *K = getCurKernelDesc ();
4774
- assert (K && " no kernel" );
4775
- K->FreeFunctionCalls .CallsThisGroup = B;
4776
- }
4777
-
4778
4683
SYCLIntegrationHeader::SYCLIntegrationHeader (Sema &S) : S(S) {}
4779
4684
4780
4685
void SYCLIntegrationFooter::addVarDecl (const VarDecl *VD) {
@@ -5099,28 +5004,6 @@ bool Util::isSyclType(QualType Ty, StringRef Name, bool Tmpl) {
5099
5004
return matchQualifiedTypeName (Ty, Scopes);
5100
5005
}
5101
5006
5102
- bool Util::isSyclFunction (const FunctionDecl *FD, StringRef Name) {
5103
- if (!FD->isFunctionOrMethod () || !FD->getIdentifier () ||
5104
- FD->getName ().empty () || Name != FD->getName ())
5105
- return false ;
5106
-
5107
- const DeclContext *DC = FD->getDeclContext ();
5108
- if (DC->isTranslationUnit ())
5109
- return false ;
5110
-
5111
- std::array<DeclContextDesc, 2 > ScopesSycl = {
5112
- Util::MakeDeclContextDesc (Decl::Kind::Namespace, " cl" ),
5113
- Util::MakeDeclContextDesc (Decl::Kind::Namespace, " sycl" )};
5114
- std::array<DeclContextDesc, 5 > ScopesOneapiExp = {
5115
- Util::MakeDeclContextDesc (Decl::Kind::Namespace, " cl" ),
5116
- Util::MakeDeclContextDesc (Decl::Kind::Namespace, " sycl" ),
5117
- Util::MakeDeclContextDesc (Decl::Kind::Namespace, " ext" ),
5118
- Util::MakeDeclContextDesc (Decl::Kind::Namespace, " oneapi" ),
5119
- Util::MakeDeclContextDesc (Decl::Kind::Namespace, " experimental" )};
5120
-
5121
- return matchContext (DC, ScopesSycl) || matchContext (DC, ScopesOneapiExp);
5122
- }
5123
-
5124
5007
bool Util::isAccessorPropertyListType (QualType Ty) {
5125
5008
std::array<DeclContextDesc, 5 > Scopes = {
5126
5009
Util::MakeDeclContextDesc (Decl::Kind::Namespace, " cl" ),
0 commit comments