diff options
author | Chris Lattner <sabre@nondot.org> | 2002-01-21 07:31:50 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-01-21 07:31:50 +0000 |
commit | f4de63f65fa995e68e3cd268117ab065068be413 (patch) | |
tree | 2fd8cd44af0f23dafd94102c1c0152b1cd82fe4d /lib/Transforms/IPO/SimpleStructMutation.cpp | |
parent | aff5bcebb7fb9880e0a3518a8e7c999e738d531c (diff) |
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
Diffstat (limited to 'lib/Transforms/IPO/SimpleStructMutation.cpp')
-rw-r--r-- | lib/Transforms/IPO/SimpleStructMutation.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
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<pair<unsigned, unsigned> > &Vec, static inline void GetTransformation(const StructType *ST, vector<int> &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<pair<unsigned, unsigned> > 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<Pass*> 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<PointerType*> &UnsafePTys = FUPT.getUnsafeTypes(); - const set<const Type *> &UsedTypes = FUT.getTypes(); + const set<PointerType*> &UnsafePTys = FUPT->getUnsafeTypes(); + const set<const Type *> &UsedTypes = FUT->getTypes(); // Combine the two sets, weeding out non structure types. Closures in C++ |