2001-06-30 04:34:07 +00:00
|
|
|
//===-- DCE.h - Functions that perform Dead Code Elimination -----*- C++ -*--=//
|
|
|
|
//
|
|
|
|
// This family of functions is useful for performing dead code elimination of
|
|
|
|
// various sorts.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_OPT_DCE_H
|
|
|
|
#define LLVM_OPT_DCE_H
|
|
|
|
|
2001-06-30 06:37:16 +00:00
|
|
|
#include "llvm/Module.h"
|
2001-06-30 04:34:07 +00:00
|
|
|
#include "llvm/Method.h"
|
|
|
|
|
|
|
|
namespace opt {
|
|
|
|
|
|
|
|
bool DoDeadCodeElimination(Method *M); // DCE a method
|
|
|
|
bool DoRemoveUnusedConstants(SymTabValue *S); // RUC a method or module
|
|
|
|
bool DoDeadCodeElimination(Module *C); // DCE & RUC a whole module
|
|
|
|
|
2001-06-30 06:37:16 +00:00
|
|
|
|
|
|
|
// DoADCE - Execute the Agressive Dead Code Elimination Algorithm
|
|
|
|
//
|
|
|
|
bool DoADCE(Method *M); // Defined in ADCE.cpp
|
|
|
|
static inline bool DoADCE(Module *M) {
|
|
|
|
return M->reduceApply(DoADCE);
|
|
|
|
}
|
|
|
|
|
2001-06-30 04:34:07 +00:00
|
|
|
// SimplifyCFG - This function is used to do simplification of a CFG. For
|
|
|
|
// example, it adjusts branches to branches to eliminate the extra hop, it
|
|
|
|
// eliminates unreachable basic blocks, and does other "peephole" optimization
|
|
|
|
// of the CFG. It returns true if a modification was made, and returns an
|
|
|
|
// iterator that designates the first element remaining after the block that
|
|
|
|
// was deleted.
|
|
|
|
//
|
|
|
|
// WARNING: The entry node of a method may not be simplified.
|
|
|
|
//
|
|
|
|
bool SimplifyCFG(Method::iterator &BBIt);
|
|
|
|
|
|
|
|
} // End namespace opt
|
|
|
|
|
|
|
|
#endif
|