From f4de63f65fa995e68e3cd268117ab065068be413 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 21 Jan 2002 07:31:50 +0000 Subject: Implement a more powerful, simpler, pass system. This pass system can figure out how to run a collection of passes optimially given their behaviors and charactaristics. Convert code to use it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1507 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/IPO/SimpleStructMutation.cpp | 32 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'lib/Transforms/IPO/SimpleStructMutation.cpp') diff --git a/lib/Transforms/IPO/SimpleStructMutation.cpp b/lib/Transforms/IPO/SimpleStructMutation.cpp index d0b8bb2807..571638e867 100644 --- a/lib/Transforms/IPO/SimpleStructMutation.cpp +++ b/lib/Transforms/IPO/SimpleStructMutation.cpp @@ -58,18 +58,18 @@ static unsigned getIndex(const vector > &Vec, static inline void GetTransformation(const StructType *ST, vector &Transform, - enum PrebuiltStructMutation::Transform XForm) { + enum SimpleStructMutation::Transform XForm) { unsigned NumElements = ST->getElementTypes().size(); Transform.reserve(NumElements); switch (XForm) { - case PrebuiltStructMutation::SwapElements: + case SimpleStructMutation::SwapElements: // The transformation to do is: just simply swap the elements for (unsigned i = 0; i < NumElements; ++i) Transform.push_back(NumElements-i-1); break; - case PrebuiltStructMutation::SortElements: { + case SimpleStructMutation::SortElements: { vector > ElList; // Build mapping from index to size @@ -87,26 +87,26 @@ static inline void GetTransformation(const StructType *ST, } } -// doPassInitialization - This does all of the work of the pass -// -PrebuiltStructMutation::TransformsType - PrebuiltStructMutation::getTransforms(Module *M, enum Transform XForm) { +SimpleStructMutation::TransformsType + SimpleStructMutation::getTransforms(Module *M, enum Transform XForm) { + + // FIXME: These should be calculated by the Pass framework! + // We need to know which types to modify, and which types we CAN'T modify - FindUsedTypes FUT/*(true)*/; // TODO: Do symbol tables as well - FindUnsafePointerTypes FUPT; + FindUsedTypes *FUT = new FindUsedTypes(/*true*/); // TODO: Do symbol tables as well + FindUnsafePointerTypes *FUPT = new FindUnsafePointerTypes(); // Simutaneously find all of the types used, and all of the types that aren't // safe. // - vector Analyses; - Analyses.push_back(&FUT); - Analyses.push_back(&FUPT); - Pass::runAllPasses(M, Analyses); // Do analyses - + PassManager Analyses; + Analyses.add(FUT); + Analyses.add(FUPT); + Analyses.run(M); // Do analyses // Get the results out of the analyzers... - const set &UnsafePTys = FUPT.getUnsafeTypes(); - const set &UsedTypes = FUT.getTypes(); + const set &UnsafePTys = FUPT->getUnsafeTypes(); + const set &UsedTypes = FUT->getTypes(); // Combine the two sets, weeding out non structure types. Closures in C++ -- cgit v1.2.3