Skip to content

WIP: fix for avr-rust issue 129 #8

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

Closed
wants to merge 0 commits into from
Closed

WIP: fix for avr-rust issue 129 #8

wants to merge 0 commits into from

Conversation

carlos4242
Copy link

The bug is related to parameter ordering and endianness. (See avr-rust rust-lang#129.)

When a large type can't be legalised, it's broken into smaller types, those are passed as parameters in order based on the endianness of the platform, which is wrong in the case of AVR (at least).

I came up with the rather too radical idea of adding an extra variable to the data layout to reflect this so parameter order is done right. This seems too much because i) as far as I know only AVR is affected by this issue and ii) as far as I know, only one call is known to need this distinction, although we might find more later.

The problem is the legalising is in shared code, without any platform specific hooks that I can work out, but it might be possible to use another one that I don't know about?

To make this fail-safe, the ABI big endian flag defaults to false, just like the main endianness flag, plus by default, if an architecture is marked as big endian in the data layout string ('E'), it will set the ABI endianness flag to big endian too. Then for AVR (and any other platform that needs it), you can add 'K' to the data layout string to specify a big endian ABI.

One other serious problem with this patch is it doesn't work. :) The ABI endian flag is false when the expand node in the legaliser runs. I've tried to debug it and can't figure out why right now. Anyway, it's complete enough for discussion, which is the main thing right now.

@carlos4242
Copy link
Author

carlos4242 commented Feb 19, 2019

Side note: for some weird reason, github is including the previous commit in this PR too, which is unrelated code, please ignore it: that's the patch in AVRISelLowering.cpp and the associated unit test (123).

@carlos4242 carlos4242 closed this Feb 21, 2019
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