[LLVMbugs] [Bug 358] NEW: Make the code generator assert if #operands passed to BuildMI is not correct

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Jun 3 16:56:22 PDT 2004


           Summary: Make the code generator assert if #operands passed to
                    BuildMI is not correct
           Product: libraries
           Version: 1.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sabre at nondot.org

Right now the BuildMI functions take a number of operands to reserve space in
the operands vector for the MachineInstr class.  It is really easy to pass in an
incorrect number for these calls, and it has no bad effect now.

We should add assertions that the number passed in is right.  Doing this is
tricky though as we don't save the number.  Instead of just 'reserve'ing space
in the operands list, we could actually resize the vector, then have the BuildMI
functionality FILL IN the operands instead of push_back them.  This would allow
the MachineInstrBuilder to assert that all operands are added when it is destroyed.

Once this is done, a pretty substantial performance win in the code generator
could be realized by actually allocating the operands for a MachineInstr in the
same block of memory as the MachineInstr itself, instead of in a separate
vector.  Since the number of operands to a machine instruction should not change
over the lifetime of the machine instr, this should work great.


------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

More information about the llvm-bugs mailing list