Skip to content

Commit

Permalink
VVarCategory: Add a TMP category. (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
ltfish authored Oct 17, 2024
1 parent 0989ca3 commit 0767b5e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ailment/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ class VirtualVariableCategory(IntEnum):
STACK = 1
MEMORY = 2
PARAMETER = 3
UNKNOWN = 4
TMP = 4
UNKNOWN = 5


class VirtualVariable(Atom):
Expand Down Expand Up @@ -257,6 +258,10 @@ def was_stack(self) -> bool:
def was_parameter(self) -> bool:
return self.category == VirtualVariableCategory.PARAMETER

@property
def was_tmp(self) -> bool:
return self.category == VirtualVariableCategory.TMP

@property
def reg_offset(self) -> int | None:
if self.was_reg:
Expand All @@ -269,6 +274,10 @@ def stack_offset(self) -> int | None:
return self.oident
return None

@property
def tmp_idx(self) -> int | None:
return self.oident if self.was_tmp else None

def likes(self, atom):
return (
isinstance(atom, VirtualVariable)
Expand Down

0 comments on commit 0767b5e

Please sign in to comment.