Page MenuHomePhabricator

TableGen: Add hasNoSchedulingInfo flag to instructions
ClosedPublic

Authored by MatzeB on Feb 29 2016, 11:13 AM.

Details

Summary

This introduces a new flag that indicates that a specific instruction will never be present when the MachineScheduler runs and therefore needs no scheduling information.

This is in preparation for an upcoming commit which checks completeness of a scheduling model when tablegen runs.

Diff Detail

Repository
rL LLVM

Event Timeline

MatzeB updated this revision to Diff 49398.Feb 29 2016, 11:13 AM
MatzeB retitled this revision from to TableGen: Add hasNoSchedulingInfo flag to instructions.
MatzeB updated this object.
MatzeB added a reviewer: atrick.
MatzeB set the repository for this revision to rL LLVM.
MatzeB added a subscriber: llvm-commits.
atrick edited edge metadata.Feb 29 2016, 2:23 PM

I had the same idea when adding the "Unsupported" flag to the ProcWriteResources template. It emits InvalidNumMicroOps, so you can use the API SchedModel.getSchedClassDesc(SchedClassIdx).isValid().

The idea was that some subtargets support only a subset of the ISA.

Do we really need to add a scheduling specific flag to tablegen Instruction class too?

I had the same idea when adding the "Unsupported" flag to the ProcWriteResources template. It emits InvalidNumMicroOps, so you can use the API SchedModel.getSchedClassDesc(SchedClassIdx).isValid().

The idea was that some subtargets support only a subset of the ISA.

Do we really need to add a scheduling specific flag to tablegen Instruction class too?

The problem with Unsupproted is that it forces us to list the unsupported instructions in each scheduling model again. We've got a bunch of generic instructions which we will never even encounter when the scheduler is running (e.g. PHI, EXTRACT_SUBREG, INSERT_SUBREG, STACKMAP) or for which we deliberately do not want to create scheduling info because they will not result in machine instructions (DBG_VALUE, IMPLICIT_DEF, KILL, LIFETIME_START, LIFETIME_END).
None of the existing instruction flags appears to match exactly these cases, (the closes existing thing is isPseudo and isCodeGenOnly, but both have examples where we still want scheduling information; e.g. COPY has isPseudo and isCodeGenOnly set but we still want scheduling information for it.

After our discussion I thought about introducing a new flag for instructions that do not result in machine instructions after all, but this won't catch this case either, because for example EXTRACT_SUBREG, INSERT_SUBREG do actually result in machine instruction but we still don't want to ever include them into the scheduling model because they are lowered early enough.

So is it okay to add this flag is specifically about the instruction being included in the scheduling model?

atrick accepted this revision.Feb 29 2016, 5:04 PM
atrick edited edge metadata.

Yes, that makes sense.

This revision is now accepted and ready to land.Feb 29 2016, 5:04 PM
This revision was automatically updated to reflect the committed changes.