Skip to content
  1. Mar 29, 2013
  2. Mar 25, 2013
  3. Jan 11, 2013
  4. Jan 07, 2013
    • Chandler Carruth's avatar
      Switch TargetTransformInfo from an immutable analysis pass that requires · 664e354d
      Chandler Carruth authored
      a TargetMachine to construct (and thus isn't always available), to an
      analysis group that supports layered implementations much like
      AliasAnalysis does. This is a pretty massive change, with a few parts
      that I was unable to easily separate (sorry), so I'll walk through it.
      
      The first step of this conversion was to make TargetTransformInfo an
      analysis group, and to sink the nonce implementations in
      ScalarTargetTransformInfo and VectorTargetTranformInfo into
      a NoTargetTransformInfo pass. This allows other passes to add a hard
      requirement on TTI, and assume they will always get at least on
      implementation.
      
      The TargetTransformInfo analysis group leverages the delegation chaining
      trick that AliasAnalysis uses, where the base class for the analysis
      group delegates to the previous analysis *pass*, allowing all but tho
      NoFoo analysis passes to only implement the parts of the interfaces they
      support. It also introduces a new trick where each pass in the group
      retains a pointer to the top-most pass that has been initialized. This
      allows passes to implement one API in terms of another API and benefit
      when some other pass above them in the stack has more precise results
      for the second API.
      
      The second step of this conversion is to create a pass that implements
      the TargetTransformInfo analysis using the target-independent
      abstractions in the code generator. This replaces the
      ScalarTargetTransformImpl and VectorTargetTransformImpl classes in
      lib/Target with a single pass in lib/CodeGen called
      BasicTargetTransformInfo. This class actually provides most of the TTI
      functionality, basing it upon the TargetLowering abstraction and other
      information in the target independent code generator.
      
      The third step of the conversion adds support to all TargetMachines to
      register custom analysis passes. This allows building those passes with
      access to TargetLowering or other target-specific classes, and it also
      allows each target to customize the set of analysis passes desired in
      the pass manager. The baseline LLVMTargetMachine implements this
      interface to add the BasicTTI pass to the pass manager, and all of the
      tools that want to support target-aware TTI passes call this routine on
      whatever target machine they end up with to add the appropriate passes.
      
      The fourth step of the conversion created target-specific TTI analysis
      passes for the X86 and ARM backends. These passes contain the custom
      logic that was previously in their extensions of the
      ScalarTargetTransformInfo and VectorTargetTransformInfo interfaces.
      I separated them into their own file, as now all of the interface bits
      are private and they just expose a function to create the pass itself.
      Then I extended these target machines to set up a custom set of analysis
      passes, first adding BasicTTI as a fallback, and then adding their
      customized TTI implementations.
      
      The fourth step required logic that was shared between the target
      independent layer and the specific targets to move to a different
      interface, as they no longer derive from each other. As a consequence,
      a helper functions were added to TargetLowering representing the common
      logic needed both in the target implementation and the codegen
      implementation of the TTI pass. While technically this is the only
      change that could have been committed separately, it would have been
      a nightmare to extract.
      
      The final step of the conversion was just to delete all the old
      boilerplate. This got rid of the ScalarTargetTransformInfo and
      VectorTargetTransformInfo classes, all of the support in all of the
      targets for producing instances of them, and all of the support in the
      tools for manually constructing a pass based around them.
      
      Now that TTI is a relatively normal analysis group, two things become
      straightforward. First, we can sink it into lib/Analysis which is a more
      natural layer for it to live. Second, clients of this interface can
      depend on it *always* being available which will simplify their code and
      behavior. These (and other) simplifications will follow in subsequent
      commits, this one is clearly big enough.
      
      Finally, I'm very aware that much of the comments and documentation
      needs to be updated. As soon as I had this working, and plausibly well
      commented, I wanted to get it committed and in front of the build bots.
      I'll be doing a few passes over documentation later if it sticks.
      
      Commits to update DragonEgg and Clang will be made presently.
      
      llvm-svn: 171681
      664e354d
  5. Nov 28, 2012
    • Jakob Stoklund Olesen's avatar
      Move the guts of TargetInstrInfoImpl into the TargetInstrInfo class. · c351aed4
      Jakob Stoklund Olesen authored
      The *Impl class no longer serves a purpose now that the super-class
      implementation is in CodeGen.
      
      llvm-svn: 168759
      c351aed4
    • Jakob Stoklund Olesen's avatar
      Move Target{Instr,Register}Info.cpp into lib/CodeGen. · fcf14e84
      Jakob Stoklund Olesen authored
      The Target library is not allowed to depend on the large CodeGen
      library, but the TRI and TII classes provide abstract interfaces that
      require both caller and callee to link to CodeGen.
      
      The implementation files for these classes provide default
      implementations of some of the hooks. These methods may need to
      reference CodeGen, so they belong in that library.
      
      We already have a number of methods implemented in the
      TargetInstrInfoImpl sub-class because of that. I will merge that class
      into the parent next.
      
      llvm-svn: 168758
      fcf14e84
  6. Nov 27, 2012
  7. Sep 17, 2012
  8. Sep 14, 2012
  9. Sep 06, 2012
  10. Jul 26, 2012
    • Jakob Stoklund Olesen's avatar
      Start scaffolding for a MachineTraceMetrics analysis pass. · f9029fef
      Jakob Stoklund Olesen authored
      This is still a work in progress.
      
      Out-of-order CPUs usually execute instructions from multiple basic
      blocks simultaneously, so it is necessary to look at longer traces when
      estimating the performance effects of code transformations.
      
      The MachineTraceMetrics analysis will pick a typical trace through a
      given basic block and provide performance metrics for the trace. Metrics
      will include:
      
      - Instruction count through the trace.
      - Issue count per functional unit.
      - Critical path length, and per-instruction 'slack'.
      
      These metrics can be used to determine the performance limiting factor
      when executing the trace, and how it will be affected by a code
      transformation.
      
      Initially, this will be used by the early if-conversion pass.
      
      llvm-svn: 160796
      f9029fef
  11. Jul 04, 2012
    • Jakob Stoklund Olesen's avatar
      Add an experimental early if-conversion pass, off by default. · f8a63a15
      Jakob Stoklund Olesen authored
      This pass performs if-conversion on SSA form machine code by
      speculatively executing both sides of the branch and using a cmov
      instruction to select the result. This can help lower the number of
      branch mispredictions on architectures like x86 that don't have
      predicable instructions.
      
      The current implementation is very aggressive, and causes regressions on
      mosts tests. It needs good heuristics that have yet to be implemented.
      
      llvm-svn: 159694
      f8a63a15
  12. Jun 24, 2012
  13. Jun 21, 2012
  14. Jun 09, 2012
    • Jakob Stoklund Olesen's avatar
      Sketch a LiveRegMatrix analysis pass. · c26fbbfb
      Jakob Stoklund Olesen authored
      The LiveRegMatrix represents the live range of assigned virtual
      registers in a Live interval union per register unit. This is not
      fundamentally different from the interference tracking in RegAllocBase
      that both RABasic and RAGreedy use.
      
      The important differences are:
      
      - LiveRegMatrix tracks interference per register unit instead of per
        physical register. This makes interference checks cheaper and
        assignments slightly more expensive. For example, the ARM D7 reigster
        has 24 aliases, so we would check 24 physregs before assigning to one.
        With unit-based interference, we check 2 units before assigning to 2
        units.
      
      - LiveRegMatrix caches regmask interference checks. That is currently
        duplicated functionality in RABasic and RAGreedy.
      
      - LiveRegMatrix is a pass which makes it possible to insert
        target-dependent passes between register allocation and rewriting.
        Such passes could tweak the register assignments with interference
        checking support from LiveRegMatrix.
      
      Eventually, RABasic and RAGreedy will be switched to LiveRegMatrix.
      
      llvm-svn: 158255
      c26fbbfb
  15. Apr 24, 2012
  16. Mar 07, 2012
  17. Jan 13, 2012
  18. Jan 11, 2012
  19. Jan 07, 2012
    • Evan Cheng's avatar
      Added a late machine instruction copy propagation pass. This catches · 00b1a3cd
      Evan Cheng authored
      opportunities that only present themselves after late optimizations
      such as tail duplication .e.g.
      ## BB#1:
              movl    %eax, %ecx
              movl    %ecx, %eax
              ret
      
      The register allocator also leaves some of them around (due to false
      dep between copies from phi-elimination, etc.)
      
      This required some changes in codegen passes. Post-ra scheduler and the
      pseudo-instruction expansion passes have been moved after branch folding
      and tail merging. They were before branch folding before because it did
      not always update block livein's. That's fixed now. The pass change makes
      independently since we want to properly schedule instructions after
      branch folding / tail duplication.
      
      rdar://10428165
      rdar://10640363
      
      llvm-svn: 147716
      00b1a3cd
  20. Jan 05, 2012
  21. Dec 20, 2011
  22. Dec 15, 2011
  23. Dec 14, 2011
  24. Dec 06, 2011
  25. Dec 01, 2011
  26. Nov 29, 2011
  27. Nov 13, 2011
  28. Nov 12, 2011
  29. Oct 21, 2011
    • Chandler Carruth's avatar
      Implement a block placement pass based on the branch probability and · 10281425
      Chandler Carruth authored
      block frequency analyses. This differs substantially from the existing
      block-placement pass in LLVM:
      
      1) It operates on the Machine-IR in the CodeGen layer. This exposes much
         more (and more precise) information and opportunities. Also, the
         results are more stable due to fewer transforms ocurring after the
         pass runs.
      2) It uses the generalized probability and frequency analyses. These can
         model static heuristics, code annotation derived heuristics as well
         as eventual profile loading. By basing the optimization on the
         analysis interface it can work from any (or a combination) of these
         inputs.
      3) It uses a more aggressive algorithm, both building chains from tho
         bottom up to maximize benefit, and using an SCC-based walk to layout
         chains of blocks in a profitable ordering without O(N^2) iterations
         which the old pass involves.
      
      The pass is currently gated behind a flag, and not enabled by default
      because it still needs to grow some important features. Most notably, it
      needs to support loop aligning and careful layout of loop structures
      much as done by hand currently in CodePlacementOpt. Once it supports
      these, and has sufficient testing and quality tuning, it should replace
      both of these passes.
      
      Thanks to Nick Lewycky and Richard Smith for help authoring & debugging
      this, and to Jakob, Andy, Eric, Jim, and probably a few others I'm
      forgetting for reviewing and answering all my questions. Writing
      a backend pass is *sooo* much better now than it used to be. =D
      
      llvm-svn: 142641
      10281425
  30. Sep 28, 2011
  31. Sep 25, 2011
    • Jakob Stoklund Olesen's avatar
      Rename LowerSubregs to ExpandPostRAPseudos. · f152df1e
      Jakob Stoklund Olesen authored
      I'll fix the file contents in the next commit.
      
      This pass is currently expanding the COPY and SUBREG_TO_REG pseudos. I
      am going to add a hook so targets can expand more pseudo-instructions
      after register allocation.
      
      Many targets have pseudo-instructions that assist the register
      allocator.  They can be expanded after register allocation, before PEI
      and PostRA scheduling.
      
      llvm-svn: 140469
      f152df1e
  32. Sep 13, 2011
  33. Aug 10, 2011
  34. Jul 29, 2011
    • Chandler Carruth's avatar
      Rewrite the CMake build to use explicit dependencies between libraries, · 9d7feab3
      Chandler Carruth authored
      specified in the same file that the library itself is created. This is
      more idiomatic for CMake builds, and also allows us to correctly specify
      dependencies that are missed due to bugs in the GenLibDeps perl script,
      or change from compiler to compiler. On Linux, this returns CMake to
      a place where it can relably rebuild several targets of LLVM.
      
      I have tried not to change the dependencies from the ones in the current
      auto-generated file. The only places I've really diverged are in places
      where I was seeing link failures, and added a dependency. The goal of
      this patch is not to start changing the dependencies, merely to move
      them into the correct location, and an explicit form that we can control
      and change when necessary.
      
      This also removes a serialization point in the build because we don't
      have to scan all the libraries before we begin building various tools.
      We no longer have a step of the build that regenerates a file inside the
      source tree. A few other associated cleanups fall out of this.
      
      This isn't really finished yet though. After talking to dgregor he urged
      switching to a single CMake macro to construct libraries with both
      sources and dependencies in the arguments. Migrating from the two macros
      to that style will be a follow-up patch.
      
      Also, llvm-config is still generated with GenLibDeps.pl, which means it
      still has slightly buggy dependencies. The internal CMake
      'llvm-config-like' macro uses the correct explicitly specified
      dependencies however. A future patch will switch llvm-config generation
      (when using CMake) to be based on these deps as well.
      
      This may well break Windows. I'm getting a machine set up now to dig
      into any failures there. If anyone can chime in with problems they see
      or ideas of how to solve them for Windows, much appreciated.
      
      llvm-svn: 136433
      9d7feab3
  35. Jul 25, 2011
  36. Jul 16, 2011
  37. Jun 28, 2011
  38. Jun 27, 2011
Loading