mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 19:31:58 +00:00
Add command-line option to select whether to isolate or delete function from
module. Default is `isolate' as before. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13113 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7d248397a7
commit
ca718e41cf
@ -36,6 +36,9 @@ OutputFilename("o", cl::desc("Specify output filename"),
|
||||
static cl::opt<bool>
|
||||
Force("f", cl::desc("Overwrite output files"));
|
||||
|
||||
static cl::opt<bool>
|
||||
DeleteFn("delete", cl::desc("Delete specified function from Module"));
|
||||
|
||||
// ExtractFunc - The function to extract from the module... defaults to main.
|
||||
static cl::opt<std::string>
|
||||
ExtractFunc("func", cl::desc("Specify function to extract"), cl::init("main"),
|
||||
@ -64,7 +67,8 @@ int main(int argc, char **argv) {
|
||||
//
|
||||
PassManager Passes;
|
||||
Passes.add(new TargetData("extract", M.get())); // Use correct TargetData
|
||||
Passes.add(createFunctionExtractionPass(F)); // Extract the function
|
||||
// Either isolate the function or delete it from the Module
|
||||
Passes.add(createFunctionExtractionPass(F, DeleteFn));
|
||||
Passes.add(createGlobalDCEPass()); // Delete unreachable globals
|
||||
Passes.add(createFunctionResolvingPass()); // Delete prototypes
|
||||
Passes.add(createDeadTypeEliminationPass()); // Remove dead types...
|
||||
|
@ -36,6 +36,9 @@ OutputFilename("o", cl::desc("Specify output filename"),
|
||||
static cl::opt<bool>
|
||||
Force("f", cl::desc("Overwrite output files"));
|
||||
|
||||
static cl::opt<bool>
|
||||
DeleteFn("delete", cl::desc("Delete specified function from Module"));
|
||||
|
||||
// ExtractFunc - The function to extract from the module... defaults to main.
|
||||
static cl::opt<std::string>
|
||||
ExtractFunc("func", cl::desc("Specify function to extract"), cl::init("main"),
|
||||
@ -64,7 +67,8 @@ int main(int argc, char **argv) {
|
||||
//
|
||||
PassManager Passes;
|
||||
Passes.add(new TargetData("extract", M.get())); // Use correct TargetData
|
||||
Passes.add(createFunctionExtractionPass(F)); // Extract the function
|
||||
// Either isolate the function or delete it from the Module
|
||||
Passes.add(createFunctionExtractionPass(F, DeleteFn));
|
||||
Passes.add(createGlobalDCEPass()); // Delete unreachable globals
|
||||
Passes.add(createFunctionResolvingPass()); // Delete prototypes
|
||||
Passes.add(createDeadTypeEliminationPass()); // Remove dead types...
|
||||
|
Loading…
Reference in New Issue
Block a user