Skip to content

Commit

Permalink
further cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
harkal committed Feb 19, 2025
1 parent 580e667 commit 9dbbd6c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
1 change: 1 addition & 0 deletions tests/unit/compiler/test_source_map.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from collections import namedtuple

import pytest

from vyper.compiler import compile_code
from vyper.compiler.output import _compress_source_map
from vyper.compiler.settings import OptimizationLevel
Expand Down
26 changes: 3 additions & 23 deletions vyper/venom/ir_node_to_venom.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,33 +195,16 @@ def _handle_self_call(fn: IRFunction, ir: IRnode, symbols: SymbolTable) -> Optio
return return_buf


_current_func_t = None
_current_context = None


def _is_word_type(typ):
return typ._is_prim_word
# return typ.memory_bytes_required == 32


# func_t: ContractFunctionT
def _returns_word(func_t) -> bool:
return_t = func_t.return_type
return return_t is not None and _is_word_type(return_t)


def _handle_internal_func(
# TODO: remove does_return_data, replace with `func_t.return_type is not None`
fn: IRFunction,
ir: IRnode,
does_return_data: bool,
symbols: SymbolTable,
) -> IRFunction:
global _alloca_table, _current_func_t, _current_context

_current_func_t = ir.passthrough_metadata["func_t"]
_current_context = ir.passthrough_metadata["context"]
global _alloca_table

fn = fn.ctx.create_function(ir.args[0].args[0].value)
fn = fn.ctx.create_function(ir.args[0].args[0].value)

bb = fn.get_basic_block()
Expand Down Expand Up @@ -594,10 +577,7 @@ def emit_body_blocks():
alloca = ir.passthrough_metadata["alloca"]
assert alloca._callsite is not None
if alloca._id not in _alloca_table:
bb = fn.get_basic_block()
ptr = IRLiteral(alloca.offset)

_alloca_table[alloca._id] = ptr
_alloca_table[alloca._id] = IRLiteral(alloca.offset)
ret = _alloca_table[alloca._id]
# assumption: callocas appear in the same order as the
# order of arguments to the function.
Expand Down

0 comments on commit 9dbbd6c

Please sign in to comment.