- }
- return MadeChanges;
-}
-
-namespace {
- // FIXME: ConstantMerge should not be a FunctionPass!!!
- class ConstantMerge : public FunctionPass {
- protected:
- std::map<Constant*, GlobalVariable*> Constants;
- unsigned LastConstantSeen;
- public:
- inline ConstantMerge() : LastConstantSeen(0) {}
-
- const char *getPassName() const {return "Merge Duplicate Global Constants";}
-
- // doInitialization - For this pass, process all of the globals in the
- // module, eliminating duplicate constants.
- //
- bool doInitialization(Module *M) {
- return ::mergeDuplicateConstants(M, LastConstantSeen, Constants);
- }
-
- bool runOnFunction(Function *) { return false; }
-
- // doFinalization - Clean up internal state for this module
- //
- bool doFinalization(Module *M) {
- LastConstantSeen = 0;
- Constants.clear();
- return false;
- }