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
- // ===----------------------------------------------------------------------===//
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
9
10
10
#ifndef KLEE_INSTRUCTIONINFOTABLE_H
11
11
#define KLEE_INSTRUCTIONINFOTABLE_H
@@ -31,82 +31,81 @@ class Module;
31
31
32
32
namespace klee {
33
33
34
- // / @brief InstructionInfo stores debug information for a KInstruction.
35
- struct InstructionInfo {
36
- // / @brief The instruction id.
37
- unsigned id;
38
- // / @brief Line number in source file.
39
- unsigned line;
40
- // / @brief Column number in source file.
41
- unsigned column;
42
- // / @brief Line number in generated assembly.ll.
43
- llvm::Optional<uint64_t > assemblyLine;
44
- // / @brief Source file name.
45
- const std::string &file;
46
-
47
- public:
48
- InstructionInfo (unsigned id, const std::string &file, unsigned line,
49
- unsigned column, llvm::Optional<uint64_t > assemblyLine)
50
- : id{id}, line{line}, column{column},
51
- assemblyLine{assemblyLine}, file{file} {}
52
- };
53
-
54
- // / @brief FunctionInfo stores debug information for a KFunction.
55
- struct FunctionInfo {
56
- // / @brief The function id.
57
- unsigned id;
58
- // / @brief Line number in source file.
59
- unsigned line;
60
- // / @brief Line number in generated assembly.ll.
61
- llvm::Optional<uint64_t > assemblyLine;
62
- // / @brief Source file name.
63
- const std::string &file;
64
-
65
- public:
66
- FunctionInfo (unsigned id, const std::string &file, unsigned line,
67
- llvm::Optional<uint64_t > assemblyLine)
68
- : id{id}, line{line}, assemblyLine{assemblyLine}, file{file} {}
69
-
70
- FunctionInfo (const FunctionInfo &) = delete ;
71
- FunctionInfo &operator =(FunctionInfo const &) = delete ;
72
-
73
- FunctionInfo (FunctionInfo &&) = default ;
34
+ // // TODO move to methods of kInstruction
35
+ // /// @brief InstructionInfo stores debug information for a KInstruction.
36
+ // struct InstructionInfo {
37
+ // /// @brief The instruction id.
38
+ // // unsigned id; // TODO move to kInstruction
39
+ // /// @brief Line number in source file.
40
+ // // unsigned line;
41
+ // /// @brief Column number in source file.
42
+ // // unsigned column;
43
+ // /// @brief Line number in generated assembly.ll.
44
+ // // llvm::Optional<uint64_t> assemblyLine;
45
+ // /// @brief Source file name.
46
+ // // const std::string &file;
47
+ //
48
+ // public:
49
+ // InstructionInfo(unsigned id) {}
50
+ // };
51
+ //
52
+ // /// @brief FunctionInfo stores debug information for a KFunction.
53
+ // struct FunctionInfo { // TODO clear this too
54
+ // /// @brief The function id.
55
+ // // unsigned id; // TODO move to kFunction
56
+ // /// @brief Line number in source file.
57
+ // // unsigned line;
58
+ // /// @brief Line number in generated assembly.ll.
59
+ // // llvm::Optional<uint64_t> assemblyLine;
60
+ // /// @brief Source file name.
61
+ // // const std::string &file;
62
+ //
63
+ // public:
64
+ // FunctionInfo(unsigned id) {}
65
+ //
66
+ // FunctionInfo(const FunctionInfo &) = delete;
67
+ // FunctionInfo &operator=(FunctionInfo const &) = delete;
68
+ //
69
+ // FunctionInfo(FunctionInfo &&) = default;
70
+ // };
71
+ //
72
+ // class InstructionInfoTable {
73
+ // public:
74
+ // using LocationToFunctionsMap =
75
+ // std::unordered_map<std::string,
76
+ // std::unordered_set<const llvm::Function *>>;
77
+ //
78
+ // private:
79
+ // std::unordered_map<const llvm::Instruction *,
80
+ // std::unique_ptr<InstructionInfo>> infos;
81
+ // std::unordered_map<const llvm::Function *, std::unique_ptr<FunctionInfo>>
82
+ // functionInfos;
83
+ // LocationToFunctionsMap fileNameToFunctions; // TODO remove
84
+ // // Instructions insts; // TODO remove when move prepare target to main
85
+ //
86
+ // public:
87
+ // explicit InstructionInfoTable(
88
+ // const llvm::Module &m);
89
+ //
90
+ // // unsigned getMaxID() const;
91
+ // const InstructionInfo &getInfo(const llvm::Instruction &) const;
92
+ // const FunctionInfo &getFunctionInfo(const llvm::Function &) const;
93
+ // const LocationToFunctionsMap &getFileNameToFunctions() const;
94
+ // // Instructions getInstructions();
95
+ // };
96
+
97
+ struct LocationInfo {
98
+ std::string file;
99
+ size_t line;
100
+ size_t column;
74
101
};
75
102
76
- class InstructionInfoTable {
77
- public:
78
- using Instructions = std::unordered_map<
79
- std::string,
80
- std::unordered_map<
81
- unsigned int ,
82
- std::unordered_map<unsigned int , std::unordered_set<unsigned int >>>>;
83
- using LocationToFunctionsMap =
84
- std::unordered_map<std::string,
85
- std::unordered_set<const llvm::Function *>>;
86
103
87
- private:
88
- std::unordered_map<const llvm::Instruction *,
89
- std::unique_ptr<InstructionInfo>>
90
- infos;
91
- std::unordered_map<const llvm::Function *, std::unique_ptr<FunctionInfo>>
92
- functionInfos;
93
- LocationToFunctionsMap fileNameToFunctions;
94
- std::vector<std::unique_ptr<std::string>> internedStrings;
95
- std::unordered_set<std::string> filesNames;
96
- Instructions insts;
104
+ // TODO need unify with kFunction
105
+ LocationInfo getLocationInfo (const llvm::Function *func);
97
106
98
- public:
99
- explicit InstructionInfoTable (
100
- const llvm::Module &m, std::unique_ptr<llvm::raw_fd_ostream> assemblyFS,
101
- bool withInstructions = false );
102
-
103
- unsigned getMaxID () const ;
104
- const InstructionInfo &getInfo (const llvm::Instruction &) const ;
105
- const FunctionInfo &getFunctionInfo (const llvm::Function &) const ;
106
- const LocationToFunctionsMap &getFileNameToFunctions () const ;
107
- const std::unordered_set<std::string> &getFilesNames () const ;
108
- Instructions getInstructions ();
109
- };
107
+ // TODO need unify with kInstruction
108
+ LocationInfo getLocationInfo (const llvm::Instruction *inst);
110
109
111
110
} // namespace klee
112
111
0 commit comments