#include "cir/cir.h"

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

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

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

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

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

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