This is an archive of the discontinued LLVM Phabricator instance.

[FastISel] Permit instructions to be skipped for FastISel generation.
ClosedPublic

Authored by sdardis on May 16 2018, 8:33 AM.

Details

Summary

Some ISA's such as microMIPS32(R6) have instructions which are near identical
for code generation purposes, e.g. xor and xor16. These instructions take the
same value types for operands and return values, have the same
instruction predicates and map to the same ISD opcode. (These instructions do
differ by register classes.)

In such cases, the FastISel generator rejects the instruction definition.

This patch borrows the 'FastIselShouldIgnore' bit from rL129692 and enables
applying it to an instruction definition.

Diff Detail

Repository
rL LLVM

Event Timeline

sdardis created this revision.May 16 2018, 8:33 AM

Can you please add a test case?

Is the intent here just to bail early in order to save compile time?

sdardis updated this revision to Diff 147450.May 18 2018, 2:27 AM

Include test case.

Is the intent here just to bail early in order to save compile time?

The intent here is to deal with instructions like addu16 in microMIPS by excluding them from consideration for FastISel altogether as currently they can't be handled:

cd /Users/sdardis/dev/llvm/llvmbuild3 && /Users/sdardis/dev/llvm/llvmbuild3/bin/llvm-tblgen -gen-fast-isel -I /Users/sdardis/dev/llvm/llvm/lib/Target/Mips -I /Users/sdardis/dev/llvm/llvm/include -I /Users/sdardis/dev/llvm/llvm/lib/Target /Users/sdardis/dev/llvm/llvm/lib/Target/Mips/Mips.td -o lib/Target/Mips/MipsGenFastISel.inc.tmp -d lib/Target/Mips/MipsGenFastISel.inc.d
Included from /Users/sdardis/dev/llvm/llvm/lib/Target/Mips/Mips.td:60:
Included from /Users/sdardis/dev/llvm/llvm/lib/Target/Mips/MipsInstrInfo.td:3185:
/Users/sdardis/dev/llvm/llvm/lib/Target/Mips/MicroMipsInstrInfo.td:747:3: error: Duplicate predicate in FastISel table!

This error occurs wile building LLVM with the D46956 applied and a similar error for the attached test case. This patch allows FastISel generation to succeed.

Okay, now I understand. Seems like a reasonable extension.

Can you point me at the change that actually uses this new functionality?

utils/TableGen/FastISelEmitter.cpp
452 ↗(On Diff #147450)

Please don't add white space.

The two dependant patches (https://reviews.llvm.org/D46956 and https://reviews.llvm.org/D47075) make use of this functionality. I can't commit them yet without this patch, as they'll break the build for any builder which compiles the MIPS backend.

utils/TableGen/FastISelEmitter.cpp
452 ↗(On Diff #147450)

Will fix this.

This revision is now accepted and ready to land.May 21 2018, 11:51 AM
This revision was automatically updated to reflect the committed changes.