aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-22 03:41:33 +0000
committer_ov4 <ov4@ov4.org>2026-10-22 03:58:26 +0000
commit91e506e404c0d285ec1ec77196e83248c8c77161 (patch)
treeadffdea64cc44d59f234293a7fb83a09abb92022 /include
parent0798836375047a051ad4bffa500e8e819fd51c5e (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'include')
-rw-r--r--include/cps/ArrayHandler.h5
1 files changed, 5 insertions, 0 deletions
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<llvm::Value*> &Highs,
std::vector<llvm::Value*> &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<llvm::Value*> Lows,
+ std::vector<llvm::Value*> Highs,
+ llvm::Value *&TotalElements);
bool emitCheckedIndices(const std::string &Name,
const std::vector<std::unique_ptr<ExprAST>> &IndexExprs,
int Line,