You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/attributes/codegen.md
+35-8Lines changed: 35 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,10 @@ function where it is defined.
32
32
> internal heuristics. Incorrectly inlining functions can make the program
33
33
> slower, so this attribute should be used with care.
34
34
35
+
r[attributes.codegen.inline.syntax]
36
+
The `inline` attribute uses either [_MetaWord_] syntax (for the default form), or [_MetaListIdents_] syntax.
37
+
When using [_MetaListIdents_] form, only a single ident is permitted.
38
+
35
39
r[attributes.codegen.inline.modes]
36
40
There are three ways to use the inline attribute:
37
41
@@ -48,25 +52,46 @@ There are three ways to use the inline attribute:
48
52
49
53
r[attributes.codegen.cold]
50
54
55
+
r[attributes.codegen.cold.intro]
51
56
The *`cold`[attribute]* suggests that the attributed function is unlikely to
52
57
be called.
53
58
59
+
> [!NOTE]
60
+
> In particular, it indicates that branches that lead to such a call are unlikely to be taken.
61
+
62
+
r[attributes.codegen.cold.syntax]
63
+
The `cold` attribute uses the [_MetaWord_] syntax.
64
+
54
65
## The `no_builtins` attribute
55
66
56
67
r[attributes.codegen.no_builtins]
57
68
69
+
r[attributes.codegen.no_builtins.intro]
58
70
The *`no_builtins`[attribute]* may be applied at the crate level to disable
59
71
optimizing certain code patterns to invocations of library functions that are
60
72
assumed to exist.
61
73
74
+
> [!NOTE]
75
+
> Such library functions may include, but are not limited to, C routines such as `memcpy` or `memset`.
76
+
77
+
> [!WARN]
78
+
> A crate using `no_builtins` does not guarantee that the crate will be free from calls to such functions, even if it does not call the routines explicit.
79
+
> For example, the standard library implementation may still call such functions.
80
+
81
+
r[attributes.codegen.no_builtins.syntax]
82
+
The `no_builtins` attribute uses the [_MetaWord_] syntax.
83
+
62
84
## The `target_feature` attribute
63
85
64
86
r[attributes.codegen.target_feature]
65
87
66
88
r[attributes.codegen.target_feature.intro]
67
89
The *`target_feature`[attribute]* may be applied to a function to
68
90
enable code generation of that function for specific platform architecture
69
-
features. It uses the [_MetaListNameValueStr_] syntax with a single key of
91
+
features.
92
+
93
+
r[attributes.codegen.target_feature.syntax]
94
+
The `target_feature` attribute uses the [_MetaListNameValueStr_] syntax with a single key of
70
95
`enable` whose value is a string of comma-separated feature names to enable.
71
96
72
97
```rust
@@ -182,7 +207,6 @@ Reference Manual], or elsewhere on [developer.arm.com].
182
207
> or disabled together if used:
183
208
> -`paca` and `pacg`, which LLVM currently implements as one feature.
It is a compilation error to use the `instruction_set` attribute on a target that does not support it.
500
522
@@ -519,3 +541,8 @@ Using the `instruction_set` attribute has the following effects:
519
541
520
542
* 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.
521
543
* Any inline assembly in the function must use the specified instruction set instead of the target default.
0 commit comments