forked from NUDT-compiler/nudt-compiler-cpp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.4 KiB
37 lines
1.4 KiB
# 检查第 219 和 220 个参数之间的帧槽分配
|
|
|
|
num_params = 390
|
|
num_reg_params = 8
|
|
|
|
# 模拟帧槽分配
|
|
frame_slots = []
|
|
for param_idx in range(num_params):
|
|
# 创建参数帧槽
|
|
frame_slots.append({"type": "param", "param_idx": param_idx, "is_stack_arg": False})
|
|
|
|
# 如果参数在栈上,创建 callee_stack_arg 帧槽
|
|
if param_idx >= num_reg_params:
|
|
frame_slots.append({"type": "callee_stack_arg", "param_idx": param_idx, "is_stack_arg": True})
|
|
|
|
# 计算负偏移帧槽的偏移量
|
|
local_cursor = 0
|
|
for i, slot in enumerate(frame_slots):
|
|
if not slot["is_stack_arg"]:
|
|
local_cursor += 4
|
|
frame_slots[i]["offset"] = -local_cursor
|
|
|
|
# 检查第 218-222 个参数的帧槽索引和偏移
|
|
for param_idx in [217, 218, 219, 220, 221, 222]:
|
|
# 找到对应的参数帧槽
|
|
for i, slot in enumerate(frame_slots):
|
|
if slot["type"] == "param" and slot["param_idx"] == param_idx:
|
|
print(f"参数索引 {param_idx} (第 {param_idx+1} 个参数): 帧槽索引 {i}, 偏移 {slot['offset']}")
|
|
break
|
|
|
|
# 检查帧槽索引 426-440 的详细信息
|
|
print("\n帧槽索引 426-440 的详细信息:")
|
|
for i in range(426, 442):
|
|
slot = frame_slots[i]
|
|
offset_str = str(slot.get('offset', 'N/A'))
|
|
print(f"帧槽 {i}: 类型 {slot['type']}, 参数索引 {slot.get('param_idx', 'N/A')}, is_stack_arg {slot['is_stack_arg']}, 偏移 {offset_str}")
|