-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Encoder identity refactoring changes (#19)
* Renamed enums This commit renamed all the enocder identitiy enums from the prev- ious `OP_` prefix to the `ENC_` prefix. Previously, the enocder identities were placed in the `operand.h` file and held the `OP_` prefix before it was moved to this file. However despite being moved to another module, the old name stayed around until it was finally renamed in this commit. * Define enocder tables pragmatically using macros Previosuly, the enocder function definitions were literally copied and pasted into a header file and introduced lots of verbosity to the header, things like the encoder arguments were repeated many times and was hard to maintain, this commit rectifies this issue by creating a *temporary macro* that will create function defini- tions for you automatically using the standard argument library. * Renamed `MR` and `RM` common function Previous name of the common function for the `MR` and `MR` encoder identities carried the un-descripitive and in conclusive name of `mr_rm_ref()`, this new name - `rm_mr_common` should better explain the funcitonality of this encoder helper function. Further more, this commit also removed the arbitary boolean param- eter value that described if the function was used to encode the `RM` or `MR` encoder identity, now this function simply takes a enumeration of the current identity and changes behavior based on this. * Migrated functions over to `encoder.h` This commit migrated some functions and types from the `instruct- ion.h` header to the new `encoder.h` as well as removing the enocder function definition macros. Please see the detailed changelog below: - Since there is *no recursive* preprocessing in the normal C stand- ard, the previous macro, namely the `DECLARE_ENCODER_LIST` macro fails to work, therefore removed in favour of the migration of the `instr_encode_func` from the `instruction.h` header. - The `instr_encode_func` and `instr_encoder_t` function and type respectively has been moved over to the `encoder.h` file along with the renaming of their prefixes to `enc` (Which stands for encoder) rather than the old `instr` prefix (aka *instruction*) Now, the enocder functions can be accessed using the `enc_lookup` wrapper function so the function definition doesn't need to be declared in the `encoder.h` file and prevents namespace poullution issues as well as naming clashes. * Renamed `enc_lookup`'s definition to match source As per the commit message in 64b99a5: > - The `instr_encode_func` and `instr_encoder_t` function and type > respectively has been moved over to the `encoder.h` file along with > the renaming of their prefixes to `enc` (Which stands for encoder) > rather than the old `instr` prefix (aka *instruction*) For somereason this was not carried over for the header definiton, causing linkage errors during linktime. This commit just matches this with the function prototype in the source file. (No more linker issues now :)) * Call *new* `enc_lookup` function After the migration and renaming of the instruction encoder look- up function in the previous commit, the callers were not adjusted to the change. This commit adds the `encoder.h` header file instead (Since it moved) and changed name to match function call * Added alias type for preprocessors IMO using the enocder type as a type for pre processors seems very confusing, so this commit defined the `encoder_t` type to another name sort of like a *alias* as the name of `pre_encoder_t`
- Loading branch information
1 parent
d8e7f65
commit b386787
Showing
7 changed files
with
107 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.