diff --git a/llvm/mc/__init__.py b/llvm/mc/__init__.py index f165d5d..b177827 100644 --- a/llvm/mc/__init__.py +++ b/llvm/mc/__init__.py @@ -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 diff --git a/test/example-disassemble.py b/test/example-disassemble.py index 862036f..bb9d47b 100644 --- a/test/example-disassemble.py +++ b/test/example-disassemble.py @@ -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()))