mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2025-12-31 21:06:25 +00:00
fix formatting
This commit is contained in:
@ -5,6 +5,7 @@ import logging
|
|||||||
|
|
||||||
logger: Logger = logging.getLogger(__name__)
|
logger: Logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def recursive_dereferencer(var, builder):
|
def recursive_dereferencer(var, builder):
|
||||||
"""dereference until primitive type comes out"""
|
"""dereference until primitive type comes out"""
|
||||||
if var.type == ir.PointerType(ir.PointerType(ir.IntType(64))):
|
if var.type == ir.PointerType(ir.PointerType(ir.IntType(64))):
|
||||||
|
|||||||
@ -50,8 +50,7 @@ def processor(source_code, filename, module):
|
|||||||
|
|
||||||
def compile_to_ir(filename: str, output: str, loglevel=logging.WARNING):
|
def compile_to_ir(filename: str, output: str, loglevel=logging.WARNING):
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=loglevel,
|
level=loglevel, format="%(asctime)s [%(levelname)s] %(name)s: %(message)s"
|
||||||
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s"
|
|
||||||
)
|
)
|
||||||
with open(filename) as f:
|
with open(filename) as f:
|
||||||
source = f.read()
|
source = f.read()
|
||||||
@ -147,7 +146,9 @@ def compile(loglevel=logging.WARNING) -> bool:
|
|||||||
o_file = caller_file.with_suffix(".o")
|
o_file = caller_file.with_suffix(".o")
|
||||||
|
|
||||||
success = True
|
success = True
|
||||||
success = compile_to_ir(str(caller_file), str(ll_file), loglevel=loglevel) and success
|
success = (
|
||||||
|
compile_to_ir(str(caller_file), str(ll_file), loglevel=loglevel) and success
|
||||||
|
)
|
||||||
|
|
||||||
success = bool(
|
success = bool(
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import logging
|
|||||||
|
|
||||||
logger: Logger = logging.getLogger(__name__)
|
logger: Logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def eval_expr(
|
def eval_expr(
|
||||||
func,
|
func,
|
||||||
module,
|
module,
|
||||||
|
|||||||
@ -449,7 +449,9 @@ def allocate_mem(
|
|||||||
ir_type = ctypes_to_ir(call_type)
|
ir_type = ctypes_to_ir(call_type)
|
||||||
var = builder.alloca(ir_type, name=var_name)
|
var = builder.alloca(ir_type, name=var_name)
|
||||||
var.align = ir_type.width // 8
|
var.align = ir_type.width // 8
|
||||||
logger.info(f"Pre-allocated variable {var_name} of type {call_type}")
|
logger.info(
|
||||||
|
f"Pre-allocated variable {var_name} of type {call_type}"
|
||||||
|
)
|
||||||
elif HelperHandlerRegistry.has_handler(call_type):
|
elif HelperHandlerRegistry.has_handler(call_type):
|
||||||
# Assume return type is int64 for now
|
# Assume return type is int64 for now
|
||||||
ir_type = ir.IntType(64)
|
ir_type = ir.IntType(64)
|
||||||
|
|||||||
Reference in New Issue
Block a user