Hard cutover policy: lowering builds a typed IR model, and emission serializes that model. No mixed semantic checks inside IR emission, no report text construction inside codegen, no direct string assembly for structured metadata.
Source facts already established:
native/objc3c/src/ir/objc3_ir_emitter.cpp has 14,665 lines.
Objc3IREmitter owns expression emission, statement emission, function emission, method emission, runtime metadata, proof comments, entrypoint generation, property storage, synthesized methods, and lowering summaries.
native/objc3c/src/lower/objc3_lowering_contract.cpp has 5,077 lines and mixes contracts with implementation-ready lowerable state.
Required lowering tree:
native/objc3c/src/lower/core/
lowering_context.h/.cpp
lowering_result.h
lowering_diagnostics.h/.cpp
native/objc3c/src/lower/model/
lowered_module.h/.cpp
lowered_function.h/.cpp
lowered_value.h/.cpp
lowered_type.h/.cpp
native/objc3c/src/lower/expr/
literal_lowering.h/.cpp
identifier_lowering.h/.cpp
call_lowering.h/.cpp
message_send_lowering.h/.cpp
keypath_lowering.h/.cpp
block_literal_lowering.h/.cpp
native/objc3c/src/lower/stmt/
statement_lowering.h/.cpp
control_flow_lowering.h/.cpp
defer_lowering.h/.cpp
error_lowering.h/.cpp
concurrency_lowering.h/.cpp
native/objc3c/src/lower/objc/
class_metadata_lowering.h/.cpp
method_lowering.h/.cpp
property_lowering.h/.cpp
dispatch_lowering.h/.cpp
native/objc3c/src/lower/ownership/
arc_lowering.h/.cpp
autorelease_lowering.h/.cpp
weak_lowering.h/.cpp
Required IR tree:
native/objc3c/src/ir/model/
ir_module.h/.cpp
ir_function.h/.cpp
ir_instruction.h/.cpp
ir_metadata.h/.cpp
native/objc3c/src/ir/write/
ir_text_writer.h/.cpp
ir_metadata_writer.h/.cpp
ir_constant_writer.h/.cpp
native/objc3c/src/ir/emit/
module_emitter.h/.cpp
function_emitter.h/.cpp
expression_emitter.h/.cpp
statement_emitter.h/.cpp
objc_metadata_emitter.h/.cpp
runtime_call_emitter.h/.cpp
entrypoint_emitter.h/.cpp
Required work:
- Split lowering from IR text emission.
- Move runtime ABI symbol names into
ir/emit/runtime_call_emitter.*.
- Move metadata record construction into
lower/objc/* and serialization into ir/write/*.
- Move proof, readiness, and report strings to
artifacts/.
- Replace direct string concatenation for structured metadata with IR metadata writer APIs.
- Delete old monolithic
objc3_ir_emitter.cpp and oversized lowering contract implementation.
Maximum effort shared hoist pass:
- Hoist identifier-safe suffix logic to
support/identifiers/.
- Hoist global initializer evaluation to
lower/core/constant_eval.*.
- Hoist runtime ABI name construction to
ir/emit/runtime_call_emitter.*.
- Hoist stable metadata ordering to
support/stable_order/.
Acceptance criteria:
- No IR or lowering source file exceeds 1,500 lines.
- IR emission consumes a typed lowered module.
- Metadata serialization uses writer APIs.
- Codegen tests cover expressions, statements, message sends, properties, blocks, errors, and entrypoint emission through module-level fixtures.
Hard cutover policy: lowering builds a typed IR model, and emission serializes that model. No mixed semantic checks inside IR emission, no report text construction inside codegen, no direct string assembly for structured metadata.
Source facts already established:
native/objc3c/src/ir/objc3_ir_emitter.cpphas 14,665 lines.Objc3IREmitterowns expression emission, statement emission, function emission, method emission, runtime metadata, proof comments, entrypoint generation, property storage, synthesized methods, and lowering summaries.native/objc3c/src/lower/objc3_lowering_contract.cpphas 5,077 lines and mixes contracts with implementation-ready lowerable state.Required lowering tree:
native/objc3c/src/lower/core/lowering_context.h/.cpplowering_result.hlowering_diagnostics.h/.cppnative/objc3c/src/lower/model/lowered_module.h/.cpplowered_function.h/.cpplowered_value.h/.cpplowered_type.h/.cppnative/objc3c/src/lower/expr/literal_lowering.h/.cppidentifier_lowering.h/.cppcall_lowering.h/.cppmessage_send_lowering.h/.cppkeypath_lowering.h/.cppblock_literal_lowering.h/.cppnative/objc3c/src/lower/stmt/statement_lowering.h/.cppcontrol_flow_lowering.h/.cppdefer_lowering.h/.cpperror_lowering.h/.cppconcurrency_lowering.h/.cppnative/objc3c/src/lower/objc/class_metadata_lowering.h/.cppmethod_lowering.h/.cppproperty_lowering.h/.cppdispatch_lowering.h/.cppnative/objc3c/src/lower/ownership/arc_lowering.h/.cppautorelease_lowering.h/.cppweak_lowering.h/.cppRequired IR tree:
native/objc3c/src/ir/model/ir_module.h/.cppir_function.h/.cppir_instruction.h/.cppir_metadata.h/.cppnative/objc3c/src/ir/write/ir_text_writer.h/.cppir_metadata_writer.h/.cppir_constant_writer.h/.cppnative/objc3c/src/ir/emit/module_emitter.h/.cppfunction_emitter.h/.cppexpression_emitter.h/.cppstatement_emitter.h/.cppobjc_metadata_emitter.h/.cppruntime_call_emitter.h/.cppentrypoint_emitter.h/.cppRequired work:
ir/emit/runtime_call_emitter.*.lower/objc/*and serialization intoir/write/*.artifacts/.objc3_ir_emitter.cppand oversized lowering contract implementation.Maximum effort shared hoist pass:
support/identifiers/.lower/core/constant_eval.*.ir/emit/runtime_call_emitter.*.support/stable_order/.Acceptance criteria: