Emit facts for target compatibility directly
This is just a simplification, and it doesn't seem to affect performance in any way.
This commit is contained in:
parent
617f44f9ed
commit
cc9e6c4578
@ -1820,8 +1820,10 @@ 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))
|
||||
# Code for ancestor can run on target
|
||||
for ancestor in 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
|
||||
@ -1832,10 +1834,10 @@ def target_defaults(self, specs):
|
||||
i += 1
|
||||
else:
|
||||
self.default_targets.append((100, target.name))
|
||||
|
||||
self.default_targets = list(sorted(set(self.default_targets)))
|
||||
self.gen.newline()
|
||||
|
||||
self.default_targets = list(sorted(set(self.default_targets)))
|
||||
|
||||
def virtual_providers(self):
|
||||
self.gen.h2("Virtual providers")
|
||||
msg = (
|
||||
|
@ -816,18 +816,7 @@ 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
|
||||
% 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)
|
||||
|
Loading…
Reference in New Issue
Block a user