[LLVMdev] Distinguish variadic register defines/uses in MCInstrDesc?

Christoph Grenz christophg+llvm at grenz-bonn.de
Wed Sep 26 16:42:04 PDT 2012

Am Mittwoch, 26. September 2012, 11:18:20 schrieb Jakob Stoklund Olesen:
> Hi Christoph,
> As you noticed, MCInstrDesc doesn't distinguish between variadic uses and
> defs. Since variadic instructions will always require some kind of special
> handling, it doesn't seem worthwhile to make the model more detailed.

I don't see what makes them so different from other instructions.
MCInstrDesc provides the information which operands are defines and which uses 
for all other instruction types and for variadic there are only three possible 
* All variadic registers are uses (push/stm on ARM)
* All variadic registers are defines (pop/ldm)
* uses and defines are mixed.

I think variable_ops on x86 RET can also be modeled as the first case.

The first two cases don't need any special handling. The start and count of 
variadic operands is known through MCInstrDesc and 
MCInstruction::getNumOperands(). So I can handle them like any other 
instruction if I know which case applies. Only the third case really needs 
special handling and I couldn't find an instruction that falls into this case.

> I think your current workaround sounds fine.
> /jakob


More information about the llvm-dev mailing list