File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -248,6 +248,7 @@ The following is an index of all built-in attributes.
248248 - [ ` no_builtins ` ] — Disables use of certain built-in functions.
249249 - [ ` target_feature ` ] — Configure platform-specific code generation.
250250 - [ ` track_caller ` ] - Pass the parent call location to ` std::panic::Location::caller() ` .
251+ - [ ` instruction_set ` ] - Specify the instruction set used to generate a functions code
251252- Documentation
252253 - ` doc ` — Specifies documentation. See [ The Rustdoc Book] for more
253254 information. [ Doc comments] are transformed into ` doc ` attributes.
@@ -298,6 +299,7 @@ The following is an index of all built-in attributes.
298299[ `global_allocator` ] : runtime.md#the-global_allocator-attribute
299300[ `ignore` ] : attributes/testing.md#the-ignore-attribute
300301[ `inline` ] : attributes/codegen.md#the-inline-attribute
302+ [ `instruction_set` ] : attributes/codegen.md#the-instruction_set-attribute
301303[ `link_name` ] : items/external-blocks.md#the-link_name-attribute
302304[ `link_ordinal` ] : items/external-blocks.md#the-link_ordinal-attribute
303305[ `link_section` ] : abi.md#the-link_section-attribute
Original file line number Diff line number Diff line change @@ -352,3 +352,26 @@ trait object whose methods are attributed.
352352[ `core::intrinsics::caller_location` ] : ../../core/intrinsics/fn.caller_location.html
353353[ `core::panic::Location::caller` ] : ../../core/panic/struct.Location.html#method.caller
354354[ `Location` ] : ../../core/panic/struct.Location.html
355+
356+ ## The ` instruction_set ` attribute
357+
358+ The * ` instruction_set ` attribute* may be applied to a function to enable code generation for a specific
359+ instruction set supported by the target architecture. It uses the [ _ MetaListPath_ ] syntax and a path
360+ comprised of the architecture and instruction set to specify how to generate the code for
361+ architectures where a single program may utilize multiple instruction sets.
362+
363+ The following values are available on targets for the ` ARMv4 ` and ` ARMv5te ` architectures:
364+
365+ * ` arm::a32 ` - Uses ARM code.
366+ * ` arm::t32 ` - Uses Thumb code.
367+
368+ <!-- ignore: arm-only -->
369+ ``` rust,ignore
370+ #[instruction_set(arm::a32)]
371+ fn foo_arm_code() {}
372+
373+ #[instruction_set(arm::t32)]
374+ fn bar_thumb_code() {}
375+ ```
376+
377+ [ _MetaListPath_ ] : ../attributes.md#meta-item-attribute-syntax
You can’t perform that action at this time.
0 commit comments