Skip to content

Commit ada40c8

Browse files
committed
rename spin-strict-memory to spin-relax-memory, and document it
1 parent 7d899c3 commit ada40c8

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

backends/asm/outasm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#define IS_FAST_CALL(f) ( (f == 0) || !FuncData(f) || FuncData(f)->convention == FAST_CALL)
3232
#define IS_STACK_CALL(f) ( (f != 0) && FuncData(f)->convention == STACK_CALL)
3333

34-
#define ALL_VARS_ON_STACK(f) ( IS_STACK_CALL(f) || f->force_locals_to_stack || (f->local_address_taken && IsSpinLang(f->language) && !(f->optimize_flags & OPT_SPIN_STRICTMEM)) || f->closure)
34+
#define ALL_VARS_ON_STACK(f) ( IS_STACK_CALL(f) || f->force_locals_to_stack || (f->local_address_taken && IsSpinLang(f->language) && !(f->optimize_flags & OPT_SPIN_RELAXMEM)) || f->closure)
3535
#define ANY_VARS_ON_STACK(f) ( ALL_VARS_ON_STACK(f) || f->stack_local || f->local_address_taken )
3636

3737
#define IS_LEAF(func) ((gl_compress == 0) && ((func)->is_leaf || (FuncData(func) && FuncData(func)->effectivelyLeaf)))

cmdline.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ static FlagTable optflag[] = {
538538
{ "local-reuse", OPT_LOCAL_REUSE},
539539
{ "aggressive-mem", OPT_AGGRESSIVE_MEM},
540540
{ "cold-code", OPT_COLD_CODE},
541-
{ "spin-strict-memory", OPT_SPIN_STRICTMEM},
541+
{ "spin-relax-memory", OPT_SPIN_RELAXMEM},
542542
{ "experimental", OPT_EXPERIMENTAL },
543543
{ "all", OPT_FLAGS_ALL },
544544
};

doc/general.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,10 @@ Moves unlikely code paths (indicated using `__builtin_expect`) to the end of the
468468

469469
This optimization is not currently enabled by any flags. Use it cautiously.
470470

471+
### Relax Spin memory semantics (-Ospin-relax-memory)
472+
473+
Relaxes the Spin memory model. Normally if any local in a Spin function is put on the stack, all of the locals are; this allows for some common Spin idioms involving memory copies assuming that multiple variables may be copied. This option relaxes that and only puts variables on the stack if their addresses are explicitly taken.
474+
471475

472476
## Memory Allocation and Management
473477

frontends/common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ extern int gl_optimize_flags; /* flags for optimization */
193193
#define OPT_AGGRESSIVE_MEM 0x00200000 /* aggressive load/store optimization */
194194
#define OPT_COLD_CODE 0x00400000 /* move cold code to end of function */
195195
#define OPT_MERGE_DUPLICATES 0x00800000 /* merge duplicate functions */
196-
#define OPT_SPIN_STRICTMEM 0x01000000 /* strict memory semantics for Spin */
196+
#define OPT_SPIN_RELAXMEM 0x01000000 /* relax strict memory semantics for Spin */
197197

198198
#define OPT_EXPERIMENTAL 0x80000000 /* gate new or experimental optimizations */
199-
#define OPT_FLAGS_ALL (0xffffffff & ~OPT_SPIN_STRICTMEM)
199+
#define OPT_FLAGS_ALL 0xffffffff
200200

201201
#define OPT_ASM_BASIC (OPT_BASIC_REGS|OPT_BRANCHES|OPT_PEEPHOLE|OPT_CONST_PROPAGATE|OPT_REMOVE_FEATURES|OPT_MAKE_MACROS)
202202

0 commit comments

Comments
 (0)