[PATCH] Remove static initializers from MCSchedModel

Chandler Carruth chandlerc at google.com
Fri Aug 29 13:13:36 PDT 2014


So, if this is just the pattern we use with all of the bits here, I'm OK
with that I guess... but it seems to make the the interface much more ugly:

+// For unknown processors.
+MCSchedModel MCSchedModel::DefaultSchedModel = {
+  MCSchedModel::DefaultIssueWidth,
+  DefaultMicroOpBufferSize,
+  DefaultLoopMicroOpBufferSize,
+  DefaultLoadLatency,
+  DefaultHighLatency,
+  DefaultMispredictPenalty,
+  false,
+  true,
+  0,
+  nullptr,
+  nullptr,
+  0,
+  0,
+  nullptr
+};

I found the old hiding of private members and use of a constructor much
easier to read.

Would it work to do this with the same technique that Chris used in some of
his patches where MCSchedModel has a static method that returns an object
with the defaults set appropriately?


On Fri, Aug 29, 2014 at 9:38 AM, Pete Cooper <peter_cooper at apple.com> wrote:

> Hi all
>
> Please review this patch to change MCSchedModel to avoid static
> initializers.  This makes it behavior match other structs with similar
> uses, e.g., MCWriteProcResEntry and MCProcResourceDesc.
>
> This is part of the work to remove all the static initializers from LLVM.
>
> Thanks,
> Pete
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140829/0f89c874/attachment.html>


More information about the llvm-commits mailing list