added opcode property to llvm.mc.Instr

This commit is contained in:
anthony cantor 2013-09-03 00:10:41 -06:00 • committed by Siu Kwan Lam
commit 65c4558cac
2 changed files with 7 additions and 2 deletions

View file

@ -91,7 +91,7 @@ class Instr(object):
@property
def instr_desc(self):
return self.tm.instr_info.get(self.mcinst.getOpcode())
return self.tm.instr_info.get(self.opcode)
@property
def flags(self):
@ -101,6 +101,11 @@ class Instr(object):
def ts_flags(self):
return self.instr_desc.TSFlags
@property
def opcode(self):
return self.mcinst.getOpcode()
class BadInstr(Instr):
pass

View file

@ -21,7 +21,7 @@ if llvm.version >= (3, 4):
else:
print("\t0x%x ops = %s" % (addr, ops))
print("\t\tflags = 0x%x, tsflags = 0x%x" % (inst.flags, inst.ts_flags))
print("\t\topcode = 0x%x, flags = 0x%x, tsflags = 0x%x" % (inst.opcode, inst.flags, inst.ts_flags))
for line in str(inst).split("\n"):
print("\t\t%-24s %s" % ("".join(map(lambda b: "%02x" % b, data))+":", line.strip()))