mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
Use HelperHandleRegitry
This commit is contained in:
@ -2,7 +2,7 @@ from llvmlite import ir
|
||||
import ast
|
||||
|
||||
|
||||
from .helper.bpf_helper_handler import helper_func_list, handle_helper_call
|
||||
from .helper import HelperHandlerRegistry, handle_helper_call
|
||||
from .type_deducer import ctypes_to_ir
|
||||
from .binary_ops import handle_binary_op
|
||||
from .expr_pass import eval_expr, handle_expr
|
||||
@ -113,7 +113,7 @@ def handle_assign(func, module, builder, stmt, map_sym_tab, local_sym_tab, struc
|
||||
print(f"Assigned {call_type} constant "
|
||||
f"{rval.args[0].value} to {var_name}")
|
||||
# local_sym_tab[var_name] = var
|
||||
elif call_type in helper_func_list:
|
||||
elif call_type in HelperHandlerRegistry._handlers:
|
||||
# var = builder.alloca(ir.IntType(64), name=var_name)
|
||||
# var.align = 8
|
||||
val = handle_helper_call(
|
||||
@ -154,7 +154,7 @@ def handle_assign(func, module, builder, stmt, map_sym_tab, local_sym_tab, struc
|
||||
method_name = rval.func.attr
|
||||
if map_name in map_sym_tab:
|
||||
map_ptr = map_sym_tab[map_name]
|
||||
if method_name in helper_func_list:
|
||||
if method_name in HelperHandlerRegistry._handlers:
|
||||
val = handle_helper_call(
|
||||
rval, module, builder, func, local_sym_tab, map_sym_tab, structs_sym_tab, local_var_metadata)
|
||||
# var = builder.alloca(ir.IntType(64), name=var_name)
|
||||
@ -344,7 +344,7 @@ def allocate_mem(module, builder, body, func, ret_type, map_sym_tab, local_sym_t
|
||||
var.align = ir_type.width // 8
|
||||
print(
|
||||
f"Pre-allocated variable {var_name} of type {call_type}")
|
||||
elif call_type in helper_func_list:
|
||||
elif call_type in HelperHandlerRegistry._handlers:
|
||||
# Assume return type is int64 for now
|
||||
ir_type = ir.IntType(64)
|
||||
var = builder.alloca(ir_type, name=var_name)
|
||||
|
||||
Reference in New Issue
Block a user