Skip to content
  • Jakob Stoklund Olesen's avatar
    Use ArrayRecycler for MachineInstr operand lists. · 1bfeecb4
    Jakob Stoklund Olesen authored
    Instead of an std::vector<MachineOperand>, use MachineOperand arrays
    from an ArrayRecycler living in MachineFunction.
    
    This has several advantages:
    
    - MachineInstr now has a trivial destructor, making it possible to
      delete them in batches when destroying MachineFunction. This will be
      enabled in a later patch.
    
    - Bypassing malloc() and free() can be faster, depending on the system
      library.
    
    - MachineInstr objects and their operands are allocated from the same
      BumpPtrAllocator, so they will usually be next to each other in
      memory, providing better locality of reference.
    
    - Reduce MachineInstr footprint. A std::vector is 24 bytes, the new
      operand array representation only uses 8+4+1 bytes in MachineInstr.
    
    - Better control over operand array reallocations. In the old
      representation, the use-def chains would be reordered whenever a
      std::vector reached its capacity. The new implementation never changes
      the use-def chain order.
    
    Note that some decisions in the code generator depend on the use-def
    chain orders, so this patch may cause different assembly to be produced
    in a few cases.
    
    llvm-svn: 171598
    1bfeecb4
Loading