OSDN Git Service

Subzero: Refactor some common TargetLowering initializations.
authorJim Stichnoth <stichnot@chromium.org>
Thu, 5 Nov 2015 00:06:16 +0000 (16:06 -0800)
committerJim Stichnoth <stichnot@chromium.org>
Thu, 5 Nov 2015 00:06:16 +0000 (16:06 -0800)
commit94844f1290d7fae68ad4f9e9b9e3543639e44a15
treeb81713fdabc89a7bc391493a98d8f1e409a70dc0
parentb81b90150e980671bc51e72c928ed0bad75bcd6a
Subzero: Refactor some common TargetLowering initializations.

Each TargetLowering subclass has several fields (generally register allocation related) that are initialized to the same values every time a TargetLowering object is created.  These fields are essentially const once initialized, so there is no reason to repeatedly initialize them.

The solution is to make them static fields, and statically initialize them at program startup.

This also makes it practical to access such fields without needing a TargetLowering object.

There are likely more items that should also get this treatment, but those can be changed later.

The staticInit() method needs a run-once guard because the unit tests actually cause it to be called more than once.

BUG= none
R=kschimpf@google.com

Review URL: https://codereview.chromium.org/1418853005 .
src/IceGlobalContext.cpp
src/IceTargetLowering.cpp
src/IceTargetLowering.h
src/IceTargetLoweringARM32.cpp
src/IceTargetLoweringARM32.h
src/IceTargetLoweringMIPS32.cpp
src/IceTargetLoweringMIPS32.h
src/IceTargetLoweringX8632.cpp
src/IceTargetLoweringX8664.cpp
src/IceTargetLoweringX86Base.h
src/IceTargetLoweringX86BaseImpl.h