OSDN Git Service

Re-commit: [globalisel][tablegen] Support zero-instruction emission.
authorDaniel Sanders <daniel_l_sanders@apple.com>
Thu, 17 Aug 2017 09:26:14 +0000 (09:26 +0000)
committerDaniel Sanders <daniel_l_sanders@apple.com>
Thu, 17 Aug 2017 09:26:14 +0000 (09:26 +0000)
commit2cd3b1f607b75e4e47d14da113f88d9db5d5f1bf
tree71d718716aa95d9e29f2368b524d4bc490eac277
parentc9af81ed3775625be88a0ffb1d594b48ca3ca5d5
Re-commit: [globalisel][tablegen] Support zero-instruction emission.

Summary:
Support the case where an operand of a pattern is also the whole of the
result pattern. In this case the original result and all its uses must be
replaced by the operand. However, register class restrictions can require
a COPY. This patch handles both cases by always emitting the copy and
leaving it for the register allocator to optimize.

The previous commit failed on Windows machines due to a flaw in the sort
predicate which allowed both A < B < C and B == C to be satisfied
simultaneously. The cause of this was some sloppiness in the priority order of
G_CONSTANT instructions compared to other instructions. These had equal priority
because it makes no difference, however there were operands had higher priority
than G_CONSTANT but lower priority than any other instruction. As a result, a
priority order between G_CONSTANT and other instructions must be enforced to
ensure the predicate defines a strict weak order.

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Subscribers: javed.absar, kristof.beyls, igorb, llvm-commits

Differential Revision: https://reviews.llvm.org/D36084

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311076 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/AArch64/AArch64InstructionSelector.cpp
test/CodeGen/AArch64/GlobalISel/select-bitcast.mir
utils/TableGen/GlobalISelEmitter.cpp