Code Retargeting Using a Nucleus Set
A survey of various methods of deriving code generators revealed the need to exploit certain similarities in features among the instruction sets of different processors in order to achieve and simplify code retargeting at the machine or assembly language level. A methodology is developed for comparing instruction sets of different processors with a view to obtaining their common and divergent characteristics. This entails standardising the specification of instructions, defining certain compatibility or orthogonality properties, and using these properties to classify instructions into nucleus set and non-orthogonal instructions, proof has been presented to show that these properties are necessary for the equivalence of any two instructions. The nucleus set concept is shown to be useful in a number of ways. In particular, it has been demonstrated that it forms the basis for converting an instruction set to another. A method has been designed for synthesizing non-orthogonal instructions. The nucleus instructions and other instructions derived from the synthesis, form conversion templates. These templates have been tested using Z80 and 6502 assemblers, and found to work effectively.