diff options
| author | Owen Anderson <resistor@mac.com> | 2009-06-09 19:30:45 +0000 |
|---|---|---|
| committer | Owen Anderson <resistor@mac.com> | 2009-06-09 19:30:45 +0000 |
| commit | f6df30852b59e828b2f6b0a0f3422110d6ca8a58 (patch) | |
| tree | 66bd3d3cf9a698de578a49844f43bd069e189cfc /llvm/include | |
| parent | cb61314f0f9889c624338d5ab17a56594b3ec002 (diff) | |
| download | bcm5719-llvm-f6df30852b59e828b2f6b0a0f3422110d6ca8a58.tar.gz bcm5719-llvm-f6df30852b59e828b2f6b0a0f3422110d6ca8a58.zip | |
Add the beginnings of an implementatation of lazy liveness analysis, based on "Fast Liveness Checking for SSA-form Programs" by Boissinot, et al.
This is still very early, hasn't been tested, and is not yet well documented. More to come soon.
llvm-svn: 73141
Diffstat (limited to 'llvm/include')
| -rw-r--r-- | llvm/include/llvm/CodeGen/LazyLiveness.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/llvm/include/llvm/CodeGen/LazyLiveness.h b/llvm/include/llvm/CodeGen/LazyLiveness.h new file mode 100644 index 00000000000..702ba142c5d --- /dev/null +++ b/llvm/include/llvm/CodeGen/LazyLiveness.h @@ -0,0 +1,62 @@ +//===- LazyLiveness.h - Lazy, CFG-invariant liveness information ----------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This pass implements a lazy liveness analysis as per "Fast Liveness Checking +// for SSA-form Programs," by Boissinot, et al. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CODEGEN_LAZYLIVENESS_H +#define LLVM_CODEGEN_LAZYLIVENESS_H + +#include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/CodeGen/MachineDominators.h" +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/DenseSet.h" +#include "llvm/ADT/SparseBitVector.h" +#include <vector> + +namespace llvm { + +class MachineRegisterInfo; + +class LazyLiveness : public MachineFunctionPass { +public: + static char ID; // Pass identification, replacement for typeid + LazyLiveness() : MachineFunctionPass(&ID) { } + + void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + AU.addRequired<MachineDominatorTree>(); + } + + bool runOnMachineFunction(MachineFunction &mf); + + bool vregLiveIntoMBB(unsigned vreg, MachineBasicBlock* MBB); + +private: + void computeBackedgeChain(MachineFunction& mf, MachineBasicBlock* MBB); + + typedef std::pair<MachineBasicBlock*, MachineBasicBlock*> edge_t; + + MachineRegisterInfo* MRI; + + DenseMap<MachineBasicBlock*, unsigned> preorder; + std::vector<MachineBasicBlock*> rev_preorder; + DenseMap<MachineBasicBlock*, SparseBitVector<128> > rv; + DenseMap<MachineBasicBlock*, SparseBitVector<128> > tv; + DenseSet<edge_t> backedges; + SparseBitVector<128> backedge_source; + SparseBitVector<128> backedge_target; + SparseBitVector<128> calculated; +}; + +} + +#endif
\ No newline at end of file |

