Skip to content

Commit

Permalink
u
Browse files Browse the repository at this point in the history
  • Loading branch information
SCHREIBER Martin committed Nov 14, 2024
1 parent 92b479e commit a840d35
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 104 deletions.
44 changes: 24 additions & 20 deletions src/psyclone/psyir/nodes/call.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,12 @@ def copy(self):
new_copy._argument_names = new_list

return new_copy

def _get_container_symbols_rec(self,
container_symbols_list:List[str],
_stack_container_name_list:List[str] = [],
_depth:int = 0):

def _get_container_symbols_rec(
self,
container_symbols_list: List[str],
_stack_container_name_list: List[str] = [],
_depth: int = 0):
"""Return a list of all container symbols that can be found
recursively
Expand All @@ -460,7 +461,7 @@ def _get_container_symbols_rec(self,
#
# TODO: This function seems to be extremely slow
#
indent = " "*_depth
# indent = " "*_depth
retlist = container_symbols_list[:]

# Cache the container names from symbols
Expand Down Expand Up @@ -490,15 +491,14 @@ def _get_container_symbols_rec(self,
container.symbol_table.containersymbols,
_stack_container_name_list+[container.name.lower()],
_depth+1)

# Remove duplicates
for r in new_container_symbols:
if r not in retlist:
retlist.append(r)

return retlist


def get_callees(self):
'''
Searches for the implementation(s) of all potential target routines
Expand Down Expand Up @@ -558,8 +558,9 @@ def _location_txt(node):
wildcard_names.append(container_symbol.name)

try:
container: Container = container_symbol.find_container_psyir(
local_node=self)
container: Container = (
container_symbol.find_container_psyir(
local_node=self))
except SymbolError:
container = None

Expand All @@ -570,9 +571,12 @@ def _location_txt(node):

routines = []
for name in container.resolve_routine(rsym.name):
# Allow private imports if an 'interface' has been used
# Allow private imports if an 'interface'
# has been used
allow_private = (name != rsym.name)
psyir = container.find_routine_psyir(name, allow_private=allow_private)
psyir = container.find_routine_psyir(
name,
allow_private=allow_private)
if psyir:
routines.append(psyir)
if routines:
Expand Down Expand Up @@ -666,9 +670,10 @@ class MatchingArgumentsNotFound(BaseException):
for this routine
"""

def get_argument_routine_match( self,
routine: Routine,
check_strict_array_datatype:bool = True):
def get_argument_routine_match(
self,
routine: Routine,
check_strict_array_datatype: bool = True):
"""Return a list of integers giving for each argument of the call
the index of the argument in argument_list (typically of a routine)
Expand Down Expand Up @@ -704,7 +709,6 @@ def get_argument_routine_match( self,
routine_arg = routine_argument_list[call_arg_idx]
routine_arg: DataSymbol


type_matches = False
if not check_strict_array_datatype:
if (isinstance(call_arg.datatype, ArrayType) and
Expand All @@ -714,8 +718,8 @@ def get_argument_routine_match( self,
if not type_matches:
# Do the types of arguments match?
#
# TODO #759: If optional is used, it's an unsupported Fortran
# type and we need to use the following workaround
# TODO #759: If optional is used, it's an unsupported
# Fortran type and we need to use the following workaround
# Once this issue is resolved, simply remove this if branch
if not isinstance(
routine_arg.datatype,
Expand Down Expand Up @@ -822,8 +826,8 @@ def get_callee(

try:
arg_match_list = self.get_argument_routine_match(
routine,
check_strict_array_datatype=check_strict_array_datatype)
routine,
check_strict_array_datatype=check_strict_array_datatype)
except self.MatchingArgumentsNotFound:
continue

Expand Down
6 changes: 5 additions & 1 deletion src/psyclone/psyir/symbols/symbol_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,11 @@ def add(self, new_symbol, tag=None):

self._symbols[key] = new_symbol

def check_for_clashes(self, other_table, symbols_to_skip=(), check_unresolved_symbols=True):
def check_for_clashes(
self,
other_table,
symbols_to_skip=(),
check_unresolved_symbols=True):
'''
Checks the symbols in the supplied table against those in
this table. If there is a name clash that cannot be resolved by
Expand Down
Loading

0 comments on commit a840d35

Please sign in to comment.