This commit is contained in:
Pragyansh Chaturvedi
2025-09-11 01:13:54 +05:30
parent 8d50298e9e
commit 10fb1f0914
2 changed files with 19 additions and 3 deletions

View File

@ -30,11 +30,11 @@ def hello_again(ctx: c_void_p) -> c_int64:
# if delta < 1000000000:
# print("execve called within last second")
# last().delete(key)
x = False
x = True
x = False
if x:
print("we prevailed")
if x:
else:
print("we did not prevail")
ts = ktime()
last().update(key, ts)
@ -52,4 +52,5 @@ def hello_again(ctx: c_void_p) -> c_int64:
def LICENSE() -> str:
return "GPL"
compile()

View File

@ -161,11 +161,18 @@ def handle_if(func, module, builder, stmt, map_sym_tab, local_sym_tab):
start = builder.block.parent
then_block = func.append_basic_block(name="if.then")
merge_block = func.append_basic_block(name="if.end")
if stmt.orelse:
else_block = func.append_basic_block(name="if.else")
else:
else_block = None
cond = handle_cond(func, module, builder, stmt.test,
local_sym_tab, map_sym_tab)
if else_block:
builder.cbranch(cond, then_block, else_block)
else:
builder.cbranch(cond, then_block, merge_block)
builder.cbranch(cond, then_block, merge_block)
builder.position_at_end(then_block)
for s in stmt.body:
process_stmt(func, module, builder, s,
@ -173,6 +180,14 @@ def handle_if(func, module, builder, stmt, map_sym_tab, local_sym_tab):
if not builder.block.is_terminated:
builder.branch(merge_block)
if else_block:
builder.position_at_end(else_block)
for s in stmt.orelse:
process_stmt(func, module, builder, s,
local_sym_tab, map_sym_tab, False)
if not builder.block.is_terminated:
builder.branch(merge_block)
builder.position_at_end(merge_block)