Change the command line option to sil-opt for the definite initialization

pass to be -definite-init instead of -memory-promotion, rename the
entrypoint for the pass to match, and tidy various and sundry comments.


Swift SVN r8927
This commit is contained in:
Chris Lattner
2013-10-04 18:45:09 +00:00
parent 07fda51a37
commit 767da738bb
6 changed files with 17 additions and 15 deletions

View File

@@ -126,9 +126,10 @@ namespace swift {
SILModule *performSILGeneration(TranslationUnit *TU, SILModule *performSILGeneration(TranslationUnit *TU,
unsigned StartElem = 0); unsigned StartElem = 0);
/// performSILMemoryPromotion - Promote alloc_box uses into SSA registers and /// performSILDefiniteInitialization - Perform definitive initialization
/// perform definitive initialization analysis. /// analysis and promote alloc_box uses into SSA registers for later SSA-based
void performSILMemoryPromotion(SILModule *M); /// dataflow passes.
void performSILDefiniteInitialization(SILModule *M);
/// performSILAllocBoxToStackPromotion - Promote alloc_box into stack /// performSILAllocBoxToStackPromotion - Promote alloc_box into stack
/// allocations. /// allocations.

View File

@@ -1,4 +1,4 @@
//===--- MemoryPromotion.cpp - Promote memory to SSA registers ------------===// //===--- DefiniteInitialization.cpp - Perform definite init analysis ------===//
// //
// This source file is part of the Swift.org open source project // This source file is part of the Swift.org open source project
// //
@@ -1259,9 +1259,10 @@ static void lowerRawSILOperations(SILFunction &Fn) {
} }
/// performSILMemoryPromotion - Promote alloc_box uses into SSA registers and /// performSILDefiniteInitialization - Perform definitive initialization
/// perform definitive initialization analysis. /// analysis and promote alloc_box uses into SSA registers for later SSA-based
void swift::performSILMemoryPromotion(SILModule *M) { /// dataflow passes.
void swift::performSILDefiniteInitialization(SILModule *M) {
for (auto &Fn : *M) { for (auto &Fn : *M) {
// Walk through an promote all of the alloc_box's that we can. // Walk through an promote all of the alloc_box's that we can.
checkDefiniteInitialization(Fn); checkDefiniteInitialization(Fn);

View File

@@ -1,4 +1,4 @@
// RUN: %sil-opt %s -memory-promotion -verify | FileCheck %s // RUN: %sil-opt %s -definite-init -verify | FileCheck %s
import Builtin import Builtin
import swift import swift

View File

@@ -1,4 +1,4 @@
// RUN: %sil-opt %s -memory-promotion -verify | FileCheck %s // RUN: %sil-opt %s -definite-init -verify | FileCheck %s
// These are all regression tests to ensure that the memory promotion pass // These are all regression tests to ensure that the memory promotion pass
// doesn't crash. // doesn't crash.

View File

@@ -27,7 +27,7 @@ using namespace swift;
enum class PassKind { enum class PassKind {
AllocBoxToStack, AllocBoxToStack,
StackToSSA, StackToSSA,
MemoryPromotion, DefiniteInit,
CCP, CCP,
DCE, DCE,
DataflowDiagnostics, DataflowDiagnostics,
@@ -50,8 +50,8 @@ Passes(llvm::cl::desc("Passes:"),
"allocbox-to-stack", "Promote memory"), "allocbox-to-stack", "Promote memory"),
clEnumValN(PassKind::StackToSSA, clEnumValN(PassKind::StackToSSA,
"stack-to-ssa", "alloc_stack to SSA"), "stack-to-ssa", "alloc_stack to SSA"),
clEnumValN(PassKind::MemoryPromotion, clEnumValN(PassKind::DefiniteInit,
"memory-promotion", "Promote memory"), "definite-init","definitive initialization"),
clEnumValN(PassKind::CCP, clEnumValN(PassKind::CCP,
"constant-propagation", "constant-propagation",
"Propagate constants"), "Propagate constants"),
@@ -134,8 +134,8 @@ int main(int argc, char **argv) {
case PassKind::StackToSSA: case PassKind::StackToSSA:
performSILStackToSSAPromotion(CI.getSILModule()); performSILStackToSSAPromotion(CI.getSILModule());
break; break;
case PassKind::MemoryPromotion: case PassKind::DefiniteInit:
performSILMemoryPromotion(CI.getSILModule()); performSILDefiniteInitialization(CI.getSILModule());
break; break;
case PassKind::CCP: case PassKind::CCP:
performSILConstantPropagation(CI.getSILModule()); performSILConstantPropagation(CI.getSILModule());

View File

@@ -48,7 +48,7 @@ bool swift::runSILDiagnosticPasses(SILModule &Module) {
auto &Ctx = Module.getASTContext(); auto &Ctx = Module.getASTContext();
performSILMandatoryInlining(&Module); performSILMandatoryInlining(&Module);
performSILMemoryPromotion(&Module); performSILDefiniteInitialization(&Module);
performSILAllocBoxToStackPromotion(&Module); performSILAllocBoxToStackPromotion(&Module);
performSILStackToSSAPromotion(&Module); performSILStackToSSAPromotion(&Module);