Computer Science · Hardware and Architecture
Compact Code Generation through Custom Instruction Sets
See on the mapAbstract
This report describes the use of a custom instruction set to optimize for code size. A compiler is described that accepts a C program as input and generates a custom instruction set for that program that minimizes the resulting code size when compiling with this instruction set. The method uses a greedy heuristic that tries different instruction sets. The chosen instruction set defines a virtual machine. The input program is translated for this virtual machine, and an interpreter is generated that implements this virtual machine. Experiments show that on a RISC processor (MIPS) the resulting code size is typically 3 of the original code size. The compressed code runs considerably slower than the original code.