Goose  Artifact [5bd795414a]

Artifact 5bd795414ac5069c899d44700367c14e16f743929581ee11ff40620a7e44f044:

  • File bs/codegen/module.h — part of check-in [c5a38bbeae] at 2019-07-25 14:09:37 on branch trunk — Have the llvm context be a static instance instead of being owned by the Env object, so that we can access it anywhere. (user: achavasse size: 715)

#ifndef EMPATHY_CODEGEN_MODULE_H
#define EMPATHY_CODEGEN_MODULE_H

namespace empathy::codegen
{
    class Module
    {
        public:
            Module( const string& name );

            void DumpAsLlvmIr( const string& filename ) const;

            llvm::FunctionType* GetOrCreateFuncType( const builtins::FuncType& ftype );

            llvm::Function* BuildFuncProto( const builtins::Func& func, const string& name );

            llvm::Function* GetOrCreateFunc( const builtins::Func& func );
            llvm::Function* GetOrCreateFunc( const builtins::Func& func, const string& name );

        private:
            llvm::Module m_llvmModule;
            llvm::IRBuilder<> m_llvmBuilder;
    };
}

#endif