LLVM  6.0.0svn
DbgValueHistoryCalculator.h
Go to the documentation of this file.
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 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DBGVALUEHISTORYCALCULATOR_H
11 #define LLVM_LIB_CODEGEN_ASMPRINTER_DBGVALUEHISTORYCALCULATOR_H
12 
13 #include "llvm/ADT/MapVector.h"
14 #include "llvm/ADT/SmallVector.h"
16 #include <utility>
17 
18 namespace llvm {
19 
20 class DILocalVariable;
21 class MachineFunction;
22 class MachineInstr;
23 class TargetRegisterInfo;
24 
25 // For each user variable, keep a list of instruction ranges where this variable
26 // is accessible. The variables are listed in order of appearance.
28  // Each instruction range starts with a DBG_VALUE instruction, specifying the
29  // location of a variable, which is assumed to be valid until the end of the
30  // range. If end is not specified, location is valid until the start
31  // instruction of the next instruction range, or until the end of the
32  // function.
33 public:
34  using InstrRange = std::pair<const MachineInstr *, const MachineInstr *>;
36  using InlinedVariable =
37  std::pair<const DILocalVariable *, const DILocation *>;
39 
40 private:
41  InstrRangesMap VarInstrRanges;
42 
43 public:
45  void endInstrRange(InlinedVariable Var, const MachineInstr &MI);
46 
47  // Returns register currently describing @Var. If @Var is currently
48  // unaccessible or is not described by a register, returns 0.
49  unsigned getRegisterForVar(InlinedVariable Var) const;
50 
51  bool empty() const { return VarInstrRanges.empty(); }
52  void clear() { VarInstrRanges.clear(); }
53  InstrRangesMap::const_iterator begin() const { return VarInstrRanges.begin(); }
54  InstrRangesMap::const_iterator end() const { return VarInstrRanges.end(); }
55 };
56 
58  const TargetRegisterInfo *TRI,
59  DbgValueHistoryMap &Result);
60 
61 } // end namespace llvm
62 
63 #endif // LLVM_LIB_CODEGEN_ASMPRINTER_DBGVALUEHISTORYCALCULATOR_H
void calculateDbgValueHistory(const MachineFunction *MF, const TargetRegisterInfo *TRI, DbgValueHistoryMap &Result)
void clear()
Definition: MapVector.h:85
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
std::pair< const DILocalVariable *, const DILocation * > InlinedVariable
bool empty() const
Definition: MapVector.h:76
InstrRangesMap::const_iterator begin() const
void startInstrRange(InlinedVariable Var, const MachineInstr &MI)
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
InstrRangesMap::const_iterator end() const
This is a &#39;vector&#39; (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:864
typename std::vector< std::pair< InlinedVariable, InstrRanges >> ::const_iterator const_iterator
Definition: MapVector.h:47
Representation of each machine instruction.
Definition: MachineInstr.h:59
std::pair< const MachineInstr *, const MachineInstr * > InstrRange
void endInstrRange(InlinedVariable Var, const MachineInstr &MI)
iterator begin()
Definition: MapVector.h:66
iterator end()
Definition: MapVector.h:68
IRTranslator LLVM IR MI
unsigned getRegisterForVar(InlinedVariable Var) const