From 3151d6a99bdbdbe0b9dec651ab011f1edee24b57 Mon Sep 17 00:00:00 2001 From: Dani Messerman Date: Fri, 1 May 2015 23:07:33 +0300 Subject: [PATCH] Renamed DataProcessing to MovShift, reducing its scope --- src/binary_translation/CMakeLists.txt | 6 +++--- .../{DataProcessing.cpp => MovShift.cpp} | 17 +++++------------ .../{DataProcessing.h => MovShift.h} | 12 +----------- 3 files changed, 9 insertions(+), 26 deletions(-) rename src/binary_translation/Instructions/{DataProcessing.cpp => MovShift.cpp} (80%) rename src/binary_translation/Instructions/{DataProcessing.h => MovShift.h} (59%) diff --git a/src/binary_translation/CMakeLists.txt b/src/binary_translation/CMakeLists.txt index a770c8e87..465910a0a 100644 --- a/src/binary_translation/CMakeLists.txt +++ b/src/binary_translation/CMakeLists.txt @@ -9,7 +9,7 @@ set(SRCS ARMFuncs.cpp Instructions/Instruction.cpp - Instructions/DataProcessing.cpp + Instructions/MovShift.cpp Instructions/Branch.cpp ) set(HEADERS @@ -24,7 +24,7 @@ set(HEADERS Instructions/Types.h Instructions/Instruction.h - Instructions/DataProcessing.h + Instructions/MovShift.h Instructions/Branch.h ) @@ -35,4 +35,4 @@ add_executable(binary_translate ${SRCS} ${HEADERS}) target_link_libraries(binary_translate ${llvm_libs}) target_link_libraries(binary_translate core common video_core) target_link_libraries(binary_translate ${GLFW_LIBRARIES} ${OPENGL_gl_LIBRARY} inih) -target_link_libraries(binary_translate ${PLATFORM_LIBRARIES}) \ No newline at end of file +target_link_libraries(binary_translate ${PLATFORM_LIBRARIES}) diff --git a/src/binary_translation/Instructions/DataProcessing.cpp b/src/binary_translation/Instructions/MovShift.cpp similarity index 80% rename from src/binary_translation/Instructions/DataProcessing.cpp rename to src/binary_translation/Instructions/MovShift.cpp index 879629534..114008875 100644 --- a/src/binary_translation/Instructions/DataProcessing.cpp +++ b/src/binary_translation/Instructions/MovShift.cpp @@ -1,15 +1,15 @@ -#include "DataProcessing.h" +#include "MovShift.h" #include "Disassembler.h" #include "InstructionBlock.h" #include "ModuleGen.h" #include "ARMFuncs.h" -static RegisterInstruction register_instruction; +static RegisterInstruction register_instruction; -bool DataProcessing::Decode() +bool MovShift::Decode() { // Mov and shifts must have zeroes at some operands of different data processing instructions - if (ReadFields({ CondDef(), FieldDef<3>(0), FieldDef<4>((u32)ShortOpType::MoveAndShifts), FieldDef<1>(&s), FieldDef<4>(0), + if (ReadFields({ CondDef(), FieldDef<3>(0), FieldDef<4>(13), FieldDef<1>(&s), FieldDef<4>(0), FieldDef<4>(&rd), FieldDef<5>(&imm5), FieldDef<2>(&op2), FieldDef<1>(0), FieldDef<4>(&rm) })) { form = Form::Register; @@ -17,17 +17,10 @@ bool DataProcessing::Decode() if (rd == Register::PC && s) return false; // SEE SUBS PC, LR and related instructions; return true; } - if (ReadFields({ CondDef(), FieldDef<3>(1), FieldDef<4>(&short_op), FieldDef<1>(&s), FieldDef<4>(&rn), - FieldDef<4>(&rd), FieldDef<12>(&imm12) })) - { - // TODO: not implemented - form = Form::Immediate; - return false; - } return false; } -void DataProcessing::GenerateInstructionCode(InstructionBlock* instruction_block) +void MovShift::GenerateInstructionCode(InstructionBlock* instruction_block) { auto ir_builder = instruction_block->IrBuilder(); diff --git a/src/binary_translation/Instructions/DataProcessing.h b/src/binary_translation/Instructions/MovShift.h similarity index 59% rename from src/binary_translation/Instructions/DataProcessing.h rename to src/binary_translation/Instructions/MovShift.h index 84a13f0fd..cd892e97b 100644 --- a/src/binary_translation/Instructions/DataProcessing.h +++ b/src/binary_translation/Instructions/MovShift.h @@ -6,18 +6,9 @@ * ARMv7-A 5.2.1 (register), 5.2.2 (register-shifted register, 5.2.3 (immediate) */ -class DataProcessing : public Instruction +class MovShift : public Instruction { public: - /* - * The 4 bit op types (1 = 0001x: BitwiseXor, etc...) - */ - enum class ShortOpType - { - BitwiseAnd = 0, BitwiseXor, Subtract, RevSubtract, Add, AddWithCarry, SubtractWithCarry, ReverseSubtractWithCarry, - // Compare, Test, Misc - BitwiseOr = 12, MoveAndShifts, BitwiseBitClear, BitwiseNot - }; enum class Op2Type { MoveAndLSL, LSR, ASR, RRXAndROR @@ -32,7 +23,6 @@ public: void GenerateInstructionCode(InstructionBlock* instruction_block) override; private: Form form; - ShortOpType short_op; bool s; Register rn; Register rd;