[patch] Start merging MCSection and MCSectionData

Duncan P. N. Exon Smith dexonsmith at apple.com
Thu May 21 11:05:34 PDT 2015


> On 2015 May 21, at 10:34, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:
> 
> There are a few issues with the current split between MCSection and
> MCSectionData.
> 
> * It optimizes the the not as important case. We want the production
> of .o files to be really fast, but the split puts the information used
> for .o emission in a separate data structure.
> 
> * The ELF/COFF/MachO hierarchy is not represented in MCSectionData,
> leading to some ad-hoc ways to represent the various flags.
> 
> * It makes it harder to remember where each item is.
> 
> The attached patch starts merging the two by moving the alignment from
> MCSectionData to MCSection.
> 
> Most of the patch is actually just dropping 'const', since
> MCSectionData is mutable, but MCSection was not.

Instead of dropping `const` with `MCSymbol`, I made all the `MCSymbolData`
fields `mutable`.  The downside of my approach is that the fields are
always mutable.

I'm not particularly tied to the way I did things; I mostly did it that
way since there were already a bunch of `mutable` fields in `MCSymbol`.
However, there does seem to be a real separation between when the two
sets of fields need to be modified.  I haven't looked at whether the
same is true of `MCSymbolData`.

Any thoughts on which approach is better?

> 
> Cheers,
> Rafael
> <t.patch>





More information about the llvm-commits mailing list