// predecessor only has one successor.
// * Eliminates PHI nodes for basic blocks with a single predecessor
// * Eliminates a basic block that only contains an unconditional branch
-// * Eliminates method prototypes that are not referenced
+// * Eliminates function prototypes that are not referenced
//
// TODO: This should REALLY be worklist driven instead of iterative. Right now,
// we scan linearly through values, removing unused ones as we go. The problem
// iterator that designates the first element remaining after the block that
// was deleted.
//
-// WARNING: The entry node of a method may not be simplified.
+// WARNING: The entry node of a function may not be simplified.
//
bool SimplifyCFG(Function::iterator &BBIt) {
BasicBlock *BB = *BBIt;
Function *M = BB->getParent();
- assert(BB && BB->getParent() && "Block not embedded in method!");
+ assert(BB && BB->getParent() && "Block not embedded in function!");
assert(BB->getTerminator() && "Degenerate basic block encountered!");
assert(BB->getParent()->front() != BB && "Can't Simplify entry block!");
Pred->getInstList().push_back(Def); // Add to end...
}
- // Remove basic block from the method... and advance iterator to the
+ // Remove basic block from the function... and advance iterator to the
// next valid block...
BB = M->getBasicBlocks().remove(BBIt);
}
// Remove unused global values - This removes unused global values of no
-// possible value. This currently includes unused method prototypes and
+// possible value. This currently includes unused function prototypes and
// unitialized global variables.
//
static bool RemoveUnusedGlobalValues(Module *Mod) {
Function *Meth = *MI;
if (Meth->isExternal() && Meth->use_size() == 0) {
// No references to prototype?
- //cerr << "Removing method proto: " << Meth->getName() << endl;
+ //cerr << "Removing function proto: " << Meth->getName() << endl;
delete Mod->getFunctionList().remove(MI); // Remove prototype
// Remove moves iterator to point to the next one automatically
Changed = true;
}
namespace {
- struct DeadCodeElimination : public MethodPass {
+ struct DeadCodeElimination : public FunctionPass {
// Pass Interface...
virtual bool doInitialization(Module *M) {
// It is possible that we may require multiple passes over the code to fully
// eliminate dead code. Iterate until we are done.
//
- virtual bool runOnMethod(Function *F) {
+ virtual bool runOnFunction(Function *F) {
bool Changed = false;
while (DoDCEPass(F)) Changed = true;
return Changed;