Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Issue 1427973003: Subzero: Refactor x86 register representation to actively use aliases. (Closed)

Created:
5 years, 1 month ago by Jim Stichnoth
Modified:
5 years, 1 month ago
Reviewers:
Karl, sehr, John
CC:
native-client-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Subzero: Refactor x86 register representation to actively use aliases. Sets up additional register attributes, plus the notion of register classes, to enable robust usage of the high 8-bit GPRs (ah/bh/ch/dh), for both x86-32 and x86-64. (Note that the x86-64 changes are currently untested.) We add a Register Class field to the Variable class. The default register class is a value corresponding to the variable's type, but the target can extend the set of register class values, and the target lowering can assign different register classes as needed. The register allocator uses the register class instead of the type to determine the set of registers to draw from. For x86-64, the high 8-bit registers are not included in the general register allocation pool, but there are explicit references to ah for lowering the div/rem instructions. The target lowering is modified as needed to make sure types are appropriate and register use in instructions is legalized. Some other fixes and cleanups are included in this CL: * Makefile.standalone changes. Source files are reordered so that the more expensive compiles are done earlier, speeding up parallel builds by decreasing fragmentation. A dependency error is fixed for check-spec. * A bug is fixed in advanced phi lowering. When a temporary is introduced to break a cycle, we were neglecting to updated the predecessor count for one of the operands, leading to an assertion failure. (Applying that fix to master resulted in no changes to spec2k code generation.) A consistency check is added to help find future problems like this. Also, refactored iteration over the Phi descriptor array to use range-based for loops and avoid directly indexing the array. * Removed most of the "IceType_" prefixes in x-macro tables for brevity. * Fix a correctness TODO in the register allocator. This had no effect on spec2k code generation in master or in this CL, so we were probably just lucky. * Made some much-needed s/Dest->getType()/Ty/ changes for brevity, in the target lowering sections that needed other changes. BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4095 R=jpp@chromium.org Committed: https://gerrit.chromium.org/gerrit/gitweb?p=native_client/pnacl-subzero.git;a=commit;h=c59288b334b91f4c0b2edf0de7415c68c760aa12

Patch Set 1 #

Patch Set 2 : Change for consistency #

Total comments: 17

Patch Set 3 : Code review changes #

Patch Set 4 : More code review changes #

Patch Set 5 : Reformat #

Unified diffs Side-by-side diffs Delta from patch set Stats (+573 lines, -446 lines) Patch
M Makefile.standalone View 1 2 5 chunks +19 lines, -15 lines 0 comments Download
M src/IceCfg.cpp View 1 2 3 4 2 chunks +10 lines, -13 lines 0 comments Download
M src/IceCfgNode.cpp View 1 2 3 4 2 chunks +2 lines, -1 line 0 comments Download
M src/IceInstX8632.def View 2 chunks +20 lines, -20 lines 0 comments Download
M src/IceInstX8664.def View 1 chunk +16 lines, -16 lines 0 comments Download
M src/IceInstX86BaseImpl.h View 5 chunks +41 lines, -55 lines 0 comments Download
M src/IceOperand.h View 4 chunks +23 lines, -1 line 0 comments Download
M src/IceRegAlloc.cpp View 1 2 2 chunks +3 lines, -5 lines 0 comments Download
M src/IceRegistersARM32.h View 1 2 2 chunks +4 lines, -0 lines 0 comments Download
M src/IceRegistersMIPS32.h View 1 2 2 chunks +4 lines, -0 lines 0 comments Download
M src/IceTargetLowering.h View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M src/IceTargetLoweringARM32.h View 1 2 2 chunks +6 lines, -3 lines 0 comments Download
M src/IceTargetLoweringMIPS32.h View 1 2 2 chunks +6 lines, -3 lines 0 comments Download
M src/IceTargetLoweringX8632.cpp View 3 chunks +3 lines, -3 lines 0 comments Download
M src/IceTargetLoweringX8632Traits.h View 6 chunks +38 lines, -17 lines 0 comments Download
M src/IceTargetLoweringX8664.cpp View 3 chunks +3 lines, -3 lines 0 comments Download
M src/IceTargetLoweringX8664Traits.h View 6 chunks +36 lines, -16 lines 0 comments Download
M src/IceTargetLoweringX86Base.h View 1 2 4 chunks +8 lines, -3 lines 0 comments Download
M src/IceTargetLoweringX86BaseImpl.h View 1 35 chunks +231 lines, -210 lines 0 comments Download
A src/IceTargetLoweringX86RegClass.h View 1 2 3 1 chunk +36 lines, -0 lines 0 comments Download
M src/IceTypes.h View 1 chunk +1 line, -1 line 0 comments Download
M src/IceTypes.cpp View 2 chunks +3 lines, -2 lines 0 comments Download
M src/IceTypes.def View 2 chunks +33 lines, -33 lines 0 comments Download
M tests_lit/llvm2ice_tests/64bit.pnacl.ll View 3 chunks +4 lines, -4 lines 0 comments Download
M tests_lit/llvm2ice_tests/ebp_args.ll View 1 chunk +1 line, -1 line 0 comments Download
M tests_lit/llvm2ice_tests/nacl-atomic-intrinsics.ll View 1 chunk +1 line, -1 line 0 comments Download
M tests_lit/llvm2ice_tests/randomize-regalloc.ll View 4 chunks +14 lines, -14 lines 0 comments Download
M tests_lit/llvm2ice_tests/rng.ll View 1 chunk +5 lines, -5 lines 0 comments Download

Messages

Total messages: 8 (3 generated)
Jim Stichnoth
Looks like a 12% improvement for bzip2, maybe 3% for gzip, and random fluctuations elsewhere. ...
5 years, 1 month ago (2015-11-08 17:45:59 UTC) #3
John
lgtm Mostly nits. I would still encourage splitting this CL in two before landing it. ...
5 years, 1 month ago (2015-11-09 16:23:30 UTC) #4
Jim Stichnoth
https://codereview.chromium.org/1427973003/diff/20001/src/IceCfgNode.cpp File src/IceCfgNode.cpp (right): https://codereview.chromium.org/1427973003/diff/20001/src/IceCfgNode.cpp#newcode308 src/IceCfgNode.cpp:308: PhiDesc(const PhiDesc &) = default; On 2015/11/09 16:23:29, John ...
5 years, 1 month ago (2015-11-09 18:17:36 UTC) #5
Jim Stichnoth
https://codereview.chromium.org/1427973003/diff/20001/Makefile.standalone File Makefile.standalone (right): https://codereview.chromium.org/1427973003/diff/20001/Makefile.standalone#newcode428 Makefile.standalone:428: check: check-lit check-unit check-xtest check-spec On 2015/11/09 16:23:29, John ...
5 years, 1 month ago (2015-11-09 18:45:35 UTC) #7
Jim Stichnoth
5 years, 1 month ago (2015-11-09 19:38:46 UTC) #8
Message was sent while issue was closed.
Committed patchset #5 (id:80001) manually as
c59288b334b91f4c0b2edf0de7415c68c760aa12 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698