mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[function-signature-opts] Commit initial function sig optimization pass that eliminates dead arguments.
The way this pass works is very similar to generic specialization except that it turns the old function into a thunk that calls the newly created function that has had the dead arguments removed. This ensures that any place in the code where we were unable to see that the old function was being called still works and also enables us to cut down on code size increase due to code duplication since the marshalling code for the thunk should be very small. This is just the first part of a larger body of work that optimizes function signatures. The plan is to include transforming loadable pointer args to pass by value and to convert @owned arguments to @gauranteed arguments. <rdar://problem/17319928> Swift SVN r18970
This commit is contained in:
@@ -70,7 +70,8 @@ enum class PassKind {
|
||||
GlobalARCOpts,
|
||||
DCE,
|
||||
EnumSimplification,
|
||||
LoopInfoPrinter
|
||||
LoopInfoPrinter,
|
||||
FunctionSignatureOpts,
|
||||
};
|
||||
|
||||
enum class OptGroup {
|
||||
@@ -229,6 +230,9 @@ Passes(llvm::cl::desc("Passes:"),
|
||||
clEnumValN(PassKind::LoopInfoPrinter,
|
||||
"loop-info-printer",
|
||||
"Display loop information."),
|
||||
clEnumValN(PassKind::FunctionSignatureOpts,
|
||||
"function-signature-opts",
|
||||
"Optimize function signatures."),
|
||||
clEnumValEnd));
|
||||
|
||||
static llvm::cl::opt<bool>
|
||||
@@ -402,6 +406,9 @@ static void runCommandLineSelectedPasses(SILModule *Module,
|
||||
case PassKind::LoopInfoPrinter:
|
||||
PM.add(createLoopInfoPrinter());
|
||||
break;
|
||||
case PassKind::FunctionSignatureOpts:
|
||||
PM.add(createFunctionSignatureOpts());
|
||||
break;
|
||||
}
|
||||
}
|
||||
PM.run();
|
||||
|
||||
Reference in New Issue
Block a user