Next: , Previous: , Up: Assembler Programs   [Contents][Index]

5.14 Using the Assembler Preprocessor

The assembler preprocessor, which is part of the QSMM framework, was primarily developed to provide the means of encapsulating similar blocks of assembler source code in macros that can be reused in an assembler program. Macros can define nested control transfer structures and produce unique location labels when expanded. The preprocessor also provides the means of including other files in an assembler source file.

The assembler preprocessor returns a single output buffer with a text of preprocessed program. The contents of all included source files are copied explicitly to the preprocessed output. The preprocessed output might contain ‘line’ directives that describe source locations, which could be indicated in error, warning, and note messages generated by the assembler. The preprocessor also merges string literals on a line, which go one after another and are delimited by zero or more whitespace characters, into a single string literal.

When performing transformations of the source text, the assembler preprocessor may break alignment of multiline comments. This may prevent proper detection by the assembler whether a multiline comment is continued on the next line, and comments may be assigned to some instructions incorrectly. At present, this cannot be generally avoided.

The assembler preprocessor provides only basic features necessary to work with symbols and macros. If you need more sophisticated features to produce the source text of an assembler program, then either generate input to the preprocessor using an auxiliary function, program, or a script, or create an assembler program, which does not require preprocessing, by those means directly. Example C programs that generate input to the assembler preprocessor, which is then converted to an assembler program and loaded into a node, are described in asmat, tohuff-test, and predict-test.

Next: , Previous: , Up: Assembler Programs   [Contents][Index]