klee
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
InstructionInfoTable.h
Go to the documentation of this file.
1 //===-- InstructionInfoTable.h ----------------------------------*- C++ -*-===//
2 //
3 // The KLEE Symbolic Virtual Machine
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 KLEE_LIB_INSTRUCTIONINFOTABLE_H
11 #define KLEE_LIB_INSTRUCTIONINFOTABLE_H
12 
13 #include <map>
14 #include <string>
15 #include <set>
16 
17 namespace llvm {
18  class Function;
19  class Instruction;
20  class Module;
21 }
22 
23 namespace klee {
24 
25  /* Stores debug information for a KInstruction */
26  struct InstructionInfo {
27  unsigned id;
28  const std::string &file;
29  unsigned line;
30  unsigned assemblyLine;
31 
32  public:
33  InstructionInfo(unsigned _id,
34  const std::string &_file,
35  unsigned _line,
36  unsigned _assemblyLine)
37  : id(_id),
38  file(_file),
39  line(_line),
40  assemblyLine(_assemblyLine) {
41  }
42  };
43 
45  struct ltstr {
46  bool operator()(const std::string *a, const std::string *b) const {
47  return *a<*b;
48  }
49  };
50 
51  std::string dummyString;
53  std::map<const llvm::Instruction*, InstructionInfo> infos;
54  std::set<const std::string *, ltstr> internedStrings;
55 
56  private:
57  const std::string *internString(std::string s);
58  bool getInstructionDebugInfo(const llvm::Instruction *I,
59  const std::string *&File, unsigned &Line);
60 
61  public:
62  InstructionInfoTable(llvm::Module *m);
64 
65  unsigned getMaxID() const;
66  const InstructionInfo &getInfo(const llvm::Instruction*) const;
67  const InstructionInfo &getFunctionInfo(const llvm::Function*) const;
68  };
69 
70 }
71 
72 #endif
const std::string * internString(std::string s)
const InstructionInfo & getFunctionInfo(const llvm::Function *) const
bool getInstructionDebugInfo(const llvm::Instruction *I, const std::string *&File, unsigned &Line)
InstructionInfo(unsigned _id, const std::string &_file, unsigned _line, unsigned _assemblyLine)
std::set< const std::string *, ltstr > internedStrings
const InstructionInfo & getInfo(const llvm::Instruction *) const
bool operator()(const std::string *a, const std::string *b) const
const std::string & file
std::map< const llvm::Instruction *, InstructionInfo > infos