summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2021-10-26 12:11:24 -0400
committerPeter LaFosse <peter@vector35.com>2021-11-05 10:30:12 -0400
commit9290bd614d83b389ba0c1159379d3d357c658b1e (patch)
tree08153d292c0d4599ccd9f72ac872680933c75890
parent54f253ac5c3d4916e9ce5fca6816be7fd1c7de27 (diff)
Make all ILInstructions inherit from the same abstract base class
-rw-r--r--python/commonil.py5
-rw-r--r--python/highlevelil.py4
-rw-r--r--python/lowlevelil.py4
-rw-r--r--python/mediumlevelil.py4
4 files changed, 11 insertions, 6 deletions
diff --git a/python/commonil.py b/python/commonil.py
index 4a079f02..fdb6540e 100644
--- a/python/commonil.py
+++ b/python/commonil.py
@@ -24,6 +24,11 @@ from dataclasses import dataclass
# This file contains a list of top level abstract classes for implementing BNIL instructions
@dataclass(frozen=True, repr=False)
+class ILInstruction:
+ pass
+
+
+@dataclass(frozen=True, repr=False)
class Constant:
pass
diff --git a/python/highlevelil.py b/python/highlevelil.py
index a71dc69c..0ae927e4 100644
--- a/python/highlevelil.py
+++ b/python/highlevelil.py
@@ -37,7 +37,7 @@ from . import types
from . import highlight
from . import flowgraph
from . import variable
-from .commonil import (Call, Tailcall, Syscall, Comparison, Signed, UnaryOperation, BinaryOperation,
+from .commonil import (ILInstruction, Call, Tailcall, Syscall, Comparison, Signed, UnaryOperation, BinaryOperation,
SSA, Phi, Loop, ControlFlow, Memory, Constant, Arithmetic, DoublePrecision, Terminal,
FloatingPoint)
@@ -128,7 +128,7 @@ class CoreHighLevelILInstruction:
@dataclass(frozen=True)
-class HighLevelILInstruction:
+class HighLevelILInstruction(ILInstruction):
"""
``class HighLevelILInstruction`` High Level Intermediate Language Instructions form an abstract syntax tree of
the code. Control flow structures are present as high level constructs in the HLIL tree.
diff --git a/python/lowlevelil.py b/python/lowlevelil.py
index f1756692..80349987 100644
--- a/python/lowlevelil.py
+++ b/python/lowlevelil.py
@@ -35,7 +35,7 @@ from . import variable
from . import binaryview
from . import architecture
from . import types
-from .commonil import (Constant, BinaryOperation, UnaryOperation, Comparison, SSA,
+from .commonil import (ILInstruction, Constant, BinaryOperation, UnaryOperation, Comparison, SSA,
Phi, FloatingPoint, ControlFlow, Terminal, Call, StackOperation, Return,
Signed, Arithmetic, Carry, DoublePrecision, Memory, Load, Store, RegisterStack, SetReg)
@@ -299,7 +299,7 @@ class CoreLowLevelILInstruction:
@dataclass(frozen=True)
-class LowLevelILInstruction:
+class LowLevelILInstruction(ILInstruction):
"""
``class LowLevelILInstruction`` Low Level Intermediate Language Instructions are infinite length tree-based
instructions. Tree-based instructions use infix notation with the left hand operand being the destination operand.
diff --git a/python/mediumlevelil.py b/python/mediumlevelil.py
index 202bc036..3a37bb6a 100644
--- a/python/mediumlevelil.py
+++ b/python/mediumlevelil.py
@@ -35,7 +35,7 @@ from . import flowgraph
from . import variable
from . import architecture
from . import binaryview
-from .commonil import (Constant, BinaryOperation, UnaryOperation, Comparison, SSA,
+from .commonil import (ILInstruction, Constant, BinaryOperation, UnaryOperation, Comparison, SSA,
Phi, FloatingPoint, ControlFlow, Terminal, Call, Syscall, Tailcall, Return,
Signed, Arithmetic, Carry, DoublePrecision, Memory, Load, Store, RegisterStack, SetVar)
@@ -105,7 +105,7 @@ class CoreMediumLevelILInstruction:
@dataclass(frozen=True)
-class MediumLevelILInstruction:
+class MediumLevelILInstruction(ILInstruction):
"""
``class MediumLevelILInstruction`` Medium Level Intermediate Language Instructions are infinite length tree-based
instructions. Tree-based instructions use infix notation with the left hand operand being the destination operand.