Skip to content

Commit 321415f

Browse files
committed
Add update_max_temps_for_stmt in allocate_mem
1 parent 8776d76 commit 321415f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pythonbpf/functions/functions_pass.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,16 @@ def allocate_mem(
414414
module, builder, body, func, ret_type, map_sym_tab, local_sym_tab, structs_sym_tab
415415
):
416416
double_alloc = False
417+
max_temps_needed = 0
418+
419+
def update_max_temps_for_stmt(stmt):
420+
nonlocal max_temps_needed
421+
422+
for node in ast.walk(stmt):
423+
if isinstance(node, ast.Call):
424+
temps_needed = count_temps_in_call(node)
425+
max_temps_needed = max(max_temps_needed, temps_needed)
426+
417427
for stmt in body:
418428
has_metadata = False
419429
if isinstance(stmt, ast.If):

0 commit comments

Comments
 (0)