From a48b4ec5839b271c0c0af19a243d5816bc571a23 Mon Sep 17 00:00:00 2001
From: Lioncash <mathew1800@gmail.com>
Date: Thu, 14 May 2015 11:33:50 -0400
Subject: [PATCH 1/5] dyncom: Remove unused structs

---
 src/core/arm/dyncom/arm_dyncom_interpreter.cpp | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
index 8c52bdb72..aeb1bb929 100644
--- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
+++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
@@ -798,14 +798,6 @@ struct bkpt_inst {
     u32 imm;
 };
 
-struct blx1_inst {
-    unsigned int addr;
-};
-
-struct blx2_inst {
-    unsigned int Rm;
-};
-
 typedef struct _stc_inst {
 } stc_inst;
 

From f3c4de4ce4effbc121d7cc96f12ae18ab9d9b043 Mon Sep 17 00:00:00 2001
From: Lioncash <mathew1800@gmail.com>
Date: Thu, 14 May 2015 11:51:46 -0400
Subject: [PATCH 2/5] dyncom: Remove unnecessary typedefs

---
 .../arm/dyncom/arm_dyncom_interpreter.cpp     | 265 +++++++++---------
 src/core/arm/skyeye_common/vfp/vfpinstr.cpp   | 128 ++++-----
 2 files changed, 197 insertions(+), 196 deletions(-)

diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
index aeb1bb929..ebc1b96b9 100644
--- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
+++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
@@ -224,10 +224,10 @@ static unsigned int DPO(RotateRightByRegister)(ARMul_State* cpu, unsigned int sh
 
 typedef void (*get_addr_fp_t)(ARMul_State *cpu, unsigned int inst, unsigned int &virt_addr, unsigned int rw);
 
-typedef struct _ldst_inst {
+struct ldst_inst {
     unsigned int inst;
     get_addr_fp_t get_addr;
-} ldst_inst;
+};
 #define DEBUG_MSG LOG_DEBUG(Core_ARM11, "inst is %x", inst); CITRA_IGNORE_EXIT(0)
 
 int CondPassed(ARMul_State* cpu, unsigned int cond);
@@ -647,247 +647,248 @@ static void LnSWoUB(ScaledRegisterOffset)(ARMul_State* cpu, unsigned int inst, u
     virt_addr = addr;
 }
 
-typedef struct _arm_inst {
+struct arm_inst {
     unsigned int idx;
     unsigned int cond;
     int br;
     int load_r15;
     char component[0];
-} arm_inst;
+};
 
-typedef struct generic_arm_inst {
+struct generic_arm_inst {
     u32 Ra;
     u32 Rm;
     u32 Rn;
     u32 Rd;
     u8 op1;
     u8 op2;
-} generic_arm_inst;
+};
 
-typedef struct _adc_inst {
+struct adc_inst {
     unsigned int I;
     unsigned int S;
     unsigned int Rn;
     unsigned int Rd;
     unsigned int shifter_operand;
     shtop_fp_t shtop_func;
-} adc_inst;
+};
 
-typedef struct _add_inst {
+struct add_inst {
     unsigned int I;
     unsigned int S;
     unsigned int Rn;
     unsigned int Rd;
     unsigned int shifter_operand;
     shtop_fp_t shtop_func;
-} add_inst;
+};
 
-typedef struct _orr_inst {
+struct orr_inst {
     unsigned int I;
     unsigned int S;
     unsigned int Rn;
     unsigned int Rd;
     unsigned int shifter_operand;
     shtop_fp_t shtop_func;
-} orr_inst;
+};
 
-typedef struct _and_inst {
+struct and_inst {
     unsigned int I;
     unsigned int S;
     unsigned int Rn;
     unsigned int Rd;
     unsigned int shifter_operand;
     shtop_fp_t shtop_func;
-} and_inst;
+};
 
-typedef struct _eor_inst {
+struct eor_inst {
     unsigned int I;
     unsigned int S;
     unsigned int Rn;
     unsigned int Rd;
     unsigned int shifter_operand;
     shtop_fp_t shtop_func;
-} eor_inst;
+};
 
-typedef struct _bbl_inst {
+struct bbl_inst {
     unsigned int L;
     int signed_immed_24;
     unsigned int next_addr;
     unsigned int jmp_addr;
-} bbl_inst;
+};
 
-typedef struct _bx_inst {
+struct bx_inst {
     unsigned int Rm;
-} bx_inst;
+};
 
-typedef struct _blx_inst {
+struct blx_inst {
     union {
         int32_t signed_immed_24;
         uint32_t Rm;
     } val;
     unsigned int inst;
-} blx_inst;
+};
 
-typedef struct _clz_inst {
+struct clz_inst {
     unsigned int Rm;
     unsigned int Rd;
-} clz_inst;
+};
 
-typedef struct _cps_inst {
+struct cps_inst {
     unsigned int imod0;
     unsigned int imod1;
     unsigned int mmod;
     unsigned int A, I, F;
     unsigned int mode;
-} cps_inst;
+};
 
-typedef struct _clrex_inst {
-} clrex_inst;
+struct clrex_inst {
+};
 
-typedef struct _cpy_inst {
+struct cpy_inst {
     unsigned int Rm;
     unsigned int Rd;
-} cpy_inst;
+};
 
-typedef struct _bic_inst {
+struct bic_inst {
     unsigned int I;
     unsigned int S;
     unsigned int Rn;
     unsigned int Rd;
     unsigned int shifter_operand;
     shtop_fp_t shtop_func;
-} bic_inst;
+};
 
-typedef struct _sub_inst {
+struct sub_inst {
     unsigned int I;
     unsigned int S;
     unsigned int Rn;
     unsigned int Rd;
     unsigned int shifter_operand;
     shtop_fp_t shtop_func;
-} sub_inst;
+};
 
-typedef struct _tst_inst {
+struct tst_inst {
     unsigned int I;
     unsigned int S;
     unsigned int Rn;
     unsigned int Rd;
     unsigned int shifter_operand;
     shtop_fp_t shtop_func;
-} tst_inst;
+};
 
-typedef struct _cmn_inst {
+struct cmn_inst {
     unsigned int I;
     unsigned int Rn;
     unsigned int shifter_operand;
     shtop_fp_t shtop_func;
-} cmn_inst;
+};
 
-typedef struct _teq_inst {
+struct teq_inst {
     unsigned int I;
     unsigned int Rn;
     unsigned int shifter_operand;
     shtop_fp_t shtop_func;
-} teq_inst;
+};
 
-typedef struct _stm_inst {
+struct stm_inst {
     unsigned int inst;
-} stm_inst;
+};
 
 struct bkpt_inst {
     u32 imm;
 };
 
-typedef struct _stc_inst {
-} stc_inst;
+struct stc_inst {
+};
 
-typedef struct _ldc_inst {
-} ldc_inst;
+struct ldc_inst {
+};
 
-typedef struct _swi_inst {
+struct swi_inst {
     unsigned int num;
-} swi_inst;
+};
 
-typedef struct _cmp_inst {
+struct cmp_inst {
     unsigned int I;
     unsigned int Rn;
     unsigned int shifter_operand;
     shtop_fp_t shtop_func;
-} cmp_inst;
+};
 
-typedef struct _mov_inst {
+struct mov_inst {
     unsigned int I;
     unsigned int S;
     unsigned int Rd;
     unsigned int shifter_operand;
     shtop_fp_t shtop_func;
-} mov_inst;
+};
 
-typedef struct _mvn_inst {
+struct mvn_inst {
     unsigned int I;
     unsigned int S;
     unsigned int Rd;
     unsigned int shifter_operand;
     shtop_fp_t shtop_func;
-} mvn_inst;
+};
 
-typedef struct _rev_inst {
+struct rev_inst {
     unsigned int Rd;
     unsigned int Rm;
     unsigned int op1;
     unsigned int op2;
-} rev_inst;
+};
 
-typedef struct _rsb_inst {
+struct rsb_inst {
     unsigned int I;
     unsigned int S;
     unsigned int Rn;
     unsigned int Rd;
     unsigned int shifter_operand;
     shtop_fp_t shtop_func;
-} rsb_inst;
+};
 
-typedef struct _rsc_inst {
+struct rsc_inst {
     unsigned int I;
     unsigned int S;
     unsigned int Rn;
     unsigned int Rd;
     unsigned int shifter_operand;
     shtop_fp_t shtop_func;
-} rsc_inst;
+};
 
-typedef struct _sbc_inst {
+struct sbc_inst {
     unsigned int I;
     unsigned int S;
     unsigned int Rn;
     unsigned int Rd;
     unsigned int shifter_operand;
     shtop_fp_t shtop_func;
-} sbc_inst;
+};
 
-typedef struct _mul_inst {
+struct mul_inst {
     unsigned int S;
     unsigned int Rd;
     unsigned int Rs;
     unsigned int Rm;
-} mul_inst;
+};
 
-typedef struct _smul_inst {
+struct smul_inst {
     unsigned int Rd;
     unsigned int Rs;
     unsigned int Rm;
     unsigned int x;
     unsigned int y;
-} smul_inst;
+};
 
-typedef struct _umull_inst {
+struct umull_inst {
     unsigned int S;
     unsigned int RdHi;
     unsigned int RdLo;
     unsigned int Rs;
     unsigned int Rm;
-} umull_inst;
-typedef struct _smlad_inst {
+};
+
+struct smlad_inst {
     unsigned int m;
     unsigned int Rm;
     unsigned int Rd;
@@ -895,58 +896,58 @@ typedef struct _smlad_inst {
     unsigned int Rn;
     unsigned int op1;
     unsigned int op2;
-} smlad_inst;
+};
 
-typedef struct _smla_inst {
+struct smla_inst {
     unsigned int x;
     unsigned int y;
     unsigned int Rm;
     unsigned int Rd;
     unsigned int Rs;
     unsigned int Rn;
-} smla_inst;
+};
 
-typedef struct smlalxy_inst {
+struct smlalxy_inst {
     unsigned int x;
     unsigned int y;
     unsigned int RdLo;
     unsigned int RdHi;
     unsigned int Rm;
     unsigned int Rn;
-} smlalxy_inst;
+};
 
-typedef struct ssat_inst {
+struct ssat_inst {
     unsigned int Rn;
     unsigned int Rd;
     unsigned int imm5;
     unsigned int sat_imm;
     unsigned int shift_type;
-} ssat_inst;
+};
 
-typedef struct umaal_inst {
+struct umaal_inst {
     unsigned int Rn;
     unsigned int Rm;
     unsigned int RdHi;
     unsigned int RdLo;
-} umaal_inst;
+};
 
-typedef struct _umlal_inst {
+struct umlal_inst {
     unsigned int S;
     unsigned int Rm;
     unsigned int Rs;
     unsigned int RdHi;
     unsigned int RdLo;
-} umlal_inst;
+};
 
-typedef struct _smlal_inst {
+struct smlal_inst {
     unsigned int S;
     unsigned int Rm;
     unsigned int Rs;
     unsigned int RdHi;
     unsigned int RdLo;
-} smlal_inst;
+};
 
-typedef struct smlald_inst {
+struct smlald_inst {
     unsigned int RdLo;
     unsigned int RdHi;
     unsigned int Rm;
@@ -954,17 +955,17 @@ typedef struct smlald_inst {
     unsigned int swap;
     unsigned int op1;
     unsigned int op2;
-} smlald_inst;
+};
 
-typedef struct _mla_inst {
+struct mla_inst {
     unsigned int S;
     unsigned int Rn;
     unsigned int Rd;
     unsigned int Rs;
     unsigned int Rm;
-} mla_inst;
+};
 
-typedef struct _mrc_inst {
+struct mrc_inst {
     unsigned int opcode_1;
     unsigned int opcode_2;
     unsigned int cp_num;
@@ -972,9 +973,9 @@ typedef struct _mrc_inst {
     unsigned int crm;
     unsigned int Rd;
     unsigned int inst;
-} mrc_inst;
+};
 
-typedef struct _mcr_inst {
+struct mcr_inst {
     unsigned int opcode_1;
     unsigned int opcode_2;
     unsigned int cp_num;
@@ -982,77 +983,77 @@ typedef struct _mcr_inst {
     unsigned int crm;
     unsigned int Rd;
     unsigned int inst;
-} mcr_inst;
+};
 
-typedef struct mcrr_inst {
+struct mcrr_inst {
     unsigned int opcode_1;
     unsigned int cp_num;
     unsigned int crm;
     unsigned int rt;
     unsigned int rt2;
-} mcrr_inst;
+};
 
-typedef struct _mrs_inst {
+struct mrs_inst {
     unsigned int R;
     unsigned int Rd;
-} mrs_inst;
+};
 
-typedef struct _msr_inst {
+struct msr_inst {
     unsigned int field_mask;
     unsigned int R;
     unsigned int inst;
-} msr_inst;
+};
 
-typedef struct _pld_inst {
-} pld_inst;
+struct pld_inst {
+};
 
-typedef struct _sxtb_inst {
+struct sxtb_inst {
     unsigned int Rd;
     unsigned int Rm;
     unsigned int rotate;
-} sxtb_inst;
+};
 
-typedef struct _sxtab_inst {
+struct sxtab_inst {
     unsigned int Rd;
     unsigned int Rn;
     unsigned int Rm;
     unsigned rotate;
-} sxtab_inst;
+};
 
-typedef struct _sxtah_inst {
+struct sxtah_inst {
     unsigned int Rd;
     unsigned int Rn;
     unsigned int Rm;
     unsigned int rotate;
-} sxtah_inst;
+};
 
-typedef struct _sxth_inst {
+struct sxth_inst {
     unsigned int Rd;
     unsigned int Rm;
     unsigned int rotate;
-} sxth_inst;
+};
 
-typedef struct _uxtab_inst {
+struct uxtab_inst {
     unsigned int Rn;
     unsigned int Rd;
     unsigned int rotate;
     unsigned int Rm;
-} uxtab_inst;
+};
 
-typedef struct _uxtah_inst {
+struct uxtah_inst {
     unsigned int Rn;
     unsigned int Rd;
     unsigned int rotate;
     unsigned int Rm;
-} uxtah_inst;
+};
 
-typedef struct _uxth_inst {
+struct uxth_inst {
     unsigned int Rd;
     unsigned int Rm;
     unsigned int rotate;
-} uxth_inst;
+};
 
-typedef struct _cdp_inst {
+struct cdp_inst {
     unsigned int opcode_1;
     unsigned int CRn;
     unsigned int CRd;
@@ -1060,49 +1061,49 @@ typedef struct _cdp_inst {
     unsigned int opcode_2;
     unsigned int CRm;
     unsigned int inst;
-}cdp_inst;
+};
 
-typedef struct _uxtb_inst {
+struct uxtb_inst {
     unsigned int Rd;
     unsigned int Rm;
     unsigned int rotate;
-} uxtb_inst;
+};
 
-typedef struct _swp_inst {
+struct swp_inst {
     unsigned int Rn;
     unsigned int Rd;
     unsigned int Rm;
-} swp_inst;
+};
 
-typedef struct setend_inst {
+struct setend_inst {
     unsigned int set_bigend;
-} setend_inst;
+};
 
-typedef struct _b_2_thumb {
+struct b_2_thumb {
     unsigned int imm;
-}b_2_thumb;
-typedef struct _b_cond_thumb {
+};
+struct b_cond_thumb {
     unsigned int imm;
     unsigned int cond;
-}b_cond_thumb;
+};
 
-typedef struct _bl_1_thumb {
+struct bl_1_thumb {
     unsigned int imm;
-}bl_1_thumb;
-typedef struct _bl_2_thumb {
+};
+struct bl_2_thumb {
     unsigned int imm;
-}bl_2_thumb;
-typedef struct _blx_1_thumb {
+};
+struct blx_1_thumb {
     unsigned int imm;
     unsigned int instr;
-}blx_1_thumb;
+};
 
-typedef struct _pkh_inst {
+struct pkh_inst {
     unsigned int Rm;
     unsigned int Rn;
     unsigned int Rd;
     unsigned char imm;
-} pkh_inst;
+};
 
 typedef arm_inst * ARM_INST_PTR;
 
diff --git a/src/core/arm/skyeye_common/vfp/vfpinstr.cpp b/src/core/arm/skyeye_common/vfp/vfpinstr.cpp
index 72afe2164..a04bf915c 100644
--- a/src/core/arm/skyeye_common/vfp/vfpinstr.cpp
+++ b/src/core/arm/skyeye_common/vfp/vfpinstr.cpp
@@ -13,10 +13,10 @@
 /* VMLA */
 /* cond 1110 0D00 Vn-- Vd-- 101X N0M0 Vm-- */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vmla_inst {
+struct vmla_inst {
     unsigned int instr;
     unsigned int dp_operation;
-} vmla_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vmla)(unsigned int inst, int index)
@@ -63,10 +63,10 @@ VMLA_INST:
 /* VNMLS */
 /* cond 1110 0D00 Vn-- Vd-- 101X N1M0 Vm-- */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vmls_inst {
+struct vmls_inst {
     unsigned int instr;
     unsigned int dp_operation;
-} vmls_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vmls)(unsigned int inst, int index)
@@ -113,10 +113,10 @@ VMLS_INST:
 /* VNMLA */
 /* cond 1110 0D01 Vn-- Vd-- 101X N1M0 Vm-- */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vnmla_inst {
+struct vnmla_inst {
     unsigned int instr;
     unsigned int dp_operation;
-} vnmla_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vnmla)(unsigned int inst, int index)
@@ -164,10 +164,10 @@ VNMLA_INST:
 /* cond 1110 0D01 Vn-- Vd-- 101X N0M0 Vm-- */
 
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vnmls_inst {
+struct vnmls_inst {
     unsigned int instr;
     unsigned int dp_operation;
-} vnmls_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vnmls)(unsigned int inst, int index)
@@ -214,10 +214,10 @@ VNMLS_INST:
 /* VNMUL */
 /* cond 1110 0D10 Vn-- Vd-- 101X N0M0 Vm-- */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vnmul_inst {
+struct vnmul_inst {
     unsigned int instr;
     unsigned int dp_operation;
-} vnmul_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vnmul)(unsigned int inst, int index)
@@ -264,10 +264,10 @@ VNMUL_INST:
 /* VMUL */
 /* cond 1110 0D10 Vn-- Vd-- 101X N0M0 Vm-- */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vmul_inst {
+struct vmul_inst {
     unsigned int instr;
     unsigned int dp_operation;
-} vmul_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vmul)(unsigned int inst, int index)
@@ -314,10 +314,10 @@ VMUL_INST:
 /* VADD */
 /* cond 1110 0D11 Vn-- Vd-- 101X N0M0 Vm-- */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vadd_inst {
+struct vadd_inst {
     unsigned int instr;
     unsigned int dp_operation;
-} vadd_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vadd)(unsigned int inst, int index)
@@ -364,10 +364,10 @@ VADD_INST:
 /* VSUB */
 /* cond 1110 0D11 Vn-- Vd-- 101X N1M0 Vm-- */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vsub_inst {
+struct vsub_inst {
     unsigned int instr;
     unsigned int dp_operation;
-} vsub_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vsub)(unsigned int inst, int index)
@@ -414,10 +414,10 @@ VSUB_INST:
 /* VDIV */
 /* cond 1110 1D00 Vn-- Vd-- 101X N0M0 Vm-- */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vdiv_inst {
+struct vdiv_inst {
     unsigned int instr;
     unsigned int dp_operation;
-} vdiv_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vdiv)(unsigned int inst, int index)
@@ -465,11 +465,11 @@ VDIV_INST:
 /* cond 1110 1D11 im4H Vd-- 101X 0000 im4L */
 /* cond 1110 opc1 CRn- CRd- copr op20 CRm- CDP */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vmovi_inst {
+struct vmovi_inst {
     unsigned int single;
     unsigned int d;
     unsigned int imm;
-} vmovi_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vmovi)(unsigned int inst, int index)
@@ -514,11 +514,11 @@ VMOVI_INST:
 /* cond 1110 1D11 0000 Vd-- 101X 01M0 Vm-- */
 /* cond 1110 opc1 CRn- CRd- copr op20 CRm- CDP */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vmovr_inst {
+struct vmovr_inst {
     unsigned int single;
     unsigned int d;
     unsigned int m;
-} vmovr_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vmovr)(unsigned int inst, int index)
@@ -609,10 +609,10 @@ VABS_INST:
 /* cond 1110 1D11 0001 Vd-- 101X 11M0 Vm-- */
 
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vneg_inst {
+struct vneg_inst {
     unsigned int instr;
     unsigned int dp_operation;
-} vneg_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vneg)(unsigned int inst, int index)
@@ -659,10 +659,10 @@ VNEG_INST:
 /* VSQRT */
 /* cond 1110 1D11 0001 Vd-- 101X 11M0 Vm-- */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vsqrt_inst {
+struct vsqrt_inst {
     unsigned int instr;
     unsigned int dp_operation;
-} vsqrt_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vsqrt)(unsigned int inst, int index)
@@ -709,10 +709,10 @@ VSQRT_INST:
 /* VCMP VCMPE */
 /* cond 1110 1D11 0100 Vd-- 101X E1M0 Vm-- Encoding 1 */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vcmp_inst {
+struct vcmp_inst {
     unsigned int instr;
     unsigned int dp_operation;
-} vcmp_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vcmp)(unsigned int inst, int index)
@@ -759,10 +759,10 @@ VCMP_INST:
 /* VCMP VCMPE */
 /* cond 1110 1D11 0100 Vd-- 101X E1M0 Vm-- Encoding 2 */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vcmp2_inst {
+struct vcmp2_inst {
     unsigned int instr;
     unsigned int dp_operation;
-} vcmp2_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vcmp2)(unsigned int inst, int index)
@@ -809,10 +809,10 @@ VCMP2_INST:
 /* VCVTBDS between double and single */
 /* cond 1110 1D11 0111 Vd-- 101X 11M0 Vm-- */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vcvtbds_inst {
+struct vcvtbds_inst {
     unsigned int instr;
     unsigned int dp_operation;
-} vcvtbds_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vcvtbds)(unsigned int inst, int index)
@@ -859,10 +859,10 @@ VCVTBDS_INST:
 /* VCVTBFF between floating point and fixed point */
 /* cond 1110 1D11 1op2 Vd-- 101X X1M0 Vm-- */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vcvtbff_inst {
+struct vcvtbff_inst {
     unsigned int instr;
     unsigned int dp_operation;
-} vcvtbff_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vcvtbff)(unsigned int inst, int index)
@@ -911,10 +911,10 @@ VCVTBFF_INST:
 /* VCVTBFI between floating point and integer */
 /* cond 1110 1D11 1op2 Vd-- 101X X1M0 Vm-- */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vcvtbfi_inst {
+struct vcvtbfi_inst {
     unsigned int instr;
     unsigned int dp_operation;
-} vcvtbfi_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vcvtbfi)(unsigned int inst, int index)
@@ -967,11 +967,11 @@ VCVTBFI_INST:
 /* cond 1110 000o Vn-- Rt-- 1010 N001 0000 */
 /* cond 1110 op11 CRn- Rt-- copr op21 CRm- MRC */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vmovbrs_inst {
+struct vmovbrs_inst {
     unsigned int to_arm;
     unsigned int t;
     unsigned int n;
-} vmovbrs_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vmovbrs)(unsigned int inst, int index)
@@ -1013,10 +1013,10 @@ VMOVBRS_INST:
 /* cond 1110 1110 reg- Rt-- 1010 0001 0000 */
 /* cond 1110 op10 CRn- Rt-- copr op21 CRm- MCR */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vmsr_inst {
+struct vmsr_inst {
     unsigned int reg;
     unsigned int Rd;
-} vmsr_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vmsr)(unsigned int inst, int index)
@@ -1040,7 +1040,7 @@ VMSR_INST:
 {
     if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
         /* FIXME: special case for access to FPSID and FPEXC, VFP must be disabled ,
-           and in privilegied mode */
+           and in privileged mode */
         /* Exceptions must be checked, according to v7 ref manual */
         CHECK_VFP_ENABLED;
 
@@ -1060,12 +1060,12 @@ VMSR_INST:
 /* cond 1110 0XX0 Vd-- Rt-- 1011 DXX1 0000 */
 /* cond 1110 op10 CRn- Rt-- copr op21 CRm- MCR */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vmovbrc_inst {
+struct vmovbrc_inst {
     unsigned int esize;
     unsigned int index;
     unsigned int d;
     unsigned int t;
-} vmovbrc_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vmovbrc)(unsigned int inst, int index)
@@ -1109,10 +1109,10 @@ VMOVBRC_INST:
 /* cond 1110 1111 CRn- Rt-- 1010 0001 0000 */
 /* cond 1110 op11 CRn- Rt-- copr op21 CRm- MRC */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vmrs_inst {
+struct vmrs_inst {
     unsigned int reg;
     unsigned int Rt;
-} vmrs_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vmrs)(unsigned int inst, int index)
@@ -1136,7 +1136,7 @@ VMRS_INST:
 {
     if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
         /* FIXME: special case for access to FPSID and FPEXC, VFP must be disabled,
-           and in privilegied mode */
+           and in privileged mode */
         /* Exceptions must be checked, according to v7 ref manual */
         CHECK_VFP_ENABLED;
 
@@ -1191,12 +1191,12 @@ VMRS_INST:
 /* cond 1110 XXX1 Vd-- Rt-- 1011 NXX1 0000 */
 /* cond 1110 op11 CRn- Rt-- copr op21 CRm- MCR */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vmovbcr_inst {
+struct vmovbcr_inst {
     unsigned int esize;
     unsigned int index;
     unsigned int d;
     unsigned int t;
-} vmovbcr_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vmovbcr)(unsigned int inst, int index)
@@ -1245,12 +1245,12 @@ VMOVBCR_INST:
 /* cond 1100 010X Rt2- Rt-- 1010 00X1 Vm-- */
 /* cond 1100 0101 Rt2- Rt-- copr opc1 CRm- MRRC */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vmovbrrss_inst {
+struct vmovbrrss_inst {
     unsigned int to_arm;
     unsigned int t;
     unsigned int t2;
     unsigned int m;
-} vmovbrrss_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vmovbrrss)(unsigned int inst, int index)
@@ -1294,12 +1294,12 @@ VMOVBRRSS_INST:
 /* cond 1100 010X Rt2- Rt-- 1011 00X1 Vm-- */
 /* cond 1100 0101 Rt2- Rt-- copr opc1 CRm- MRRC */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vmovbrrd_inst {
+struct vmovbrrd_inst {
     unsigned int to_arm;
     unsigned int t;
     unsigned int t2;
     unsigned int m;
-} vmovbrrd_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vmovbrrd)(unsigned int inst, int index)
@@ -1347,13 +1347,13 @@ VMOVBRRD_INST:
 /* VSTR */
 /* cond 1101 UD00 Rn-- Vd-- 101X imm8 imm8 */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vstr_inst {
+struct vstr_inst {
     unsigned int single;
     unsigned int n;
     unsigned int d;
     unsigned int imm32;
     unsigned int add;
-} vstr_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vstr)(unsigned int inst, int index)
@@ -1415,12 +1415,12 @@ VSTR_INST:
 /* VPUSH */
 /* cond 1101 0D10 1101 Vd-- 101X imm8 imm8 */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vpush_inst {
+struct vpush_inst {
     unsigned int single;
     unsigned int d;
     unsigned int imm32;
     unsigned int regs;
-} vpush_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vpush)(unsigned int inst, int index)
@@ -1488,7 +1488,7 @@ VPUSH_INST:
 /* VSTM */
 /* cond 110P UDW0 Rn-- Vd-- 101X imm8 imm8 */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vstm_inst {
+struct vstm_inst {
     unsigned int single;
     unsigned int add;
     unsigned int wback;
@@ -1496,7 +1496,7 @@ typedef struct _vstm_inst {
     unsigned int n;
     unsigned int imm32;
     unsigned int regs;
-} vstm_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vstm)(unsigned int inst, int index)
@@ -1570,12 +1570,12 @@ VSTM_INST: /* encoding 1 */
 /* VPOP */
 /* cond 1100 1D11 1101 Vd-- 101X imm8 imm8 */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vpop_inst {
+struct vpop_inst {
     unsigned int single;
     unsigned int d;
     unsigned int imm32;
     unsigned int regs;
-} vpop_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vpop)(unsigned int inst, int index)
@@ -1643,13 +1643,13 @@ VPOP_INST:
 /* VLDR */
 /* cond 1101 UD01 Rn-- Vd-- 101X imm8 imm8 */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vldr_inst {
+struct vldr_inst {
     unsigned int single;
     unsigned int n;
     unsigned int d;
     unsigned int imm32;
     unsigned int add;
-} vldr_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vldr)(unsigned int inst, int index)
@@ -1711,7 +1711,7 @@ VLDR_INST:
 /* VLDM */
 /* cond 110P UDW1 Rn-- Vd-- 101X imm8 imm8 */
 #ifdef VFP_INTERPRETER_STRUCT
-typedef struct _vldm_inst {
+struct vldm_inst {
     unsigned int single;
     unsigned int add;
     unsigned int wback;
@@ -1719,7 +1719,7 @@ typedef struct _vldm_inst {
     unsigned int n;
     unsigned int imm32;
     unsigned int regs;
-} vldm_inst;
+};
 #endif
 #ifdef VFP_INTERPRETER_TRANS
 static ARM_INST_PTR INTERPRETER_TRANSLATE(vldm)(unsigned int inst, int index)

From 0530fd249911a807bcaca2563d95d1f33298ad62 Mon Sep 17 00:00:00 2001
From: Lioncash <mathew1800@gmail.com>
Date: Thu, 14 May 2015 11:58:05 -0400
Subject: [PATCH 3/5] dyncom: Make translation-unit functions and variables
 static

---
 .../arm/dyncom/arm_dyncom_interpreter.cpp     | 130 +++++++++---------
 1 file changed, 64 insertions(+), 66 deletions(-)

diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
index ebc1b96b9..81d8c7026 100644
--- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
+++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
@@ -68,6 +68,67 @@ static void remove_exclusive(ARMul_State* state, ARMword addr){
     state->exclusive_tag = 0xFFFFFFFF;
 }
 
+static int CondPassed(ARMul_State* cpu, unsigned int cond) {
+    #define NFLAG        cpu->NFlag
+    #define ZFLAG        cpu->ZFlag
+    #define CFLAG        cpu->CFlag
+    #define VFLAG        cpu->VFlag
+
+    int temp = 0;
+
+    switch (cond) {
+    case 0x0:
+        temp = ZFLAG;
+        break;
+    case 0x1: // NE
+        temp = !ZFLAG;
+        break;
+    case 0x2: // CS
+        temp = CFLAG;
+        break;
+    case 0x3: // CC
+        temp = !CFLAG;
+        break;
+    case 0x4: // MI
+        temp = NFLAG;
+        break;
+    case 0x5: // PL
+        temp = !NFLAG;
+        break;
+    case 0x6: // VS
+        temp = VFLAG;
+        break;
+    case 0x7: // VC
+        temp = !VFLAG;
+        break;
+    case 0x8: // HI
+        temp = (CFLAG && !ZFLAG);
+        break;
+    case 0x9: // LS
+        temp = (!CFLAG || ZFLAG);
+        break;
+    case 0xa: // GE
+        temp = ((!NFLAG && !VFLAG) || (NFLAG && VFLAG));
+        break;
+    case 0xb: // LT
+        temp = ((NFLAG && !VFLAG) || (!NFLAG && VFLAG));
+        break;
+    case 0xc: // GT
+        temp = ((!NFLAG && !VFLAG && !ZFLAG) || (NFLAG && VFLAG && !ZFLAG));
+        break;
+    case 0xd: // LE
+        temp = ((NFLAG && !VFLAG) || (!NFLAG && VFLAG)) || ZFLAG;
+        break;
+    case 0xe: // AL
+        temp = 1;
+        break;
+    case 0xf:
+        temp = 1;
+        break;
+    }
+    return temp;
+}
+
 static unsigned int DPO(Immediate)(ARMul_State* cpu, unsigned int sht_oper) {
     unsigned int immed_8 = BITS(sht_oper, 0, 7);
     unsigned int rotate_imm = BITS(sht_oper, 8, 11);
@@ -230,8 +291,6 @@ struct ldst_inst {
 };
 #define DEBUG_MSG LOG_DEBUG(Core_ARM11, "inst is %x", inst); CITRA_IGNORE_EXIT(0)
 
-int CondPassed(ARMul_State* cpu, unsigned int cond);
-
 #define LnSWoUB(s)   glue(LnSWoUB, s)
 #define MLnS(s)      glue(MLnS, s)
 #define LdnStM(s)    glue(LdnStM, s)
@@ -1108,9 +1167,9 @@ struct pkh_inst {
 typedef arm_inst * ARM_INST_PTR;
 
 #define CACHE_BUFFER_SIZE    (64 * 1024 * 2000)
-char inst_buf[CACHE_BUFFER_SIZE];
-int top = 0;
-inline void *AllocBuffer(unsigned int size) {
+static char inst_buf[CACHE_BUFFER_SIZE];
+static int top = 0;
+static inline void *AllocBuffer(unsigned int size) {
     int start = top;
     top += size;
     if (top > CACHE_BUFFER_SIZE) {
@@ -1120,67 +1179,6 @@ inline void *AllocBuffer(unsigned int size) {
     return (void *)&inst_buf[start];
 }
 
-int CondPassed(ARMul_State* cpu, unsigned int cond) {
-    #define NFLAG        cpu->NFlag
-    #define ZFLAG        cpu->ZFlag
-    #define CFLAG        cpu->CFlag
-    #define VFLAG        cpu->VFlag
-
-    int temp = 0;
-
-    switch (cond) {
-    case 0x0:
-        temp = ZFLAG;
-        break;
-    case 0x1: // NE
-        temp = !ZFLAG;
-        break;
-    case 0x6: // VS
-        temp = VFLAG;
-        break;
-    case 0x7: // VC
-        temp = !VFLAG;
-        break;
-    case 0x4: // MI
-        temp = NFLAG;
-        break;
-    case 0x5: // PL
-        temp = !NFLAG;
-        break;
-    case 0x2: // CS
-        temp = CFLAG;
-        break;
-    case 0x3: // CC
-        temp = !CFLAG;
-        break;
-    case 0x8: // HI
-        temp = (CFLAG && !ZFLAG);
-        break;
-    case 0x9: // LS
-        temp = (!CFLAG || ZFLAG);
-        break;
-    case 0xa: // GE
-        temp = ((!NFLAG && !VFLAG) || (NFLAG && VFLAG));
-        break;
-    case 0xb: // LT
-        temp = ((NFLAG && !VFLAG) || (!NFLAG && VFLAG));
-        break;
-    case 0xc: // GT
-        temp = ((!NFLAG && !VFLAG && !ZFLAG) || (NFLAG && VFLAG && !ZFLAG));
-        break;
-    case 0xd: // LE
-        temp = ((NFLAG && !VFLAG) || (!NFLAG && VFLAG)) || ZFLAG;
-        break;
-    case 0xe: // AL
-        temp = 1;
-        break;
-    case 0xf:
-        temp = 1;
-        break;
-    }
-    return temp;
-}
-
 enum DECODE_STATUS {
     DECODE_SUCCESS,
     DECODE_FAILURE

From f4921d0f9d8d3bd28f68fd70eacdc565562bb5cd Mon Sep 17 00:00:00 2001
From: Lioncash <mathew1800@gmail.com>
Date: Thu, 14 May 2015 12:15:03 -0400
Subject: [PATCH 4/5] dyncom: Remove unnecessary defines

These can simply be const vars.
---
 src/core/arm/dyncom/arm_dyncom_interpreter.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
index 81d8c7026..7ec2f3ef2 100644
--- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
+++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
@@ -69,10 +69,10 @@ static void remove_exclusive(ARMul_State* state, ARMword addr){
 }
 
 static int CondPassed(ARMul_State* cpu, unsigned int cond) {
-    #define NFLAG        cpu->NFlag
-    #define ZFLAG        cpu->ZFlag
-    #define CFLAG        cpu->CFlag
-    #define VFLAG        cpu->VFlag
+    const u32 NFLAG = cpu->NFlag;
+    const u32 ZFLAG = cpu->ZFlag;
+    const u32 CFLAG = cpu->CFlag;
+    const u32 VFLAG = cpu->VFlag;
 
     int temp = 0;
 

From 1e0255364c25d4ed341cbff47a1d835731064207 Mon Sep 17 00:00:00 2001
From: Lioncash <mathew1800@gmail.com>
Date: Thu, 14 May 2015 12:19:51 -0400
Subject: [PATCH 5/5] dyncom: Remove duplicate enums/prototypes

These are already defined in arm_dyncom_interpreter_dec.cpp.
---
 src/core/arm/dyncom/arm_dyncom_interpreter.cpp | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
index 7ec2f3ef2..816c86c21 100644
--- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
+++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
@@ -13,6 +13,7 @@
 #include "core/mem_map.h"
 #include "core/hle/svc.h"
 #include "core/arm/disassembler/arm_disasm.h"
+#include "core/arm/dyncom/arm_dyncom_dec.h"
 #include "core/arm/dyncom/arm_dyncom_interpreter.h"
 #include "core/arm/dyncom/arm_dyncom_thumb.h"
 #include "core/arm/dyncom/arm_dyncom_run.h"
@@ -1179,13 +1180,6 @@ static inline void *AllocBuffer(unsigned int size) {
     return (void *)&inst_buf[start];
 }
 
-enum DECODE_STATUS {
-    DECODE_SUCCESS,
-    DECODE_FAILURE
-};
-
-int decode_arm_instr(uint32_t instr, int32_t *idx);
-
 static shtop_fp_t get_shtop(unsigned int inst) {
     if (BIT(inst, 25)) {
         return DPO(Immediate);