Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. //===- LiveIntervalCalc.h - Calculate live intervals -----------*- C++ -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // The LiveIntervalCalc class is an extension of LiveRangeCalc targeted to the
  10. // computation and modification of the LiveInterval variants of LiveRanges.
  11. // LiveIntervals are meant to track liveness of registers and stack slots and
  12. // LiveIntervalCalc adds to LiveRangeCalc all the machinery required to
  13. // construct the liveness of virtual registers tracked by a LiveInterval.
  14. //
  15. //===----------------------------------------------------------------------===//
  16.  
  17. #ifndef LLVM_CODEGEN_LIVEINTERVALCALC_H
  18. #define LLVM_CODEGEN_LIVEINTERVALCALC_H
  19.  
  20. #include "llvm/CodeGen/LiveRangeCalc.h"
  21.  
  22. namespace llvm {
  23.  
  24. template <class NodeT> class DomTreeNodeBase;
  25.  
  26. using MachineDomTreeNode = DomTreeNodeBase<MachineBasicBlock>;
  27.  
  28. class LiveIntervalCalc : public LiveRangeCalc {
  29.   /// Extend the live range of @p LR to reach all uses of Reg.
  30.   ///
  31.   /// If @p LR is a main range, or if @p LI is null, then all uses must be
  32.   /// jointly dominated by the definitions from @p LR. If @p LR is a subrange
  33.   /// of the live interval @p LI, corresponding to lane mask @p LaneMask,
  34.   /// all uses must be jointly dominated by the definitions from @p LR
  35.   /// together with definitions of other lanes where @p LR becomes undefined
  36.   /// (via <def,read-undef> operands).
  37.   /// If @p LR is a main range, the @p LaneMask should be set to ~0, i.e.
  38.   /// LaneBitmask::getAll().
  39.   void extendToUses(LiveRange &LR, Register Reg, LaneBitmask LaneMask,
  40.                     LiveInterval *LI = nullptr);
  41.  
  42. public:
  43.   LiveIntervalCalc() = default;
  44.  
  45.   /// createDeadDefs - Create a dead def in LI for every def operand of Reg.
  46.   /// Each instruction defining Reg gets a new VNInfo with a corresponding
  47.   /// minimal live range.
  48.   void createDeadDefs(LiveRange &LR, Register Reg);
  49.  
  50.   /// Extend the live range of @p LR to reach all uses of Reg.
  51.   ///
  52.   /// All uses must be jointly dominated by existing liveness.  PHI-defs are
  53.   /// inserted as needed to preserve SSA form.
  54.   void extendToUses(LiveRange &LR, MCRegister PhysReg) {
  55.     extendToUses(LR, PhysReg, LaneBitmask::getAll());
  56.   }
  57.  
  58.   /// Calculates liveness for the register specified in live interval @p LI.
  59.   /// Creates subregister live ranges as needed if subreg liveness tracking is
  60.   /// enabled.
  61.   void calculate(LiveInterval &LI, bool TrackSubRegs);
  62.  
  63.   /// For live interval \p LI with correct SubRanges construct matching
  64.   /// information for the main live range. Expects the main live range to not
  65.   /// have any segments or value numbers.
  66.   void constructMainRangeFromSubranges(LiveInterval &LI);
  67. };
  68.  
  69. } // end namespace llvm
  70.  
  71. #endif // LLVM_CODEGEN_LIVEINTERVALCALC_H
  72.