mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Remove dead functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5913 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
473a843f31
commit
44be257166
@ -110,19 +110,6 @@ private:
|
|||||||
return runPasses(PassesToRun, Filename, DeleteOutput);
|
return runPasses(PassesToRun, Filename, DeleteOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// runPass - Run only the specified pass on the program.
|
|
||||||
///
|
|
||||||
bool runPass(const PassInfo *P, bool DeleteOutput = true) const {
|
|
||||||
return runPasses(std::vector<const PassInfo*>(1, P), DeleteOutput);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// extractFunctionFromModule - This method is used to extract the specified
|
|
||||||
/// (non-external) function from the current program, slim down the module,
|
|
||||||
/// and then return it. This does not modify Program at all, it modifies a
|
|
||||||
/// copy, which it returns.
|
|
||||||
///
|
|
||||||
Module *extractFunctionFromModule(Function *F) const;
|
|
||||||
|
|
||||||
/// deleteInstructionFromProgram - This method clones the current Program and
|
/// deleteInstructionFromProgram - This method clones the current Program and
|
||||||
/// deletes the specified instruction from the cloned module. It then runs a
|
/// deletes the specified instruction from the cloned module. It then runs a
|
||||||
/// series of cleanup passes (ADCE and SimplifyCFG) to eliminate any code
|
/// series of cleanup passes (ADCE and SimplifyCFG) to eliminate any code
|
||||||
|
@ -15,31 +15,6 @@
|
|||||||
#include "llvm/Type.h"
|
#include "llvm/Type.h"
|
||||||
#include "llvm/Constant.h"
|
#include "llvm/Constant.h"
|
||||||
|
|
||||||
/// extractFunctionFromModule - This method is used to extract the specified
|
|
||||||
/// (non-external) function from the current program, slim down the module, and
|
|
||||||
/// then return it. This does not modify Program at all, it modifies a copy,
|
|
||||||
/// which it returns.
|
|
||||||
Module *BugDriver::extractFunctionFromModule(Function *F) const {
|
|
||||||
Module *Result = CloneModule(Program);
|
|
||||||
|
|
||||||
// Translate from the old module to the new copied module...
|
|
||||||
Module::iterator RFI = Result->begin(); // Get iterator to corresponding fn
|
|
||||||
std::advance(RFI, std::distance(Program->begin(), Module::iterator(F)));
|
|
||||||
|
|
||||||
// In addition to just parsing the input from GCC, we also want to spiff it up
|
|
||||||
// a little bit. Do this now.
|
|
||||||
//
|
|
||||||
PassManager Passes;
|
|
||||||
Passes.add(createFunctionExtractionPass(RFI)); // Extract the function
|
|
||||||
Passes.add(createGlobalDCEPass()); // Delete unreachable globals
|
|
||||||
Passes.add(createFunctionResolvingPass()); // Delete prototypes
|
|
||||||
Passes.add(createDeadTypeEliminationPass()); // Remove dead types...
|
|
||||||
Passes.add(createVerifierPass());
|
|
||||||
Passes.run(*Result);
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// deleteInstructionFromProgram - This method clones the current Program and
|
/// deleteInstructionFromProgram - This method clones the current Program and
|
||||||
/// deletes the specified instruction from the cloned module. It then runs a
|
/// deletes the specified instruction from the cloned module. It then runs a
|
||||||
/// series of cleanup passes (ADCE and SimplifyCFG) to eliminate any code which
|
/// series of cleanup passes (ADCE and SimplifyCFG) to eliminate any code which
|
||||||
@ -69,9 +44,7 @@ Module *BugDriver::deleteInstructionFromProgram(Instruction *I,
|
|||||||
// Remove the instruction from the program.
|
// Remove the instruction from the program.
|
||||||
I->getParent()->getInstList().erase(I);
|
I->getParent()->getInstList().erase(I);
|
||||||
|
|
||||||
// In addition to just parsing the input from GCC, we also want to spiff it up
|
// Spiff up the output a little bit.
|
||||||
// a little bit. Do this now.
|
|
||||||
//
|
|
||||||
PassManager Passes;
|
PassManager Passes;
|
||||||
if (Simplification > 2)
|
if (Simplification > 2)
|
||||||
Passes.add(createAggressiveDCEPass()); // Remove dead code...
|
Passes.add(createAggressiveDCEPass()); // Remove dead code...
|
||||||
|
Loading…
Reference in New Issue
Block a user