def use(cls, regs):
_instruction = sys.modules.get('instruction', __import__('instruction'))
# convert any regs that are strings into their correct object type
regs = { _instruction.reg.by_name(r) if isinstance(r, basestring) else r for r in regs }
# returns an iterable of bools that returns whether r is a subset of any of the registers in ``regs``.
match = lambda r, regs=regs: any(itertools.imap(r.relatedQ, regs))
# returns true if the operand at the specified address is related to one of the registers in ``regs``.
def uses_register(ea, opnum):
val = _instruction.op_value(ea, opnum)
if isinstance(val, symbol_t):
return any(map(match, val.__symbols__))
return False
return uses_register
评论列表
文章目录