[LLVMdev] Proposal: Splitting up MC/ELF + AsmPrinter Hierarchy?

Chris Lattner clattner at apple.com
Mon Sep 27 10:46:41 PDT 2010


On Sep 27, 2010, at 10:41 AM, Jason Kim wrote:

> Hi everyone,
> 
> I am in the process of adding some new code for th ARM/MC ELF
> emission, but noticed a curious linkage between th AsmPrinter and the
> MC.
> 
> It looks like the MC code (on X86 at least) calls out to the
> (misnamed?) AsmPrinter to dump out ELF bits (in X86AsmPrinter.cpp) in
> the same routine, using conditional branching....

You're right: AsmPrinter is misnamed, a better name would be "MCLowering".  AsmPrinter (and its subclasses) are in chart of lowering from the "Machine" layer to the MC layer.  The flow here is that the AsmPrinter code calls into the MC code.

> As JimG and I are working both on ARM emission stuff, I want to
> minimize chances of us stomping on each other - which probably means a
> refactoring the AsmPrinter hierarchy to contain a common ABC.
> This approach seems like the right one to take, but it itself is a
> "big" nonlocal change, so I wanted to gather opinions before I send in
> a patch along those lines...

Please don't do this, there shouldn't be a new subclass or change in AsmPrinter.  I recently fixed X86 to only have one AsmPrinter class instead of 3 :-)

What specific problem are you trying to solve that you think requires this?

-Chris



More information about the llvm-dev mailing list