Sun Apr 19 11:27:37 CEST 2009
what is an assembly instruction?
[asm] -> [asm]
An abstract data type to be manipulated by coma macros. This
type has expansion-time information that checks constraints on
the syntax: name and arity. (and later possibly type).
(asm,here,operands) -> [bin]
Assembly instructions can be _compiled_ to binary machine code,
relative to the location at which they are supposed to be
placed. Note that operands need to be bit vectors. This
function is called a primitive assembler. The (partial) inverse
of this is called a primitive disassembler.
(asm,here,operands) -> (m -> m)
The primitive simulator is merely a different representation of
the semantics, accessible from the syntax manipulation phase.
It translates a fully specified instruction into a machine state
update function, enabling the instruction to be _interpreted_.
([asm],dict,start) -> [bin]
Instances of asm structures can contain symbolic information
which eventually depends on the size of the [bin] output of
primitive assemblers. This circularity is broken by sucessive
approximation using a relaxation algorithm.
Anything that translates to [bin] looses information: in this stage,
all symbolic/parameterized information is gone.
The interesting parts are the coma [asm] -> [asm] translation and the
interpretation steps (asm,here,operands) -> (m -> m). If the latter
can be made to perform abstract interpretation, a lot of checks can be
It looks like the important conclusions are:
- flexibility of representation of instruction semantics (m -> m)
will determine how the information encoded in these functions can
be fed back to [asm] -> [asm] transformers (i.e. to generate
peephole optimizations). however, this can be added later on, on
top of basic static structure.
- practically: information about the instruction's type needs a