From 1749b2b4a3e55db7c9bed95376f99b7f07932b49 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sun, 26 Jul 2026 12:15:33 +0000 Subject: refactor: drop per-type micro handlers and the parallel NamedValues map Integer/Real/Boolean/CharHandler carried only five one-line LLVM API wrappers (now inlined at their call sites in CodeGen.cc) plus dead emitDeclare methods that violated the documented two-table lock-step invariant. StringHandler::emitDeclare (also dead) and its NamedValues reference go too. With the dead writers gone, NamedValues held no information not already in Symbols[].Storage, so the parallel map is removed: getNamedValue reads Symbols, ArrayHandler/FunctionGen take one table, and function bodies save/restore a single map. Behavior unchanged. Co-Authored-By: Claude Fable 5 --- lib/CodeGen/ArrayHandler.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lib/CodeGen/ArrayHandler.cc') diff --git a/lib/CodeGen/ArrayHandler.cc b/lib/CodeGen/ArrayHandler.cc index af16692..83204a7 100644 --- a/lib/CodeGen/ArrayHandler.cc +++ b/lib/CodeGen/ArrayHandler.cc @@ -12,14 +12,12 @@ using namespace cps; ArrayHandler::ArrayHandler(LLVMContext &C, IRBuilder<> &B, Module &M, - std::map &NV, std::map &Sym, TypeSystem &TS, RuntimeCheck &RC) : TheContext(&C), Builder(&B), TheModule(&M), - NamedValues(&NV), Symbols(&Sym), Types(TS), RuntimeChecker(RC) { @@ -58,11 +56,11 @@ Value *ArrayHandler::computeFlatIndex(const std::string &Name, const std::vector } Value *ArrayHandler::getArrayBasePointer(const std::string &Name) { - auto It = NamedValues->find(Name); - if (It == NamedValues->end() || !It->second) { + auto It = Symbols->find(Name); + if (It == Symbols->end() || !It->second.Storage) { return nullptr; } - return Builder->CreateLoad(PointerType::getUnqual(*TheContext), It->second, (Name + "_raw").c_str()); + return Builder->CreateLoad(PointerType::getUnqual(*TheContext), It->second.Storage, (Name + "_raw").c_str()); } Value *ArrayHandler::getElementPointer(const std::string &Name, Value *Offset) { -- cgit v1.3.1-4-g156e