-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Out-source globals model * Mode call-graph construction * small refactor * Cleanup resolver headers * buildCallGraph speedup for non-OTF resolvers * Move isVirtualCall into Resolver + some refactoring * Move EntryFunctionUtils into phasar_llvm_controlflow to avoid circular library dependencies between phasar_llvm_db and phasar_llvm_utils * Add more constness
- Loading branch information
1 parent
f17594d
commit bb86c25
Showing
22 changed files
with
692 additions
and
429 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
31 changes: 31 additions & 0 deletions
31
include/phasar/PhasarLLVM/ControlFlow/EntryFunctionUtils.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,31 @@ | ||
/****************************************************************************** | ||
* Copyright (c) 2024 Fabian Schiebel. | ||
* All rights reserved. This program and the accompanying materials are made | ||
* available under the terms of LICENSE.txt. | ||
* | ||
* Contributors: | ||
* Fabian Schiebel and others | ||
*****************************************************************************/ | ||
|
||
#ifndef PHASAR_PHASARLLVM_UTILS_ENTRYFUNCTIONUTILS_H | ||
#define PHASAR_PHASARLLVM_UTILS_ENTRYFUNCTIONUTILS_H | ||
|
||
#include "llvm/ADT/ArrayRef.h" | ||
#include "llvm/IR/Function.h" | ||
|
||
#include <string> | ||
#include <vector> | ||
|
||
namespace psr { | ||
class LLVMProjectIRDB; | ||
|
||
[[nodiscard]] std::vector<const llvm::Function *> | ||
getEntryFunctions(const LLVMProjectIRDB &IRDB, | ||
llvm::ArrayRef<std::string> EntryPoints); | ||
|
||
[[nodiscard]] std::vector<llvm::Function *> | ||
getEntryFunctionsMut(LLVMProjectIRDB &IRDB, | ||
llvm::ArrayRef<std::string> EntryPoints); | ||
} // namespace psr | ||
|
||
#endif // PHASAR_PHASARLLVM_UTILS_ENTRYFUNCTIONUTILS_H |
45 changes: 45 additions & 0 deletions
45
include/phasar/PhasarLLVM/ControlFlow/GlobalCtorsDtorsModel.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,45 @@ | ||
/****************************************************************************** | ||
* Copyright (c) 2024 Fabian Schiebel. | ||
* All rights reserved. This program and the accompanying materials are made | ||
* available under the terms of LICENSE.txt. | ||
* | ||
* Contributors: | ||
* Fabian Schiebel and others | ||
*****************************************************************************/ | ||
|
||
#ifndef PHASAR_PHASARLLVM_CONTROLFLOW_GLOBALCTORSDTORSMODEL_H | ||
#define PHASAR_PHASARLLVM_CONTROLFLOW_GLOBALCTORSDTORSMODEL_H | ||
|
||
#include "llvm/ADT/ArrayRef.h" | ||
#include "llvm/IR/Function.h" | ||
|
||
namespace psr { | ||
class LLVMProjectIRDB; | ||
|
||
class GlobalCtorsDtorsModel { | ||
public: | ||
static constexpr llvm::StringLiteral ModelName = | ||
"__psrCRuntimeGlobalCtorsModel"; | ||
|
||
static constexpr llvm::StringLiteral DtorModelName = | ||
"__psrCRuntimeGlobalDtorsModel"; | ||
|
||
static constexpr llvm::StringLiteral DtorsCallerName = | ||
"__psrGlobalDtorsCaller"; | ||
|
||
static constexpr llvm::StringLiteral UserEntrySelectorName = | ||
"__psrCRuntimeUserEntrySelector"; | ||
|
||
static llvm::Function * | ||
buildModel(LLVMProjectIRDB &IRDB, | ||
llvm::ArrayRef<llvm::Function *> UserEntryPoints); | ||
static llvm::Function * | ||
buildModel(LLVMProjectIRDB &IRDB, | ||
llvm::ArrayRef<std::string> UserEntryPoints); | ||
|
||
/// Returns true, if a function was generated by phasar. | ||
[[nodiscard]] static bool isPhasarGenerated(const llvm::Function &F) noexcept; | ||
}; | ||
} // namespace psr | ||
|
||
#endif // PHASAR_PHASARLLVM_CONTROLFLOW_GLOBALCTORSDTORSMODEL_H |
25 changes: 25 additions & 0 deletions
25
include/phasar/PhasarLLVM/ControlFlow/LLVMBasedCallGraph.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,25 @@ | ||
/****************************************************************************** | ||
* Copyright (c) 2024 Fabian Schiebel. | ||
* All rights reserved. This program and the accompanying materials are made | ||
* available under the terms of LICENSE.txt. | ||
* | ||
* Contributors: | ||
* Fabian Schiebel and others | ||
*****************************************************************************/ | ||
|
||
#ifndef PHASAR_PHASARLLVM_CONTROLFLOW_LLVMBASEDCALLGRAPH_H | ||
#define PHASAR_PHASARLLVM_CONTROLFLOW_LLVMBASEDCALLGRAPH_H | ||
|
||
#include "phasar/ControlFlow/CallGraph.h" | ||
|
||
namespace llvm { | ||
class Instruction; | ||
class Function; | ||
} // namespace llvm | ||
|
||
namespace psr { | ||
using LLVMBasedCallGraph = | ||
CallGraph<const llvm::Instruction *, const llvm::Function *>; | ||
} // namespace psr | ||
|
||
#endif // PHASAR_PHASARLLVM_CONTROLFLOW_LLVMBASEDCALLGRAPH_H |
49 changes: 49 additions & 0 deletions
49
include/phasar/PhasarLLVM/ControlFlow/LLVMBasedCallGraphBuilder.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,49 @@ | ||
/****************************************************************************** | ||
* Copyright (c) 2024 Fabian Schiebel. | ||
* All rights reserved. This program and the accompanying materials are made | ||
* available under the terms of LICENSE.txt. | ||
* | ||
* Contributors: | ||
* Fabian Schiebel and others | ||
*****************************************************************************/ | ||
|
||
#ifndef PHASAR_PHASARLLVM_CONTROLFLOW_LLVMBASEDCALLGRAPHBUILDER_H | ||
#define PHASAR_PHASARLLVM_CONTROLFLOW_LLVMBASEDCALLGRAPHBUILDER_H | ||
|
||
#include "phasar/PhasarLLVM/ControlFlow/LLVMBasedCallGraph.h" | ||
#include "phasar/PhasarLLVM/Pointer/LLVMAliasInfo.h" | ||
#include "phasar/Utils/Soundness.h" | ||
|
||
namespace psr { | ||
class LLVMProjectIRDB; | ||
enum class CallGraphAnalysisType; | ||
class LLVMTypeHierarchy; | ||
class LLVMVFTableProvider; | ||
class Resolver; | ||
|
||
[[nodiscard]] LLVMBasedCallGraph | ||
buildLLVMBasedCallGraph(LLVMProjectIRDB &IRDB, CallGraphAnalysisType CGType, | ||
llvm::ArrayRef<const llvm::Function *> EntryPoints, | ||
LLVMTypeHierarchy &TH, LLVMVFTableProvider &VTP, | ||
LLVMAliasInfoRef PT = nullptr, | ||
Soundness S = Soundness::Soundy); | ||
|
||
[[nodiscard]] LLVMBasedCallGraph | ||
buildLLVMBasedCallGraph(const LLVMProjectIRDB &IRDB, Resolver &CGResolver, | ||
llvm::ArrayRef<const llvm::Function *> EntryPoints, | ||
Soundness S = Soundness::Soundy); | ||
|
||
[[nodiscard]] LLVMBasedCallGraph | ||
buildLLVMBasedCallGraph(LLVMProjectIRDB &IRDB, CallGraphAnalysisType CGType, | ||
llvm::ArrayRef<std::string> EntryPoints, | ||
LLVMTypeHierarchy &TH, LLVMVFTableProvider &VTP, | ||
LLVMAliasInfoRef PT = nullptr, | ||
Soundness S = Soundness::Soundy); | ||
|
||
[[nodiscard]] LLVMBasedCallGraph | ||
buildLLVMBasedCallGraph(const LLVMProjectIRDB &IRDB, Resolver &CGResolver, | ||
llvm::ArrayRef<std::string> EntryPoints, | ||
Soundness S = Soundness::Soundy); | ||
} // namespace psr | ||
|
||
#endif // PHASAR_PHASARLLVM_CONTROLFLOW_LLVMBASEDCALLGRAPHBUILDER_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
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
Oops, something went wrong.