Skip to content

[RFC] Abstract the target endianness with a macro - #21

Open
smaeul wants to merge 1 commit into
openrisc:or1k-masterfrom
smaeul:patch/little-endian-target
Open

[RFC] Abstract the target endianness with a macro#21
smaeul wants to merge 1 commit into
openrisc:or1k-masterfrom
smaeul:patch/little-endian-target

Conversation

@smaeul

@smaeul smaeul commented Jun 19, 2022

Copy link
Copy Markdown
Contributor

In addition to running code on the AR100 in little-endian mode, this is how I tested my little-endian toolchain patches. I'm not sure if this is worth merging in its current state, but at least it documents what parts of the code would need to be changed.


Only a few changes are needed to swap the target instruction endianness.
Most of these places are already conditional on the host endianness, but
the changes are not completely overlapping. Add a macro for the target
endianness so it can be swapped out.

In the future, this choice could come from the config file, but that
requires more refactoring.

Signed-off-by: Samuel Holland samuel@sholland.org

Only a few changes are needed to swap the target instruction endianness.
Most of these places are already conditional on the host endianness, but
the changes are not completely overlapping. Add a macro for the target
endianness so it can be swapped out.

In the future, this choice could come from the config file, but that
requires more refactoring.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Comment thread cpu/common/abstract.h
#endif /* ULONGEST */

/* Endianness convenience macros */
#define TARGET_BIG_ENDIAN

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

To switch this to little endian you just remove this line? I think just adding a comment explaining the purpose of the TARGET_BIG_ENDIAN macro should be good enough.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's right.

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.

2 participants