mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
support binary ops with vmlinux enums
This commit is contained in:
@ -67,7 +67,7 @@ def processor(source_code, filename, module):
|
||||
globals_processing(tree, module)
|
||||
structs_sym_tab = structs_proc(tree, module, bpf_chunks)
|
||||
map_sym_tab = maps_proc(tree, module, bpf_chunks)
|
||||
func_proc(tree, module, bpf_chunks, map_sym_tab, structs_sym_tab, vmlinux_symtab)
|
||||
func_proc(tree, module, bpf_chunks, map_sym_tab, structs_sym_tab)
|
||||
|
||||
globals_list_creation(tree, module)
|
||||
|
||||
|
||||
@ -142,7 +142,12 @@ def get_operand_value(
|
||||
logger.info(f"var is {var}, base_type is {base_type}, depth is {depth}")
|
||||
val = deref_to_depth(func, builder, var, depth)
|
||||
return val
|
||||
raise ValueError(f"Undefined variable: {operand.id}")
|
||||
else:
|
||||
# Check if it's a vmlinux enum/constant
|
||||
vmlinux_result = VmlinuxHandlerRegistry.handle_name(operand.id)
|
||||
if vmlinux_result is not None:
|
||||
val, _ = vmlinux_result
|
||||
return val
|
||||
elif isinstance(operand, ast.Constant):
|
||||
if isinstance(operand.value, int):
|
||||
cst = ir.Constant(ir.IntType(64), int(operand.value))
|
||||
|
||||
Reference in New Issue
Block a user