mirror of
https://github.com/catseye/SixtyPical.git
synced 2024-06-02 18:41:35 +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:
|
if options.dump_callgraph:
|
||||||
graph = {}
|
graph = {}
|
||||||
|
|
||||||
|
from sixtypical.model import RoutineType, VectorType
|
||||||
|
|
||||||
|
def find_routines_matching_vector_type(program, type_):
|
||||||
|
return [] # dummy
|
||||||
|
|
||||||
for routine in program.routines:
|
for routine in program.routines:
|
||||||
potentially_calls = []
|
potentially_calls = []
|
||||||
for called_routine in routine.called_routines:
|
for (called_routine, called_routine_type) in routine.called_routines:
|
||||||
# TODO if called_routine is a vector, this should be all routines which can be assigned to this vector
|
if isinstance(called_routine_type, RoutineType):
|
||||||
potentially_calls.append(called_routine.name)
|
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] = {
|
graph[routine.name] = {
|
||||||
'potentially-calls': potentially_calls,
|
'potentially-calls': potentially_calls,
|
||||||
}
|
}
|
||||||
|
|
|
@ -516,7 +516,7 @@ class Analyzer(object):
|
||||||
type = self.get_type(instr.location)
|
type = self.get_type(instr.location)
|
||||||
if not isinstance(type, (RoutineType, VectorType)):
|
if not isinstance(type, (RoutineType, VectorType)):
|
||||||
raise TypeMismatchError(instr, instr.location.name)
|
raise TypeMismatchError(instr, instr.location.name)
|
||||||
context.mark_as_called(instr.location)
|
context.mark_as_called(instr.location, type)
|
||||||
if isinstance(type, VectorType):
|
if isinstance(type, VectorType):
|
||||||
type = type.of_type
|
type = type.of_type
|
||||||
for ref in type.inputs:
|
for ref in type.inputs:
|
||||||
|
|
|
@ -330,5 +330,5 @@ class AnalysisContext(object):
|
||||||
else:
|
else:
|
||||||
return self.symtab.fetch_global_type(ref.name).max_range
|
return self.symtab.fetch_global_type(ref.name).max_range
|
||||||
|
|
||||||
def mark_as_called(self, routine):
|
def mark_as_called(self, location, type_):
|
||||||
self.called_routines.add(routine)
|
self.called_routines.add((location, type_))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user