Пример #1
0
 def testSimpleAssignment(self):
     x = VariableDecl(int_type, 'x')
     y = VariableDecl(int_type, 'y')
     stmt = Operation(AssignStatement(Name(x), Name(y)))
     cfg = CFG('f')
     cfg.connect(cfg.entry, stmt, cfg.exit)
     liveness = LivenessAnalysis(cfg)
     self.assertFalse(liveness.check(x, cfg.entry))
     self.assertFalse(liveness.check(x, cfg.exit))
     self.assertTrue(liveness.check(y, cfg.entry))
     self.assertFalse(liveness.check(y, cfg.exit))
Пример #2
0
 def testSimpleAssignment(self):
     x = VariableDecl(int_type, 'x')
     y = VariableDecl(int_type, 'y')
     stmt = Operation(AssignStatement(Name(x), Name(y)))
     cfg = CFG('f')
     cfg.connect(cfg.entry, stmt, cfg.exit)
     liveness = LivenessAnalysis(cfg)
     self.assertFalse(liveness.check(x, cfg.entry))
     self.assertFalse(liveness.check(x, cfg.exit))
     self.assertTrue(liveness.check(y, cfg.entry))
     self.assertFalse(liveness.check(y, cfg.exit))
Пример #3
0
 def testEmpty(self):
     x = VariableDecl(int_type, 'x')
     cfg = CFG('f')
     liveness = LivenessAnalysis(cfg)
     self.assertFalse(liveness.check(x, cfg.entry))
     self.assertFalse(liveness.check(x, cfg.exit))
Пример #4
0
 def testEmpty(self):
     x = VariableDecl(int_type, 'x')
     cfg = CFG('f')
     liveness = LivenessAnalysis(cfg)
     self.assertFalse(liveness.check(x, cfg.entry))
     self.assertFalse(liveness.check(x, cfg.exit))