示例#1
0
    def optimizedWithContext(self, ctx):

        self.target = self.target.optimizedWithContext(ctx)
        if hasattr(self.target, 'getAddress'):
            self.targetAddr = self.target.getAddress()
        elif hasattr(self.target, 'value') and self.target.value is not None:
            self.targetAddr = address.fromVirtualAndCurrent(self.target.value, self.addr)
            self.target = ProcAddress(self.targetAddr)
        else:
            pass  # XXX

        deps = self.getDependencySet()

        ins = joinRegisters(deps.reads - set(['mem']))

        for param in ins:
            if ctx.hasConstantValue(param):
                self.constant_params[param] = ctx.getValue(param)

        for w in deps.writes:
            ctx.setValueComplex(w)

        # TODO: XXX
        if self.targetAddr.virtual() == 0x07B9:
            if 'A' in self.constant_params:
                ctx.setValue('ROMBANK', self.constant_params['A'])

        return self
示例#2
0
 def signature(self):
     deps = self.inner.getDependencySet()
     loopvars = deps.writes & deps.reads
     loopvars -= set(['mem'])
     loopvars = joinRegisters(loopvars)
     return " @ loopvars: " + ", ".join(
         sorted(
             str(x)
             for x in loopvars if not isinstance(x, address.Address)))
示例#3
0
    def signature(self):
        x = ''
        if not self.cond.alwaysTrue():
            x = 'CONDITIONAL'

        depset = self.getDependencySet().onlyRegisters()
        ins = joinRegisters(depset.reads - set(['mem']))
        outs = joinRegisters(self.returns_used - set(['mem']))

        ins |= set(param+'='+str(self.constant_params[param]) for param in self.constant_params)

        ins = ', '.join(sorted(ins))
        outs = ', '.join(sorted(outs))
        if ins:
            ins = ' @ (' + ins + ')'
        if not outs:
            outs = 'void'
        return x + ins + ' -> ' + outs
示例#4
0
 def signature(self):
     ins = joinRegisters(self.needed & ALL_REGS)
     return " @ " + ", ".join(sorted(str(x) for x in ins if not isinstance(x, address.Address)))
示例#5
0
 def signature(self):
     deps = self.inner.getDependencySet()
     loopvars = deps.writes & deps.reads
     loopvars -= set(["mem"])
     loopvars = joinRegisters(loopvars)
     return " @ loopvars: " + ", ".join(sorted(str(x) for x in loopvars if not isinstance(x, address.Address)))
示例#6
0
 def signature(self):
     ins = joinRegisters(self.needed & ALL_REGS)
     return ' @ ' + ', '.join(
         sorted(str(x) for x in ins if not isinstance(x, address.Address)))
示例#7
0
 def getDependencySet(self):
     reads = set(self.target_depset.reads)
     for r in joinRegisters(reads):
         if r in self.constant_params:
             reads -= splitRegister(r)
     return DependencySet(reads, self.target_depset.writes)
示例#8
0
def encodeDependencySet(depset):
    return ", ".join(str(x) for x in joinRegisters(depset.reads)) + " -> " + ", ".join(str(x) for x in joinRegisters(depset.writes))
示例#9
0
 def __str__(self):
     return 'DependencySet({0}, {1})'.format(joinRegisters(self.reads), joinRegisters(self.writes))