Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions slothy/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"""
SLOTHY configuration
"""

import shutil

from copy import deepcopy

Expand Down Expand Up @@ -143,7 +143,19 @@ def selftest(self):

This is so far implemented as a repeated randomized test -- nothing clever.
"""
return self._selftest
selftest_enabled = self._selftest
if None in [
shutil.which(tool) for tool in ["llvm-mc", "llvm-nm", "llvm-readobj"]
]:
self.logger.warning(
(
"LLVM (llvm-mc, llvm-nm, llvm-readobj) not found, "
"disabling selftest. Consider installing LLVM."
)
)
selftest_enabled = False

return selftest_enabled

@property
def selftest_iterations(self):
Expand Down Expand Up @@ -1294,11 +1306,12 @@ def rename_hint_orig_rename(self, val):
def order_hint_orig_order(self, val):
self._order_hint_orig_order = val

def __init__(self, Arch, Target):
def __init__(self, Arch, Target, logger):
super().__init__()

self._arch = Arch
self._target = Target
self.logger = logger

self._sw_pipelining = Config.SoftwarePipelining()
self._constraints = Config.Constraints()
Expand Down
4 changes: 3 additions & 1 deletion slothy/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1606,8 +1606,10 @@ def __init__(
self, Arch: any, Target: any, *, logger: any = None, config: any = None
):
super().__init__()
self.config = config if config is not None else Config(Arch, Target)
self.logger = logger if logger is not None else logging.getLogger("slothy")
self.config = (
config if config is not None else Config(Arch, Target, self.logger)
)
self.logger.input = self.logger.getChild("input")
self.logger.config = self.logger.getChild("config")
self.logger.result = self.logger.getChild("result")
Expand Down
4 changes: 2 additions & 2 deletions slothy/core/slothy.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ def _get_target(self):
target = property(_get_target)

def __init__(self, arch, target, logger=None):
self.config = Config(arch, target)

# Configure default logging to stdout if no handlers are configured
if logger is None:
root_logger = logging.getLogger()
Expand All @@ -108,6 +106,8 @@ def __init__(self, arch, target, logger=None):
else:
self.logger = logger

self.config = Config(arch, target, logger=logger)

# The source, once loaded, is represented as a list of strings
self._source = None
self._original_source = None
Expand Down