Skip to content

Commit 4284d95

Browse files
committed
fix stack lowering for new lea semantics
1 parent 435a59d commit 4284d95

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/shady/passes/lower_physical_ptrs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static const Node* gen_deserialisation(Context* ctx, BodyBuilder* bb, const Type
9494
}
9595
if (config->printf_trace.memory_accesses) {
9696
AddressSpace as = get_unqualified_type(arr->type)->payload.ptr_type.address_space;
97-
String template = format_string_interned(a, "loaded %s at %s:%s\n", element_type->payload.int_type.width == IntTy64 ? "%lu" : "%u", get_address_space_name(as), "%lx");
97+
String template = format_string_interned(a, "loaded %s at %s:0x%s\n", element_type->payload.int_type.width == IntTy64 ? "%lu" : "%u", get_address_space_name(as), "%lx");
9898
const Node* widened = acc;
9999
if (element_type->payload.int_type.width < IntTy32)
100100
widened = gen_conversion(bb, uint32_type(a), acc);
@@ -198,7 +198,7 @@ static void gen_serialisation(Context* ctx, BodyBuilder* bb, const Type* element
198198
}
199199
if (config->printf_trace.memory_accesses) {
200200
AddressSpace as = get_unqualified_type(arr->type)->payload.ptr_type.address_space;
201-
String template = format_string_interned(a, "stored %s at %s:%s\n", element_type->payload.int_type.width == IntTy64 ? "%lu" : "%u", get_address_space_name(as), "%lx");
201+
String template = format_string_interned(a, "stored %s at %s:0x%s\n", element_type->payload.int_type.width == IntTy64 ? "%lu" : "%u", get_address_space_name(as), "%lx");
202202
const Node* widened = value;
203203
if (element_type->payload.int_type.width < IntTy32)
204204
widened = gen_conversion(bb, uint32_type(a), value);

src/shady/passes/lower_stack.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static const Node* gen_fn(Context* ctx, const Type* element_type, bool push) {
5959
if (!push) // for pop, we decrease the stack size first
6060
stack_size = gen_primop_ce(bb, sub_op, 2, (const Node* []) { stack_size, element_size});
6161

62-
const Node* addr = gen_lea(bb, stack, stack_size, nodes(a, 1, (const Node* []) {uint32_literal(a, 0) }));
62+
const Node* addr = gen_lea(bb, ctx->stack, int32_literal(a, 0), singleton(stack_size));
6363
assert(get_unqualified_type(addr->type)->tag == PtrType_TAG);
6464
AddressSpace addr_space = get_unqualified_type(addr->type)->payload.ptr_type.address_space;
6565

@@ -118,7 +118,7 @@ static const Node* process_let(Context* ctx, const Node* node) {
118118
BodyBuilder* bb = begin_body(a);
119119
const Node* stack_pointer = ctx->stack_pointer;
120120
const Node* stack_size = gen_load(bb, stack_pointer);
121-
const Node* stack_base_ptr = gen_lea(bb, ctx->stack, stack_size, empty(a));
121+
const Node* stack_base_ptr = gen_lea(bb, ctx->stack, int32_literal(a, 0), singleton(stack_size));
122122
if (ctx->config->printf_trace.stack_size) {
123123
if (oprim_op->op == get_stack_base_op)
124124
bind_instruction(bb, prim_op(a, (PrimOp) {.op = debug_printf_op, .operands = mk_nodes(a, string_lit(a, (StringLiteral) {.string = "trace: stack_size=%d\n"}), stack_size)}));

0 commit comments

Comments
 (0)