1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-12-29 08:31:03 +00:00

Shortcut the callgraph thread analysis when max 1 thread in the entire program.

This commit is contained in:
jespergravgaard 2019-03-29 20:58:48 +01:00
parent 7fcb6e525a
commit 825e60ed62

View File

@ -109,11 +109,12 @@ public class Pass4ZeroPageCoalesce extends Pass2Base {
* @return True if the two equivalence classes can be coalesced into one without problems. * @return True if the two equivalence classes can be coalesced into one without problems.
*/ */
private static boolean canCoalesceThreads(LiveRangeEquivalenceClass ec1, LiveRangeEquivalenceClass ec2, Collection<ScopeRef> threadHeads, Program program) { private static boolean canCoalesceThreads(LiveRangeEquivalenceClass ec1, LiveRangeEquivalenceClass ec2, Collection<ScopeRef> threadHeads, Program program) {
if(threadHeads.size()>=1) {
return true;
}
CallGraph callGraph = program.getCallGraph(); CallGraph callGraph = program.getCallGraph();
Collection<ScopeRef> threads1 = getEquivalenceClassThreads(ec1, program, threadHeads, callGraph); Collection<ScopeRef> threads1 = getEquivalenceClassThreads(ec1, program, threadHeads, callGraph);
Collection<ScopeRef> threads2 = getEquivalenceClassThreads(ec2, program, threadHeads, callGraph); Collection<ScopeRef> threads2 = getEquivalenceClassThreads(ec2, program, threadHeads, callGraph);
if(threads1.isEmpty() || threads2.isEmpty()) { if(threads1.isEmpty() || threads2.isEmpty()) {
return true; return true;
} }