1 //===- LazyLiveness.h - Lazy, CFG-invariant liveness information ----------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This pass implements a lazy liveness analysis as per "Fast Liveness Checking
11 // for SSA-form Programs," by Boissinot, et al.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CODEGEN_LAZYLIVENESS_H
16 #define LLVM_CODEGEN_LAZYLIVENESS_H
18 #include "llvm/CodeGen/MachineFunctionPass.h"
19 #include "llvm/CodeGen/MachineDominators.h"
20 #include "llvm/ADT/DenseMap.h"
21 #include "llvm/ADT/DenseSet.h"
22 #include "llvm/ADT/SparseBitVector.h"
27 class MachineRegisterInfo;
29 class LazyLiveness : public MachineFunctionPass {
31 static char ID; // Pass identification, replacement for typeid
32 LazyLiveness() : MachineFunctionPass(&ID) { }
34 void getAnalysisUsage(AnalysisUsage &AU) const {
36 AU.addRequired<MachineDominatorTree>();
39 bool runOnMachineFunction(MachineFunction &mf);
41 bool vregLiveIntoMBB(unsigned vreg, MachineBasicBlock* MBB);
44 void computeBackedgeChain(MachineFunction& mf, MachineBasicBlock* MBB);
46 typedef std::pair<MachineBasicBlock*, MachineBasicBlock*> edge_t;
48 MachineRegisterInfo* MRI;
50 DenseMap<MachineBasicBlock*, unsigned> preorder;
51 std::vector<MachineBasicBlock*> rev_preorder;
52 DenseMap<MachineBasicBlock*, SparseBitVector<128> > rv;
53 DenseMap<MachineBasicBlock*, SparseBitVector<128> > tv;
54 DenseSet<edge_t> backedges;
55 SparseBitVector<128> backedge_source;
56 SparseBitVector<128> backedge_target;
57 SparseBitVector<128> calculated;