On 9/22/21 11:59, Richard Biener wrote:
On Thu, Sep 16, 2021 at 3:12 PM Martin Liška <mli...@suse.cz> wrote:

This patch comes up with asm_out_state and a new global variable casm.

Tested on all cross compilers.
Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?

         * output.h (struct asm_out_file): New struct that replaces a
^^^
asm_out_state?

Yes, sure!


You replace a lot of asm_out_file - do we still need the macro then?
(I'd have simplified the patch leaving that replacement out at first)

Well, I actually replaced only a very small fraction of the usage of 
asm_out_file.

$ git grep asm_out_file | grep -v ChangeLog | wc -l

1601


So I think we should live with the macro for some time ...


You leave quite some global state out of the struct that is obviously
related, in the diff I see object_block_htab for example.

Yes, I'm aware of it. Can we do that incrementally?

Basically
everything initialized in init_varasm_once is a candidate (which
then shows const_desc_htab and shared_constant_pool as well
as pending_assemble_externals_set).

Well, these would probably need a different header file (or another #include 
... must
be added before output.h :// ).

For the goal of outputting
early DWARF to another file the state CTOR could have a mode
to not initialize those parts or we could have asm-out-state-with-sections
as base of asm-out-state.

Yes, right now asm_out_state ctor is minimal:

  asm_out_state (): out_file (NULL), in_section (NULL),
    sec ({}), anchor_labelno (0), in_cold_section_p (false)
  {
    section_htab = hash_table<section_hasher>::create_ggc (31);
  }


In the end there will be a target part of the state so I think
construction needs to be defered to the target which can
derive from asm-out-state and initialize the part it needs.
That's currently what targetm.asm_out.init_sections () does
and we'd transform that to a targetm.asm_out.create () or so.
That might already be necessary for the DWARF stuff.

So what do you want to with content of init_varasm_once function?


That said, dealing with the target stuff piecemail is OK, but maybe
try to make sure that init_varasm_once is actually identical
to what the CTOR does?

So you want asm_out_state::asm_out_state doing what we current initialize
in init_varasm_once, right?

Thanks,
Cheers,
Martin



Richard.

Thanks,
Martin

Reply via email to