[llvm-commits] [PATCH] MCFragments Clean Up

Daniel Dunbar daniel at zuster.org
Fri Nov 5 11:09:57 PDT 2010


Hi David,

MCFragment actually used to be virtual.

I eventually killed this because in practice I felt like the number of
interesting fragments was likely to be small, and the vtable
construction cost wasn't worth it.

I would propose making an extensible MCFragment subclass to cover the
case of wanting to add plugable MCFragments, instead of imposing a
vtable construction cost on the core classes (which was construct many
hundreds of, and don't actually dispatch on much).

 - Daniel

On Thu, Oct 14, 2010 at 11:48 AM, David Meyer <pdox at google.com> wrote:
> Hi Dan,
>
> This patch against rev 116493 does the following:
>
> * Adds four virtual methods to MCFragment:
>     ComputeSize() - Compute the size of this fragment
>     WriteData() - Write the data of this fragment
>     AssertLegalInVirtualSection() - Assert that this fragment is legal
> in a virtual section
>     dump_kind_data() - Dump the kind-specific data for this fragment
>
> * Moves the implementation of these actions from MCAssembler.cpp to a
> new file "MCFragment.cpp"
>
> * As a benefit, most of the switches on MCFragment::Kind and many of
> the MCFragment casts go away.
>
> * Introduces the PendingLayout flag to make it possible to reuse the MCAsmLayout
> getter functions (i.e. getFragmentAddress() and getFragmentOffset())
> while inside of
> ComputeSize().
>
> Thanks. Please let me know what you think.
>
> - David M
>




More information about the llvm-commits mailing list