diff options
Diffstat (limited to 'include/cps')
| -rw-r--r-- | include/cps/CodeGen.h | 1 | ||||
| -rw-r--r-- | include/cps/FunctionGen.h | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/include/cps/CodeGen.h b/include/cps/CodeGen.h index 04bf25c..d81a82c 100644 --- a/include/cps/CodeGen.h +++ b/include/cps/CodeGen.h @@ -155,6 +155,7 @@ class CodeGen { const std::vector<std::unique_ptr<ExprAST>> &ArgExprs, int Line); const FuncSig *resolveCall(const std::string &Name, const std::vector<std::unique_ptr<ExprAST>> &Args); + llvm::Value *emitVariadicArgument(ExprAST *Expr, const std::string &Callee, size_t Position); bool marshalCallArgs(const FuncSig &Signature, const std::vector<std::unique_ptr<ExprAST>> &ArgExprs, int Line, diff --git a/include/cps/FunctionGen.h b/include/cps/FunctionGen.h index c168e1c..5eb0f82 100644 --- a/include/cps/FunctionGen.h +++ b/include/cps/FunctionGen.h @@ -43,6 +43,12 @@ struct FuncSig { std::string ReturnTypeName; std::vector<ParamSig> Params; size_t OwnerUnit = 0; + // EXTERN "C": called through its declared C type, which may differ from a + // runtime declaration of the same libc symbol. + bool IsExternal = false; + bool IsVariadic = false; + llvm::FunctionType *ExternType = nullptr; + llvm::AttributeList ExternAttrs; }; class FunctionGen { @@ -103,10 +109,12 @@ public: const FuncSig *getSignatureByLink(const std::string &Name) const; llvm::Function *emitPrototype(PrototypeAST *Proto); + bool emitExternPrototype(PrototypeAST *Proto); llvm::Function *emitFunctionDef(FunctionDefAST *FuncAST, const std::function<void(StmtAST*)> &StmtEmitter, unsigned ScopeID); llvm::Value *emitCall(const std::string &Callee, const std::vector<llvm::Value*> &Args); + llvm::Value *emitCall(const FuncSig &Sig, const std::vector<llvm::Value*> &Args); void emitReturn(ReturnStmtAST *Ret, llvm::Value *RetVal); }; |
