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

initial Aarch64 support #16554

Merged
merged 1 commit into from
Sep 6, 2024
Merged

initial Aarch64 support #16554

merged 1 commit into from
Sep 6, 2024

Conversation

WalterBright
Copy link
Member

Only works for a trivial function: void foo() { }

This is here mainly to ensure it stays in sync with the master branch as both evolve, and to not break the master.

Added undocumented -arm command line switch to enable it.

@WalterBright WalterBright added WIP Work In Progress - not ready for review or pulling Aarch64 Arm 64 code generator labels Jun 3, 2024
@dlang-bot
Copy link
Contributor

Thanks for your pull request, @WalterBright!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#16554"

Comment on lines 32 to 35
import dmd.backend.code;
import dmd.backend.arm.cod3;
import dmd.backend.x86.code_x86;
Copy link
Member

Choose a reason for hiding this comment

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

I can't see you getting far mixing different architectures like this.

Copy link
Member

@ibuclaw ibuclaw Jun 3, 2024

Choose a reason for hiding this comment

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

In case this comes across as an unactionable comment. To clarify, changes like this make it quite clear that a lot more work needs to go into separation of IR and target modules in the back-end before the introduction of any new architecture can be done (sans this kind of spaghetti imports).

That alone would make introducing any new foreign architecture into dmd more palatable.

Copy link
Member Author

Choose a reason for hiding this comment

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

A good chunk of the code between the two will be identical. It's a balance between having them being totally separate and sharing common code. I don't know just where that balance will be, it will become apparent after I make more progress.

Copy link
Contributor

Choose a reason for hiding this comment

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

Having every architecture depend on every other architecture is not sustainable. Isn't contributing a new architecture hard enough without technical debt like this?

Copy link
Member Author

Choose a reason for hiding this comment

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

It won't be clear where the separation should be until I make much more progress.

compiler/src/dmd/target.d Outdated Show resolved Hide resolved
@WalterBright
Copy link
Member Author

How does disasm86.d, with its last commit 2 weeks ago, suddenly start failing the LDC Ubuntu run of its unittests?

a746142

core.exception.AssertError@src/dmd/backend/x86/disasm86.d(3760): Assertion failure

@WalterBright
Copy link
Member Author

The LDC Ubuntu test is now working again, though I still have made no changes in that direction.

@WalterBright
Copy link
Member Author

The LDC Ubuntu is back to failing again.

@tgehr
Copy link
Contributor

tgehr commented Sep 6, 2024

In target.d:

426 | isX86 = !isX86_64;

Looks wrong.

@WalterBright
Copy link
Member Author

@tgehr the process of setting those variables is an ugly tangle that I had only partially straightened out. I added an assert that it was set up correctly.

@WalterBright
Copy link
Member Author

P.S. I fixed the heisenbug in the disasm86 code.

@WalterBright WalterBright merged commit 01518c3 into dlang:master Sep 6, 2024
41 checks passed
WalterBright added a commit to WalterBright/dmd that referenced this pull request Sep 7, 2024
@tgehr
Copy link
Contributor

tgehr commented Sep 7, 2024

@tgehr the process of setting those variables is an ugly tangle that I had only partially straightened out. I added an assert that it was set up correctly.

isX86 = !isX86_64;
assert(isX86 + isX86_64 + isAArch64 == 1); // there can be only one

This assertion is equivalent to assert(!isAArch64).

thewilsonator pushed a commit to thewilsonator/dmd that referenced this pull request Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Aarch64 Arm 64 code generator Backend glue code, optimizer, code generation WIP Work In Progress - not ready for review or pulling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants