Пример #1
0
 def __init__(self, addr):
     super(Label, self).__init__("label", [AddressConstant(addr)])
     self.addr = addr
     self.gotos = set()
     self.breaks = set()
     self.continues = set()
     self.needed = ALL_REGS - set(["FZ", "FC", "FN", "FH"])
     self.depset = unknownDependencySet()
Пример #2
0
 def __init__(self, addr):
     super(Label, self).__init__('label', [AddressConstant(addr)])
     self.addr = addr
     self.gotos = set()
     self.breaks = set()
     self.continues = set()
     self.needed = ALL_REGS - set(['FZ', 'FC', 'FN', 'FH'])
     self.depset = unknownDependencySet()
Пример #3
0
    def __init__(self, connection, addr, result=None):

        c = connection.cursor()
        c.execute(
            'select type, depset, has_switch, suspicious_switch, has_suspicious_instr, has_nop, has_ambig_calls, length from procs where addr=?',
            (addr, ))
        assert c.rowcount <= 1
        result = c.fetchone()

        self.addr = addr
        if result:
            self.type = result[0]
            self.depset = decodeDependencySet(result[1])
            self.has_switch = result[2]
            self.suspicious_switch = result[3]
            self.has_suspicious_instr = result[4]
            self.has_nop = result[5]
            self.has_ambig_calls = result[6]
            self.length = result[7]
        else:
            self.type = "proc"
            self.depset = unknownDependencySet()
            self.has_switch = False
            self.suspicious_switch = False
            self.has_suspicious_instr = False
            self.has_nop = False
            self.has_ambig_calls = True
            self.length = 0

        self.calls = set()
        self.tail_calls = set()
        c.execute('select destination, type from calls where source=?',
                  (addr, ))
        for dest, calltype in c.fetchall():
            if calltype == 'tail':
                self.tail_calls.add(dest)
            else:
                self.calls.add(dest)

        self.memreads = set()
        self.memwrites = set()
        c.execute('select addr, type from memref where proc=?', (addr, ))
        for address, reftype in c.fetchall():
            if reftype == 'read':
                self.memreads.add(address)
            else:
                self.memwrites.add(address)

        self.callers = set()
        c.execute('select source from calls where destination=?', (addr, ))
        for src, in c.fetchall():
            self.callers.add(src)

        c.close()
Пример #4
0
    def __init__(self, connection, addr, result=None):

        c = connection.cursor()
        c.execute('select type, depset, has_switch, suspicious_switch, has_suspicious_instr, has_nop, has_ambig_calls, length from procs where addr=?', (addr,))
        assert c.rowcount <= 1
        result = c.fetchone()

        self.addr = addr
        if result:
            self.type = result[0]
            self.depset = decodeDependencySet(result[1])
            self.has_switch = result[2]
            self.suspicious_switch = result[3]
            self.has_suspicious_instr = result[4]
            self.has_nop = result[5]
            self.has_ambig_calls = result[6]
            self.length = result[7]
        else:
            self.type = "proc"
            self.depset = unknownDependencySet()
            self.has_switch = False
            self.suspicious_switch = False
            self.has_suspicious_instr = False
            self.has_nop = False
            self.has_ambig_calls = True
            self.length = 0

        self.calls = set()
        self.tail_calls = set()
        c.execute('select destination, type from calls where source=?', (addr,))
        for dest, calltype in c.fetchall():
            if calltype == 'tail':
                self.tail_calls.add(dest)
            else:
                self.calls.add(dest)

        self.memreads = set()
        self.memwrites = set()
        c.execute('select addr, type from memref where proc=?', (addr,))
        for address, reftype in c.fetchall():
            if reftype == 'read':
                self.memreads.add(address)
            else:
                self.memwrites.add(address)

        self.callers = set()
        c.execute('select source from calls where destination=?', (addr,))
        for src, in c.fetchall():
            self.callers.add(src)

        c.close()
Пример #5
0
 def getDependencySet(self):
     return unknownDependencySet()