mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2026-03-27 15:41:27 +00:00
Add docstrings to core modules and helper functions
Co-authored-by: varun-r-mallya <100590632+varun-r-mallya@users.noreply.github.com>
This commit is contained in:
@ -35,6 +35,17 @@ def get_operand_value(operand, builder, local_sym_tab):
|
||||
|
||||
|
||||
def handle_binary_op_impl(rval, builder, local_sym_tab):
|
||||
"""
|
||||
Handle binary operations and emit corresponding LLVM IR instructions.
|
||||
|
||||
Args:
|
||||
rval: The AST BinOp node representing the binary operation
|
||||
builder: LLVM IR builder for emitting instructions
|
||||
local_sym_tab: Symbol table mapping variable names to their IR representations
|
||||
|
||||
Returns:
|
||||
The LLVM IR value representing the result of the binary operation
|
||||
"""
|
||||
op = rval.op
|
||||
left = get_operand_value(rval.left, builder, local_sym_tab)
|
||||
right = get_operand_value(rval.right, builder, local_sym_tab)
|
||||
@ -63,6 +74,18 @@ def handle_binary_op_impl(rval, builder, local_sym_tab):
|
||||
|
||||
|
||||
def handle_binary_op(rval, builder, var_name, local_sym_tab):
|
||||
"""
|
||||
Handle binary operations and optionally store the result to a variable.
|
||||
|
||||
Args:
|
||||
rval: The AST BinOp node representing the binary operation
|
||||
builder: LLVM IR builder for emitting instructions
|
||||
var_name: Optional variable name to store the result
|
||||
local_sym_tab: Symbol table mapping variable names to their IR representations
|
||||
|
||||
Returns:
|
||||
A tuple of (result_value, result_type)
|
||||
"""
|
||||
result = handle_binary_op_impl(rval, builder, local_sym_tab)
|
||||
if var_name and var_name in local_sym_tab:
|
||||
logger.info(
|
||||
|
||||
Reference in New Issue
Block a user