Convert the diagnostic methods into passes.

Swift SVN r13503
This commit is contained in:
Nadav Rotem
2014-02-05 20:30:49 +00:00
parent 484468fd96
commit 1df8e93bbb
8 changed files with 167 additions and 0 deletions

View File

@@ -17,11 +17,14 @@
#include "swift/AST/DiagnosticsSIL.h"
#include "swift/SIL/SILBuilder.h"
#include "swift/SILPasses/Utils/Local.h"
#include "swift/SILPasses/Transforms.h"
#include "swift/SILPasses/PassManager.h"
#include "swift/Basic/Fallthrough.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Support/Debug.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/StringExtras.h"
using namespace swift;
STATISTIC(NumAssignRewritten, "Number of assigns rewritten");
@@ -1565,3 +1568,27 @@ void swift::performSILDefiniteInitialization(SILModule *M) {
DEBUG(Fn.verify());
}
}
class DefiniteInitialization : public SILFunctionTrans {
virtual ~DefiniteInitialization() {}
/// The entry point to the transformation.
virtual void runOnFunction(SILFunction &F, SILPassManager *PM) {
// Walk through and promote all of the alloc_box's that we can.
checkDefiniteInitialization(F);
DEBUG(F.verify());
// Lower raw-sil only instructions used by this pass, like "assign".
lowerRawSILOperations(F);
DEBUG(F.verify());
PM->invalidateAllAnalysis(SILAnalysis::IK_All);
}
};
SILTransform *swift::createDefiniteInitialization() {
return new DefiniteInitialization();
}