MVT (machine value type) for MachineOperand

Hi,

I am writing a small tool to gather some static statistics on machine code using LLVMs MachineInstr, etc., infrastructure.

My current goal is to count the number of bytes of integer and floating point data being processed per iteration of a loop.
Now I’ve ran into the problem that I can’t find any obvious way to get the actual type of a MachineOperand.

After some digging I noticed that the selection DAG has some type information and I had a look at the TableGen records that contain this type info. I started looking into how I could generate some descriptor tables with that information but TableGen is quite a handfull, and I’d like to avoid this if I can.

Did I overlook some easy way to get at type information at the MachineOperand level?

Thanks.

For the registers on register operands you can query MachineRegisterInfor for their Class. The registerclass should have a list of possible types (usually with the same size in bits) assigned.

- Matthias

Unfortunately looking at the register classes is not enough for my use case.
Some vector registers for example can hold both scalars and packed vectors. This would lead my estimation being wrong by factor between 2 and 4x.
In many cases this also does not allow me to distinguish floating point and integer computation.