-
Notifications
You must be signed in to change notification settings - Fork 498
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
Clearly specify the instruction_set
effects
#1307
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3d45616
Clearly specify the instruction_set inlining restrictions
Lokathor df9643a
Update codegen.md
Lokathor 236e014
Update src/attributes/codegen.md
Lokathor a38bdf7
Update src/attributes/codegen.md
Lokathor 188499d
Update codegen.md
Lokathor 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 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 | ||||
---|---|---|---|---|---|---|
|
@@ -355,15 +355,16 @@ trait object whose methods are attributed. | |||||
|
||||||
## The `instruction_set` attribute | ||||||
|
||||||
The *`instruction_set` attribute* may be applied to a function to enable code generation for a specific | ||||||
instruction set supported by the target architecture. It uses the [_MetaListPath_] syntax and a path | ||||||
comprised of the architecture and instruction set to specify how to generate the code for | ||||||
architectures where a single program may utilize multiple instruction sets. | ||||||
The *`instruction_set` [attribute]* may be applied to a function to control which instruction set the function will be generated for. | ||||||
This allows mixing more than one instruction set in a single program on CPU architectures that support it. | ||||||
It uses the [_MetaListPath_] syntax, and a path comprised of the architecture family name and instruction set name. | ||||||
|
||||||
The following values are available on targets for the `ARMv4` and `ARMv5te` architectures: | ||||||
[_MetaListPath_]: ../attributes.md#meta-item-attribute-syntax | ||||||
|
||||||
For the `ARMv4T` and `ARMv5te` architectures, the following are supported: | ||||||
|
||||||
* `arm::a32` - Uses ARM code. | ||||||
* `arm::t32` - Uses Thumb code. | ||||||
* `arm::a32` - Generate the function as A32 "ARM" code. | ||||||
* `arm::t32` - Generate the function as T32 "Thumb" code. | ||||||
|
||||||
<!-- ignore: arm-only --> | ||||||
```rust,ignore | ||||||
|
@@ -374,4 +375,9 @@ fn foo_arm_code() {} | |||||
fn bar_thumb_code() {} | ||||||
``` | ||||||
|
||||||
[_MetaListPath_]: ../attributes.md#meta-item-attribute-syntax | ||||||
If your function has neither the `instruction_set` attribute nor inline assembly, then the code you write within that function should not presume any particular instruction set. | ||||||
This ends up creating a limitation to how often code is inlined: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
* If a function has an `instruction_set` attribute it won't inline into a function of another instruction set. | ||||||
* If a function does not have an `instruction_set` attribute but *does* contain inline assembly, then the inline assembly is assumed to require the default instruction set of the build target, and so inlining between different instruction sets won't happen. | ||||||
* Otherwise, inlining happens normally. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like it's specific to ARM and Thumb; this may not necessarily universally be true for all future uses of |
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.