diff options
Diffstat (limited to 'include/cps/FunctionGen.h')
| -rw-r--r-- | include/cps/FunctionGen.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/cps/FunctionGen.h b/include/cps/FunctionGen.h index 1dc3901..f55db1b 100644 --- a/include/cps/FunctionGen.h +++ b/include/cps/FunctionGen.h @@ -11,6 +11,14 @@ namespace cps { +// Pseudocode-level signature of a FUNCTION/PROCEDURE, kept so call sites can +// dispatch on declared parameter types and BYREF flags instead of inferring +// them back from LLVM types. +struct FuncSig { + std::string ReturnTypeName; + std::vector<std::pair<std::string, bool>> Params; // (TypeName, IsByRef) +}; + class FunctionGen { llvm::LLVMContext &Context; llvm::Module &Module; @@ -21,6 +29,8 @@ class FunctionGen { std::map<std::string, SymbolInfo> &Symbols; bool &HadError; + std::map<std::string, FuncSig> Signatures; + void createArgumentAllocas(llvm::Function *F, const std::vector<std::tuple<std::string, std::string, bool>> &Args); public: @@ -35,6 +45,8 @@ public: llvm::Type *getLLVMType(const std::string &TypeName); + const FuncSig *getSignature(const std::string &Name) const; + llvm::Function *emitPrototype(PrototypeAST *Proto); llvm::Function *emitFunctionDef(FunctionDefAST *FuncAST, const std::function<void(StmtAST*)> &StmtEmitter); |
