CallPathManager.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef __UTIL_CALLPATHMANAGER_H__
00011 #define __UTIL_CALLPATHMANAGER_H__
00012
00013 #include "klee/Statistics.h"
00014
00015 #include <map>
00016 #include <vector>
00017
00018 namespace llvm {
00019 class Instruction;
00020 class Function;
00021 }
00022
00023 namespace klee {
00024 class StatisticRecord;
00025
00026 struct CallSiteInfo {
00027 unsigned count;
00028 StatisticRecord statistics;
00029
00030 public:
00031 CallSiteInfo() : count(0) {}
00032 };
00033
00034 typedef std::map<llvm::Instruction*,
00035 std::map<llvm::Function*, CallSiteInfo> > CallSiteSummaryTable;
00036
00037 class CallPathNode {
00038 friend class CallPathManager;
00039
00040 public:
00041 typedef std::map<std::pair<llvm::Instruction*,
00042 llvm::Function*>, CallPathNode*> children_ty;
00043
00044
00045 CallPathNode *parent;
00046 llvm::Instruction *callSite;
00047 llvm::Function *function;
00048 children_ty children;
00049
00050 StatisticRecord statistics;
00051 StatisticRecord summaryStatistics;
00052 unsigned count;
00053
00054 public:
00055 CallPathNode(CallPathNode *parent,
00056 llvm::Instruction *callSite,
00057 llvm::Function *function);
00058
00059 void print();
00060 };
00061
00062 class CallPathManager {
00063 CallPathNode root;
00064 std::vector<CallPathNode*> paths;
00065
00066 private:
00067 CallPathNode *computeCallPath(CallPathNode *parent,
00068 llvm::Instruction *callSite,
00069 llvm::Function *f);
00070
00071 public:
00072 CallPathManager();
00073 ~CallPathManager();
00074
00075 void getSummaryStatistics(CallSiteSummaryTable &result);
00076
00077 CallPathNode *getCallPath(CallPathNode *parent,
00078 llvm::Instruction *callSite,
00079 llvm::Function *f);
00080 };
00081 }
00082
00083 #endif