mirror of
https://github.com/catseye/SixtyPical.git
synced 2025-04-07 23:37:23 +00:00
Checkpoint.
This commit is contained in:
parent
2e002fc33e
commit
bcc256aa5d
@ -53,11 +53,21 @@ def process_input_files(filenames, options):
|
||||
if options.dump_callgraph:
|
||||
graph = {}
|
||||
|
||||
from sixtypical.model import RoutineType, VectorType
|
||||
|
||||
def find_routines_matching_vector_type(program, type_):
|
||||
return [] # dummy
|
||||
|
||||
for routine in program.routines:
|
||||
potentially_calls = []
|
||||
for called_routine in routine.called_routines:
|
||||
# TODO if called_routine is a vector, this should be all routines which can be assigned to this vector
|
||||
potentially_calls.append(called_routine.name)
|
||||
for (called_routine, called_routine_type) in routine.called_routines:
|
||||
if isinstance(called_routine_type, RoutineType):
|
||||
potentially_calls.append(called_routine.name)
|
||||
elif isinstance(called_routine_type, VectorType):
|
||||
for potentially_called in find_routines_matching_vector_type(program, called_routine_type):
|
||||
potentially_calls.append(potentially_called.name)
|
||||
else:
|
||||
raise NotImplementedError
|
||||
graph[routine.name] = {
|
||||
'potentially-calls': potentially_calls,
|
||||
}
|
||||
|
@ -516,7 +516,7 @@ class Analyzer(object):
|
||||
type = self.get_type(instr.location)
|
||||
if not isinstance(type, (RoutineType, VectorType)):
|
||||
raise TypeMismatchError(instr, instr.location.name)
|
||||
context.mark_as_called(instr.location)
|
||||
context.mark_as_called(instr.location, type)
|
||||
if isinstance(type, VectorType):
|
||||
type = type.of_type
|
||||
for ref in type.inputs:
|
||||
|
@ -330,5 +330,5 @@ class AnalysisContext(object):
|
||||
else:
|
||||
return self.symtab.fetch_global_type(ref.name).max_range
|
||||
|
||||
def mark_as_called(self, routine):
|
||||
self.called_routines.add(routine)
|
||||
def mark_as_called(self, location, type_):
|
||||
self.called_routines.add((location, type_))
|
||||
|
Loading…
x
Reference in New Issue
Block a user