mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
-sil-print-all (et al.) should print specialized functions when they are created.
This commit is contained in:
@@ -155,6 +155,9 @@ public:
|
|||||||
CompletedPassesMap.clear();
|
CompletedPassesMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// \brief Notify the pass manager of a newly create function for tracing.
|
||||||
|
void notifyOfNewFunction(SILFunction *F, SILTransform *T);
|
||||||
|
|
||||||
/// \brief Add the function \p F to the function pass worklist.
|
/// \brief Add the function \p F to the function pass worklist.
|
||||||
/// If not null, the function \p DerivedFrom is the function from which \p F
|
/// If not null, the function \p DerivedFrom is the function from which \p F
|
||||||
/// is derived. This is used to avoid an infinite amount of functions pushed
|
/// is derived. This is used to avoid an infinite amount of functions pushed
|
||||||
@@ -291,6 +294,9 @@ private:
|
|||||||
/// Return true if all analyses are unlocked.
|
/// Return true if all analyses are unlocked.
|
||||||
bool analysesUnlocked();
|
bool analysesUnlocked();
|
||||||
|
|
||||||
|
/// Dumps information about the pass with index \p TransIdx to llvm::dbgs().
|
||||||
|
void dumpPassInfo(const char *Title, SILTransform *Tr, SILFunction *F);
|
||||||
|
|
||||||
/// Dumps information about the pass with index \p TransIdx to llvm::dbgs().
|
/// Dumps information about the pass with index \p TransIdx to llvm::dbgs().
|
||||||
void dumpPassInfo(const char *Title, unsigned TransIdx,
|
void dumpPassInfo(const char *Title, unsigned TransIdx,
|
||||||
SILFunction *F = nullptr);
|
SILFunction *F = nullptr);
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ namespace swift {
|
|||||||
/// The number should be small anyway, but bugs in optimizations could cause
|
/// The number should be small anyway, but bugs in optimizations could cause
|
||||||
/// an infinite loop in the passmanager.
|
/// an infinite loop in the passmanager.
|
||||||
void notifyAddFunction(SILFunction *F, SILFunction *DerivedFrom) {
|
void notifyAddFunction(SILFunction *F, SILFunction *DerivedFrom) {
|
||||||
|
PM->notifyOfNewFunction(F, this);
|
||||||
PM->addFunctionToWorklist(F, DerivedFrom);
|
PM->addFunctionToWorklist(F, DerivedFrom);
|
||||||
PM->notifyAnalysisOfFunction(F);
|
PM->notifyAnalysisOfFunction(F);
|
||||||
}
|
}
|
||||||
@@ -171,6 +172,7 @@ namespace swift {
|
|||||||
|
|
||||||
/// Inform the pass manager of an added function.
|
/// Inform the pass manager of an added function.
|
||||||
void notifyAddFunction(SILFunction *F) {
|
void notifyAddFunction(SILFunction *F) {
|
||||||
|
PM->notifyOfNewFunction(F, this);
|
||||||
PM->notifyAnalysisOfFunction(F);
|
PM->notifyAnalysisOfFunction(F);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -283,6 +283,16 @@ static bool breakBeforeRunning(StringRef fnName, SILFunctionTransform *SFT) {
|
|||||||
&& (SFT->getID() == SILBreakOnPass || SFT->getTag() == SILBreakOnPass);
|
&& (SFT->getID() == SILBreakOnPass || SFT->getTag() == SILBreakOnPass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SILPassManager::dumpPassInfo(const char *Title, SILTransform *Tr,
|
||||||
|
SILFunction *F) {
|
||||||
|
llvm::dbgs() << " " << Title << " #" << NumPassesRun << ", stage "
|
||||||
|
<< StageName << ", pass : " << Tr->getID()
|
||||||
|
<< " (" << Tr->getTag() << ")";
|
||||||
|
if (F)
|
||||||
|
llvm::dbgs() << ", Function: " << F->getName();
|
||||||
|
llvm::dbgs() << '\n';
|
||||||
|
}
|
||||||
|
|
||||||
void SILPassManager::dumpPassInfo(const char *Title, unsigned TransIdx,
|
void SILPassManager::dumpPassInfo(const char *Title, unsigned TransIdx,
|
||||||
SILFunction *F) {
|
SILFunction *F) {
|
||||||
SILTransform *Tr = Transformations[TransIdx];
|
SILTransform *Tr = Transformations[TransIdx];
|
||||||
@@ -541,6 +551,13 @@ SILPassManager::~SILPassManager() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SILPassManager::notifyOfNewFunction(SILFunction *F, SILTransform *T) {
|
||||||
|
if (doPrintAfter(T, F, SILPrintAll)) {
|
||||||
|
dumpPassInfo("*** New SIL function in ", T, F);
|
||||||
|
F->dump(getOptions().EmitVerboseSIL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SILPassManager::addFunctionToWorklist(SILFunction *F,
|
void SILPassManager::addFunctionToWorklist(SILFunction *F,
|
||||||
SILFunction *DerivedFrom) {
|
SILFunction *DerivedFrom) {
|
||||||
assert(F && F->isDefinition() && (isMandatoryPipeline || F->shouldOptimize())
|
assert(F && F->isDefinition() && (isMandatoryPipeline || F->shouldOptimize())
|
||||||
|
|||||||
Reference in New Issue
Block a user