mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
Add deref(), add delete helper, refactor pre-alloc
This commit is contained in:
@ -1,11 +1,15 @@
|
||||
import ast
|
||||
from llvmlite import ir
|
||||
|
||||
|
||||
def handle_binary_op(rval, module, builder, func, local_sym_tab, map_sym_tab):
|
||||
print(module)
|
||||
left = rval.left
|
||||
right = rval.right
|
||||
op = rval.op
|
||||
|
||||
# In case of pointers, we'll deref once.
|
||||
|
||||
if isinstance(left, ast.Name):
|
||||
left = local_sym_tab[left.id]
|
||||
elif isinstance(left, ast.Constant):
|
||||
@ -20,6 +24,8 @@ def handle_binary_op(rval, module, builder, func, local_sym_tab, map_sym_tab):
|
||||
else:
|
||||
SyntaxError("Unsupported right operand type")
|
||||
|
||||
print(f"left is {left}, right is {right}, op is {op}")
|
||||
|
||||
if isinstance(op, ast.Add):
|
||||
result = builder.add(left, right)
|
||||
elif isinstance(op, ast.Sub):
|
||||
|
||||
Reference in New Issue
Block a user