Accessing slot numbers of unnamed instructions (SlotTracker)

Hey everyone,

I'm currently trying to figure out a method for providing a unique
identification of an llvm::Instruction that is consistent with the output of an
AssemblyWriter. Obviously this is easy for named instructions: In this case
the identification is the name itself, but I'd like to have the same thing for
unnamed instructions.

If I understand the code in AssemblyWriter.cpp correctly, AssemblyWriter uses
SlotTracker to keep track of the numbers used for unnamed instructions.
Unfortunately for me SlotTracker is missing from LLVM's public header files. Is
there any other way to retrieve a slot number for an Instruction that is
consistent with the numbers assigned by an existing AssemblyWriter instance.

Best regards,
Florian Merz

Hi Florian,

I'm currently trying to figure out a method for providing a unique
identification of an llvm::Instruction that is consistent with the output of an
AssemblyWriter. Obviously this is easy for named instructions: In this case
the identification is the name itself, but I'd like to have the same thing for
unnamed instructions.

If I understand the code in AssemblyWriter.cpp correctly, AssemblyWriter uses
SlotTracker to keep track of the numbers used for unnamed instructions.
Unfortunately for me SlotTracker is missing from LLVM's public header files. Is
there any other way to retrieve a slot number for an Instruction that is
consistent with the numbers assigned by an existing AssemblyWriter instance.

why do you want this? The short answer is that these numbers are only available
in the AssemblyWriter, so you would either have to duplicate the logic that it
uses, or put some kind of hook in AssemblyWriter.

Ciao, Duncan.