Skip to content
  1. Jan 08, 2013
  2. Jan 05, 2013
    • Jakob Stoklund Olesen's avatar
      Don't call destructors on MachineInstr and MachineOperand. · dc5285f1
      Jakob Stoklund Olesen authored
      The series of patches leading up to this one makes llc -O0 run 8% faster.
      
      When deallocating a MachineFunction, there is no need to visit all
      MachineInstr and MachineOperand objects to deallocate them. All their
      memory come from a BumpPtrAllocator that is about to be purged, and they
      have empty destructors anyway.
      
      This only applies when deallocating the MachineFunction.
      DeleteMachineInstr() should still be used to recycle MI memory during
      the codegen passes.
      
      Remove the LeakDetector support for MachineInstr. I've never seen it
      used before, and now it definitely doesn't work. With this patch, leaked
      MachineInstrs would be much less of a problem since all of their memory
      will be reclaimed by ~MachineFunction().
      
      llvm-svn: 171599
      dc5285f1
    • 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
  3. Jan 02, 2013
    • Chandler Carruth's avatar
      Move all of the header files which are involved in modelling the LLVM IR · 9fb823bb
      Chandler Carruth authored
      into their new header subdirectory: include/llvm/IR. This matches the
      directory structure of lib, and begins to correct a long standing point
      of file layout clutter in LLVM.
      
      There are still more header files to move here, but I wanted to handle
      them in separate commits to make tracking what files make sense at each
      layer easier.
      
      The only really questionable files here are the target intrinsic
      tablegen files. But that's a battle I'd rather not fight today.
      
      I've updated both CMake and Makefile build systems (I think, and my
      tests think, but I may have missed something).
      
      I've also re-sorted the includes throughout the project. I'll be
      committing updates to Clang, DragonEgg, and Polly momentarily.
      
      llvm-svn: 171366
      9fb823bb
  4. Dec 22, 2012
  5. Dec 20, 2012
  6. Dec 19, 2012
  7. Dec 18, 2012
    • Jakob Stoklund Olesen's avatar
      Don't allow the automatically updated MI flags to be set directly. · a33f504b
      Jakob Stoklund Olesen authored
      The bundle-related MI flags need to be kept in sync with the neighboring
      instructions. Don't allow the bulk flag-setting setFlags() function to
      change them.
      
      Also don't copy MI flags when cloning an instruction. The clone's bundle
      flags will be set when it is explicitly inserted into a bundle.
      
      llvm-svn: 170459
      a33f504b
    • Jakob Stoklund Olesen's avatar
      Tighten up the erase/remove API for bundled instructions. · ccfb5fb4
      Jakob Stoklund Olesen authored
      Most code is oblivious to bundles and uses the MBB::iterator which only
      visits whole bundles. MBB::erase() operates on whole bundles at a time
      as before.
      
      MBB::remove() now refuses to remove bundled instructions. It is not safe
      to remove all instructions in a bundle without deleting them since there
      is no way of returning pointers to all the removed instructions.
      
      MBB::remove_instr() and MBB::erase_instr() will now update bundle flags
      correctly, lifting individual instructions out of bundles while leaving
      the remaining bundle intact.
      
      The MachineInstr convenience functions are updated so
      
        eraseFromParent() erases a whole bundle as before
        eraseFromBundle() erases a single instruction, leaving the rest of its bundle.
        removeFromParent() refuses to operate on bundled instructions, and
        removeFromBundle() lifts a single instruction out of its bundle.
      
      These functions will no longer accidentally split or coalesce bundles -
      bundle flags are updated to preserve the existing bundling, and explicit
      bundleWith* / unbundleFrom* functions should be used to change the
      instruction bundling.
      
      This API update is still a work in progress. I am going to update APIs
      first so they maintain bundle flags automatically when possible. Then
      I'll add stricter verification of the bundle flags.
      
      llvm-svn: 170384
      ccfb5fb4
  8. Dec 07, 2012
    • Jakob Stoklund Olesen's avatar
      Add higher-level API for dealing with bundled MachineInstrs. · fead62d4
      Jakob Stoklund Olesen authored
      This is still a work in progress. The purpose is to make bundling and
      unbundling operations explicit, and to catch errors where bundles are
      broken or created inadvertently.
      
      The old IsInsideBundle flag is replaced by two MI flags: BundledPred
      which has the same meaning as IsInsideBundle, and BundledSucc which is
      set on instructions that are bundled with a successor. Having two flags
      provdes redundancy to detect when a bundle is inadvertently torn by a
      splice() or insert(), and it makes it possible to write bundle iterators
      that don't need to peek at adjacent instructions.
      
      The new flags can't be manipulated directly (once setIsInsideBundle is
      gone). Instead there are MI functions to make and break bundle bonds.
      
      The setIsInsideBundle function will be removed in a future commit. It
      should be replaced by bundleWithPred().
      
      llvm-svn: 169583
      fead62d4
  9. Dec 05, 2012
  10. Dec 03, 2012
    • Chandler Carruth's avatar
      Use the new script to sort the includes of every file under lib. · ed0881b2
      Chandler Carruth authored
      Sooooo many of these had incorrect or strange main module includes.
      I have manually inspected all of these, and fixed the main module
      include to be the nearest plausible thing I could find. If you own or
      care about any of these source files, I encourage you to take some time
      and check that these edits were sensible. I can't have broken anything
      (I strictly added headers, and reordered them, never removed), but they
      may not be the headers you'd really like to identify as containing the
      API being implemented.
      
      Many forward declarations and missing includes were added to a header
      files to allow them to parse cleanly when included first. The main
      module rule does in fact have its merits. =]
      
      llvm-svn: 169131
      ed0881b2
  11. Oct 31, 2012
  12. Oct 08, 2012
  13. Sep 12, 2012
    • Michael Liao's avatar
      Fix PR11985 · abb87d48
      Michael Liao authored
          
      - BlockAddress has no support of BA + offset form and there is no way to
        propagate that offset into machine operand;
      - Add BA + offset support and a new interface 'getTargetBlockAddress' to
        simplify target block address forming;
      - All targets are modified to use new interface and X86 backend is enhanced to
        support BA + offset addressing.
      
      llvm-svn: 163743
      abb87d48
    • Manman Ren's avatar
      Release build: guard dump functions with · 19f49ac6
      Manman Ren authored
      "#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)"
      
      No functional change. Update r163339.
      
      llvm-svn: 163653
      19f49ac6
  14. Sep 06, 2012
  15. Sep 05, 2012
  16. Sep 04, 2012
    • Jakob Stoklund Olesen's avatar
      Typo. · d92e2bc2
      Jakob Stoklund Olesen authored
      llvm-svn: 163154
      d92e2bc2
    • Jakob Stoklund Olesen's avatar
      Actually use the MachineOperand field for isRegTiedToDefOperand(). · 9fceda74
      Jakob Stoklund Olesen authored
      The MachineOperand::TiedTo field was maintained, but not used.
      
      This patch enables it in isRegTiedToDefOperand() and
      isRegTiedToUseOperand() which are the actual functions use by the
      register allocator.
      
      llvm-svn: 163153
      9fceda74
    • Jakob Stoklund Olesen's avatar
      Allow tied uses and defs in different orders. · 0a09da83
      Jakob Stoklund Olesen authored
      After much agonizing, use a full 4 bits of precious MachineOperand space
      to encode this. This uses existing padding, and doesn't grow
      MachineOperand beyond its current 32 bytes.
      
      This allows tied defs among the first 15 operands on a normal
      instruction, just like the current MCInstrDesc constraint encoding.
      Inline assembly needs to be able to tie more than the first 15 operands,
      and gets special treatment.
      
      Tied uses can appear beyond 15 operands, as long as they are tied to a
      def that's in range.
      
      llvm-svn: 163151
      0a09da83
  17. Aug 31, 2012
    • Jakob Stoklund Olesen's avatar
      Add MachineInstr::tieOperands, remove setIsTied(). · 5c8eda0e
      Jakob Stoklund Olesen authored
      Manage tied operands entirely internally to MachineInstr. This makes it
      possible to change the representation of tied operands, as I will do
      shortly.
      
      The constraint that tied uses and defs must be in the same order was too
      restrictive.
      
      llvm-svn: 163021
      5c8eda0e
  18. Aug 30, 2012
    • Jakob Stoklund Olesen's avatar
      Don't use MCInstrDesc flags for implicit operands. · 0eecbbeb
      Jakob Stoklund Olesen authored
      When a MachineInstr is constructed, its implicit operands are added
      first, then the explicit operands are inserted before the implicits.
      
      MCInstrDesc has oprand flags like early clobber and operand ties that
      apply to the explicit operands.
      
      Don't look at those flags when the implicit operands are first added in
      the explicit operands's positions.
      
      llvm-svn: 162910
      0eecbbeb
  19. Aug 29, 2012
  20. Aug 28, 2012
    • Jakob Stoklund Olesen's avatar
      Add a MachineOperand::isTied() flag. · e56c60c5
      Jakob Stoklund Olesen authored
      While in SSA form, a MachineInstr can have pairs of tied defs and uses.
      The tied operands are used to represent read-modify-write operands that
      must be assigned the same physical register.
      
      Previously, tied operand pairs were computed from fixed MCInstrDesc
      fields, or by using black magic on inline assembly instructions.
      
      The isTied flag makes it possible to add tied operands to any
      instruction while getting rid of (some of) the inlineasm magic.
      
      Tied operands on normal instructions are needed to represent predicated
      individual instructions in SSA form. An extra <tied,imp-use> operand is
      required to represent the output value when the instruction predicate is
      false.
      
      Adding a predicate to:
      
        %vreg0<def> = ADD %vreg1, %vreg2
      
      Will look like:
      
        %vreg0<tied,def> = ADD %vreg1, %vreg2, pred:3, %vreg7<tied,imp-use>
      
      The virtual register %vreg7 is the value given to %vreg0 when the
      predicate is false. It will be assigned the same physreg as %vreg0.
      
      This commit adds the isTied flag and sets it based on MCInstrDesc when
      building an instruction. The flag is not used for anything yet.
      
      llvm-svn: 162774
      e56c60c5
    • Jakob Stoklund Olesen's avatar
      Don't allow TargetFlags on MO_Register MachineOperands. · dba99d0d
      Jakob Stoklund Olesen authored
      Register operands are manipulated by a lot of target-independent code,
      and it is not always possible to preserve target flags. That means it is
      not safe to use target flags on register operands.
      
      None of the targets in the tree are using register operand target flags.
      External targets should be using immediate operands to annotate
      instructions with operand modifiers.
      
      llvm-svn: 162770
      dba99d0d
  21. Aug 10, 2012
  22. Aug 07, 2012
    • Jakob Stoklund Olesen's avatar
      Add a new kind of MachineOperand: MO_TargetIndex. · 84689b0d
      Jakob Stoklund Olesen authored
      A target index operand looks a lot like a constant pool reference, but
      it is completely target-defined. It contains the 8-bit TargetFlags, a
      32-bit index, and a 64-bit offset. It is preserved by all code generator
      passes.
      
      TargetIndex operands can be used to carry target-specific information in
      cases where immediate operands won't suffice.
      
      llvm-svn: 161441
      84689b0d
  23. Jul 05, 2012
    • Chandler Carruth's avatar
      Finish fixing the MachineOperand hashing, providing a nice modern · 264854f9
      Chandler Carruth authored
      hash_value overload for MachineOperands. This addresses a FIXME
      sufficient for me to remove it, and cleans up the code nicely too.
      
      The important changes to the hashing logic:
      - TargetFlags are now included in all of the hashes. These were complete
        missed.
      - Register operands have their subregisters and whether they are a def
        included in the hash.
      - We now actually hash all of the operand types. Previously, many
        operand types were simply *dropped on the floor*. For example:
        - Floating point immediates
        - Large integer immediates (>64-bit)
        - External globals!
        - Register masks
        - Metadata operands
      - It removes the offset from the block-address hash; I'm a bit
        suspicious of this, but isIdenticalTo doesn't consider the offset for
        black addresses.
      
      Any patterns involving these entities could have triggered extreme
      slowdowns in MachineCSE or PHIElimination. Let me know if there are PRs
      you think might be closed now... I'm looking myself, but I may miss
      them.
      
      llvm-svn: 159743
      264854f9
Loading