LLVM  3.7.0
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"
15 
16 namespace llvm {
17 
18 class MachineFunction;
19 class MachineInstr;
20 class DILocalVariable;
21 class DILocation;
22 class TargetRegisterInfo;
23 
24 // For each user variable, keep a list of instruction ranges where this variable
25 // is accessible. The variables are listed in order of appearance.
27  // Each instruction range starts with a DBG_VALUE instruction, specifying the
28  // location of a variable, which is assumed to be valid until the end of the
29  // range. If end is not specified, location is valid until the start
30  // instruction of the next instruction range, or until the end of the
31  // function.
32 public:
33  typedef std::pair<const MachineInstr *, const MachineInstr *> InstrRange;
35  typedef std::pair<const DILocalVariable *, const DILocation *>
38 
39 private:
40  InstrRangesMap VarInstrRanges;
41 
42 public:
44  void endInstrRange(InlinedVariable Var, const MachineInstr &MI);
45  // Returns register currently describing @Var. If @Var is currently
46  // unaccessible or is not described by a register, returns 0.
47  unsigned getRegisterForVar(InlinedVariable Var) const;
48 
49  bool empty() const { return VarInstrRanges.empty(); }
50  void clear() { VarInstrRanges.clear(); }
51  InstrRangesMap::const_iterator begin() const { return VarInstrRanges.begin(); }
52  InstrRangesMap::const_iterator end() const { return VarInstrRanges.end(); }
53 };
54 
55 void calculateDbgValueHistory(const MachineFunction *MF,
56  const TargetRegisterInfo *TRI,
57  DbgValueHistoryMap &Result);
58 }
59 
60 #endif
void calculateDbgValueHistory(const MachineFunction *MF, const TargetRegisterInfo *TRI, DbgValueHistoryMap &Result)
void clear()
Definition: MapVector.h:65
InstrRangesMap::const_iterator end() const
std::pair< const MachineInstr *, const MachineInstr * > InstrRange
bool empty() const
Definition: MapVector.h:56
SmallVector< InstrRange, 4 > InstrRanges
void startInstrRange(InlinedVariable Var, const MachineInstr &MI)
std::vector< std::pair< InlinedVariable, InstrRanges > >::const_iterator const_iterator
Definition: MapVector.h:40
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:861
InstrRangesMap::const_iterator begin() const
Representation of each machine instruction.
Definition: MachineInstr.h:51
MapVector< InlinedVariable, InstrRanges > InstrRangesMap
void endInstrRange(InlinedVariable Var, const MachineInstr &MI)
iterator begin()
Definition: MapVector.h:46
iterator end()
Definition: MapVector.h:48
unsigned getRegisterForVar(InlinedVariable Var) const
std::pair< const DILocalVariable *, const DILocation * > InlinedVariable