SimEng
SimEng copied to clipboard
Modify Instruction_Execute Helper Functions
Current helper function implementation is verbose (i.e. most instruction types have their own helper function). However, a better implementation would be a series of generic helper functions which can be passed a lambda function for the operation to be performed.
Such an implementation would require operand getter functions which automatically fetch the appropriate operands for the instruction.
Additionally, the following changes should be made to the current implementation :
- Instead of helper functions returning RegisterValues, pass the
Resultsarray by reference into the helper function (To reduce the amount of data being passed around, and number of RegisterValue objects instantiated). - As a result of the above, change type of all functions to
void. - Reduce amount of repeated calculations within helper functions (e.g. if the same value is calculated within each pass of a loop, create a new variable outside of the loop).
An alternative to lambda functions would be to use templates with the "lambda" passed in. That will generate more code, but avoid any runtime cost of binding lambda arguments.