Integrated assembler improvements in LLVM 19 | MaskRay

submited by
Style Pass
2024-07-01 03:00:03

Within the LLVM project, MC is a library responsible for handling assembly, disassembly, and object file formats. [Intro to the LLVM MC Project], which was written back in 2010, remains a good source to understand the high-level structures.

In the latest release cycle, substantial effort has been dedicated to refining MC's internal representation for improved performance and readability. These changes have decreased compile time significantly . This blog post will delve into the details, providing insights into the specific changes.

MCAssembler manages assembler states (including sections, symbols) and implements layout and object file writing after parsing. MCAsmLayout, tightly coupled with MCAssembler, was in charge of symbol and fragment offsets during MCAssembler::Finish. Many MCAssembler and MCExpr member functions have a const MCAsmLayout & parameter, contributing to slight overhead.

Fragments, representing sequences of non-relaxable instructions, relaxable instruction, alignment directives, and other elements. MCDataFragment and MCRelaxableFragment, whose sizes are crucial for memory consumption, have undergone several optimizations:

Leave a Comment