From 4a25b279d8f6c662fa8152cfe42e038d1ea06901 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sun, 26 Jul 2026 12:07:51 +0000 Subject: refactor: keep pseudocode signatures, single call-marshalling path emitPrototype now records each FUNCTION/PROCEDURE's pseudocode signature (FuncSig: return type + per-param type/BYREF flag). CodeGen:: marshalCallArgs replaces the two verbatim-duplicated marshalling blocks and dispatches on the declared signature instead of inferring BYREF from pointer-typed LLVM params: BYVAL STRING params now receive the string data pointer (no more runtime garbage), and BYVAL args are coerced to the declared type (INTEGER->REAL args no longer emit invalid IR). Top-level prototypes are pre-registered in compile(), so calls may precede definitions; GenerateCall no longer fabricates i64 externs for unknown names - an unregistered callee is a compile error. OUTPUT reports an error when it cannot infer the expression type instead of printing with the INTEGER format. Co-Authored-By: Claude Fable 5 --- include/cps/CodeGen.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/cps/CodeGen.h') diff --git a/include/cps/CodeGen.h b/include/cps/CodeGen.h index 268ba7e..b1d3831 100644 --- a/include/cps/CodeGen.h +++ b/include/cps/CodeGen.h @@ -69,6 +69,9 @@ class CodeGen { const SymbolInfo *getSymbolInfo(const std::string &Name) const; const TypeInfo *getExprTypeInfo(ExprAST *Expr) const; llvm::Value *coerceValueToType(llvm::Value *Val, const TypeInfo *TargetInfo); + bool marshalCallArgs(const std::string &Callee, + const std::vector> &ArgExprs, + std::vector &Out); void emitDeclareStmt(DeclareStmtAST *Stmt); void emitOutputValue(llvm::Value *Val, const TypeInfo *TypeInfo, bool AppendNewline = true); -- cgit v1.3.1-4-g156e