Skip to content

add IR builder methods to BaseGenerator and IGeneratorContext#12

Merged
cs01 merged 1 commit intomainfrom
shard-c-ir-builder-methods
Feb 19, 2026
Merged

add IR builder methods to BaseGenerator and IGeneratorContext#12
cs01 merged 1 commit intomainfrom
shard-c-ir-builder-methods

Conversation

@cs01
Copy link
Owner

@cs01 cs01 commented Feb 19, 2026

Summary

  • Add 7 IR builder methods to BaseGenerator, IGeneratorContext, and MockGeneratorContext (three-way sync): emitCall, emitCallVoid, emitLoad, emitStore, emitGep, emitIcmp, emitBitcast
  • Each method auto-allocates a temp register, emits the LLVM IR instruction, tracks the result type via setVariableType(), and returns the register name
  • Pilot migration: convert DateGenerator.generateNow() in date.ts to use the new builders as proof of concept

This is Shard C of the compiler rearchitecture plan. All files are disjoint from Shards A/B/D.

Files changed

  • src/codegen/infrastructure/base-generator.ts — builder method implementations
  • src/codegen/infrastructure/generator-context.ts — interface declarations + mock implementations
  • src/codegen/stdlib/date.ts — pilot migration (5 of 10 nextTemp+emit pairs replaced with single-line builder calls)

Test plan

  • npm run build passes clean
  • npm test — 324 passing, 18 failing (all pre-existing try-catch failures, identical to clean main)
  • npm run verify:quick — self-hosting stages pass, same pre-existing failures only

@cs01 cs01 merged commit c91b500 into main Feb 19, 2026
11 checks passed
@cs01 cs01 deleted the shard-c-ir-builder-methods branch February 19, 2026 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments