2727class LocalSymbol :
2828 """
2929 Represents a local variable in a BPF function.
30-
30+
3131 Attributes:
3232 var: LLVM IR alloca instruction for the variable
3333 ir_type: LLVM IR type of the variable
3434 metadata: Optional metadata (e.g., struct type name)
3535 """
36+
3637 var : ir .AllocaInstr
3738 ir_type : ir .Type
3839 metadata : Any = None
@@ -262,7 +263,7 @@ def handle_cond(
262263):
263264 """
264265 Evaluate a condition expression and convert it to a boolean value.
265-
266+
266267 Args:
267268 func: The LLVM IR function being built
268269 module: The LLVM IR module
@@ -271,7 +272,7 @@ def handle_cond(
271272 local_sym_tab: Local symbol table
272273 map_sym_tab: Map symbol table
273274 structs_sym_tab: Struct symbol table
274-
275+
275276 Returns:
276277 LLVM IR boolean value representing the condition result
277278 """
@@ -332,13 +333,13 @@ def handle_if(
332333def handle_return (builder , stmt , local_sym_tab , ret_type ):
333334 """
334335 Handle return statements in BPF functions.
335-
336+
336337 Args:
337338 builder: LLVM IR builder
338339 stmt: The AST Return node
339340 local_sym_tab: Local symbol table
340341 ret_type: Expected return type
341-
342+
342343 Returns:
343344 True if a return was emitted, False otherwise
344345 """
@@ -375,7 +376,7 @@ def process_stmt(
375376):
376377 """
377378 Process a single statement in a BPF function.
378-
379+
379380 Args:
380381 func: The LLVM IR function being built
381382 module: The LLVM IR module
@@ -386,7 +387,7 @@ def process_stmt(
386387 structs_sym_tab: Struct symbol table
387388 did_return: Whether a return has been emitted
388389 ret_type: Expected return type
389-
390+
390391 Returns:
391392 True if a return was emitted, False otherwise
392393 """
@@ -426,10 +427,10 @@ def allocate_mem(
426427):
427428 """
428429 Pre-allocate stack memory for local variables in a BPF function.
429-
430+
430431 This function scans the function body and creates alloca instructions
431432 for all local variables before processing the function statements.
432-
433+
433434 Args:
434435 module: The LLVM IR module
435436 builder: LLVM IR builder
@@ -439,7 +440,7 @@ def allocate_mem(
439440 map_sym_tab: Map symbol table
440441 local_sym_tab: Local symbol table to populate
441442 structs_sym_tab: Struct symbol table
442-
443+
443444 Returns:
444445 Updated local symbol table
445446 """
@@ -638,7 +639,7 @@ def process_bpf_chunk(func_node, module, return_type, map_sym_tab, structs_sym_t
638639def func_proc (tree , module , chunks , map_sym_tab , structs_sym_tab ):
639640 """
640641 Process all BPF function chunks and generate LLVM IR.
641-
642+
642643 Args:
643644 tree: The Python AST (not used in current implementation)
644645 module: The LLVM IR module to add functions to
@@ -673,13 +674,13 @@ def func_proc(tree, module, chunks, map_sym_tab, structs_sym_tab):
673674def infer_return_type (func_node : ast .FunctionDef ):
674675 """
675676 Infer the return type of a BPF function from annotations or return statements.
676-
677+
677678 Args:
678679 func_node: The AST function node
679-
680+
680681 Returns:
681682 String representation of the return type (e.g., 'c_int64')
682-
683+
683684 Raises:
684685 TypeError: If func_node is not a FunctionDef
685686 """
0 commit comments