Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major changes to HuCC's comparison code-generation. #50

Merged
merged 7 commits into from
Oct 12, 2024

Conversation

jbrandwood
Copy link
Collaborator

These save more time than space, but even then the improvement isn't going to be great.

OTOH, having more comparisons look like something that an asm programmer would write is a positive from my POV.

…st to set

the flags for branching, and the second to convert the flag into a boolean int
that can be stored or used in math.

This allows the second stage I_BOOLEAN i-code to be removed by the peephole if
an integer value is not needed/used.

At the moment this just saves one CLY instruction for most tests, but it could
be more if the test results return the C flag instead of the Z flag as true or
false.
…ments for

the local name rather than the `;` style.

Seperate the /* */ comment a bit further away from the compiler-generated name
so that it is a bit easier to read.
correct the VPC initialization comments in vdc.asm
Uli's attempt to generate byte comparisons has been completely removed from the
code-generation section of the compiler because the SmallC expression code does
not propagate operand size information.

Remove the last of the T_LIB usage of embedded comparison name strings, and use
integer enums instead which make it easier to optimize comparison-ops.

Teach the peephole optimizer how to convert the compare-with-integer operations
into a new i-code that generates faster inline code.

Further optimize unsigned char compare-with-integer operations when they can be
detected.
…memory and

compare-with-stack operations into new i-codes that generate faster inline code.
…ng A and

the Z flag.

This makes most of the common comparison operations a little quicker with the
cost that the rare boolean conversion step is slower and larger when it isn't
removed by the peephole optimizer.

The most common boolean is "var = !var", and this can be optimized separately
in the future.
@jbrandwood jbrandwood merged commit 9281f33 into pce-devel:master Oct 12, 2024
4 checks passed
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