mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add a viewCFGOnly function for debugging purposes.
This commit is contained in:
@@ -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