The use of the MC layer
The MC layer is used to handle the final representation of the actual instructions of the target. The final representation in the context of a backend compiler is either the textual or binary representation of the object file.
Figure 12.2 illustrates when the MC layer is used in the LLVM infrastructure:

Figure 12.2: MC, the glue for handling with the final output of the compiler
Looking closer at Figure 12.2, you can see that the Machine IR gets compiled to the MC representation. Then you can print the MC representation to produce assembly files (.s
), in other words, the textual representation of an object file, or assemble it to produce the binary file that is typically called the object file (.o
). These are the two main output paths used with MC.
Similarly, MC is used as the representation when coming from either an assembly or object file. For assembly files, the LLVM infrastructure parses the textual representation and internally produces...