Skip to content

Commit

Permalink
Revert "Merge branch 'master' of https://github.com/vyperlang/vyper i…
Browse files Browse the repository at this point in the history
…nto feat/decimal-abi"

This reverts commit d45ec62, reversing
changes made to 7e7f19e.
  • Loading branch information
tserg committed Apr 7, 2024
1 parent 2e5d6bd commit 3361649
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 59 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Publish to PyPI

on:
release:
types: [published] # releases and pre-releases (release candidates)

jobs:

deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build
run: python setup.py sdist bdist_wheel

- name: Publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload dist/*
38 changes: 0 additions & 38 deletions .github/workflows/release-pypi.yml

This file was deleted.

63 changes: 44 additions & 19 deletions vyper/venom/basicblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ def __repr__(self) -> str:

class IROperand:
"""
IROperand represents an IR operand. An operand is anything that can be
operated by instructions. It can be a literal, a variable, or a label.
IROperand represents an operand in IR. An operand is anything that can
be an argument to an IRInstruction
"""

value: Any
Expand All @@ -102,19 +102,18 @@ class IROperand:
def name(self) -> str:
return self.value

def __hash__(self) -> int:
return hash(self.value)

def __eq__(self, other) -> bool:
if not isinstance(other, type(self)):
return False
return self.value == other.value
class IRValue(IROperand):
"""
IRValue represents a value in IR. A value is anything that can be
operated by non-control flow instructions. That is, IRValues can be
IRVariables or IRLiterals.
"""

def __repr__(self) -> str:
return str(self.value)
pass


class IRLiteral(IROperand):
class IRLiteral(IRValue):
"""
IRLiteral represents a literal in IR
"""
Expand All @@ -125,13 +124,25 @@ def __init__(self, value: int) -> None:
assert isinstance(value, int), "value must be an int"
self.value = value

def __hash__(self) -> int:
return self.value.__hash__()

def __eq__(self, other) -> bool:
if not isinstance(other, type(self)):
return False
return self.value == other.value

def __repr__(self) -> str:
return str(self.value)


class IRVariable(IROperand):
class IRVariable(IRValue):
"""
IRVariable represents a variable in IR. A variable is a string that starts with a %.
"""

value: str
offset: int = 0

def __init__(self, value: str, version: Optional[str | int] = None) -> None:
assert isinstance(value, str)
Expand All @@ -142,6 +153,7 @@ def __init__(self, value: str, version: Optional[str | int] = None) -> None:
if value[0] != "%":
value = f"%{value}"
self.value = value
self.offset = 0

@property
def name(self) -> str:
Expand All @@ -153,6 +165,17 @@ def version(self) -> int:
return 0
return int(self.value.split(":")[1])

def __hash__(self) -> int:
return self.value.__hash__()

def __eq__(self, other) -> bool:
if not isinstance(other, type(self)):
return False
return self.value == other.value

def __repr__(self) -> str:
return self.value


class IRLabel(IROperand):
"""
Expand All @@ -169,14 +192,16 @@ def __init__(self, value: str, is_symbol: bool = False) -> None:
self.value = value
self.is_symbol = is_symbol

def __eq__(self, other):
# no need for is_symbol to participate in equality
return super().__eq__(other)
def __hash__(self) -> int:
return hash(self.value)

def __hash__(self):
# __hash__ is required when __eq__ is overridden --
# https://docs.python.org/3/reference/datamodel.html#object.__hash__
return super().__hash__()
def __eq__(self, other) -> bool:
if not isinstance(other, type(self)):
return False
return self.value == other.value

def __repr__(self) -> str:
return self.value


class IRInstruction:
Expand Down
4 changes: 2 additions & 2 deletions vyper/venom/passes/make_ssa.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def _rename_vars(self, basic_block: IRBasicBlock):

# Pre-action
for inst in basic_block.instructions:
new_ops: list[IROperand] = []
new_ops = []
if inst.opcode != "phi":
for op in inst.operands:
if not isinstance(op, IRVariable):
Expand Down Expand Up @@ -143,7 +143,7 @@ def _remove_degenerate_phis(self, entry: IRBasicBlock):
if inst.opcode != "phi":
continue

new_ops: list[IROperand] = []
new_ops = []
for label, op in inst.phi_operands:
if op == inst.output:
continue
Expand Down

0 comments on commit 3361649

Please sign in to comment.