mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
Allocate scratch space for temp vars at the end of allocate_mem
This commit is contained in:
@ -425,6 +425,7 @@ def allocate_mem(
|
|||||||
max_temps_needed = max(max_temps_needed, temps_needed)
|
max_temps_needed = max(max_temps_needed, temps_needed)
|
||||||
|
|
||||||
for stmt in body:
|
for stmt in body:
|
||||||
|
update_max_temps_for_stmt(stmt)
|
||||||
has_metadata = False
|
has_metadata = False
|
||||||
if isinstance(stmt, ast.If):
|
if isinstance(stmt, ast.If):
|
||||||
if stmt.body:
|
if stmt.body:
|
||||||
@ -545,6 +546,13 @@ def allocate_mem(
|
|||||||
|
|
||||||
if double_alloc:
|
if double_alloc:
|
||||||
local_sym_tab[f"{var_name}_tmp"] = LocalSymbol(var_tmp, tmp_ir_type)
|
local_sym_tab[f"{var_name}_tmp"] = LocalSymbol(var_tmp, tmp_ir_type)
|
||||||
|
|
||||||
|
logger.info(f"Temporary scratch space needed for calls: {max_temps_needed}")
|
||||||
|
for i in range(max_temps_needed):
|
||||||
|
temp_var = builder.alloca(ir.IntType(64), name=f"__helper_temp_{i}")
|
||||||
|
temp_var.align = 8
|
||||||
|
local_sym_tab[f"__helper_temp_{i}"] = LocalSymbol(temp_var, ir.IntType(64))
|
||||||
|
|
||||||
return local_sym_tab
|
return local_sym_tab
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user