improved property detection excluding state transitions
This commit is contained in:
parent
ae412bc2d4
commit
abd3b7660b
@ -190,7 +190,7 @@ if __name__ == "__main__":
|
||||
reachable_states.append(s)
|
||||
# find properties
|
||||
for f in fsm_funcs:
|
||||
sccpv = SwitchCaseCodePropertyVisitor(n, pure_sa, prop_func_blacklist)
|
||||
sccpv = SwitchCaseCodePropertyVisitor(n, states, prop_func_blacklist)
|
||||
sccpv.visit(f)
|
||||
if len(sccpv.properties) > 0:
|
||||
props_by_state[n] = sccpv.properties
|
||||
|
||||
@ -384,10 +384,10 @@ class SwitchCaseTranVisitor(c_ast.NodeVisitor):
|
||||
self.tran_table.append((ft, self._asm_node.rvalue.name))
|
||||
|
||||
class SwitchCasePropertyVisitor(c_ast.NodeVisitor):
|
||||
def __init__(self, state_asmts, func_blacklist = None):
|
||||
def __init__(self, states, func_blacklist = None):
|
||||
super().__init__()
|
||||
self._func_bl = func_blacklist
|
||||
self._sas = state_asmts
|
||||
self.states = states
|
||||
self.properties = []
|
||||
|
||||
def visit_FuncCall(self, node):
|
||||
@ -398,7 +398,11 @@ class SwitchCasePropertyVisitor(c_ast.NodeVisitor):
|
||||
self.properties.append(fcall)
|
||||
|
||||
def visit_Assignment(self, node):
|
||||
if not(node in self._sas):
|
||||
#if not(node in self._sas):
|
||||
cg = c_generator.CGenerator()
|
||||
rvalue = cg.visit(node.rvalue)
|
||||
print("NODE RVAL", rvalue)
|
||||
if not(rvalue in self.states):
|
||||
lvalue = None
|
||||
rvalue = None
|
||||
if isinstance(node.lvalue, c_ast.StructRef):
|
||||
@ -418,11 +422,11 @@ class SwitchCasePropertyVisitor(c_ast.NodeVisitor):
|
||||
|
||||
|
||||
class SwitchCaseCodePropertyVisitor(c_ast.NodeVisitor):
|
||||
def __init__(self, case, state_asmts, func_blacklist):
|
||||
def __init__(self, case, states, func_blacklist):
|
||||
super().__init__()
|
||||
self._func_bl = func_blacklist
|
||||
self._case = case
|
||||
self._sas = state_asmts
|
||||
self.states = states
|
||||
self.properties = []
|
||||
|
||||
def visit_Case(self, node):
|
||||
@ -431,7 +435,7 @@ class SwitchCaseCodePropertyVisitor(c_ast.NodeVisitor):
|
||||
clev = CaseLabelExtractionVisitor()
|
||||
clev.visit(label)
|
||||
if clev.label == self._case:
|
||||
scpv = SwitchCasePropertyVisitor(self._sas, self._func_bl)
|
||||
scpv = SwitchCasePropertyVisitor(self.states, self._func_bl)
|
||||
scpv.visit(block)
|
||||
self.properties += scpv.properties
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user