Compare commits

...

1 Commits

Author SHA1 Message Date
Gregory Becker
03084d2ff8 avoid quadratic expansion of targets in the solver 2023-01-12 12:25:15 -08:00
2 changed files with 4 additions and 10 deletions

View File

@@ -1800,8 +1800,9 @@ def target_defaults(self, specs):
for target in candidate_targets:
self.gen.fact(fn.target(target.name))
self.gen.fact(fn.target_family(target.name, target.family.name))
for parent in sorted(target.parents):
self.gen.fact(fn.target_parent(target.name, parent.name))
self.gen.fact(fn.target_compatible(target.name, target.name))
for ancestor in sorted(target.ancestors):
self.gen.fact(fn.target_compatible(target.name, ancestor.name))
# prefer best possible targets; weight others poorly so
# they're not used unless set explicitly

View File

@@ -816,18 +816,11 @@ node_target_compatible(Package, Target)
:- attr("node_target", Package, MyTarget),
target_compatible(Target, MyTarget).
% target_compatible(T1, T2) means code for T2 can run on T1
% NOTE: target_compatible(T1, T2) means code for T2 can run on T1
% This order is dependent -> dependency in the node DAG, which
% is contravariant with the target DAG.
target_compatible(Target, Target) :- target(Target).
target_compatible(Child, Parent) :- target_parent(Child, Parent).
target_compatible(Descendent, Ancestor)
:- target_parent(Target, Ancestor),
target_compatible(Descendent, Target),
target(Target).
#defined target_satisfies/2.
#defined target_parent/2.
% can't use targets on node if the compiler for the node doesn't support them
error(2, "{0} compiler '{2}@{3}' incompatible with 'target={1}'", Package, Target, Compiler, Version)