Specifying representations of machine instructions
- 1 May 1997
- journal article
- Published by Association for Computing Machinery (ACM) in ACM Transactions on Programming Languages and Systems
- Vol. 19 (3) , 492-524
- https://doi.org/10.1145/256167.256225
Abstract
We present SLED, a specification language for Encoding and Decoding, which describes, abstract, binary, and assembly-language representations of machine instructions. Guided by a SLED specification, the New Jersey Machine-Code Toolkit generates bit-manipulating code for use in applications that process machine code. Programmers can write such applications at an assembly language level of abstraction, and the toolkit enables the applications to recognize and emit the binary representations used by the hardware. SLED is suitable for describing both CISC and RISC machines; we have specified representations of MIPS R3000, SPARC, Alpha, and Intel Pentium instructions, and toolkit users have written specifications for the Power PC and Motorola 68000. The article includes representative excerpts from our SPARC and Pentium specifications. SLED uses four elements; fields and tokens describe parts of instructions; patterns describe binary representations of instructions or group of instructions; and constructors map between the abstract and binary levels. By combining the elements in different ways, SLED supports machine-independent implementations of machine-level concepts like conditional assembly, span-dependent instructions, relocatable addresses, object code, sections, and relocation. SLED specifications can be checked automatically for consistency with existing assemblers. The implementation of the toolkit is largely determined by our representations of patterns and constructors. We use a normal form that facilitates construction of encoders and decoders. The article describes the normal form and its use. The toolkit has been used to help build several applications. We have built a retargetable debugger and a retargetable, optimizing linker. Colleagues have built a dynamic code generator, a decompiler, and an execution-time analyzer. The toolkit generates efficient code; for example, the linker emits binary up to 15% faster than it emits assembly language, making it 1.7-2 times faster to produce an a.out directly than by using the assembler.Keywords
This publication has 11 references indexed in Scilit:
- Automatic checking of instruction specificationsPublished by Association for Computing Machinery (ACM) ,1997
- VortexACM SIGPLAN Notices, 1996
- A Simple Solver for Linear Equations Containing Nonlinear OperatorsSoftware: Practice and Experience, 1996
- Literate programming simplifiedIEEE Software, 1994
- Optimally profiling and tracing programsACM Transactions on Programming Languages and Systems, 1994
- Shade: a fast instruction-set simulator for execution profilingPublished by Association for Computing Machinery (ACM) ,1994
- A portable and optimizing back end for the SML/NJ compilerPublished by Springer Nature ,1994
- Automatic Derivation of Code Generators from Machine DescriptionsACM Transactions on Programming Languages and Systems, 1980
- Assembling code for machines with span-dependent instructionsCommunications of the ACM, 1978
- Evolution of the meta-assembly programCommunications of the ACM, 1966