InstructionInfoTable.h

Go to the documentation of this file.
00001 //===-- InstructionInfoTable.h ----------------------------------*- C++ -*-===//
00002 //
00003 //                     The KLEE Symbolic Virtual Machine
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #ifndef KLEE_LIB_INSTRUCTIONINFOTABLE_H
00011 #define KLEE_LIB_INSTRUCTIONINFOTABLE_H
00012 
00013 #include <map>
00014 #include <string>
00015 #include <set>
00016 
00017 namespace llvm {
00018   class Function;
00019   class Instruction;
00020   class Module; 
00021 }
00022 
00023 namespace klee {
00024 
00025   /* Stores debug information for a KInstruction */
00026   struct InstructionInfo {
00027     unsigned id;
00028     const std::string &file;
00029     unsigned line;
00030     unsigned assemblyLine;
00031 
00032   public:
00033     InstructionInfo(unsigned _id,
00034                     const std::string &_file,
00035                     unsigned _line,
00036                     unsigned _assemblyLine)
00037       : id(_id), 
00038         file(_file),
00039         line(_line),
00040         assemblyLine(_assemblyLine) {
00041     }
00042   };
00043 
00044   class InstructionInfoTable {
00045     struct ltstr { 
00046       bool operator()(const std::string *a, const std::string *b) const {
00047         return *a<*b;
00048       }
00049     };
00050 
00051     std::string dummyString;
00052     InstructionInfo dummyInfo;
00053     std::map<const llvm::Instruction*, InstructionInfo> infos;
00054     std::set<const std::string *, ltstr> internedStrings;
00055 
00056   private:
00057     const std::string *internString(std::string s);
00058 
00059   public:
00060     InstructionInfoTable(llvm::Module *m);
00061     ~InstructionInfoTable();
00062 
00063     unsigned getMaxID() const;
00064     const InstructionInfo &getInfo(const llvm::Instruction*) const;
00065     const InstructionInfo &getFunctionInfo(const llvm::Function*) const;
00066   };
00067 
00068 }
00069 
00070 #endif

Generated on Fri Jun 5 03:31:31 2009 for klee by  doxygen 1.5.8