Skip to content

Make x86_64.rules more usable. - #29

Open
dot-asm wants to merge 2 commits into
fmlab-iis:masterfrom
dot-asm:x86_64.rules
Open

Make x86_64.rules more usable.#29
dot-asm wants to merge 2 commits into
fmlab-iis:masterfrom
dot-asm:x86_64.rules

Conversation

@dot-asm

@dot-asm dot-asm commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Until now we had to remove a bunch of bookeeping instructions to make .cl work. These new rules minimize the need for the said adjustments.

@dot-asm

dot-asm commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Consider suggested

#! re:(?:-?\w+)?\(%r[\w,%]+\)(.+#!.+) = %%EA\1

What I wanted is

#! re:(?:-?\w+)?\(%r[\w,%]+\)(.+#! EA.+) = %%EA\1

but it didn't work. I've traced the issue to the fact [that] the to_zsdl.py invokes instr.applySubst() twice. As in

# Translate instructions
def translate_instrs(tspec, instrs):
  # Apply variable substitutions
  substs, rules = tspec
  for instr in instrs:
    instr.applySubst()
    for lhs, rhs in substs.items():
      instr.dsl = re.sub(lhs, rhs, instr.dsl)
    instr.applySubst()
    ...

I wonder what was the rationale for the first instr.applySubst() call. The reason I ask is because it's the one that prevents the rule with (.+#! EA.+).

Until now we had to remove a bunch of bookeeping instructions to make
.cl work. These new rules minimize the need for the said adjustments.
@dot-asm

dot-asm commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

As for sbb bug in the additional commit. Somehow the rule is actually never invoked. The sbb with memory operand gets handled by sbb $1v, ...' somehow, I'm looking into it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant