Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ae convert CFBBG to ICFG #1384

Merged
merged 9 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ coverage:
status:
project:
default:
target: 67.85% # If auto, it will compare with the last commit. This could be set to an exact number such as 70% or higher.
target: 67.70% # If auto, it will compare with the last commit. This could be set to an exact number such as 70% or higher.
threshold: 0.01% # Allow the coverage to drop by 0.01%, and posting a success status.
base: auto
patch:
Expand Down
85 changes: 0 additions & 85 deletions svf/include/AE/Core/CFBasicBlockGWTO.h

This file was deleted.

4 changes: 4 additions & 0 deletions svf/include/AE/Core/ICFGWTO.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ class ICFGWTO : public WTO<ICFG>

explicit ICFGWTO(ICFG* graph, const ICFGNode* node) : Base(graph, node) {}

virtual ~ICFGWTO()
{
}

inline void forEachSuccessor(
const ICFGNode* node,
std::function<void(const ICFGNode*)> func) const override
Expand Down
2 changes: 2 additions & 0 deletions svf/include/AE/Core/IntervalExeState.h
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,8 @@ class IntervalExeState : public IntervalESBase
return *this;
}

virtual void printExprValues(std::ostream &oss) const override;

/// move constructor
IntervalExeState(IntervalExeState &&rhs) : IntervalESBase(std::move(rhs))
{
Expand Down
64 changes: 31 additions & 33 deletions svf/include/AE/Svfexe/AbstractExecution.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "AE/Svfexe/SVFIR2ItvExeState.h"
#include "Util/WorkList.h"
#include "MSSA/SVFGBuilder.h"
#include "AE/Core/CFBasicBlockGWTO.h"
#include "AE/Core/ICFGWTO.h"
#include "WPA/Andersen.h"
#include "Util/SVFBugReport.h"

Expand All @@ -46,7 +46,7 @@ class AEAPI;
enum class AEKind
{
AbstractExecution,
BufOverflowChecker
BufOverflowChecker,
};

/// AEStat: Statistic for AE
Expand Down Expand Up @@ -120,7 +120,6 @@ class AbstractExecution

virtual void runOnModule(SVFIR* svfModule);


/// Destructor
virtual ~AbstractExecution();

Expand All @@ -145,37 +144,37 @@ class AbstractExecution
void markRecursiveFuns();

/**
* Check if execution state exist by merging states of predecessor blocks
* Check if execution state exist by merging states of predecessor nodes
*
* @param block The basic block to analyse
* @return if this block has preceding execution state
* @param node The ICFGNode to analyse
* @return if this node has preceding execution state
*/
bool hasInEdgesES(const CFBasicBlockNode *block);
bool hasInEdgesES(const ICFGNode *node);

/**
* Check if execution state exist at the branch edge
*
* @param intraEdge the edge from CmpStmt to the next Block
* @param intraEdge the edge from CmpStmt to the next node
* @return if this edge is feasible
*/
bool hasBranchES(const IntraCFGEdge* intraEdge, IntervalExeState& es);

/**
* handle instructions in svf basic blocks
* handle instructions in ICFGNode
*
* @param block basic block that has a series of instructions
*/
void handleBlock(const CFBasicBlockNode *block);
void handleWTONode(const ICFGNode* node);

/**
* handle one instruction in svf basic blocks
* handle one instruction in ICFGNode
*
* @param node ICFGNode which has a single instruction
*/
virtual void handleICFGNode(const ICFGNode *node);

/**
* handle call node in svf basic blocks
* handle call node in ICFGNode
*
* @param node ICFGNode which has a single CallICFGNode
*/
Expand All @@ -186,7 +185,7 @@ class AbstractExecution
*
* @param cycle WTOCycle which has weak topo order of basic blocks and nested cycles
*/
virtual void handleCycle(const CFBasicBlockGWTOCycle *cycle);
virtual void handleCycle(const ICFGWTOCycle *cycle);

/**
* handle user defined function, ext function is not included.
Expand Down Expand Up @@ -221,7 +220,7 @@ class AbstractExecution
*
* @param cmpStmt CmpStmt is a conditional branch statement
* @param succ the value of cmpStmt (True or False)
* @return if this block has preceding execution state
* @return if this ICFGNode has preceding execution state
*/
bool hasCmpBranchES(const CmpStmt* cmpStmt, s64_t succ, IntervalExeState& es);

Expand All @@ -230,7 +229,7 @@ class AbstractExecution
*
* @param var var in switch inst
* @param succ the case value of switch inst
* @return if this block has preceding execution state
* @return if this ICFGNode has preceding execution state
*/
bool hasSwitchBranchES(const SVFVar* var, s64_t succ, IntervalExeState& es);

Expand All @@ -249,33 +248,32 @@ class AbstractExecution
SVFBugReport _recoder;
std::vector<const CallICFGNode*> _callSiteStack;
Map<const ICFGNode *, std::string> _nodeToBugInfo;
AndersenWaveDiff *_ander;
Map<const SVFFunction*, ICFGWTO *> _funcToWTO;
Set<const SVFFunction*> _recursiveFuns;

private:
// helper functions in handleCallSite
bool isExtCall(const CallICFGNode* callNode);
void extCallPass(const CallICFGNode* callNode);
bool isRecursiveCall(const CallICFGNode* callNode);
void recursiveCallPass(const CallICFGNode* callNode);
bool isDirectCall(const CallICFGNode* callNode);
void directCallFunPass(const CallICFGNode* callNode);
bool isIndirectCall(const CallICFGNode* callNode);
void indirectCallFunPass(const CallICFGNode* callNode);
virtual bool isExtCall(const CallICFGNode* callNode);
virtual void extCallPass(const CallICFGNode* callNode);
virtual bool isRecursiveCall(const CallICFGNode* callNode);
virtual void recursiveCallPass(const CallICFGNode* callNode);
virtual bool isDirectCall(const CallICFGNode* callNode);
virtual void directCallFunPass(const CallICFGNode* callNode);
virtual bool isIndirectCall(const CallICFGNode* callNode);
virtual void indirectCallFunPass(const CallICFGNode* callNode);

// helper functions in hasInEdgesES
bool isFunEntry(const CFBasicBlockNode* block);
bool isGlobalEntry(const CFBasicBlockNode* block);
bool isFunEntry(const ICFGNode* node);
bool isGlobalEntry(const ICFGNode* node);

// helper functions in handleCycle
bool widenFixpointPass(const CFBasicBlockNode* cycle_head, IntervalExeState& pre_es);
bool narrowFixpointPass(const CFBasicBlockNode* cycle_head, IntervalExeState& pre_es);
bool widenFixpointPass(const ICFGNode* cycle_head, IntervalExeState& pre_es);
bool narrowFixpointPass(const ICFGNode* cycle_head, IntervalExeState& pre_es);

// private data
CFBasicBlockGraph* _CFBlockG;
AndersenWaveDiff *_ander;
Map<const CFBasicBlockNode*, IntervalExeState> _preES;
Map<const CFBasicBlockNode*, IntervalExeState> _postES;
Map<const SVFFunction*, CFBasicBlockGWTO *> _funcToWTO;
Set<const SVFFunction*> _recursiveFuns;
Map<const ICFGNode*, IntervalExeState> _preES;
Map<const ICFGNode*, IntervalExeState> _postES;
std::string _moduleName;

};
Expand Down
Loading
Loading