mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
Allow non-call convention for maps
This commit is contained in:
@ -192,8 +192,23 @@ def handle_assign(
|
|||||||
elif isinstance(rval.func, ast.Attribute):
|
elif isinstance(rval.func, ast.Attribute):
|
||||||
print(f"Assignment call attribute: {ast.dump(rval.func)}")
|
print(f"Assignment call attribute: {ast.dump(rval.func)}")
|
||||||
if isinstance(rval.func.value, ast.Name):
|
if isinstance(rval.func.value, ast.Name):
|
||||||
# TODO: probably a struct access
|
if rval.func.value.id in map_sym_tab:
|
||||||
print(f"TODO STRUCT ACCESS {ast.dump(rval)}")
|
map_name = rval.func.value.id
|
||||||
|
method_name = rval.func.attr
|
||||||
|
if HelperHandlerRegistry.has_handler(method_name):
|
||||||
|
val = handle_helper_call(
|
||||||
|
rval,
|
||||||
|
module,
|
||||||
|
builder,
|
||||||
|
func,
|
||||||
|
local_sym_tab,
|
||||||
|
map_sym_tab,
|
||||||
|
structs_sym_tab,
|
||||||
|
)
|
||||||
|
builder.store(val[0], local_sym_tab[var_name].var)
|
||||||
|
else:
|
||||||
|
# TODO: probably a struct access
|
||||||
|
print(f"TODO STRUCT ACCESS {ast.dump(rval)}")
|
||||||
elif isinstance(rval.func.value, ast.Call) and isinstance(
|
elif isinstance(rval.func.value, ast.Call) and isinstance(
|
||||||
rval.func.value.func, ast.Name
|
rval.func.value.func, ast.Name
|
||||||
):
|
):
|
||||||
|
|||||||
@ -274,6 +274,7 @@ def process_bpf_map(func_node, module):
|
|||||||
rval = return_stmt.value
|
rval = return_stmt.value
|
||||||
|
|
||||||
if isinstance(rval, ast.Call) and isinstance(rval.func, ast.Name):
|
if isinstance(rval, ast.Call) and isinstance(rval.func, ast.Name):
|
||||||
|
print(f"we're lit, {ast.dump(rval)}")
|
||||||
handler = MapProcessorRegistry.get_processor(rval.func.id)
|
handler = MapProcessorRegistry.get_processor(rval.func.id)
|
||||||
if handler:
|
if handler:
|
||||||
return handler(map_name, rval, module)
|
return handler(map_name, rval, module)
|
||||||
|
|||||||
Reference in New Issue
Block a user