@@ -2581,32 +2581,6 @@ void LinkageSpecDeclRule::runRule(const MatchFinder::MatchResult &Result) {
25812581 std::make_pair(BeginLocInfo.second, EndLocInfo.second));
25822582}
25832583
2584-
2585- // Rule for FFT enums.
2586- void FFTEnumsRule::registerMatcher(MatchFinder &MF) {
2587- MF.addMatcher(
2588- declRefExpr(
2589- to(enumConstantDecl(matchesName(
2590- "(CUFFT_SUCCESS|CUFFT_INVALID_PLAN|CUFFT_ALLOC_FAILED|CUFFT_"
2591- "INVALID_TYPE|CUFFT_INVALID_VALUE|CUFFT_INTERNAL_ERROR|CUFFT_"
2592- "EXEC_FAILED|CUFFT_SETUP_FAILED|CUFFT_INVALID_SIZE|CUFFT_"
2593- "UNALIGNED_DATA|CUFFT_INCOMPLETE_PARAMETER_LIST|CUFFT_INVALID_"
2594- "DEVICE|CUFFT_PARSE_ERROR|CUFFT_NO_WORKSPACE|CUFFT_NOT_"
2595- "IMPLEMENTED|CUFFT_LICENSE_ERROR|CUFFT_NOT_SUPPORTED)"))))
2596- .bind("FFTConstants"),
2597- this);
2598- }
2599-
2600- void FFTEnumsRule::runRule(const MatchFinder::MatchResult &Result) {
2601- if (const DeclRefExpr *DE =
2602- getNodeAsType<DeclRefExpr>(Result, "FFTConstants")) {
2603- auto *EC = cast<EnumConstantDecl>(DE->getDecl());
2604- emplaceTransformation(new ReplaceStmt(DE, toString(EC->getInitVal(), 10)));
2605- return;
2606- }
2607- }
2608-
2609-
26102584// Rule for CU_JIT enums.
26112585void CU_JITEnumsRule::registerMatcher(MatchFinder &MF) {
26122586 MF.addMatcher(
@@ -13066,88 +13040,6 @@ void RemoveBaseClassRule::runRule(const MatchFinder::MatchResult &Result) {
1306613040 }
1306713041}
1306813042
13069-
13070- // Rule for FFT function calls.
13071- void FFTFunctionCallRule::registerMatcher(MatchFinder &MF) {
13072- auto functionName = [&]() {
13073- return hasAnyName("cufftPlan1d", "cufftPlan2d", "cufftPlan3d",
13074- "cufftPlanMany", "cufftMakePlan1d", "cufftMakePlan2d",
13075- "cufftMakePlan3d", "cufftMakePlanMany",
13076- "cufftMakePlanMany64", "cufftExecC2C", "cufftExecR2C",
13077- "cufftExecC2R", "cufftExecZ2Z", "cufftExecZ2D",
13078- "cufftExecD2Z", "cufftCreate", "cufftDestroy",
13079- "cufftSetStream", "cufftGetVersion", "cufftGetProperty",
13080- "cufftXtMakePlanMany", "cufftXtExec", "cufftGetSize1d",
13081- "cufftGetSize2d", "cufftGetSize3d", "cufftGetSizeMany",
13082- "cufftGetSize", "cufftEstimate1d", "cufftEstimate2d",
13083- "cufftEstimate3d", "cufftEstimateMany",
13084- "cufftSetAutoAllocation", "cufftGetSizeMany64",
13085- "cufftSetWorkArea");
13086- };
13087- MF.addMatcher(callExpr(callee(functionDecl(functionName()))).bind("FuncCall"),
13088- this);
13089-
13090- // Currently, only exec functions support function pointer migration
13091- auto execFunctionName = [&]() {
13092- return hasAnyName("cufftExecC2C", "cufftExecR2C", "cufftExecC2R",
13093- "cufftExecZ2Z", "cufftExecZ2D", "cufftExecD2Z");
13094- };
13095- MF.addMatcher(unaryOperator(hasOperatorName("&"),
13096- hasUnaryOperand(declRefExpr(hasDeclaration(
13097- functionDecl(execFunctionName())))))
13098- .bind("FuncPtr"),
13099- this);
13100- }
13101-
13102- void FFTFunctionCallRule::runRule(const MatchFinder::MatchResult &Result) {
13103- const CallExpr *CE = getNodeAsType<CallExpr>(Result, "FuncCall");
13104- const UnaryOperator *UO = getNodeAsType<UnaryOperator>(Result, "FuncPtr");
13105-
13106- if (!CE) {
13107- auto TM = processFunctionPointer(UO);
13108- if (TM) {
13109- emplaceTransformation(TM);
13110- }
13111- return;
13112- }
13113-
13114- auto &SM = DpctGlobalInfo::getSourceManager();
13115- if (!CE->getDirectCallee())
13116- return;
13117- std::string FuncName =
13118- CE->getDirectCallee()->getNameInfo().getName().getAsString();
13119-
13120- if (FuncName == "cufftGetVersion" || FuncName == "cufftGetProperty") {
13121- DpctGlobalInfo::getInstance().insertHeader(
13122- SM.getExpansionLoc(CE->getBeginLoc()), HT_DPCT_COMMON_Utils);
13123- ExprAnalysis EA(CE);
13124- emplaceTransformation(EA.getReplacement());
13125- EA.applyAllSubExprRepl();
13126- return;
13127- } else if (FuncName == "cufftSetStream" ||
13128- FuncName == "cufftCreate" || FuncName == "cufftDestroy" ||
13129- FuncName == "cufftPlan1d" || FuncName == "cufftMakePlan1d" ||
13130- FuncName == "cufftPlan2d" || FuncName == "cufftMakePlan2d" ||
13131- FuncName == "cufftPlan3d" || FuncName == "cufftMakePlan3d" ||
13132- FuncName == "cufftPlanMany" || FuncName == "cufftMakePlanMany" ||
13133- FuncName == "cufftMakePlanMany64" || FuncName == "cufftXtMakePlanMany" ||
13134- FuncName == "cufftExecC2C" || FuncName == "cufftExecZ2Z" ||
13135- FuncName == "cufftExecC2R" || FuncName == "cufftExecR2C" ||
13136- FuncName == "cufftExecZ2D" || FuncName == "cufftExecD2Z" ||
13137- FuncName == "cufftXtExec" || FuncName == "cufftGetSize1d" ||
13138- FuncName == "cufftGetSize2d" || FuncName == "cufftGetSize3d" ||
13139- FuncName == "cufftGetSizeMany" || FuncName == "cufftGetSize" ||
13140- FuncName == "cufftEstimate1d" || FuncName == "cufftEstimate2d" ||
13141- FuncName == "cufftEstimate3d" || FuncName == "cufftEstimateMany" ||
13142- FuncName == "cufftSetAutoAllocation" || FuncName == "cufftGetSizeMany64" ||
13143- FuncName == "cufftSetWorkArea") {
13144- ExprAnalysis EA(CE);
13145- emplaceTransformation(EA.getReplacement());
13146- EA.applyAllSubExprRepl();
13147- return;
13148- }
13149- }
13150-
1315113043void VirtualMemRule::registerMatcher(ast_matchers::MatchFinder &MF) {
1315213044 auto virtualmemoryAPI = [&]() {
1315313045 return hasAnyName("cuMemCreate", "cuMemAddressReserve", "cuMemMap",
0 commit comments