forked from secure-software-engineering/phasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0644ee
commit d27f060
Showing
54 changed files
with
1,779 additions
and
1,292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 135 additions & 0 deletions
135
include/phasar/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IDEInstInteractionAnalysis.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
/****************************************************************************** | ||
* Copyright (c) 2019 Philipp Schubert, Richard Leer, and Florian Sattler. | ||
* All rights reserved. This program and the accompanying materials are made | ||
* available under the terms of LICENSE.txt. | ||
* | ||
* Contributors: | ||
* Philipp Schubert and others | ||
*****************************************************************************/ | ||
|
||
#ifndef PHASAR_PHASARLLVM_IFDSIDE_PROBLEMS_IDEINSTINTERACTIONALYSIS_H_ | ||
#define PHASAR_PHASARLLVM_IFDSIDE_PROBLEMS_IDEINSTINTERACTIONALYSIS_H_ | ||
|
||
#include <functional> | ||
#include <map> | ||
#include <memory> | ||
#include <set> | ||
#include <string> | ||
#include <vector> | ||
|
||
#include <phasar/PhasarLLVM/DataFlowSolver/IfdsIde/IDETabulationProblem.h> | ||
#include <phasar/Utils/BitVectorSet.h> | ||
|
||
namespace llvm { | ||
class Instruction; | ||
class Function; | ||
class StructType; | ||
class Value; | ||
} // namespace llvm | ||
|
||
namespace psr { | ||
|
||
class LLVMBasedICFG; | ||
class LLVMTypeHierarchy; | ||
class LLVMPointsToInfo; | ||
|
||
class IDEInstInteractionAnalysis | ||
: public IDETabulationProblem<const llvm::Instruction *, | ||
const llvm::Value *, const llvm::Function *, | ||
const llvm::StructType *, const llvm::Value *, | ||
BitVectorSet<std::string>, LLVMBasedICFG> { | ||
public: | ||
typedef const llvm::Value *d_t; | ||
typedef const llvm::Instruction *n_t; | ||
typedef const llvm::Function *m_t; | ||
typedef const llvm::StructType *t_t; | ||
typedef const llvm::Value *v_t; | ||
typedef BitVectorSet<std::string> l_t; | ||
typedef LLVMBasedICFG i_t; | ||
|
||
private: | ||
std::function<std::set<d_t>(n_t)> FactGen; | ||
|
||
public: | ||
IDEInstInteractionAnalysis(const ProjectIRDB *IRDB, | ||
const LLVMTypeHierarchy *TH, | ||
const LLVMBasedICFG *ICF, | ||
const LLVMPointsToInfo *PT, | ||
std::set<std::string> EntryPoints = {"main"}); | ||
|
||
virtual ~IDEInstInteractionAnalysis() = default; | ||
|
||
// offer a special hook to the usr that allows to generate facts on-the-fly | ||
|
||
void | ||
registerFlowFactGenerator(std::function<std::set<d_t>(n_t)> FactGenerator); | ||
|
||
// start formulating our analysis by specifying the parts required for IFDS | ||
|
||
std::shared_ptr<FlowFunction<d_t>> getNormalFlowFunction(n_t curr, | ||
n_t succ) override; | ||
|
||
std::shared_ptr<FlowFunction<d_t>> getCallFlowFunction(n_t callStmt, | ||
m_t destMthd) override; | ||
|
||
std::shared_ptr<FlowFunction<d_t>> getRetFlowFunction(n_t callSite, | ||
m_t calleeMthd, | ||
n_t exitStmt, | ||
n_t retSite) override; | ||
|
||
std::shared_ptr<FlowFunction<d_t>> | ||
getCallToRetFlowFunction(n_t callSite, n_t retSite, | ||
std::set<m_t> callees) override; | ||
|
||
std::shared_ptr<FlowFunction<d_t>> | ||
getSummaryFlowFunction(n_t callStmt, m_t destMthd) override; | ||
|
||
std::map<n_t, std::set<d_t>> initialSeeds() override; | ||
|
||
d_t createZeroValue() const override; | ||
|
||
bool isZeroValue(d_t d) const override; | ||
|
||
// in addition provide specifications for the IDE parts | ||
|
||
std::shared_ptr<EdgeFunction<l_t>> | ||
getNormalEdgeFunction(n_t curr, d_t currNode, n_t succ, | ||
d_t succNode) override; | ||
|
||
std::shared_ptr<EdgeFunction<l_t>> getCallEdgeFunction(n_t callStmt, | ||
d_t srcNode, | ||
m_t destinationMethod, | ||
d_t destNode) override; | ||
|
||
std::shared_ptr<EdgeFunction<l_t>> | ||
getReturnEdgeFunction(n_t callSite, m_t calleeMethod, n_t exitStmt, | ||
d_t exitNode, n_t reSite, d_t retNode) override; | ||
|
||
std::shared_ptr<EdgeFunction<l_t>> | ||
getCallToRetEdgeFunction(n_t callSite, d_t callNode, n_t retSite, | ||
d_t retSiteNode, std::set<m_t> callees) override; | ||
|
||
std::shared_ptr<EdgeFunction<l_t>> | ||
getSummaryEdgeFunction(n_t callSite, d_t callNode, n_t retSite, | ||
d_t retSiteNode) override; | ||
|
||
l_t topElement() override; | ||
|
||
l_t bottomElement() override; | ||
|
||
l_t join(l_t lhs, l_t rhs) override; | ||
|
||
std::shared_ptr<EdgeFunction<l_t>> allTopFunction() override; | ||
|
||
void printNode(std::ostream &os, n_t n) const override; | ||
|
||
void printDataFlowFact(std::ostream &os, d_t d) const override; | ||
|
||
void printMethod(std::ostream &os, m_t m) const override; | ||
|
||
void printEdgeFact(std::ostream &os, l_t l) const override; | ||
}; | ||
|
||
} // namespace psr | ||
|
||
#endif |
Oops, something went wrong.