Goose  Diff

Differences From Artifact [7cb181e6a4]:

  • File bs/compiler.cpp — part of check-in [f31afce8ce] at 2019-07-26 22:30:22 on branch trunk —
    • Implemented an unification rule of ct_integer versus rt_integer.
    • Fixed multiple bugs related to compile time eager evaluation.
    • Fixed incorrect usage of CompileFunc which resulted in not actually calling the domain specific version of the function.
    (user: achavasse size: 1681)

To Artifact [b44bdda11e]:

  • File bs/compiler.cpp — part of check-in [0d6a77f7ab] at 2019-07-28 17:22:26 on branch trunk — codegen: added functions to set the target for a module, and to output a module either as an asm or as an object file. (user: achavasse size: 1904)

1
2
3
4
5

6
7
8
9
10
11
12
1
2
3
4
5
6
7
8
9
10
11
12
13





+







#include "compiler.h"
#include "builtins/builtins.h"
#include "builtins/helpers.h"
#include "sema/sema.h"
#include "execute/execute.h"
#include "llvm/Support/TargetSelect.h"

using namespace empathy;
using namespace empathy::util;
using namespace empathy::ir;

Compiler::Compiler( int argc, char** argv ) :
    m_pEnv( make_shared< sema::Env >() )
28
29
30
31
32
33
34






35
36
37
38
39
40
41
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48







+
+
+
+
+
+







        } );

    builtins::RegisterBuiltinFunc< void ( string ) >( *m_pEnv, "Print"_sid,
        []( const string& str )
        {
            cout << str << endl;
        } );

    llvm::InitializeAllTargetInfos();
    llvm::InitializeAllTargets();
    llvm::InitializeAllTargetMCs();
    llvm::InitializeAllAsmParsers();
    llvm::InitializeAllAsmPrinters();
}

uint64_t Compiler::execute( istream& source, const ptr< string >& filename )
{
    sema::Context c( m_pEnv, builtins::RootIdentity(), GetValueType< uint64_t >() );

    auto r = make_shared< parse::Resolver >( make_shared< lex::Lexer >( source, filename ), c );