-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Arm32 thumb2 (Cortex-M) support #13815
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
Open
cpetig
wants to merge
19
commits into
bytecodealliance:main
Choose a base branch
from
cpetig:arm32
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
eab420b
initial arm32 thumb2 skeleton
cpetig d705a58
fix warnings
cpetig 82b91b6
clippy fix
cpetig 97d10f3
return instruction
cpetig 1f2ceba
function epilog
cpetig f0b4e42
working first filetest
cpetig e10ff79
plus test
cpetig 357466c
simplify and fix warnings
cpetig 8cd5c56
simplification
cpetig f680c52
simplify
cpetig d892a09
more simplification
cpetig 71cd8b5
avoid glob imports
cpetig 0ece411
reduce imports
cpetig a131ab8
fix imports
cpetig b2818af
cut down the number of glob re-exports
cpetig c69977e
this is necessary to compile the most simple runtest
cpetig edc576e
standardize on arm32
cpetig 072f983
undo the warning fix for pulley
cpetig 7f6714a
clippy fix
cpetig File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| use crate::cdsl::isa::TargetIsa; | ||
| use crate::cdsl::settings::SettingGroupBuilder; | ||
|
|
||
| pub(crate) fn define() -> TargetIsa { | ||
| let settings = SettingGroupBuilder::new("arm32"); | ||
|
|
||
| // ARM32-specific settings can be added here in the future. | ||
| // For now, we start with an empty settings group. | ||
|
|
||
| TargetIsa::new("arm32", settings.build()) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cg_clif would at the very least need the thumb2 (use thumb2 rather than the original thumb) and thumb-mode (actually use thumb rather than arm instructions) settings to match LLVM. And the current backend you wrote should error when either is not set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree about the erroring part, do you have specific names for the flags in mind so that they are more easily compatible with cg_clif?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess other settings are has_fp32, has_fp64, has_dsp, has_cbz, has_it, hwfloat_abi.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you mean these subtarget flags: https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/ARM/ARMSubtarget.h and https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/TargetParser/Triple.h - but at least thumb vs arm is selected by the target triple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can select between thumb and arm on a per-function basis in LLVM and Rust, so changing the target triple is not the only way of choosing thumb mode.
#[instruction_set(arm::t32)]lowers to what is effectively#[target_feature(enable = "thumb-mode")]in the LLVM backend of rustc. And a couple of rustc targets also usetarget_features: "+thumb-mode"in the target spec.