mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add a viewCFGOnly function for debugging purposes.
This commit is contained in:
@@ -900,6 +900,9 @@ public:
|
||||
/// block inside. This depends on there being a 'dot' and 'gv' program in
|
||||
/// your path.
|
||||
void viewCFG() const;
|
||||
// Like the ViewCFG, but the graph does not show the basic block contents.
|
||||
void viewCFGOnly() const;
|
||||
|
||||
};
|
||||
|
||||
inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
|
||||
|
||||
@@ -405,17 +405,28 @@ TargetFunction("view-cfg-only-for-function", llvm::cl::init(""),
|
||||
llvm::cl::desc("Only print out the cfg for this function"));
|
||||
#endif
|
||||
|
||||
|
||||
void SILFunction::viewCFG() const {
|
||||
namespace {
|
||||
void viewCFGHelper(const SILFunction* F, bool skipBBContents) {
|
||||
/// When asserts are disabled, this should be a NoOp.
|
||||
#ifndef NDEBUG
|
||||
// If we have a target function, only print that function out.
|
||||
if (!TargetFunction.empty() && !(getName().str() == TargetFunction))
|
||||
if (!TargetFunction.empty() && !(F->getName().str() == TargetFunction))
|
||||
return;
|
||||
|
||||
ViewGraph(const_cast<SILFunction *>(this), "cfg" + getName().str());
|
||||
ViewGraph(const_cast<SILFunction *>(F), "cfg" + F->getName().str(),
|
||||
/*shortNames=*/skipBBContents);
|
||||
#endif
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void SILFunction::viewCFG() const {
|
||||
viewCFGHelper(this, /*skipBBContents=*/false);
|
||||
}
|
||||
|
||||
void SILFunction::viewCFGOnly() const {
|
||||
viewCFGHelper(this, /*skipBBContents=*/true);
|
||||
}
|
||||
|
||||
|
||||
bool SILFunction::hasSelfMetadataParam() const {
|
||||
auto paramTypes = getConventions().getParameterSILTypes();
|
||||
|
||||
Reference in New Issue
Block a user