From b298cc03bf077b692b48c71fae6f7265a869f4eb Mon Sep 17 00:00:00 2001 From: Alexander Date: Mon, 2 Jun 2025 08:54:45 +0300 Subject: [PATCH] moved to transformations --- CMakeLists.txt | 12 ++++++------ src/Sapfor.cpp | 8 +++----- .../SwapOperators/swap_operators.cpp} | 16 ++++++++-------- .../SwapOperators/swap_operators.h} | 4 ++-- 4 files changed, 19 insertions(+), 21 deletions(-) rename src/{SwapOperators/swapOperators.cpp => Transformations/SwapOperators/swap_operators.cpp} (97%) rename src/{SwapOperators/swapOperators.h => Transformations/SwapOperators/swap_operators.h} (72%) diff --git a/CMakeLists.txt b/CMakeLists.txt index e6fce13..015856a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -203,8 +203,8 @@ set(TR_INLINER src/Transformations/FunctionInlining/inliner.cpp src/Transformations/FunctionInlining/inliner.h) set(TR_RENAME_SYMBOLS src/Transformations/RenameSymbols/rename_symbols.cpp src/Transformations/RenameSymbols/rename_symbols.h) -SET(SWAP_OPERATORS src/SwapOperators/swapOperators.cpp - src/SwapOperators/swapOperators.h) +SET(TR_SWAP_OPERATORS src/Transformations/SwapOperators/swap_operators.cpp + src/Transformations/SwapOperators/swap_operators.h) set(TRANSFORMS ${TR_DEAD_CODE} @@ -227,7 +227,8 @@ set(TRANSFORMS ${TR_REPLACE_ARRAYS_IN_IO} ${TR_EXPR_TRANSFORM} ${TR_INLINER} - ${TR_RENAME_SYMBOLS}) + ${TR_RENAME_SYMBOLS} + ${TR_SWAP_OPERATORS}) set(CFG src/CFGraph/IR.cpp src/CFGraph/IR.h @@ -434,8 +435,7 @@ set(SOURCE_EXE ${ZLIB} ${GR_LAYOUT} ${PR_PARAM} - ${PROJ_MAN} - ${SWAP_OPERATORS}) + ${PROJ_MAN}) add_executable(Sapfor_F ${SOURCE_EXE}) source_group (CFGraph FILES ${CFG}) @@ -461,6 +461,7 @@ source_group (Transformations\\GlobalVariables FILES ${TR_GV}) source_group (Transformations\\ConvertToC FILES ${TR_CONV}) source_group (Transformations\\SetImplicitNone FILES ${TR_IMPLICIT_NONE}) source_group (Transformations\\ReplaceArraysInIO FILES ${TR_REPLACE_ARRAYS_IN_IO}) +source_group (Transformations\\SwapOperators FILES ${TR_SWAP_OPERATORS}) source_group (CreateIntervals FILES ${CREATE_INTER_T}) @@ -479,7 +480,6 @@ source_group (Utils FILES ${UTILS}) source_group (VerificationCode FILES ${VERIF}) source_group (ProjectParameters FILES ${PR_PARAM}) source_group (ProjectManipulation FILES ${PROJ_MAN}) -source_group (SwapOperators FILES ${SWAP_OPERATORS}) source_group (VisualizerCalls FILES ${VS_CALLS}) source_group (VisualizerCalls\\GraphLayout FILES ${GR_LAYOUT}) diff --git a/src/Sapfor.cpp b/src/Sapfor.cpp index 6731c47..afce70a 100644 --- a/src/Sapfor.cpp +++ b/src/Sapfor.cpp @@ -89,7 +89,7 @@ #include "Transformations/DeadCodeRemoving/dead_code.h" #include "Transformations/RenameSymbols/rename_symbols.h" #include "Transformations/FunctionInlining/inliner.h" -#include "SwapOperators/swapOperators.h" +#include "Transformations/SwapOperators/swap_operators.h" #include "ProjectParameters/projectParameters.h" @@ -940,10 +940,8 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne internalExit = err; } } - else if (curr_regime == SWAP_OPERATORS) - { - runSwapOperators(file, loopGraph, fullIR, countOfTransform); - } + else if (curr_regime == SWAP_OPERATORS) + runSwapOperators(file, loopGraph, fullIR, countOfTransform); else if (curr_regime == PRIVATE_REMOVING_ANALYSIS) { auto itFound = loopGraph.find(file->filename()); diff --git a/src/SwapOperators/swapOperators.cpp b/src/Transformations/SwapOperators/swap_operators.cpp similarity index 97% rename from src/SwapOperators/swapOperators.cpp rename to src/Transformations/SwapOperators/swap_operators.cpp index 4985c43..162624f 100644 --- a/src/SwapOperators/swapOperators.cpp +++ b/src/Transformations/SwapOperators/swap_operators.cpp @@ -4,14 +4,14 @@ #include #include -#include "../Utils/errors.h" -#include "../Utils/SgUtils.h" -#include "../GraphCall/graph_calls.h" -#include "../GraphCall/graph_calls_func.h" -#include "../CFGraph/CFGraph.h" -#include "../CFGraph/IR.h" -#include "../GraphLoop/graph_loops.h" -#include "swapOperators.h" +#include "../../Utils/errors.h" +#include "../../Utils/SgUtils.h" +#include "../../GraphCall/graph_calls.h" +#include "../../GraphCall/graph_calls_func.h" +#include "../../CFGraph/CFGraph.h" +#include "../../CFGraph/IR.h" +#include "../../GraphLoop/graph_loops.h" +#include "swap_operators.h" using namespace std; diff --git a/src/SwapOperators/swapOperators.h b/src/Transformations/SwapOperators/swap_operators.h similarity index 72% rename from src/SwapOperators/swapOperators.h rename to src/Transformations/SwapOperators/swap_operators.h index b66152f..a23add9 100644 --- a/src/SwapOperators/swapOperators.h +++ b/src/Transformations/SwapOperators/swap_operators.h @@ -1,6 +1,6 @@ #pragma once -#include "../GraphLoop/graph_loops.h" -#include "../CFGraph/CFGraph.h" +#include "../../GraphLoop/graph_loops.h" +#include "../../CFGraph/CFGraph.h" void runSwapOperators(SgFile *file, std::map>& loopGraph, std::map>& FullIR, int& countOfTransform);