]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - opencl/llvm.git/blob - lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.h
Rename DIExpressionIterator to DIExpression::iterator.
[opencl/llvm.git] / lib / CodeGen / AsmPrinter / DbgValueHistoryCalculator.h
1 //===-- llvm/CodeGen/AsmPrinter/DbgValueHistoryCalculator.h ----*- C++ -*--===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DBGVALUEHISTORYCALCULATOR_H
11 #define LLVM_LIB_CODEGEN_ASMPRINTER_DBGVALUEHISTORYCALCULATOR_H
13 #include "llvm/ADT/MapVector.h"
14 #include "llvm/ADT/SmallVector.h"
16 namespace llvm {
18 class MachineFunction;
19 class MachineInstr;
20 class MDNode;
21 class TargetRegisterInfo;
23 // For each user variable, keep a list of instruction ranges where this variable
24 // is accessible. The variables are listed in order of appearance.
25 class DbgValueHistoryMap {
26   // Each instruction range starts with a DBG_VALUE instruction, specifying the
27   // location of a variable, which is assumed to be valid until the end of the
28   // range. If end is not specified, location is valid until the start
29   // instruction of the next instruction range, or until the end of the
30   // function.
31 public:
32   typedef std::pair<const MachineInstr *, const MachineInstr *> InstrRange;
33   typedef SmallVector<InstrRange, 4> InstrRanges;
34   typedef MapVector<const MDNode *, InstrRanges> InstrRangesMap;
35 private:
36   InstrRangesMap VarInstrRanges;
38 public:
39   void startInstrRange(const MDNode *Var, const MachineInstr &MI);
40   void endInstrRange(const MDNode *Var, const MachineInstr &MI);
41   // Returns register currently describing @Var. If @Var is currently
42   // unaccessible or is not described by a register, returns 0.
43   unsigned getRegisterForVar(const MDNode *Var) const;
45   bool empty() const { return VarInstrRanges.empty(); }
46   void clear() { VarInstrRanges.clear(); }
47   InstrRangesMap::const_iterator begin() const { return VarInstrRanges.begin(); }
48   InstrRangesMap::const_iterator end() const { return VarInstrRanges.end(); }
49 };
51 void calculateDbgValueHistory(const MachineFunction *MF,
52                               const TargetRegisterInfo *TRI,
53                               DbgValueHistoryMap &Result);
54 }
56 #endif