-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement the first version of constant propagation support. (#426)
* Implement the first version of constant propagation support.
- Loading branch information
Showing
9 changed files
with
184 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
class ConstVal: | ||
""" | ||
A constant value object. Indicates a constant value assignment to a VEX tmp variable. | ||
:ivar tmp: The tmp variable being assigned to. | ||
:ivar value: The value of the tmp variable. | ||
:ivar stmt_idx: The IRSB statement index containing the data access | ||
""" | ||
|
||
__slots__ = ( | ||
"tmp", | ||
"value", | ||
"stmt_idx", | ||
) | ||
|
||
def __init__(self, tmp: int, value: int, stmt_idx: int): | ||
self.tmp = tmp | ||
self.value = value | ||
self.stmt_idx = stmt_idx | ||
|
||
def __repr__(self): | ||
return f"<ConstVal {self.tmp} = {self.value:#x} @ {self.stmt_idx}>" | ||
|
||
@classmethod | ||
def from_c(cls, r): | ||
return cls(r.tmp, r.value, r.stmt_idx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.