Skip to content

Commit f41a9cc

Browse files
committed
Remove unnecessary args from binary_ops
1 parent be05b5d commit f41a9cc

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

pythonbpf/binary_ops.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
def recursive_dereferencer(var, builder):
1010
"""dereference until primitive type comes out"""
1111
# TODO: Not worrying about stack overflow for now
12+
logger.info(f"Dereferencing {var}, type is {var.type}")
1213
if isinstance(var.type, ir.PointerType):
1314
a = builder.load(var)
1415
return recursive_dereferencer(a, builder)
@@ -18,7 +19,7 @@ def recursive_dereferencer(var, builder):
1819
raise TypeError(f"Unsupported type for dereferencing: {var.type}")
1920

2021

21-
def get_operand_value(operand, module, builder, local_sym_tab):
22+
def get_operand_value(operand, builder, local_sym_tab):
2223
"""Extract the value from an operand, handling variables and constants."""
2324
if isinstance(operand, ast.Name):
2425
if operand.id in local_sym_tab:
@@ -29,14 +30,14 @@ def get_operand_value(operand, module, builder, local_sym_tab):
2930
return ir.Constant(ir.IntType(64), operand.value)
3031
raise TypeError(f"Unsupported constant type: {type(operand.value)}")
3132
elif isinstance(operand, ast.BinOp):
32-
return handle_binary_op_impl(operand, module, builder, local_sym_tab)
33+
return handle_binary_op_impl(operand, builder, local_sym_tab)
3334
raise TypeError(f"Unsupported operand type: {type(operand)}")
3435

3536

36-
def handle_binary_op_impl(rval, module, builder, local_sym_tab):
37+
def handle_binary_op_impl(rval, builder, local_sym_tab):
3738
op = rval.op
38-
left = get_operand_value(rval.left, module, builder, local_sym_tab)
39-
right = get_operand_value(rval.right, module, builder, local_sym_tab)
39+
left = get_operand_value(rval.left, builder, local_sym_tab)
40+
right = get_operand_value(rval.right, builder, local_sym_tab)
4041
logger.info(f"left is {left}, right is {right}, op is {op}")
4142

4243
# Map AST operation nodes to LLVM IR builder methods
@@ -61,8 +62,8 @@ def handle_binary_op_impl(rval, module, builder, local_sym_tab):
6162
raise SyntaxError("Unsupported binary operation")
6263

6364

64-
def handle_binary_op(rval, module, builder, var_name, local_sym_tab):
65-
result = handle_binary_op_impl(rval, module, builder, local_sym_tab)
65+
def handle_binary_op(rval, builder, var_name, local_sym_tab):
66+
result = handle_binary_op_impl(rval, builder, local_sym_tab)
6667
if var_name in local_sym_tab:
6768
builder.store(result, local_sym_tab[var_name].var)
6869
return result, result.type

0 commit comments

Comments
 (0)