Skip to content

Commit

Permalink
Rewrite of OpenMP region recognition in assembler code
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Hovy committed Sep 18, 2020
1 parent 981e359 commit f2f0876
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions assembler.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ def __getModuleFileNameCandidates(self, moduleName):
return candidates

def __findCalledSubroutines(self, subroutine, filePath):
ompRegEx = re.compile(r'^.*[^a-z0-9_](?P<omp>[a-z0-9_]+\._omp_fn\.\d+).*$', re.IGNORECASE);

openFile = open(filePath);
calls = []
inFunction = False
Expand Down Expand Up @@ -134,12 +136,12 @@ def __findCalledSubroutines(self, subroutine, filePath):
calls.append((SubroutineFullName(callee),) + self.__findLineNumberAndDiscriminator(lines, i))
elif InnerSubroutineName.validInnerSubroutineName(callee):
calls.append((InnerSubroutineName(callee, hostForInnerSubroutines),) + self.__findLineNumberAndDiscriminator(lines, i))
elif line.startswith('leaq\t') and line.find('._omp_fn.') >= 0:
ompRegion = line.replace('leaq\t', '', 1)
parathPos = ompRegion.find('(')
if parathPos >= 0:
ompRegion = ompRegion[:parathPos]
calls += self.__findCalledSubroutines(ompRegion, filePath)
elif callee == 'GOMP_parallel':
lineBefore = lines[i - 1].strip()
ompRegExMatch = ompRegEx.match(lineBefore)
if ompRegExMatch is not None:
ompRegion = ompRegExMatch.group('omp')
calls += self.__findCalledSubroutines(ompRegion, filePath)
openFile.close();
return calls

Expand Down

0 comments on commit f2f0876

Please sign in to comment.