Services and Modeling for Embedded Software Development
Embecosm divider strip
Prev  Next

2.1. llvm-mc

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=arch is used and -mattr=a1,+a2,-a3 is used to enable and disable features of the processor required for instructions to be valid.

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
        
Embecosm divider strip