Skip to content

Commit 188499d

Browse files
authored
Update codegen.md
1 parent a38bdf7 commit 188499d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/attributes/codegen.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,10 @@ It uses the [_MetaListPath_] syntax, and a path comprised of the architecture fa
361361

362362
[_MetaListPath_]: ../attributes.md#meta-item-attribute-syntax
363363

364+
It is a compilation error to use the `instruction_set` attribute on a target that does not support it.
365+
366+
### On ARM
367+
364368
For the `ARMv4T` and `ARMv5te` architectures, the following are supported:
365369

366370
* `arm::a32` - Generate the function as A32 "ARM" code.
@@ -375,9 +379,7 @@ fn foo_arm_code() {}
375379
fn bar_thumb_code() {}
376380
```
377381

378-
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.
379-
This ends up creating a limitation to how often code is inlined:
382+
Using the `instruction_set` attribute has the following effects:
380383

381-
* If a function has an `instruction_set` attribute it won't inline into a function of another instruction set.
382-
* 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.
383-
* Otherwise, inlining happens normally.
384+
* If the address of the function is taken as a function pointer, the low bit of the address will be set to 0 (arm) or 1 (thumb) depending on the instruction set.
385+
* Any inline assembly in the function must use the specified instruction set instead of the target default.

0 commit comments

Comments
 (0)