]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
target-insns.def: (tag_memory) New pattern.
authorClaudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
Wed, 9 Jul 2025 11:46:38 +0000 (14:46 +0300)
committerClaudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
Tue, 16 Dec 2025 09:18:49 +0000 (11:18 +0200)
Add a new target instruction. Hardware-assisted sanitizers on
architectures providing instructions to tag/untag memory can then
make use of this new instruction pattern. For example, the
memtag-stack sanitizer uses these instructions to tag and untag a
memory granule.

gcc/
* target-insns.def (tag_memory): New target instruction.
* doc/md.texi (tag_memory): Add documentation.

Signed-off-by: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
gcc/doc/md.texi
gcc/target-insns.def

index 86ed4ffe1e8e9eae90af3bcd82feafef9dbb947e..79588762fd38d5e458bed2a31ce616fa91b41920 100644 (file)
@@ -8679,6 +8679,11 @@ the values were equal.
 If this pattern is not defined, then a plain compare pattern and
 conditional branch pattern is used.
 
+@cindex @code{tag_memory} instruction pattern
+This pattern tags an object that begins at the address specified by
+operand 0, has the byte size indicated by the operand 2, and uses the
+tag from operand 1.
+
 @cindex @code{clear_cache} instruction pattern
 @item @samp{clear_cache}
 This pattern, if defined, flushes the instruction cache for a region of
index 59025a20bf7e26e02e05693e4c3098468ab40af0..16e1d8cf565fa33f3a6aeeb45a3bfe00c9ed29ab 100644 (file)
@@ -102,6 +102,7 @@ DEF_TARGET_INSN (stack_protect_combined_test, (rtx x0, rtx x1, rtx x2))
 DEF_TARGET_INSN (stack_protect_test, (rtx x0, rtx x1, rtx x2))
 DEF_TARGET_INSN (store_multiple, (rtx x0, rtx x1, rtx x2))
 DEF_TARGET_INSN (tablejump, (rtx x0, rtx x1))
+DEF_TARGET_INSN (tag_memory, (rtx x0, rtx x1, rtx x2))
 DEF_TARGET_INSN (trap, (void))
 DEF_TARGET_INSN (unique, (void))
 DEF_TARGET_INSN (untyped_call, (rtx x0, rtx x1, rtx x2))