Artifact c39a3720e366116f5afdc259151e48eb1d76a544dc40bc72255e99ad7bf1ad86:
- 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)
#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(); } }