Example #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))
Example #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))
Example #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))
Example #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))