public:
/// If you'd like to deal with a function instead of just a module, use
/// this method to get its data into the SlotMachine.
- void incorporateFunction(const Function *F) { TheFunction = F; }
+ void incorporateFunction(const Function *F) {
+ TheFunction = F;
+ FunctionProcessed = false;
+ }
/// After calling incorporateFunction, use this method to remove the
/// most recently incorporated function from the SlotMachine. This
/// @brief The function for which we are holding slot numbers
const Function* TheFunction;
+ bool FunctionProcessed;
/// @brief The TypePlanes map for the module level data
TypedPlanes mMap;
SlotMachine::SlotMachine(const Module *M)
: TheModule(M) ///< Saved for lazy initialization.
, TheFunction(0)
+ , FunctionProcessed(false)
, mMap()
, mTypes()
, fMap()
SlotMachine::SlotMachine(const Function *F )
: TheModule( F ? F->getParent() : 0 ) ///< Saved for lazy initialization
, TheFunction(F) ///< Saved for lazy initialization
+ , FunctionProcessed(false)
, mMap()
, mTypes()
, fMap()
processModule();
TheModule = 0; ///< Prevent re-processing next time we're called.
}
- if ( TheFunction ) {
+ if ( TheFunction && ! FunctionProcessed) {
processFunction();
}
}
}
}
+ FunctionProcessed = true;
+
SC_DEBUG("end processFunction!\n");
}
fMap.clear(); // Simply discard the function level map
fTypes.clear();
TheFunction = 0;
+ FunctionProcessed = false;
SC_DEBUG("end purgeFunction!\n");
}