kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

commit fabf255b249ab4ee5ddf58854e015c4ec179d5d4
parent ae8d0f623877d8dde6a25d8fe458c6bded4fe37c
Author: Ryan Sepassi <rsepassi@gmail.com>
Date:   Mon,  1 Jun 2026 19:00:17 -0700

cg: drop advertise-but-ignore MemAccess fields (Track 3a, decision #5)

CFREE_CG_MEM_NONTEMPORAL/_INVARIANT and CfreeCgMemAccess.alias_scope/
noalias_scope were never carried into the internal MemAccess or read by any
backend (api_mem_from_access only ever translated VOLATILE). Per Principle 2
(no advertise-but-ignore) and decision #5, remove them now; re-add with a real
internal carrier + backend consumer when there is one. Drop the matching toy
@load/@store/@memcpy access attributes and update the two corpus cases that
used them (behavior unchanged — the flags were already discarded).

Leaves the bitfield rider on CfreeCgMemAccess for Track 3b (which depends on
the Track 7 place model).

Diffstat:
Minclude/cfree/cg.h | 9---------
Mlang/toy/builtins.c | 14--------------
Mtest/toy/cases/123_spec_demo.toy | 2+-
Mtest/toy/cases/63_memory_flags.toy | 4++--
4 files changed, 3 insertions(+), 26 deletions(-)

diff --git a/include/cfree/cg.h b/include/cfree/cg.h @@ -250,13 +250,6 @@ typedef enum CfreeCgMemAccessFlag { /* Access is an externally observable side effect and must not be merged, * removed, or reordered across other volatile accesses. */ CFREE_CG_MEM_VOLATILE = 1u << 0, - /* Streaming/cache hint: the access is unlikely to be reused soon. Targets - * may select non-temporal load/store instructions or ignore the hint. */ - CFREE_CG_MEM_NONTEMPORAL = 1u << 1, - /* The pointed-to contents are known not to change for the relevant program - * region except through this access path. This is stronger than readonly - * object placement and should be set only when the frontend can prove it. */ - CFREE_CG_MEM_INVARIANT = 1u << 2, } CfreeCgMemAccessFlag; typedef struct CfreeCgMemAccess { @@ -264,8 +257,6 @@ typedef struct CfreeCgMemAccess { uint32_t align; /* 0 = natural for type */ uint32_t address_space; /* normally inherited from pointer type */ uint32_t flags; /* CfreeCgMemAccessFlag */ - uint32_t alias_scope; - uint32_t noalias_scope; /* Bit-field metadata. When bit_width != 0 the memop performs a bit-field * access at bit range [bit_offset, bit_offset + bit_width) within a * storage_size-byte container located at the EA. */ diff --git a/lang/toy/builtins.c b/lang/toy/builtins.c @@ -15,10 +15,6 @@ static int toy_parse_mem_flags_tail(ToyParser* p, CfreeCgMemAccess* access) { if (!toy_parse_attr_dot_name(p, &flag)) return 0; if (toy_sym_is(p, flag, "volatile")) access->flags |= CFREE_CG_MEM_VOLATILE; - else if (toy_sym_is(p, flag, "nontemporal")) - access->flags |= CFREE_CG_MEM_NONTEMPORAL; - else if (toy_sym_is(p, flag, "invariant")) - access->flags |= CFREE_CG_MEM_INVARIANT; else { toy_error(p, p->cur.loc, "unknown memory access flag"); return 0; @@ -130,16 +126,6 @@ static int toy_parse_access_group(ToyParser* p, CfreeCgMemAccess* access) { access->address_space = (uint32_t)int_arg; } else if (toy_sym_is(p, name, "volatile")) { access->flags |= CFREE_CG_MEM_VOLATILE; - } else if (toy_sym_is(p, name, "nontemporal")) { - access->flags |= CFREE_CG_MEM_NONTEMPORAL; - } else if (toy_sym_is(p, name, "invariant")) { - access->flags |= CFREE_CG_MEM_INVARIANT; - } else if (toy_sym_is(p, name, "alias_scope")) { - if (!toy_parse_attr_int_arg(p, &int_arg) || int_arg < 0) return 0; - access->alias_scope = (uint32_t)int_arg; - } else if (toy_sym_is(p, name, "noalias_scope")) { - if (!toy_parse_attr_int_arg(p, &int_arg) || int_arg < 0) return 0; - access->noalias_scope = (uint32_t)int_arg; } else { toy_error(p, p->cur.loc, "unknown access entry"); return 0; diff --git a/test/toy/cases/123_spec_demo.toy b/test/toy/cases/123_spec_demo.toy @@ -189,7 +189,7 @@ fn memory_demo(n: Word): Word { src[1] = 22; @memset(dst, 0, n, 8, .volatile); @memcpy(dst, src, n, 8); - @memmove(tmp, dst, n, 8, .nontemporal); + @memmove(tmp, dst, n, 8); return restrict_first(tmp); } diff --git a/test/toy/cases/63_memory_flags.toy b/test/toy/cases/63_memory_flags.toy @@ -5,8 +5,8 @@ fn __user_main(): i64 { src[1] = 2; src[2] = 3; src[3] = 4; - @memcpy(dst, src, 32, 8, .volatile, .nontemporal); - @memset(&dst[1], 0, 8, 8, .invariant); + @memcpy(dst, src, 32, 8, .volatile); + @memset(&dst[1], 0, 8, 8); return dst[0] + dst[1] + dst[2] + dst[3]; }