[Lldb-commits] [PATCH] D12356: [MIPS64] Emulate MSA branch instructions

Tamas Berghammer via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 26 04:00:23 PDT 2015

tberghammer added a subscriber: tberghammer.
tberghammer added a comment.

You added 10 new function to the emulator where the first 8 functions and the last 2 functions are almost identical. I know that the rest of the MIPS64 instruction emulator is having the same issue but I would like to see these functions to be merged into a smaller number of functions to remove code duplication.

I see 2 different approach to do it and I am not sure which one is better in this case, but both of them improves the situation by a lot.

- Write only 2 function (first 8, last 2) and that function then reads out the condition and the sizes from the MCInst object. I would prefer this approach, but I am not sure how difficult it is to read out data from an MCInst
- Keep the 10 function for the 10 different instruction, but make these functions to call a function (one for the first 8 and one for the last 2) with passing in the constants required by the specific instruction.

Both approach would reduce the amount of code in this class and help a lot in reducing the maintenance cost with removing a lot of duplicated code.



More information about the lldb-commits mailing list