[Lldb-commits] [lldb] r128248 - in /lldb/trunk: include/lldb/Core/Disassembler.h include/lldb/Core/EmulateInstruction.h include/lldb/Core/Opcode.h include/lldb/lldb-private-types.h lldb.xcodeproj/project.pbxproj source/Core/Disassembler.cpp source/Core/EmulateInstruction.cpp source/Core/Opcode.cpp source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp source/Plugins/Disassembler/llvm/DisassemblerLLVM.h source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp source/Plugins/Instruction/ARM/EmulateInstructionARM.h

Greg Clayton gclayton at apple.com
Thu Mar 24 16:53:38 PDT 2011


Author: gclayton
Date: Thu Mar 24 18:53:38 2011
New Revision: 128248

URL: http://llvm.org/viewvc/llvm-project?rev=128248&view=rev
Log:
Made the lldb_private::Opcode struct into a real boy... I mean class.

Modified the Disassembler::Instruction base class to contain an Opcode 
instance so that we can know the bytes for an instruction without needing
to keep the data around.

Modified the DisassemblerLLVM's instruction class to correctly extract the
opcode bytes if all goes well.


Added:
    lldb/trunk/include/lldb/Core/Opcode.h
    lldb/trunk/source/Core/Opcode.cpp
Modified:
    lldb/trunk/include/lldb/Core/Disassembler.h
    lldb/trunk/include/lldb/Core/EmulateInstruction.h
    lldb/trunk/include/lldb/lldb-private-types.h
    lldb/trunk/lldb.xcodeproj/project.pbxproj
    lldb/trunk/source/Core/Disassembler.cpp
    lldb/trunk/source/Core/EmulateInstruction.cpp
    lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
    lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.h
    lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
    lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h

Modified: lldb/trunk/include/lldb/Core/Disassembler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Disassembler.h?rev=128248&r1=128247&r2=128248&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Disassembler.h (original)
+++ lldb/trunk/include/lldb/Core/Disassembler.h Thu Mar 24 18:53:38 2011
@@ -19,6 +19,7 @@
 #include "lldb/lldb-private.h"
 #include "lldb/Core/Address.h"
 #include "lldb/Core/ArchSpec.h"
+#include "lldb/Core/Opcode.h"
 #include "lldb/Core/PluginInterface.h"
 
 namespace lldb_private {
@@ -27,6 +28,7 @@
 {
 public:
     Instruction (const Address &addr);
+    Instruction (const Address &addr, const Opcode &opcode);
 
     virtual
    ~Instruction();
@@ -59,10 +61,19 @@
     DoesBranch () const = 0;
 
     virtual size_t
-    Extract (const DataExtractor& data, uint32_t data_offset) = 0;
+    Extract (const Disassembler &disassembler, 
+             const DataExtractor& data, 
+             uint32_t data_offset) = 0;
+
+    const Opcode &
+    GetOpcode () const
+    {
+        return m_opcode;
+    }
 
 protected:
-    Address m_addr;  // The section offset address of this instruction
+    Address m_addr; // The section offset address of this instruction
+    Opcode m_opcode; // The opcode for this instruction
 };
 
 
@@ -206,6 +217,12 @@
     const InstructionList &
     GetInstructionList () const;
 
+    const ArchSpec &
+    GetArchitecture () const
+    {
+        return m_arch;
+    }
+
 protected:
     //------------------------------------------------------------------
     // Classes that inherit from Disassembler can see and modify these

Modified: lldb/trunk/include/lldb/Core/EmulateInstruction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/EmulateInstruction.h?rev=128248&r1=128247&r2=128248&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/EmulateInstruction.h (original)
+++ lldb/trunk/include/lldb/Core/EmulateInstruction.h Thu Mar 24 18:53:38 2011
@@ -12,6 +12,7 @@
 
 #include "lldb/lldb-public.h"
 #include "lldb/Core/PluginInterface.h"
+#include "lldb/Core/Opcode.h"
 
 //----------------------------------------------------------------------
 /// @class EmulateInstruction EmulateInstruction.h "lldb/Core/EmulateInstruction.h"
@@ -432,22 +433,10 @@
         return m_byte_order;
     }
 
-    uint64_t
-    OpcodeAsUnsigned (bool *success_ptr)
+    const Opcode &
+    GetOpcode () const
     {
-        if (success_ptr)
-            *success_ptr = true;
-        switch (m_opcode.type)
-        {
-        case eOpcode8:     return m_opcode.data.inst8;
-        case eOpcode16:    return m_opcode.data.inst16;
-        case eOpcode32:    return m_opcode.data.inst32;
-        case eOpcode64:    return m_opcode.data.inst64;
-        case eOpcodeBytes: break;
-        }
-        if (success_ptr)
-            *success_ptr = false;
-        return 0;
+        return m_opcode;
     }
 
 protected:

Added: lldb/trunk/include/lldb/Core/Opcode.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Opcode.h?rev=128248&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Core/Opcode.h (added)
+++ lldb/trunk/include/lldb/Core/Opcode.h Thu Mar 24 18:53:38 2011
@@ -0,0 +1,217 @@
+//===-- Opcode.h ------------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_Opcode_h
+#define lldb_Opcode_h
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-public.h"
+
+namespace lldb_private {
+
+    class Opcode
+    {
+    public:
+        enum Type
+        {
+            eTypeInvalid,
+            eType8,
+            eType16,
+            eType32,
+            eType64,
+            eTypeBytes
+        };
+        
+        Opcode () : m_type (eTypeInvalid)
+        {
+        }
+
+        Opcode (uint8_t inst) : m_type (eType8)
+        {
+            m_data.inst8 = inst;
+        }
+
+        Opcode (uint16_t inst) : m_type (eType16)
+        {
+            m_data.inst16 = inst;
+        }
+
+        Opcode (uint32_t inst) : m_type (eType32)
+        {
+            m_data.inst32 = inst;
+        }
+
+        Opcode (uint64_t inst) : m_type (eType64)
+        {
+            m_data.inst64 = inst;
+        }
+
+        Opcode (uint8_t *bytes, size_t length)
+        {
+            SetOpcodeBytes (bytes, length);
+        }
+
+        Opcode::Type
+        GetType () const
+        {
+            return m_type;
+        }
+    
+        uint8_t
+        GetOpcode8 (uint8_t invalid_opcode = UINT8_MAX) const
+        {
+            switch (m_type)
+            {
+            case Opcode::eTypeInvalid:  break;
+            case Opcode::eType8:        return m_data.inst8;
+            case Opcode::eType16:       break;
+            case Opcode::eType32:       break;
+            case Opcode::eType64:       break;
+            case Opcode::eTypeBytes:    break;
+                break;
+            }
+            return invalid_opcode;
+        }
+
+        uint16_t
+        GetOpcode16 (uint16_t invalid_opcode = UINT16_MAX) const
+        {
+            switch (m_type)
+            {
+            case Opcode::eTypeInvalid:  break;
+            case Opcode::eType8:        return m_data.inst8;
+            case Opcode::eType16:       return m_data.inst16;
+            case Opcode::eType32:       break;
+            case Opcode::eType64:       break;
+            case Opcode::eTypeBytes:    break;
+            }
+            return invalid_opcode;
+        }
+
+        uint32_t
+        GetOpcode32 (uint32_t invalid_opcode = UINT32_MAX) const
+        {
+            switch (m_type)
+            {
+            case Opcode::eTypeInvalid:  break;
+            case Opcode::eType8:        return m_data.inst8;
+            case Opcode::eType16:       return m_data.inst16;
+            case Opcode::eType32:       return m_data.inst32;
+            case Opcode::eType64:       break;
+            case Opcode::eTypeBytes:    break;
+            }
+            return invalid_opcode;
+        }
+
+        uint64_t
+        GetOpcode64 (uint64_t invalid_opcode = UINT64_MAX) const
+        {
+            switch (m_type)
+            {
+            case Opcode::eTypeInvalid:  break;
+            case Opcode::eType8:        return m_data.inst8;
+            case Opcode::eType16:       return m_data.inst16;
+            case Opcode::eType32:       return m_data.inst32;
+            case Opcode::eType64:       return m_data.inst64;
+            case Opcode::eTypeBytes:    break;
+            }
+            return invalid_opcode;
+        }
+
+        void
+        SetOpcode8 (uint8_t inst)
+        {
+            m_type = eType8;
+            m_data.inst8 = inst;
+        }
+
+        void
+        SetOpcode16 (uint16_t inst)
+        {
+            m_type = eType16;
+            m_data.inst16 = inst;
+        }
+
+        void
+        SetOpcode32 (uint32_t inst)
+        {
+            m_type = eType32;
+            m_data.inst32 = inst;
+        }
+
+        void
+        SetOpcode64 (uint64_t inst)
+        {
+            m_type = eType64;
+            m_data.inst64 = inst;
+        }
+
+        void
+        SetOpcodeBytes (const void *bytes, size_t length)
+        {
+            if (bytes && length > 0)
+            {
+                m_type = eTypeBytes;
+                assert (length < sizeof (m_data.inst.bytes));
+                memcpy (m_data.inst.bytes, bytes, length);
+            }
+            else
+            {
+                m_type = eTypeInvalid;
+                m_data.inst.length = 0;
+            }
+        }
+
+        const void *
+        GetOpcodeBytes () const
+        {
+            if (m_type == Opcode::eTypeBytes)
+                return m_data.inst.bytes;
+            return NULL;
+        }
+        
+        uint32_t
+        GetByteSize () const
+        {
+            switch (m_type)
+            {
+            case Opcode::eTypeInvalid: break;
+            case Opcode::eType8:     return sizeof(m_data.inst8);
+            case Opcode::eType16:    return sizeof(m_data.inst16);
+            case Opcode::eType32:    return sizeof(m_data.inst32);
+            case Opcode::eType64:    return sizeof(m_data.inst64);
+            case Opcode::eTypeBytes: return m_data.inst.length;
+            }
+            return 0;
+        }
+
+
+    protected:
+
+        Opcode::Type m_type;
+        union
+        {
+            uint8_t inst8;
+            uint16_t inst16;
+            uint32_t inst32;
+            uint64_t inst64;
+            struct 
+            {
+                uint8_t length;
+                uint8_t bytes[16]; // This must be big enough to handle any opcode for any supported target.
+            } inst;
+        } m_data;
+    };
+
+} // namespace lldb_private
+
+#endif	// lldb_Opcode_h

Modified: lldb/trunk/include/lldb/lldb-private-types.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-types.h?rev=128248&r1=128247&r2=128248&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-private-types.h (original)
+++ lldb/trunk/include/lldb/lldb-private-types.h Thu Mar 24 18:53:38 2011
@@ -65,33 +65,6 @@
                                                  // pass it.
     } OptionDefinition;
 
-
-    enum OpcodeType
-    {
-        eOpcode8,
-        eOpcode16,
-        eOpcode32,
-        eOpcode64,
-        eOpcodeBytes
-    };
-
-    struct Opcode
-    {
-        OpcodeType type;
-        union
-        {
-            uint8_t inst8;
-            uint16_t inst16;
-            uint32_t inst32;
-            uint64_t inst64;
-            struct 
-            {
-                uint8_t length;
-                uint8_t bytes[16]; // This must be big enough to handle any opcode for any supported target.
-            } inst;
-        } data;
-    };
-
 } // namespace lldb_private
 
 #endif  // #if defined(__cplusplus)

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=128248&r1=128247&r2=128248&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Mar 24 18:53:38 2011
@@ -16,6 +16,8 @@
 		264A97BF133918BC0017F0BE /* PlatformRemoteGDBServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 264A97BD133918BC0017F0BE /* PlatformRemoteGDBServer.cpp */; };
 		264A97C0133918BC0017F0BE /* PlatformRemoteGDBServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 264A97BE133918BC0017F0BE /* PlatformRemoteGDBServer.h */; };
 		265ABF6310F42EE900531910 /* DebugSymbols.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 265ABF6210F42EE900531910 /* DebugSymbols.framework */; };
+		26651A16133BF9CD005B64B7 /* Opcode.h in Headers */ = {isa = PBXBuildFile; fileRef = 26651A15133BF9CC005B64B7 /* Opcode.h */; };
+		26651A18133BF9E0005B64B7 /* Opcode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26651A17133BF9DF005B64B7 /* Opcode.cpp */; };
 		2668020E115FD12C008E1FE4 /* lldb-defines.h in Headers */ = {isa = PBXBuildFile; fileRef = 26BC7C2510F1B3BC00F91463 /* lldb-defines.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		2668020F115FD12C008E1FE4 /* lldb-enumerations.h in Headers */ = {isa = PBXBuildFile; fileRef = 26BC7C2610F1B3BC00F91463 /* lldb-enumerations.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		26680214115FD12C008E1FE4 /* lldb-types.h in Headers */ = {isa = PBXBuildFile; fileRef = 26BC7C2910F1B3BC00F91463 /* lldb-types.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -631,6 +633,8 @@
 		2660D9F711922A1300958FBD /* StringExtractor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringExtractor.h; path = source/Utility/StringExtractor.h; sourceTree = "<group>"; };
 		2660D9FE11922A7F00958FBD /* ThreadPlanStepUntil.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanStepUntil.cpp; path = source/Target/ThreadPlanStepUntil.cpp; sourceTree = "<group>"; };
 		26651A14133BEC76005B64B7 /* lldb-public.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "lldb-public.h"; path = "include/lldb/lldb-public.h"; sourceTree = "<group>"; };
+		26651A15133BF9CC005B64B7 /* Opcode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Opcode.h; path = include/lldb/Core/Opcode.h; sourceTree = "<group>"; };
+		26651A17133BF9DF005B64B7 /* Opcode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Opcode.cpp; path = source/Core/Opcode.cpp; sourceTree = "<group>"; };
 		26680207115FD0ED008E1FE4 /* LLDB.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = LLDB.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		266960591199F4230075C61A /* build-llvm.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = "build-llvm.pl"; sourceTree = "<group>"; };
 		2669605A1199F4230075C61A /* build-swig-wrapper-classes.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "build-swig-wrapper-classes.sh"; sourceTree = "<group>"; };
@@ -1832,6 +1836,8 @@
 				26BC7E8210F1B85900F91463 /* ModuleChild.cpp */,
 				26BC7D6C10F1B77400F91463 /* ModuleList.h */,
 				26BC7E8310F1B85900F91463 /* ModuleList.cpp */,
+				26651A15133BF9CC005B64B7 /* Opcode.h */,
+				26651A17133BF9DF005B64B7 /* Opcode.cpp */,
 				26BC7D7010F1B77400F91463 /* PluginInterface.h */,
 				26BC7D7110F1B77400F91463 /* PluginManager.h */,
 				26BC7E8A10F1B85900F91463 /* PluginManager.cpp */,
@@ -2521,6 +2527,7 @@
 				26744EF41338317700EF765A /* GDBRemoteCommunicationServer.h in Headers */,
 				264A97C0133918BC0017F0BE /* PlatformRemoteGDBServer.h in Headers */,
 				2697A54E133A6305004E4240 /* PlatformDarwin.h in Headers */,
+				26651A16133BF9CD005B64B7 /* Opcode.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -3080,6 +3087,7 @@
 				26744EF31338317700EF765A /* GDBRemoteCommunicationServer.cpp in Sources */,
 				264A97BF133918BC0017F0BE /* PlatformRemoteGDBServer.cpp in Sources */,
 				2697A54D133A6305004E4240 /* PlatformDarwin.cpp in Sources */,
+				26651A18133BF9E0005B64B7 /* Opcode.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: lldb/trunk/source/Core/Disassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=128248&r1=128247&r2=128248&view=diff
==============================================================================
--- lldb/trunk/source/Core/Disassembler.cpp (original)
+++ lldb/trunk/source/Core/Disassembler.cpp Thu Mar 24 18:53:38 2011
@@ -469,6 +469,14 @@
 Instruction::Instruction(const Address &addr) :
     m_addr (addr)
 {
+    ::memset (&m_opcode, 0, sizeof (m_opcode));
+}
+
+
+Instruction::Instruction(const Address &addr, const Opcode &opcode) :
+    m_addr (addr),
+    m_opcode (opcode)
+{
 }
 
 Instruction::~Instruction()

Modified: lldb/trunk/source/Core/EmulateInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/EmulateInstruction.cpp?rev=128248&r1=128247&r2=128248&view=diff
==============================================================================
--- lldb/trunk/source/Core/EmulateInstruction.cpp (original)
+++ lldb/trunk/source/Core/EmulateInstruction.cpp Thu Mar 24 18:53:38 2011
@@ -59,9 +59,9 @@
     m_write_mem_callback (write_mem_callback),
     m_read_reg_callback (read_reg_callback),
     m_write_reg_callback (write_reg_callback),
+    m_opcode (),
     m_opcode_pc (LLDB_INVALID_ADDRESS)
 {
-    ::memset (&m_opcode, 0, sizeof (m_opcode));
 }
 
 uint64_t

Added: lldb/trunk/source/Core/Opcode.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Opcode.cpp?rev=128248&view=auto
==============================================================================
--- lldb/trunk/source/Core/Opcode.cpp (added)
+++ lldb/trunk/source/Core/Opcode.cpp Thu Mar 24 18:53:38 2011
@@ -0,0 +1,18 @@
+//===-- Baton.cpp -----------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Core/Opcode.h"
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+
+using namespace lldb;
+using namespace lldb_private;
\ No newline at end of file

Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp?rev=128248&r1=128247&r2=128248&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp (original)
+++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Thu Mar 24 18:53:38 2011
@@ -32,7 +32,7 @@
 
 
 static int 
-DataExtractorByteReader(uint8_t *byte, uint64_t address, void *arg)
+DataExtractorByteReader (uint8_t *byte, uint64_t address, void *arg)
 {
     DataExtractor &extractor = *((DataExtractor *)arg);
 
@@ -74,7 +74,7 @@
     return -1;
 }
 
-DisassemblerLLVM::InstructionLLVM::InstructionLLVM (EDDisassemblerRef disassembler, const Address &addr) :
+DisassemblerLLVM::InstructionLLVM::InstructionLLVM (const Address &addr, EDDisassemblerRef disassembler) :
     Instruction (addr),
     m_disassembler (disassembler)
 {
@@ -334,10 +334,41 @@
 }
 
 size_t
-DisassemblerLLVM::InstructionLLVM::Extract(const DataExtractor &data, uint32_t data_offset)
+DisassemblerLLVM::InstructionLLVM::Extract (const Disassembler &disassembler, 
+                                            const lldb_private::DataExtractor &data,
+                                            uint32_t data_offset)
 {
     if (EDCreateInsts(&m_inst, 1, m_disassembler, DataExtractorByteReader, data_offset, (void*)(&data)))
-        return EDInstByteSize(m_inst);
+    {
+        const int byte_size = EDInstByteSize(m_inst);
+        uint32_t offset = data_offset;
+        // Make a copy of the opcode in m_opcode
+        switch (disassembler.GetArchitecture().GetMachine())
+        {
+        case llvm::Triple::x86:
+        case llvm::Triple::x86_64:
+            m_opcode.SetOpcodeBytes (data.PeekData (data_offset, byte_size), byte_size);
+            break;
+
+        case llvm::Triple::arm:
+            assert (byte_size == 4);
+            m_opcode.SetOpcode32 (data.GetU32 (&offset));
+            break;
+
+        case llvm::Triple::thumb:
+            assert ((byte_size == 2) || (byte_size == 4));
+            if (byte_size == 2)
+                m_opcode.SetOpcode16 (data.GetU16 (&offset));
+            else
+                m_opcode.SetOpcode32 (data.GetU32 (&offset));
+            break;
+
+        default:
+            assert (!"This shouldn't happen since we control the architecture we allow DisassemblerLLVM to be created for");
+            break;
+        }
+        return byte_size;
+    }
     else
         return 0;
 }
@@ -430,10 +461,10 @@
             if (inst_addr.GetAddressClass () == eAddressClassCodeAlternateISA)
                 use_thumb = true;
         }
-        InstructionSP inst_sp (new InstructionLLVM (use_thumb ? m_disassembler_thumb : m_disassembler, 
-                                                    inst_addr));
+        InstructionSP inst_sp (new InstructionLLVM (inst_addr, 
+                                                    use_thumb ? m_disassembler_thumb : m_disassembler));
 
-        size_t inst_byte_size = inst_sp->Extract (data, data_offset);
+        size_t inst_byte_size = inst_sp->Extract (*this, data, data_offset);
 
         if (inst_byte_size == 0)
             break;

Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.h?rev=128248&r1=128247&r2=128248&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.h (original)
+++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.h Thu Mar 24 18:53:38 2011
@@ -22,7 +22,8 @@
     class InstructionLLVM : public lldb_private::Instruction
     {
     public:
-        InstructionLLVM(EDDisassemblerRef disassembler, const lldb_private::Address &addr);
+        InstructionLLVM (const lldb_private::Address &addr,
+                         EDDisassemblerRef disassembler);
 
         virtual
         ~InstructionLLVM();
@@ -42,7 +43,8 @@
         GetByteSize() const;
 
         size_t
-        Extract (const lldb_private::DataExtractor &data,
+        Extract (const Disassembler &disassembler,
+                 const lldb_private::DataExtractor &data,
                  uint32_t data_offset);
 
     protected:

Modified: lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp?rev=128248&r1=128247&r2=128248&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp (original)
+++ lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp Thu Mar 24 18:53:38 2011
@@ -190,7 +190,7 @@
 // consecutive memory locations ending just below the address in SP, and updates
 // SP to point to the start of the stored data.
 bool 
-EmulateInstructionARM::EmulatePUSH (ARMEncoding encoding)
+EmulateInstructionARM::EmulatePUSH (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -220,11 +220,7 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
-
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         const uint32_t addr_byte_size = GetAddressByteSize();
         const addr_t sp = ReadCoreReg (SP_REG, &success);
@@ -321,7 +317,7 @@
 // consecutive memory locations staring at the address in SP, and updates
 // SP to point just above the loaded data.
 bool 
-EmulateInstructionARM::EmulatePOP (ARMEncoding encoding)
+EmulateInstructionARM::EmulatePOP (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -343,11 +339,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         const uint32_t addr_byte_size = GetAddressByteSize();
         const addr_t sp = ReadCoreReg (SP_REG, &success);
@@ -454,7 +447,7 @@
 // Set r7 or ip to point to saved value residing within the stack.
 // ADD (SP plus immediate)
 bool
-EmulateInstructionARM::EmulateADDRdSPImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateADDRdSPImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -475,11 +468,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         const addr_t sp = ReadCoreReg (SP_REG, &success);
         if (!success)
@@ -516,7 +506,7 @@
 // Set r7 or ip to the current stack pointer.
 // MOV (register)
 bool
-EmulateInstructionARM::EmulateMOVRdSP (ARMEncoding encoding)
+EmulateInstructionARM::EmulateMOVRdSP (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -537,11 +527,8 @@
 #endif
 
     bool success = false;
-    //const uint32_t opcode = OpcodeAsUnsigned (&success);
-    //if (!success)
-    //    return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         const addr_t sp = ReadCoreReg (SP_REG, &success);
         if (!success)
@@ -573,15 +560,15 @@
 // Move from high register (r8-r15) to low register (r0-r7).
 // MOV (register)
 bool
-EmulateInstructionARM::EmulateMOVLowHigh (ARMEncoding encoding)
+EmulateInstructionARM::EmulateMOVLowHigh (const uint32_t opcode, const ARMEncoding encoding)
 {
-    return EmulateMOVRdRm (encoding);
+    return EmulateMOVRdRm (opcode, encoding);
 }
 
 // Move from register to register.
 // MOV (register)
 bool
-EmulateInstructionARM::EmulateMOVRdRm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateMOVRdRm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -602,11 +589,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rm; // the source register
         uint32_t Rd; // the destination register
@@ -670,7 +654,7 @@
 // can optionally update the condition flags based on the value.
 // MOV (immediate)
 bool
-EmulateInstructionARM::EmulateMOVRdImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateMOVRdImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -689,12 +673,8 @@
                 // APSR.V unchanged
     }
 #endif
-    bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rd; // the destination register
         uint32_t imm32; // the immediate value to be written to Rd
@@ -737,7 +717,7 @@
 // Optionally, it can update the condition flags based on the result.  In the Thumb instruction set, this option is 
 // limited to only a few forms of the instruction.
 bool
-EmulateInstructionARM::EmulateMUL (ARMEncoding encoding)
+EmulateInstructionARM::EmulateMUL (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -754,13 +734,8 @@
             // else APSR.C unchanged 
             // APSR.V always unchanged
 #endif
-                  
-    bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
     
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t d;
         uint32_t n;
@@ -816,7 +791,9 @@
             default:
                 return false;
         }
-                  
+
+        bool success = false;
+
         // operand1 = SInt(R[n]); // operand1 = UInt(R[n]) produces the same final results
         uint64_t operand1 = ReadRegisterUnsigned (eRegisterKindDWARF, dwarf_r0 + n, 0, &success);
         if (!success)
@@ -867,7 +844,7 @@
 // Bitwise NOT (immediate) writes the bitwise inverse of an immediate value to the destination register.
 // It can optionally update the condition flags based on the value.
 bool
-EmulateInstructionARM::EmulateMVNImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateMVNImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -886,12 +863,8 @@
                 // APSR.V unchanged
     }
 #endif
-    bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rd; // the destination register
         uint32_t imm32; // the output after ThumbExpandImm_C or ARMExpandImm_C
@@ -931,7 +904,7 @@
 // Bitwise NOT (register) writes the bitwise inverse of a register value to the destination register.
 // It can optionally update the condition flags based on the result.
 bool
-EmulateInstructionARM::EmulateMVNReg (ARMEncoding encoding)
+EmulateInstructionARM::EmulateMVNReg (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -952,12 +925,7 @@
     }
 #endif
 
-    bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
-
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rm; // the source register
         uint32_t Rd; // the destination register
@@ -993,6 +961,7 @@
         default:
             return false;
         }
+        bool success = false;
         uint32_t value = ReadCoreReg(Rm, &success);
         if (!success)
             return false;
@@ -1014,7 +983,7 @@
 // PC relative immediate load into register, possibly followed by ADD (SP plus register).
 // LDR (literal)
 bool
-EmulateInstructionARM::EmulateLDRRtPCRelative (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLDRRtPCRelative (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -1036,13 +1005,9 @@
     }
 #endif
 
-    bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
-
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
+        bool success = false;
         const uint32_t pc = ReadCoreReg(PC_REG, &success);
         if (!success)
             return false;
@@ -1114,7 +1079,7 @@
 // An add operation to adjust the SP.
 // ADD (SP plus immediate)
 bool
-EmulateInstructionARM::EmulateADDSPImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateADDSPImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -1135,11 +1100,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         const addr_t sp = ReadCoreReg (SP_REG, &success);
         if (!success)
@@ -1192,7 +1154,7 @@
 // An add operation to adjust the SP.
 // ADD (SP plus register)
 bool
-EmulateInstructionARM::EmulateADDSPRm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateADDSPRm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -1214,11 +1176,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         const addr_t sp = ReadCoreReg (SP_REG, &success);
         if (!success)
@@ -1252,7 +1211,7 @@
 // from Thumb to ARM.
 // BLX (immediate)
 bool
-EmulateInstructionARM::EmulateBLXImmediate (ARMEncoding encoding)
+EmulateInstructionARM::EmulateBLXImmediate (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -1272,12 +1231,9 @@
     }
 #endif
 
-    bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
+    bool success = true;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         EmulateInstruction::Context context;
         context.type = EmulateInstruction::eContextRelativeBranchImmediate;
@@ -1351,7 +1307,7 @@
 // instruction set specified by a register.
 // BLX (register)
 bool
-EmulateInstructionARM::EmulateBLXRm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateBLXRm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -1370,11 +1326,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         EmulateInstruction::Context context;
         context.type = EmulateInstruction::eContextAbsoluteBranchRegister;
@@ -1419,7 +1372,7 @@
 
 // Branch and Exchange causes a branch to an address and instruction set specified by a register.
 bool
-EmulateInstructionARM::EmulateBXRm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateBXRm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -1430,12 +1383,7 @@
     }
 #endif
 
-    bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
-
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         EmulateInstruction::Context context;
         context.type = EmulateInstruction::eContextAbsoluteBranchRegister;
@@ -1452,6 +1400,7 @@
         default:
             return false;
         }
+        bool success = false;
         addr_t target = ReadCoreReg (Rm, &success);
         if (!success)
             return false;
@@ -1471,7 +1420,7 @@
 // TODO: Emulate Jazelle architecture?
 //       We currently assume that switching to Jazelle state fails, thus treating BXJ as a BX operation.
 bool
-EmulateInstructionARM::EmulateBXJRm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateBXJRm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -1488,12 +1437,7 @@
     }
 #endif
 
-    bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
-
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         EmulateInstruction::Context context;
         context.type = EmulateInstruction::eContextAbsoluteBranchRegister;
@@ -1514,6 +1458,7 @@
         default:
             return false;
         }
+        bool success = false;
         addr_t target = ReadCoreReg (Rm, &success);
         if (!success)
             return false;
@@ -1530,7 +1475,7 @@
 // Set r7 to point to some ip offset.
 // SUB (immediate)
 bool
-EmulateInstructionARM::EmulateSUBR7IPImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateSUBR7IPImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -1550,13 +1495,9 @@
     }
 #endif
 
-    bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
-
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
+        bool success = false;
         const addr_t ip = ReadCoreReg (12, &success);
         if (!success)
             return false;
@@ -1586,7 +1527,7 @@
 // Set ip to point to some stack offset.
 // SUB (SP minus immediate)
 bool
-EmulateInstructionARM::EmulateSUBIPSPImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateSUBIPSPImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -1606,13 +1547,9 @@
     }
 #endif
 
-    bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
-
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
+        bool success = false;
         const addr_t sp = ReadCoreReg (SP_REG, &success);
         if (!success)
             return false;
@@ -1644,7 +1581,7 @@
 //
 // If Rd == 13 => A sub operation to adjust the SP -- allocate space for local storage.
 bool
-EmulateInstructionARM::EmulateSUBSPImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateSUBSPImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -1665,11 +1602,7 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
-
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         const addr_t sp = ReadCoreReg (SP_REG, &success);
         if (!success)
@@ -1689,7 +1622,7 @@
             setflags = BitIsSet(opcode, 20);
             imm32 = ThumbExpandImm(opcode); // imm32 = ThumbExpandImm(i:imm3:imm8)
             if (Rd == 15 && setflags)
-                return EmulateCMPImm(eEncodingT2);
+                return EmulateCMPImm(opcode, eEncodingT2);
             if (Rd == 15 && !setflags)
                 return false;
             break;
@@ -1736,7 +1669,7 @@
 
 // A store operation to the stack that also updates the SP.
 bool
-EmulateInstructionARM::EmulateSTRRtSP (ARMEncoding encoding)
+EmulateInstructionARM::EmulateSTRRtSP (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -1751,11 +1684,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         const uint32_t addr_byte_size = GetAddressByteSize();
         const addr_t sp = ReadCoreReg (SP_REG, &success);
@@ -1836,7 +1766,7 @@
 // Vector Push stores multiple extension registers to the stack.
 // It also updates SP to point to the start of the stored data.
 bool 
-EmulateInstructionARM::EmulateVPUSH (ARMEncoding encoding)
+EmulateInstructionARM::EmulateVPUSH (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -1858,11 +1788,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         const uint32_t addr_byte_size = GetAddressByteSize();
         const addr_t sp = ReadCoreReg (SP_REG, &success);
@@ -1932,7 +1859,7 @@
 // Vector Pop loads multiple extension registers from the stack.
 // It also updates SP to point just above the loaded data.
 bool 
-EmulateInstructionARM::EmulateVPOP (ARMEncoding encoding)
+EmulateInstructionARM::EmulateVPOP (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -1953,11 +1880,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         const uint32_t addr_byte_size = GetAddressByteSize();
         const addr_t sp = ReadCoreReg (SP_REG, &success);
@@ -2026,7 +1950,7 @@
 
 // SVC (previously SWI)
 bool
-EmulateInstructionARM::EmulateSVC (ARMEncoding encoding)
+EmulateInstructionARM::EmulateSVC (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -2038,11 +1962,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         const uint32_t pc = ReadCoreReg(PC_REG, &success);
         addr_t lr; // next instruction address
@@ -2076,7 +1997,7 @@
 
 // If Then makes up to four following instructions (the IT block) conditional.
 bool
-EmulateInstructionARM::EmulateIT (ARMEncoding encoding)
+EmulateInstructionARM::EmulateIT (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -2084,18 +2005,13 @@
     ITSTATE.IT<7:0> = firstcond:mask;
 #endif
 
-    bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
-
     m_it_session.InitIT(Bits32(opcode, 7, 0));
     return true;
 }
 
 // Branch causes a branch to a target address.
 bool
-EmulateInstructionARM::EmulateB (ARMEncoding encoding)
+EmulateInstructionARM::EmulateB (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -2107,11 +2023,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         EmulateInstruction::Context context;
         context.type = EmulateInstruction::eContextRelativeBranchImmediate;
@@ -2179,7 +2092,7 @@
 // zero and conditionally branch forward a constant value.  They do not affect the condition flags.
 // CBNZ, CBZ
 bool
-EmulateInstructionARM::EmulateCB (ARMEncoding encoding)
+EmulateInstructionARM::EmulateCB (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -2189,9 +2102,6 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
     // Read the register value from the operand register Rn.
     uint32_t reg_val = ReadCoreReg(Bits32(opcode, 2, 0), &success);
@@ -2233,7 +2143,7 @@
 // The branch length is twice the value of the halfword returned from the table.
 // TBB, TBH
 bool
-EmulateInstructionARM::EmulateTB (ARMEncoding encoding)
+EmulateInstructionARM::EmulateTB (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -2246,9 +2156,6 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
     uint32_t Rn;     // the base register which contains the address of the table of branch lengths
     uint32_t Rm;     // the index register which contains an integer pointing to a byte/halfword in the table
@@ -2306,7 +2213,7 @@
 // This instruction adds an immediate value to a register value, and writes the result to the destination register.  
 // It can optionally update the condition flags based on the result.
 bool
-EmulateInstructionARM::EmulateADDImmThumb (ARMEncoding encoding)
+EmulateInstructionARM::EmulateADDImmThumb (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -2321,11 +2228,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t d;
         uint32_t n;
@@ -2422,7 +2326,7 @@
 // This instruction adds an immediate value to a register value, and writes the result to the destination
 // register.  It can optionally update the condition flags based on the result.
 bool
-EmulateInstructionARM::EmulateADDImmARM (ARMEncoding encoding)
+EmulateInstructionARM::EmulateADDImmARM (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -2441,11 +2345,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rd, Rn;
         uint32_t imm32; // the immediate value to be added to the value obtained from Rn
@@ -2482,7 +2383,7 @@
 // This instruction adds a register value and an optionally-shifted register value, and writes the result
 // to the destination register. It can optionally update the condition flags based on the result.
 bool
-EmulateInstructionARM::EmulateADDReg (ARMEncoding encoding)
+EmulateInstructionARM::EmulateADDReg (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -2502,11 +2403,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rd, Rn, Rm;
         ARM_ShifterType shift_t;
@@ -2574,7 +2472,7 @@
 // Compare Negative (immediate) adds a register value and an immediate value.
 // It updates the condition flags based on the result, and discards the result.
 bool
-EmulateInstructionARM::EmulateCMNImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateCMNImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -2588,9 +2486,6 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
     uint32_t Rn; // the first operand
     uint32_t imm32; // the immediate value to be compared with
@@ -2627,7 +2522,7 @@
 // Compare Negative (register) adds a register value and an optionally-shifted register value.
 // It updates the condition flags based on the result, and discards the result.
 bool
-EmulateInstructionARM::EmulateCMNReg (ARMEncoding encoding)
+EmulateInstructionARM::EmulateCMNReg (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -2642,9 +2537,6 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
     uint32_t Rn; // the first operand
     uint32_t Rm; // the second operand
@@ -2698,7 +2590,7 @@
 // Compare (immediate) subtracts an immediate value from a register value.
 // It updates the condition flags based on the result, and discards the result.
 bool
-EmulateInstructionARM::EmulateCMPImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateCMPImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -2712,9 +2604,6 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
     uint32_t Rn; // the first operand
     uint32_t imm32; // the immediate value to be compared with
@@ -2755,7 +2644,7 @@
 // Compare (register) subtracts an optionally-shifted register value from a register value.
 // It updates the condition flags based on the result, and discards the result.
 bool
-EmulateInstructionARM::EmulateCMPReg (ARMEncoding encoding)
+EmulateInstructionARM::EmulateCMPReg (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -2770,9 +2659,6 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
     uint32_t Rn; // the first operand
     uint32_t Rm; // the second operand
@@ -2829,7 +2715,7 @@
 // shifting in copies of its sign bit, and writes the result to the destination register.  It can
 // optionally update the condition flags based on the result.
 bool
-EmulateInstructionARM::EmulateASRImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateASRImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -2847,7 +2733,7 @@
                 // APSR.V unchanged
 #endif
 
-    return EmulateShiftImm(encoding, SRType_ASR);
+    return EmulateShiftImm (opcode, encoding, SRType_ASR);
 }
 
 // Arithmetic Shift Right (register) shifts a register value right by a variable number of bits,
@@ -2855,7 +2741,7 @@
 // The variable number of bits is read from the bottom byte of a register. It can optionally update
 // the condition flags based on the result.
 bool
-EmulateInstructionARM::EmulateASRReg (ARMEncoding encoding)
+EmulateInstructionARM::EmulateASRReg (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -2871,14 +2757,14 @@
             // APSR.V unchanged
 #endif
 
-    return EmulateShiftReg(encoding, SRType_ASR);
+    return EmulateShiftReg (opcode, encoding, SRType_ASR);
 }
 
 // Logical Shift Left (immediate) shifts a register value left by an immediate number of bits,
 // shifting in zeros, and writes the result to the destination register.  It can optionally
 // update the condition flags based on the result.
 bool
-EmulateInstructionARM::EmulateLSLImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLSLImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -2896,7 +2782,7 @@
                 // APSR.V unchanged
 #endif
 
-    return EmulateShiftImm(encoding, SRType_LSL);
+    return EmulateShiftImm (opcode, encoding, SRType_LSL);
 }
 
 // Logical Shift Left (register) shifts a register value left by a variable number of bits,
@@ -2904,7 +2790,7 @@
 // of bits is read from the bottom byte of a register. It can optionally update the condition
 // flags based on the result.
 bool
-EmulateInstructionARM::EmulateLSLReg (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLSLReg (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -2920,14 +2806,14 @@
             // APSR.V unchanged
 #endif
 
-    return EmulateShiftReg(encoding, SRType_LSL);
+    return EmulateShiftReg (opcode, encoding, SRType_LSL);
 }
 
 // Logical Shift Right (immediate) shifts a register value right by an immediate number of bits,
 // shifting in zeros, and writes the result to the destination register.  It can optionally
 // update the condition flags based on the result.
 bool
-EmulateInstructionARM::EmulateLSRImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLSRImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -2945,7 +2831,7 @@
                 // APSR.V unchanged
 #endif
 
-    return EmulateShiftImm(encoding, SRType_LSR);
+    return EmulateShiftImm (opcode, encoding, SRType_LSR);
 }
 
 // Logical Shift Right (register) shifts a register value right by a variable number of bits,
@@ -2953,7 +2839,7 @@
 // of bits is read from the bottom byte of a register. It can optionally update the condition
 // flags based on the result.
 bool
-EmulateInstructionARM::EmulateLSRReg (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLSRReg (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -2969,14 +2855,14 @@
             // APSR.V unchanged
 #endif
 
-    return EmulateShiftReg(encoding, SRType_LSR);
+    return EmulateShiftReg (opcode, encoding, SRType_LSR);
 }
 
 // Rotate Right (immediate) provides the value of the contents of a register rotated by a constant value.
 // The bits that are rotated off the right end are inserted into the vacated bit positions on the left.
 // It can optionally update the condition flags based on the result.
 bool
-EmulateInstructionARM::EmulateRORImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateRORImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -2994,7 +2880,7 @@
                 // APSR.V unchanged
 #endif
 
-    return EmulateShiftImm(encoding, SRType_ROR);
+    return EmulateShiftImm (opcode, encoding, SRType_ROR);
 }
 
 // Rotate Right (register) provides the value of the contents of a register rotated by a variable number of bits.
@@ -3002,7 +2888,7 @@
 // The variable number of bits is read from the bottom byte of a register. It can optionally update the condition
 // flags based on the result.
 bool
-EmulateInstructionARM::EmulateRORReg (ARMEncoding encoding)
+EmulateInstructionARM::EmulateRORReg (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -3018,7 +2904,7 @@
             // APSR.V unchanged
 #endif
 
-    return EmulateShiftReg(encoding, SRType_ROR);
+    return EmulateShiftReg (opcode, encoding, SRType_ROR);
 }
 
 // Rotate Right with Extend provides the value of the contents of a register shifted right by one place,
@@ -3027,7 +2913,7 @@
 // RRX can optionally update the condition flags based on the result.
 // In that case, bit [0] is shifted into the carry flag.
 bool
-EmulateInstructionARM::EmulateRRX (ARMEncoding encoding)
+EmulateInstructionARM::EmulateRRX (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -3045,20 +2931,17 @@
                 // APSR.V unchanged
 #endif
 
-    return EmulateShiftImm(encoding, SRType_RRX);
+    return EmulateShiftImm (opcode, encoding, SRType_RRX);
 }
 
 bool
-EmulateInstructionARM::EmulateShiftImm (ARMEncoding encoding, ARM_ShifterType shift_type)
+EmulateInstructionARM::EmulateShiftImm (const uint32_t opcode, const ARMEncoding encoding, ARM_ShifterType shift_type)
 {
     assert(shift_type == SRType_ASR || shift_type == SRType_LSL || shift_type == SRType_LSR);
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rd;    // the destination register
         uint32_t Rm;    // the first operand register
@@ -3068,14 +2951,15 @@
 
         // Special case handling!
         // A8.6.139 ROR (immediate) -- Encoding T1
-        if (shift_type == SRType_ROR && encoding == eEncodingT1)
+        ARMEncoding use_encoding = encoding;
+        if (shift_type == SRType_ROR && use_encoding == eEncodingT1)
         {
             // Morph the T1 encoding from the ARM Architecture Manual into T2 encoding to
             // have the same decoding of bit fields as the other Thumb2 shift operations.
-            encoding = eEncodingT2;
+            use_encoding = eEncodingT2;
         }
 
-        switch (encoding) {
+        switch (use_encoding) {
         case eEncodingT1:
             // Due to the above special case handling!
             assert(shift_type != SRType_ROR);
@@ -3132,16 +3016,13 @@
 }
 
 bool
-EmulateInstructionARM::EmulateShiftReg (ARMEncoding encoding, ARM_ShifterType shift_type)
+EmulateInstructionARM::EmulateShiftReg (const uint32_t opcode, const ARMEncoding encoding, ARM_ShifterType shift_type)
 {
     assert(shift_type == SRType_ASR || shift_type == SRType_LSL || shift_type == SRType_LSR);
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rd;    // the destination register
         uint32_t Rn;    // the first operand register
@@ -3204,7 +3085,7 @@
 // address from a base register.  Optionally the address just above the highest of those locations
 // can be written back to the base register.
 bool
-EmulateInstructionARM::EmulateLDM (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLDM (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -3224,11 +3105,8 @@
 #endif
             
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
             
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t n;
         uint32_t registers = 0;
@@ -3348,7 +3226,7 @@
 // The consecutive memorty locations end at this address and the address just below the lowest of those locations
 // can optionally be written back tot he base registers.
 bool
-EmulateInstructionARM::EmulateLDMDA (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLDMDA (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -3368,11 +3246,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t n;
         uint32_t registers = 0;
@@ -3469,7 +3344,7 @@
 // consecutive memory lcoations end just below this address, and the address of the lowest of those locations can 
 // be optionally written back to the base register.
 bool
-EmulateInstructionARM::EmulateLDMDB (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLDMDB (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -3488,11 +3363,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t n;
         uint32_t registers = 0;
@@ -3610,7 +3482,7 @@
 // consecutive memory locations start just above this address, and thea ddress of the last of those locations can 
 // optinoally be written back to the base register.
 bool
-EmulateInstructionARM::EmulateLDMIB (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLDMIB (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then
@@ -3628,11 +3500,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t n;
         uint32_t registers = 0;
@@ -3727,7 +3596,7 @@
 // an immediate offset, loads a word from memory, and writes to a register.
 // LDR (immediate, Thumb)
 bool
-EmulateInstructionARM::EmulateLDRRtRnImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLDRRtRnImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -3747,11 +3616,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rt; // the destination register
         uint32_t Rn; // the base register
@@ -3887,7 +3753,7 @@
 // from a base register.  The consecutive memory locations start at this address, and teh address just above the last
 // of those locations can optionally be written back to the base register.
 bool
-EmulateInstructionARM::EmulateSTM (ARMEncoding encoding)
+EmulateInstructionARM::EmulateSTM (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -3908,11 +3774,8 @@
 #endif
     
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed ())
+    if (ConditionPassed(opcode))
     {
         uint32_t n;
         uint32_t registers = 0;
@@ -4044,7 +3907,7 @@
 // from a base register.  The consecutive memory locations end at this address, and the address just below the lowest
 // of those locations can optionally be written back to the base register.
 bool
-EmulateInstructionARM::EmulateSTMDA (ARMEncoding encoding)
+EmulateInstructionARM::EmulateSTMDA (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -4066,11 +3929,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed ())
+    if (ConditionPassed(opcode))
     {
         uint32_t n;
         uint32_t registers = 0;
@@ -4172,7 +4032,7 @@
 // from a base register.  The consecutive memory locations end just below this address, and the address of the first of
 // those locations can optionally be written back to the base register.
 bool
-EmulateInstructionARM::EmulateSTMDB (ARMEncoding encoding)
+EmulateInstructionARM::EmulateSTMDB (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -4195,11 +4055,8 @@
 
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed ())
+    if (ConditionPassed(opcode))
     {
         uint32_t n;
         uint32_t registers = 0;
@@ -4326,7 +4183,7 @@
 // from a base register.  The consecutive memory locations start just above this address, and the address of the last
 // of those locations can optionally be written back to the base register.
 bool
-EmulateInstructionARM::EmulateSTMIB (ARMEncoding encoding)
+EmulateInstructionARM::EmulateSTMIB (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -4348,11 +4205,8 @@
 #endif   
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t n;
         uint32_t registers = 0;
@@ -4454,7 +4308,7 @@
 // STR (store immediate) calcualtes an address from a base register value and an immediate offset, and stores a word
 // from a register to memory.  It can use offset, post-indexed, or pre-indexed addressing.
 bool
-EmulateInstructionARM::EmulateSTRThumb (ARMEncoding encoding)
+EmulateInstructionARM::EmulateSTRThumb (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -4469,11 +4323,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         const uint32_t addr_byte_size = GetAddressByteSize();
                   
@@ -4617,7 +4468,7 @@
 // STR (Store Register) calculates an address from a base register value and an offset register value, stores a 
 // word from a register to memory.   The offset register value can optionally be shifted.
 bool
-EmulateInstructionARM::EmulateSTRRegister (ARMEncoding encoding)
+EmulateInstructionARM::EmulateSTRRegister (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -4637,11 +4488,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         const uint32_t addr_byte_size = GetAddressByteSize();
                   
@@ -4808,7 +4656,7 @@
 }
                
 bool
-EmulateInstructionARM::EmulateSTRBThumb (ARMEncoding encoding)
+EmulateInstructionARM::EmulateSTRBThumb (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -4821,11 +4669,8 @@
 
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed ())
+    if (ConditionPassed(opcode))
     {
         uint32_t t;
         uint32_t n;
@@ -4948,7 +4793,7 @@
 // STRH (register) calculates an address from a base register value and an offset register value, and stores a 
 // halfword from a register to memory.  The offset register alue can be shifted left by 0, 1, 2, or 3 bits.
 bool
-EmulateInstructionARM::EmulateSTRHRegister (ARMEncoding encoding)
+EmulateInstructionARM::EmulateSTRHRegister (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -4964,11 +4809,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed ())
+    if (ConditionPassed(opcode))
     {
         uint32_t t;
         uint32_t n;
@@ -5129,7 +4971,7 @@
 // and writes the result to the destination register.  It can optionally update the condition flags
 // based on the result.
 bool
-EmulateInstructionARM::EmulateADCImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateADCImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -5148,11 +4990,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rd, Rn;
         uint32_t imm32; // the immediate value to be added to the value obtained from Rn
@@ -5201,7 +5040,7 @@
 // register value, and writes the result to the destination register.  It can optionally update the
 // condition flags based on the result.
 bool
-EmulateInstructionARM::EmulateADCReg (ARMEncoding encoding)
+EmulateInstructionARM::EmulateADCReg (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -5221,11 +5060,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rd, Rn, Rm;
         ARM_ShifterType shift_t;
@@ -5289,7 +5125,7 @@
 // This instruction adds an immediate value to the PC value to form a PC-relative address,
 // and writes the result to the destination register.
 bool
-EmulateInstructionARM::EmulateADR (ARMEncoding encoding)
+EmulateInstructionARM::EmulateADR (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -5303,11 +5139,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rd;
         uint32_t imm32; // the immediate value to be added/subtracted to/from the PC
@@ -5356,7 +5189,7 @@
 // This instruction performs a bitwise AND of a register value and an immediate value, and writes the result
 // to the destination register.  It can optionally update the condition flags based on the result.
 bool
-EmulateInstructionARM::EmulateANDImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateANDImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -5375,11 +5208,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rd, Rn;
         uint32_t imm32; // the immediate value to be ANDed to the value obtained from Rn
@@ -5394,7 +5224,7 @@
             imm32 = ThumbExpandImm_C(opcode, APSR_C, carry); // (imm32, carry) = ThumbExpandImm(i:imm3:imm8, APSR.C)
             // if Rd == '1111' && S == '1' then SEE TST (immediate);
             if (Rd == 15 && setflags)
-                return EmulateTSTImm(eEncodingT1);
+                return EmulateTSTImm(opcode, eEncodingT1);
             if (Rd == 13 || (Rd == 15 && !setflags) || BadReg(Rn))
                 return false;
             break;
@@ -5432,7 +5262,7 @@
 // and writes the result to the destination register.  It can optionally update the condition flags
 // based on the result.
 bool
-EmulateInstructionARM::EmulateANDReg (ARMEncoding encoding)
+EmulateInstructionARM::EmulateANDReg (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -5452,11 +5282,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rd, Rn, Rm;
         ARM_ShifterType shift_t;
@@ -5480,7 +5307,7 @@
             shift_n = DecodeImmShiftThumb(opcode, shift_t);
             // if Rd == '1111' && S == '1' then SEE TST (register);
             if (Rd == 15 && setflags)
-                return EmulateTSTReg(eEncodingT2);
+                return EmulateTSTReg(opcode, eEncodingT2);
             if (Rd == 13 || (Rd == 15 && !setflags) || BadReg(Rn) || BadReg(Rm))
                 return false;
             break;
@@ -5525,7 +5352,7 @@
 // immediate value, and writes the result to the destination register.  It can optionally update the
 // condition flags based on the result.
 bool
-EmulateInstructionARM::EmulateBICImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateBICImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -5544,11 +5371,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rd, Rn;
         uint32_t imm32; // the immediate value to be bitwise inverted and ANDed to the value obtained from Rn
@@ -5599,7 +5423,7 @@
 // optionally-shifted register value, and writes the result to the destination register.
 // It can optionally update the condition flags based on the result.
 bool
-EmulateInstructionARM::EmulateBICReg (ARMEncoding encoding)
+EmulateInstructionARM::EmulateBICReg (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -5619,11 +5443,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rd, Rn, Rm;
         ARM_ShifterType shift_t;
@@ -5689,7 +5510,7 @@
 // LDR (immediate, ARM) calculates an address from a base register value and an immediate offset, loads a word 
 // from memory, and writes it to a register.  It can use offset, post-indexed, or pre-indexed addressing.
 bool
-EmulateInstructionARM::EmulateLDRImmediateARM (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLDRImmediateARM (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -5707,11 +5528,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                 
-    if (ConditionPassed ())
+    if (ConditionPassed(opcode))
     {
         const uint32_t addr_byte_size = GetAddressByteSize();
                   
@@ -5829,7 +5647,7 @@
 // LDR (register) calculates an address from a base register value and an offset register value, loads a word 
 // from memory, and writes it to a resgister.  The offset register value can optionally be shifted.  
 bool
-EmulateInstructionARM::EmulateLDRRegister (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLDRRegister (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -5851,11 +5669,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed ())
+    if (ConditionPassed(opcode))
     {
         const uint32_t addr_byte_size = GetAddressByteSize();
                   
@@ -6040,7 +5855,7 @@
 
 // LDRB (immediate, Thumb)
 bool
-EmulateInstructionARM::EmulateLDRBImmediate (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLDRBImmediate (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -6052,11 +5867,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed ())
+    if (ConditionPassed(opcode))
     {
         uint32_t t;
         uint32_t n;
@@ -6179,7 +5991,7 @@
 // LDRB (literal) calculates an address from the PC value and an immediate offset, loads a byte from memory, 
 // zero-extends it to form a 32-bit word and writes it to a register.
 bool
-EmulateInstructionARM::EmulateLDRBLiteral (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLDRBLiteral (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -6190,11 +6002,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed ())
+    if (ConditionPassed(opcode))
     {
         uint32_t t;
         uint32_t imm32;
@@ -6262,7 +6071,7 @@
 // memory, zero-extends it to form a 32-bit word, and writes it to a register.  The offset register value can 
 // optionally be shifted.
 bool
-EmulateInstructionARM::EmulateLDRBRegister (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLDRBRegister (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -6275,11 +6084,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                 
-    if (ConditionPassed ())
+    if (ConditionPassed(opcode))
     {
         uint32_t t;
         uint32_t n;
@@ -6420,7 +6226,7 @@
 // halfword from memory, zero-extends it to form a 32-bit word, and writes it to a register.  It can use offset, 
 // post-indexed, or pre-indexed addressing.
 bool
-EmulateInstructionARM::EmulateLDRHImmediate (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLDRHImmediate (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -6437,11 +6243,8 @@
                   
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t t;
         uint32_t n;
@@ -6572,7 +6375,7 @@
 // LDRH (literal) caculates an address from the PC value and an immediate offset, loads a halfword from memory, 
 // zero-extends it to form a 32-bit word, and writes it to a register.            
 bool
-EmulateInstructionARM::EmulateLDRHLiteral (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLDRHLiteral (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -6587,11 +6390,8 @@
 #endif
                                     
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
             
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t t;
         uint32_t imm32;
@@ -6683,7 +6483,7 @@
 // from memory, zero-extends it to form a 32-bit word, and writes it to a register.  The offset register value can 
 // be shifted left by 0, 1, 2, or 3 bits.
 bool
-EmulateInstructionARM::EmulateLDRHRegister (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLDRHRegister (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -6700,11 +6500,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
             
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t t;
         uint32_t n;
@@ -6859,7 +6656,7 @@
 // memory, sign-extends it to form a 32-bit word, and writes it to a register.  It can use offset, post-indexed, 
 // or pre-indexed addressing.
 bool
-EmulateInstructionARM::EmulateLDRSBImmediate (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLDRSBImmediate (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -6871,11 +6668,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed ())
+    if (ConditionPassed(opcode))
     {
         uint32_t t;
         uint32_t n;
@@ -7009,7 +6803,7 @@
 // LDRSB (literal) calculates an address from the PC value and an immediate offset, loads a byte from memory, 
 // sign-extends it to form a 32-bit word, and writes tit to a register.
 bool
-EmulateInstructionARM::EmulateLDRSBLiteral (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLDRSBLiteral (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -7020,11 +6814,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
             
-    if (ConditionPassed ())
+    if (ConditionPassed(opcode))
     {
         uint32_t t;
         uint32_t imm32;
@@ -7102,7 +6893,7 @@
 // memory, sign-extends it to form a 32-bit word, and writes it to a register.  The offset register value can be 
 // shifted left by 0, 1, 2, or 3 bits.
 bool
-EmulateInstructionARM::EmulateLDRSBRegister (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLDRSBRegister (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -7115,11 +6906,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
             
-    if (ConditionPassed ())
+    if (ConditionPassed(opcode))
     {
         uint32_t t;
         uint32_t n;
@@ -7261,7 +7049,7 @@
 // memory, sign-extends it to form a 32-bit word, and writes it to a register.  It can use offset, post-indexed, or 
 // pre-indexed addressing.
 bool
-EmulateInstructionARM::EmulateLDRSHImmediate (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLDRSHImmediate (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -7277,11 +7065,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t t;
         uint32_t n;
@@ -7424,7 +7209,7 @@
 // LDRSH (literal) calculates an address from the PC value and an immediate offset, loads a halfword from memory, 
 // sign-extends it to from a 32-bit word, and writes it to a register.
 bool
-EmulateInstructionARM::EmulateLDRSHLiteral (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLDRSHLiteral (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -7439,11 +7224,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t t;
         uint32_t imm32;
@@ -7531,7 +7313,7 @@
 // from memory, sign-extends it to form a 32-bit word, and writes it to a register.  The offset register value can be 
 // shifted left by 0, 1, 2, or 3 bits.
 bool
-EmulateInstructionARM::EmulateLDRSHRegister (ARMEncoding encoding)
+EmulateInstructionARM::EmulateLDRSHRegister (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -7548,11 +7330,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t t;
         uint32_t n;
@@ -7710,7 +7489,7 @@
 // SXTB extracts an 8-bit value from a register, sign-extends it to 32 bits, and writes the result to the destination 
 // register.  You can specifiy a rotation by 0, 8, 16, or 24 bits before extracting the 8-bit value.
 bool 
-EmulateInstructionARM::EmulateSXTB (ARMEncoding encoding)
+EmulateInstructionARM::EmulateSXTB (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -7720,11 +7499,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t d;
         uint32_t m;
@@ -7795,7 +7571,7 @@
 // SXTH extracts a 16-bit value from a register, sign-extends it to 32 bits, and writes the result to the destination
 // register.  You can specify a rotation by 0, 8, 16, or 24 bits before extracting the 16-bit value.
 bool
-EmulateInstructionARM::EmulateSXTH (ARMEncoding encoding)
+EmulateInstructionARM::EmulateSXTH (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -7805,11 +7581,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t d;
         uint32_t m;
@@ -7880,7 +7653,7 @@
 // UXTB extracts an 8-bit value from a register, zero-extneds it to 32 bits, and writes the result to the destination
 // register.  You can specify a rotation by 0, 8, 16, or 24 bits before extracting the 8-bit value.
 bool
-EmulateInstructionARM::EmulateUXTB (ARMEncoding encoding)
+EmulateInstructionARM::EmulateUXTB (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -7890,11 +7663,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t d;
         uint32_t m;
@@ -7963,7 +7733,7 @@
 // UXTH extracts a 16-bit value from a register, zero-extends it to 32 bits, and writes the result to the destination 
 // register.  You can specify a rotation by 0, 8, 16, or 24 bits before extracting the 16-bit value.
 bool 
-EmulateInstructionARM::EmulateUXTH (ARMEncoding encoding)
+EmulateInstructionARM::EmulateUXTH (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -7973,11 +7743,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed ())
+    if (ConditionPassed(opcode))
     {
         uint32_t d;
         uint32_t m;
@@ -8045,7 +7812,7 @@
 // RFE (Return From Exception) loads the PC and the CPSR from the word at the specified address and the following 
 // word respectively.  
 bool
-EmulateInstructionARM::EmulateRFE (ARMEncoding encoding)
+EmulateInstructionARM::EmulateRFE (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     if ConditionPassed() then 
@@ -8061,11 +7828,8 @@
 #endif
                   
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
                   
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t n;
         bool wback;
@@ -8196,7 +7960,7 @@
 // and writes the result to the destination register.  It can optionally update the condition flags based on
 // the result.
 bool
-EmulateInstructionARM::EmulateEORImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateEORImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -8215,11 +7979,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rd, Rn;
         uint32_t imm32; // the immediate value to be ORed to the value obtained from Rn
@@ -8234,7 +7995,7 @@
             imm32 = ThumbExpandImm_C(opcode, APSR_C, carry); // (imm32, carry) = ThumbExpandImm(i:imm3:imm8, APSR.C)
             // if Rd == '1111' && S == '1' then SEE TEQ (immediate);
             if (Rd == 15 && setflags)
-                return EmulateTEQImm(eEncodingT1);
+                return EmulateTEQImm (opcode, eEncodingT1);
             if (Rd == 13 || (Rd == 15 && !setflags) || BadReg(Rn))
                 return false;
             break;
@@ -8273,7 +8034,7 @@
 // optionally-shifted register value, and writes the result to the destination register.
 // It can optionally update the condition flags based on the result.
 bool
-EmulateInstructionARM::EmulateEORReg (ARMEncoding encoding)
+EmulateInstructionARM::EmulateEORReg (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -8293,11 +8054,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rd, Rn, Rm;
         ARM_ShifterType shift_t;
@@ -8321,7 +8079,7 @@
             shift_n = DecodeImmShiftThumb(opcode, shift_t);
             // if Rd == '1111' && S == '1' then SEE TEQ (register);
             if (Rd == 15 && setflags)
-                return EmulateTEQReg(eEncodingT1);
+                return EmulateTEQReg (opcode, eEncodingT1);
             if (Rd == 13 || (Rd == 15 && !setflags) || BadReg(Rn) || BadReg(Rm))
                 return false;
             break;
@@ -8367,7 +8125,7 @@
 // writes the result to the destination register.  It can optionally update the condition flags based
 // on the result.
 bool
-EmulateInstructionARM::EmulateORRImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateORRImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -8386,11 +8144,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rd, Rn;
         uint32_t imm32; // the immediate value to be ORed to the value obtained from Rn
@@ -8405,7 +8160,7 @@
             imm32 = ThumbExpandImm_C(opcode, APSR_C, carry); // (imm32, carry) = ThumbExpandImm(i:imm3:imm8, APSR.C)
             // if Rn == ‘1111’ then SEE MOV (immediate);
             if (Rn == 15)
-                return EmulateMOVRdImm(eEncodingT2);
+                return EmulateMOVRdImm (opcode, eEncodingT2);
             if (BadReg(Rd) || Rn == 13)
                 return false;
             break;
@@ -8443,7 +8198,7 @@
 // value, and writes the result to the destination register.  It can optionally update the condition flags based
 // on the result.
 bool
-EmulateInstructionARM::EmulateORRReg (ARMEncoding encoding)
+EmulateInstructionARM::EmulateORRReg (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -8463,11 +8218,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rd, Rn, Rm;
         ARM_ShifterType shift_t;
@@ -8491,7 +8243,7 @@
             shift_n = DecodeImmShiftThumb(opcode, shift_t);
             // if Rn == '1111' then SEE MOV (register);
             if (Rn == 15)
-                return EmulateMOVRdRm(eEncodingT3);
+                return EmulateMOVRdRm (opcode, eEncodingT3);
             if (BadReg(Rd) || Rn == 13 || BadReg(Rm))
                 return false;
             break;
@@ -8535,7 +8287,7 @@
 // Reverse Subtract (immediate) subtracts a register value from an immediate value, and writes the result to
 // the destination register. It can optionally update the condition flags based on the result.
 bool
-EmulateInstructionARM::EmulateRSBImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateRSBImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -8554,9 +8306,6 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
     uint32_t Rd; // the destination register
     uint32_t Rn; // the first operand
@@ -8610,7 +8359,7 @@
 // Reverse Subtract (register) subtracts a register value from an optionally-shifted register value, and writes the
 // result to the destination register. It can optionally update the condition flags based on the result.
 bool
-EmulateInstructionARM::EmulateRSBReg (ARMEncoding encoding)
+EmulateInstructionARM::EmulateRSBReg (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -8630,9 +8379,6 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
     uint32_t Rd; // the destination register
     uint32_t Rn; // the first operand
@@ -8691,7 +8437,7 @@
 // an immediate value, and writes the result to the destination register. It can optionally update the condition
 // flags based on the result.
 bool
-EmulateInstructionARM::EmulateRSCImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateRSCImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -8710,9 +8456,6 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
     uint32_t Rd; // the destination register
     uint32_t Rn; // the first operand
@@ -8753,7 +8496,7 @@
 // optionally-shifted register value, and writes the result to the destination register. It can optionally update the
 // condition flags based on the result.
 bool
-EmulateInstructionARM::EmulateRSCReg (ARMEncoding encoding)
+EmulateInstructionARM::EmulateRSCReg (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -8773,9 +8516,6 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
     uint32_t Rd; // the destination register
     uint32_t Rn; // the first operand
@@ -8824,7 +8564,7 @@
 // NOT (Carry flag) from a register value, and writes the result to the destination register.
 // It can optionally update the condition flags based on the result.
 bool
-EmulateInstructionARM::EmulateSBCImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateSBCImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -8843,9 +8583,6 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
     uint32_t Rd; // the destination register
     uint32_t Rn; // the first operand
@@ -8894,7 +8631,7 @@
 // NOT (Carry flag) from a register value, and writes the result to the destination register.
 // It can optionally update the condition flags based on the result.
 bool
-EmulateInstructionARM::EmulateSBCReg (ARMEncoding encoding)
+EmulateInstructionARM::EmulateSBCReg (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -8914,9 +8651,6 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
     uint32_t Rd; // the destination register
     uint32_t Rn; // the first operand
@@ -8980,7 +8714,7 @@
 // This instruction subtracts an immediate value from a register value, and writes the result
 // to the destination register.  It can optionally update the condition flags based on the result.
 bool
-EmulateInstructionARM::EmulateSUBImmThumb (ARMEncoding encoding)
+EmulateInstructionARM::EmulateSUBImmThumb (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -8996,9 +8730,6 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
     uint32_t Rd; // the destination register
     uint32_t Rn; // the first operand
@@ -9024,11 +8755,11 @@
 
         // if Rd == '1111' && S == '1' then SEE CMP (immediate);
         if (Rd == 15 && setflags)
-            return EmulateCMPImm(eEncodingT2);
+            return EmulateCMPImm (opcode, eEncodingT2);
 
         // if Rn == ‘1101’ then SEE SUB (SP minus immediate);
         if (Rn == 13)
-            return EmulateSUBSPImm(eEncodingT2);
+            return EmulateSUBSPImm (opcode, eEncodingT2);
 
         // if d == 13 || (d == 15 && S == '0') || n == 15 then UNPREDICTABLE;
         if (Rd == 13 || (Rd == 15 && !setflags) || Rn == 15)
@@ -9042,11 +8773,11 @@
 
         // if Rn == '1111' then SEE ADR;
         if (Rn == 15)
-            return EmulateADR(eEncodingT2);
+            return EmulateADR (opcode, eEncodingT2);
 
         // if Rn == '1101' then SEE SUB (SP minus immediate);
         if (Rn == 13)
-            return EmulateSUBSPImm(eEncodingT3);
+            return EmulateSUBSPImm (opcode, eEncodingT3);
 
         if (BadReg(Rd))
             return false;
@@ -9074,7 +8805,7 @@
 // This instruction subtracts an immediate value from a register value, and writes the result
 // to the destination register.  It can optionally update the condition flags based on the result.
 bool
-EmulateInstructionARM::EmulateSUBImmARM (ARMEncoding encoding)
+EmulateInstructionARM::EmulateSUBImmARM (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -9093,9 +8824,6 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
     uint32_t Rd; // the destination register
     uint32_t Rn; // the first operand
@@ -9110,11 +8838,11 @@
 
         // if Rn == ‘1111’ && S == ‘0’ then SEE ADR;
         if (Rn == 15 && !setflags)
-            return EmulateADR(eEncodingA2);
+            return EmulateADR (opcode, eEncodingA2);
 
         // if Rn == ‘1101’ then SEE SUB (SP minus immediate);
         if (Rn == 13)
-            return EmulateSUBSPImm(eEncodingA1);
+            return EmulateSUBSPImm (opcode, eEncodingA1);
 
         // if Rd == '1111' && S == '1' then SEE SUBS PC, LR and related instructions;
         // TODO: Emulate SUBS PC, LR and related instructions.
@@ -9144,7 +8872,7 @@
 // Test Equivalence (immediate) performs a bitwise exclusive OR operation on a register value and an
 // immediate value.  It updates the condition flags based on the result, and discards the result.
 bool
-EmulateInstructionARM::EmulateTEQImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateTEQImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -9158,11 +8886,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rn;
         uint32_t imm32; // the immediate value to be ANDed to the value obtained from Rn
@@ -9171,13 +8896,13 @@
         {
         case eEncodingT1:
             Rn = Bits32(opcode, 19, 16);
-            imm32 = ThumbExpandImm_C(opcode, APSR_C, carry); // (imm32, carry) = ThumbExpandImm(i:imm3:imm8, APSR.C)
+            imm32 = ThumbExpandImm_C (opcode, APSR_C, carry); // (imm32, carry) = ThumbExpandImm(i:imm3:imm8, APSR.C)
             if (BadReg(Rn))
                 return false;
             break;
         case eEncodingA1:
             Rn = Bits32(opcode, 19, 16);
-            imm32 = ARMExpandImm_C(opcode, APSR_C, carry); // (imm32, carry) = ARMExpandImm(imm12, APSR.C)
+            imm32 = ARMExpandImm_C (opcode, APSR_C, carry); // (imm32, carry) = ARMExpandImm(imm12, APSR.C)
             break;
         default:
             return false;
@@ -9204,7 +8929,7 @@
 // optionally-shifted register value.  It updates the condition flags based on the result, and discards
 // the result.
 bool
-EmulateInstructionARM::EmulateTEQReg (ARMEncoding encoding)
+EmulateInstructionARM::EmulateTEQReg (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -9219,11 +8944,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rn, Rm;
         ARM_ShifterType shift_t;
@@ -9273,7 +8995,7 @@
 // Test (immediate) performs a bitwise AND operation on a register value and an immediate value.
 // It updates the condition flags based on the result, and discards the result.
 bool
-EmulateInstructionARM::EmulateTSTImm (ARMEncoding encoding)
+EmulateInstructionARM::EmulateTSTImm (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -9287,11 +9009,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rn;
         uint32_t imm32; // the immediate value to be ANDed to the value obtained from Rn
@@ -9332,7 +9051,7 @@
 // Test (register) performs a bitwise AND operation on a register value and an optionally-shifted register value.
 // It updates the condition flags based on the result, and discards the result.
 bool
-EmulateInstructionARM::EmulateTSTReg (ARMEncoding encoding)
+EmulateInstructionARM::EmulateTSTReg (const uint32_t opcode, const ARMEncoding encoding)
 {
 #if 0
     // ARM pseudo code...
@@ -9347,11 +9066,8 @@
 #endif
 
     bool success = false;
-    const uint32_t opcode = OpcodeAsUnsigned (&success);
-    if (!success)
-        return false;
 
-    if (ConditionPassed())
+    if (ConditionPassed(opcode))
     {
         uint32_t Rn, Rm;
         ARM_ShifterType shift_t;
@@ -9937,23 +9653,20 @@
                 
                 if (success)
                 {
-                    if ((m_opcode.data.inst16 & 0xe000) != 0xe000 || ((m_opcode.data.inst16 & 0x1800u) == 0))
+                    if ((thumb_opcode & 0xe000) != 0xe000 || ((thumb_opcode & 0x1800u) == 0))
                     {
-                        m_opcode.type = eOpcode16;
-                        m_opcode.data.inst16 = thumb_opcode;
+                        m_opcode.SetOpcode16 (thumb_opcode);
                     }
                     else
                     {
-                        m_opcode.type = eOpcode32;
-                        m_opcode.data.inst32 = (thumb_opcode << 16) | MemARead(read_inst_context, pc + 2, 2, 0, &success);
+                        m_opcode.SetOpcode32 ((thumb_opcode << 16) | MemARead(read_inst_context, pc + 2, 2, 0, &success));
                     }
                 }
             }
             else
             {
                 m_opcode_mode = eModeARM;
-                m_opcode.type = eOpcode32;
-                m_opcode.data.inst32 = MemARead(read_inst_context, pc, 4, 0, &success);
+                m_opcode.SetOpcode32 (MemARead(read_inst_context, pc, 4, 0, &success));
             }
         }
     }
@@ -9972,12 +9685,12 @@
 }
 
 bool
-EmulateInstructionARM::ConditionPassed ()
+EmulateInstructionARM::ConditionPassed (const uint32_t opcode)
 {
     if (m_opcode_cpsr == 0)
         return false;
 
-    const uint32_t cond = CurrentCond ();
+    const uint32_t cond = CurrentCond (opcode);
     
     if (cond == UINT32_MAX)
         return false;
@@ -10015,7 +9728,7 @@
 }
 
 uint32_t
-EmulateInstructionARM::CurrentCond ()
+EmulateInstructionARM::CurrentCond (const uint32_t opcode)
 {
     switch (m_opcode_mode)
     {
@@ -10024,27 +9737,32 @@
         break;
 
     case eModeARM:
-        return UnsignedBits(m_opcode.data.inst32, 31, 28);
+        return UnsignedBits(opcode, 31, 28);
     
     case eModeThumb:
         // For T1 and T3 encodings of the Branch instruction, it returns the 4-bit
         // 'cond' field of the encoding.
-        if (m_opcode.type == eOpcode16 &&
-            Bits32(m_opcode.data.inst16, 15, 12) == 0x0d &&
-            Bits32(m_opcode.data.inst16, 11, 7) != 0x0f)
-        {
-            return Bits32(m_opcode.data.inst16, 11, 7);
-        }
-        else if (m_opcode.type == eOpcode32 &&
-                 Bits32(m_opcode.data.inst32, 31, 27) == 0x1e &&
-                 Bits32(m_opcode.data.inst32, 15, 14) == 0x02 &&
-                 Bits32(m_opcode.data.inst32, 12, 12) == 0x00 &&
-                 Bits32(m_opcode.data.inst32, 25, 22) <= 0x0d)
         {
-            return Bits32(m_opcode.data.inst32, 25, 22);
+            const uint32_t byte_size = m_opcode.GetByteSize();
+            if (byte_size == 2)
+            {
+                if (Bits32(opcode, 15, 12) == 0x0d && Bits32(opcode, 11, 7) != 0x0f)
+                    return Bits32(opcode, 11, 7);
+            }
+            else
+            {
+                assert (byte_size == 4);
+                if (Bits32(opcode, 31, 27) == 0x1e &&
+                    Bits32(opcode, 15, 14) == 0x02 &&
+                    Bits32(opcode, 12, 12) == 0x00 &&
+                    Bits32(opcode, 25, 22) <= 0x0d)
+                {
+                    return Bits32(opcode, 25, 22);
+                }
+            }
+            
+            return m_it_session.GetCond();
         }
-        
-        return m_it_session.GetCond();
     }
     return UINT32_MAX;  // Return invalid value
 }

Modified: lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h?rev=128248&r1=128247&r2=128248&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h (original)
+++ lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h Thu Mar 24 18:53:38 2011
@@ -125,10 +125,10 @@
     ArchVersion();
 
     bool
-    ConditionPassed ();
+    ConditionPassed (const uint32_t opcode);
 
     uint32_t
-    CurrentCond ();
+    CurrentCond (const uint32_t opcode);
 
     // InITBlock - Returns true if we're in Thumb mode and inside an IT Block.
     bool InITBlock();
@@ -301,7 +301,7 @@
         uint32_t variants;
         EmulateInstructionARM::ARMEncoding encoding;
         ARMInstrSize size;
-        bool (EmulateInstructionARM::*callback) (EmulateInstructionARM::ARMEncoding encoding);
+        bool (EmulateInstructionARM::*callback) (const uint32_t opcode, const EmulateInstructionARM::ARMEncoding encoding);
         const char *name;
     }  ARMOpcode;
     
@@ -314,423 +314,423 @@
 
     // A8.6.123 PUSH
     bool
-    EmulatePUSH (ARMEncoding encoding);
+    EmulatePUSH (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.122 POP
     bool
-    EmulatePOP (ARMEncoding encoding);
+    EmulatePOP (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.8 ADD (SP plus immediate)
     bool
-    EmulateADDRdSPImm (ARMEncoding encoding);
+    EmulateADDRdSPImm (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.97 MOV (register) -- Rd == r7|ip and Rm == sp
     bool
-    EmulateMOVRdSP (ARMEncoding encoding);
+    EmulateMOVRdSP (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.97 MOV (register) -- move from r8-r15 to r0-r7
     bool
-    EmulateMOVLowHigh (ARMEncoding encoding);
+    EmulateMOVLowHigh (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.59 LDR (literal)
     bool
-    EmulateLDRRtPCRelative (ARMEncoding encoding);
+    EmulateLDRRtPCRelative (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.8 ADD (SP plus immediate)
     bool
-    EmulateADDSPImm (ARMEncoding encoding);
+    EmulateADDSPImm (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.9 ADD (SP plus register)
     bool
-    EmulateADDSPRm (ARMEncoding encoding);
+    EmulateADDSPRm (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.23 BL, BLX (immediate)
     bool
-    EmulateBLXImmediate (ARMEncoding encoding);
+    EmulateBLXImmediate (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.24 BLX (register)
     bool
-    EmulateBLXRm (ARMEncoding encoding);
+    EmulateBLXRm (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.25 BX
     bool
-    EmulateBXRm (ARMEncoding encoding);
+    EmulateBXRm (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.26 BXJ
     bool
-    EmulateBXJRm (ARMEncoding encoding);
+    EmulateBXJRm (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.212 SUB (immediate, ARM) -- Rd == r7 and Rm == ip
     bool
-    EmulateSUBR7IPImm (ARMEncoding encoding);
+    EmulateSUBR7IPImm (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.215 SUB (SP minus immediate) -- Rd == ip
     bool
-    EmulateSUBIPSPImm (ARMEncoding encoding);
+    EmulateSUBIPSPImm (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.215 SUB (SP minus immediate)
     bool
-    EmulateSUBSPImm (ARMEncoding encoding);
+    EmulateSUBSPImm (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.194 STR (immediate, ARM) -- Rn == sp
     bool
-    EmulateSTRRtSP (ARMEncoding encoding);
+    EmulateSTRRtSP (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.355 VPUSH
     bool
-    EmulateVPUSH (ARMEncoding encoding);
+    EmulateVPUSH (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.354 VPOP
     bool
-    EmulateVPOP (ARMEncoding encoding);
+    EmulateVPOP (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.218 SVC (previously SWI)
     bool
-    EmulateSVC (ARMEncoding encoding);
+    EmulateSVC (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.50 IT
     bool
-    EmulateIT (ARMEncoding encoding);
+    EmulateIT (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.16 B
     bool
-    EmulateB (ARMEncoding encoding);
+    EmulateB (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.27 CBNZ, CBZ
     bool
-    EmulateCB (ARMEncoding encoding);
+    EmulateCB (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.226 TBB, TBH
     bool
-    EmulateTB (ARMEncoding encoding);
+    EmulateTB (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.4 ADD (immediate, Thumb)
     bool
-    EmulateADDImmThumb (ARMEncoding encoding);
+    EmulateADDImmThumb (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.5 ADD (immediate, ARM)
     bool
-    EmulateADDImmARM (ARMEncoding encoding);
+    EmulateADDImmARM (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.6 ADD (register)
     bool
-    EmulateADDReg (ARMEncoding encoding);
+    EmulateADDReg (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.97 MOV (register)
     bool
-    EmulateMOVRdRm (ARMEncoding encoding);
+    EmulateMOVRdRm (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.96 MOV (immediate)
     bool
-    EmulateMOVRdImm (ARMEncoding encoding);
+    EmulateMOVRdImm (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.35 CMP (immediate)
     bool
-    EmulateCMPImm (ARMEncoding encoding);
+    EmulateCMPImm (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.36 CMP (register)
     bool
-    EmulateCMPReg (ARMEncoding encoding);
+    EmulateCMPReg (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.14 ASR (immediate)
     bool
-    EmulateASRImm (ARMEncoding encoding);
+    EmulateASRImm (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.15 ASR (register)
     bool
-    EmulateASRReg (ARMEncoding encoding);
+    EmulateASRReg (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.88 LSL (immediate)
     bool
-    EmulateLSLImm (ARMEncoding encoding);
+    EmulateLSLImm (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.89 LSL (register)
     bool
-    EmulateLSLReg (ARMEncoding encoding);
+    EmulateLSLReg (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.90 LSR (immediate)
     bool
-    EmulateLSRImm (ARMEncoding encoding);
+    EmulateLSRImm (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.91 LSR (register)
     bool
-    EmulateLSRReg (ARMEncoding encoding);
+    EmulateLSRReg (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.139 ROR (immediate)
     bool
-    EmulateRORImm (ARMEncoding encoding);
+    EmulateRORImm (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.140 ROR (register)
     bool
-    EmulateRORReg (ARMEncoding encoding);
+    EmulateRORReg (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.141 RRX
     bool
-    EmulateRRX (ARMEncoding encoding);
+    EmulateRRX (const uint32_t opcode, const ARMEncoding encoding);
 
     // Helper method for ASR, LSL, LSR, ROR (immediate), and RRX
     bool
-    EmulateShiftImm (ARMEncoding encoding, ARM_ShifterType shift_type);
+    EmulateShiftImm (const uint32_t opcode, const ARMEncoding encoding, ARM_ShifterType shift_type);
 
     // Helper method for ASR, LSL, LSR, and ROR (register)
     bool
-    EmulateShiftReg (ARMEncoding encoding, ARM_ShifterType shift_type);
+    EmulateShiftReg (const uint32_t opcode, const ARMEncoding encoding, ARM_ShifterType shift_type);
 
     // A8.6.53 LDM/LDMIA/LDMFD
     bool
-    EmulateLDM (ARMEncoding encoding);
+    EmulateLDM (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.54 LDMDA/LDMFA
     bool
-    EmulateLDMDA (ARMEncoding encoding);
+    EmulateLDMDA (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.55 LDMDB/LDMEA
     bool 
-    EmulateLDMDB (ARMEncoding encoding);
+    EmulateLDMDB (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.56 LDMIB/LDMED
     bool
-    EmulateLDMIB (ARMEncoding encoding);
+    EmulateLDMIB (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.57 LDR (immediate, Thumb) -- Encoding T1
     bool
-    EmulateLDRRtRnImm (ARMEncoding encoding);
+    EmulateLDRRtRnImm (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.188 STM/STMIA/STMEA
     bool
-    EmulateSTM (ARMEncoding encoding);
+    EmulateSTM (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.189 STMDA/STMED
     bool
-    EmulateSTMDA (ARMEncoding encoding);
+    EmulateSTMDA (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.190 STMDB/STMFD
     bool
-    EmulateSTMDB (ARMEncoding encoding);
+    EmulateSTMDB (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.191 STMIB/STMFA
     bool
-    EmulateSTMIB (ARMEncoding encoding);
+    EmulateSTMIB (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.192 STR (immediate, Thumb)
     bool
-    EmulateSTRThumb(ARMEncoding encoding);
+    EmulateSTRThumb(const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.194 STR (register)
     bool
-    EmulateSTRRegister (ARMEncoding encoding);
+    EmulateSTRRegister (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.195 STRB (immediate, Thumb)
     bool
-    EmulateSTRBThumb (ARMEncoding encoding);
+    EmulateSTRBThumb (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.207 STRH (register)
     bool
-    EmulateSTRHRegister (ARMEncoding encoding);
+    EmulateSTRHRegister (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.1 ADC (immediate)
     bool
-    EmulateADCImm (ARMEncoding encoding);
+    EmulateADCImm (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.2 ADC (Register)
     bool
-    EmulateADCReg (ARMEncoding encoding);
+    EmulateADCReg (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.10 ADR
     bool
-    EmulateADR (ARMEncoding encoding);
+    EmulateADR (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.11 AND (immediate)
     bool
-    EmulateANDImm (ARMEncoding encoding);
+    EmulateANDImm (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.12 AND (register)
     bool
-    EmulateANDReg (ARMEncoding encoding);
+    EmulateANDReg (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.19 BIC (immediate)
     bool
-    EmulateBICImm (ARMEncoding encoding);
+    EmulateBICImm (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.20 BIC (register)
     bool
-    EmulateBICReg (ARMEncoding encoding);
+    EmulateBICReg (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.26 BXJ
     bool
-    EmulateBXJ (ARMEncoding encoding);
+    EmulateBXJ (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.32 CMN (immediate)
     bool
-    EmulateCMNImm (ARMEncoding encoding);
+    EmulateCMNImm (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.33 CMN (register)
     bool
-    EmulateCMNReg (ARMEncoding encoding);
+    EmulateCMNReg (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.44 EOR (immediate)
     bool
-    EmulateEORImm (ARMEncoding encoding);
+    EmulateEORImm (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.45 EOR (register)
     bool
-    EmulateEORReg (ARMEncoding encoding);
+    EmulateEORReg (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.58 LDR (immediate, ARM) - Encoding A1
     bool
-    EmulateLDRImmediateARM (ARMEncoding encoding);
+    EmulateLDRImmediateARM (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.60 LDR (register) - Encoding T1, T2, A1
     bool
-    EmulateLDRRegister (ARMEncoding encoding);
+    EmulateLDRRegister (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.61 LDRB (immediate, Thumb) - Encoding T1, T2
     bool
-    EmulateLDRBImmediate (ARMEncoding encoding);
+    EmulateLDRBImmediate (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.63 LDRB (literal) - Encoding T1
     bool
-    EmulateLDRBLiteral (ARMEncoding encoding);
+    EmulateLDRBLiteral (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.64 LDRB (register) - Encoding T1
     bool
-    EmulateLDRBRegister (ARMEncoding encoding);
+    EmulateLDRBRegister (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.73 LDRH (immediate, Thumb) - Encoding T1, T2
     bool
-    EmulateLDRHImmediate (ARMEncoding encoding);
+    EmulateLDRHImmediate (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.75 LDRH (literal) - Encoding T1
     bool
-    EmulateLDRHLiteral (ARMEncoding encoding);
+    EmulateLDRHLiteral (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.76 LDRH (register) - Encoding T1, T2
     bool
-    EmulateLDRHRegister (ARMEncoding encoding);
+    EmulateLDRHRegister (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.78 LDRSB (immediate) - Encoding T1
     bool
-    EmulateLDRSBImmediate (ARMEncoding encoding);
+    EmulateLDRSBImmediate (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.79 LDRSB (literal) - Encoding T1
     bool
-    EmulateLDRSBLiteral (ARMEncoding encoding);
+    EmulateLDRSBLiteral (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.80 LDRSB (register) - Encoding T1, T2
     bool
-    EmulateLDRSBRegister (ARMEncoding encoding);
+    EmulateLDRSBRegister (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.82 LDRSH (immediate) - Encoding T1
     bool
-    EmulateLDRSHImmediate (ARMEncoding encoding);
+    EmulateLDRSHImmediate (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.83 LDRSH (literal) - Encoding T1
     bool
-    EmulateLDRSHLiteral (ARMEncoding encoding);
+    EmulateLDRSHLiteral (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.84 LDRSH (register) - Encoding T1, T2
     bool
-    EmulateLDRSHRegister (ARMEncoding encoding);
+    EmulateLDRSHRegister (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.105 MUL
     bool
-    EmulateMUL (ARMEncoding encoding);
+    EmulateMUL (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.106 MVN (immediate)
     bool
-    EmulateMVNImm (ARMEncoding encoding);
+    EmulateMVNImm (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.107 MVN (register)
     bool
-    EmulateMVNReg (ARMEncoding encoding);
+    EmulateMVNReg (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.113 ORR (immediate)
     bool
-    EmulateORRImm (ARMEncoding encoding);
+    EmulateORRImm (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.114 ORR (register)
     bool
-    EmulateORRReg (ARMEncoding encoding);
+    EmulateORRReg (const uint32_t opcode, const ARMEncoding encoding);
 
     // A8.6.117 PLD (immediate, literal) - Encoding T1, T2, T3, A1
     bool
-    EmulatePLDImmediate (ARMEncoding encoding);
+    EmulatePLDImmediate (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.119 PLI (immediate,literal) - Encoding T3, A1
     bool
-    EmulatePLIImmediate (ARMEncoding encoding);
+    EmulatePLIImmediate (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.120 PLI (register) - Encoding T1, A1
     bool
-    EmulatePLIRegister (ARMEncoding encoding);
+    EmulatePLIRegister (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.141 RSB (immediate)
     bool
-    EmulateRSBImm (ARMEncoding encoding);
+    EmulateRSBImm (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.142 RSB (register)
     bool
-    EmulateRSBReg (ARMEncoding encoding);
+    EmulateRSBReg (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.144 RSC (immediate)
     bool
-    EmulateRSCImm (ARMEncoding encoding);
+    EmulateRSCImm (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.145 RSC (register)
     bool
-    EmulateRSCReg (ARMEncoding encoding);
+    EmulateRSCReg (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.150 SBC (immediate)
     bool
-    EmulateSBCImm (ARMEncoding encoding);
+    EmulateSBCImm (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.151 SBC (register)
     bool
-    EmulateSBCReg (ARMEncoding encoding);
+    EmulateSBCReg (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.211 SUB (immediate, Thumb)
     bool
-    EmulateSUBImmThumb (ARMEncoding encoding);
+    EmulateSUBImmThumb (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.212 SUB (immediate, ARM)
     bool
-    EmulateSUBImmARM (ARMEncoding encoding);
+    EmulateSUBImmARM (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.222 SXTB  - Encoding T1
     bool
-    EmulateSXTB (ARMEncoding encoding);
+    EmulateSXTB (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.224 SXTH  - EncodingT1
     bool
-    EmulateSXTH (ARMEncoding encoding);
+    EmulateSXTH (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.227 TEQ (immediate) - Encoding A1
     bool
-    EmulateTEQImm (ARMEncoding encoding);
+    EmulateTEQImm (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.228 TEQ (register)  - Encoding A1
     bool
-    EmulateTEQReg (ARMEncoding encoding);
+    EmulateTEQReg (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.230 TST (immediate) - Encoding A1
     bool
-    EmulateTSTImm (ARMEncoding encoding);
+    EmulateTSTImm (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.231 TST (register)  - Encoding T1, A1
     bool
-    EmulateTSTReg (ARMEncoding encoding);
+    EmulateTSTReg (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.262 UXTB  - Encoding T1
     bool
-    EmulateUXTB (ARMEncoding encoding);
+    EmulateUXTB (const uint32_t opcode, const ARMEncoding encoding);
     
     // A8.6.264 UXTH  - Encoding T1
     bool
-    EmulateUXTH (ARMEncoding encoding);
+    EmulateUXTH (const uint32_t opcode, const ARMEncoding encoding);
     
     // B6.1.8  RFE
     bool
-    EmulateRFE (ARMEncoding encoding);
+    EmulateRFE (const uint32_t opcode, const ARMEncoding encoding);
      
     uint32_t m_arm_isa;
     Mode m_opcode_mode;





More information about the lldb-commits mailing list