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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "slothy"
version = "0.1.7"
version = "0.1.8"
description = "SLOTHY: Assembly superoptimization via constraint solving"
readme = "README.md"
license = {text = "MIT"}
Expand Down
6 changes: 2 additions & 4 deletions slothy/core/slothy.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,7 @@ def optimize(
body = AsmIfElse.process_instructions(body)
body = SourceLine.apply_indentation(body, indentation)
logger.info("SLOTHY version: %s", self._get_version())
self.logger.info(
"Instructions in body: %d", len([line for line in body if line.has_text()])
)
self.logger.info("Instructions in body: %d", SourceLine.instruction_count(body))

if self.config.with_llvm_mca_before is True:
orig_stats = self._make_llvm_mca_stats(
Expand Down Expand Up @@ -623,7 +621,7 @@ def optimize_loop(
self.logger.info(
"Optimizing loop %s (%d instructions) ...",
loop_lbl,
len([line for line in body if line.has_text()]),
SourceLine.instruction_count(body),
)

if self.config.with_llvm_mca_before is True:
Expand Down
5 changes: 5 additions & 0 deletions slothy/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ def has_text(self):
"""Indicates if the source line constaints some text"""
return self._raw.strip() != ""

@staticmethod
def instruction_count(lines):
"""Count the number of instructions in a list of source lines"""
return len([line for line in lines if line.has_text()])

@property
def indentation(self):
"""Returns the current level of indentation for the source line"""
Expand Down