From 91e506e404c0d285ec1ec77196e83248c8c77161 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Thu, 22 Oct 2026 03:41:33 +0000 Subject: refactor(codegen): share array metadata registration DECLARE and array-parameter binding both computed the dimension multipliers, filled the same ArrayMetadata and stored it in ArrayTable. Move that into a private ArrayHandler::defineMetadata helper that also yields the total element count. Co-Authored-By: Claude Opus 5.5 --- include/cps/ArrayHandler.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/cps/ArrayHandler.h') diff --git a/include/cps/ArrayHandler.h b/include/cps/ArrayHandler.h index 8ba631f..a09e708 100644 --- a/include/cps/ArrayHandler.h +++ b/include/cps/ArrayHandler.h @@ -47,6 +47,11 @@ class ArrayHandler { const std::vector &Highs, std::vector &Multipliers, llvm::Value *&TotalElements); + // Computes the bounds math, then fills and registers Name's metadata. + const ArrayMetadata &defineMetadata(const std::string &Name, const TypeInfo *ElemInfo, + std::vector Lows, + std::vector Highs, + llvm::Value *&TotalElements); bool emitCheckedIndices(const std::string &Name, const std::vector> &IndexExprs, int Line, -- cgit v1.3.1-4-g156e