[PATCH] Remove static initializers from MCSchedModel
atrick at apple.com
Fri Aug 29 17:20:12 PDT 2014
> On Aug 29, 2014, at 4:54 PM, Pete Cooper <peter_cooper at apple.com> wrote:
>> I think you should remove isDefaultModel. I don’t see any purpose and it’s not maintainable.
> Actually, I think you’re right. I was looking to replace the code in Disassembler.cpp which used to do ‘if (!SCModel…)’. However, a null model in the old code didn’t even mean default, but instead uninitialized.
> Would it be fair to add another field which tells us if a model is initialized? Otherwise i’m not going to be able to handle this case? Perhaps I can fold it in to the ‘CompleteModel’ bool and have an enum for whether a model is ‘Uninitialized, Complete, InComplete’.
MCSubTargetInfo may want to support uninitialized sched model to handle invoking the disassembler with missing cpu info. I’m copying Quentin to confirm.
In that case it should deal with the uninitialized state internally (it’s really the subtarget itself that is being used without proper initialization). I don’t think MCSchedModel should be impacted. The least confusing way to do this is with a null MCSchedModel pointer and asserts in the right places. If there’s some problem with that, it could just have a flag that says “don’t use the sched model”.
>> It would be nice to move the default values from MCSchedule into targetSchedule.td. Then we can get rid of the confusing "-1 == use default” logic and consolidate comments. Hopefully that’s possible after your changes.
> Yes, that change can be done if we can find a way to construct a default model in tablegen instead of the GetDefaultModel method. Note that GetDefaultModel is really just equivalent to the old default constructor. So we’re no closer to moving the defaults to td, but no farther either.
Yeah, to make that work, it looks like all clients would need to get the default sched model from target specific code. But the generic TargetSchedule and InstrItineraryData are instantiating default models.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-commits