[llvm-commits] State managed by MCStreamer/MCObjectStreamer

Pedro Artigas partigas at apple.com
Tue Dec 11 12:04:59 PST 2012


Hello All,

I have a question and some potential discussion topics. MCStreamer/MCObjectStreamer manage some state with regards to the target machine that needs to be cleared/reset so that the system can be used to generate code for successive compilation units in one go. The question is as follows:

What is the ownership model, that is who owns who? It seems that in a successful compilation the AsmPrinter owns the object above and calls Finish after the end of it's own doFinalization, is this accurate?

If so, it would make sense for the Finish ( or a new Reset/cleanup after the finish) to make the state go back to the right after construction state so the object can be reused. What people prefer:

- Enhance the Finish method to do state management (clear some maps, reinitialize variables, etc…)
- Create a new Reset method to do the state management and call that in the doFinalization of the AsmPrinter after the Finish
- Something else …

Also the MCContext should move from doInitialization/doFinalization to single Reset/cleanup as other state objects are handled.

What do people think?

Pedro



More information about the llvm-commits mailing list