Skip to content

Commit 27876af

Browse files
committed
rename stack size primops
1 parent 56870b7 commit 27876af

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

include/shady/primops.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,15 @@
197197
"side-effects": true
198198
},
199199
{
200-
"name": "get_stack_pointer",
200+
"name": "get_stack_size",
201201
"class": "stack"
202202
},
203203
{
204204
"name": "get_stack_base",
205205
"class": "stack"
206206
},
207207
{
208-
"name": "set_stack_pointer",
208+
"name": "set_stack_size",
209209
"class": "stack",
210210
"side-effects": true
211211
},

src/shady/passes/lift_indirect_targets.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static const Node* add_spill_instrs(Context* ctx, BodyBuilder* builder, struct L
6464
bind_instruction(builder, save_instruction);
6565
}
6666

67-
const Node* sp = gen_primop_ce(builder, get_stack_pointer_op, 0, NULL);
67+
const Node* sp = gen_primop_ce(builder, get_stack_size_op, 0, NULL);
6868

6969
return sp;
7070
}
@@ -134,7 +134,7 @@ static LiftedCont* lambda_lift(Context* ctx, const Node* cont, String given_name
134134

135135
// Recover that stuff inside the new body
136136
BodyBuilder* bb = begin_body(a);
137-
gen_primop(bb, set_stack_pointer_op, empty(a), singleton(payload));
137+
gen_primop(bb, set_stack_size_op, empty(a), singleton(payload));
138138
for (size_t i = recover_context_size - 1; i < recover_context_size; i--) {
139139
const Node* ovar = read_list(const Node*, recover_context)[i];
140140
assert(ovar->tag == Variable_TAG);

src/shady/passes/lower_alloca.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static const Node* process(Context* ctx, const Node* node) {
142142
if (!ctx->entry_stack_offset) {
143143
//String tmp_name = format_string_arena(a->arena, "stack_ptr_before_alloca_%s", get_abstraction_name(fun));
144144
String tmp_name = "stack_ptr_before_alloca";
145-
ctx->entry_stack_offset = first(bind_instruction_named(bb, prim_op(a, (PrimOp) { .op = get_stack_pointer_op } ), (String []) { tmp_name }));
145+
ctx->entry_stack_offset = first(bind_instruction_named(bb, prim_op(a, (PrimOp) { .op = get_stack_size_op } ), (String []) { tmp_name }));
146146
}
147147

148148
//const Node* lea_instr = prim_op_helper(a, lea_op, empty(a), mk_nodes(a, rewrite_node(&ctx->rewriter, first(node->payload.prim_op.operands)), found_slot->offset));
@@ -154,7 +154,7 @@ static const Node* process(Context* ctx, const Node* node) {
154154
//bool last = found_slot->i == ctx->num_slots - 1;
155155
//if (last) {
156156
const Node* updated_stack_ptr = gen_primop_e(bb, add_op, empty(a), mk_nodes(a, ctx->entry_stack_offset, ctx->frame_size));
157-
gen_primop(bb, set_stack_pointer_op, empty(a), singleton(updated_stack_ptr));
157+
gen_primop(bb, set_stack_size_op, empty(a), singleton(updated_stack_ptr));
158158
//}
159159

160160
return yield_values_and_wrap_in_block(bb, singleton(slot));

src/shady/passes/lower_stack.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ static const Node* process_let(Context* ctx, const Node* node) {
100100
if (old_instruction->tag == PrimOp_TAG) {
101101
const PrimOp* oprim_op = &old_instruction->payload.prim_op;
102102
switch (oprim_op->op) {
103-
case get_stack_pointer_op: {
103+
case get_stack_size_op: {
104104
assert(ctx->stack);
105105
BodyBuilder* bb = begin_body(a);
106106
const Node* sp = gen_load(bb, ctx->stack_pointer);
107107
return finish_body(bb, let(a, quote_helper(a, singleton(sp)), tail));
108108
}
109-
case set_stack_pointer_op: {
109+
case set_stack_size_op: {
110110
assert(ctx->stack);
111111
BodyBuilder* bb = begin_body(a);
112112
const Node* val = rewrite_node(&ctx->rewriter, oprim_op->operands.nodes[0]);

src/shady/passes/setup_stack_frames.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static const Node* process(Context* ctx, const Node* node) {
3535

3636
BodyBuilder* bb = begin_body(a);
3737
if (!ctx2.disable_lowering) {
38-
ctx2.entry_stack_offset = first(bind_instruction_named(bb, prim_op(a, (PrimOp) { .op = get_stack_pointer_op } ), (String []) {format_string_arena(a->arena, "saved_stack_ptr_entering_%s", get_abstraction_name(fun)) }));
38+
ctx2.entry_stack_offset = first(bind_instruction_named(bb, prim_op(a, (PrimOp) { .op = get_stack_size_op } ), (String []) {format_string_arena(a->arena, "saved_stack_ptr_entering_%s", get_abstraction_name(fun)) }));
3939
}
4040
if (node->payload.fun.body)
4141
fun->payload.fun.body = finish_body(bb, rewrite_node(&ctx2.rewriter, node->payload.fun.body));
@@ -49,7 +49,7 @@ static const Node* process(Context* ctx, const Node* node) {
4949
assert(ctx->entry_stack_offset);
5050
// Restore SP before calling exit
5151
bind_instruction(bb, prim_op(a, (PrimOp) {
52-
.op = set_stack_pointer_op,
52+
.op = set_stack_size_op,
5353
.operands = nodes(a, 1, (const Node* []) {ctx->entry_stack_offset })
5454
}));
5555
}

src/shady/type.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ const Type* check_type_prim_op(IrArena* arena, PrimOp prim_op) {
10291029
return qualified_type(arena, (QualifiedType) { .type = join_point_type(arena, (JoinPointType) { .yield_types = empty(arena) }), .is_uniform = true });
10301030
}
10311031
// Stack stuff
1032-
case get_stack_pointer_op: {
1032+
case get_stack_size_op: {
10331033
assert(prim_op.type_arguments.count == 0);
10341034
assert(prim_op.operands.count == 0);
10351035
return qualified_type(arena, (QualifiedType) { .is_uniform = false, .type = uint32_type(arena) });
@@ -1040,7 +1040,7 @@ const Type* check_type_prim_op(IrArena* arena, PrimOp prim_op) {
10401040
const Node* ptr = ptr_type(arena, (PtrType) { .pointed_type = uint8_type(arena), .address_space = AsPrivate});
10411041
return qualified_type(arena, (QualifiedType) { .is_uniform = false, .type = ptr });
10421042
}
1043-
case set_stack_pointer_op: {
1043+
case set_stack_size_op: {
10441044
assert(prim_op.type_arguments.count == 0);
10451045
assert(prim_op.operands.count == 1);
10461046
assert(get_unqualified_type(prim_op.operands.nodes[0]->type) == uint32_type(arena));

0 commit comments

Comments
 (0)