The llvm-mc tool, described as the "LLVM machine code playground",
is used for testing components of a target's MC implementation. The
main task this tool fulfills is to assemble a .s file (via the
-assemble
command), disassemble strings of bytes
(-disassemble
), as well as show the encoding of
instructions and their internal representations
(-show-encoding
and -show-inst
respectively).
In order to determine the architecture, the parameter
-arch=
is used and
arch
-mattr=
is used to enable and disable features of the processor required for
instructions to be valid.
a1,+a2,-a3
An example of the above for the OpenRISC 1000 architecture is the optional support for multiplication and division instructions. To enable these, a command like the following would be used.
llvm-mc -assemble -show-encoding -arch=or1k -mattr=+mul,+div input.s