From 4619377409f28f35cfd9bf0f6ed2bd1094e66c16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20De=20Canni=C3=A8re?= Date: Mon, 4 Mar 2024 09:45:34 +0100 Subject: Compiler: Extract Basic blocks generation into its own compiler pass The old basic blocks pass was responsible for two things: the basic blocks generation and dead code analysis/type adjustments based on those blocks and the type propagation performed earlier. Now the basic blocks get generated first, even before the type propagation and the dead code analysis and type adjustments are now grouped in a pass called QQmlJSOptimizations. The rest of the passes remain unchanged. Change-Id: I7b4303eaf67c761a49b82ab194e5d035d24d2615 Reviewed-by: Fabian Kosmale Reviewed-by: Ulf Hermann --- src/qmlcompiler/qqmljsstoragegeneralizer.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/qmlcompiler/qqmljsstoragegeneralizer.cpp') diff --git a/src/qmlcompiler/qqmljsstoragegeneralizer.cpp b/src/qmlcompiler/qqmljsstoragegeneralizer.cpp index 543dec9ff6..077c1dcc01 100644 --- a/src/qmlcompiler/qqmljsstoragegeneralizer.cpp +++ b/src/qmlcompiler/qqmljsstoragegeneralizer.cpp @@ -19,9 +19,8 @@ QT_BEGIN_NAMESPACE * operates only on the annotations and the function description. */ -QQmlJSCompilePass::InstructionAnnotations QQmlJSStorageGeneralizer::run( - InstructionAnnotations annotations, Function *function, - QQmlJS::DiagnosticMessage *error) +QQmlJSCompilePass::BlocksAndAnnotations +QQmlJSStorageGeneralizer::run(Function *function, QQmlJS::DiagnosticMessage *error) { m_error = error; @@ -32,7 +31,7 @@ QQmlJSCompilePass::InstructionAnnotations QQmlJSStorageGeneralizer::run( } else { setError(QStringLiteral("Cannot store the return type %1.") .arg(returnType->internalName(), 0)); - return InstructionAnnotations(); + return {}; } } @@ -53,12 +52,12 @@ QQmlJSCompilePass::InstructionAnnotations QQmlJSStorageGeneralizer::run( transformRegister(argument); } - for (auto i = annotations.begin(), iEnd = annotations.end(); i != iEnd; ++i) { + for (auto i = m_annotations.begin(), iEnd = m_annotations.end(); i != iEnd; ++i) { transformRegister(i->second.changedRegister); transformRegisters(i->second.typeConversions); } - return annotations; + return { std::move(m_basicBlocks), std::move(m_annotations) }; } QT_END_NAMESPACE -- cgit v1.2.3