Page MenuHomePhabricator

[TableGen] New default operand "undef_tied_input".
ClosedPublic

Authored by simon_tatham on Apr 15 2019, 5:57 AM.

Details

Summary

This is a new special identifier which you can use as a default in
OperandWithDefaultOps. The idea is that you use it for an input
operand of an instruction that's tied to an output operand, and its
semantics are that (in the default case) the input operand's value is
not used at all.

The detailed effect is that when instruction selection emits the
instruction in the form of a pre-regalloc MachineInstr, it creates an
IMPLICIT_DEF node to use as that input.

If you're creating an MCInst with explicit register names, then the
right handling would be to set the input operand to the same register
as the output one (honouring the tie) and to add the 'undef' flag
indicating that that register is deemed to acquire a new don't-care
definition just before we read it. But I haven't done that in this
commit, because there was no need to - no Tablegen backend seems to
autogenerate default fields in an MCInst.

Event Timeline

simon_tatham created this revision.Apr 15 2019, 5:57 AM
ostannard accepted this revision.Apr 16 2019, 2:52 AM
ostannard added a subscriber: ostannard.

LGTM

This revision is now accepted and ready to land.Apr 16 2019, 2:52 AM
This revision was automatically updated to reflect the committed changes.

But I haven't done that in this commit, because there was no need to - no Tablegen backend seems to autogenerate default fields in an MCInst.

So what's the test plan here?

But I haven't done that in this commit, because there was no need to - no Tablegen backend seems to autogenerate default fields in an MCInst.

So what's the test plan here?

Thanks for pointing this out. Agreed, of course, this needs checking!
I think this is used/tested in one of the many MVE patches that we have. I need to look into it, and will do so asap.

I am seeing a build warning now. Is this a bug?

	/mnt/nvme0/llvm-project/llvm/utils/TableGen/GlobalISelEmitter.cpp: In member function ‘llvm::Error {anonymous}::GlobalISelEmitter::importDefaultOperandRenderers({anonymous}::action_iterator, {anonymous}::RuleMatcher&, {anonymous}::BuildMIAction&, llvm::DagInit*) const’:
/mnt/nvme0/llvm-project/llvm/utils/TableGen/GlobalISelEmitter.cpp:3816:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
         if (DefaultDagOperator->getDef()->isSubClassOf("ValueType"))
         ^~
/mnt/nvme0/llvm-project/llvm/utils/TableGen/GlobalISelEmitter.cpp:3819:11: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
           DefaultOp = DefaultDagOp->getArg(0);
           ^~~~~~~~~

@bogner

I've committed rL362211 to fix this bug. This change is used and tested by D62669.