Goose  Diff

Differences From Artifact [c39a3720e3]:

  • File bs/llr/helpers.cpp — part of check-in [8ddd71f9b2] at 2020-12-18 01:29:15 on branch trunk — References refactor: references are now values all the way to the llr, where a new "CalcAddress" instruction represents a conversion from a logical address (location + path) into an actual runtime or compilation time address. This is in preparation to allow references to be stored in variables or passed as parameters. (It just took 4.5 months to finish this... Refactoring just sucks) (user: achavasse size: 656)

To Artifact [a4c91addd1]:

  • File bs/cir/helpers.cpp — part of check-in [7d2def7b75] at 2020-12-27 14:40:24 on branch trunk — Renamed "ir" to "eir" (expression intermediate representation) and "llr" to "cir" (code intermediate representation) for clarity. (user: achavasse size: 659)

1

2
3

4
5

6
7
8
9
10

11
12
13

14
15
16
17
18

19
20
21

22
23
24
25
26

27
28
29

1
2

3
4

5
6
7
8
9

10
11
12

13
14
15
16
17

18
19
20

21
22
23
24
25

26
27
28
29
-
+

-
+

-
+




-
+


-
+




-
+


-
+




-
+



#include "llr/llr.h"
#include "cir/cir.h"

namespace goose::llr
namespace goose::cir
{
    bool IsValueConstantOrExecutable( const ir::Value& val )
    bool IsValueConstantOrExecutable( const eir::Value& val )
    {
        if( val.isConstant() )
            return true;

        return val.llr()->canBeExecuted();
        return val.cir()->canBeExecuted();
    }

    bool CanValueBeEagerlyEvaluated( const ir::Value& val )
    bool CanValueBeEagerlyEvaluated( const eir::Value& val )
    {
        if( val.isConstant() )
            return true;

        return val.llr()->canBeEagerlyEvaluated();
        return val.cir()->canBeEagerlyEvaluated();
    }

    bool IsCompileTimeTempRef( const ir::Value& val )
    bool IsCompileTimeTempRef( const eir::Value& val )
    {
        if( !val.isConstant() )
            return false;

        const auto* pRefInst = get_if< CalcAddress >( &val.llr()->content() );
        const auto* pRefInst = get_if< CalcAddress >( &val.cir()->content() );
        return pRefInst && pRefInst->isTempRef();
    }
}