Skip to content
Merged
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
13 changes: 8 additions & 5 deletions Tools/cases_generator/optimizer_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from stack import Stack, SizeMismatch, UNUSED

DEFAULT_OUTPUT = ROOT / "Python/optimizer_cases.c.h"
DEFAULT_ABSTRACT_INPUT = ROOT / "Python/optimizer_bytecodes.c"
DEFAULT_ABSTRACT_INPUT = (ROOT / "Python/optimizer_bytecodes.c").absolute().as_posix()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is needed because of parser/prettify_filename which works only with an str type.



def validate_uop(override: Uop, uop: Uop) -> None:
Expand Down Expand Up @@ -214,19 +214,22 @@ def generate_tier2_abstract_from_files(
)


arg_parser.add_argument("input", nargs=1, help="Abstract interpreter definition file")
arg_parser.add_argument("input", nargs='*', help="Abstract interpreter definition file")

arg_parser.add_argument(
"base", nargs=argparse.REMAINDER, help="The base instruction definition file(s)"
"base", nargs="*", help="The base instruction definition file(s)"
)

arg_parser.add_argument("-d", "--debug", help="Insert debug calls", action="store_true")

if __name__ == "__main__":
args = arg_parser.parse_args()
if len(args.base) == 0:
args.input.append(DEFAULT_INPUT)
if not args.input:
args.base.append(DEFAULT_INPUT)
args.input.append(DEFAULT_ABSTRACT_INPUT)
else:
args.base.append(args.input[-1])
args.input.pop()
abstract = analyze_files(args.input)
base = analyze_files(args.base)
with open(args.output, "w") as outfile:
Expand Down