diff --git a/pythonbpf/expr/expr_pass.py b/pythonbpf/expr/expr_pass.py index ea3c8d6..d6ca18e 100644 --- a/pythonbpf/expr/expr_pass.py +++ b/pythonbpf/expr/expr_pass.py @@ -421,7 +421,7 @@ def _handle_unary_op( if isinstance(expr.op, ast.Not): true_const = ir.Constant(ir.IntType(1), 1) result = builder.xor(convert_to_bool(builder, operand), true_const) - return result, ir.IntType(1) + return result, IntTy(1, False) elif isinstance(expr.op, ast.USub): if isinstance(operand, ir.Constant) and isinstance(operand.constant, int): # -2 parses as USub(Constant 2); fold it so it is a literal like @@ -491,7 +491,7 @@ def _handle_and_op(func, builder, expr, local_sym_tab, compilation_context): phi.add_incoming(val, block) logger.debug(f"Generated 'and' with {len(incoming_values)} incoming values") - return phi, ir.IntType(1) + return phi, IntTy(1, False) def _handle_or_op(func, builder, expr, local_sym_tab, compilation_context): @@ -544,7 +544,7 @@ def _handle_or_op(func, builder, expr, local_sym_tab, compilation_context): phi.add_incoming(val, block) logger.debug(f"Generated 'or' with {len(incoming_values)} incoming values") - return phi, ir.IntType(1) + return phi, IntTy(1, False) def _handle_boolean_op( diff --git a/pythonbpf/expr/type_normalization.py b/pythonbpf/expr/type_normalization.py index e58577a..96a02ec 100644 --- a/pythonbpf/expr/type_normalization.py +++ b/pythonbpf/expr/type_normalization.py @@ -1,7 +1,7 @@ import logging from llvmlite import ir from .ir_ops import deref_to_depth -from pythonbpf.type_deducer import signedness +from pythonbpf.type_deducer import IntTy, signedness from .operators import COMPARISON_OPS logger = logging.getLogger(__name__) @@ -128,4 +128,4 @@ def handle_comparator(func, builder, op, lhs, rhs, signed=True): icmp = builder.icmp_signed if signed else builder.icmp_unsigned result = icmp(predicate, lhs, rhs) logger.debug(f"Comparison result: {result}") - return result, ir.IntType(1) + return result, IntTy(1, False)