Skip to content

Commit df1220c

Browse files
committed
[TSAR, Tfm, Interchange] Refactor and add new checks.
1 parent b2e7f29 commit df1220c

File tree

6 files changed

+520
-542
lines changed

6 files changed

+520
-542
lines changed

include/tsar/Analysis/Memory/DIClientServerInfo.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ struct DIClientServerInfo {
7272
std::function<DIMemory *(DIMemory *)> getMemory = [](DIMemory *M) {
7373
return M;
7474
};
75+
std::function<DIMemory *(DIMemory *)> getClientMemory = [](DIMemory *M) {
76+
return M;
77+
};
7578

7679
/// Alias tree on server or on client or nullptr.
7780
DIAliasTree *DIAT = nullptr;

include/tsar/Support/DiagnosticKinds.td

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,14 @@ def error_expect_function_param : Error<"expected function parameter name">;
186186
def note_record_member_unknown: Error<"record has no member '%0'">;
187187
def note_declared_here: Note<"declared here">;
188188

189+
def warn_disable_loop_interchange: Warning<"disable loop interchange">;
190+
def note_interchange_induction_mismatch: Note<"unable to find an interchangeable loop with the '%0' induction variable">;
191+
def note_interchange_irregular_loop_nest: Note<"irregular loop structure prevents transformation (use the 'nostrict' clause to force transformation)">;
192+
def warn_interchange_not_canonical: Warning<"unable to interchange loop being not in a canonical loop form">;
193+
def warn_interchange_not_perfect: Warning<"unable to interchange not perfectly nested loop">;
194+
def warn_interchange_not_for_loop: Warning<"unable to interchange not for-loop">;
195+
def warn_interchange_dependency: Warning<"unable to interchange loop with data dependencies (use the 'nostrict' clause to force transformation)">;
196+
def warn_interchange_no_analysis: Warning<"absence of analysis results prevents loop interchange (use the 'nostrict' clause to force transformation">;
189197

190198
// Fortran-specific diagnostics.
191199
def warn_fortran_no_execution_part: Warning<"unable to locate execution-part statmenets">;
192-
193-
def warn_interchange_not_canonical: Warning<"expected canonical loop">;
194-
def warn_interchange_not_perfect: Warning<"expected perfect loop">;
195-
def warn_interchange_id_not_found: Warning<"induction not found">;
196-
def warn_interchange_not_forstmt: Warning<"expected for loop">;
197-
def err_interchange_dependency: Error<"loop contains dependence. use 'nostrict' clause to skip this check">;
198-
def warn_interchange_no_analysis: Warning<"loop has no analysis. use 'nostrict' clause to skip this check">;

include/tsar/Transform/Clang/LoopInterchange.h

Lines changed: 0 additions & 16 deletions
This file was deleted.

include/tsar/Transform/Clang/Passes.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ ModulePass * createClangStructureReplacementPass();
8282
/// with separate variables.
8383
void initializeClangStructureReplacementPassPass(PassRegistry &Registry);
8484

85+
/// Create a pass to intergchange loops in a loop nest.
86+
FunctionPass * createClangLoopInterchange();
87+
88+
/// Initialize a pass to intergchange loops in a loop nest.
8589
void initializeClangLoopInterchangePass(PassRegistry &Registry);
86-
ModulePass* createClangLoopInterchange();
8790
}
8891
#endif//TSAR_CLANG_TRANSFORM_PASSES_H

lib/Analysis/Memory/DIClientServerInfo.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ DIClientServerInfo::DIClientServerInfo(llvm::Pass &P, llvm::Function &F) {
6262
auto Itr = MemoryMatcher->find<Origin>(M);
6363
return Itr != MemoryMatcher->end() ? Itr->get<Clone>() : nullptr;
6464
};
65+
getClientMemory = [MemoryMatcher](DIMemory *M) {
66+
assert(M && "Memory must not be null!");
67+
auto Itr = MemoryMatcher->find<Clone>(M);
68+
return Itr != MemoryMatcher->end() ? Itr->get<Origin>() : nullptr;
69+
};
6570
if (auto R = Socket->getAnalysis<
6671
DIEstimateMemoryPass, DIDependencyAnalysisPass>(F)) {
6772
DIAT = &R->value<DIEstimateMemoryPass *>()->getAliasTree();
@@ -131,4 +136,3 @@ DIDependenceSet *DIMemoryClientServerInfo::findFromClient(const Loop &L) const {
131136
}
132137
return nullptr;
133138
}
134-

0 commit comments

Comments
 (0)