Before being read by SALTO, the description file is fed through the cpp preprocessor. Any cpp-supported directives can be used to help simplify and clarify the target description. Two cpp features are commonly used:
Using the above cpp mechanisms, the description of a given target system consisting of a hardware architecture arch and a software environment target, the description will be split into five files named arch.md, arch-resource.def, arch-macro.def, arch-semantics.def, and target.cc (see figure 2.1.)
arch-resource.def : |
---|
<definition of hardware resources> <definition of resource classes> <definition of reservation tables> |
arch-macro.def : |
<definition of predefined assembler macros> |
arch-semantics.def : |
<definition of specific instruction semantics> |
target.cc
<assembler-specific directives and actions> |
Figure 2.1: Recommended layout of target system description files
The main file arch.md contains inclusion directives for the three remaining files, the description of the lexical structure of the assembly language and the definition of the target instruction set as manipulated by SALTO. File arch-macro.def contains the description of expansion rules for the predefined macros of the assembler. File arch-resource.def provides the definition of hardware resources, resource classes, and reservation tables. Finally, file arch-semantics.def provides the definition of instruction-specific semantical constraints.
Given the great variety of directive semantics between supported targets, the description of assembly directives and support routines for their manipulation are provided in a C++ file named target.cc which is compiled into a shared object file. This separates all target-dependent code from the SALTO kernel library. The base name of this file is purposely different from that of the hardware description file, since multiple target.cc files may have to deal with the peculiarities of various compiler/assembler combinations for the same hardware architecture.
In the following, the syntax of target system descriptions is presented using the BNF notation. We use the following typographical conventions: