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. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150528/1371b348/attachment.html>
Matthias Braun
2015-May-28 23:07 UTC
[LLVMdev] MVT (machine value type) for MachineOperand
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> On May 28, 2015, at 8:11 AM, Fabian Gruber <fabian.gruber at fadeopolis.com> wrote: > > 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. > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
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. On 29 May 2015 01:07, "Matthias Braun" <mbraun at apple.com> wrote:> 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 > > > On May 28, 2015, at 8:11 AM, Fabian Gruber <fabian.gruber at fadeopolis.com> > wrote: > > > > 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. > > > > _______________________________________________ > > LLVM Developers mailing list > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150529/0a751c02/attachment.html>
Maybe Matching Threads
- [LLVMdev] MVT (machine value type) for MachineOperand
- [LLVMdev] Determining the register type of a MachineOperand
- [LLVMdev] Determining the register type of a MachineOperand
- [LLVMdev] Determining the register type of a MachineOperand
- [LLVMdev] Instruction MVT::ValueTypes