#include "llr/llr.h"

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

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

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

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

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

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