OSDN Git Service

Factor out legalization of undef, and handle more cases for ARM.
authorJan Voung <jvoung@chromium.org>
Wed, 15 Jul 2015 19:36:20 +0000 (12:36 -0700)
committerJan Voung <jvoung@chromium.org>
Wed, 15 Jul 2015 19:36:20 +0000 (12:36 -0700)
commitfbdd244013aad0808220386eb6bd17eb0635dd4c
tree5eab41eaf30b9814dd3f7a4048278a5e8b7ba70a
parent728c1d400bbf92053e3a3fcf1292810277844670
Factor out legalization of undef, and handle more cases for ARM.

By factoring out legalizeUndef(), we can use the same
logic in prelowerPhis which may help if we ever change the
value used (though if we switch from zero-ing out regs to
using uninitialized regs, it'll take more work -- e.g.,
can't return a 64-bit reg).

For x86, use legalizeUndef where it's clear that the value
is immediately fed to loOperand/hiOperand then another
legalize() call. Otherwise, leave the general
X = legalize(X); alone where the code is counting on that
being the sole legalization.

For x86 legalize(const64) is a pass-through, which can then
be passed to loOperand/hiOperand nicely. However, for ARM,
legalize(const64) may end up trying to copy the const64 to
a register, but we don't have 64-bit registers. Instead do
legalizeUndef(X) where x86 would have just done
legalize(X). This happens to work because legalizeUndef
doesn't try to copy to reg, and we immediately pass the
result to loOperand/hiOperand() which then passes the
result to a real legalization call.

Add a few more undef tests.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=4076
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1233903002 .
src/IceTargetLoweringARM32.cpp
src/IceTargetLoweringARM32.h
src/IceTargetLoweringX86Base.h
src/IceTargetLoweringX86BaseImpl.h
tests_lit/llvm2ice_tests/bool-folding.ll
tests_lit/llvm2ice_tests/nacl-atomic-intrinsics.ll
tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll
tests_lit/llvm2ice_tests/rmw.ll
tests_lit/llvm2ice_tests/switch-opt.ll
tests_lit/llvm2ice_tests/undef.ll