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: clang/docs/LanguageExtensions.rst
+43Lines changed: 43 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1760,6 +1760,49 @@ references can be used instead of numeric references.
1760
1760
return -1;
1761
1761
}
1762
1762
1763
+
Hard Register Operands for ASM Constraints
1764
+
==========================================
1765
+
1766
+
Clang supports the ability to specify specific hardware registers in inline
1767
+
assembly constraints via the use of curly braces ``{}``.
1768
+
1769
+
Prior to clang-19, the only way to associate an inline assembly constraint
1770
+
with a specific register is via the local register variable feature (`GCC
1771
+
Specifying Registers for Local Variables <https://gcc.gnu.org/onlinedocs/gcc-6.5.0/gcc/Local-Register-Variables.html>`_). However, the local register variable association lasts for the entire
1772
+
scope of the variable.
1773
+
1774
+
Hard register operands will instead only apply to the specific inline ASM
1775
+
statement which improves readability and solves a few other issues experienced
1776
+
by local register variables, such as:
1777
+
1778
+
* function calls might clobber register variables
1779
+
* the constraints for the register operands are superfluous
1780
+
* one register variable cannot be used for 2 different inline
1781
+
assemblies if the value is expected in different hard regs
1782
+
1783
+
The code below is an example of an inline assembly statement using local
0 commit comments