-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoptimizationClass.py
52 lines (37 loc) · 1.13 KB
/
optimizationClass.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from basicblock import *
from operations_new import *
class optimizationClass:
"""
Parent optimization class.
"""
def __init__(self, blocks):
"""
Initializes all the necessary variables.
"""
self.name = "Optimization class"
self.optimizedBlocks = blocks
self.exceptions = []
self.output = []
def getOutput(self):
"""
Used by any class that wants debug output.
"""
return self.output
def setBlocks(self, blocks):
"""
Alter the set of blocks that will be optimized.
"""
self.optimizedBlocks = blocks
def getBlocks(self):
"""
Get the set of (optimized) blocks.
"""
return self.optimizedBlocks
def analyseBlocks(self):
"""
Iterate over all the blocks and analyse each block separately. The
analysis of a single block returns a new block which is added to the
list of optimized basic blocks.
"""
for block in self.optimizedBlocks:
self.analyseBasicBlock(block)