Skip to content

Commit 2121187

Browse files
TylerMSFTTylerMSFT
authored andcommitted
draft /voltilemetadata
1 parent 0284663 commit 2121187

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed

docs/build/reference/compiler-options-listed-alphabetically.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ This table contains an alphabetical list of compiler options. For a list of comp
196196
| [`/vmv`](vmm-vms-vmv-general-purpose-representation.md) | Declares virtual inheritance. |
197197
| [`/volatile:iso`](volatile-volatile-keyword-interpretation.md) | Acquire/release semantics not guaranteed on volatile accesses. |
198198
| [`/volatile:ms`](volatile-volatile-keyword-interpretation.md) | Acquire/release semantics guaranteed on volatile accesses. |
199-
| `/volatileMetadata` | Generate metadata on volatile memory accesses. |
199+
| [`/volatileMetadata`](volatile.md) | Generate metadata on volatile memory accesses. |
200200
| [`/w`](compiler-option-warning-level.md) | Disable all warnings. |
201201
| [`/W0`, `/W1`, `/W2`, `/W3`, `/W4`](compiler-option-warning-level.md) | Set output warning level. |
202202
| [`/w1<n>`, `/w2<n>`, `/w3<n>`, `/w4<n>`](compiler-option-warning-level.md) | Set warning level for the specified warning. |

docs/build/reference/compiler-options-listed-by-category.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ This article contains a categorical list of compiler options. For an alphabetica
261261
| [`/utf-8`](utf-8-set-source-and-executable-character-sets-to-utf-8.md) | Set source and execution character sets to UTF-8. |
262262
| [`/V`](v-version-number.md) | Deprecated. Sets the version string. |
263263
| [`/validate-charset`](validate-charset-validate-for-compatible-characters.md) | Validate UTF-8 files for only compatible characters. |
264-
| `/volatileMetadata` | Generate metadata on volatile memory accesses. |
264+
| [`/volatileMetadata`](volatile.md) | Generate metadata on volatile memory accesses. |
265265
| [`/Yc`](yc-create-precompiled-header-file.md) | Create *`.PCH`* file. |
266266
| [`/Yd`](yd-place-debug-information-in-object-file.md) | Deprecated. Places complete debugging information in all object files. Use [`/Zi`](z7-zi-zi-debug-information-format.md) instead. |
267267
| [`/Yl`](yl-inject-pch-reference-for-debug-library.md) | Injects a PCH reference when creating a debug library. |

docs/build/reference/volatile.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
description: "Learn more about: /volatilemetadata"
3+
title: "/volatilemetadata (Generate metadata on volatile memory accesses)"
4+
ms.date: 5/28/2024
5+
f1_keywords: ["/volatilemetadata"]
6+
helpviewer_keywords: ["/volatilemetadata", "-volatilemetadata compiler option", "/volatilemetadata compiler option", "volatilemetadata"]
7+
---
8+
# `/volatilemetadata` (Generate metadata on volatile memory accesses)
9+
10+
Generate metadata on volatile memory accesses to improve performance when running x64 code on ARM.
11+
12+
## Syntax
13+
14+
```cpp
15+
/volatilemetdata[-]
16+
```
17+
18+
## Arguments
19+
20+
**`-`**\
21+
Turns off `/volatileMetadata`. This may result in worse performance if your code is run in emulation mode on ARM because the emulator will pessimistically assume that every load/store needs a barrier.
22+
23+
## Remarks
24+
25+
Starting with Visual Studio 2019 16.10, `/volatileMetadata` is on by default when generating x64 code meant to run on ARM. It improves the emulation performance of x64 code on ARM by generating metadata that identifies volatile memory addresses. This metadata can be used by an emulator to improve performance because it then knows which addresses aren't volatile. Without this metadata, the emulator assumes that all addresses are volatile, and uses acquire and release semantics to access them.
26+
27+
One side effect `/volatileMetadata` is you may see `npad` macros in the generated code. This macro expands to a specified number of NOP instructions to create an address to associate with the memory barrier. That address is then recorded in the metadata.
28+
29+
`/volatileMetadata` can be disabled by using `/volatileMetadata-`.
30+
31+
`/volatileMetadata` is ignored when targeting x86.
32+
33+
## Requirements
34+
35+
Visual Studio 16.10 or later.
36+
37+
## See also
38+
39+
[MSVC Compiler Options](compiler-options.md)\
40+
[MSVC Compiler Command-Line Syntax](compiler-command-line-syntax.md)

docs/build/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,8 @@ items:
744744
href: ../build/reference/vmm-vms-vmv-general-purpose-representation.md
745745
- name: /volatile (volatile keyword interpretation)
746746
href: ../build/reference/volatile-volatile-keyword-interpretation.md
747+
- name: /volatilemetadata
748+
href: ../build/reference/volatile.md
747749
- name: /w, /W0, /W1, /W2, /W3, /W4, /w1, /w2, /w3, /w4, /Wall, /wd, /we, /wo, /Wv, /WX (Warning level)
748750
href: ../build/reference/compiler-option-warning-level.md
749751
- name: /WL (Enable one-line diagnostics)

0 commit comments

Comments
 (0)