Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat[venom]: stack2mem pass implementation #4245

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

harkal
Copy link
Collaborator

@harkal harkal commented Sep 18, 2024

What I did

Implemented the stack2mem pass. This pass demotes stack variables to memory accesses when they are not reachable on the stack.

Fixes [#4222]

How I did it

How to verify it

Commit message

This commit implements the `Stack2Mem` pass that converts stack variable to memory accesses.  

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

temp

more stack2mem

exception and usage

mem allocator

tests and fixes to allocator

fixes

lint allocator

more

stack top method

allocator fixes

lint

fixes and update tests

plug memory allocator

add types

cleanup and lint

exceptions handling
@harkal harkal changed the title feat[venom]: stack2mem feat[venom]: stack2mem pass implementation Sep 24, 2024
elif opcode in ("alloca", "palloca"):
elif opcode == "alloca":
raise Exception("Alloca at assembly generation is not valid")
offset, _size = inst.operands

Check warning

Code scanning / CodeQL

Unreachable code Warning

This statement is unreachable.
@@ -1,7 +1,9 @@
from typing import Iterator, Optional

from vyper.codegen.ir_node import IRnode
from vyper.venom.basicblock import IRBasicBlock, IRLabel, IRVariable
from vyper.utils import OrderedSet

Check notice

Code scanning / CodeQL

Unused import Note

Import of 'OrderedSet' is not used.
@@ -1,7 +1,9 @@
from typing import Iterator, Optional

from vyper.codegen.ir_node import IRnode
from vyper.venom.basicblock import IRBasicBlock, IRLabel, IRVariable
from vyper.utils import OrderedSet
from vyper.venom.basicblock import CFG_ALTERING_INSTRUCTIONS, IRBasicBlock, IRLabel, IRVariable

Check notice

Code scanning / CodeQL

Unused import Note

Import of 'CFG_ALTERING_INSTRUCTIONS' is not used.
@@ -1,7 +1,9 @@
from typing import Iterator, Optional

from vyper.codegen.ir_node import IRnode
from vyper.venom.basicblock import IRBasicBlock, IRLabel, IRVariable
from vyper.utils import OrderedSet
from vyper.venom.basicblock import CFG_ALTERING_INSTRUCTIONS, IRBasicBlock, IRLabel, IRVariable

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'IRBasicBlock' may not be defined if module
vyper.venom.basicblock
is imported before module
vyper.venom.function
, as the
definition
of IRBasicBlock occurs after the cyclic
import
of vyper.venom.function.
@@ -1,7 +1,9 @@
from typing import Iterator, Optional

from vyper.codegen.ir_node import IRnode
from vyper.venom.basicblock import IRBasicBlock, IRLabel, IRVariable
from vyper.utils import OrderedSet
from vyper.venom.basicblock import CFG_ALTERING_INSTRUCTIONS, IRBasicBlock, IRLabel, IRVariable

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'IRLabel' may not be defined if module
vyper.venom.basicblock
is imported before module
vyper.venom.function
, as the
definition
of IRLabel occurs after the cyclic
import
of vyper.venom.function.
@@ -1,7 +1,9 @@
from typing import Iterator, Optional

from vyper.codegen.ir_node import IRnode
from vyper.venom.basicblock import IRBasicBlock, IRLabel, IRVariable
from vyper.utils import OrderedSet
from vyper.venom.basicblock import CFG_ALTERING_INSTRUCTIONS, IRBasicBlock, IRLabel, IRVariable

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'IRVariable' may not be defined if module
vyper.venom.basicblock
is imported before module
vyper.venom.function
, as the
definition
of IRVariable occurs after the cyclic
import
of vyper.venom.function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants