add flags, ts_flags properties for Instr class
This commit is contained in:
parent
cadc53f174
commit
3c06f0d590
3 changed files with 13 additions and 2 deletions
|
|
@ -87,6 +87,18 @@ class Instr(object):
|
||||||
|
|
||||||
return l
|
return l
|
||||||
|
|
||||||
|
@property
|
||||||
|
def instr_desc(self):
|
||||||
|
return self.tm.instr_info.get(self.mcinst.getOpcode())
|
||||||
|
|
||||||
|
@property
|
||||||
|
def flags(self):
|
||||||
|
return self.instr_desc.getFlags()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def ts_flags(self):
|
||||||
|
return self.instr_desc.TSFlags
|
||||||
|
|
||||||
class BadInstr(Instr):
|
class BadInstr(Instr):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ if llvm.version >= (3, 4):
|
||||||
else:
|
else:
|
||||||
print("\t0x%x ops = %s" % (addr, ops))
|
print("\t0x%x ops = %s" % (addr, ops))
|
||||||
|
|
||||||
|
print("\t\tflags = 0x%x, tsflags = 0x%x" % (inst.flags, inst.ts_flags))
|
||||||
for line in str(inst).split("\n"):
|
for line in str(inst).split("\n"):
|
||||||
print("\t%s" % (line))
|
print("\t%s" % (line))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,12 @@ def main():
|
||||||
triple = "i386--"
|
triple = "i386--"
|
||||||
|
|
||||||
print("init start")
|
print("init start")
|
||||||
'''
|
|
||||||
api.llvm.InitializeAllTargets()
|
api.llvm.InitializeAllTargets()
|
||||||
api.llvm.InitializeAllTargetInfos()
|
api.llvm.InitializeAllTargetInfos()
|
||||||
api.llvm.InitializeAllTargetMCs()
|
api.llvm.InitializeAllTargetMCs()
|
||||||
api.llvm.InitializeAllAsmParsers()
|
api.llvm.InitializeAllAsmParsers()
|
||||||
api.llvm.InitializeAllAsmPrinters()
|
api.llvm.InitializeAllAsmPrinters()
|
||||||
api.llvm.InitializeAllDisassemblers()
|
api.llvm.InitializeAllDisassemblers()
|
||||||
'''
|
|
||||||
print("init done\n")
|
print("init done\n")
|
||||||
|
|
||||||
tm = llvm.target.TargetMachine.x86()
|
tm = llvm.target.TargetMachine.x86()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue