Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/MLIRGen-refactoring-review.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Benefits: parallel builds (this single TU dominates incremental build time), sma

Mechanically safest path: keep `MLIRGenImpl` as-is, move method *bodies* out with no signature changes, verify with the existing test suite after each batch.

*Status: in progress.* First slice landed: the class moved out of MLIRGen.cpp's anonymous namespace into `typescript::mlirgen` in a private header `lib/TypeScript/MLIRGenImpl.h` (bodies still inline; each subsequent slice replaces a family's inline bodies with declarations and moves the definitions to a new TU). `MLIRGenCast.cpp` is the first satellite: the contiguous cast family (`selectFieldsValues` … `createBoundMethodFromExtensionMethod`, 29 methods) defined out-of-line. Enabling fixes: `GenContext`/`PassResult`/`ValueOrLogicalResult` in `MLIRGenContext.h` were in an anonymous namespace **in a header** (each TU got distinct types — worked only because there was one TU); they now live in `namespace typescript`. `ts::print(Node)` in `dump.h` was a non-inline header definition — now `inline`. The TU-static `compileOptionsPtr` stays in MLIRGen.cpp behind a new `setCompileOptions()` so inline code never references a TU-local. Second slice: `MLIRGenTypes.cpp` — the type-resolution family (`getType` … `getNullType`, 134 methods, ~3,400 lines) moved out-of-line; the lone template member (`getIndexedAccessTypeForArray<T>`) stays inline in the header. Third slice: `MLIRGenModule.cpp` — the module/discovery/include/import driver (`report` … `mlirGen(ImportDeclaration)`, 24 methods, ~930 lines); method-level `#ifdef` guards (`GENERATE_IMPORT_INFO_USING_D_TS_FILE`) are kept around both the declarations and the moved definitions. Remaining units to peel off per the table above; header hygiene (§8) comes after the last one.
*Status: in progress.* First slice landed: the class moved out of MLIRGen.cpp's anonymous namespace into `typescript::mlirgen` in a private header `lib/TypeScript/MLIRGenImpl.h` (bodies still inline; each subsequent slice replaces a family's inline bodies with declarations and moves the definitions to a new TU). `MLIRGenCast.cpp` is the first satellite: the contiguous cast family (`selectFieldsValues` … `createBoundMethodFromExtensionMethod`, 29 methods) defined out-of-line. Enabling fixes: `GenContext`/`PassResult`/`ValueOrLogicalResult` in `MLIRGenContext.h` were in an anonymous namespace **in a header** (each TU got distinct types — worked only because there was one TU); they now live in `namespace typescript`. `ts::print(Node)` in `dump.h` was a non-inline header definition — now `inline`. The TU-static `compileOptionsPtr` stays in MLIRGen.cpp behind a new `setCompileOptions()` so inline code never references a TU-local. Second slice: `MLIRGenTypes.cpp` — the type-resolution family (`getType` … `getNullType`, 134 methods, ~3,400 lines) moved out-of-line; the lone template member (`getIndexedAccessTypeForArray<T>`) stays inline in the header. Third slice: `MLIRGenModule.cpp` — the module/discovery/include/import driver (`report` … `mlirGen(ImportDeclaration)`, 24 methods, ~930 lines); method-level `#ifdef` guards (`GENERATE_IMPORT_INFO_USING_D_TS_FILE`) are kept around both the declarations and the moved definitions. Fourth slice: `MLIRGenGenerics.cpp` — generic inference and specialization (`tryInferNamedGeneric` … `mlirGen(ExpressionWithTypeArguments)`: the `tryInfer*` family, `inferType`, `instantiateSpecializedFunction/ClassType/InterfaceType`, `resolveGenericParams*`, `mlirGenSpecialized`; 26 methods, ~1,400 lines); `tryInferTupleFields<T>` stays inline. Remaining units to peel off per the table above; header hygiene (§8) comes after the last one.

## 2. Kill the dangling-`FuncOp` hazard in the symbol maps

Expand Down
1 change: 1 addition & 0 deletions tslang/lib/TypeScript/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ add_mlir_dialect_library(MLIRTypeScript
DiagnosticHelper.cpp
MLIRGen.cpp
MLIRGenCast.cpp
MLIRGenGenerics.cpp
MLIRGenModule.cpp
MLIRGenTypes.cpp
LowerToAffineLoops.cpp
Expand Down
Loading
Loading