Compare commits
12 Commits
ca5174f447
...
79c7008340
| Author | SHA1 | Date | |
|---|---|---|---|
| 79c7008340 | |||
|
|
1855f12a53 | ||
|
|
8399c9d591 | ||
|
|
bc46a7f239 | ||
|
|
f910693788 | ||
|
|
a0bbb6ebf4 | ||
|
|
8d672e01d4 | ||
|
|
a8f7c2ca10 | ||
|
|
ddf848843a | ||
|
|
97f36f64bc | ||
|
|
e95731fdff | ||
|
|
a0a401c42a |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -78,3 +78,4 @@ Sapfor/Sapc++/x64/
|
||||
|
||||
Sapfor/out/
|
||||
Sapfor/_bin/*
|
||||
_bin/*
|
||||
|
||||
111
CMakeLists.txt
111
CMakeLists.txt
@@ -27,6 +27,13 @@ set(libpred_sources projects/libpredictor/src/)
|
||||
set(libpred_include projects/libpredictor/include/)
|
||||
|
||||
include_directories(src)
|
||||
include_directories(src/Utils)
|
||||
include_directories(src/SgUtils)
|
||||
include_directories(src/Distribution)
|
||||
include_directories(src/GraphCall)
|
||||
include_directories(src/GraphLoop)
|
||||
include_directories(src/Transformations/ExpressionSubstitution)
|
||||
|
||||
#Sage lib includes
|
||||
include_directories(${fdvm_include})
|
||||
include_directories(${sage_include_1})
|
||||
@@ -154,40 +161,49 @@ set(PARALLEL_REG src/ParallelizationRegions/ParRegions.cpp
|
||||
src/ParallelizationRegions/resolve_par_reg_conflicts.cpp
|
||||
src/ParallelizationRegions/resolve_par_reg_conflicts.h)
|
||||
|
||||
set(TR_DEAD_CODE src/Transformations/dead_code.cpp
|
||||
src/Transformations/dead_code.h)
|
||||
set(TR_CP src/Transformations/checkpoints.cpp
|
||||
src/Transformations/checkpoints.h)
|
||||
set(TR_VECTOR src/Transformations/array_assign_to_loop.cpp
|
||||
src/Transformations/array_assign_to_loop.h)
|
||||
set(TR_ENDDO_LOOP src/Transformations/enddo_loop_converter.cpp
|
||||
src/Transformations/enddo_loop_converter.h)
|
||||
set(TR_LOOP_NEST src/Transformations/loop_transform.cpp
|
||||
src/Transformations/loop_transform.h)
|
||||
set(TR_LOOP_COMB src/Transformations/loops_combiner.cpp
|
||||
src/Transformations/loops_combiner.h)
|
||||
set(TR_LOOP_SPLIT src/Transformations/loops_splitter.cpp
|
||||
src/Transformations/loops_splitter.h)
|
||||
set(TR_LOOP_UNROLL src/Transformations/loops_unrolling.cpp
|
||||
src/Transformations/loops_unrolling.h)
|
||||
set(TR_PRIV_BR src/Transformations/private_arrays_resizing.cpp
|
||||
src/Transformations/private_arrays_resizing.h)
|
||||
set(TR_PRIV_DEL src/Transformations/private_removing.cpp
|
||||
src/Transformations/private_removing.h)
|
||||
set(TR_SWAP_ARR_DIMS src/Transformations/swap_array_dims.cpp
|
||||
src/Transformations/swap_array_dims.h)
|
||||
set(TR_FUNC_DUP src/Transformations/uniq_call_chain_dup.cpp
|
||||
src/Transformations/uniq_call_chain_dup.h)
|
||||
set(TR_FUNC_PURE src/Transformations/function_purifying.cpp
|
||||
src/Transformations/function_purifying.h)
|
||||
set(TR_GV src/Transformations/fix_common_blocks.cpp
|
||||
src/Transformations/fix_common_blocks.h)
|
||||
set(TR_CONV src/Transformations/convert_to_c.cpp
|
||||
src/Transformations/convert_to_c.h)
|
||||
set(TR_IMPLICIT_NONE src/Transformations/set_implicit_none.cpp
|
||||
src/Transformations/set_implicit_none.h)
|
||||
set(TR_REPLACE_ARRAYS_IN_IO src/Transformations/replace_dist_arrays_in_io.cpp
|
||||
src/Transformations/replace_dist_arrays_in_io.h)
|
||||
set(TR_DEAD_CODE src/Transformations/DeadCodeRemoving/dead_code.cpp
|
||||
src/Transformations/DeadCodeRemoving/dead_code.h)
|
||||
set(TR_CP src/Transformations/CheckPoints/checkpoints.cpp
|
||||
src/Transformations/CheckPoints/checkpoints.h)
|
||||
set(TR_VECTOR src/Transformations/VectorAssignToLoop/array_assign_to_loop.cpp
|
||||
src/Transformations/VectorAssignToLoop/array_assign_to_loop.h)
|
||||
set(TR_ENDDO_LOOP src/Transformations/LoopEndDoConverter/enddo_loop_converter.cpp
|
||||
src/Transformations/LoopEndDoConverter/enddo_loop_converter.h)
|
||||
set(TR_LOOP_NEST src/Transformations/LoopNesting/loop_transform.cpp
|
||||
src/Transformations/LoopNesting/loop_transform.h)
|
||||
set(TR_LOOP_COMB src/Transformations/LoopCombining/loops_combiner.cpp
|
||||
src/Transformations/LoopCombining/loops_combiner.h)
|
||||
set(TR_LOOP_SPLIT src/Transformations/LoopSplitting/loops_splitter.cpp
|
||||
src/Transformations/LoopSplitting/loops_splitter.h)
|
||||
set(TR_LOOP_UNROLL src/Transformations/LoopUnrolling/loops_unrolling.cpp
|
||||
src/Transformations/LoopUnrolling/loops_unrolling.h)
|
||||
set(TR_PRIV_BR src/Transformations/PrivateArrayResizing/private_arrays_resizing.cpp
|
||||
src/Transformations/PrivateArrayResizing/private_arrays_resizing.h)
|
||||
set(TR_PRIV_DEL src/Transformations/PrivateArrayRemoving/private_removing.cpp
|
||||
src/Transformations/PrivateArrayRemoving/private_removing.h)
|
||||
set(TR_SWAP_ARR_DIMS src/Transformations/ArrayDimsSwapping/swap_array_dims.cpp
|
||||
src/Transformations/ArrayDimsSwapping/swap_array_dims.h)
|
||||
set(TR_FUNC_DUP src/Transformations/FunctionDuplication/uniq_call_chain_dup.cpp
|
||||
src/Transformations/FunctionDuplication/uniq_call_chain_dup.h)
|
||||
set(TR_FUNC_PURE src/Transformations/FunctionPurifying/function_purifying.cpp
|
||||
src/Transformations/FunctionPurifying/function_purifying.h)
|
||||
set(TR_GV src/Transformations/GlobalVariables/fix_common_blocks.cpp
|
||||
src/Transformations/GlobalVariables/fix_common_blocks.h)
|
||||
set(TR_CONV src/Transformations/ConvertToC/convert_to_c.cpp
|
||||
src/Transformations/ConvertToC/convert_to_c.h)
|
||||
set(TR_IMPLICIT_NONE src/Transformations/SetImplicitNone/set_implicit_none.cpp
|
||||
src/Transformations/SetImplicitNone/set_implicit_none.h)
|
||||
set(TR_REPLACE_ARRAYS_IN_IO src/Transformations/ReplaceArraysInIO/replace_dist_arrays_in_io.cpp
|
||||
src/Transformations/ReplaceArraysInIO/replace_dist_arrays_in_io.h)
|
||||
set(TR_EXPR_TRANSFORM src/Transformations/ExpressionSubstitution/control_flow_graph_part.cpp
|
||||
src/Transformations/ExpressionSubstitution/expr_transform.cpp
|
||||
src/Transformations/ExpressionSubstitution/expr_transform.h)
|
||||
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(TR_SWAP_OPERATORS src/Transformations/SwapOperators/swap_operators.cpp
|
||||
src/Transformations/SwapOperators/swap_operators.h)
|
||||
|
||||
set(TRANSFORMS
|
||||
${TR_DEAD_CODE}
|
||||
@@ -207,7 +223,11 @@ set(TRANSFORMS
|
||||
${TR_CONV}
|
||||
${TR_PRIV_DEL}
|
||||
${TR_IMPLICIT_NONE}
|
||||
${TR_REPLACE_ARRAYS_IN_IO})
|
||||
${TR_REPLACE_ARRAYS_IN_IO}
|
||||
${TR_EXPR_TRANSFORM}
|
||||
${TR_INLINER}
|
||||
${TR_RENAME_SYMBOLS}
|
||||
${TR_SWAP_OPERATORS})
|
||||
|
||||
set(CFG src/CFGraph/IR.cpp
|
||||
src/CFGraph/IR.h
|
||||
@@ -288,10 +308,6 @@ set(DYNA src/DynamicAnalysis/createParallelRegions.cpp
|
||||
src/DynamicAnalysis/gcov_info.h
|
||||
src/DynamicAnalysis/gCov_parser.cpp
|
||||
src/DynamicAnalysis/gCov_parser_func.h)
|
||||
|
||||
set(EXPR_TRANSFORM src/ExpressionTransform/control_flow_graph_part.cpp
|
||||
src/ExpressionTransform/expr_transform.cpp
|
||||
src/ExpressionTransform/expr_transform.h)
|
||||
|
||||
set(GR_CALL src/GraphCall/graph_calls.cpp
|
||||
src/GraphCall/graph_calls.h
|
||||
@@ -303,18 +319,11 @@ set(GR_LOOP src/GraphLoop/graph_loops_base.cpp
|
||||
src/GraphLoop/graph_loops.h
|
||||
src/GraphLoop/graph_loops_func.h)
|
||||
|
||||
set(INLINER src/Inliner/inliner.cpp
|
||||
src/Inliner/inliner.h)
|
||||
|
||||
set(LOOP_ANALYZER src/LoopAnalyzer/allocations_prepoc.cpp
|
||||
src/LoopAnalyzer/dep_analyzer.cpp
|
||||
src/LoopAnalyzer/loop_analyzer.cpp
|
||||
src/LoopAnalyzer/loop_analyzer.h)
|
||||
|
||||
set(RENAME_SYMBOLS src/RenameSymbols/rename_symbols.cpp
|
||||
src/RenameSymbols/rename_symbols.h)
|
||||
|
||||
|
||||
set(MAIN src/Sapfor.cpp
|
||||
src/Sapfor.h
|
||||
src/SapforData.h
|
||||
@@ -404,12 +413,9 @@ set(SOURCE_EXE
|
||||
${DISTR}
|
||||
${DVMH_REG}
|
||||
${DYNA}
|
||||
${EXPR_TRANSFORM}
|
||||
${GR_CALL}
|
||||
${GR_LOOP}
|
||||
${INLINER}
|
||||
${LOOP_ANALYZER}
|
||||
${RENAME_SYMBOLS}
|
||||
${TRANSFORMS}
|
||||
${PARALLEL_REG}
|
||||
${PRIV}
|
||||
@@ -433,7 +439,7 @@ source_group (CFGraph FILES ${CFG})
|
||||
source_group (CFGraph\\DataFlow FILES ${DATA_FLOW})
|
||||
|
||||
source_group (Transformations\\DeadCodeRemoving FILES ${TR_DEAD_CODE})
|
||||
source_group (Transformations\\ExpressionSubstitution FILES ${EXPR_TRANSFORM})
|
||||
source_group (Transformations\\ExpressionSubstitution FILES ${TR_EXPR_TRANSFORM})
|
||||
source_group (Transformations\\CheckPoints FILES ${TR_CP})
|
||||
source_group (Transformations\\LoopEndDoConverter FILES ${TR_ENDDO_LOOP})
|
||||
source_group (Transformations\\LoopNesting FILES ${TR_LOOP_NEST})
|
||||
@@ -441,17 +447,18 @@ source_group (Transformations\\LoopCombining FILES ${TR_LOOP_COMB})
|
||||
source_group (Transformations\\LoopSplitting FILES ${TR_LOOP_SPLIT})
|
||||
source_group (Transformations\\LoopUnrolling FILES ${TR_LOOP_UNROLL})
|
||||
source_group (Transformations\\FunctionDuplication FILES ${TR_FUNC_DUP})
|
||||
source_group (Transformations\\FunctionInlining FILES ${INLINER})
|
||||
source_group (Transformations\\FunctionInlining FILES ${TR_INLINER})
|
||||
source_group (Transformations\\FunctionPurifying FILES ${TR_FUNC_PURE})
|
||||
source_group (Transformations\\ArrayDimsSwapping FILES ${TR_SWAP_ARR_DIMS})
|
||||
source_group (Transformations\\PrivateArrayResizing FILES ${TR_PRIV_BR})
|
||||
source_group (Transformations\\PrivateArrayRemoving FILES ${TR_PRIV_DEL})
|
||||
source_group (Transformations\\VectorAssignToLoop FILES ${TR_VECTOR})
|
||||
source_group (Transformations\\RenameSymbols FILES ${RENAME_SYMBOLS})
|
||||
source_group (Transformations\\RenameSymbols FILES ${TR_RENAME_SYMBOLS})
|
||||
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})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#define _LEAK_
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "../Utils/SgUtils.h"
|
||||
#include "../Utils/CommonBlock.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
|
||||
#include "dvm.h"
|
||||
#include "IR.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
#include "../Utils/SgUtils.h"
|
||||
#include "../Utils/CommonBlock.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "../ExpressionTransform/expr_transform.h"
|
||||
#include "graph_calls.h"
|
||||
#include "expr_transform.h"
|
||||
|
||||
#include "dvm.h"
|
||||
#include "IR.h"
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
#include "../Utils/SgUtils.h"
|
||||
#include "../Utils/CommonBlock.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "../ExpressionTransform/expr_transform.h"
|
||||
#include "graph_calls.h"
|
||||
#include "expr_transform.h"
|
||||
|
||||
#define PRINT_PROF_INFO 0
|
||||
#define DEBUG_CHECKS 0
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "../Utils/SgUtils.h"
|
||||
#include "../Utils/CommonBlock.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
|
||||
#include "CFGraph.h"
|
||||
#include "IR.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
@@ -22,8 +22,8 @@
|
||||
#include "../Utils/SgUtils.h"
|
||||
#include "../Sapfor.h"
|
||||
#include "../GraphLoop/graph_loops_func.h"
|
||||
#include "../Transformations/loop_transform.h"
|
||||
#include "../ExpressionTransform/expr_transform.h"
|
||||
#include "../Transformations/LoopNesting/loop_transform.h"
|
||||
#include "expr_transform.h"
|
||||
#include "../GraphCall/graph_calls_func.h"
|
||||
|
||||
#include "../Utils/AstWrapper.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "../ParallelizationRegions/ParRegions.h"
|
||||
#include "../Distribution/Arrays.h"
|
||||
#include "../Transformations/loop_transform.h"
|
||||
#include "../Transformations/LoopNesting/loop_transform.h"
|
||||
|
||||
#include "../Utils/errors.h"
|
||||
#include "directive_parser.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "../Utils/errors.h"
|
||||
#include "../Utils/SgUtils.h"
|
||||
#include "../Distribution/Arrays.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
#include "../GraphCall/graph_calls_func.h"
|
||||
#include "../GraphLoop/graph_loops_func.h"
|
||||
#include "remote_access.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "../Distribution/Arrays.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
#include "../GraphLoop/graph_loops.h"
|
||||
#include "../ParallelizationRegions/ParRegions.h"
|
||||
#include "remote_access.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <set>
|
||||
#include <map>
|
||||
@@ -8,12 +8,12 @@
|
||||
#include "../Utils/errors.h"
|
||||
#include "../Utils/utils.h"
|
||||
#include "../GraphLoop/graph_loops_func.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
#include "../GraphCall/graph_calls_func.h"
|
||||
#include "directive_parser.h"
|
||||
#include "../Distribution/DvmhDirective_func.h"
|
||||
#include "../Utils/SgUtils.h"
|
||||
#include "../ExpressionTransform/expr_transform.h"
|
||||
#include "expr_transform.h"
|
||||
|
||||
#include "../CFGraph/CFGraph.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "../Utils/SgUtils.h"
|
||||
#include "../Utils/errors.h"
|
||||
#include "directive_parser.h"
|
||||
#include "../ExpressionTransform/expr_transform.h"
|
||||
#include "expr_transform.h"
|
||||
#include "../LoopAnalyzer/loop_analyzer.h"
|
||||
#include "../DirectiveProcessing/directive_omp_parser.h"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "Array.h"
|
||||
#include "../Utils/errors.h"
|
||||
#include "../Utils/utils.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "Array.h"
|
||||
#include "../Utils/errors.h"
|
||||
#include "../Utils/utils.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
#include "../Utils/SgUtils.h"
|
||||
#include "../DirectiveProcessing/directive_parser.h"
|
||||
#include "../DirectiveProcessing/directive_omp_parser.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "DvmhRegionInserter.h"
|
||||
#include "DvmhRegions/RegionsMerger.h"
|
||||
#include "../VerificationCode/verifications.h"
|
||||
#include "../Transformations/function_purifying.h"
|
||||
#include "../Transformations/FunctionPurifying/function_purifying.h"
|
||||
#include "../LoopAnalyzer/loop_analyzer.h"
|
||||
#include "../DirectiveProcessing/directive_parser.h"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "../GraphCall/graph_calls_func.h"
|
||||
#include "../GraphLoop/graph_loops_func.h"
|
||||
#include "../ExpressionTransform/expr_transform.h"
|
||||
#include "expr_transform.h"
|
||||
#include "../ParallelizationRegions/ParRegions.h"
|
||||
#include "../Utils/SgUtils.h"
|
||||
#include "ReadWriteAnalyzer.h"
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
#include "./createParallelRegions.h"
|
||||
|
||||
#include "../CreateInterTree/CreateInterTree.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
#include "./gcov_info.h"
|
||||
#include "./gCov_parser_func.h"
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "./gcov_info.h"
|
||||
#include "../CreateInterTree/CreateInterTree.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fstream>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "../Utils/json.hpp"
|
||||
#include "../ParallelizationRegions/ParRegions_func.h"
|
||||
#include "../DynamicAnalysis/gCov_parser_func.h"
|
||||
#include "../ExpressionTransform/expr_transform.h"
|
||||
#include "expr_transform.h"
|
||||
#include "../LoopAnalyzer/loop_analyzer.h"
|
||||
#include "../VerificationCode/verifications.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "../Sapfor.h"
|
||||
#include "../GraphCall/graph_calls_func.h"
|
||||
#include "../ParallelizationRegions/ParRegions_func.h"
|
||||
#include "../ExpressionTransform/expr_transform.h"
|
||||
#include "expr_transform.h"
|
||||
|
||||
#include "../Distribution/GraphCSR.h"
|
||||
#include "../Distribution/Arrays.h"
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "../DirectiveProcessing/directive_parser.h"
|
||||
#include "../DynamicAnalysis/gCov_parser_func.h"
|
||||
|
||||
#include "../Transformations/array_assign_to_loop.h"
|
||||
#include "../Transformations/VectorAssignToLoop/array_assign_to_loop.h"
|
||||
|
||||
using std::vector;
|
||||
using std::map;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <tuple>
|
||||
#include <stack>
|
||||
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#if _WIN32 && NDEBUG && __BOOST
|
||||
#include <boost/thread.hpp>
|
||||
@@ -42,13 +42,13 @@ extern int passDone;
|
||||
#include "../ParallelizationRegions/ParRegions_func.h"
|
||||
#include "../DynamicAnalysis/gCov_parser_func.h"
|
||||
|
||||
#include "../ExpressionTransform/expr_transform.h"
|
||||
#include "expr_transform.h"
|
||||
#include "../SageAnalysisTool/depInterfaceExt.h"
|
||||
|
||||
#include "../VisualizerCalls/get_information.h"
|
||||
#include "../VisualizerCalls/SendMessage.h"
|
||||
|
||||
#include "../Transformations/enddo_loop_converter.h"
|
||||
#include "../Transformations/LoopEndDoConverter/enddo_loop_converter.h"
|
||||
|
||||
#include "../DirectiveProcessing/remote_access.h"
|
||||
#include "../DirectiveProcessing/directive_omp_parser.h"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include "../GraphLoop/graph_loops.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
#include "../ParallelizationRegions/ParRegions.h"
|
||||
#include "../SageAnalysisTool/depInterfaceExt.h"
|
||||
#include "../Utils/AstWrapper.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "../GraphCall/graph_calls_func.h"
|
||||
#include "../GraphLoop/graph_loops.h"
|
||||
#include "../Distribution/Distribution.h"
|
||||
#include "../ExpressionTransform/expr_transform.h"
|
||||
#include "expr_transform.h"
|
||||
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "ParRegions.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
#include "../GraphLoop/graph_loops.h"
|
||||
|
||||
void fillRegionLines(SgFile *file, std::vector<ParallelRegion*> ®ions, std::vector<Messages>& messagesForFile, std::vector<LoopGraph*> *loops = NULL, std::vector<FuncInfo*> *funcs = NULL);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -17,8 +17,8 @@
|
||||
#include "../DirectiveProcessing/directive_creator.h"
|
||||
#include "../DirectiveProcessing/insert_directive.h"
|
||||
#include "../Utils/SgUtils.h"
|
||||
#include "../ExpressionTransform/expr_transform.h"
|
||||
#include "../Transformations/function_purifying.h"
|
||||
#include "expr_transform.h"
|
||||
#include "../Transformations/FunctionPurifying/function_purifying.h"
|
||||
|
||||
using std::map;
|
||||
using std::pair;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "ParRegions.h"
|
||||
#include "../Utils/SgUtils.h"
|
||||
#include "../Utils/errors.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
|
||||
void fillRegionIntervals(std::vector<ParallelRegion*> ®ions);
|
||||
void fillRegionArrays(std::vector<ParallelRegion*> ®ions, const std::map<std::string, std::vector<FuncInfo*>> &allFuncInfo, const std::map<std::string, CommonBlock*> &commonBlocks);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "../DirectiveProcessing/directive_parser.h"
|
||||
#include "../Distribution/DvmhDirective.h"
|
||||
#include "../GraphLoop/graph_loops_func.h"
|
||||
#include "../ExpressionTransform/expr_transform.h"
|
||||
#include "expr_transform.h"
|
||||
#include "../LoopAnalyzer/loop_analyzer.h"
|
||||
#include "../CFGraph/CFGraph.h"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
#include "dvm.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
#include "../Utils/json.hpp"
|
||||
|
||||
class ParallelStats
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#define _LEAK_
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
#include "private_analyzer.h"
|
||||
#include "dvm.h"
|
||||
#include "../CFGraph/CFGraph.h"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "dvm.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
|
||||
extern void Private_Vars_Analyzer(SgStatement* start);
|
||||
void PrivateAnalyzer(SgFile *file, std::vector<FuncInfo*> &funcs);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "dvm.h"
|
||||
#include "../Utils/errors.h"
|
||||
#include "../Utils/SgUtils.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
#include "../GraphCall/graph_calls_func.h"
|
||||
|
||||
#include "projectParameters.h"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
#include "../Utils/errors.h"
|
||||
#include "../Utils/utils.h"
|
||||
#include "sage++user.h"
|
||||
|
||||
@@ -15,7 +15,7 @@ extern "C" void removeFromCollection(void *pointer);
|
||||
#endif
|
||||
extern int passDone;
|
||||
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
#include "../Utils/errors.h"
|
||||
#include "../VisualizerCalls/get_information.h"
|
||||
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
#include "ParallelizationRegions/resolve_par_reg_conflicts.h"
|
||||
#include "ParallelizationRegions/expand_extract_reg.h"
|
||||
|
||||
#include "Transformations/replace_dist_arrays_in_io.h"
|
||||
|
||||
#include "Distribution/Distribution.h"
|
||||
#include "Distribution/GraphCSR.h"
|
||||
#include "Distribution/Arrays.h"
|
||||
@@ -56,7 +54,7 @@
|
||||
#include "Distribution/CreateDistributionDirs.h"
|
||||
#include "PrivateAnalyzer/private_analyzer.h"
|
||||
#include "PrivateAnalyzer/private_arrays_search.h"
|
||||
#include "ExpressionTransform/expr_transform.h"
|
||||
#include "expr_transform.h"
|
||||
|
||||
#include "Predictor/PredictScheme.h"
|
||||
#include "Predictor/PredictorModel.h"
|
||||
@@ -72,24 +70,27 @@
|
||||
#include "VisualizerCalls/SendMessage.h"
|
||||
#include "VisualizerCalls/BuildGraph.h"
|
||||
|
||||
#include "Transformations/enddo_loop_converter.h"
|
||||
#include "Transformations/loop_transform.h"
|
||||
#include "Transformations/array_assign_to_loop.h"
|
||||
#include "Transformations/private_arrays_resizing.h"
|
||||
#include "Transformations/loops_splitter.h"
|
||||
#include "Transformations/loops_combiner.h"
|
||||
#include "Transformations/loops_unrolling.h"
|
||||
#include "Transformations/uniq_call_chain_dup.h"
|
||||
#include "Transformations/checkpoints.h"
|
||||
#include "Transformations/swap_array_dims.h"
|
||||
#include "Transformations/function_purifying.h"
|
||||
#include "Transformations/private_removing.h"
|
||||
#include "Transformations/fix_common_blocks.h"
|
||||
#include "Transformations/convert_to_c.h"
|
||||
#include "Transformations/set_implicit_none.h"
|
||||
#include "Transformations/dead_code.h"
|
||||
#include "Transformations/ReplaceArraysInIO/replace_dist_arrays_in_io.h"
|
||||
#include "Transformations/LoopEndDoConverter/enddo_loop_converter.h"
|
||||
#include "Transformations/LoopNesting/loop_transform.h"
|
||||
#include "Transformations/VectorAssignToLoop/array_assign_to_loop.h"
|
||||
#include "Transformations/PrivateArrayResizing/private_arrays_resizing.h"
|
||||
#include "Transformations/LoopSplitting/loops_splitter.h"
|
||||
#include "Transformations/LoopCombining/loops_combiner.h"
|
||||
#include "Transformations/LoopUnrolling/loops_unrolling.h"
|
||||
#include "Transformations/FunctionDuplication/uniq_call_chain_dup.h"
|
||||
#include "Transformations/CheckPoints/checkpoints.h"
|
||||
#include "Transformations/ArrayDimsSwapping/swap_array_dims.h"
|
||||
#include "Transformations/FunctionPurifying/function_purifying.h"
|
||||
#include "Transformations/PrivateArrayRemoving/private_removing.h"
|
||||
#include "Transformations/GlobalVariables/fix_common_blocks.h"
|
||||
#include "Transformations/ConvertToC/convert_to_c.h"
|
||||
#include "Transformations/SetImplicitNone/set_implicit_none.h"
|
||||
#include "Transformations/DeadCodeRemoving/dead_code.h"
|
||||
#include "Transformations/RenameSymbols/rename_symbols.h"
|
||||
#include "Transformations/FunctionInlining/inliner.h"
|
||||
#include "Transformations/SwapOperators/swap_operators.h"
|
||||
|
||||
#include "RenameSymbols/rename_symbols.h"
|
||||
#include "ProjectParameters/projectParameters.h"
|
||||
|
||||
#include "CFGraph/IR.h"
|
||||
@@ -99,8 +100,6 @@
|
||||
#include "CFGraph/live_variable_analysis.h"
|
||||
#include "CFGraph/private_variables_analysis.h"
|
||||
|
||||
#include "Inliner/inliner.h"
|
||||
|
||||
#include "dvm.h"
|
||||
#include "Sapfor.h"
|
||||
#include "Utils/PassManager.h"
|
||||
@@ -949,6 +948,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 == PRIVATE_REMOVING_ANALYSIS)
|
||||
{
|
||||
auto itFound = loopGraph.find(file->filename());
|
||||
@@ -1047,7 +1048,8 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne
|
||||
PRIVATE_REMOVING,
|
||||
PRIVATE_ARRAYS_EXPANSION,
|
||||
PRIVATE_ARRAYS_SHRINKING,
|
||||
REMOVE_DEAD_CODE };
|
||||
REMOVE_DEAD_CODE,
|
||||
SWAP_OPERATORS };
|
||||
|
||||
if ((countOfTransform == 0 || internalExit > 0) && applyFor.find(curr_regime) != applyFor.end())
|
||||
{
|
||||
@@ -2341,6 +2343,7 @@ void runPass(const int curr_regime, const char *proj_name, const char *folderNam
|
||||
case INSERT_NO_DISTR_FLAGS_FROM_GUI:
|
||||
case PRIVATE_REMOVING:
|
||||
case RENAME_INLCUDES:
|
||||
case SWAP_OPERATORS:
|
||||
runAnalysis(*project, curr_regime, true, "", folderName);
|
||||
break;
|
||||
case INLINE_PROCEDURES:
|
||||
|
||||
@@ -122,6 +122,8 @@ enum passes {
|
||||
CREATE_INTER_TREE,
|
||||
INSERT_INTER_TREE,
|
||||
|
||||
SWAP_OPERATORS,
|
||||
|
||||
SHADOW_GROUPING,
|
||||
INLINE_PROCEDURES,
|
||||
FILL_PARALLEL_REG_IR,
|
||||
@@ -317,6 +319,7 @@ static void setPassValues()
|
||||
passNames[CHECK_PAR_REG_DIR] = "CHECK_PAR_REG_DIR";
|
||||
passNames[CREATE_INTER_TREE] = "CREATE_INTER_TREE";
|
||||
passNames[INSERT_INTER_TREE] = "INSERT_INTER_TREE";
|
||||
passNames[SWAP_OPERATORS] = "SWAP_OPERATORS";
|
||||
passNames[CREATE_PARALLEL_REGIONS] = "CREATE_PARALLEL_REGIONS";
|
||||
passNames[PRIVATE_REMOVING_ANALYSIS] = "PRIVATE_REMOVING_ANALYSIS";
|
||||
passNames[PRIVATE_REMOVING] = "PRIVATE_REMOVING";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "../Utils/SgUtils.h"
|
||||
#include "../Utils/utils.h"
|
||||
#include "../ExpressionTransform/expr_transform.h"
|
||||
#include "expr_transform.h"
|
||||
|
||||
#include "checkpoints.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include "dvm.h"
|
||||
#include "acc_analyzer.h"
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#if _WIN32 && NDEBUG && __SPF && __BOOST
|
||||
#include <boost/thread.hpp>
|
||||
@@ -20,7 +20,7 @@ extern int passDone;
|
||||
#include "../ParallelizationRegions/ParRegions.h"
|
||||
#include "../ParallelizationRegions/ParRegions_func.h"
|
||||
#include "../GraphLoop/graph_loops.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
#include "../GraphCall/graph_calls_func.h"
|
||||
#include "../Utils/utils.h"
|
||||
#include "../Utils/SgUtils.h"
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "../Distribution/Distribution.h"
|
||||
#include "../GraphLoop/graph_loops.h"
|
||||
#include "../ParallelizationRegions/ParRegions.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
#include "../Utils/SgUtils.h"
|
||||
|
||||
#include "acc_analyzer.h"
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
@@ -16,9 +16,9 @@
|
||||
#include "../Utils/SgUtils.h"
|
||||
|
||||
#include "uniq_call_chain_dup.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
#include "../GraphCall/graph_calls_func.h"
|
||||
#include "../ExpressionTransform/expr_transform.h"
|
||||
#include "expr_transform.h"
|
||||
#include "../VerificationCode/verifications.h"
|
||||
|
||||
using namespace std;
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "../GraphCall/graph_calls_func.h"
|
||||
#include "inliner.h"
|
||||
#include "../VisualizerCalls/SendMessage.h"
|
||||
#include "../ExpressionTransform/expr_transform.h"
|
||||
#include "expr_transform.h"
|
||||
|
||||
using std::set;
|
||||
using std::map;
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "../Utils/SgUtils.h"
|
||||
#include "../Utils/CommonBlock.h"
|
||||
#include "../Utils/DefUseList.h"
|
||||
#include "ExpressionTransform/expr_transform.h"
|
||||
#include "expr_transform.h"
|
||||
#include "../VerificationCode/verifications.h"
|
||||
#include "../DvmhRegions/DvmhRegionInserter.h"
|
||||
#include "function_purifying.h"
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "../Utils/SgUtils.h"
|
||||
|
||||
#include "../LoopAnalyzer/loop_analyzer.h"
|
||||
#include "../ExpressionTransform/expr_transform.h"
|
||||
#include "expr_transform.h"
|
||||
|
||||
|
||||
struct DeclInfo // for error messages
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "loops_combiner.h"
|
||||
|
||||
#include "../LoopAnalyzer/loop_analyzer.h"
|
||||
#include "../ExpressionTransform/expr_transform.h"
|
||||
#include "expr_transform.h"
|
||||
#include "../Utils/errors.h"
|
||||
#include "../Utils/SgUtils.h"
|
||||
#include <string>
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "../LoopAnalyzer/loop_analyzer.h"
|
||||
#include "../ExpressionTransform/expr_transform.h"
|
||||
#include "expr_transform.h"
|
||||
#include "../Utils/errors.h"
|
||||
#include "../CFGraph/CFGraph.h"
|
||||
#include "../SageAnalysisTool/OmegaForSage/include/lang-interf.h"
|
||||
@@ -3,8 +3,8 @@
|
||||
#include "../Utils/errors.h"
|
||||
#include "../Utils/SgUtils.h"
|
||||
#include "../Utils/utils.h"
|
||||
#include "../ExpressionTransform/expr_transform.h"
|
||||
#include "dead_code.h"
|
||||
#include "expr_transform.h"
|
||||
#include "../DeadCodeRemoving/dead_code.h"
|
||||
|
||||
using std::make_pair;
|
||||
using std::map;
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "Utils/SgUtils.h"
|
||||
#include "RenameSymbols/rename_symbols.h"
|
||||
#include "rename_symbols.h"
|
||||
|
||||
using std::vector;
|
||||
using std::map;
|
||||
@@ -1,11 +1,11 @@
|
||||
#include "replace_dist_arrays_in_io.h"
|
||||
|
||||
#include "../ParallelizationRegions/resolve_par_reg_conflicts.h"
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <ExpressionTransform/expr_transform.h>
|
||||
|
||||
#include "expr_transform.h"
|
||||
#include "../ParallelizationRegions/resolve_par_reg_conflicts.h"
|
||||
|
||||
using std::map;
|
||||
using std::set;
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "../ParallelizationRegions/ParRegions.h"
|
||||
#include "../Utils/SgUtils.h"
|
||||
#include "../Utils/errors.h"
|
||||
#include "../GraphCall/graph_calls.h"
|
||||
#include "graph_calls.h"
|
||||
|
||||
void replaceDistributedArraysInIO(std::vector<ParallelRegion*>& regions,
|
||||
const std::map<std::string, std::vector<FuncInfo*>>& allFuncInfo,
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
353
src/Transformations/SwapOperators/swap_operators.cpp
Normal file
353
src/Transformations/SwapOperators/swap_operators.cpp
Normal file
@@ -0,0 +1,353 @@
|
||||
#include <map>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
#include <queue>
|
||||
#include <iostream>
|
||||
|
||||
#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;
|
||||
|
||||
|
||||
unordered_set<int> loop_tags = {FOR_NODE/*, FORALL_NODE, WHILE_NODE, DO_WHILE_NODE*/};
|
||||
unordered_set<int> importantDepsTags = {FOR_NODE, IF_NODE};
|
||||
unordered_set<int> importantUpdDepsTags = {ELSEIF_NODE};
|
||||
unordered_set<int> importantEndTags = {CONTROL_END};
|
||||
|
||||
|
||||
vector<SAPFOR::IR_Block*> findInstructionsFromOperator(SgStatement* st, vector<SAPFOR::BasicBlock*> Blocks)
|
||||
{
|
||||
vector<SAPFOR::IR_Block*> result;
|
||||
string filename = st -> fileName();
|
||||
for (auto& block: Blocks)
|
||||
{
|
||||
vector<SAPFOR::IR_Block*> instructionsInBlock = block -> getInstructions();
|
||||
for (auto& instruction: instructionsInBlock)
|
||||
{
|
||||
SgStatement* curOperator = instruction -> getInstruction() -> getOperator();
|
||||
if (curOperator -> lineNumber() == st -> lineNumber())
|
||||
result.push_back(instruction);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
vector<SAPFOR::BasicBlock*> findFuncBlocksByFuncStatement(SgStatement *st, map<FuncInfo*, vector<SAPFOR::BasicBlock*>>& FullIR)
|
||||
{
|
||||
vector<SAPFOR::BasicBlock*> result;
|
||||
Statement* forSt = (Statement*)st;
|
||||
for (auto& func: FullIR)
|
||||
{
|
||||
if (func.first -> funcPointer -> getCurrProcessFile() == forSt -> getCurrProcessFile()
|
||||
&& func.first -> funcPointer -> lineNumber() == forSt -> lineNumber())
|
||||
result = func.second;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
map<SgForStmt*, vector<SAPFOR::BasicBlock*>> findAndAnalyzeLoops(SgStatement *st, vector<SAPFOR::BasicBlock*> blocks)
|
||||
{
|
||||
map<SgForStmt*, vector<SAPFOR::BasicBlock*>> result;
|
||||
SgStatement *lastNode = st->lastNodeOfStmt();
|
||||
while (st && st != lastNode)
|
||||
{
|
||||
if (loop_tags.find(st -> variant()) != loop_tags.end())
|
||||
{
|
||||
// part with find statements of loop
|
||||
SgForStmt *forSt = (SgForStmt*)st;
|
||||
SgStatement *loopBody = forSt -> body();
|
||||
SgStatement *lastLoopNode = st->lastNodeOfStmt();
|
||||
// part with find blocks and instructions of loops
|
||||
unordered_set<int> blocks_nums;
|
||||
while (loopBody && loopBody != lastLoopNode)
|
||||
{
|
||||
SAPFOR::IR_Block* IR = findInstructionsFromOperator(loopBody, blocks).front();
|
||||
if (blocks_nums.find(IR -> getBasicBlock() -> getNumber()) == blocks_nums.end())
|
||||
{
|
||||
result[forSt].push_back(IR -> getBasicBlock());
|
||||
blocks_nums.insert(IR -> getBasicBlock() -> getNumber());
|
||||
}
|
||||
loopBody = loopBody -> lexNext();
|
||||
}
|
||||
std::sort(result[forSt].begin(), result[forSt].end());
|
||||
}
|
||||
st = st -> lexNext();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
map<SgStatement*, set<SgStatement*>> AnalyzeLoopAndFindDeps(SgForStmt* forStatement, vector<SAPFOR::BasicBlock*> loopBlocks, map<FuncInfo*, vector<SAPFOR::BasicBlock*>>& FullIR)
|
||||
{
|
||||
map<SgStatement*, set<SgStatement*>> result;
|
||||
for (SAPFOR::BasicBlock* bb: loopBlocks)
|
||||
{
|
||||
map<SAPFOR::Argument*, set<int>> blockReachingDefinitions = bb -> getRD_In();
|
||||
vector<SAPFOR::IR_Block*> instructions = bb -> getInstructions();
|
||||
for (SAPFOR::IR_Block* irBlock: instructions)
|
||||
{
|
||||
// TODO: Think about what to do with function calls and array references. Because there are also dependencies there that are not reflected in RD, but they must be taken into account
|
||||
SAPFOR::Instruction* instr = irBlock -> getInstruction();
|
||||
result[instr -> getOperator()];
|
||||
// take Argument 1 and it's RD and push operators to final set
|
||||
if (instr -> getArg1() != NULL)
|
||||
{
|
||||
SAPFOR::Argument* arg = instr -> getArg1();
|
||||
set<int> prevInstructionsNumbers = blockReachingDefinitions[arg];
|
||||
for (int i: prevInstructionsNumbers)
|
||||
{
|
||||
SAPFOR::Instruction* foundInstruction = getInstructionAndBlockByNumber(FullIR, i).first;
|
||||
if (foundInstruction != NULL)
|
||||
{
|
||||
SgStatement* prevOp = foundInstruction -> getOperator();
|
||||
if (prevOp != forStatement && instr -> getOperator() != forStatement && instr -> getOperator() -> lineNumber() > prevOp -> lineNumber()
|
||||
&& prevOp -> lineNumber() > forStatement -> lineNumber())
|
||||
result[instr -> getOperator()].insert(prevOp);
|
||||
}
|
||||
}
|
||||
}
|
||||
// take Argument 2 (if exists) and it's RD and push operators to final set
|
||||
if (instr -> getArg2() != NULL)
|
||||
{
|
||||
SAPFOR::Argument* arg = instr -> getArg2();
|
||||
set<int> prevInstructionsNumbers = blockReachingDefinitions[arg];
|
||||
for (int i: prevInstructionsNumbers)
|
||||
{
|
||||
SAPFOR::Instruction* foundInstruction = getInstructionAndBlockByNumber(FullIR, i).first;
|
||||
if (foundInstruction != NULL)
|
||||
{
|
||||
SgStatement* prevOp = foundInstruction -> getOperator();
|
||||
if (prevOp != forStatement && instr -> getOperator() != forStatement&& instr -> getOperator() -> lineNumber() > prevOp -> lineNumber()
|
||||
&& prevOp -> lineNumber() > forStatement -> lineNumber())
|
||||
result[instr -> getOperator()].insert(prevOp);
|
||||
}
|
||||
}
|
||||
}
|
||||
// update RD
|
||||
if (instr -> getResult() != NULL)
|
||||
blockReachingDefinitions[instr -> getResult()] = {instr -> getNumber()};
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void buildAdditionalDeps(SgForStmt* forStatement, map<SgStatement*, set<SgStatement*>>& dependencies)
|
||||
{
|
||||
SgStatement* lastNode = forStatement->lastNodeOfStmt();
|
||||
vector<SgStatement*> importantDeps;
|
||||
SgStatement* st = (SgStatement*) forStatement;
|
||||
st = st -> lexNext();
|
||||
SgStatement* logIfOp = NULL;
|
||||
while (st && st != lastNode)
|
||||
{
|
||||
if(importantDeps.size() != 0)
|
||||
{
|
||||
if (st != importantDeps.back())
|
||||
{
|
||||
dependencies[st].insert(importantDeps.back());
|
||||
}
|
||||
}
|
||||
if (logIfOp != NULL)
|
||||
{
|
||||
dependencies[st].insert(logIfOp);
|
||||
logIfOp = NULL;
|
||||
}
|
||||
if (st -> variant() == LOGIF_NODE)
|
||||
{
|
||||
logIfOp = st;
|
||||
}
|
||||
if (importantDepsTags.find(st -> variant()) != importantDepsTags.end())
|
||||
{
|
||||
importantDeps.push_back(st);
|
||||
}
|
||||
if (importantUpdDepsTags.find(st -> variant()) != importantUpdDepsTags.end())
|
||||
{
|
||||
importantDeps.pop_back();
|
||||
importantDeps.push_back(st);
|
||||
}
|
||||
if (importantEndTags.find(st -> variant()) != importantEndTags.end())
|
||||
{
|
||||
if(importantDeps.size() != 0)
|
||||
{
|
||||
importantDeps.pop_back();
|
||||
}
|
||||
}
|
||||
st = st -> lexNext();
|
||||
}
|
||||
}
|
||||
|
||||
struct ReadyOp {
|
||||
SgStatement* stmt;
|
||||
int degree;
|
||||
size_t arrival;
|
||||
ReadyOp(SgStatement* s, int d, size_t a): stmt(s), degree(d), arrival(a) {}
|
||||
};
|
||||
|
||||
struct ReadyOpCompare {
|
||||
bool operator()(const ReadyOp& a, const ReadyOp& b) const {
|
||||
if (a.degree != b.degree)
|
||||
return a.degree > b.degree;
|
||||
else
|
||||
return a.arrival > b.arrival;
|
||||
}
|
||||
};
|
||||
|
||||
vector<SgStatement*> scheduleOperations(const map<SgStatement*, set<SgStatement*>>& dependencies)
|
||||
{
|
||||
// get all statements
|
||||
unordered_set<SgStatement*> allStmtsSet;
|
||||
for (const auto& pair : dependencies)
|
||||
{
|
||||
allStmtsSet.insert(pair.first);
|
||||
for (SgStatement* dep : pair.second)
|
||||
{
|
||||
allStmtsSet.insert(dep);
|
||||
}
|
||||
}
|
||||
vector<SgStatement*> allStmts(allStmtsSet.begin(), allStmtsSet.end());
|
||||
// count deps and build reversed graph
|
||||
unordered_map<SgStatement*, vector<SgStatement*>> graph;
|
||||
unordered_map<SgStatement*, int> inDegree;
|
||||
unordered_map<SgStatement*, int> degree;
|
||||
for (auto op : allStmts)
|
||||
inDegree[op] = 0;
|
||||
// find and remember initial dependencies
|
||||
unordered_set<SgStatement*> dependentStmts;
|
||||
for (const auto& pair : dependencies)
|
||||
{
|
||||
SgStatement* op = pair.first;
|
||||
const auto& deps = pair.second;
|
||||
degree[op] = deps.size();
|
||||
inDegree[op] = deps.size();
|
||||
if (!deps.empty())
|
||||
dependentStmts.insert(op);
|
||||
for (auto dep : deps)
|
||||
graph[dep].push_back(op);
|
||||
}
|
||||
for (SgStatement* op : allStmts)
|
||||
{
|
||||
if (!degree.count(op))
|
||||
{
|
||||
degree[op] = 0;
|
||||
}
|
||||
}
|
||||
// build queues
|
||||
using PQ = priority_queue<ReadyOp, vector<ReadyOp>, ReadyOpCompare>;
|
||||
PQ readyDependent;
|
||||
queue<SgStatement*> readyIndependent;
|
||||
size_t arrivalCounter = 0;
|
||||
for (auto op : allStmts)
|
||||
{
|
||||
if (inDegree[op] == 0)
|
||||
{
|
||||
if (dependentStmts.count(op))
|
||||
{
|
||||
readyDependent.emplace(op, degree[op], arrivalCounter++);
|
||||
}
|
||||
else
|
||||
{
|
||||
readyIndependent.push(op);
|
||||
}
|
||||
}
|
||||
}
|
||||
// main sort algorythm
|
||||
vector<SgStatement*> executionOrder;
|
||||
while (!readyDependent.empty() || !readyIndependent.empty())
|
||||
{
|
||||
SgStatement* current = nullptr;
|
||||
if (!readyDependent.empty())
|
||||
{
|
||||
current = readyDependent.top().stmt;
|
||||
readyDependent.pop();
|
||||
}
|
||||
else
|
||||
{
|
||||
current = readyIndependent.front();
|
||||
readyIndependent.pop();
|
||||
}
|
||||
executionOrder.push_back(current);
|
||||
for (SgStatement* neighbor : graph[current])
|
||||
{
|
||||
inDegree[neighbor]--;
|
||||
if (inDegree[neighbor] == 0) {
|
||||
if (dependentStmts.count(neighbor))
|
||||
{
|
||||
readyDependent.emplace(neighbor, degree[neighbor], arrivalCounter++);
|
||||
}
|
||||
else
|
||||
{
|
||||
readyIndependent.push(neighbor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return executionOrder;
|
||||
}
|
||||
|
||||
void buildNewAST(SgStatement* loop, vector<SgStatement*>& newBody)
|
||||
{
|
||||
SgStatement* endDo = loop->lastNodeOfStmt();
|
||||
SgStatement* st = loop;
|
||||
int lineNum = loop -> lineNumber() + 1;
|
||||
for (int i = 0; i < newBody.size(); i++)
|
||||
{
|
||||
st -> setLexNext(*newBody[i]);
|
||||
st = st -> lexNext();
|
||||
st -> setlineNumber(lineNum);
|
||||
lineNum++;
|
||||
}
|
||||
st -> setLexNext(*endDo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void runSwapOperators(SgFile *file, std::map<std::string, std::vector<LoopGraph*>>& loopGraph, std::map<FuncInfo*, std::vector<SAPFOR::BasicBlock*>>& FullIR, int& countOfTransform)
|
||||
{
|
||||
std::cout << "SWAP_OPERATORS Pass" << std::endl; // to remove
|
||||
countOfTransform += 1; // to remove
|
||||
|
||||
const int funcNum = file -> numberOfFunctions();
|
||||
for (int i = 0; i < funcNum; ++i)
|
||||
{
|
||||
SgStatement *st = file -> functions(i);
|
||||
vector<SAPFOR::BasicBlock*> blocks = findFuncBlocksByFuncStatement(st, FullIR);
|
||||
map<SgForStmt*, vector<SAPFOR::BasicBlock*>> loopsMapping = findAndAnalyzeLoops(st, blocks);
|
||||
for (pair<SgForStmt*, vector<SAPFOR::BasicBlock*>> loopForAnalyze: loopsMapping)
|
||||
{
|
||||
map<SgStatement*, set<SgStatement*>> dependencyGraph = AnalyzeLoopAndFindDeps(loopForAnalyze.first, loopForAnalyze.second, FullIR);
|
||||
// TODO: Write a function that will go through the operators and update all dependencies so that there are no mix-ups and splits inside the semantic blocks (for if, do and may be some other cases)
|
||||
buildAdditionalDeps(loopForAnalyze.first, dependencyGraph);
|
||||
cout << endl;
|
||||
int firstLine = loopForAnalyze.first -> lineNumber();
|
||||
int lastLine = loopForAnalyze.first -> lastNodeOfStmt() -> lineNumber();
|
||||
cout << "LOOP ANALYZE FROM " << firstLine << " TO " << lastLine << " RES" << endl;
|
||||
// for (auto &v: dependencyGraph) {
|
||||
// cout << "OPERATOR: " << v.first -> lineNumber() << " " << v.first -> variant() << "\nDEPENDS ON:" << endl;
|
||||
// if (v.second.size() != 0)
|
||||
// for (auto vv: v.second)
|
||||
// cout << vv -> lineNumber() << " ";
|
||||
// cout << endl;
|
||||
// }
|
||||
vector<SgStatement*> new_order = scheduleOperations(dependencyGraph);
|
||||
cout << "RESULT ORDER:" << endl;
|
||||
for (auto v: new_order)
|
||||
if (v -> lineNumber() > firstLine)
|
||||
cout << v -> lineNumber() << endl;
|
||||
buildNewAST(loopForAnalyze.first, new_order);
|
||||
st = loopForAnalyze.first -> lexNext();
|
||||
while (st != loopForAnalyze.first -> lastNodeOfStmt())
|
||||
{
|
||||
cout << st -> lineNumber() << " " << st -> sunparse() << endl;
|
||||
st = st -> lexNext();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
};
|
||||
6
src/Transformations/SwapOperators/swap_operators.h
Normal file
6
src/Transformations/SwapOperators/swap_operators.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../GraphLoop/graph_loops.h"
|
||||
#include "../../CFGraph/CFGraph.h"
|
||||
|
||||
void runSwapOperators(SgFile *file, std::map<std::string, std::vector<LoopGraph*>>& loopGraph, std::map<FuncInfo*, std::vector<SAPFOR::BasicBlock*>>& FullIR, int& countOfTransform);
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../Utils/leak_detector.h"
|
||||
#include "leak_detector.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "../ParallelizationRegions/ParRegions.h"
|
||||
#include "array_assign_to_loop.h"
|
||||
#include "../Utils/SgUtils.h"
|
||||
#include "../ExpressionTransform/expr_transform.h"
|
||||
#include "expr_transform.h"
|
||||
#include "../GraphCall/graph_calls_func.h"
|
||||
#include "../VerificationCode/verifications.h"
|
||||
|
||||
@@ -212,6 +212,8 @@ void InitPassesDependencies(map<passes, vector<passes>> &passDepsIn, set<passes>
|
||||
|
||||
Pass(BUILD_IR) <= Pass(SUBST_EXPR_RD) <= Pass(SUBST_EXPR_RD_AND_UNPARSE);
|
||||
|
||||
list({BUILD_IR, CALL_GRAPH2}) <= Pass(SWAP_OPERATORS);
|
||||
|
||||
list({ LOOP_ANALYZER_DATA_DIST_S1, SUBST_EXPR_RD } ) <= Pass(PRIVATE_REMOVING_ANALYSIS);
|
||||
list({ PRIVATE_REMOVING_ANALYSIS, REVERT_SUBST_EXPR_RD }) <= Pass(PRIVATE_REMOVING);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user